Skip to main content

Short answer

Use gpt-image-2 and add two fields to the request:
The image comes back as a PNG with a real alpha channel — no cutout post-processing required. Text-to-image, image editing, and the Responses image tool all support it.
background: "transparent" is a capability OpenAI opened up for GPT-Image-2 on 2026-08-21 (marked preview by OpenAI). APIYI has verified it end to end: both text-to-image and image editing return true alpha transparency.

Which models can produce transparent backgrounds

If you need transparency reliably, use gpt-image-2. A parameter and a prompt request are not the same thing: the first is guaranteed by the API, the second is the model doing its best. At batch scale the difference shows.

Three ways to call it

Text-to-image /v1/images/generations

Image editing /v1/images/edits

Hand it an ordinary photo and ask it to drop the background:
Mask-based inpainting (mask) and a transparent background work together — they do not conflict.

Responses image tool

The returned image_generation_call echoes "background": "transparent".

Why jpeg does not work

JPEG has no alpha channel — there is nowhere to store transparency. Combining output_format: "jpeg" with background: "transparent" returns a 400:
For transparency pick png (lossless, larger) or webp (lossy and tunable, smaller, also supports alpha). webp additionally accepts output_compression to trim file size.

Editing is a re-draw, not a precise cutout

Set expectations here up front: when /v1/images/edits runs with background: transparent, the model understands the scene and paints the subject again rather than tracing the original outline the way Photoshop would. That means:
  • The subject’s pose, style, and fine detail will shift — this is not pixel-level preservation
  • To stay closer to the original, use quality: "high" and state “keep the original composition, do not change the subject’s appearance” in the prompt
  • If your workflow needs pixel-exact extraction, do the cutout yourself with rembg, PIL, or sharp. Model generation is a better fit for “produce reusable assets” than for exact matting

Billing

Transparency costs nothing extra. At the same quality tier and size, background: "transparent" and background: "opaque" consume exactly the same number of image tokens, billed under the normal per-token rules for gpt-image-2.

Common errors

output_format was set to jpeg. Switch it to png or webp.
Check three things. First, that the background field actually reached the API — the edits endpoint is multipart/form-data, so it must be -F background=transparent rather than a JSON body field. Second, whether the top-level background in the response echoes transparent. Third, whether you are on gpt-image-2gpt-image-2-all and gpt-image-2-vip have no such parameter and silently ignore it.
One Python snippet is enough:
Mode RGB means there is no alpha channel at all. Mode RGBA with every alpha value at 255 means the channel exists but nothing was cut out.
A prompt only asks the model to paint it that way, and the model may paint a grey-and-white checkerboard that merely looks transparent — those are still opaque pixels. Only the background: "transparent" parameter guarantees a real alpha channel.

GPT-Image-2 overview

Full parameters, sizes, quality tiers, and error codes

Text-to-image API reference

Every field on /v1/images/generations

Image editing API reference

/v1/images/edits and multi-image fusion

Mask inpainting

Use an alpha mask to mark the region to change

Official vs reverse routes

Choosing between gpt-image-2 / -all / -vip

Artifacts on white backgrounds

A different problem with pure-white backgrounds