Skip to content

OpenAI gpt-image-2 ​

Looking for the September 2026 release? See GPT Image 2.5 Flare and Sunburst. This page covers the earlier GPT Image 2 model.

OpenAI's state-of-the-art image generation model — gpt-image-2-2026-04-21 snapshot, integrated into Go Bananas! as a tenant-selectable provider.

Provider comparison: Gemini Flash, Gemini Pro, OpenAI gpt-image-2

Choose your provider — every Go Bananas! tenant can mix Gemini Flash, Gemini Pro, and OpenAI gpt-image-2 per request. (Generated with gpt-image-2 itself.)

openai-gpt-image-2 runs alongside the Gemini family in the model registry. Tenants enable it by adding one to five OpenAI API keys in workspace settings and including it in their allowedModels list, then opt in per request via model_id.

Decision tree: which model should I pick?

Quick decision tree — gpt-image-2 wins for text-heavy work and quality control; Pro wins for grounding and 4K; Flash for everything else.

When to Pick gpt-image-2 ​

StrengthWhy
Text renderingOpenAI calls this its "killer feature" — small text, multilingual characters, dense compositions, infographics
Prompt adherenceStronger instruction-following than older OpenAI models; reliable for structured layouts
Quality controlFirst-class low / medium / high / auto quality levels with explicit pricing tiers
Output formatsNative PNG, JPEG, and WebP with optional output_compression
Aspect-ratio rangeBroader supported set including 21:9 cinematic, 4:5 / 5:4 social formats
Edits with refsUp to 16 reference images via /v1/images/edits for consistent multi-image edits

Constraints to Know ​

ConstraintValue
Maximum edge≤3,840px
Edge multipleBoth edges must be multiples of 16px
Aspect ratio capLong-to-short ≤3:1
Pixel range655,360–8,294,400 total pixels
Max reference images16
Default request timeout240s (set in src/models/registry.ts)
Transparent backgroundNot supported — background: "transparent" rejected
Google Search groundingNot supported (Gemini Pro only)
Native "thinking" modeNot exposed by Go Bananas! at this layer

Per-Request Parameters ​

gpt-image-2 exposes a richer parameter surface than the Gemini providers. Pass these alongside model_id: "openai-gpt-image-2":

ParameterTypeDescription
model_idstring"openai-gpt-image-2" — required to select this provider
promptstringText prompt (max 32,000 chars)
negative_promptstringAppended as Avoid: … to the OpenAI prompt
system_instructionstringPrepended to the prompt
aspect_ratioenumOne of: square, portrait, landscape, 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9
sizestring"auto" or explicit WIDTHxHEIGHT (validated against the constraints above)
nint1–4 images through Go Bananas (mapped to OpenAI n)
output_formatenumpng (default), jpeg, webp
output_compressionint0–100 — JPEG/WebP only; rejected for PNG
qualityenumlow, medium, high, auto (default)
backgroundenumauto (default) or opaque — transparent rejected
moderationenumauto (default) or low for less-restrictive filtering
reference_imagesarrayUp to 16 input images (sent to /v1/images/edits)
mask_image_idintOptional stored mask image for edit_image / edit_uploaded_image with OpenAI

Format selection

PNG is best for line art, screenshots, and anything you'll edit downstream. JPEG with output_compression: 80 cuts storage cost ~70% for photographic output. WebP is the best compromise for web delivery.

Use caseSizeNotes
Square hero / avatar1024x1024Fastest, cheapest
Landscape product shot1536x1024Standard 3:2
Portrait poster1024x1536Standard 2:3
2K square print2048x2048Higher detail
4K landscape wallpaper3840x2160Maximum edge
4K portrait poster2160x3840Maximum edge
Cinematic banner3840x164821:9

The provider rounds and validates against maxEdge, edgeMultiple, maxAspectRatio, minPixels, and maxPixels from the registry. Out-of-range sizes are rejected with a clear error rather than silently truncated.

Editing with Reference Images ​

