Z-Image Prompt Builder
The chat-formatted prompt trick that makes Z-Image actually listen
- formatted_text
Here's the thing about Z-Image nobody tells you until you're deep in it: its text encoder is Qwen3-4B, which is a chat model, not a dumb embedder. Feed it one giant prompt blob and you're leaving a lot of its ability to follow structure on the table. This node exploits that - it assembles your scene into proper chat turns - system, user, and an assistant "think" block - so the model plans the composition before it draws. It's a niche node for a specific model, but if Z-Image is your daily driver it's quietly the most interesting thing in this pack.
How it works
The node takes your scene text plus an optional character and wraps them in the <|im_start|>/<|im_end|> chat markup Z-Image's Qwen encoder expects. Before the final user turn it inserts an assistant think block: it calls the Anthropic Claude API to produce a terse composition plan - shot size, spatial arrangement, subject - and pastes that in as the model's "reasoning." With a character connected, it instead generates a "Key features to preserve" line first, so character consistency survives across panels.
The pragmatic bit: if you don't provide an api_key, or the API call fails, or anthropic isn't installed, it silently falls back to using your scene text as the think block. The node still works, just with a dumber plan. So use_think and the API key are an upgrade path, not a requirement.
Inputs and output
- scene (STRING, multiline) - the actual panel/shot description. The one field that matters.
- style_prefix (STRING, multiline) - default is a "professional film storyboard artist, pencil sketch, gray wash" preamble. If you're not doing storyboards, replace this with your own style directive; it's the system turn.
- api_key (STRING) - Anthropic key for the Claude-generated think block. Leave empty for the fallback.
- use_think (BOOLEAN, default on) - whether to insert the think block at all.
- character (STRING, optional) - a character description to lock visual features across panels.
- formatted_text (STRING) - the assembled chat string. Wire this into whatever text-encode node your Z-Image workflow uses.
The gotchas
First, this is a prompt builder, not a generator. You still need the Z-Image checkpoint, its loader, and a sampler - this just replaces your prompt-encode stage. Second, the default style prefix is aggressively storyboard-flavored; if you paste the node into a normal Z-Image workflow and images come out as gray pencil sketches, that's the default talking, not a bug. Swap style_prefix and move on.
Install
Ships in the IXIWORKS pack - ComfyUI Manager → search ComfyUI-VideoDescription, restart. Or clone the repo into custom_nodes/. The Claude think block needs pip install anthropic; without it you get the degraded fallback. Grounding note: Z-Image and its Qwen3-4B encoder are covered well in the Z-Image ecosystem literature - this node is a small, focused slice of that ecosystem, and for storyboard pipelines specifically it's a genuine timesaver.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| scene | STRING | — | |
| style_prefix | STRING | Professional film storyboard artist. Rough pencil sketch, gray wash, monochrome only. Single rectangular panel. Gestural figures, not anatomically detailed. Always respect the prompt's explicit shot size — never pull back beyond it. Default to medium-wide if no shot size specified. | — |
| api_key | STRING | — | |
| use_think | BOOLEAN | true | — |
| characteropt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| formatted_text | STRING | — |