ChatGPT & Local LLM ♾️Mixlab
An LLM node for prompt-building right in ComfyUI
- text
- messages
- session_history
Drop a large language model into the middle of your workflow. The obvious use is prompt engineering - you type a rough idea, the LLM expands it into a rich, detailed image prompt, and that flows straight into your CLIP encoder. But it's a general chat node, so it'll also caption, translate, summarize, or answer questions about text you pass it. Despite the name it isn't locked to OpenAI: it speaks the OpenAI API format, which means it also talks to a local LLM or any compatible provider.
How it works
It's a client for a chat-completions API. You give it a system_content (the instruction that sets the AI's behavior - "You are a prompt engineer, expand this into a detailed image description") and a prompt (your actual input), it sends them off, and returns the reply as text. That's the whole loop. The intelligence lives at whatever endpoint you point it at - OpenAI's servers, a Chinese provider, or LM Studio running on your own machine.
The inputs that matter
- prompt - your message to the model.
- system_content - the standing instruction. This is where you shape the output. Want prompts, not prose? Say so here.
- model - which model to call. Defaults to
gpt-3.5-turbo; the list includesgpt-4o, the older GPT-4 variants, and some non-OpenAI names likeqwen-turbo. - api_url - a preset picker for the endpoint:
openai,api2d,Kimi,DeepSeek-V2,SiliconCloud. The last three are handy, cheaper (sometimes free) providers, a nod to the pack's Chinese user base. - api_key (optional) - your key for the chosen provider. Required for any cloud endpoint; leave it out only for a keyless local server.
- context_size - how many previous exchanges the node remembers, for multi-turn chats. Default
1. For one-shot prompt expansion you can leave it low. - custom_api_url / custom_model_name (optional) - the escape hatch. Point
custom_api_urlat something likehttp://127.0.0.1:1234/v1(LM Studio) orhttp://127.0.0.1:11434/v1(Ollama) and name the model, and you're running a fully local LLM with no key and no bills.
Outputs are text (the reply - the one you'll usually wire onward), plus messages and session_history for chaining or debugging conversations.
Installing it
Get the pack via ComfyUI Manager (search mixlab, install comfyui-mixlab-nodes, restart), or clone it:
cd ComfyUI/custom_nodes
git clone https://github.com/shadowcz007/comfyui-mixlab-nodes
then install requirements and restart. The node itself needs no model download - but if you want the local route, you separately install and run something like LM Studio or Ollama and point custom_api_url at it.
Common snags
- 401 / auth errors. Wrong or empty
api_key, or a key that doesn't match theapi_urlprovider. The key and the endpoint have to belong to the same account. - Cloud calls cost money. OpenAI bills per token. If you're iterating a lot, a local model via
custom_api_urlis free after setup - worth it for heavy prompt-expansion loops. - Local endpoint refused. Your local server isn't running, or the port's wrong. Confirm the URL works in a browser/curl first, and remember the
/v1suffix. - Model name not recognized. If you're on a custom endpoint, set
custom_model_nameto exactly what that server expects - the dropdown's OpenAI names won't map to your local model.
Nothing about this node is Mixlab-specific once it's talking - it's a plain OpenAI-format client, so any endpoint that honors that format will work, whether that's the real OpenAI, a reseller, or your own box.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | — | |
| system_content | STRING | You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible. | — |
| model | COMBO | gpt-3.5-turbo | 25 options: gpt-3.5-turbo, gpt-3.5-turbo-16k, gpt-4o, gpt-4o-2024-05-13, gpt-4, gpt-4-0314, +19 |
| seed | INT | 00–18446744073709550000 | — |
| context_size | INT | 10–30 | — |
| api_url | COMBO | openai | 5 options: openai, api2d, Kimi, DeepSeek-V2, SiliconCloud |
| api_keyopt | STRING | — | |
| custom_model_nameopt | STRING | — | |
| custom_api_urlopt | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| messages | STRING | — |
| session_history | STRING | — |