Y7 Prompt Enhancer (Native)
A prompt enhancer that borrows ComfyUI's text encoder instead of hauling in a second model
- clip
- thinking_output
- enhanced_prompt
Most prompt enhancer nodes are little empires. They download their own LLM, load it through HuggingFace transformers, hold it in VRAM while your actual model waits, then fight ComfyUI over who unloads it. The Y7 Prompt Enhancer (Native) does the opposite: it takes a CLIP input from a stock CLIPLoader and makes the text encoder you already loaded rewrite your prompt. Nothing downloaded, nothing loaded, nothing left resident that ComfyUI isn't already managing. "Native" is the whole pitch.
This fits the 2026 model landscape better than it sounds. The newest image models don't read your prompt through CLIP anymore; they wrap it in a chat template and feed it to an actual LLM like Gemma or Qwen (HiDream-O1 ships Gemma-4 prompt enhancement in its stock workflows, LTX-2's text encoder is Gemma 3 12B). These encoders can not only encode text - they can generate it. This node cashes that in.
How it works
The mechanism is genuinely simple, and it's all on the clip object. The node checks the loaded encoder actually has a generate() path (more on that in a second), builds instruction + your text, then calls clip.tokenize(...) and clip.generate(...) - the same generation API ComfyUI's own Generate Text node uses. The output gets decoded, then a regex pass splits reasoning from answer.
The reasoning split is where the author earned their keep. Gemma 4 emits its planning inside a thought channel, and ComfyUI's decoder deliberately preserves that text - which is why the core Generate Text node hands you a wall of planning notes with your actual prompt buried at the end. This node separates the two, even in the awkward cases: a think block truncated by max_length, or Gemma reasoning past its primed channel and closing it with an orphan tag. Reasoning goes to thinking_output, the clean prompt to enhanced_prompt.
Not every encoder qualifies. Gemma 3/4, Qwen3, Qwen3.5, and Qwen3-VL have generation paths; T5, UMT5, CLIP-L/G, Gemma 2, and LLaMA-3.1 don't. The node detects this up front and tells you in plain English rather than blowing up somewhere deep inside the encoder. Nice touch.
The inputs that matter
clip- the generation-capable encoder, loaded with a plainCLIPLoader.text- your rough prompt. Wire in any string node.instruction- the system-style instruction prepended to your text. This is the real dial; the default asks the model to "describe only what is visible" and keep every element you asked for. Editing it changes the whole flavor of the rewrite.max_length- maximum new tokens, default 2048. Not the context window. Two gotchas in one field: reasoning eats from this same budget, and the KV cache reserves roughly 84KB of VRAM per token up front.temperature,top_k,top_p- Gemma's recommended values are already set (1.0 / 64 / 0.95).temperature0 switches to greedy decoding and ignores the other two.seed- identical inputs return a cached result, so bump this to re-roll.thinking- optional; lets the model reason first. Its output always goes tothinking_output, never into the prompt.
Wire enhanced_prompt into your conditioning (a CLIPTextEncode or the model's prompt input), and thinking_output into a Show Anything if you're curious what it was deliberating.
Install and models
ComfyUI Manager → Custom Nodes Manager → search Y7 or Y7Nodes, install, restart. Or the manual way:
cd ComfyUI/custom_nodes
git clone https://github.com/yushan777/ComfyUI-Y7Nodes
cd ComfyUI-Y7Nodes && pip install -r requirements.txt
The pack's requirements.txt needs transformers and sentencepiece - already present in a normal ComfyUI install, but worth knowing if you run a stripped-down venv. The actual model is the real download. Safetensors only, in models/text_encoders/ - e.g. Gemma 4 from Comfy-Org/gemma-4:
ComfyUI
└── models
└── text_encoders
└── gemma4_e4b_it_bf16.safetensors
GGUF will not work - ComfyUI core has no GGUF loader, and for Gemma 4 the tokenizer lives inside the safetensors file. For Gemma 4 the CLIPLoader type dropdown is ignored entirely; the model is detected from the weights.
Where people get burned
enhanced_promptcomes back empty. The model spent the wholemax_lengthbudget reasoning. Raisemax_lengthor droptemperaturetoward 0.- "This text encoder does not support text generation." That's the guard doing its job - you fed it a T5 or CLIP encoder. Grab a Gemma/Qwen.
- Out of memory on generation. A big
max_lengthon a 27B Qwen3.5 reserves a lot of KV cache. Start with the default and remember the ~84KB/token math. - Don't confuse it with the LM Studio nodes in this same pack. Those need a running LM Studio server. This one needs no server, no key, nothing.
The author's README opens with "probably only useful to me. There's really nothing new here." That's the self-deprecation of someone who built exactly the enhancer they wanted: no model management, no 30-second first run while it downloads an LLM, just the encoder you're already paying for doing a useful second job.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | A generation-capable text encoder loaded with CLIPLoader (Gemma 3/4, Qwen3, Qwen3-VL). T5/CLIP-L will not work. | |
| text | STRING | The basic prompt to enhance. | |
| instruction | STRING | Rewrite the user's text into a single detailed image generation prompt. - Keep every element the user asked for. Invent concrete visual detail where they were vague: lighting, materials, textures, setting, composition. - Describe only what is visible. No smell, taste, sound or emotion. - Output the prompt only. No preamble, no explanation, no markdown, no quotes. | System-style instruction placed before the text. |
| max_length | INT | 204864–32768 | Maximum NEW tokens to generate (not the context window). Reasoning is spent from this same budget. Costs ~84KB of VRAM per token in KV cache, reserved up front. |
| temperature | FLOAT | 1.000–2 | 1.0 is Google's recommended value for Gemma. 0 switches to greedy decoding, which ignores top_k/top_p entirely. |
| top_k | INT | 640–1000 | Keep only the k most likely tokens. 64 is Google's recommended value for Gemma. 0 disables the filter. |
| top_p | FLOAT | 0.950–1 | Nucleus sampling: keep the smallest set of tokens whose probabilities sum to p. 0.95 is Google's recommended value for Gemma. 1.0 disables the filter. |
| seed | INT | 00–18446744073709550000 | — |
| thinkingopt | BOOLEAN | false | Let the model reason first. Its reasoning goes to the thinking output, never the prompt output. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| thinking_output | STRING | — |
| enhanced_prompt | STRING | — |