Nodes/Comfyui_gpt_2.0/GPT Image 2 AIO
ComfyUI Node

GPT Image 2 AIO

The whole OpenAI image API in one node, no GPU required

By Poo-DH·Created 4 months ago·Updated 3 months ago· 1
GPT Image 2 AIO
  • mask
  • image_1
  • image_2
  • image_3
  • image_4
  • image_5
  • image_6
  • image_7
  • image_8
  • images
  • alpha_mask
  • revised_prompt
  • metadata
promptA polished product photo of a futuristic eyewear display.
model_namegpt-image-2
image_count1
aspect_ratioAuto
image_size2K
qualityauto
backgroundauto
output_formatpng
moderationauto
api_key

Let's be honest about why you're here: you want GPT Image's text rendering and prompt adherence, and there's no local version to download. OpenAI's image models are closed, full stop - no weights, no GGUF, no fine-tune. The only door is the API, and this node is that door, turned into a single box that drops its result into your ComfyUI graph like a local sampler made it. It's the flagship of the Comfyui_gpt_2.0 pack, and the one you'll actually reach for if you want OpenAI's image output inside your normal workflow instead of bouncing out to the ChatGPT tab.

What it actually does

Under the hood it's a thin HTTP client for api.openai.com/v1/images. No input image connected? It calls /generations (pure text-to-image). One or more of the eight image_1 through image_8 sockets plugged in? It switches to /edits automatically, uploading your images as PNGs. Same node, two entirely different API calls, zero manual switching - that's the "AIO" in the name, and it's the thing that makes this more than a toy wrapper.

That dual mode is the real point. GPT Image is famous for being able to take up to eight reference images and edit them coherently - restyle a product shot, swap a background, keep a subject consistent across variations. In ComfyUI terms this node is the only step you need between "load a reference image" and "get the edited result back," which fits naturally next to your local stuff: generate the composition locally, send it up to GPT for the polish that needs text, composite the result back down with a local upscaler.

The inputs that matter

You mostly set three things and leave the rest alone:

  • prompt - the whole game, as always.
  • model_name - gpt-image-2 (the moving alias) or gpt-image-2-2026-04-21 (a pinned snapshot). Default is the alias; use the snapshot if you care about reproducibility.
  • image_count - 1 to 4 images per generation call. Note it only applies to generation: once you connect a reference image, edits come back one at a time and image_count is ignored.

Then the quality knobs, which all pass straight through to the API: aspect_ratio (Auto plus the usual 1:1, 16:9, 9:16, 21:9, …), image_size (1K/2K/4K), quality (auto/low/medium/high), background (auto/opaque/transparent), output_format (png/jpeg/webp), and moderation (auto/low). The mask input takes a ComfyUI MASK for localized edits - white region gets edited, black gets preserved, and the node converts it to the transparent-PNG-alpha form OpenAI's edit API actually expects.

Outputs

Four of them, and they cover the whole flow: images (the generated/edited IMAGE), alpha_mask (the alpha channel pulled out as a MASK - white where the image is transparent, handy if you asked for a transparent background and want to composite it), revised_prompt (OpenAI's rewritten version of your prompt, useful to learn what it actually listened to), and metadata (compact JSON with sizes, timestamps, and the revised prompts).

Installing it

Two routes, both easy. In ComfyUI Manager, search for Comfyui_gpt_2.0 and install. Or do it by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/Poo-DH/Comfyui_gpt_2.0
cd Comfyui_gpt_2.0
pip install -r requirements.txt

Dependencies are tiny - just python-dotenv and requests. No model files, no heavy DL packages; your GPU isn't involved at all. Then restart ComfyUI and add your OpenAI key - either a .env file inside the pack folder (OPENAI_API_KEY=...) or the node's api_key input, with the node input winning if both are set. That's it.

Where people get burned

The big one: when the API call fails, the node doesn't error the graph - it hands you a 64×64 black image and stuffs the real error into the metadata output. If you suddenly see tiny black squares, you didn't break ComfyUI; your call failed. Read the metadata string (a Text node will show it) and you'll get the actual message - usually a missing key (OPENAI_API_KEY is not configured...) or an API-side refusal.

Also keep two things in perspective. Moderation is baked into the model, not the node - the moderation input is pass-through, not a bypass, and a refusal will surface as a metadata error. And on cost: unless you're on Auto aspect ratio, the request OpenAI bills is always one of the ~1MP native sizes, and 1K/2K/4K mostly decides what you get after the node locally resizes the result (4K is a LANCZOS upscale to a 4096 long side, not native 4K generation). Every run is a metered call, so it adds up - but you're not paying for 4K when you ask for it.

CategoryPOODH/GPT Image

Inputs (19)

NameTypeDefaultDescription
promptSTRINGA polished product photo of a futuristic eyewear display.
model_nameCOMBOgpt-image-22 options: gpt-image-2, gpt-image-2-2026-04-21
image_countINT11–4
aspect_ratioCOMBOAuto11 options: Auto, 1:1, 2:3, 3:2, 3:4, 4:3, +5
image_sizeCOMBO2K3 options: 1K, 2K, 4K
qualityCOMBOauto4 options: auto, low, medium, high
backgroundCOMBOauto3 options: auto, opaque, transparent
output_formatCOMBOpng3 options: png, jpeg, webp
moderationCOMBOauto2 options: auto, low
api_keyoptSTRING
maskoptMASK
image_1optIMAGE
image_2optIMAGE
image_3optIMAGE
image_4optIMAGE
image_5optIMAGE
image_6optIMAGE
image_7optIMAGE
image_8optIMAGE

Outputs (4)

NameTypeDescription
imagesIMAGE
alpha_maskMASK
revised_promptSTRING
metadataSTRING