ComfyUI-GPT-image Generate
A top closed model, no GPU, pay per image
- image
- response_json
The short version
ComfyUI-GPT-image Generate is a ComfyUI node that turns a text prompt into an image using OpenAI's hosted GPT Image models - gpt-image-2 or gpt-image-1.5 - and drops the result back into your graph as a normal IMAGE tensor. No GPU required, no checkpoint to download, no local inference at all. The generation happens on a server, you pay per image, and the node slots into your workflow exactly like any local generator.
To be clear about what "GPT-image" means here: it's not a local model. These are the closed models that set the benchmark for text rendering and instruction following - the ones the open-source community keeps measuring against. This node is a thin client that lets you use them from ComfyUI without leaving your graph.
Why you'd reach for it
You want this node when you need a generation that local weights can't quite deliver - crisp text baked into the image, a specific composition described in plain language, a benchmark-quality result to compare against your local pipeline. It's also the pragmatic pick when you're out of VRAM or don't want to babysit a heavy checkpoint. The author's relay verification suggests these models are both live and current on the default endpoint, so this is a working path to GPT-Image-2 rather than a wrapper around a dead API.
The honest caveats, because they matter: it's paid, it's not private (prompts leave your machine), and it's closed. If local-only is your whole identity, this pack isn't for you. If you're fine treating ComfyUI as workflow glue around a cloud model, this is a genuinely handy node.
How it works
The Generate node is a wrapper around POST /v1/images/generations. It builds a payload from your prompt and settings, calls the API through an async httpx client, decodes the returned base64 image, and converts it to an IMAGE tensor for the rest of your graph. It also emits response_json - the raw API response, with the image data replaced by a placeholder so debug output stays readable.
The size handling is where this node does real work. size is a dropdown of auto / 1K / 2K / 4K tiers, and aspect_ratio offers auto, 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, and 9:16. With no input image, auto passes through to the API as-is and the preset tiers default to square; pick a tier plus an explicit ratio and the node computes a legal size. Note that gpt-image-1.5 only supports auto and 1K - the 2K/4K tiers are gpt-image-2 territory.
The inputs that matter
- prompt (required) - multiline. The whole job is here; GPT image models are genuinely good at plain-language descriptions and text-in-image.
- model -
gpt-image-2(default) orgpt-image-1.5. - n - how many images to return, 1 to 10. Each one costs money, so start at 1.
- size / aspect_ratio - presets, usually
autofor casual use. - quality, background, output_format, model_override - background gives
transparent/opaqueoptions, output format ispng/jpeg/webp, andmodel_overridesends a custom model name if your relay uses a different alias.
Outputs are image (wire to Save Image or anything downstream) and response_json (debug string).
Setup
Install via ComfyUI Manager (search "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
Then restart ComfyUI. Dependencies are light - httpx, pillow, numpy - and there are no model files. What you need is an API key. Drop a 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 relay (default, points at an OpenAI-compatible relay like AIHubMix), openai, azure, or vapeur. Env vars like OPENAI_API_KEY and GPT_IMAGE_API_PROVIDER work as an alternative.
Common issues
- 401 / 403 - wrong key, wrong base URL, or no billing access. Check config first; it's the usual culprit.
- 429 rate limit - slow down or raise quota. Requests aren't free; the API will happily charge you, and then it'll happily rate-limit you.
- "model only supports 1K" - you picked
2K/4Kongpt-image-1.5. Switch models or drop the tier. - Relay model alias mismatch - if your relay doesn't expose the stock model names, use
model_overrideto send the actual alias. - Azure - the
modelmust be your deployment name, which is exactly whatmodel_overrideis for.
One tip: with VapeurAI as the provider and gpt-image-2, the node prints a token-based cost estimate in its UI output - the only provider that gives you a bill preview, so use it before you go wild with n = 10.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | — | |
| model | COMBO | gpt-image-2 | 2 options: gpt-image-2, gpt-image-1.5 |
| nopt | INT | 11–10 | — |
| sizeopt | COMBO | auto | 4 options: auto, 1K, 2K, 4K |
| aspect_ratioopt | COMBO | auto | 8 options: auto, 1:1, 4:3, 3:4, 3:2, 2:3, +2 |
| qualityopt | COMBO | auto | 4 options: auto, low, medium, high |
| backgroundopt | COMBO | auto | 3 options: auto, transparent, opaque |
| output_formatopt | COMBO | png | 3 options: png, jpeg, webp |
| model_overrideopt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| response_json | STRING | — |