gpt-image-2 routes edits through OpenAI's /v1/images/edits endpoint. When you pass reference_images, Go Bananas! automatically:

  1. Bundles each reference as a multipart image[] field with the correct extension
  2. Uploads in canonical order (text first, references after — matching Gemini's pattern for cross-provider consistency)
  3. Preserves input fidelity (high-fidelity processing is automatic for gpt-image-2; not user-configurable)
json
{
  "prompt": "Place this product on a marble bathroom counter, soft morning light",
  "model_id": "openai-gpt-image-2",
  "quality": "high",
  "output_format": "webp",
  "output_compression": 85,
  "reference_images": [42, 43]
}

Mask-Guided Edits ​

For localized OpenAI edits, pass mask_image_id to edit_image or edit_uploaded_image. The mask must already exist in the Go Bananas image library; upload or generate it first, then pass its image ID with model_id: "openai-gpt-image-2".

json
{
  "image_id": 6367,
  "mask_image_id": 6401,
  "prompt": "Replace only the masked sign with a brushed steel logo plaque",
  "model_id": "openai-gpt-image-2",
  "quality": "high"
}

Masking is OpenAI-only in Go Bananas. Gemini edit tools will reject mask_image_id instead of silently ignoring it. OpenAI also requires the mask to match the source image size and format and include an alpha channel; Go Bananas validates the size/format before sending the request.

Quality vs. Cost ​

OpenAI publishes token pricing for gpt-image-2; Go Bananas uses practical 1024×1024 heuristics for pre-flight estimates:

QualityApprox. cost per imageUse when
low~$0.006Drafts, thumbnails, A/B mock-ups
medium~$0.053Most production work
high~$0.211Hero assets, print, final marketing
autoVariableLet the model pick — best for mixed workloads

Reference-based edits cost more because the input image counts against your input-token budget (full-fidelity processing). Cached identical inputs are billed at a lower rate.

Output cost dominates

Unlike Gemini's flat per-call pricing, gpt-image-2 charges by output tokens which scale with quality and resolution. Budgeting high quality at 4K can be ~30× the cost of low quality at 1K. Use check_quota and get_account_summary to monitor.

Reliability ​

OpenAIImageProvider (src/services/image-provider/openai-provider.ts) wraps every call with the same production patterns as Gemini:

  • Key pool: Each tenant can store up to five OpenAI keys. Consecutive requests rotate their starting key to spread load across the pool.
  • Automatic failover: Authentication, authorization, rate-limit, insufficient-quota, and billing-hard-limit errors move immediately to the next configured key instead of retrying the rejected key.
  • Per-key circuit breaker: A rejected key is quarantined for 60 seconds, while healthy keys continue serving traffic. Invalid image requests do not poison key health.
  • Safe retry policy: Read-only connection checks may retry transient provider/network failures. Image generation and edit POSTs are never replayed after an ambiguous timeout or 5xx, avoiding duplicate billed generations. Key-specific rate and billing responses fail over immediately.
  • Timeout budget: 240s per provider request (set in registry, vs. 60s Flash and 120s Pro) because gpt-image-2 takes longer at high quality and large sizes
  • Aspect-ratio enforcement: Output is post-cropped if it deviates >5% from the requested ratio, using the same WASM Photon cropper as Gemini

Pooling reduces avoidable failures but cannot guarantee unlimited throughput. Keys under the same OpenAI project or account may share organization-level rate or billing limits.

When NOT to Use gpt-image-2 ​

NeedUse instead
Google Search grounding for live datagemini-pro-image
Native thinking mode for complex compositionsgemini-pro-image
Gemini-specific high-fidelity object workflowsgemini-pro-image
Resolution tiers (1K/2K/4K presets)gemini-pro-image
Lowest latency at large batch sizesgemini-flash-lite-image (Nano Banana 2 Lite)
Transparent backgroundsCrop out post-generation; gpt-image-2 doesn't expose this

Setting Up gpt-image-2 for a Tenant ​

  1. Add the keys: Open the tenant admin view → Manage OpenAI Key Pool → enter one to five keys. The whole pool is stored as a versioned AES-GCM-encrypted credential in tenant_provider_credentials; existing single-key rows remain compatible.
  2. Add to allowlist: Update the tenant's allowedModels array to include "openai-gpt-image-2".
  3. Test: Call generate_image with model_id: "openai-gpt-image-2". The frontend ModelSelector will start surfacing it once the allowlist permits.
  4. Monitor: check_quota validates Go Bananas storage and request-rate limits, but it cannot preflight OpenAI account billing or project-level rate limits. Provider-key failover reacts when OpenAI rejects an actual request.

Sources ​

Released under the MIT License.