OpenAI Client
It doesn't call anything. That's the point.
- OPENAI_CLIENT
This node is the most anticlimactic thing you'll wire up all day, and it has to be. The OpenAI Client node takes an API key and, optionally, a base URL, and hands back an OPENAI_CLIENT object - that's the entire job. The name sounds like it's doing network calls, but nothing leaves your machine here. No key is validated, no request is made. It just builds an OpenAI Python client and passes it along, because the other half of this pack - OpenAI Chat Completion - refuses to do anything until you hand it one of these.
What you actually set
Two inputs, that's the whole panel:
api_key(required) - your key for whatever endpoint you're talking to.base_url(optional) - leave it empty and it defaults to OpenAI'shttps://api.openai.com/v1. Fill it in and you're pointed at any OpenAI-compatible server: Ollama, a llama.cpp server, vLLM, OpenRouter, the works.
That base_url is the interesting part, because it's the entire reason the pack's README brags "local supported." Point the client at a local Ollama instance and you get a chat/vision model inside ComfyUI that costs nothing and never ships a byte off your machine - a genuinely nice fit for the local-first crowd, who picked ComfyUI precisely because prompts and images don't leave the box. Point it at OpenAI and you're paying per token and exporting your prompts. Same node, different privacy and cost math. The choice is yours, and it's literally one field.
One thing worth knowing: even though this node never calls out, it isn't entirely decorative. The pack adds a POST /sg_openai_models endpoint to ComfyUI's server that fetches the model list from {base_url}/models using exactly these two fields. That's how the Chat Completion node's model dropdown gets populated. So when the dropdown comes back empty or screaming "Error fetching models," the problem is almost always sitting right here: wrong key, dead server, or a base_url whose endpoint doesn't implement /models.
Installing it
It ships in the comfyui-sg-openai-client pack alongside the chat node. Via ComfyUI Manager, search comfyui-sg-openai-client and hit install. Or do it by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/sebagallo/comfyui-sg-openai-client
cd comfyui-sg-openai-client
pip install -r requirements.txt
Then restart ComfyUI. The only real dependency is the openai Python package - there are no model files to download, because the model lives on the server side, not in your ComfyUI install. If you install manually, make sure that pip install lands in the same Python environment ComfyUI itself uses, or you'll get the classic "module openai not found" error and blame the wrong node.
Where people get burned
The usual failure modes here are boring but real. Your key is stored as a plain widget value, which means it gets baked into the workflow JSON - share that workflow anywhere and you've just shared your API key, so scrub it or use a scoped/throwaway key. And because this node validates nothing, a typo'd key or a wrong base_url won't surface until the Chat Completion node actually tries to generate and comes back with an auth error or an empty dropdown. Nothing's wrong with this node when that happens - it's doing exactly what it says. Wire it up, feed it good credentials, and let the other node do the talking.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| api_key | STRING | — | |
| base_urlopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| OPENAI_CLIENT | OPENAI_CLIENT | — |