GPT-Image-2
GPT-Image-2 Image Generation
Generate images with gpt-image-2, supporting text-to-image and reference_images based image generation
POST
Documentation Index
Fetch the complete documentation index at: https://docs.toapis.com/llms.txt
Use this file to discover all available pages before exploring further.
- Unified image generation API
- Select the
gpt-image-2model via themodelparameter - Supports text-to-image, single-reference, and multi-reference image generation
- Async task management with task ID based result lookup
Authorizations
All endpoints require Bearer Token authenticationGet your API Key from the API Key Management PageAdd to request header:
Body
Image generation model nameExample:
"gpt-image-2"Text prompt for image generationMaximum 32,000 characters for GPT image models
Output image aspect ratioSupported values depend on
resolution:1K:1:1,3:2,2:32K:1:1,3:2,2:3,4:3,3:4,5:4,4:5,16:9,9:16,2:1,1:2,21:9,9:214K:16:9,9:16,2:1,1:2,21:9,9:21
Output resolution tierSupported values:
1K, 2K, 4KSize Reference
| size | 1K | 2K | 4K |
|---|---|---|---|
1:1 | 1024x1024 | 2048x2048 | Not supported |
3:2 | 1536x1024 | 2048x1360 | Not supported |
2:3 | 1024x1536 | 1360x2048 | Not supported |
4:3 | Not supported | 2048x1536 | Not supported |
3:4 | Not supported | 1536x2048 | Not supported |
5:4 | Not supported | 2560x2048 | Not supported |
4:5 | Not supported | 2048x2560 | Not supported |
16:9 | Not supported | 2048x1152 | 3840x2160 |
9:16 | Not supported | 1152x2048 | 2160x3840 |
2:1 | Not supported | 2688x1344 | 3840x1920 |
1:2 | Not supported | 1344x2688 | 1920x3840 |
21:9 | Not supported | 2688x1152 | 3840x1648 |
9:21 | Not supported | 1152x2688 | 1648x3840 |
Number of images to generateDefault: 1
Response formatThe API returns image URLs, so
url is the recommended valueReference image URLs for image-to-image generation⚠️ URL format only (base64 no longer supported)
- Publicly accessible URLs (
http://orhttps://) - You can use the Upload Image API to upload local files and get URLs
- Supports single-image and multi-image reference
Backward-compatible reference image fieldToAPIs automatically normalizes it to
reference_imagesResponse
Unique task identifier for status queries
Object type, always
generation.taskModel name used
Task status
queuedin_progresscompletedfailed
Task progress percentage (0-100)
Task creation timestamp (Unix timestamp)