Nodes/SDXL Auto Prompter/APNext QwenVL Z-Image Vision Cloner
ComfyUI Node

APNext QwenVL Z-Image Vision Cloner

Turn any image into a Z-Image-ready chat prompt — vision cloner for Z-Image

By dagthomas·Created 3 years ago·Updated about 18 hours ago· 285
APNext QwenVL Z-Image Vision Cloner
  • images
  • zimage_formatted
  • description
  • raw_json
qwen_modelQwen3-VL-2B-Instruct
prompt_filezimage_vision_analysis.txt
system_prompt_filezimage_vision_system.txt
user_mod_filezimage_vision_user_mod.txt
max_tokens4096
temperature0.50
keep_model_loadedtrue
use_flash_attentionfalse
include_system_prompttrue
include_think_blockfalse
strip_quotesfalse
seed-1
randomize_each_runtrue
custom_analysis_prompt
user_modification
custom_system_prompt

Z-Image - Alibaba's fast 6B image model - wants its prompts in a chat format, wrapped in <|im_start|> and <|im_end|> tokens like the language-model conversations it was trained on. That's fine when you're typing a prompt yourself, and a real headache when you want to generate from a description of an existing image. This node closes that gap: it looks at your image with a local QwenVL model, writes the analysis, and formats the result as a ready-to-paste Z-Image prompt - tokens and all.

Think of it as the Vision Cloner with a Z-Image output stage bolted on. The vision part is identical in spirit - Qwen3-VL, fully local, model auto-downloaded to ComfyUI/models/LLM/Qwen-VL/ on first use, no API key. The difference is the payload it produces: zimage_formatted, which is the analysis wrapped in the chat token structure Z-Image's text encoder expects, ready to drop straight into a Z-Image node's prompt input.

How it works

The node builds its request from three template files (all in data/custom_prompts/, all overridable with inline strings):

  • prompt_file - the main analysis instruction (default zimage_vision_analysis.txt).
  • system_prompt_file - a system-level framing prompt, on by default via include_system_prompt.
  • user_mod_file - an optional user-side modification ("keep it moody and desaturated"), also driven by the user_modification inline field.

You get three outputs: zimage_formatted (the token-wrapped, Z-Image-ready prompt - the one you wire into a Z-Image generation node), description (the plain analysis without the wrapper, handy for reading), and raw_json (the structured raw response). The include_think_block toggle lets the model emit a thinking pass before the answer - richer analysis, slower. strip_quotes cleans stray quotes out of the formatted output so they don't corrupt the prompt, and temperature defaults lower (0.5) here than elsewhere, because Z-Image prompts should stay close to the reference rather than wander.

The inputs that matter

  • images - one or more reference images to analyze.
  • qwen_model - Qwen3-VL 2B–8B (plus Thinking/FP8). 4B is a good default for style work.
  • The three prompt files + include_system_prompt - the template stack; override with the inline custom_analysis_prompt, custom_system_prompt and user_modification fields rather than editing files.
  • max_tokens (default 4096), temperature, keep_model_loaded, use_flash_attention, seed/randomize_each_run - the standard QwenVL set.

Install

Pack install is the shared routine - ComfyUI Manager (search "comfyui_dagthomas") or:

cd ComfyUI/custom_nodes
git clone https://github.com/dagthomas/comfyui_dagthomas
cd comfyui_dagthomas
pip install -r requirements.txt

Restart, and let the QwenVL model download on first use. Z-Image itself is a separate model you install in ComfyUI as usual; this node only writes the prompt for it.

Common issues

  • Z-Image ignores the prompt - check that zimage_formatted, not description, is what you wired into the Z-Image node's prompt input; the token wrapper is the part that matters.
  • Prompt corrupted by quotes - turn on strip_quotes; a stray " inside a token-wrapped prompt can break the whole thing.
  • Slow or memory-heavy - a thinking-pass 8B model is the expensive combo. Drop to 4B Instruct (or an FP8 build) and turn include_think_block off unless you need the deeper analysis.
  • Custom templates not in the dropdown - the prompt-file lists are read at startup; add .txt files to data/custom_prompts/ and restart ComfyUI.
Categorycomfyui_dagthomas/LLM

Inputs (17)

NameTypeDefaultDescription
imagesIMAGE
qwen_modelCOMBOQwen3-VL-2B-Instruct23 options: Qwen3-VL-2B-Instruct, Qwen3-VL-2B-Thinking, Qwen3-VL-2B-Instruct-FP8, Qwen3-VL-2B-Thinking-FP8, Qwen3-VL-4B-Instruct, Qwen3-VL-4B-Thinking, +17
prompt_fileCOMBOzimage_vision_analysis.txt44 options: (none), cloner.txt, cloner_concept_blender.txt, extractor.txt, follow.txt, gemini.txt, +38
system_prompt_fileCOMBOzimage_vision_system.txt44 options: (none), cloner.txt, cloner_concept_blender.txt, extractor.txt, follow.txt, gemini.txt, +38
user_mod_fileCOMBOzimage_vision_user_mod.txt44 options: (none), cloner.txt, cloner_concept_blender.txt, extractor.txt, follow.txt, gemini.txt, +38
max_tokensINT4096512–8192
temperatureFLOAT0.500.1–1
keep_model_loadedBOOLEANtrue
use_flash_attentionBOOLEANfalse
include_system_promptBOOLEANtrue
include_think_blockBOOLEANfalse
strip_quotesBOOLEANfalse
seedINT-1-1–18446744073709550000
randomize_each_runBOOLEANtrue
custom_analysis_promptoptSTRING
user_modificationoptSTRING
custom_system_promptoptSTRING

Outputs (3)

NameTypeDescription
zimage_formattedSTRING
descriptionSTRING
raw_jsonSTRING