GlobalAiOpc

GPT Image 2 - Create Task

Create GPT Image 2 image generation tasks with support for multiple quality levels, aspect ratios, and resolution options

POST/kyyReactApiServer/v1/image2/images

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 Key
All requests require a Bearer token in the request header:
cURL
Authorization: Bearer {{key}}

Base URL

https://zcbservice.aizfw.cn/kyyReactApiServer
baseUrl 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

modelstringrequired
Model name
Available options:
  • gpt-image-2 - Standard model, billed by quality level
  • gpt-image-2-r - Resolution model, billed by resolution
  • gpt-image-2-async - Billed per request
  • image2-pro-async - Billed per request
promptstringrequired
Image generation prompt
Example: "A cute orange cat sitting on a windowsill looking at the scenery outside"
qualitystring
Quality level, defaults to low. Supported models: gpt-image-2
Available options:
  • low - Low quality
  • medium - Medium quality
  • high - High quality
ratiostring
Aspect ratio setting. Required when using resolution, defaults to 1:1
Available options:
  • 1:1 - Square (default)
  • 16:9 - Widescreen landscape
  • 9:16 - Widescreen portrait
  • 4:3 - Standard landscape
  • 3:4 - Standard portrait
  • 3:2 - Classic landscape
  • 2:3 - Classic portrait
  • 5:4 - Near-square landscape
  • 4:5 - Near-square portrait
  • 2:1 - Wide landscape
  • 1:2 - Tall portrait
  • 21:9 - Ultra-wide landscape
  • 9:21 - Ultra-tall portrait
resolutionstring
Resolution setting, defaults to 1k. Use either resolution or size. When using resolution, ratio must also be provided
Available options:
  • 1k - 1K resolution
  • 2k - 2K resolution (only gpt-image-2)
  • 4k - 4K resolution (only gpt-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.
sizestring
Size setting. When size is provided, resolution and ratio are not required. If both size and resolution are provided, size takes precedence
Recommended values:
  • 1024x1024 - Square
  • 1536x1024 - Landscape
  • 1024x1536 - Portrait
  • 2048x2048 - 2K Square
  • 2048x1152 - 2K Landscape
  • 3840x2160 - 4K Landscape
  • 2160x3840 - 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_urlsarray
Array of reference image URLs to guide image generation style
  • gpt-image-2 - Up to 6 images
  • gpt-image-2-r - Up to 16 images
  • gpt-image-2-async - Up to 6 images
  • image2-pro-async - Up to 6 images

Response Parameters

idstring
Unique identifier for the image generation task, used for subsequent status queries
objectstring
Object type, always image
createdinteger
Task creation timestamp
modelstring
Model name used
statusstring
Task status:
  • queued - Queued
  • processing - Processing
errorstring
Error message, returned when status is failed

Quality 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 id to query task status and results
  • When size is provided, resolution and ratio are not required
  • When resolution is provided, ratio must also be provided (defaults to 1:1)
  • If both size and resolution are provided, size takes precedence
  • Recommended polling interval is 2-5 seconds, avoid frequent requests
Best Practices:
  1. Use application/json format for requests
  2. Prompts should clearly describe the desired image content and style
  3. Reference images can help guide generation style but are not required
  4. Choose appropriate aspect ratio or size to match your use case