Nodes/Imagent/πŸ€– Imagent: OpenAI Image
ComfyUI Node

πŸ€– Imagent: OpenAI Image

Your GPU can't run gpt-image-2. This node doesn't care.

By agarzonΒ·Created 2 months agoΒ·Updated 2 months agoΒ· 0
πŸ€– Imagent: OpenAI Image
    • image
    β—„promptβ–Ί
    β—„modelβ–Ύβ–Ί
    β—„qualityautoβ–Ί
    β—„output_formatpngβ–Ί
    β—„output_compression100β–Ί
    β—„moderationautoβ–Ί
    β—„n1β–Ί

    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-2 and you get the hi-res presets (up to 3840px) plus a custom size with width/height sliders (both multiples of 16, aspect ≀ 3:1). Pick a gpt-image-1.x and you get base sizes plus a transparent background option (needs png/webp). The node refuses to send a model a size it can't handle - it silently falls back to auto rather than erroring.
    • quality - auto lets the model decide; low/medium/high trade 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.

    CategoryImagent

    Inputs (7)

    NameTypeDefaultDescription
    promptSTRINGText description of the image to generate.
    modelCOMBOOpenAI gpt-image model. Switching this changes the options below.
    qualityCOMBOautoRendering quality. 'auto' lets the model decide; higher quality costs more.
    output_formatCOMBOpngImage file format returned by the API.
    output_compressionINT1000–100Compression 0-100. Applies only to jpeg and webp output.
    moderationCOMBOautoContent moderation strictness. 'auto' (default) or 'low' (less restrictive). Sent only when not 'auto'.
    nINT11–8How many images to generate (1-8).

    Outputs (1)

    NameTypeDescription
    imageIMAGEβ€”