Text Generate Qwen3 Prompt
Your Z-Image Qwen3 Encoder Is Also a Prompt Expander
- clip
- generated_text
The one-line pitch
Your Z-Image workflow already loads a Qwen3-4B LLM - it's the model that reads your prompt and turns it into conditioning. This node borrows that same loaded CLIP object and gives it a second job: writing the prompt itself. Feed it a rough idea ("cyberpunk noodle bar at night, neon rain"), it runs the LLM in chat mode, and hands back a polished prose prompt you can wire into a text-encode node.
The name is honest. No API call, no key, no cloud - everything runs locally through ComfyUI's built-in text generation path, and the only model it needs is the one you're already holding.
Why you'd reach for it
Models that encode with an LLM - Z-Image and friends - read your prompt like an instruction, not a bag of tags. Full sentences with clear ownership beat comma-separated keywords, which is exactly where a prompt expander earns its keep: you say the skeleton, the LLM fills in the prose. And here's the nice part - you only install this pack if you're already running a Qwen3-encoder model (Z-Image, Klein 4B, the Anima family), so the model cost is already paid. Same checkpoint, double duty. That's the closest thing to a free upgrade this ecosystem hands out.
One honest caveat: ComfyUI ships a generic TextGenerate node that does much the same thing. This node's value is that it's Qwen3-specialized - it builds the official chat template for you, adds thinking-mode control, and strips the <think> blocks automatically. If you're on a Qwen3-encoder model and you want a prompt expander that just behaves, that specialization is worth it.
How it works
It wraps your prompt in Qwen3's chat format (<|im_start|>system … <|im_start|>assistant), tokenizes via clip.tokenize, and generates via clip.generate - the same native LLM path the standard node rides on. Then it decodes, chops off the prompt prefix, removes any <think>...</think> block, and cleans the special tokens out of what's left. Thinking mode off just appends /no_think to your message, Qwen3's official soft switch; thinking mode on produces reasoning you never see, because it's deleted before the string reaches you.
Inputs and output
You only really set a few of these.
- clip (CLIP, required) - the Load CLIP'd Qwen3-4B. Wire in the exact same CLIP object you already feed your conditioning node.
- prompt (STRING, multiline) - your rough idea. The seed phrase that gets expanded.
- system_prompt (STRING, multiline) - defaults to "You are a professional image generation prompt expert. Output in English." Change it if you want a different style or language.
- enable_thinking (BOOLEAN, default False) - flip on for deeper reasoning; if you do, raise max_length to 1024+ or your output gets cut off mid-thought.
The rest - temperature, top_k, top_p, min_p, repetition_penalty, seed, do_sample - is a standard sampling cluster with sane defaults. The README's recommended knobs: non-thinking temp 0.7 / top_p 0.8 / top_k 20 / min_p 0, thinking temp 0.6 / top_p 0.95 / top_k 20 / min_p 0.
The single output, generated_text (STRING), plugs straight into the prompt input of a CLIP Text Encode node. Note it's a string, not conditioning - the node doesn't touch the sampler.
Installing it
ComfyUI Manager → search "ComfyUI-TextGenerateQwen3Prompt", or:
cd ComfyUI/custom_nodes
git clone https://github.com/knishika62/ComfyUI-TextGenerateQwen3Prompt
then restart ComfyUI. There's no requirements.txt - the pack is just Python stdlib plus torch, so no dependency hell for once. The real download is the Qwen3-4B checkpoint itself, loaded through the standard Load CLIP node (quantized, it's a couple of GB; full precision is bigger).
Where people get burned
- Old ComfyUI:
clip.generateis a relatively new addition. If the node errors on run, you're on a stale build - update ComfyUI first. - Thinking mode with a tiny max_length: output truncates mid-thought. The README is right; give it 1024+.
- Expecting vision: there's no image input - Qwen3-4B isn't a vision model. This is text-to-text prompt expansion, not image-to-prompt captioning.
- It's a forward pass every time: instant, but not free - the LLM has to actually run, so budget a moment of VRAM and compute per expansion.
Simple idea, small pack, genuinely handy if you're already on Z-Image. Install it, wire your existing CLIP in, and let the model write your own prompts for once.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| prompt | STRING | — | |
| system_prompt | STRING | You are a professional image generation prompt expert. Output in English. | — |
| max_length | INT | 2561–4096 | — |
| do_sample | BOOLEAN | true | — |
| temperature | FLOAT | 0.700–2 | — |
| top_k | INT | 640–1000 | — |
| top_p | FLOAT | 0.950–1 | — |
| min_p | FLOAT | 0.050–1 | — |
| repetition_penalty | FLOAT | 1.051–2 | — |
| seed | INT | 00–18446744073709550000 | — |
| enable_thinking | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| generated_text | STRING | — |