MiniMax H3 Context IR (OpenAI) - leoleexh
Make MiniMax H3 obey your prompt — and stop breaking the media tags
- creative_profile
- first_frame
- last_frame
- ref_images
- ref_videos
- ref_video_audios
- ref_audios
- h3_prompt
- context_ir_json
- analysis_report
- warnings
- usage_json
MiniMax H3 is the open-weights model that finally gave Veo's audio advantage a local answer: a 33B omni-modal generator with native synced stereo sound, which landed #1 in video-editing-with-audio on Artificial Analysis within days of its August 2026 drop. The catch is the prompt format. Native H3 nodes want <Picture N>, <Video N>, <Audio N> tags that line up exactly with the media you plug into conditioning, a laid-out shot timeline, and dialogue in the (S1) says <d>[Chinese] 台词</d> shape. Plain prose mostly works. Prose plus a pile of reference media is where it falls apart - the numbers drift, tags go stale, and the model starts ignoring half your references.
M3H3ContextIROpenAI_leoleexh (listed as "MiniMax H3 Context IR (OpenAI) - leoleexh") is a prompt preprocessor built for that exact problem. It's the flagship node of the ComfyUI-M3-IRContext pack, and it does what a generic LLM prompt-polisher can't: it actually looks at your images, video frames, and audio, then renders a valid H3 Base three-section or Ref2VA six-section prompt that matches what you wired into the native node.
How it works
The design is deliberately defensive. First it builds an immutable local media registry - each image is analyzed separately, the single reference video is sampled at about 2 fps from the timeline prefix native generation actually uses (hard cap 32 frames), and audio gets a 16 kHz mono copy made for transcription. Every still and sample frame is re-encoded locally as a JPEG (max side 1024px, under 100KB) before anything goes out. Then it asks an OpenAI-compatible model for a strict JSON plan, using the Responses API first and falling back to Chat Completions only when the endpoint doesn't support Responses. That plan is validated locally against asset IDs, tags, subjects, verbatim dialogue, timeline, and target duration - with one automatic repair pass if it misses. The final prompt render happens locally, which means the model can't control physical input numbering or invent tags.
The inputs that matter
user_prompt- your natural-language intent.she says: Hello. English dialogueis converted to proper H3 dialogue automatically.width,height,length- direct INT sockets. Branch these from the same Resolution Selector and duration Math Expression you feed native H3; the node plans its shot timing fromlength / 24, so prompt pacing and generation share one source of truth and never drift.api_key,base_url,model_preset- the connection. Default model isgpt-5.6-sol;custom_modeltakes any compatible ID. Leave the key blank and useH3_CONTEXT_API_KEY(orOPENAI_API_KEY) env vars.privacy_mode-cloudsends media derivatives and text to the endpoint;local_onlyuploads nothing but only outputs a conservative template.generate_background_music,generate_dialogue,dialogue_language,generate_narration,generate_subtitles- the generation toggles, all with sensible H3-native defaults.max_visual_inputs(default 40) andmax_video_frames(default 32) - the cloud-analysis budget.
Media goes in via first_frame, last_frame, ref_images (up to 9), one ref_videos, a paired ref_video_audios, and ref_audios (3). mode: auto picks T2VA, I2VA, L2VA, FL2VA, or Ref2VA from whatever's connected - note first/last frame and ref_* inputs are mutually exclusive. There's also an optional creative_profile input fed by the pack's Creative Director node.
Outputs
h3_prompt is the one that matters - wire it into the native H3 node's prompt. The rest are diagnostics: context_ir_json (full validated plan), analysis_report, warnings, and usage_json (tokens, latency, cache hits - no keys).
Install
It's a light API node: the entire dependency list is openai>=1.74.0, no model downloads.
cd ComfyUI/custom_nodes
git clone https://github.com/leoleelxh/ComfyUI-M3-IRContext.git
python -m pip install -r ComfyUI-M3-IRContext/requirements.txt
Restart ComfyUI and you'll find all three nodes under leoleexh/MiniMax H3. ComfyUI Manager can install it too.
Where people get burned
- The key is saved in the workflow. ComfyUI's string widget shows it and may serialize it into workflow JSON. Never share a workflow or screenshot with a real key - set the env var instead.
- Media must go to native H3 too. This node doesn't produce conditioning and doesn't forward media. Connect every image/video/audio to both this preprocessor and the native H3 node, in the same order. That's the classic "H3 sees nothing" mistake.
- Not every "OpenAI-compatible" endpoint works. Cloud mode needs vision, strict JSON Schema output, and (for audio) a transcription endpoint. Missing capabilities fail explicitly rather than fabricate output.
- The H3 weights themselves are license-geofenced - the MiniMax H3 Community License excludes the US, EU, UK, and South Korea, so this node is only useful if you're in a territory where running the local weights is legal for you.
With VideoHelperSuite, set force_rate=24 and select_every_nth=1 on VHS Load Video and branch the IMAGE output to both ref_video_1 ports. Don't use meta_batch streaming - the preprocessor won't stitch chunks across runs.
Inputs (32)
| Name | Type | Default | Description |
|---|---|---|---|
| user_prompt | STRING | Original intent in natural language. Common forms such as `she says: Hello. English dialogue` are converted automatically; explicit <d>[Language] text</d> is also supported. | |
| mode | COMBO | auto | 6 options: auto, t2va, i2va, fl2va, l2va, ref2va |
| width | INT | Connect the same width INT used by the native H3 node, normally from the official Resolution Selector. | |
| height | INT | Connect the same height INT used by the native H3 node, normally from the official Resolution Selector. | |
| length | INT | Connect the exact same H3-aligned frame-count INT used by the native H3 node. In the official workflow this is the integer output of the duration Math Expression. | |
| model_preset | COMBO | gpt-5.6-sol | 5 options: gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna, gpt-5.5, custom |
| custom_model | STRING | Used when model_preset is custom. Any compatible provider model ID is accepted. | |
| api_key | STRING | Type the key here, or leave blank to use an environment variable. ComfyUI's standard string widget shows this value and may save it in workflow JSON. Never share a workflow or screenshot containing a real key. | |
| base_url | STRING | https://api.openai.com/v1 | OpenAI-compatible API base URL. This is stored in workflow JSON; never put a key here. |
| api_mode | COMBO | auto | Auto tries Responses first and falls back only when the endpoint does not implement it. |
| reasoning_effort | COMBO | medium | 3 options: low, medium, high |
| output_language | COMBO | en | 3 options: en, zh, auto |
| strictness | COMBO | balanced | 3 options: conservative, balanced, creative |
| generate_background_music | BOOLEAN | true | ON asks for a fitting non-diegetic score unless the user explicitly requests no music. OFF forces the final prompt to prohibit background music. |
| generate_dialogue | BOOLEAN | true | ON allows natural dialogue when the scene supports it and preserves extracted or explicit lines. OFF forces no character dialogue or vocal performance. Narration is controlled separately. |
| generate_subtitles | BOOLEAN | false | ON asks H3 to burn in synchronized subtitles for actual dialogue. OFF prohibits dialogue captions. Generated-video text may still be imperfect. |
| privacy_mode | COMBO | cloud | Cloud sends selected media derivatives/audio/text to the endpoint. local_only uploads nothing. |
| cache_enabled | BOOLEAN | true | — |
| max_visual_inputs | INT | 401–64 | Global cloud-analysis budget: still images count as 1 each; the remaining slots are used for timestamped sampled frames from the single reference video. It must be at least the number of connected visual assets. |
| max_video_frames | INT | 322–32 | Hard cap for AI video frames. Actual sampling is adaptive at about 2 fps and is also limited by max_visual_inputs; the full frame batch is never uploaded. |
| transcription_model | STRING | gpt-4o-transcribe | — |
| timeout_seconds | INT | 12010–900 | — |
| max_retries | INT | 20–6 | — |
| generate_narration | BOOLEAN | false | OFF prohibits narration, voice-over, spoken descriptions, and reading prompt text aloud. ON only permits narration when the user_prompt explicitly requests it. |
| dialogue_language | COMBO | auto | Auto only permits context-appropriate dialogue. Selecting a language requires cloud planning to author at least one line in that language. Natural input such as `她说:你好。中文对白` is converted automatically; explicit <d>[Language] ...</d> also remains supported. |
| creative_profileopt | M3_CREATIVE_PROFILE | Optional connection from MiniMax H3 Creative Director. The structured profile is expanded against this node's exact duration, aspect ratio, mode, and connected references. | |
| first_frameopt | IMAGE | — | |
| last_frameopt | IMAGE | — | |
| ref_imagesopt | COMFY_AUTOGROW_V3 | — | |
| ref_videosopt | COMFY_AUTOGROW_V3 | — | |
| ref_video_audiosopt | COMFY_AUTOGROW_V3 | — | |
| ref_audiosopt | COMFY_AUTOGROW_V3 | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| h3_prompt | STRING | — |
| context_ir_json | STRING | — |
| analysis_report | STRING | — |
| warnings | STRING | — |
| usage_json | STRING | — |