Output controls
The official
gpt-image-2 model accepts additional resolutions that meet the constraints in OpenAI’s image generation guide. This API exposes the three presets above for Generate, Async Generate, and Edit. Set size explicitly when exact pixels matter; omitted-size behavior is outside this public API.
Generate request
/v1/images/generations for synchronous generation.
Unified asynchronous body
Send JSON to/v1/images/tasks. Use action=generate without input_images, or action=edit with 1–16 Base64 images:
mime_type must match the actual PNG, JPEG, or WebP bytes. GPT Image tasks omit aspect_ratio. Use Idempotency-Key for retryable submissions.
Edit form
Sendmultipart/form-data to /v1/images/edits with:
model=gpt-image-2-vip;- one
imagefile; - a required
prompt; - one supported
sizeandquality; n=1or an omittedn.
413, reduce the image and total multipart body before retrying; the unified JSON task limit remains 20 MiB decoded. See errors and safe retries.
Quality behavior
low uses a smaller output budget than medium; high uses the largest supported budget; auto lets the route choose. Request duration varies independently, so do not select quality as a timeout control.
An invalid value fails with HTTP 400:
Copy VIP examples
Run all three supported workflows.