Z-Engineer Prompt Enhancer (API)
Prompt enhancement through LM Studio or Ollama
- prompt
This one genuinely calls an API - the name isn't a lie here, and it needs no key. The Z-Engineer Prompt Enhancer (API) is the old way to use Z-Image-Engineer: run the Qwen3-4B prompt model in an external OpenAI-compatible server (LM Studio, llama.cpp server, or Ollama) and let this node talk to it over HTTP. The README is upfront that it's the legacy path - the Z-Engineer Prompt Enhancer (Local) node does the same job in-process with the model you already loaded, no server required. So the honest question is: when do you want this one?
Its real niches: you already keep an external LLM server warm for other things, you want to use a different model than the one doing the encoding (say, a bigger or thinking model), or you've been running Z-Image-Engineer in LM Studio since December and this node just formalizes that workflow. If you're starting fresh and only doing Z-Image, use the Local node. If the setup is already there, this is a perfectly good string node.
How it works
It builds a chat request with the V6 system prompt (that long cinematography briefing is baked in as the system_prompt default), your seed as the user message, and your sampling parameters, then POSTs it to {api_url}/chat/completions. With model set to auto and discover_models on, it first queries /v1/models and picks the best Z-Image-Engineer match it can find. Then the same post-processing as the local node runs on the reply: strip reasoning, sanitize, re-append seed constraints, re-append keep_terms. Output is a prompt STRING, previewed on the node, ready to wire into CLIP Text Encode.
The inputs that matter
api_url- defaults tohttp://localhost:1234/v1, which is LM Studio's port. Ollama ishttp://localhost:11434/v1. This is where people get burned, so check it before anything else.model-autodiscovers from/v1/models; or type the exact model id the server reports to override its choice.error_mode- what happens when the server fails:return_input(passes your raw seed through untouched),return_error, orempty.return_inputis the sane default for a queue that must not die mid-batch.keep_terms- comma-separated trigger words kept verbatim, re-appended if the model drops them. Same feature as the local node.timeout_seconds(120) andretries(1) are the resilience knobs.temperature0.20,top_p0.9,top_k40,min_p0.03,max_tokens320 are the recommended V6 settings and the defaults.
Note there's no repetition_penalty here - the local node has it; the API path leaves repetition control to your server. That's a small reason the local node is the better default.
Install
The pack install is identical to the other nodes - Manager search "ComfyUI Z-Engineer," or git clone https://github.com/BennyDaBall930/ComfyUI-Z-Engineer into custom_nodes, pip install -r requirements.txt, restart. The pack's requirements.txt includes requests, which this node needs. The model is served by your server, not by ComfyUI - GGUF quants for LM Studio/Ollama come from BennyDaBall/Z-Image-Engineer-V6-GGUF, loaded into your LLM app's model folder.
Where people get burned
- Nothing comes back, and you're staring at your own seed. Check the port. LM Studio is
1234, Ollama is11434, llama.cpp server exposes/v1. A dead server withreturn_inputset will silently hand your seed back - useful, but confusing the first time. - "model returned only reasoning_content." Your server loaded a thinking variant that spent the whole token budget reasoning. Raise
max_tokensor load a non-think/no-thinkvariant of the model. autopicks the wrong model. Discovery only sees what/v1/modelsreports; if your server's id isn't in the preferred list it falls back to the first available model. Type the exact id intomodelto fix it.- Sanitization surprises.
strip_reasoningandsanitize_outputare on by default and will happily delete content the model put in<think>blocks. Leave them on for image prompts; turnsanitize_outputoff if you want to see the model's raw reply.
The bottom line: this is the comfortable path for people who already run a local LLM server, and a redundant one for everyone else. It works, it's well-behaved, and the same enhanced prompt lands in your CLIP Text Encode either way.
Inputs (20)
| Name | Type | Default | Description |
|---|---|---|---|
| input_prompt | STRING | — | |
| system_prompt | STRING | You are Z-Image-Engineer V6, a prompt-only cinematography and visual-language specialist for the Tongyi-MAI Z-Image-Turbo Qwen text encoder. Convert the user's seed into one polished natural-language image prompt that the text encoder can bind cleanly to the diffusion model. Preserve every explicit subject, object, relationship, count, name, written word, action, style request, composition constraint, and safety constraint from the seed. Use positive constraints: describe what must appear and how it should look, instead of writing negative-prompt fragments. Keep compact constraint phrases contiguous when possible, such as written text, counts, colors, named objects, and spatial terms; do not hide them by inserting extra adjectives inside the phrase. Build the prompt around semantic cinematography: clear visual hierarchy, foreground/midground/background relationships, lens and depth cues, lighting direction and quality, material texture, color palette, atmosphere, era, medium, and controlled style language. Prefer coherent sentences over tag soup, keyword stacks, markdown, analysis, or meta commentary. Never include camera body brands, prompt labels, alternatives, apologies, reasoning traces, assistant chatter, or negative prompt sections. Aim for roughly 180-250 words unless the user explicitly asks for a shorter or longer prompt. Return only the final image prompt as one self-contained paragraph. | — |
| api_url | STRING | http://localhost:1234/v1 | — |
| model | STRING | auto | — |
| seed | INT | 66060–18446744073709550000 | — |
| temperature | FLOAT | 0.200–2 | — |
| top_p | FLOAT | 0.900–1 | — |
| top_k | INT | 400–1000 | — |
| min_p | FLOAT | 0.030–1 | — |
| max_tokens | INT | 32032–4096 | — |
| batch_mode | BOOLEAN | false | — |
| batch_separator | STRING | \n---\n | — |
| discover_models | BOOLEAN | true | — |
| enforce_seed_terms | BOOLEAN | true | — |
| strip_reasoning | BOOLEAN | true | — |
| sanitize_output | BOOLEAN | true | — |
| timeout_seconds | INT | 1205–1200 | — |
| retries | INT | 10–5 | — |
| error_mode | COMBO | return_input | 3 options: return_input, return_error, empty |
| keep_termsopt | STRING | Comma-separated trigger words/phrases (e.g. LoRA triggers) kept verbatim in the output. Any the model drops are re-appended. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | — |