LLM Chat Completion
The node that actually talks to the LLM — with live streaming on the node
- client
- chat
- images
- STRING
- CHAT
This is where the pack's LLM workflow actually makes the phone call. LLM Chat Completion takes a client and a chat, appends your user message, sends the whole conversation to an OpenAI-compatible endpoint, and returns the model's reply as a STRING - plus the updated chat, so you can chain turns. If you've built the rest of the pipeline (client, chat, maybe a few example messages), this is the payoff node.
How it works
It appends your user_message (with any attached images) to the chat, then streams the request to {base_url}/chat/completions. Streaming is the default and it's a genuinely nice touch: the model's text appears live on the node in the UI as it generates, refreshing every few characters. For long completions that's the difference between staring at a frozen node and watching the answer arrive. When the response finishes, it's appended to the chat as the assistant message, so the returned CHAT is ready for another round.
Images in the request are base64-encoded PNGs, downscaled to the client's image_max_pixels limit before sending - so you can pass a full-res render to a vision model without blowing up the payload.
The inputs that matter
client- anLLM_CLIENTfrom LLM Create Client. This carries your API key and endpoint. No client, no call.chat- aCHATfrom LLM Create Chat (or one you've extended).user_message- your prompt for this turn (multiline).max_tokens(default0) - cap on output length.0means "don't set one," letting the model default. If you set it and the model hits it, the node treats it as an error (it raises, because a truncated reply is usually garbage you shouldn't trust).strip_thinking(defaulttrue) - if the model wraps reasoning in<thinking>...</thinking>tags (a common pattern on reasoning models), this removes it and returns just the answer. Keep it on unless you specifically want the reasoning.images(optional) - IMAGE(s) to send alongside the message.
Outputs: STRING (the reply) and CHAT (the extended conversation). Wire the string into a display or downstream logic; wire the chat back into another Completion for multi-turn.
Two gotchas
First, this family needs real API access - a key and a reachable OpenAI-compatible endpoint. It works with OpenAI, and equally with local servers (vLLM, LM Studio, an OpenAI-compatible gateway) pointed at your own base URL; model name auto makes the client query the endpoint and pick the first available model. Second, output is token-billed, so a chat you keep extending keeps getting more expensive per turn. Multi-turn is useful, but don't feed the whole history back forever without thinking about it.
Installing it
It's in Duanyll Nodepack. ComfyUI Manager → search "Duanyll Nodepack" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Duanyll/duanyll_nodepack
Under duanyll/llm. The LLM nodes need only requests, which ComfyUI already ships.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| client | LLM_CLIENT | — | |
| chat | CHAT | — | |
| user_message | STRING | — | |
| max_tokens | INT | 00–1048576 | — |
| strip_thinking | BOOLEAN | true | — |
| imagesopt | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |
| CHAT | CHAT | — |