π€ Imagent: OpenAI Image
Your GPU can't run gpt-image-2. This node doesn't care.
- image
OpenAI's gpt-image models have no open weights. You cannot download them, you cannot fine-tune them, and no amount of VRAM changes that. The only way to get one of these inside your ComfyUI graph is to call the API - and that's exactly what ImagentOpenAIImage is: a text-to-image node that phones OpenAI's images.generate endpoint with your API key and drops the result back in as a normal IMAGE tensor.
Why reach for it over the built-in option
ComfyUI already ships OpenAI nodes - but they route through ComfyUI's paid Partner-Node proxy on prepaid credits, with a per-image markup. Imagent is BYOK ("bring your own key"): it calls OpenAI directly, so you pay OpenAI's price and nothing else. That's the whole pitch of the pack, and it's a real one. If you already have an OPENAI_API_KEY for anything else, this node is free to run. No proxy, no extra credits, no Comfy account.
You'd pick gpt-image over your local SDXL/Flux setup for one thing in particular: text. GPT Image is the closed-model generation stack that renders words in images properly - signage, titles, UI mockups - the thing local checkpoints still embarrass themselves at. DALLΒ·E is dead (OpenAI shut it down in 2026), so this is the current lineup: gpt-image-2 (default), gpt-image-1.5, and gpt-image-1.
How it works
Mechanically it's boring, which is the compliment. The node reads prompt, model, quality, size, format and a few other widgets, builds the request, and calls the OpenAI SDK. The response (base64 or URL) gets decoded straight into a [B, H, W, 3] IMAGE tensor, so you can wire it into anything that eats an image - an upscaler, a VAE, a save node. One honest gotcha: there is no seed. OpenAI's image API doesn't accept one, so outputs aren't reproducible. ComfyUI's normal input-based caching still applies, so re-queuing an unchanged graph returns the cached image; change the prompt (or any input) to regenerate.
The inputs that matter
- prompt - the only thing you'll live in. Multiline, goes straight to OpenAI.
- model - a dynamic widget. Pick
gpt-image-2and you get the hi-res presets (up to 3840px) plus acustomsize with width/height sliders (both multiples of 16, aspect β€ 3:1). Pick a gpt-image-1.x and you get base sizes plus atransparentbackground option (needspng/webp). The node refuses to send a model a size it can't handle - it silently falls back toautorather than erroring. - quality -
autolets the model decide;low/medium/hightrade cost for fidelity. Higher quality costs more per image. - n - 1β8 images per call, returned as a batch.
- output_format / output_compression -
png,jpeg,webp; compression only applies to jpeg/webp.
The single output, image, is the only thing on the right side. Wire it to a save/preview node and go.
Install
ComfyUI Manager β Custom Nodes Manager β search Imagent β Install, then restart. Or the manual way:
cd ComfyUI/custom_nodes
git clone https://github.com/agarzon/ComfyUI-Imagent.git
pip install -r ComfyUI-Imagent/requirements.txt
Dependencies are light - just openai, Pillow, and numpy. One thing to check before installing: you need ComfyUI β₯ 0.23.0. These nodes use the new comfy_api IO schema (that dynamic model widget), which only exists in recent ComfyUI. If the node doesn't show up after install, update ComfyUI first.
The key goes in an env var (preferred) or a config.json in the extension folder:
export OPENAI_API_KEY="sk-..."
Troubleshooting
- Black image out, no crash - the node never raises, so a failed call returns an empty image and logs the real error to the ComfyUI console. Check the console first; "OPENAI_API_KEY not found" means the key didn't load.
- 403 authorization error - OpenAI may require API Organization Verification before gpt-image models can be called, even with a valid key. Complete it in the OpenAI dashboard.
- 429 rate limit - you've hit your quota. Cost is per call and it adds up faster than you expect; watch your dashboard.
- Transparent background failing on gpt-image-2 - it doesn't support transparency. Switch to a gpt-image-1.x model (with png/webp output).
And the standing caveat for every API node: your prompts leave the machine and hit OpenAI's moderation. That's the deal. You're here for a model you can't run locally - accept the trade.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Text description of the image to generate. | |
| model | COMBO | OpenAI gpt-image model. Switching this changes the options below. | |
| quality | COMBO | auto | Rendering quality. 'auto' lets the model decide; higher quality costs more. |
| output_format | COMBO | png | Image file format returned by the API. |
| output_compression | INT | 1000β100 | Compression 0-100. Applies only to jpeg and webp output. |
| moderation | COMBO | auto | Content moderation strictness. 'auto' (default) or 'low' (less restrictive). Sent only when not 'auto'. |
| n | INT | 11β8 | How many images to generate (1-8). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | β |