Z-Image Integrated KSampler
LLM-enhance, sample, save
- model
- clip
- vae
- config
- options
- image_1
- image_2
- image_3
- image_4
- latent
- images
- latent
- enhanced_prompt
- debug_log
The name is doing a lot of work, but it's accurate: this node is the entire Z-Image generation stack collapsed into one box. Give it a model, a CLIP, a VAE, and a config from Z-Image API Config, type a short idea into positive_prompt, and it runs the LLM prompt enhancement, encodes with CLIP, samples, decodes, and hands you finished images. The pack's README shows the standalone equivalent as a four-node chain - API Config → Prompt Enhancer → CLIP Text Encode → KSampler - and this node is that chain, fused.
It's the flagship of Koko-boya's Comfyui-Z-Image-Utilities pack, built around Z-Image, Alibaba's 6B model that the community treats as the SDXL successor. If you just want Z-Image running with LLM-enhanced prompts and don't care to assemble the pieces yourself, this is the one you reach for.
How it works
Under the hood it calls the pack's own prompt enhancer (always statelessly, with no session history), then does the sampling itself. Two things are worth knowing because they're easy to trip over:
- The defaults are generic ComfyUI, not Z-Image-optimized.
stepsdefaults to 20,cfgto 7, samplereuler, schedulernormal. Those are fine numbers for an SDXL-era model, wrong for Turbo. Z-Image-Turbo is guidance-distilled: it wants ~8 steps at CFG 1, where a negative prompt barely matters. Z-Image Base wants the opposite - 25–50 steps at CFG 3–5 with real negative prompting. Set them for whichever variant you loaded. auraflow_shiftis the knob you'll actually fiddle. Set it above 0 and the node patches the model's sampling shift. The community's most repeated Turbo tweak is a shift of 7 (ComfyUI's default is 3), and the KB's Z-Image guide agrees. There's alsocfg_norm_strength, a CFGNorm-style post-CFG rescale, but that's more of a power-user toy - most people leave it at 0.
generation_mode switches between text_to_image and image_to_image. I2I requires at least one of image_1 through image_4 connected; the node encodes the first image as your starting latent and uses the Z-Image pipeline's reference-latent conditioning, sending the images to a vision-capable LLM using the instruction field as its system prompt. denoise is your standard KSampler strength - drop it below 1 for lighter edits.
The inputs that matter
The required list is long but mostly self-explanatory: model/clip/vae come straight from a checkpoint loader, config from Z-Image API Config, then positive_prompt, negative_prompt, width, height, seed, steps, cfg, sampler_name, scheduler, denoise. The optional ones you'll actually touch:
enable_prompt_enhance- turn it off and your prompt is used as-is, which is handy when you've already written a full detailed prompt (the enhancer works best on short ones anyway).options- plug in a Z-Image Options node to control the LLM's temperature, repeat penalty, and so on.auto_save_folder- a folder name (relative paths land inside ComfyUI's output dir) plusoutput_prefixfor the filename; empty disables saving.
Outputs and wiring
It returns images (wire into Preview Image or Save Image), latent (the denoised latent, useful for chaining a second pass), enhanced_prompt (the actual text the LLM produced - inspect it once to see what's going in), and debug_log for when things go wrong.
Installing and gotchas
Install via ComfyUI Manager (search "Comfyui-Z-Image-Utilities") or cd ComfyUI/custom_nodes && git clone https://github.com/Koko-boya/ComfyUI-Z-Image-Utilities.git, then restart. If you run the Direct provider (model loaded from HuggingFace) you'll also need pip install bitsandbytes huggingface-hub.
Two traps worth remembering: if you enable prompt enhancement, expect verbose, narrative output - that's normal and generally helps Z-Image. And the OpenRouter free-tier LLMs the config defaults to can rate-limit mid-run, so keep an eye on debug_log when output looks wrong.
Inputs (32)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | Diffusion model for image generation | |
| clip | CLIP | CLIP model for text encoding | |
| vae | VAE | VAE model for latent encode/decode | |
| config | ZIMAGE_CONFIG | LLM configuration for prompt enhancement | |
| positive_prompt | STRING | Positive prompt - will be enhanced by LLM | |
| negative_prompt | STRING | Negative prompt for unwanted elements | |
| generation_mode | COMBO | text_to_image | T2I: Generate from text. I2I: Edit/transform input images |
| width | INT | 102464–8192 | Output image width |
| height | INT | 102464–8192 | Output image height |
| seed | INT | 00–18446744073709550000 | Random seed |
| steps | INT | 201–1000 | Sampling steps |
| cfg | FLOAT | 7.00–100 | CFG scale |
| sampler_name | COMBO | euler | Sampler algorithm |
| scheduler | COMBO | normal | Scheduler type |
| denoise | FLOAT | 1.000–1 | Denoise strength (1.0 = full, <1.0 for I2I) |
| optionsopt | ZIMAGE_OPTIONS | Advanced LLM options | |
| image_1opt | IMAGE | First image for I2I/vision enhancement | |
| image_2opt | IMAGE | Second image (optional) | |
| image_3opt | IMAGE | Third image (optional) | |
| image_4opt | IMAGE | Fourth image (optional) | |
| latentopt | LATENT | Optional latent input (for custom latent) | |
| prompt_templateopt | COMBO | chinese | LLM prompt template language |
| enable_prompt_enhanceopt | BOOLEAN | true | Enable LLM prompt enhancement (disable to use prompt as-is) |
| batch_sizeopt | INT | 11–16 | Number of images to generate |
| auraflow_shiftopt | FLOAT | 0.000–100 | AuraFlow shift (0 = disabled) |
| cfg_norm_strengthopt | FLOAT | 0.000–10 | CFGNorm strength (0 = disabled) |
| enable_clean_gpuopt | BOOLEAN | false | Clean GPU memory before/after sampling |
| enable_clean_ramopt | BOOLEAN | false | Clean RAM after completion |
| auto_save_folderopt | STRING | Auto-save folder (empty = disabled) | |
| output_prefixopt | STRING | z_image | Filename prefix for auto-save |
| custom_system_promptopt | STRING | — | |
| instructionopt | STRING | Describe the key features of the input image (color, shape, size, texture, objects, background), then explain how the user's text instruction should alter or modify the image. Generate a new image that meets the user's requirements while maintaining consistency with the original input where appropriate. | System instruction for the Vision-Language Model in I2I mode |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| latent | LATENT | — |
| enhanced_prompt | STRING | — |
| debug_log | STRING | — |