Skip to main content
POST

Authorizations

Authorization
string
header
required

API Key authentication. Format: Bearer YOUR_API_KEY.

Body

application/json

Request payload for GPT Image 2 generation model.

Request payload for GPT Image 2 generation model.

prompt
string
required

Image description text, supports up to 32,000 characters

Required string length: 1 - 32000
Example:

"A children's book drawing of a veterinarian using a stethoscope to listen to the heartbeat of a baby otter"

size
enum<string>
default:1024x1024

Output size as width x height, or 'auto' for model-selected size. Presets are valid under OpenAI constraints (total pixels 655360-8294400, edges multiples of 16). Mapping: 1:1 1K/2K; 3:2 1K/2K; 2:3 1K/2K; 4:3 1K/2K; 3:4 1K/2K; 16:9 2K/4K; 9:16 2K/4K. No 1K for 16:9/9:16; no 4K for non-widescreen ratios.

Available options:
auto,
1024x1024,
2048x2048,
1536x1024,
3072x2048,
1024x1536,
2048x3072,
1024x768,
2048x1536,
768x1024,
1536x2048,
2048x1152,
3840x2160,
1152x2048,
2160x3840
Example:

"1024x1024"

quality
enum<string>
default:low

Image quality level. 'low': fast draft (default), 'medium': balanced, 'high': best quality

Available options:
low,
medium,
high
Example:

"high"

Response

Task submitted successfully

Response object for asynchronous task submission.

code
integer
required

Response code, 0 indicates success

Example:

0

message
string
required

Response message

Example:

"success"

data
object
required

Detailed data about the submitted asynchronous task.