ComfyUI Node

ComfyUI-GPT-image Edit

Edit images with GPT-Image-2 from inside ComfyUI — no GPU, just an API key

By magicwang1111·Created 4 months ago·Updated about a month ago· 0
ComfyUI-GPT-image Edit
  • images
  • image
  • response_json
prompt
modelgpt-image-2
n1
sizeauto
aspect_ratioauto
qualityauto
backgroundauto
output_formatpng
input_fidelitylow
model_override

The short version

ComfyUI-GPT-image Edit is a node that takes one or more images from your graph, sends them to OpenAI's GPT Image API (gpt-image-2 or gpt-image-1.5), and hands you back the edited result as a normal IMAGE tensor. No GPU, no checkpoint download, no weights to manage - the generation happens on a server you pay per image. What you get is a closed, state-of-the-art model living inside your ComfyUI workflow.

The name trips people up, so get it out of the way early: "GPT-image" here is not a local model. It's OpenAI's hosted image models - the ones that embarrass most open checkpoints on text rendering and following fiddly instructions. ComfyUI just becomes the workflow glue around a paid, closed API.

Why you'd reach for it

This is a niche, but a real one. When you want a second opinion from a top-tier model without burning GPU hours or downloading a huge checkpoint, this node is the fastest path. It's also genuinely useful for style-transfer and "change the season but keep the scene" edits, where the GPT models are strong. If you're committed to local-only generation - privacy, cost, no prompts leaving the machine - this pack is not for you. The tradeoff is real: your prompts and images go to a third party, and every request costs money.

The honest pitch is comparison and finishing work: generate locally, then run the result through GPT-Image for the version that handles text-in-image and complex instructions. It's the lowest-friction way to get a closed benchmark model into your own graph.

How it works

The Edit node converts each input IMAGE tensor to a PNG, then sends a multipart POST to /v1/images/edits with image[] fields. Wire in several images and you get multi-image reference editing - the author's probe script verified up to 24 input images on the default relay. The response comes back as base64, which the node decodes back into an IMAGE tensor you can feed into Save Image or anything else.

Two details worth knowing. First, size is a preset tier (auto / 1K / 2K / 4K) that the node resolves into real dimensions - with auto, it reads the first input image's long edge and picks a legal size in the matching tier, preserving ratios like 4:3 instead of squashing them to square. Second, response_json gives you the raw API response for debugging, but with the image payload replaced by a placeholder so your logs don't explode.

The inputs that matter

Only a few of these are things you'll touch daily:

  • prompt (required) - multiline, the edit instruction. This is the whole job: "change the season to winter," "put a red scarf on the person."
  • images (required) - an IMAGE input, wired from Load Image or any generator.
  • model - gpt-image-2 or gpt-image-1.5. Default is gpt-image-2.
  • n - how many variations, 1 to 10.
  • input_fidelity - low or high, how faithfully it preserves the input. The one genuinely Edit-specific knob.
  • size and aspect_ratio - presets, usually left on auto.
  • quality, background, output_format, model_override - leave alone unless you know you need them.

The two outputs are image (the result, wire it to Save Image) and response_json (a debug string).

Setup

Install through ComfyUI Manager by searching "ComfyUI-GPT-image", or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/magicwang1111/ComfyUI-GPT-image.git
cd ComfyUI-GPT-image
python -m pip install -r requirements.txt

Restart ComfyUI. Dependencies are light - just httpx, pillow, and numpy - so no heavyweight installs and no model files. What it does need is an API key, configured in config.local.json in the repo root:

{
  "api_key": "sk-...",
  "api_provider": "relay",
  "base_url": "https://aihubmix.com/v1",
  "request_timeout": 600
}

api_provider is one of relay (default, an OpenAI-compatible relay), openai, azure, or vapeur. Environment variables like OPENAI_API_KEY and GPT_IMAGE_API_PROVIDER work too.

Common issues

  • 401 / 403 - wrong key, wrong base_url, or no billing/model access on the account. Check the config first; this is the #1 failure.
  • 429 rate limit - you're hammering the API. Wait, or get a project with higher quota.
  • "model only supports 1K" - gpt-image-1.5 tops out at 1K; picking 2K/4K errors out. Switch to gpt-image-2 or drop the tier.
  • Relay uses a different model name - put the relay's actual model string in model_override. Same trick for Azure, where the "model" has to be your deployment name.
  • VapeurAI edits - input_fidelity is silently omitted because that endpoint doesn't list it, so don't chase a fidelity setting that Vapeur ignores.

Start with one auto-everything edit before building anything elaborate - it's the fastest way to confirm your key, provider, and billing all work.

CategoryComfyUI-GPT-image

Inputs (11)

NameTypeDefaultDescription
promptSTRING
imagesIMAGE
modelCOMBOgpt-image-22 options: gpt-image-2, gpt-image-1.5
noptINT11–10
sizeoptCOMBOauto4 options: auto, 1K, 2K, 4K
aspect_ratiooptCOMBOauto8 options: auto, 1:1, 4:3, 3:4, 3:2, 2:3, +2
qualityoptCOMBOauto4 options: auto, low, medium, high
backgroundoptCOMBOauto3 options: auto, transparent, opaque
output_formatoptCOMBOpng3 options: png, jpeg, webp
input_fidelityoptCOMBOlow2 options: low, high
model_overrideoptSTRING

Outputs (2)

NameTypeDescription
imageIMAGE
response_jsonSTRING