Short answer
Usegpt-image-2 and add two fields to the request:
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
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) and a transparent background work together — they do not conflict.
Responses image tool
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:
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, orsharp. 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
400: Transparent background is not supported for JPEG output format
400: Transparent background is not supported for JPEG output format
output_format was set to jpeg. Switch it to png or webp.The image really is on white, not transparent
The image really is on white, not transparent
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-2 — gpt-image-2-all and gpt-image-2-vip have no such parameter and silently ignore it.How do I confirm the image really has an alpha channel
How do I confirm the image really has an alpha channel
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.My prompt already says transparent background — why pass the parameter too
My prompt already says transparent background — why pass the parameter too
background: "transparent" parameter guarantees a real alpha channel.Related docs
GPT-Image-2 overview
Text-to-image API reference
/v1/images/generationsImage editing API reference
/v1/images/edits and multi-image fusionMask inpainting
Official vs reverse routes
gpt-image-2 / -all / -vip