OpenAI chatGPT
Call OpenAI from inside your graph — with a model list frozen in late 2023
- secret_key
- image_url
- text
- image_url
Openai_chatGPT (2lab) does exactly what the name promises: it takes a prompt, calls OpenAI's chat API, and hands the reply back to your graph as a string. The use case is the one that made LLM-in-ComfyUI a thing - using a general-purpose language model as a prompt writer, reworder, tag translator, or workflow brain. Feed it "write a prompt for a cyberpunk street market at night," wire the text output into your CLIP Text Encode, and the graph generates from whatever it came up with.
The feature to know about before you get excited: the model dropdown is a snapshot from late 2023. The choices are gpt-3.5-turbo, gpt-3.5-turbo-16k-0613, gpt-4, and gpt-4-vision-preview. No gpt-4o, no o1, no current anything - the author built this around the GPT-3.5/GPT-4 era and never updated it. gpt-3.5-turbo still resolves on modern accounts (OpenAI keeps that alias alive), but the others are legacy names. If you need a current model, you'd have to edit the pack's source - which for a tool that's otherwise "install and forget" is the single biggest asterisk on this node.
How it works
Required inputs:
- secret_key - your OpenAI API key, a
KEY-typed field. The good news:KEYrenders as a masked input, so it's not displayed in plaintext on the graph. - prompt - the message, multiline.
- model - the four-choice enum above.
Optional:
- image_url - a
TEXTfield. This is the vision-era hook: withgpt-4-vision-preview, paste an image URL and ask the model to describe it, read text in it, or evaluate it.
Outputs:
- text - the model's reply, the one you'll actually wire somewhere.
- image_url - a string output the author never documents. In the vision flow it plausibly echoes an image URL, but don't build a pipeline on an undocumented output.
Two warnings that actually matter. First, cost and keys: this is a paid API call on every queue, and your key lives in the workflow. ComfyUI bakes workflow JSON into output images, so sharing a generated PNG can leak a key that's sitting in a widget. Don't share graphs with a live key in them - use a placeholder and paste the real key locally. Second, the reply is only as reliable as the model's prose; for prompt-writing you'll often want a replace_text-style cleanup or a sanity check downstream. Wiring a language model's output straight into a sampler is fun; trusting it blindly is how you get nonsense prompts.
Installing it
From AI2lab/comfyUI-tool-2lab. ComfyUI Manager → search comfyUI-tool-2lab → Install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/AI2lab/comfyUI-tool-2lab
Restart ComfyUI after. No models to download, no Python dependency hell - the only requirement is a valid OpenAI key and network access. This is the pack's most mainstream node and the one with the most moving parts: it works, but check the model list before you build your whole workflow on it.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| secret_key | KEY | — | |
| prompt | STRING | — | |
| model | COMBO | gpt-3.5-turbo | 4 options: gpt-3.5-turbo, gpt-3.5-turbo-16k-0613, gpt-4, gpt-4-vision-preview |
| image_urlopt | TEXT | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| image_url | STRING | — |