OpenAI Inference
One node for every OpenAI-compatible LLM backend, with vision and thinking mode
- image
- response
- reasoning
OpenAIInference is a single node that talks to any OpenAI-compatible API - OpenAI proper, vLLM, Ollama's /v1 endpoint, Gemini's OpenAI-compatible endpoint, whatever. Point base_url, api_key, and model at the server you want, give it a prompt, and it returns the answer as a STRING you can wire into anything. It also does vision (feed it an IMAGE) and thinking mode (get the reasoning trace back separately).
If you've been doing tag-optimization or prompt-rewriting workflows with hardcoded scripts, this is the node that makes it a first-class part of the graph. Toss a prompt in from a prior node, get a refined prompt out, feed it to your sampler. That's the whole game for a lot of this pack's audience.
How it works
It's a thin, careful wrapper around the Chat Completions API. The prompt and system instruction go in as messages; temperature and seed are passed through; max_output_tokens caps the reply. If you feed it an image, it encodes the tensor to PNG, base64s it, and attaches it as an image_url content part in the standard vision format - no separate vision endpoint to configure.
Two details make it friendlier than a raw API call:
- Auto model detection. Leave
modelempty and it hits/modelson your backend and picks the model - if exactly one is available. Nice for local Ollama setups where you've got one model loaded. - Thinking mode. With
thinkon, it requests the reasoning trace. Some backends (vLLM, DeepSeek-style) return it as areasoning_contentfield; others inline it as<think>...</think>. Either way the node splits it out soresponseis the clean answer andreasoningis the trace - empty if there was none.
Credentials follow the pack's pattern: node inputs first, falling back to OPENAI_BASE_URL / OPENAI_API_KEY env vars. There's also a cache so identical calls don't re-bill you.
Outputs are response (the answer) and reasoning (the thinking trace). Both STRING.
Inputs that matter
prompt- what you're asking. Multiline.base_url/api_key/model- set all three unless you're leaning on env vars.base_urlfor OpenAI ishttps://api.openai.com/v1.max_output_tokens(default 100) - the one beginners consistently under-set. Tag-rewriting replies are short, but a full prompt restructure can blow past 100 tokens.think- flip on for reasoning models.
Install
Part of ComfyUI-Alchemine-Pack:
cd ComfyUI/custom_nodes
git clone https://github.com/alchemine/comfyui-alchemine-pack
pip install -r requirements.txt
Or via ComfyUI Manager (search "ComfyUI-Alchemine-Pack"). The pack's only dependency is python-dotenv; this node needs no local models at all, just a reachable API.
Common issues
Empty model with a backend that exposes several models fails the auto-detect - it needs exactly one to pick for you; otherwise type the model name. max_output_tokens at the default 100 truncates long generations silently. And if you're using a .env file, remember ComfyUI needs a restart for env changes to take effect - the "it worked yesterday" ghost is almost always a stale env.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Hello, world! | — |
| system_instruction | STRING | You are a helpful assistant. | — |
| base_url | STRING | — | |
| api_key | STRING | — | |
| model | STRING | — | |
| max_output_tokens | INT | 1001–131072 | — |
| seed | INT | 0 | — |
| temperature | FLOAT | 0.70–2 | — |
| think | BOOLEAN | false | — |
| imageopt | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| response | STRING | — |
| reasoning | STRING | — |