Nodes/babydjac Nodes/Z-Image Prompt Engineer
ComfyUI Node

Z-Image Prompt Engineer

The Node That Writes Z-Image Base Prompts in Grok's Voice

By babydjac·Created 7 months ago·Updated 5 months ago· 12
Z-Image Prompt Engineer
  • reference_image
  • positive_prompt
  • negative_prompt
  • cfg
  • steps
  • status_info
  • expert_breakdown
text_input
prompt_lengthStandard
stylePhotorealistic
cameraNone
lightingNone
framingNone
moodNone
color_paletteNone
detail_focusNone
negative_focusArtifacts
quality_presetProduction
must_include
avoid
grok_api_key
grok_modelgrok-2-vision-1212

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.

CategorybabydjacNODES/Prompting/Z-Image

Inputs (16)

NameTypeDefaultDescription
text_inputSTRING
prompt_lengthCOMBOStandard4 options: Lean, Standard, Rich, Ultra
styleCOMBOPhotorealistic17 options: None, Photorealistic, Cinematic, Documentary, Fashion editorial, Fine art portrait, +11
cameraCOMBONone11 options: None, Canon EOS R5, Sony A1, Nikon Z9, Fujifilm GFX100 II, Leica SL2, +5
lightingCOMBONone10 options: None, Soft window light, Golden hour, Overcast, Studio softbox, Rim light, +4
framingCOMBONone11 options: None, Close-up, Medium shot, Full body, Wide establishing, Rule of thirds, +5
moodCOMBONone10 options: None, Calm, Tense, Hopeful, Melancholic, Joyful, +4
color_paletteCOMBONone8 options: None, Warm earth tones, Cool muted, Monochrome, Vibrant pop, Desaturated, +2
detail_focusCOMBONone7 options: None, Skin texture, Material realism, Architecture lines, Depth of field, Micro detail, +1
negative_focusCOMBOArtifacts6 options: None, Artifacts, Anatomy, Text/Watermark, Clutter, All
quality_presetCOMBOProduction4 options: Fast Draft, Production, Max Quality, Exploration
must_includeoptSTRING
avoidoptSTRING
grok_api_keyoptSTRING
grok_modeloptCOMBOgrok-2-vision-121217 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_imageoptIMAGE

Outputs (6)

NameTypeDescription
positive_promptSTRING
negative_promptSTRING
cfgFLOAT
stepsINT
status_infoSTRING
expert_breakdownSTRING