Skip to main content
AI

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

RatioLandscapePortraitOrientation
4:3 / 3:41024x768, 1344x1024768x1024, 1024x1344Landscape / Portrait
5:4 / 4:51280x10241024x1280Landscape / Portrait
16:9 / 9:161360x768, 1536x864768x1360, 864x1536Landscape / Portrait
1:11024x1024-Square
3:2 / 2:31536x10241024x1536Landscape / Portrait
2:1 / 1:22048x10241024x2048Landscape / Portrait
21:9 / 9:212016x864864x2016Landscape / Portrait

2K

RatioLandscapePortraitOrientation
16:9 / 9:161920x1080, 2048x1152, 2560x14401080x1920, 1152x2048, 1440x2560Landscape / Portrait
1:11536x1536-Square
3:2 / 2:32048x1360, 2160x14401360x2048, 1440x2160Landscape / Portrait
4:3 / 3:42048x15361536x2048Landscape / Portrait
2:1 / 1:22688x13441344x2688Landscape / Portrait
21:9 / 9:212688x11521152x2688Landscape / Portrait
5:4 / 4:52560x20482048x2560Landscape / Portrait

4K

RatioLandscapePortraitOrientation
1:12048x2048, 2880x2880-Square
4:3 / 3:43264x24482448x3264Landscape / Portrait
3:2 / 2:33504x23362336x3504Landscape / Portrait
2:1 / 1:23840x19201920x3840Landscape / Portrait
21:9 / 9:213840x16481648x3840Landscape / Portrait
16:9 / 9:163840x21602160x3840Landscape / Portrait

API Parameters and Examples

Endpoint

POST /v1/images/generations/

Request Body Parameters

FieldTypeRequiredTitleDescription
modelstringNoimage generation Model.gpt-image-2-origin
promptstringYesimage text description.gpt-image-132000 characters,dall-e-21000 characters,dall-e-3 4000 characters.
sizestringNogeneration image. gpt-image-2, size must be 1024x768 (Landscape), 1024x1024 (), 1024x1536 (), 1920x1080 (Landscape), 2560x1440 (Landscape) or 3840x2160 (Landscape) one of;
qualitystringNogeneration image quality. Optional values:low, medium, high
output_formatstringNoimage format. Optional values:png / jpeg / webp, default"png"
nstringYes

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

FieldTypeRequiredTitleDescription
createdintegerYes
dataarrayYes
usageobjectYes

Response Examples

Success Example

{
"created": 1777105463,
"data": [
{
"url": "https://xxxxxx/xxx.jpg"
}
]
}