โ๐จ API Image Generator (openai, gpt-image-1)
OpenAI image gen inside ComfyUI
- IMAGE
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), orauto.quality(enum: auto / high / medium / low) - higher quality costs more per image. Start atmediumorlowwhile iterating.background(enum: auto / transparent / opaque) -transparentgives you a real alpha channel, genuinely useful for assets and compositing (pair it withpngorwebp).output_format(png / jpeg / webp) andmoderation(auto / low) -lowrelaxes the content filter somewhat,autois 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.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| api_key | STRING | โ | |
| prompt | STRING | A cute baby sea otter | โ |
| size | COMBO | 1536x1024 | 4 options: 1024x1024, 1536x1024, 1024x1536, auto |
| backgroundopt | COMBO | auto | 3 options: auto, transparent, opaque |
| moderationopt | COMBO | auto | 2 options: auto, low |
| output_formatopt | COMBO | png | 3 options: png, jpeg, webp |
| qualityopt | COMBO | auto | 4 options: auto, high, medium, low |
| nopt | INT | 11โ1 | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | โ |