GPT Image 2 Image Generation Beta
- GPT Image 2 (gpt-image-2-beta) model supports text-to-image, image-to-image, and image editing modes
- Asynchronous processing mode, use the returned task ID to query status
- Generated image links are valid for 24 hours, please save them promptly
Size support:
- Currently only supports
size=auto, or ratio sizes (such assize="1:1") withresolution="1K" - When
size=auto, theresolutionfield is ignored and treated as 1K resolution="2K"/resolution="4K"and explicit pixel sizes (such as1024x1024) are not currently supported- For 2K, 4K, or explicit pixel control, use gpt-image-2
Billing (per_call):
- Billed at the 1K tier only
nis fixed at 1;qualityis not exposed on this channel
Authorizations
All APIs require Bearer Token authentication
Get API Key:
Visit API Key Management Page to get your API Key
Add to request header:
Body
Image 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"
Generated image size. Supports two modes:
1. auto (default)
The model automatically determines the output size. In this mode, the resolution field is ignored and treated as 1K.
2. Ratio (must be used with resolution="1K")
1:1: Square3:2/2:3: Landscape / Portrait4:3/3:4: Landscape / Portrait5:4/4:5: Common social media16:9/9:16: Widescreen landscape / portrait21:9/9:21: Ultra-wide landscape / portrait2:1/1:2: Landscape / Portrait3:1/1:3: Panorama landscape / portrait (maximum aspect ratio)
Note: Explicit pixel sizes (such as 1024x1024) are not currently supported. For explicit pixel control, use gpt-image-2.
"16:9"
Resolution tier. Effective only when size is a ratio. Currently only 1K is supported.
When ignored:
- When
size=auto, this field is ignored and treated as 1K (no need to pass this parameter)
Landscape / square output dimensions (portrait dimensions are the landscape width/height swapped):
Note: 2K / 4K are not currently supported. For higher resolution, use gpt-image-2.
1K "1K"
Reference image URL list for image-to-image and image editing features
Notes:
- Up to
16reference images per request - Supported formats:
.jpeg,.jpg,.png,.webp - Image URLs must be directly accessible by the server, or URLs that trigger direct download (typically URLs ending with image extensions like
.png,.jpg)
16HTTPS callback URL for task completion
Callback Timing:
- Triggered when task is completed, failed, or cancelled
- Sent after billing confirmation
Security Restrictions:
- HTTPS protocol only
- Internal IP addresses are prohibited (127.0.0.1, 10.x.x.x, 172.16-31.x.x, 192.168.x.x, etc.)
- URL length must not exceed
2048characters
Callback Mechanism:
- Timeout:
10seconds - Maximum
3retries after failure (at1/2/4seconds after failure) - Callback response format is consistent with task query API
- 2xx status code is considered successful, other codes trigger retry
"https://your-domain.com/webhooks/image-task-completed"
Response
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