MiniMax H3-Image Prompt Upsampler ๐
One Messy Sentence In, a Caption H3-Image Can Actually Use Out
- llm_service_connector
- reference_images
- prompt
- aspect_ratio
- raw_reply
This node generates no pixels. It takes the half-sentence you actually typed - "girl on a rooftop at night, neon, cinematic" - and returns a full English caption plus an aspect ratio, in the shape MiniMax's H3-Image prompt guide asks for. That's the whole job, and it's the step people skip before wondering why the model gives them mush.
It's an upsampler, not a generator, and the distinction has teeth: the same pack ships MiniMaxH3PromptGenerator for the H3 video model, and the source is blunt - "the two are different models and must not be swapped." Prompt full of camera moves and shot durations? Wrong node.
Why put an LLM in the loop
H3-Image ships a page of rules about caption structure. A language model reads that page and rewrites for you - what our LLM-in-ComfyUI doc calls a translation between two things that speak the same language. The catch it flags is dirty output: a chat model wants to open with "Here's your enhanced prompt:" and wrap everything in markdown. This node doesn't regex that away. It asks for one JSON object and refuses anything else, which is the structure-beats-syntax argument taken literally.
How it works
The node loads the official H3-Image prompt-enhancement system prompt and sends your draft as input_text. Expected reply:
{"expanded_caption": "...", "aspect_ratio": "4:3"}
It tolerates a fenced block or a <think> wrapper, sends one corrective turn ("ONE JSON object") on an unusable reply, then fails loudly. Quoted text has to survive: put "Quarterly sales" in your draft, get a caption that dropped it, and the run errors instead of rendering the wrong sign. Body text comes back in English, quoted strings verbatim, and ComfyUI's change-guard means re-queueing identical inputs won't burn a second API call.
The two modes
mode is the task axis. t2i (ๆ็ๅพๅขๅผบ) is the default: draft in, English caption plus one ratio out.
edit (ๅพๅ็ผ่พๅขๅผบ) takes an instruction plus reference images - the picture being edited first, extras after - and returns a three-part caption plus a target ratio. It needs a vision-capable connector, because the official edit prompt makes the model look at the sources and cite them as <Picture 1>, <Subject 1>; leave reference_images empty and it raises. It reads each ratio off the actual pixels rather than letting the model guess, and puts your instruction last. Those images reach the LLM only - the image model gets them through the conditioning node instead.
Inputs and outputs that matter
Set user_input, then mode and aspect_ratio. Left on adaptive the model chooses; t2i accepts only the ten official values - 1:1, 5:4, 4:3, 3:2, 16:9, 21:9, 4:5, 3:4, 2:3, 9:16 - and anything else falls back to adaptive with a log line. Edit mode takes any positive-integer W:H, because the official edit prompt refuses a preset list.
Don't touch temperature unless you know why. The default is 1.0, the official PE value, and the tooltip warns you off the 0.7 the pack's MOSS node uses - that one belongs to MOSS. max_tokens defaults to 16384 though the official PE asks for 4096, since a reasoning model burns budget thinking before the caption starts, and the call auto-escalates when the think chain starves the answer. A fixed seed plus a fixed model is your only reproducibility lever; the PE isn't deterministic.
Three string outputs. prompt feeds the H3-Image conditioning node's prompt field. aspect_ratio feeds your resolution control - a ratio, not pixels; the canvas (4 MP to 20 MP, best around 16 MP, edges in multiples of 32) belongs to your image workflow, so if your resolution node only takes width and height ints, set those by hand. raw_reply is the unparsed reply, for debugging.
Installing it
Manager โ search MieNodes โ install โ restart is the easy path (it's on the Comfy Registry). By hand:
cd ComfyUI/custom_nodes
git clone https://github.com/MieMieeeee/ComfyUI-MieNodes
pip install -r ComfyUI-MieNodes/requirements.txt
That last line isn't garnish. The node is a thin shell over three PyPI packages - comfyui-mie-llm, comfyui-mie-prompt, comfyui-mie-craft - and sixteen modules import them at load time, so a missing one takes the whole pack down. The >=0.2.1 on comfyui-mie-prompt matters too: 0.2.0 still has the old _guide modes and no t2i/edit axis.
No model files to download. You need a connector - any of the pack's Set*LLMServiceConnector nodes (OpenAI, Gemini, Claude, SiliconFlow, ZhiPu, or local Ollama with no key) into llm_service_connector. Keys can sit in mie_llm_keys.json in the plugin folder instead of on the node.
Where people get burned
An empty or truncated reply. Nearly always max_tokens eaten by a reasoning model's think chain; raw_reply shows what came back. A chatty model that won't emit JSON at all gets one corrective retry and then a hard error - switch models.
A 401 that isn't a typo. Several Chinese providers share key prefixes across plan tiers and the wrong tier 401s; the pack's docs/LLM_SERVICE_SELECTION_GUIDE.md maps prefix โ connector.
Your ratio vanishing. A non-official t2i value like 7:3 doesn't error - it silently becomes adaptive and the model picks. Same story for edit mode on a text-only model: it runs, the images go over the wire, but the model can't see them and captions what it supposedly looked at.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| llm_service_connector | LLMServiceConnector | โ | |
| mode | COMBO | t2i - ๆ็ๅพๅขๅผบ | Mode / ๆจกๅผ: t2i ๆ็ๅพๅขๅผบ (้ป่ฎค) โ the brief becomes an English caption plus an aspect ratio, as one JSON object. edit ๅพๅ็ผ่พๅขๅผบ (ๅซๅ่็ๅพ) โ an edit instruction plus the reference images (the picture being edited first, extra references after) become a three-part caption plus a target ratio; needs a vision-capable connector. |
| user_input | STRING | Rough idea / ่็จฟ: a sentence, an outline, a few lines, or a free paragraph. The rewrite expands it into the prompt H3-Image consumes. The body is always English; text you put in quotes is kept verbatim, in its own language. / ๆฉๅๆญฃๆไธๅพ่ฑๆ๏ผๅผๅทๅ ็ๆๅญ้ๅญไฟ็ใ | |
| seed | INT | 00โ18446744073709550000 | Seed / ็งๅญ forwarded to the LLM call. 0 lets the connector pick a fresh seed. The upstream PE is not deterministic, so a fixed seed + a fixed model is the only lever for reproducing a run. |
| reference_imagesopt | IMAGE | Reference images, attached in order. Used by edit -- that mode needs a vision-capable connector, because the official prompt requires the model to look at the sources (<Picture N>, <Subject N>, transcribed source text). The images are visible to the LLM only; the image model receives them separately through the H3-Image conditioning node. ๆๅบ้ไธ็ๅ่ๅพใedit ๆจกๅผๅฟ ๅกซ๏ผ้ไฝฟ็จๆฏๆ่ง่ง็ LLM ่ฟๆฅๅจ๏ผๅฎๆน prompt ่ฆๆฑๆจกๅ็็ๅป็ๅ่ๅพใๅพ็ๅช็ป LLM ็๏ผๅบๅพไป็ฑH3-Image Conditioning ่็นๅ็ฌๆฅๆถใ | |
| aspect_ratioopt | STRING | adaptive | Aspect ratio / ๅฎฝ้ซๆฏ. 'adaptive' lets the model choose. For t2i only the ten official values apply: 1:1 5:4 4:3 3:2 16:9 21:9 4:5 3:4 2:3 9:16. For edit any positive-integer W:H is allowed -- the official edit prompt explicitly refuses a preset list. The ratio is never pixels: the canvas (4 MP to 20 MP, best around 16 MP, every edge a multiple of 32) belongs to the image workflow. / ๆฏไพไธๆฏๅ็ด ๏ผ็ปๅธๅฐบๅฏธ็ฑๅบๅพๅทฅไฝๆตๅณๅฎใ |
| temperatureopt | FLOAT | 1.000โ2 | Sampling temperature / ้ๆ ทๆธฉๅบฆ. 0.0โ2.0, step 0.05. The default is 1.0, the official PE value -- do not copy the 0.7 the MOSS node uses; MOSS's own official value is 0.7. |
| max_tokensopt | INT | 1638464โ32768 | Token budget / Token ไธ้. 64โ32768. The official PE asks for 4096, but a reasoning model spends part of the budget thinking before the caption starts, and a reply that runs out mid-caption is the common failure -- so the default is 16384, and the call auto-escalates when the think chain starves the answer. |
| timeoutopt | COMBO | 300 | Per-call timeout (seconds) / ๅๆฌก่ฐ็จ่ถ ๆถ(็ง). |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | โ |
| aspect_ratio | STRING | โ |
| raw_reply | STRING | โ |