Key Capabilities
- Text-to-image — Generate images from natural language descriptions
- Image editing — Edit existing images using text prompts via
/v1/images/edits - Flexible resolution — Supports arbitrary custom dimensions up to 4K (3840px), sides must be multiples of 16
- Precise text rendering — ~99% character-level accuracy across 12+ languages
- Multi-object composition — Complex scenes without occlusion or misalignment
- Multi-style — Photorealistic, illustration, anime, vector, 3D, data visualization
For both/v1/images/generationsand/v1/images/edits,nsupports 1–10, default 1. Requires selecting the Direct group in the console.
Output Specs
| Property | Values |
|---|---|
| Size | Flexible resolution (e.g., 1024x1024, 2048x2048, 3840x2160) |
| Size constraints | Sides: multiples of 16; aspect ratio ≤ 3:1; total pixels 655,360–8,294,400 |
| Quality | low, medium, high |
| Output format | png, jpeg |
| Input format (edit endpoint) | png, jpeg |
Quick Example
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Must be gpt-image-2 |
prompt | string | Yes | Image description text |
n | integer | No | Number of images to generate (1–10), default 1. Requires selecting the Direct group in the console. |
size | string | No | {width}x{height} format; sides must be multiples of 16; aspect ratio ≤ 3:1; total pixels 655,360–8,294,400; max single side 3,840px. Default 1024x1024 |
quality | string | No | low, medium, high, default medium |
output_format | string | No | png, jpeg, default png |
moderation | string | No | auto or low, default auto |
output_compression | integer | No | Compression level for jpeg format (0–100) |
Image Editing
Edit existing images viaPOST /v1/images/edits. Request body uses multipart/form-data; images are uploaded as files.
Up to 16 input images per request (image[]).
Input Image Formats
Supported formats: PNG, JPEG. Images must be submitted via multipart/form-data file upload. Two available model IDs:gpt-image-2— Official modelgpt-image-2-c— Cost-effective version (supportsresponse_format)
Note: When usinggpt-image-2-c, selecting higher quality may affect stable output fornimages. For stable multi-image generation, lower quality is recommended.
Edit Endpoint Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
image | file | Yes | Single source image (PNG or JPEG, multipart upload) |
image[] | file array | Yes* | Multiple source images, up to 16 (PNG or JPEG). Use instead of image for multiple images |
mask | file | No | Mask image with Alpha channel, same format and dimensions as source (< 50MB). When using multiple images, the mask applies to the first image. Requires selecting the Direct group in the console. |
model | string | Yes | gpt-image-2 or gpt-image-2-c |
prompt | string | Yes | Edit instruction text |
n | integer | No | Number of images to return (1–10), default 1. Requires selecting the Direct group in the console. |
size | string | No | {width}x{height}, default 1024x1024 |
output_format | string | No | png, jpeg, default png |
output_compression | integer | No | Compression level for jpeg format (0–100) |
response_format | string | No | url. Only supported by gpt-image-2-c. Default url |
imageandimage[]are mutually exclusive and cannot be used together.
Mask Editing
Provide a mask image with an Alpha channel to control which regions of the source image are edited. Pixels where Alpha is white (opaque) are preserved; pixels where Alpha is black (transparent) will be edited. Requirements:- Mask must contain an Alpha channel
- Must match the source image in format and dimensions exactly
- File size limit: < 50MB
Mask editing and the n parameter both require selecting the Direct group in the console.
cURL
Python
Generation API Reference
Interactive Playground for
POST /v1/images/generations.Edit API Reference
Interactive Playground for
POST /v1/images/edits.
