Chat GPT Image Edit Node
Edit images with OpenAI's gpt-image API — your VRAM stays untouched
- IMAGE
- STRING
The name says "ChatGPT," the node looks like every other box in your graph, and it'll happily sit right next to your SDXL checkpoint without complaining. But this one does no work locally. It's an API wrapper: it ships your image up to OpenAI's gpt-image edit endpoint, waits for the result, and hands it back to the rest of your workflow as an ordinary IMAGE tensor. No model download, no VRAM pressure, no ControlNet. The price of admission is an OpenAI API key and per-image cost.
Why would you reach for that in a local-first tool? Because OpenAI's models are genuinely good at some things your local stack isn't. The author's own use case is the best example: he generates characters locally in SDXL, then lets OpenAI generate the backgrounds, because the closed model just renders them better. This edit node is the other half of that hybrid - send an image up for an edit or composite, get a finished tensor back, and continue downscaling or upscaling locally.
How it works
Feed it a prompt plus up to two images, and it calls OpenAI's Images API images.edit with the size, quality, and input_fidelity you picked. The response comes back as base64, gets decoded, and lands on the output as a proper ComfyUI image you can pipe into Save Image or anything else in the graph.
The one input that trips people up: image1 and image2 are STRING, not IMAGE. They expect base64-encoded PNG data. This pack ships a "Convert Image to Base64" node precisely for that - wire your IMAGE tensor into it and feed its string output into the edit node. Skip that and nothing shows up on the input side.
The inputs that matter
- prompt - multiline, plain English. "Add a sunset behind the building," not a weighted prompt. This is an edit instruction, not an SD prompt.
- size -
autoor one of the presets (1024x1024,1024x1536,1536x1024). Bigger output, bigger bill. - quality -
auto/low/medium/high. Higher quality costs more credits per edit. - input_fidelity -
highorlow, defaultlow. It's passed through for the older gpt-image family; the current gpt-image-2 model handles fidelity on its own, which is why it sits atlowby default.
Outputs are IMAGE (the edited result) and STRING (the raw API response - useful to peek at when something goes sideways, since it's the only place you'll see an error message).
Install
It ships in the same pack as the generation node, so this is a one-and-done install. 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 needs openai, Pillow, numpy, torchvision, and dotenv support - Manager pulls those automatically; manually, install openai and python-dotenv into your ComfyUI Python environment.
The part no installer can do for you is the API 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 - authentication error before anything happens. Check
.envfirst. - Feeding an IMAGE tensor into
image1/image2- they're strings. Route through the pack's "Convert Image to Base64" node. - A black 1x1 image on the output - that's the node's placeholder when the API returns nothing, usually a refused prompt or a billing problem.
- Moderation - OpenAI decides what it will and won't edit, and its guardrail behavior has flip-flopped over the years. If a prompt keeps getting refused, that's the filter, not your ComfyUI setup.
- Cost and privacy - the image leaves your machine and every edit costs money. That's the whole deal with a closed API; fine for hybrid workflows, wrong for anything private or high-volume.
If you'd rather not feed OpenAI at all, the same author's pack also carries "Banana" nodes that do this trick against Google's Nano Banana API instead.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Edit image according to this prompt. | — |
| size | COMBO | auto | 4 options: auto, 1024x1024, 1024x1536, 1536x1024 |
| quality | COMBO | auto | 4 options: auto, low, medium, high |
| input_fidelity | COMBO | low | 2 options: high, low |
| image1opt | STRING | — | |
| image2opt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| STRING | STRING | — |