Nodes/comfyui-llm-api-client/Universal OpenAI Hub
ComfyUI Node

Universal OpenAI Hub

Talk to any local LLM server straight from your graph

By DBMePls·Created 4 months ago·Updated 4 months ago· 0
Universal OpenAI Hub
  • image_1
  • image_2
  • image_3
  • image_4
  • extra_parameters
  • reasoning_text
  • response_text
promptDescribe this image or answer the question.
base_urlhttp://127.0.0.1:5000/v1
api_keyEMPTY
model
system_promptYou are a helpful AI assistant.
temperature1.00
top_p1.00
max_tokens8192
presence_penalty0.00
frequency_penalty0.00
seed0

The Universal OpenAI Hub is the main node of the comfyui-llm-api-client pack, and it does exactly one job: it lets you call any OpenAI-compatible LLM server from inside a ComfyUI workflow. If your server speaks the /v1/chat/completions dialect - Ollama on 11434, LM Studio on 1234, vLLM on 8000, TabbyAPI or YALS on 5000, even a cloud API - this node will talk to it. You type a prompt, it returns two text strings, done.

That's more useful than it sounds. This is the "drop an LLM into the graph as a tool" pattern: turn a rough idea into a structured prompt, caption an image, generate dialogue for a video, rewrite output into a specific format. And because the model lives in your server rather than a cloud endpoint, every call is free, offline, and uncensored - the reasons the local-LLM layer in ComfyUI exists in the first place.

How it works

Under the hood it's a thin wrapper around the official openai Python package. It builds a standard chat-completions payload, sends it to your base_url, and hands back the reply. The interesting bits are on top of that:

  • Dynamic model dropdown. On startup it pings ports 5000, 8000, 11434 and 1234, queries each server's /v1/models, and fills the model dropdown with what it finds. This is both the best feature and the biggest gotcha (below).
  • Native reasoning extraction. It parses <think>...</think> (DeepSeek-R1) and Gemma's <|channel>thought blocks out of the reply, so chain-of-thought goes to one output and the final answer to the other. Backends that return reasoning_content natively are handled too.
  • Vision, the easy way. Wire an IMAGE tensor into image_1 through image_4 and it base64-encodes it inline into the request. No resizing, no file juggling - just make sure the model you picked actually has vision.

The inputs that matter

Most of the required inputs are standard OpenAI fare you'll recognize from any chat API: temperature, top_p, max_tokens, presence_penalty, frequency_penalty, seed. The ones worth thinking about:

  • base_url - the only thing you'll change most days. http://127.0.0.1:11434/v1 for Ollama, http://127.0.0.1:1234/v1 for LM Studio, whatever your server exposes.
  • api_key - defaults to "EMPTY", which is fine: local OpenAI-compatible servers don't check it. Put a real key here only if you're hitting a hosted API.
  • model - auto-populated at startup, but you can also type any model name directly into the widget if your server wasn't running yet.
  • extra_parameters - the socket that connects the pack's Spoke nodes (TabbyAPI, YALS, vLLM Samplers). Ignore it until you have one of those wired up.

The two outputs, reasoning_text and response_text, are plain strings - they plug into any text input in the graph, or into a save/display node if you want to see the result.

Installing it

cd ComfyUI/custom_nodes/
git clone https://github.com/DBMePls/comfyui-llm-api-client
pip install openai

Then restart ComfyUI. The only real dependency is the openai package - torch, numpy and PIL already ship with ComfyUI. On Windows portable you install into the embedded environment instead: .\python_embeded\python.exe -m pip install openai. ComfyUI Manager works too: search for comfyui-llm-api-client. Note the pack downloads no model files at all - the models live in the servers you point it at.

One honesty flag: the README's own clone command is a leftover template (git clone https://github.com/YOUR_USERNAME/...). Use the real URL above or the Manager search. It's a small thing, but it tells you how new and unpolished this pack is - it's one file of Python written by a hobbyist, first commit May 2026. That's not a reason to skip it; it is a reason to skim the source before you trust it with anything sensitive, which you should do for every fresh LLM node anyway.

Where people get burned

  • The model dropdown is frozen at startup. The port scan runs once when ComfyUI loads. Start your LLM server before ComfyUI, or the dropdown only shows the fake fallbacks default_model and gpt-3.5-turbo. If that happens, just type your real model name into the widget manually.
  • 'openai' Python package is not installed in the console - you missed the pip step, or installed it into the wrong Python (portable installs are the usual culprit).
  • API Error: ... in the response output - the node couldn't reach your server. Check base_url and that the server is actually up; the startup probe only tests /v1/models, not the chat endpoint.

If you're generating in ComfyUI with a local model and want it to do more than answer text - think structured JSON, or the fancy anti-repetition samplers - the three Spoke nodes in this pack are where that happens.

CategoryUniversal LLM

Inputs (16)

NameTypeDefaultDescription
promptSTRINGDescribe this image or answer the question.
base_urlSTRINGhttp://127.0.0.1:5000/v1
api_keySTRINGEMPTY
modelCOMBO2 options: default_model, gpt-3.5-turbo
system_promptSTRINGYou are a helpful AI assistant.
temperatureFLOAT1.000–2
top_pFLOAT1.000–1
max_tokensINT81921–128000
presence_penaltyFLOAT0.00-2–2
frequency_penaltyFLOAT0.00-2–2
seedINT00–18446744073709550000
image_1optIMAGE
image_2optIMAGE
image_3optIMAGE
image_4optIMAGE
extra_parametersoptLLM_PARAMS

Outputs (2)

NameTypeDescription
reasoning_textSTRING
response_textSTRING