OpenAI Compatible Chat
The chat node that talks to any LLM server — no wrapper lock-in
- images
- files
- advanced_options
- STRING
If you've ever wanted an LLM inside a ComfyUI workflow but bounced off chat nodes that only talk to one service, this is the un-locked version. OpenAI Compatible Chat is a thin client for any endpoint that speaks OpenAI's /v1/chat/completions format. Ollama, LM Studio, AMD's Lemonade Server (that's the default URL it ships with), the actual OpenAI API, or some random server on localhost - if it serves that endpoint, this node will talk to it. It's sold as a drop-in replacement for the classic ChatGPT node: same interface, way more backends.
How it works
There's nothing clever under the hood, and that's the point. The node builds a messages array, POSTs JSON to your api_url with aiohttp, and pulls choices[0].message.content out of the response. stream is hardcoded to false, so replies come back whole. No models on your disk, no weights to download - the heavy lifting happens wherever your server is.
Two things it does that are genuinely useful:
- Multi-turn context. With
persist_contexton, it keeps your conversation history in memory (keyed by a session id, plus the last response id) so follow-up prompts see earlier turns. Flip it off and every call is stateless. It's in-memory, so a ComfyUI restart wipes the conversation. - Vision + files. Drop an
IMAGEintoimagesand it's converted to a PNG base64 data URL in the request - works with any vision model on the endpoint. Thefilesandadvanced_optionsinputs take dedicated types (OPENAI_INPUT_FILES,OPENAI_CHAT_CONFIG) from the pack's companion nodes, so you can pipe in documents or a prebuilt config object.
The inputs that actually matter
- api_url - the full endpoint, e.g.
http://localhost:11434/v1/chat/completionsfor Ollama. This is the field that decides everything. - model - must match what your server serves (
llama3.2,gpt-4o-mini, whatever). A name the server doesn't know is a 400/404 waiting to happen. - api_key - leave empty for local servers. The name is a hint, not a requirement.
- prompt - your text.
persist_context- the multi-turn switch, on by default.
Worth a quick note on temperature (0–2) and top_p (0–1): they map straight onto the same-named OpenAI parameters, so treat them like you would in any API call. system_message sets the assistant's personality. The output is a single STRING - the model's reply - which you can wire into a prompt text box, a string into CLIP, or anywhere else that eats text.
Install
Through ComfyUI Manager, search for "Ninode Utils" and install, or the manual way:
cd ComfyUI/custom_nodes
git clone https://github.com/iGavroche/ComfyUI-Ninode-Utils.git
cd ComfyUI-Ninode-Utils
pip install -r requirements.txt
Then restart ComfyUI. The actual requirements.txt pulls aiohttp, torch, Pillow, numpy, and torchaudio - the torch pin is the only heavyweight and you already have it if you're running ComfyUI. The node appears under the Ninode Utils/Chat category.
Common issues
The most common failure is out-of-the-box and not really your fault: the default api_url points at Lemonade Server on 127.0.0.1:8000 while the default model is gpt-4o-mini. If you don't run Lemonade, the first run fails with a connection error. Set both fields to match the server you actually have.
- Connection refused - your local server isn't running, or the port is wrong.
- 401 unauthorized - key mismatch; empty key against a server that wants one, or vice versa.
- Model not found - the name doesn't match what the server serves; check with
ollama listor your server's UI.
One more thing, and it's the part I'd actually worry about. Your api_key lives in the workflow JSON, and ComfyUI happily embeds that JSON into output PNG metadata. Sharing a workflow image can share your key. And whatever you feed this node - prompts, full images - goes to whatever endpoint you point it at. After the ComfyUI_LLMVISION malware incident, the community rule is simple: only connect to endpoints you run or genuinely trust.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Text inputs to the model, used to generate a response. | |
| api_url | STRING | http://127.0.0.1:8000/api/v1/chat/completions | OpenAI-compatible API endpoint URL (e.g., http://127.0.0.1:8000/api/v1/chat/completions for Lemonade Server, or http://localhost:11434/v1/chat/completions for Ollama) |
| model | STRING | gpt-4o-mini | Model name to use (e.g., gpt-4o-mini, llama3.2, etc.) |
| api_key | STRING | API key for authentication (leave empty if not required) | |
| persist_context | BOOLEAN | true | Persist chat context between calls (multi-turn conversation) |
| imagesopt | IMAGE | Optional image(s) to use as context for the model. To include multiple images, you can use the Batch Images node. | |
| filesopt | OPENAI_INPUT_FILES | Optional file(s) to use as context for the model. Accepts inputs from the OpenAI Chat Input Files node. | |
| advanced_optionsopt | OPENAI_CHAT_CONFIG | Optional configuration for the model. Accepts inputs from the OpenAI Chat Advanced Options node. | |
| max_tokensopt | INT | 10001–100000 | Maximum number of tokens to generate |
| temperatureopt | FLOAT | 0.70–2 | Controls randomness in the response (0.0 = deterministic, 2.0 = very random) |
| top_popt | FLOAT | 1.000–1 | Controls diversity via nucleus sampling (0.0 = only most likely tokens, 1.0 = all tokens) |
| system_messageopt | STRING | Optional system message to set the behavior of the assistant |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |