Generate Images
Public model name gpt-image-2-auto, billed by returned image resolution, quality, and count, API reference to the call examples below, size options auto
Billing mode: billed by the actual generated image size; async tasks reserve cost first and reconcile when results return
gpt-image-2-origin supported sizes
Billing mode: billed exactly by size
1K
| Ratio | Landscape | Portrait | Orientation |
|---|---|---|---|
4:3 / 3:4 | 1024x768, 1344x1024 | 768x1024, 1024x1344 | Landscape / Portrait |
5:4 / 4:5 | 1280x1024 | 1024x1280 | Landscape / Portrait |
16:9 / 9:16 | 1360x768, 1536x864 | 768x1360, 864x1536 | Landscape / Portrait |
1:1 | 1024x1024 | - | Square |
3:2 / 2:3 | 1536x1024 | 1024x1536 | Landscape / Portrait |
2:1 / 1:2 | 2048x1024 | 1024x2048 | Landscape / Portrait |
21:9 / 9:21 | 2016x864 | 864x2016 | Landscape / Portrait |
2K
| Ratio | Landscape | Portrait | Orientation |
|---|---|---|---|
16:9 / 9:16 | 1920x1080, 2048x1152, 2560x1440 | 1080x1920, 1152x2048, 1440x2560 | Landscape / Portrait |
1:1 | 1536x1536 | - | Square |
3:2 / 2:3 | 2048x1360, 2160x1440 | 1360x2048, 1440x2160 | Landscape / Portrait |
4:3 / 3:4 | 2048x1536 | 1536x2048 | Landscape / Portrait |
2:1 / 1:2 | 2688x1344 | 1344x2688 | Landscape / Portrait |
21:9 / 9:21 | 2688x1152 | 1152x2688 | Landscape / Portrait |
5:4 / 4:5 | 2560x2048 | 2048x2560 | Landscape / Portrait |
4K
| Ratio | Landscape | Portrait | Orientation |
|---|---|---|---|
1:1 | 2048x2048, 2880x2880 | - | Square |
4:3 / 3:4 | 3264x2448 | 2448x3264 | Landscape / Portrait |
3:2 / 2:3 | 3504x2336 | 2336x3504 | Landscape / Portrait |
2:1 / 1:2 | 3840x1920 | 1920x3840 | Landscape / Portrait |
21:9 / 9:21 | 3840x1648 | 1648x3840 | Landscape / Portrait |
16:9 / 9:16 | 3840x2160 | 2160x3840 | Landscape / Portrait |
API Parameters and Examples
Endpoint
POST /v1/images/generations/
Request Body Parameters
| Field | Type | Required | Title | Description |
|---|---|---|---|---|
model | string | No | image generation Model.gpt-image-2-origin | |
prompt | string | Yes | image text description.gpt-image-132000 characters,dall-e-21000 characters,dall-e-3 4000 characters. | |
size | string | No | generation image. gpt-image-2, size must be 1024x768 (Landscape), 1024x1024 (), 1024x1536 (), 1920x1080 (Landscape), 2560x1440 (Landscape) or 3840x2160 (Landscape) one of; | |
quality | string | No | generation image quality. Optional values:low, medium, high | |
output_format | string | No | image format. Optional values:png / jpeg / webp, default"png" | |
n | string | Yes |
Request Examples
Example
{
"model": "gpt-image-2-origin",
"prompt": "A cute baby sea otter",
"size": "1024x1536",
"quality": "medium",
"output_format": "png"
}
curl -X POST "{BASE_URL}/v1/images/generations/" \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-image-2-origin",
"prompt": "A cute baby sea otter",
"size": "1024x1536",
"quality": "medium",
"output_format": "png"}'
Response Fields
| Field | Type | Required | Title | Description |
|---|---|---|---|---|
created | integer | Yes | ||
data | array | Yes | ||
usage | object | Yes |
Response Examples
Success Example
{
"created": 1777105463,
"data": [
{
"url": "https://xxxxxx/xxx.jpg"
}
]
}