##All APIs require Bearer Token authentication##
Get API Key:
Visit API Key Management Page to get your API Key
Add to request header when using:
Authorization: Bearer YOUR_API_KEYImage generation model name
gpt-4o-image "gpt-4o-image"
Prompt describing the desired image to generate, or describing how to edit the input image, limited to 2000 tokens
2000"A beautiful sunset over the ocean with vibrant colors"
Size of the generated image, supports two formats:
Simplified ratio format:
1:1, 2:3, 3:2 valuesPixel format:
1024x1024, 1024x1536, 1536x1024 values1:1, 2:3, 3:2, 1024x1024, 1024x1536, 1536x1024 "1024x1024"
Number of images to generate, currently only supports 1, 2, 4 values.
Note:
n, and the actual charge will be based on the number of generated images1
Reference image URL list for image-to-image and image editing features
Note:
5 images10MB.jpeg, .jpg, .png, .webp.png, .jpg)[
"https://example.com/image1.png",
"https://example.com/image2.png"
]Mask image URL
Note:
image_urls parameter contains more than 1 image"https://example.com/mask.png"
HTTPS callback address after task completion
Callback Timing:
Security Restrictions:
2048 charactersCallback Mechanism:
10 seconds3 retries on failure (retries after 1 second/2 seconds/4 seconds)"https://your-domain.com/webhooks/image-task-completed"
Image task created successfully
Task creation timestamp
1757156493
Task ID
"task-unified-1757156493-imcg5zqt"
Actual model name used
"gpt-4o-image"
Specific task type
image.generation.task Task progress percentage (0-100)
0 <= x <= 1000
Task status
pending, processing, completed, failed "pending"
Asynchronous task information
Task output type
text, image, audio, video "image"
Usage and billing information