Nodes/Bjornulf_custom_nodes/โ˜๐ŸŽจ API Image Generator (openai, gpt-image-1)
ComfyUI Node

โ˜๐ŸŽจ API Image Generator (openai, gpt-image-1)

OpenAI image gen inside ComfyUI

By justUmenยทCreated 2 years agoยทUpdated about a year agoยท 545
โ˜๐ŸŽจ API Image Generator (openai, gpt-image-1)
    • IMAGE
    โ—„api_keyโ–บ
    โ—„promptA cute baby sea otterโ–บ
    โ—„size1536x1024โ–บ
    โ—„backgroundautoโ–บ
    โ—„moderationautoโ–บ
    โ—„output_formatpngโ–บ
    โ—„qualityautoโ–บ
    โ—„n1โ–บ

    This node calls OpenAI's gpt-image-1 - the model behind the "GPT-4o image generation" everyone was posting - straight from a ComfyUI graph. Paste your OpenAI API key, write a prompt, get an image back into your workflow. Nothing runs locally; OpenAI does the generating and bills your account. The reason to want it: gpt-image-1 is scary good at prompt comprehension - it follows complex instructions, renders legible text, and nails composition in a way open models still struggle with. The reason to be careful: it's a paid API with real per-image cost and OpenAI's content moderation baked in.

    If you live in a local Stable Diffusion pipeline but occasionally need that "just understand what I asked for" quality, this bridges the two.

    How it works

    You give it a key, a prompt, and a size, and it hits OpenAI's image endpoint and returns the result as an IMAGE you can save, preview, or feed onward. Because it's an API call, your GPU does nothing - this works on the weakest machine - but you're paying OpenAI and subject to their queue and their moderation. The optional widgets map onto gpt-image-1's real API parameters: transparent backgrounds, output format, quality tier, and a moderation setting.

    The inputs and outputs that matter

    • api_key (STRING, required) - your OpenAI API key. Required, and it's real money behind it.
    • prompt (STRING, required) - where this model shines; write full, descriptive instructions, it handles them.
    • size (enum) - 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), or auto.
    • quality (enum: auto / high / medium / low) - higher quality costs more per image. Start at medium or low while iterating.
    • background (enum: auto / transparent / opaque) - transparent gives you a real alpha channel, genuinely useful for assets and compositing (pair it with png or webp).
    • output_format (png / jpeg / webp) and moderation (auto / low) - low relaxes the content filter somewhat, auto is the default gate.
    • n (INT) - number of images; capped at 1 on this node.

    Output: IMAGE - into a save or preview node.

    How to install it

    ComfyUI Manager โ†’ Bjornulf_custom_nodes โ†’ install โ†’ restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/justUmen/Bjornulf_custom_nodes
    pip install -r Bjornulf_custom_nodes/requirements.txt
    

    then restart. This is one of the newest nodes in the pack (added in the 0.780 update), so if it's missing, update the pack - an older clone won't have it.

    Common issues & troubleshooting

    The face looks off. This is the well-documented complaint about gpt-image-1 across the ComfyUI community: it nails pose, clothing, lighting, and background but drifts on faces, which is maddening for consistent-character work. It's a model limitation, not a node bug. People fix it downstream - running the result through a local face-restoration or identity pass (PuLID/ControlNet-style) rather than expecting the API to hold a face across generations.

    "Invalid API key" or a billing error. The key is missing, wrong, or the account has no credit. gpt-image-1 is pay-per-image - set up billing on your OpenAI account first.

    My prompt got refused. OpenAI moderates gpt-image-1 hard. Setting moderation to low loosens it a little, but it won't render anything against their policy - for that content you're back to local models. This is precisely why the pack keeps its own local and Civitai generators alongside this one.

    Transparency didn't come through. Set background to transparent and choose png or webp as the output format - a jpeg can't carry alpha, so it'll flatten.

    It's slow / costs add up. You're paying per image and waiting on OpenAI. Iterate at low quality and small size, then do the final render at high quality once the prompt's right.

    CategoryOpenAI API

    Inputs (8)

    NameTypeDefaultDescription
    api_keySTRINGโ€”
    promptSTRINGA cute baby sea otterโ€”
    sizeCOMBO1536x10244 options: 1024x1024, 1536x1024, 1024x1536, auto
    backgroundoptCOMBOauto3 options: auto, transparent, opaque
    moderationoptCOMBOauto2 options: auto, low
    output_formatoptCOMBOpng3 options: png, jpeg, webp
    qualityoptCOMBOauto4 options: auto, high, medium, low
    noptINT11โ€“1โ€”

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGEโ€”