GPT-Image-2
GPT-Image-2 Image Generation
-
Asynchronous processing mode, returns task ID for subsequent queries
-
OpenAI Images compatible protocol, supports text-to-image / image-to-image
-
15 image aspect ratios supported via the
sizefield -
Output pixel tier controlled via
resolution(1k/2k/4k) -
Up to 16 reference images, URL and base64 can be mixed
-
Billed by resolution tier (1K / 2K / 4K)
POST
Model name compatibility note: This endpoint also accepts the alias
gpt-image-2-ext, which is equivalent to gpt-image-2. The two are interchangeable and produce identical results.Authorizations
All endpoints require Bearer Token authenticationGet your API Key:Visit the API Key management page to get your API KeyInclude it in the request header:
Body
Image generation model nameFixed to
gpt-image-2 (compatible alias gpt-image-2-ext)For backward compatibility, the alias
gpt-image-2-ext (for gpt-image-2) remains usable.Text description for image generation
- Supports English and Chinese, detailed descriptions recommended
- Pre-submission content moderation / safety review — violations are rejected immediately
Number of images to generateRange:
1 - 10Image aspect ratioSupported ratios, plus
Pixel dimensions can also be passed directly, such as
auto to let the server pick a suitable ratio automatically:| size | Type |
|---|---|
auto | Automatic |
1:1 | Square |
3:2 | Landscape |
2:3 | Portrait |
4:3 | Landscape |
3:4 | Portrait |
5:4 | Landscape |
4:5 | Portrait |
16:9 | Landscape |
9:16 | Portrait |
2:1 | Landscape |
1:2 | Portrait |
3:1 | Landscape |
1:3 | Portrait |
21:9 | Landscape |
9:21 | Portrait |
1881x836 / 887x1774.Output resolution tierOptions:
1k / 2k / 4ksize × resolution → actual pixel mapping:| size | 1k | 2k | 4k |
|---|---|---|---|
1:1 | 1024×1024 / 1254×1254 | 2048×2048 | 2880×2880 |
3:2 | 1536×1024 | 2048×1360 | 3520×2336 |
2:3 | 1024×1536 | 1360×2048 | 2336×3520 |
4:3 | 1024×768 | 2048×1536 | 3312×2480 |
3:4 | 768×1024 | 1536×2048 | 2480×3312 |
5:4 | 1280×1024 / 1448×1086 | 2560×2048 | 3216×2576 |
4:5 | 1024×1280 / 1122×1402 | 2048×2560 | 2576×3216 |
16:9 | 1536×864 / 1672×941 | 2048×1152 | 3840×2160 |
9:16 | 864×1536 / 941×1672 | 1152×2048 | 2160×3840 |
2:1 | 2048×1024 / 1774×887 | 2688×1344 | 3840×1920 |
1:2 | 1024×2048 / 887×1774 | 1344×2688 | 1920×3840 |
3:1 | 1881×836 / 1536×512 | 3072×1024 | 3840×1280 |
1:3 | 887×1774 / 512×1536 | 1024×3072 | 1280×3840 |
21:9 | 2016×864 / 1915×821 | 2688×1152 | 3840×1648 |
9:21 | 864×2016 / 821×1915 | 1152×2688 | 1648×3840 |
Reference image array (OpenAI standard field). Switches to image-to-image mode when provided.
Other OpenAI standard fields (
response_format, style) are not supported and will be ignored. Task results only return url — please download and convert to base64 yourself if needed.Whether to fall back to the official channel
false: Do not use (default)true: Use the official channel
Usage Examples
Text-to-image (minimal request)Response
Response status code
Response data array
Querying Task Results
After successful submission, atask_id is returned. Poll the task status via GET /v1/tasks/{task_id}, see Task Query API for details.
Success Response Example
data.result.images[0].url[0]
Task Status
| Status | Meaning |
|---|---|
submitted | Submitted |
processing | Being processed upstream |
completed | Success, result.images available |
failed | Failed, check error.message |