Skip to main content
POST
/
kyyReactApiServer
/
v1
/
image2
/
images
curl --request POST \
  --url https://zcbservice.aizfw.cn/kyyReactApiServer/v1/image2/images \
  --header 'Authorization: Bearer {{key}}' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gpt-image-2",
    "prompt": "A cute orange cat sitting on a windowsill looking at the scenery outside",
    "quality": "high",
    "ratio": "16:9",
    "resolution": "2k",
    "image_urls": []
  }'
{
  "id": "image_fd35ee52-2a98-44a6-b930-29a88ce9b8fd",
  "object": "image",
  "created": 1774836724,
  "model": "gpt-image-2",
  "status": "queued",
  "error": null
}

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

All requests require a Bearer token in the request header:
Authorization: Bearer {{key}}

Request Parameters

model
string
required
Model name, must be gpt-image-2
prompt
string
required
Image generation promptExample: "A cute orange cat sitting on a windowsill looking at the scenery outside"
quality
string
default:"low"
Quality level, defaults to lowAvailable options:
  • low - Low quality
  • medium - Medium quality
  • high - High quality
ratio
string
default:"1:1"
Aspect ratio setting. Required when using resolution, defaults to 1:1Available 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
resolution
string
Resolution setting. Use either resolution or size. When using resolution, ratio must also be providedAvailable options:
  • 1k - 1K resolution
  • 2k - 2K resolution
  • 4k - 4K resolution
size
string
Size setting. When size is provided, resolution and ratio are not required. If both size and resolution are provided, size takes precedenceAvailable options:
  • 1024x1024 - Square
  • 1536x1024 - Landscape
  • 1024x1536 - Portrait
  • 2048x2048 - 2K Square
  • 2048x1152 - 2K Landscape
  • 3840x2160 - 4K Landscape
  • 2160x3840 - 4K Portrait
image_urls
array
Array of reference image URLs to guide image generation style

Response Parameters

id
string
Unique identifier for the image generation task, used for subsequent status queries
object
string
Object type, always image
created
integer
Task creation timestamp
model
string
Model name used
status
string
Task status:
  • queued - Queued
  • processing - Processing
error
string
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
curl --request POST \
  --url https://zcbservice.aizfw.cn/kyyReactApiServer/v1/image2/images \
  --header 'Authorization: Bearer {{key}}' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gpt-image-2",
    "prompt": "A cute orange cat sitting on a windowsill looking at the scenery outside",
    "quality": "high",
    "ratio": "16:9",
    "resolution": "2k",
    "image_urls": []
  }'
{
  "id": "image_fd35ee52-2a98-44a6-b930-29a88ce9b8fd",
  "object": "image",
  "created": 1774836724,
  "model": "gpt-image-2",
  "status": "queued",
  "error": null
}