Nodes/ComfyUI_StarNodes/⭐ Star CLIP Prompt Refiner
ComfyUI Node

⭐ Star CLIP Prompt Refiner

A local LLM in your graph, no Ollama and no API key

By Starnodes2024·Created 2 years ago·Updated a day ago· 111
⭐ Star CLIP Prompt Refiner
  • clip_override
  • image1
  • video
  • audio
  • result
  • think_output
◄clip_nameqwen3-vl-4b-heretic_int8.safetensors►
◄prompt►
◄system_prompt_presetCustom►
◄system_prompt►
◄use_seedtrue►
◄seed0►
◄temperature0.70►
◄top_k64►
◄top_p0.95►
◄min_p0.05►
◄repetition_penalty1.05►
◄max_length512►
◄thinkingtrue►

The name is wrong, in a good way

It says CLIP and it isn't CLIP - there's no contrastive text-image model in here. ⭐ Star CLIP Prompt Refiner loads a text encoder out of models/text_encoders as a language model and lets it write your prompt, using the same pipeline as ComfyUI's native Generate Text node (clip.tokenize → clip.generate → clip.decode), with the loader baked in and a stack of system-prompt presets on top.

Why you'd reach for it: on Z-Image, Klein, Krea 2 and most 2026 models the text encoder is a small Qwen3 instruct LLM. Reusing that same file as your prompt writer means no second model, no Ollama server process, no llama-cpp-python build to match your system, no API key, no refusal on the far end - and ComfyUI already handles loading and offloading it.

The trade-off: it isn't a chat window - one shot per run, no history. And the consensus on enhancers is well-earned cynicism: LLM-written prompts carry noise, and a prompt you wrote by hand usually beats one a model invented. It's best when the LLM polishes and structures rather than doing the thinking for you.

How it works

It loads your chosen checkpoint through comfy.sd.load_clip, then feeds the model a chat-formatted token stream with system_prompt replacing the system prompt in the model's chat template. Your sampling settings go to clip.generate, and the returned text is split on </think> - reasoning before it, answer after - hence two outputs.

IS_CHANGED is the quiet part worth knowing. With use_seed on it caches like any other node: queue twice with identical inputs, get the identical prompt back. Turn it off and it re-runs on a fresh random seed every queue.

The inputs that matter

  • clip_name - dropdown of everything in models/text_encoders. Defaults to qwen3-vl-4b-heretic_int8.safetensors; if that file isn't there it falls back to the first entry in your folder, so don't be surprised by what's pre-selected.
  • prompt - your rough idea.
  • system_prompt_preset - the reason to use this over the native node. 29 choices: Custom plus 28 shared presets (Flux2(Klein) SysPrompt, Krea2 Image Prompt Refiner, Character Sheet Expert SFW/NSFW), read from json/startext.json - the same file Star Easy-Text-Storage and Star Ollama Prompt Helper write to. Add one there, refresh, it appears here.
  • system_prompt - used when the preset is Custom. Leave it blank and you silently get the Flux2(Klein) SysPrompt preset: a long, opinionated style guide about subject hierarchy, lighting-as-geometry and hex codes, written specifically for Qwen3 encoders. Read it before trusting it.
  • temperature (0.7), plus top_k, top_p, min_p, repetition_penalty and max_length (512). Temperature is the one you'll actually touch: ~0.4 for template-shaped output, 0.9 when you want it to riff. max_length is a hard ceiling, and 512 tokens isn't always enough with thinking on.
  • thinking - leave it on. The author's own note: disabling it injects an empty think block into the template for Qwen3-VL heretic models, which then echo your prompt instead of answering.

Optional inputs: clip_override reuses a CLIP already loaded in the graph (dropdown ignored, no second copy of a 4B model in VRAM). image1 grows a slot as you connect, up to four, for vision-language encoders; batches flatten into individual reference images. video (24 FPS assumed, subsampled to 1 FPS) and audio only matter for models that accept them.

