Nodes/comfyui-openai-compatible/OpenAI Compatible LLM
ComfyUI Node

OpenAI Compatible LLM

Talk to any OpenAI-compatible endpoint (OpenAI, OpenRouter, Groq, LM Studio, Ollama, vLLM, ...). Enter the base URL and API key, press 'Refresh models' to load the model list, then connect as many text inputs as you need.

By aiko929·Created 13 days ago·Updated 13 days ago· 0
OpenAI Compatible LLM
  • prompts
  • images
  • video
  • text
base_urlhttps://api.openai.com/v1
api_key
model(press Refresh models)
system_prompt
input_modejoin
separator\n\n
temperature1.00
max_tokens0
timeout180
seed0
reuse_last_resultfalse
image_detailauto
image_formatjpeg
image_max_side0
video_max_mb20
Categoryapi/text

Inputs (18)

NameTypeDefaultDescription
base_urlSTRINGhttps://api.openai.com/v1Endpoint root, i.e. the part before /models and /chat/completions.
api_keySTRINGAPI key. Careful: it is saved inside the workflow. Leave empty to use the OPENAI_COMPATIBLE_API_KEY / OPENAI_API_KEY environment variable, or type 'env:MY_VARIABLE' to read a specific one.
modelCOMBO(press Refresh models)Filled by the 'Refresh models' button from GET {base_url}/models.
promptsCOMFY_AUTOGROW_V3Text inputs that make up the prompt. A new slot appears every time you connect one, up to 16. Empty inputs are skipped.
system_promptoptSTRINGOptional instructions sent as the system message.
input_modeoptCOMBOjoinjoin: glue all text inputs into a single user message. separate_messages: send each text input as its own user message.
separatoroptSTRING\n\nUsed by 'join' mode. \n and \t are turned into real newlines/tabs.
temperatureoptFLOAT1.00-1–2Sampling temperature. Set to -1 to leave it out of the request.
max_tokensoptINT00–1000000Maximum tokens in the answer. 0 leaves it up to the provider.
timeoutoptINT1805–3600Seconds to wait for the response.
seedoptINT00–18446744073709550000Not sent to the API: it only controls whether this node re-runs instead of returning its cached answer.
reuse_last_resultoptBOOLEANfalseOn: output the answer this node produced last time and do not call the API at all, no matter what changed upstream. Off: generate normally. The stored answer survives restarts; if there is nothing stored yet, one answer is generated and kept.
imagesoptIMAGEOptional image(s) to look at. Every frame of the batch is sent as its own image, attached to the last user message. Needs a vision-capable model.
videooptVIDEOOptional video, inlined as a video_url block. Support is provider-specific and size limits are usually low; most models reject it.
image_detailoptCOMBOautoOpenAI 'detail' hint. 'low' is much cheaper, 'high' reads fine print.
image_formatoptCOMBOjpegHow images are encoded. png is lossless (better for text/UI screenshots).
image_max_sideoptINT00–8192Downscale images so the longest side is at most this many pixels, to save tokens and upload time. 0 sends them at full size.
video_max_mboptINT201–500Refuse to upload a video larger than this, instead of failing at the provider.

Outputs (1)

NameTypeDescription
textSTRING