GlobalAiOpc
GPT Image 2 - Create Task
Create GPT Image 2 image generation tasks with support for multiple quality levels, aspect ratios, and resolution options
Create Image Generation Task
Use the GPT Image 2 API to create high-quality AI image generation tasks with support for multiple quality levels, aspect ratios, and resolution options.
Authentication
Get KeyAll requests require a Bearer token in the request header:
cURL
Authorization: Bearer {{key}}
Base URL
https://zcbservice.aizfw.cn/kyyReactApiServerbaseUrl is the shared prefix for all public APIs. The api field in the current page frontmatter shows the full endpoint. Use this baseUrl as the common prefix when reading or composing request paths.Request Parameters
modelstringrequiredModel name
Available options:
gpt-image-2- Standard model, billed by quality levelgpt-image-2-r- Resolution model, billed by resolutiongpt-image-2-async- Billed per requestimage2-pro-async- Billed per request
promptstringrequiredImage generation prompt
Example:
"A cute orange cat sitting on a windowsill looking at the scenery outside"qualitystringQuality level, defaults to
low. Supported models: gpt-image-2Available options:
low- Low qualitymedium- Medium qualityhigh- High quality
ratiostringAspect ratio setting. Required when using
resolution, defaults to 1:1Available options:
1:1- Square (default)16:9- Widescreen landscape9:16- Widescreen portrait4:3- Standard landscape3:4- Standard portrait3:2- Classic landscape2:3- Classic portrait5:4- Near-square landscape4:5- Near-square portrait2:1- Wide landscape1:2- Tall portrait21:9- Ultra-wide landscape9:21- Ultra-tall portrait
resolutionstringResolution setting, defaults to
1k. Use either resolution or size. When using resolution, ratio must also be providedAvailable options:
1k- 1K resolution2k- 2K resolution (onlygpt-image-2)4k- 4K resolution (onlygpt-image-2)
gpt-image-2-r only supports 1k resolution. 4K is only supported for 6 ratios: 16:9 / 9:16 / 2:1 / 1:2 / 21:9 / 9:21, other ratios with 4K will fail due to exceeding the total pixel limit.sizestringSize setting. When
size is provided, resolution and ratio are not required. If both size and resolution are provided, size takes precedenceRecommended values:
1024x1024- Square1536x1024- Landscape1024x1536- Portrait2048x2048- 2K Square2048x1152- 2K Landscape3840x2160- 4K Landscape2160x3840- 4K Portrait
Size rules:
- Maximum side length must be less than or equal to 3840px
- Both sides must be multiples of 16px
- The ratio of the longer side to the shorter side must not exceed 3:1
- Total pixel count must be at least 655,360 and no more than 8,294,400
gpt-image-2-async only supports 1024x1024, 1536x1024, and 1024x1536.image_urlsarrayArray of reference image URLs to guide image generation style
gpt-image-2- Up to 6 imagesgpt-image-2-r- Up to 16 imagesgpt-image-2-async- Up to 6 imagesimage2-pro-async- Up to 6 images
Response Parameters
idstringUnique identifier for the image generation task, used for subsequent status queries
objectstringObject type, always
imagecreatedintegerTask creation timestamp
modelstringModel name used
statusstringTask status:
queued- Queuedprocessing- Processing
errorstringError message, returned when status is
failedQuality Levels
low
Low quality, fast generation, suitable for draft previews
medium
Medium quality, balances speed and quality, suitable for general use
high
High quality, best results, suitable for fine-detail creation
Important Notes
Important:
- Image generation is asynchronous, use the returned
idto query task status and results - When
sizeis provided,resolutionandratioare not required - When
resolutionis provided,ratiomust also be provided (defaults to1:1) - If both
sizeandresolutionare provided,sizetakes precedence - Recommended polling interval is 2-5 seconds, avoid frequent requests
Best Practices:
- Use
application/jsonformat for requests - Prompts should clearly describe the desired image content and style
- Reference images can help guide generation style but are not required
- Choose appropriate aspect ratio or size to match your use case