Outputs are result - the prompt, into a CLIP Text Encode or any text widget - and think_output, the reasoning. Read the second one when the first looks off; it tells you whether the model understood you.

Installing it

ComfyUI Manager, search Starnodes, install, restart. Or:

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

That requirements list is for the rest of the pack; this node needs none of it. What it needs is a text-generation-capable model in models/text_encoders. The default expects the heretic build of Qwen3-VL 4B in int8 - heretic is an abliteration method, refusals surgically removed, which is the only reason presets like the NSFW character sheets work. Comfy-Org publishes stock encoders into the same folder (qwen3vl_4b_bf16.safetensors, ~8.5 GB). Point this at a plain CLIP or T5 and you get errors, not a smarter prompt.

Where it goes wrong

It just repeats your prompt. Empty-think-block symptom - turn thinking back on. Still repeating? Lower the temperature and check that a Custom preset didn't get left blank and then overridden.

Chatter leaking into the prompt. Preset problem, not a bug. Pick one that says polish rather than expand, or end your Custom system prompt with "output the prompt and nothing else". The common complaint about every local enhancer - hand it an already-decent prompt and let it finish the job.

Prim or refused output. You're on a stock instruct encoder. Swap to an abliterated build - Qwen3-VL's refusals are a fine-tuning artifact, and running locally is the whole point.

VRAM. Two models load per workflow now - diffusion plus a 4B encoder. ComfyUI manages the offload; on a tight card use the int8 file and clip_override when that encoder already exists upstream.

Category⭐StarNodes/Prompts

Inputs (17)

NameTypeDefaultDescription
clip_nameCOMBOqwen3-vl-4b-heretic_int8.safetensorsText encoder from models/text_encoders used as the language model. Vision-language models like Qwen3-VL can also read the reference images.
promptSTRINGYour prompt text to send to the model.
system_prompt_presetCOMBOCustomChoose a preset system prompt or 'Custom' to write your own. Presets are loaded from the shared text storage (json/startext.json).
system_promptSTRINGCustom system prompt (used when preset is 'Custom'). Replaces the system prompt in the model's chat template. If left empty, the 'Flux2(Klein) SysPrompt' preset is used as default.
use_seedBOOLEANtrueOn: the seed below is used and the node caches its result when nothing changes. Off: a random seed is used every run, so the node always executes again even if the inputs did not change.
seedINT00–2147483647Seed for reproducible output sampling (only used when 'use_seed' is on).
temperatureFLOAT0.700–2Higher values produce more creative output, lower values more focused/deterministic.
top_kINT640–1000Limits sampling to the top-K most likely tokens. 0 disables the limit.
top_pFLOAT0.950–1Nucleus sampling: only tokens within this cumulative probability are considered.
min_pFLOAT0.050–1Minimum token probability relative to the most likely token. 0 disables.
repetition_penaltyFLOAT1.050–5Penalizes repeated tokens. 1.0 disables the penalty.
max_lengthINT5121–32768Maximum number of tokens to generate.
thinkingBOOLEANtrueOperate in thinking mode if the model supports it. The reasoning is returned on think_output. Note: with some Qwen3-VL models (e.g. heretic) turning this off injects an empty think block that can confuse the model - keep it on if output looks wrong.
clip_overrideoptCLIPOptional: use an already loaded text encoder (CLIP) from the workflow instead of loading the model from the dropdown. The clip_name dropdown is ignored while this is connected.
image1optIMAGEOptional reference image for vision language models. Connecting an image adds another slot (up to 4).
videooptIMAGEVideo frames as image batch. Assumed to be 24 FPS; subsampled to 1 FPS internally. Only used by models that support video (e.g. Gemma 4).
audiooptAUDIOAudio input, e.g. from a Load Audio node. Only used by models that support audio (e.g. Gemma 4).

Outputs (2)

NameTypeDescription
resultSTRING—
think_outputSTRING—