Nodes/MiniMax-H3 Prompt Rewriter/MiniMax-H3 Reduce Prompt (any LLM)
ComfyUI Node

MiniMax-H3 Reduce Prompt (any LLM)

The MiniMax-H3 reducer that never runs a model

By pytraveler·Created about a month ago·Updated 2 days ago· 144
MiniMax-H3 Reduce Prompt (any LLM)
    • system_prompt
    • user_prompt
    • prompt
    • scene
    prompt
    detailsentence
    subjectsas written
    keep_camerafalse
    keep_audiofalse
    keep_stylefalse
    language
    formatplain
    system_prompt

    Same job as the pack's MiniMax-H3 Prompt Reducer - turn a finished, four-hundred-word MiniMax-H3 prompt back into the one-line idea it came from - but this node never runs a model. It builds the two messages and hands them back as strings, for whatever LLM node you already have in the graph. Local, API, remote, it doesn't care. Cost: no VRAM, no download, about 0.01 seconds.

    That makes it the right pick when your workflow already owns an LLM you like. ComfyUI's own Generate Text (since 0.30), an Ollama node, a call out to a bigger cloud model - if you're already paying for or hosting one, why make the pack download and load a second one just to shorten a paragraph? This node is also the transparent option: the entire instruction it would send is sitting there as text on the output sockets, so you can read exactly what's being asked, and edit it if you want.

    What it does

    An H3 prompt is scaffolding wrapped around prose - field labels, the alignment sentence, [Shot n] markers, <Picture n> tags, <d> dialogue fences, whole soundscape and music sections. The node strips all of that here, by rule, before anything reaches a model. That's the part worth emphasizing: the parsing is pure Python in the pack, not an LLM's job, so the scene your model receives is already clean ordinary description. No model has touched the fourth output.

    Then it assembles the shortening instruction with the same steering widgets as its running sibling:

    • detail - idea (bare line), sentence (allows place and time), paragraph (one sentence per event, for prompts with several shots).
    • subjects - as written, age and gender, or impersonal (people become "a subject" - for templates you fill in later).
    • keep_camera / keep_audio / keep_style - all off by default; with keep_audio off the sound sections are dropped by the parser before the model ever sees them.
    • language - the honest caveat: this node can only build one request, so here the language is a rule inside the instruction, obeyed or not depending on the model. It can't do the running Reducer's two-pass "shorten, then translate" trick. If you ask for Russian and get English, that's why - the Reducer is the reliable path for translation.

    format is the one input this node has that the Reducer doesn't. It decides how the third output, prompt, joins the first two. plain (default) puts a blank line between system and user text and lets the LLM node apply its own chat template - which lands the whole instruction in the user turn. chatml writes the turns out instead, so a Qwen text encoder takes the guide as a real system message. On a model that isn't ChatML, leave it on plain.

    Outputs and wiring

    Four of them:

    • system_prompt and user_prompt - the two halves, for an LLM node that takes separate system and user inputs.
    • prompt - both joined, for the many nodes that take exactly one string. This is the one most people wire.
    • scene - the cleaned description with scaffolding stripped and nothing else done to it. Wire this when the deterministic half is all you wanted; it's the same output the running Reducer produces.

    Installing it

    From ComfyUI Manager (search MiniMax-H3-Prompt-Rewriter-ComfyUI) or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/pytraveler/MiniMax-H3-Prompt-Rewriter-ComfyUI
    

    Then restart. Nothing else is required for this node - no pip packages, no model downloads. It doesn't load anything at all. The heavy requirements you'll see in the pack's requirements.txt (transformers, peft, bitsandbytes) belong to the 27B LoRA rewriter route, which is a different part of this pack entirely.

    Choosing between the two reducers

    Honest guidance: run the Prompt Reducer when you just want the pack to handle everything end-to-end with a small local GGUF - a ~2.6 GB 4B does this job fine, since the format is already gone before the model sees anything. Use this one when you already have an LLM node wired up (or want a bigger/uncensored/remote model doing the writing), or when you want the instruction visible and tunable. It's a thin node by design - but the deterministic half, the parsing, is identical in both, and that's the half doing the real work.

    CategoryMiniMax-H3

    Inputs (9)

    NameTypeDefaultDescription
    promptSTRINGThe finished prompt to shorten. Any of the five tasks, and it does not have to be said which: the text is split against every field name either family uses, and one with no field names at all is read whole as the description. A writer node's output, a loaded text file, or something pasted in.
    detailCOMBOsentenceHow much comes back. 'idea' is the bare line -- one short sentence, ten words at most. 'sentence' allows the place and the time of day. 'paragraph' keeps one sentence per thing that actually happens, which is what a prompt with several shots needs if the order is to survive. The example the model is shown is picked to match, which does more for the length than the instruction does.
    subjectsCOMBOas writtenHow specifically the subjects are named. Separate from the length: a one-line prompt can still say 'a woman in a red coat'. 'as written' keeps appearance and clothing. 'age and gender' cuts every person down to 'a young woman', 'an elderly man'. 'impersonal' drops even that: a person becomes 'a subject' and anything else its bare kind. 'impersonal' is for templates you fill in afterwards. Fed to a generator as it stands, it produces exactly the anonymous nothing it asks for.
    keep_cameraBOOLEANfalseKeep the shot size, the angle and the camera move. Off by default: the camera is usually the writer's invention rather than yours, and leaving it out lets the next rewrite choose again.
    keep_audioBOOLEANfalseFold the soundscape and the music into one clause at the end. Off by default, and off means the sound sections never reach the model at all -- they are dropped by the parser, not by the instruction.
    keep_styleBOOLEANfalseKeep the medium and the look the prompt opens with -- live-action, animation, cinematic, documentary. Worth turning on when the look is the point and not a default.
    languageSTRINGWhich language the short prompt comes back in. Empty means the language of the input, which for an H3 prompt is English. Write a language name: English, Russian, Chinese, Deutsch -- whatever the model is likely to recognise. The Reducer does this as a second pass: it shortens first and translates the finished line afterwards, in its own request. Asking for both at once does not work -- the worked example in the instruction is in English, and a model copying the demonstration copies its language with it. Translating afterwards has one objective and no example to copy, and small models obey it. It costs one short generation on a model already loaded. 'Reduce Prompt (any LLM)' can only build one request, so there the language is a rule inside it and is obeyed or not depending on the model. If a short prompt comes back from that node in the wrong language, this is why, and the Reducer is the reliable path.
    formatoptCOMBOplainHow the third output joins the two. 'plain' puts a blank line between them and lets the LLM node apply the model's own chat template, which lands the instruction in the user turn. 'chatml' writes the turns out instead, so a Qwen text encoder takes it as a real system message and skips its thinking block; on a model that is not ChatML, leave this on 'plain'.
    system_promptoptSTRINGReplace the whole assembled instruction with your own. 'detail', 'subjects' and the three keeps then stop applying -- they exist only to build the text this overrides. 'language' still applies on the Reducer, because there it is not part of this text at all: it is a second request made after yours has answered. The parsing still happens either way. Stripping shot markers and reference tags is right whatever the instruction over them says, so what your system prompt is handed is the cleaned scene, not the raw text.

    Outputs (4)

    NameTypeDescription
    system_promptSTRING
    user_promptSTRING
    promptSTRING
    sceneSTRINGThe description with the scaffolding taken off and nothing else done to it -- no model has touched this. Wire it when the deterministic half is all you wanted: the prose of a prompt, with the field names, shot markers and reference tags gone.