Text Generate (TokenFusion)
An actual LLM inside your graph — with image fusion on the side
- clip
- image_inputs
- visual_fusion_config
- Generated Text
- Seed
This is the node that turns ComfyUI's text encoder into a general-purpose LLM. No API keys, no separate server - the Qwen you already loaded as a CLIP can generate text, and UC_TextGenerate runs it as a chat model inside your graph. Feed it a prompt, get a string back that you can wire into a text encode, a file name, or a caption pipeline. The "TokenFusion" in the name is the bonus: it can also blend the visual tokens of up to sixteen images before generation, so the model reads a fused picture as context.
What it is
A text-generation node built on clip.generate. The "clip" here isn't a diffusion text encoder - it's a full LLM/VLM loaded through ComfyUI, the same way you'd load a Qwen3-VL. The node builds a chat message, tokenizes it, generates with your chosen sampling settings, and hands back plain text.
Unlike a lot of prompt-enhancer nodes, it's careful about the two things that usually break LLM-in-the-graph workflows. It builds its chat template by string concatenation instead of Python's .format(), so braces in your prompt can't throw or corrupt the template. And it offers escape_parentheses so generated text with stray ( doesn't blow up a downstream text encoder that parses weights.
How it works
Images in the autogrow image_inputs sockets are resized to vlm_resolution (default 384) before being tokenized - bigger means more detail and more VRAM, and the tooltip says so. The formula field is an optional image-blend expression: leave it empty to keep images as separate context slots, or use it to describe a fusion when the model can only take one visual input. If you want the fancy token-level blending, connect a Visual Component Fusion Configurator to visual_fusion_config instead.
sampling_mode is a dynamic combo: on exposes temperature, top_k, top_p, min_p, repetition_penalty, seed, and presence_penalty, and varies results by seed; off gives repeatable greedy-ish output. There's even empty_response_retries that re-rolls with consecutive seeds if the model returns nothing.
The inputs and outputs that matter
- clip - the LLM/VLM. This is the load-bearing choice; the node auto-detects the chat template from the encoder.
- prompt / system_prompt - what you ask and the standing instructions.
- vlm_resolution - image analysis size; 384 is the sane default, raise only when you need detail.
- max_length - cap on response length.
- thinking (optional) - include the model's reasoning text when available.
- Outputs: Generated Text (STRING) and Seed (INT), so you can reproduce a specific generation.
Installing it
It's part of ComfyUI-UtilsCollection:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection
Restart ComfyUI (or use Manager, search "ComfyUI-UtilsCollection"). Dependencies are light - just opencv-python and typing-extensions - but the pack needs a recent ComfyUI because it's built on the current Core node API.
Common issues
Watch VRAM: cranking vlm_resolution up while holding a big Qwen in memory is the fastest way to OOM. If your generated text comes back wrapped in model chatter or empty, that's what escape_parentheses and empty_response_retries are for. And remember the hard rule from the LLM-in-graph playbook: verify what a node's arbitrary Python actually does before you trust it with your model folder - this one is a legitimate collection, but the category has a documented malware history, so keep ComfyUI and the pack updated.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| prompt | STRING | Main instruction for the generated text. Braces can be used normally. | |
| system_prompt | STRING | — | |
| vlm_resolution | INT | 3840–4096 | Image analysis size. Larger values retain more detail but use more memory. |
| max_length | INT | 5121–32768 | Maximum response length. |
| formula | STRING | Optional image blend. Leave empty to keep images separate. | |
| sampling_mode | COMBO | On varies results using the seed. Off gives repeatable results. | |
| image_inputs | COMFY_AUTOGROW_V3 | Add images in order. Each image in a batch is added in order. | |
| thinkingopt | BOOLEAN | false | Include model thinking text when available. |
| escape_parenthesesopt | BOOLEAN | false | Prevents errors from parentheses left in generated text. |
| visual_fusion_configopt | VISUAL_FUSION_CONFIG | Optional settings for combining images before generation. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| Generated Text | STRING | — |
| Seed | INT | — |