Nodes/storyboard/OpenAI Chat GPT
ComfyUI Node

OpenAI Chat GPT

Drop GPT-4o Straight Into a ComfyUI Workflow

By laubsauger·Created about a year ago·Updated about a year ago· 10
OpenAI Chat GPT
  • adv_config
  • STRING
promptUser Message
system_promptSystem Instructions
model
temperature1.00
use_cachingtrue

Some jobs in a ComfyUI graph are text jobs, and that's what this node is for. It's the workhorse of the comfyui-storyboard pack: a chat-completions client that takes a prompt, calls OpenAI, and returns the model's answer as a plain STRING you can wire into anything - prompt enhancement, rewriting a rough idea into a structured prompt, generating JSON for a router, writing dialogue for a video clip. If you've decided you want a frontier API model inside your graph instead of a local 8B, this is the pack's way to do it.

Before you commit, the honest framing: for short structured rewriting - the typical LLM job in an image pipeline - a small local model is often the better answer. It's free, uncensored, and offline per call. You reach for the API when you genuinely want frontier quality and don't mind paying per call. This node is that API path.

How it works

It reads your API key from the pack's config.json (set up once with the pack's OpenAI API Key Manager node), builds a system + user message pair from your inputs, and calls client.chat.completions.create() using the official openai Python package. The model's reply comes back as a STRING.

The caching is the clever bit. With use_caching on (the default), the node remembers the exact input set - prompt, system prompt, model, temperature, advanced config - and if you queue again with nothing changed, it returns the cached reply without spending a cent. You can see it working: the use_caching widget's label reads [ 🔄 New ], [ ✅ Cached ], or [ ❌ Error ] after each run. The cache lives in memory for the ComfyUI session, so it resets on restart. That's fine - the point is not re-billing the same prompt while you tweak the rest of the graph.

The inputs that matter

  • prompt - the user message.
  • system_prompt - the system instructions. This is where you set the behavior ("You are a prompt engineer who rewrites rough ideas into detailed, structured prompts...").
  • model - a dropdown of 15 GPT models, from gpt-4o-mini up through gpt-4o, gpt-4-turbo, gpt-4, and down to gpt-3.5-turbo-instruct.
  • temperature (0–2, default 1.0) - the creativity dial; drop it low for consistent rewriting.
  • use_caching (bool, default on) - the API-cost saver above.
  • adv_config (optional) - wire in the pack's OpenAI Adv. Config node for response format and seed.

The output

  • STRING - the model's reply. Feed it to a text node, a prompt node, or the pack's Markdown Renderer to see it formatted.

Install & key setup

# ComfyUI Manager → search "comfyui-storyboard" → Install → Restart
# or
cd ComfyUI/custom_nodes
git clone https://github.com/laubsauger/comfyui-storyboard

Two things beyond install: the openai pip package (Manager installs it; manual installs need pip install -r requirements.txt) and a valid key saved via the Key Manager node. No model files to download - everything runs in OpenAI's cloud.

Where people get burned

  • The model list is frozen in time. It's a hardcoded dropdown, and it shows its age - gpt-4-vision-preview, gpt-4-0125-preview, and gpt-3.5-turbo-instruct are legacy or deprecated names. Newer models won't appear until the pack updates, and deprecated ones can return errors on OpenAI's side. Expect to babysit the dropdown.
  • Errors come back as strings. If the call fails - bad key, dead model - the node returns Error: ... as its STRING output and labels the cache widget ❌ Error. Check that label before blaming downstream nodes.
  • It costs real money. Caching helps, but every genuinely new prompt is a billed call. And at the default temperature of 1.0 the same prompt can answer differently run to run; if you're using it to drive a pipeline, drop temperature toward 0 for reproducibility.

Use it as the text engine it is, keep an eye on the cache label, and remember that the model dropdown needs the pack to stay updated.

Categorystoryboard/LLM/OpenAI

Inputs (6)

NameTypeDefaultDescription
promptSTRINGUser Message
system_promptSTRINGSystem Instructions
modelCOMBO15 options: gpt-4o-mini, gpt-4o, gpt-4-turbo, gpt-4-turbo-preview, gpt-4-0125-preview, gpt-4-1106-preview, +9
temperatureFLOAT1.000–2
use_cachingBOOLEANtrue
adv_configoptADV_CONFIG

Outputs (1)

NameTypeDescription
STRINGSTRING