Get API Key:
Visit API Key Management Page to get your API Key
Add to request header:
Authorization: Bearer YOUR_API_KEYImage generation model name
gpt-image-2-beta "gpt-image-2-beta"
Prompt describing the image you want to generate, or describing how to edit the input image. Limited to 2000 tokens
2000"A beautiful colorful sunset over the ocean"
Size of the generated image, aspect ratio format only:
1:1: Square3:2: Landscape2:3: Portraitauto: Determined automatically by the model (default)1:1, 3:2, 2:3, auto "1:1"
Reference image URL list for image-to-image and image editing features
Notes:
.jpeg, .jpg, .png, .webp.png, .jpg)[
"https://example.com/image1.png",
"https://example.com/image2.png"
]HTTPS callback URL for task completion
Callback Timing:
Security Restrictions:
2048 charactersCallback Mechanism:
10 seconds3 retries after failure (at 1/2/4 seconds after failure)"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-image-2-beta"
Task object type
image.generation.task Task progress percentage (0-100)
0 <= x <= 1000
Task status
pending, processing, completed, failed "pending"
Async task information
Task output type
text, image, audio, video "image"
Usage and billing information