Z-Image Prompt Engineer
The Node That Writes Z-Image Base Prompts in Grok's Voice
- reference_image
- positive_prompt
- negative_prompt
- cfg
- steps
- status_info
- expert_breakdown
Z-Image is Alibaba's 6B image model that blew up the local scene - Apache 2.0, uncensored, near-Flux quality on a 12GB card. And the version you fine-tune and actually push, the non-distilled Base released January 2026, is the one that brought back real seed diversity and negative prompt support at CFG 3–5. Z-Image Prompt Engineer is a structured prompt builder aimed squarely at that Base checkpoint, and it's the fuller of the pack's two Z-Image studios.
The interesting design choice: it runs on Grok when you give it a key, but it doesn't fall over when you don't. No key, no problem - it falls back to local static logic that's genuinely usable. Most API nodes in this pack just error out; this one degrades gracefully.
How it works
Two paths, same six outputs.
With a Grok key: it calls x.ai with a strict system prompt that demands a JSON object back - prompt, negative_prompt, cfg, steps, breakdown. The rules baked in are the ones Z-Image actually rewards: a single paragraph, concrete visual details, no meta-tags like "8k" or "masterpiece" (which Z-Image's Qwen encoder reads as noise), and if humans appear, they're explicitly adults with clothing described. It also handles a reference_image by base64-encoding it for Grok Vision.
Without a key: the static path concatenates your text_input with phrase blocks pulled from your dropdown selections - style, camera, lighting, framing, mood, palette, detail focus - and returns sensible sampler defaults. You get a real prompt either way; the status_info output tells you which path ran and estimates token count.
The preset-driven sampler numbers track the community consensus for Base: Production gives CFG 4.0 / 45 steps, Max Quality 3.5 / 50, Fast Draft 4.5 / 38, Exploration 3.0 / 45. That's right in the 30–50 step, CFG 3–5 band Z-Image Base actually wants.
The inputs that matter
- text_input - your concept, in natural language. Z-Image is a prose model with a bilingual Qwen3-4B encoder; it does not take booru tags or
(word:1.3)weights, so write sentences. - prompt_length - Lean (~80–120 words) through Ultra (~220–280). Standard is a good start.
- quality_preset - the four-way tradeoff above. The one you'll touch most.
- negative_focus - preset negative themes: Artifacts, Anatomy, Text/Watermark, Clutter, or All. Defaults to Artifacts.
- must_include / avoid - hard requirements and things to steer clear of; they feed both the API call and the static negative.
- grok_api_key - optional, the switch between the two paths.
Wiring it up
Six outputs, and they're laid out to drop straight into a sampler: positive_prompt → positive, negative_prompt → negative, cfg → CFG, steps → steps. status_info tells you which path ran, and expert_breakdown shows the reasoning. That's the whole point - the node isn't just text, it hands you the settings too.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/babydjac/babydjacNODES
# restart ComfyUI
Or search "babydjacNODES" in ComfyUI Manager. No model downloads, no requirements.txt - requests and Pillow ship with ComfyUI. The optional Grok path needs an xAI key.
Where people get burned
The static path is a phrase-joiner, not a genius - it's fine for drafts, but if you want the "engineer" part, put a key in. And don't feed it taglists; the model's encoder is an LLM, so tags and weights are wasted effort. If your workflow is running Turbo instead of Base, this node's negative prompt and CFG outputs are exactly what Turbo can't use - you want the Turbo sibling for that. For Base, this is a genuinely convenient way to get prose prompts plus the settings to match.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| text_input | STRING | — | |
| prompt_length | COMBO | Standard | 4 options: Lean, Standard, Rich, Ultra |
| style | COMBO | Photorealistic | 17 options: None, Photorealistic, Cinematic, Documentary, Fashion editorial, Fine art portrait, +11 |
| camera | COMBO | None | 11 options: None, Canon EOS R5, Sony A1, Nikon Z9, Fujifilm GFX100 II, Leica SL2, +5 |
| lighting | COMBO | None | 10 options: None, Soft window light, Golden hour, Overcast, Studio softbox, Rim light, +4 |
| framing | COMBO | None | 11 options: None, Close-up, Medium shot, Full body, Wide establishing, Rule of thirds, +5 |
| mood | COMBO | None | 10 options: None, Calm, Tense, Hopeful, Melancholic, Joyful, +4 |
| color_palette | COMBO | None | 8 options: None, Warm earth tones, Cool muted, Monochrome, Vibrant pop, Desaturated, +2 |
| detail_focus | COMBO | None | 7 options: None, Skin texture, Material realism, Architecture lines, Depth of field, Micro detail, +1 |
| negative_focus | COMBO | Artifacts | 6 options: None, Artifacts, Anatomy, Text/Watermark, Clutter, All |
| quality_preset | COMBO | Production | 4 options: Fast Draft, Production, Max Quality, Exploration |
| must_includeopt | STRING | — | |
| avoidopt | STRING | — | |
| grok_api_keyopt | STRING | — | |
| grok_modelopt | COMBO | grok-2-vision-1212 | 17 options: grok-4-1-fast-reasoning, grok-4-1-fast-non-reasoning, grok-code-fast-1, grok-4-fast-reasoning, grok-4-fast-non-reasoning, grok-4-0709, +11 |
| reference_imageopt | IMAGE | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| positive_prompt | STRING | — |
| negative_prompt | STRING | — |
| cfg | FLOAT | — |
| steps | INT | — |
| status_info | STRING | — |
| expert_breakdown | STRING | — |