Nodes/comfyui-byokey/BYOKey GPT Image (OpenAI)
ComfyUI Node

BYOKey GPT Image (OpenAI)

GPT Image and DALL·E 3 in ComfyUI without Comfy's credit meter

By MeteorAndy·Created 4 months ago·Updated 3 months ago· 0
BYOKey GPT Image (OpenAI)
  • image
  • mask
  • image
api_key
base_urlhttps://api.openai.com/v1
prompt
modelgpt-image-2
sizeauto
qualitylow
backgroundauto
n1
seed0
custom_width1024
custom_height1024
stylenatural

OpenAI's image models - GPT Image 2, and DALL·E 3 for the retro route - are closed, so the only way they get into a ComfyUI graph is through a node that calls the API. BYOKey_ImageGen is that node, minus the middleman: it's the drop-in equivalent of the official OpenAI image node, but it hits api.openai.com with your own key (no Comfy proxy, no prepaid credits). You pay OpenAI's rates directly, and the node returns a real ComfyUI IMAGE tensor that flows into the rest of your graph like any local generation.

This is the classic "closed model inside an open workflow" move the KB covers: you can't run GPT Image on your GPU, so if you want its text rendering and scene coherence alongside your local upscaler and masking, this is the door. GPT Image is genuinely good at text-in-image and following complex prompts - its fidelity jumped a lot from the earlier 4o/DALL·E generation.

How it works

Text-to-image uses images/generations; if you wire in a reference image (or a mask), it switches to images/edits multipart and does an edit/inpaint instead - the mask's white areas get replaced, and the tooltip requires exactly one reference image for that mode. Responses are decoded back into an IMAGE tensor. Nothing runs locally; the generation happens on OpenAI's servers.

The inputs that matter

  • model - gpt-image-2 (default), gpt-image-1.5, gpt-image-1, or dall-e-3. Everything fancy below is gpt-image-2 territory.
  • size - presets from 1024x1024 up to 3840x2160, plus auto and Custom. Choosing Custom unlocks custom_width/custom_height (1024–3840, must be a multiple of 16) - gpt-image-2 only.
  • quality - low/medium/high for the GPT models, standard/hd for DALL·E 3. Cheap drafts at low, finals at high.
  • background - auto/opaque/transparent; note transparent is not supported by gpt-image-2.
  • n (1–8) - how many images per call. style (natural/vivid) is DALL·E 3 only.
  • image + mask - the edit/inpaint path described above.

One honest footnote: seed is in the schema but the tooltip says it's "not implemented yet in backend." Set it if you like, just don't expect reproducibility from OpenAI.

Output is image (IMAGE) - wire it straight into a preview, an upscaler, an image-to-video node, whatever.

Installing it

It's one of 37 nodes in comfyui-byokey, and the pack has no extra dependencies - just what ComfyUI bundles (torch, aiohttp, PIL, numpy, av). Install via ComfyUI Manager (search "byokey") or:

cd ComfyUI/custom_nodes
git clone https://github.com/MeteorAndy/comfyui-byokey.git

Restart, and it's under api/byokey/image. No model files, no GPU needed.

Gotchas

The per-call cost is the thing people forget. A high-quality 2K+ generation adds up fast when you're iterating, and unlike a local model there's no "free after the electricity" - the KB's notes on API nodes are blunt that video jobs and high-res images are where a session gets expensive. Also, this is OpenAI: content filtering follows the model, not the node, so anything OpenAI refuses locally will refuse here - there's no bypass because there are no weights to edit. And the pack-standard security note: your key lives in the widget and gets saved into the workflow JSON, so scrub it before sharing workflows. This category of "one node, paste your key" pack has a documented malware history, and the only sane habit is reading the source - this one's open and short. If you need GPT's image quality in your ComfyUI pipeline and already pay OpenAI, this is the cleanest way in.

Categoryapi/byokey/image

Inputs (14)

NameTypeDefaultDescription
api_keySTRINGYour OpenAI API key (sk-...).
base_urlSTRINGhttps://api.openai.com/v1OpenAI-compatible API base URL. Override for relays/proxies.
promptSTRINGText prompt for GPT Image.
modelCOMBOgpt-image-2The OpenAI image model to use.
sizeCOMBOautoImage size. Select 'Custom' to use custom width/height (gpt-image-2 only).
qualityCOMBOlowImage quality. GPT Image: low/medium/high. DALL-E 3: standard/hd.
backgroundCOMBOautoReturn image with or without background. 'transparent' is not supported by gpt-image-2.
nINT11–8How many images to generate.
seedINT00–2147483647not implemented yet in backend
custom_widthoptINT10241024–3840Used only when size is 'Custom'. Multiple of 16 (gpt-image-2 only).
custom_heightoptINT10241024–3840Used only when size is 'Custom'. Multiple of 16 (gpt-image-2 only).
styleoptCOMBOnaturalDALL-E 3 only. Vivid leans hyper-real/dramatic; natural is more natural.
imageoptIMAGEOptional reference image(s) for editing (gpt-image-* only).
maskoptMASKOptional inpaint mask (white areas replaced). Requires exactly one reference image.

Outputs (1)

NameTypeDescription
imageIMAGE