💬 AITEC LLM Chat
Chat with a local LLM in ComfyUI — with the reasoning-tag cleanup built in
- model
- text
- used_model
- status
Once an AITEC LLM Loader has a model in memory, AITEC LLM Chat is where the actual conversation happens. It takes the model pin, your system_prompt and prompt, runs inference through llama-cpp-python, and returns the reply as text you can push into a CLIP encoder, a filename builder, or a display node. Multiple Chat nodes can hang off one loader and share the same model - no extra memory per node, which the README is proud of and should be.
The standard wiring is the shortest chain in the pack:
[AITEC LLM Loader] → model → [AITEC LLM Chat] → text
The generation knobs are familiar: temperature (0–2, default 0.7), top_p (default 0.95), max_tokens (default 4096, min 64). The author's tooltip on max_tokens is worth heeding: thinking models want 4096 or more, because their reasoning block eats tokens before you get a single word of answer.
Then come the toggles, and these are the real personality of this node - they exist because Qwen3 and Gemma-class models dump markup into their output:
remove_think- strips the<think>...</think>reasoning block (and Gemma 4's<|channel|>blocks). On by default, and you'll want it on.remove_chatml- when a model repeats<|im_start|>assistant...<|im_end|>blocks, this keeps only the first response. On by default.suppress_thinking- appends a "don't think, answer directly" instruction to your system prompt. Off by default, and it's a softer hammer than stripping the tags after the fact.reset_kv_cache- on by default. Resets the KV cache before each inference so every run starts clean and doesn't exhaust the context. The tradeoff, per the tooltip: turn it off if you actually want a running conversation history across runs.unload_after_run- off by default. On, it frees the model from VRAM after the call (you'll reload it next run). This is your escape hatch for the "LLM + generation OOM" problem.
Outputs are three strings: text (the answer), used_model (which file answered), and status - which is more useful than it looks. A finish_reason=length status means you hit max_tokens; the "context may be exhausted" warning is the pack's way of telling you to raise n_ctx on the loader. If you ever get an empty text with a warning status, that's the fix: more context, not a different prompt.
One subtlety from the source: the node forces re-execution through its cache-bypassing IS_CHANGED hook, so it runs fresh each queue even when your input text is unchanged - useful when you want a new answer without editing the prompt.
Installation is the pack-wide path, plus the manual llama-cpp-python step the README insists on (it's not in requirements.txt - install JamePeng's prebuilt wheel):
cd ComfyUI/custom_nodes
git clone https://github.com/AI-TEC/ComfyUI-AITECCAFE-Toolkit
pip install -r ComfyUI-AITECCAFE-Toolkit/requirements.txt
# then install llama-cpp-python from the JamePeng .whl for your GPU
A practical thought: if you're mainly here to generate prompt text, start with a small quantized GGUF - a 4-bit model fits alongside your checkpoint far more comfortably than a 9B fp16. And when the README's "VRAM overflow" note shows up in practice, unload_after_run is the button.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| model | LLM_MODEL | — | |
| system_prompt | STRING | You are a helpful assistant. | — |
| prompt | STRING | Write a creative image generation prompt. | — |
| temperature | FLOAT | 0.700–2 | — |
| top_p | FLOAT | 0.950–1 | — |
| max_tokens | INT | 409664–32768 | Thinking model with 4096 or more is recommended |
| remove_think | BOOLEAN | true | Remove the <think>...</think> block (Qwen3, Gemma4, etc.) |
| remove_chatml | BOOLEAN | true | Remove repetitions of <|im_start|>assistant~<|im_end|> and return only the first response (Gemma4, etc.) |
| suppress_thinking | BOOLEAN | false | When enabled, adds an inference suppression instruction to the system prompt (for Thinking models such as Qwen3 and Gemma4) |
| reset_kv_cache | BOOLEAN | true | Reset the KV cache before inference. Set to ON to prevent context exhaustion (recommended for reasoning models such as Qwen3). Set to OFF to retain conversation history. |
| unload_after_run | BOOLEAN | false | Unload the model after execution to free up VRAM. You will need to reload it when you run it again. |
| seed | INT | 00–18446744073709550000 | Changing the value each time the code runs bypasses the cache and forces a re-execution. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| used_model | STRING | — |
| status | STRING | — |