MiniMax H3 Prompt Optimizer 👻
The node that writes MiniMax H3 prompts so you don't have to learn the shot-timestamp grammar
- llm_config
- h3_output
Here's the thing nobody tells you about MiniMax H3: the model is picky about prompts. It wants [Shot 1], then [Shot 2] At 00:03.500, dialogue wrapped in <d> tags, sound described in a separate overall_soundscape section, camera moves spelled out as "push in with small amplitude at slow speed." Write it like a normal person and you'll get a video, but you're leaving most of the model on the table. MiniMax H3 Prompt Optimizer 👻 is an LLM-powered node that takes your rough idea and writes the full H3-grammar prompt for you - then hands you all the reference materials you attached, already unpacked.
It's the pack's centerpiece; the Studio above it does all this plus generation in one node, but this one stops at the prompt so you wire the pieces yourself.
The workflow in one paragraph
You type a loose idea ("a product commercial for a water bottle, studio lighting"), pick a mode (T2VA text-to-video, I2VA first-frame, FL2VA first/last-frame, L2VA last-frame, Ref2VA all-reference), pick a style preset from 13 (General, Minimalist Product Ad, Cinematic Trailer, Anime Action...), set a duration (1–15s), and attach materials through a custom upload widget. The node calls an OpenAI-compatible LLM (via the pack's MiniMax H3 LLM Config node), gets back a structured H3 prompt, and outputs everything packed as an H3_OUTPUT pipe for the Output Unpacker node to split.
The material upload is the neat part. The h3_materials field isn't a text box you type JSON into - the frontend replaces it with a thumbnail grid where you upload images/videos/audio, click a thumbnail to insert @图1 / @视频1 / @音频1 references into the prompt, and the node resolves those into the <Picture N> / <Video N> / <Audio N> tags H3 expects. The LLM is told exactly which tags exist and forbidden from inventing others - the node even scrubs hallucinated tags out of the output afterwards, a detail that tells you this author has been burned before.
The inputs that matter
- h3_materials - the upload widget (it's technically a STRING holding JSON; you don't type it by hand).
- mode - the 5-way dropdown; it decides how many images you can attach and which keyframe ports get filled.
- style_preset - 13 presets that become part of the system prompt.
- duration - FLOAT, 1–15s, default 5.
- llm_config (optional) - plug in the LLM Config node; without it, no API call happens.
Outputs: a single h3_output (H3_OUTPUT) pipe - which contains prompt, prompt_zh (a Chinese review translation, generated by a second LLM pass), plus first/last frames, up to 9 reference images, 3 reference videos, and audio, all routed to the right ports when you unpack.
How it works
The node builds a system prompt from the H3 base writing spec (the shot-timestamp format, dialogue markers, camera vocabulary, sound rules - the pack bundles MiniMax's official H3 prompt-writing skills as presets), injects the tag inventory and your chosen style, and calls the LLM with temperature 0.7. Output gets parsed back into the H3 section fields, cleaned of invalid tags, and machine-translated to Chinese for review. The decoding side needs ffmpeg (with the image2 muxer) for video references and PyAV or torchaudio for audio.
No API key connected? It degrades to an offline editor - your prompt passes through with the @tags resolved but no LLM rewriting, and the reference materials still come out the other end. Never a hard wall: a smart-prompt machine when configured, a dumb passthrough when not.
Install & deps
# ComfyUI Manager: search "ComfyUI-Minitools"
# or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/lepiai/ComfyUI-Minitools
# restart ComfyUI
pip install openai # from the pack's requirements.txt (openai==2.6.1)
Plus a working ffmpeg on PATH for video references. No model weights to download - the LLM runs on the remote endpoint.
Where it bites
- It's an API node. Your prompt and reference images leave the machine and hit a cloud LLM. For the cost-aware, that's the standard tradeoff; the KB's API-wrapper security framing applies (read the pack's source before pasting keys - the category has been weaponized before).
- The LLM quality ceiling is the API model. Default is an Aliyun Bailian Qwen model; a small local Ollama model will write noticeably weaker prompts.
- The H3 grammar is opinionated. The generated prompt follows MiniMax's official spec strictly, which is exactly what you want when the spec works; if you're feeding a different video model, that
[Shot N] At MM:SS.mmmscaffolding is just noise. - Bilingual UI, thin support. Tooltips are Chinese-first, the README barely documents these nodes, and the pack has zero community footprint. The source is the docs.
For the specific misery of hand-writing H3 prompts - the grammar is real and the model rewards it - this is the most useful tool in the pack. It won't make your ideas better, but it will make sure the video gets the best version of them the model can produce.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| h3_materials | STRING | — | |
| mode | COMBO | 5 options: T2VA - 纯文本生成, I2VA - 图生视频(首帧), FL2VA - 首尾帧生成, L2VA - 末帧回溯生成, Ref2VA - 全能参考模式 | |
| style_preset | COMBO | 13 options: 通用 General, 极简产品广告 Minimalist Product Ad, 电影预告 Cinematic Trailer, 品牌宣传 Brand Promo, 游戏介绍 Game Intro, 手绘实拍 Hand-drawn Live Action, +7 | |
| duration | FLOAT | 5.01–15 | — |
| output_language | COMBO | English | LLM 直出语言:English=英文提示词,中文=中文提示词(省去翻译步骤) |
| llm_configopt | H3_LLM_CONFIG | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| h3_output | H3_OUTPUT | — |