Nodes/SDVN_Comfy_node/🎨 GPT Image
ComfyUI Node

🎨 GPT Image

OpenAI's gpt-image models in ComfyUI

By StableDiffusionVNΒ·Created 2 years agoΒ·Updated about a month agoΒ· 118
🎨 GPT Image
  • image
  • mask
  • IMAGE
β—„OpenAI_APIβ–Ί
β—„modelgpt-image-1β–Ί
β—„sizeautoβ–Ί
β—„seed0β–Ί
β—„promptβ–Ί
β—„qualitymediumβ–Ί
β—„backgroundopaqueβ–Ί
β—„n1β–Ί
β—„translateβ–Ύβ–Ί

This node calls OpenAI's gpt-image models - the current image stack that superseded DALL-E 3 - from inside ComfyUI. It's an API node, so it needs an OpenAI key with billing on it, and it runs on OpenAI's servers, not your card. What you get in return is the thing gpt-image is genuinely good at: text rendering, prompt following, and clean editing with a mask. It's also one of the few hosted models that does real transparent-background output.

Two reasons you'd wire this into a graph instead of using ChatGPT: you want it as a step in a larger workflow (feed its output into an upscaler, a compositor, whatever), and you want the parameters ChatGPT hides - model tier, quality, size, transparency, batch count.

How it works

Prompt goes to OpenAI, image(s) come back. If you also pass an image (and optionally a mask), it switches from generate to edit - paint a mask over the region you want changed and describe the change, same idea as inpainting. The SDVN layer adds Google Translate and dynamic-prompt support on the prompt field, so non-English prompts and {option|option} wildcards work here too.

The inputs and outputs that matter

  • OpenAI_API - your key. Paste it, or set it once in the pack's API_key.json.
  • model - gpt-image-1.5 (best fidelity), gpt-image-1 (the workhorse), or gpt-image-1-mini (cheapest). Start on mini for drafts.
  • prompt - what you want, or the edit instruction if you supplied an image and mask.
  • quality - low / medium / high / auto. This and model are your two cost dials.
  • size - auto, 1024x1024, 1536x1024, or 1024x1536. Square or the two rectangles; that's the whole menu.
  • background - opaque or transparent. Transparent gives you a real cutout PNG, which is the reason a lot of people reach for gpt-image over a diffusion model.
  • n - 1 to 4 images per run.
  • image / mask (optional) - supply both to edit an existing image in the masked region.

Output is IMAGE as a list - because n can be >1, wire it into a node that handles a batch (or a Save Image, which will save each).

How to install it

ComfyUI Manager: search SDVN_Comfy_node, install, restart. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/StableDiffusionVN/SDVN_Comfy_node

then pip install -r custom_nodes/SDVN_Comfy_node/requirements.txt from your ComfyUI root and restart. Get a key at platform.openai.com (Settings β†’ API keys), and prefer API_key.json (rename API_key.json.example) over hardcoding it in the node.

Common issues & troubleshooting

"Organization must be verified." gpt-image-1 and up often require a verified OpenAI organization before the API will return images. If you get a permissions error with a valid key, that's usually it - check your account status on the platform dashboard.

Content filtering is inconsistent. OpenAI's image moderation has swung back and forth; prompts that worked last month can trip the filter this month. A refused request errors or returns nothing, and it's server-side.

Transparent background looks wrong. It only comes out clean if the model actually produced an alpha-friendly subject; busy or photographic prompts won't cut out neatly. Pair background: transparent with high quality for the best edges.

Editing does nothing. The edit path needs both image and mask. A mask alone, or an image with no mask, won't behave the way you expect.

CategoryπŸ“‚ SDVN/πŸ’¬ API

Inputs (11)

NameTypeDefaultDescription
OpenAI_APISTRINGGet API: https://platform.openai.com/settings/organization/api-keys
modelCOMBOgpt-image-1Chọn model GPT Image
sizeCOMBOautoKΓ­ch thΖ°α»›c
seedINT00–18446744073709550000The random seed
promptSTRINGMΓ΄ tαΊ£ αΊ£nh
qualityCOMBOmediumChαΊ₯t lượng
backgroundCOMBOopaqueNền ảnh
nINT11–4Sα»‘ αΊ£nh
translateCOMBODα»‹ch prompt
imageoptIMAGEβ€”
maskoptMASKβ€”

Outputs (1)

NameTypeDescription
IMAGEIMAGEβ€”