Chat GPT Image Generation Node
Generate gpt-image pictures inside ComfyUI and keep the dialogue going
- IMAGE
- STRING
- STRING
This is the node that started the whole pack. Sam Tyurenkov posted it to r/comfyui in May 2025 with the honest title "My first node, not much, but still" and an even more honest explanation: he needed OpenAI's image models for backgrounds his local SDXL pipeline couldn't do, and got tired of copy-pasting between the ChatGPT window and ComfyUI.
So here's the thing to get straight before anything else: the name says "Chat GPT," it sits in your graph like every other node, and it does zero generation locally. This is a cloud-API wrapper. It sends your prompt up to OpenAI's image-generation endpoint, waits for the result, and hands it back as a normal ComfyUI IMAGE tensor. No checkpoint download, no VRAM pressure, no negative prompt. The price of admission is an OPENAI_API_KEY and per-image cost.
How it works
Under the hood the node calls OpenAI's Responses API (client.responses.create) with an image_generation tool attached, passing your size, moderation, and quality into the tool's settings. It has two modes, and they're worth understanding because they change what the inputs do:
- Start a dialogue - a fresh request. Your prompt goes in as text, and you can attach up to two images as context.
- Continue a dialogue - you feed a
response_idfrom a previous run into the optional input, and the node sends it asprevious_response_idinstead. Any images you loaded are ignored; the conversation just keeps going, same as chatting with the model.
The pack also ships a "Convert Image to Base64" utility node, and you'll want it: the image1/image2 inputs are STRING, not IMAGE. They expect base64-encoded PNG data, which is exactly what that utility outputs.
The inputs that matter
- prompt - multiline, plain English. The default is "Generate image based on provided image(s)," so it's built to work with reference images, not pure text-to-image.
- size -
autoor one of the presets like1024x1024and1536x1024. Bigger costs more. - moderation -
auto(standard OpenAI moderation) orlow, which skips the moderation pass. This is the knob to reach for whenautokeeps refusing things you consider perfectly fine. - quality -
auto/low/medium/high. Price scales with quality.
Optional inputs are image1, image2 (base64 strings), and response_id. Outputs are IMAGE (the generated result, wire it into a Save Image node), STRING (the raw API response - it's a big JSON blob, so don't feed it to a text display and expect prose), and STRING (the response ID - this is your handle for continue-dialogue).
Install
Same pack as the edit node, so the steps are identical. Easiest route is ComfyUI Manager:
- Open Manager → Install Custom Nodes → search comfyui_chatgpt → install → restart ComfyUI.
Or the manual way:
cd ComfyUI/custom_nodes
git clone https://github.com/SamTyurenkov/comfyui_chatgpt
Then restart. The pack pulls in openai, Pillow, numpy, torchvision, and dotenv support - Manager handles those; manually, install openai and python-dotenv in your ComfyUI Python env.
The one thing neither install path can do for you is the key. The node reads OPENAI_API_KEY from the environment or a .env file in ComfyUI's working directory:
# in the ComfyUI install folder
echo "OPENAI_API_KEY=sk-..." > .env
Where people get burned
- No key set - instant authentication error. Check the
.envfile before blaming the node. - Wiring IMAGE tensors into
image1/image2- they're strings. Route through "Convert Image to Base64" first. - A 1x1 black image coming out - that's the node's placeholder when the API returns nothing usable. Usually a prompt the moderation layer rejected or a billing/account issue.
- Cost and privacy - every image leaves your machine and lands on OpenAI's servers, and you pay per image. That's the trade you're signing up for by using a closed API in a local-first tool; the community's feelings about OpenAI's guardrails have flip-flopped more than once.
Also worth knowing: this author's pack has grown. It now ships "Banana" nodes too, which do the same trick against Google's Nano Banana API if you'd rather pay Alphabet than OpenAI.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Generate image based on provided image(s). | — |
| size | COMBO | auto | 4 options: auto, 1024x1024, 1024x1536, 1536x1024 |
| moderation | COMBO | auto | 2 options: auto, low |
| quality | COMBO | auto | 4 options: auto, low, medium, high |
| image1opt | STRING | — | |
| image2opt | STRING | — | |
| response_idopt | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| STRING | STRING | — |
| STRING | STRING | — |