Nodes/ERPK Collection/OpenAI Image Generation
ComfyUI Node

OpenAI Image Generation

GPT-Image-2 with transparent backgrounds and a revised prompt

By eRepublik-Labs·Created 12 months ago·Updated 4 days ago· 2
OpenAI Image Generation
  • client
  • image
  • revised_prompt
◄prompt►
◄seed-1►
◄modelgpt-image-2►
◄size1024x1024►
◄custom_width1024►
◄custom_height1024►
◄qualityauto►
◄backgroundauto►
◄moderationauto►
◄n1►
◄output_formatpng►
◄output_compression100►

OpenAI Image Generation is the image side of the ERPK OpenAI section: prompt in, IMAGE tensor out, no browser tab needed. Default model is gpt-image-2, OpenAI's current flagship with 4K output and strong multilingual text rendering - which is the whole reason to pick this over a local checkpoint when you need legible text in the frame, like posters, UI mockups, or logos.

Two things make this node genuinely more useful than a bare API call. First, it outputs two values: image (the IMAGE tensor) and revised_prompt (the STRING of what OpenAI actually generated, after its internal prompt rewriting). That second output is a gift for debugging - when the result isn't what you asked for, the revised prompt shows you exactly how the model reworded your request. Wire it to a text preview and watch what's happening.

Second, the background input supports transparent. That's a real workflow unlock: generate a logo or product render directly on a transparent background, no chroma-key or background-removal step. It requires an output format that supports transparency, so pair it with png/webp handling downstream.

The inputs that matter

  • prompt - what you want
  • size - default 1024x1024, but gpt-image-2 takes arbitrary sizes: both edges divisible by 16, aspect ratio between 1:3 and 3:1, max edge 3840px. 1536x1024 is the standard landscape option
  • quality - auto/low/medium/high for the GPT Image family
  • n - 1 to 10 images per call, stacked into a batch
  • background - auto or transparent (the sleeper feature)
  • moderation - auto (default safety filters) or low (more permissive content)

Plus the shared plumbing: seed for best-effort reproducibility, client for the optional OpenAI API Config node.

Install

Part of the ERPK Collection:

cd ComfyUI/custom_nodes
git clone https://github.com/eRepublik-Labs/comfyui-nodes-erpk.git erpk
cd erpk && pip install -r requirements.txt

Requires openai>=2.32.0 and an OpenAI key in ERPK Settings. Or "ERPK Custom Nodes" via ComfyUI Manager, restart, done.

Troubleshooting

The one real trap here is DALL-E. The README is blunt: DALL-E 3 shuts down on 2026-05-12, and the hd/standard quality values are legacy DALL-E options kept only for compatibility. If you load an old workflow with a DALL-E model selected, expect it to break or behave oddly - switch to a GPT-Image model. transparent background on a model or format that doesn't support it will also fail or come back opaque; the tooltip calls that out explicitly. And as with any hosted image model, n > 1 returns a batch, so use an Image node's batch controls to flip through your four or ten candidates.

CategoryERPK/OpenAI

Inputs (13)

NameTypeDefaultDescription
promptSTRINGDescription of the image to generate
seedINT-1-1–2147483647Seed for reproducible outputs (best-effort). Randomizes by default.
clientoptOPENAI_API_CLIENTOpenAI API client from OpenAI API Config node (uses API key from config)
modeloptCOMBOgpt-image-2Image generation model. gpt-image-2.5-sunburst / -flare: newest, add xhigh/max quality and transparent background. gpt-image-2: 4K output, multilingual text; transparent background in preview.
sizeoptCOMBO1024x1024Output image size. Select Custom to use custom_width and custom_height. gpt-image-2 and 2.5 accept any size with both edges divisible by 16, aspect ratio 1:3 to 3:1, 655,360 to 8,294,400 pixels and max edge 3840. Resolutions above 2560x1440 are experimental.
custom_widthoptINT1024256–3840Width in pixels when size is Custom. Must be a multiple of 16.
custom_heightoptINT1024256–3840Height in pixels when size is Custom. Must be a multiple of 16.
qualityoptCOMBOautoImage quality. auto/low/medium/high on every model; xhigh/max only on GPT Image 2.5 (clamped to high on gpt-image-2).
backgroundoptCOMBOautoBackground type for the generated output (GPT Image models only). 'transparent' works on GPT Image 2.5 only (gpt-image-2 rejects it) and needs png or webp output.
moderationoptCOMBOautoContent moderation level (GPT Image models only). 'auto' uses OpenAI's default safety filters; 'low' asks for less restrictive filtering. How much 'low' actually relaxes varies by model and is not guaranteed; gpt-image-2 was observed to ignore it. Neither level permits graphic or violent content.
noptINT11–10Number of images to generate per call (OpenAI supports 1-10).
output_formatoptCOMBOpngOutput file format. 'transparent' background needs png or webp.
output_compressionoptINT1000–100Compression level 0-100 (100 = least compression). Applied only to jpeg and webp.

Outputs (2)

NameTypeDescription
imageIMAGE—
revised_promptSTRING—