H3 Rewrite Prompt
Turn a one-liner into a proper H3 prompt, inside the graph
- first_frame
- last_frame
- prompt
- reference_images
H3 wants a lot from its prompts - a paced shot timeline, dialogue marks, a soundscape. Writing that by hand is the kind of thing you do twice before you wish a model would do it for you. H3 Rewrite Prompt is the graph-side half of exactly that: it builds the chat prompt that lightx2v's MiniMax-H3 prompt-rewriter LoRA was trained on, so an 8B model in your graph can turn "a cat burglar in a neon rainstorm" into a real H3 prompt.
How it works
This is the LLM-in-the-graph pattern done properly. The node renders three things, byte-for-byte matching what the adapter saw in training:
- the system prompt - vendored verbatim from the LoRA repo. Editing it isn't tuning, it's moving the rewriter off the distribution it learned, which is why
system_promptexists but the README says leave it empty. - the task header -
taskist2va(text only),i2va(first frame),l2va(last frame) orfl2va(both). - the reference-frame placeholders -
<|image_pad|>slots that bind images by position.
The outputs are prompt (already chat-templated, so Generate Text's template toggle can't interfere) and reference_images (the images in placeholder order). The position binding is the subtle part: the text encoder binds each <|image_pad|> to the next image in the batch, so the node ordering the images to match the placeholders is what keeps everything aligned. Two frames travel as one IMAGE batch, which is why fl2va scales last_frame onto first_frame when they differ.
The other inputs: resolution (default 16:9) and duration (4–15s - the rewriter paces the shot timeline to fit).
The workflow it plugs into
CLIPLoader (qwen3vl_8b, type: stable_diffusion)
-> H3 CLIP LoRA the rewriter LoRA, strength 1.0
-> Generate Text sampling_mode: off (greedy), max_length 2048-4096
prompt <- H3 Rewrite Prompt.prompt
image <- H3 Rewrite Prompt.reference_images
-> H3 Rewrite Clean -> prompt for H3 Encode
You'll want ComfyUI-format LoRAs (nynxz's Qwen3-VL-8B-ComfyUI repo carries them) and a Qwen3-VL-8B text encoder. The honest caveat: ref2va is not supported by the rewriter adapter. H3 Encode can condition on references; this rewriter can't write the prompt for them. For reference-based work, write the prompt yourself.
Install
Pack install: ComfyUI Manager → "Nynxz H3", or:
cd ComfyUI/custom_nodes
git clone https://github.com/Nynxz/ComfyUI-NynxzH3
Restart. Pure Python, no dependencies, ComfyUI 0.30.0+. The rewriter LoRA itself downloads separately from HuggingFace - nothing here bundles it.
The one-liner
Wire the prompt, the reference frames, a task and a duration, and this hands a small local model exactly the format it was trained to answer. Just remember the safety rule that applies to every LLM-in-the-graph node: read what a fresh pack does before you install it - this one is clean and open, but the category's been weaponized before.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | The short request to rewrite. | |
| task | COMBO | t2va | t2va: text only. i2va: first frame. l2va: last frame. fl2va: both. |
| resolution | COMBO | 16:9 | Target aspect. Upstream defaults to 16:9 for t2va and adaptive for the image-conditioned tasks. |
| duration | INT | 104–15 | Target duration in seconds. The rewriter paces the shot timeline to fit it. |
| first_frameopt | IMAGE | Required by i2va and fl2va. | |
| last_frameopt | IMAGE | Required by l2va and fl2va. | |
| system_promptopt | STRING | Overrides the trained system prompt. Leave empty — the adapter was trained on the built-in one, and replacing it moves the rewriter off the format it learned. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | Already chat-templated, so Generate Text's use_default_template has no effect on it. |
| reference_images | IMAGE | In placeholder order. None for t2va — leave it unwired. |