Skip to main content
POST
Model name compatibility note: This endpoint also accepts the alias gpt-image-2-ext, which is equivalent to gpt-image-2. The two are interchangeable and produce identical results.

Authorizations

Authorization
string
required
All endpoints require Bearer Token authenticationGet your API Key:Visit the API Key management page to get your API KeyInclude it in the request header:

Body

model
string
default:"gpt-image-2"
required
Image generation model nameFixed to gpt-image-2 (compatible alias gpt-image-2-ext)
For backward compatibility, the alias gpt-image-2-ext (for gpt-image-2) remains usable.
prompt
string
required
Text description for image generation
  • Supports English and Chinese, detailed descriptions recommended
  • Pre-submission content moderation / safety review — violations are rejected immediately
n
integer
default:"1"
Number of images to generateRange: 1 - 10
Must be a pure number (e.g., 1), do not wrap in quotes
size
string
default:"1:1"
Image aspect ratioSupported ratios, plus auto to let the server pick a suitable ratio automatically:Pixel dimensions can also be passed directly, such as 1881x836 / 887x1774.
When size is set to auto, the default ratio is 1:1.
resolution
string
default:"1k"
Output resolution tierOptions: 1k / 2k / 4ksize × resolution → actual pixel mapping:
4K supports the 15 ratios listed above; you can also pass the pixel dimensions from the table directly via size.
image_urls
array
Reference image array (OpenAI standard field). Switches to image-to-image mode when provided.
Other OpenAI standard fields (response_format, style) are not supported and will be ignored. Task results only return url — please download and convert to base64 yourself if needed.
official_fallback
boolean
default:"false"
Whether to fall back to the official channel
  • false: Do not use (default)
  • true: Use the official channel

Usage Examples

Text-to-image (minimal request)
Text-to-image (with ratio + 2K)
Text-to-image (4K output)
Text-to-image (multiple images)
Image-to-image (reference = URL)
Image-to-image (reference = base64)
Image-to-image (multi-reference fusion, URL + base64 mixed)

Response

code
integer
Response status code
data
array
Response data array

Querying Task Results

After successful submission, a task_id is returned. Poll the task status via GET /v1/tasks/{task_id}, see Task Query API for details.

Success Response Example

Image access: data.result.images[0].url[0]

Task Status