gpt-image-2 Image Generation Model
- 2026.04.20 This site now supports the GPT image generation model
gpt-image-2via thedall-einterface - 2025.12.17 This site now supports the GPT image generation model
gpt-image-1.5via thedall-einterface - 2025.04.24 This site now supports the GPT image generation model
gpt-image-1via thedall-einterface - Supports multi-image reference via
/v1/images/edits - Images are billed based on input and output image tokens
Billing Rules
- Billing is determined by input.text_token, input.image_token, and output.image_token
- (input.text_token*5 + input.image_token*10 + output.image_token*40)*7.1*10000/1000000 = credits
- A 1024*1024 image at
lowquality costs approximately 800 credits;mediumquality costs approximately 3000 credits, so please choose your quality level carefully - Billing reference: https://openai.com/api/pricing/
Image Generation API
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model name: gpt-image-2, gpt-image-1, gpt-image-1.5 |
| prompt | string | Yes | Image description |
| n | integer | No | Number of images to generate |
| size | string | No | Output size, supports resolution format or auto (default) |
| quality | string | No | Quality level: low, medium, high, auto (default) |
| image | file | No | Source image for editing, only for /v1/images/edits |
| response_format | string | No | Response format: b64_json or url (default) |
sizeconstraints- Maximum side length ≤
3840px - Both sides must be multiples of 16
- Aspect ratio must not exceed 3:1
- Total pixel count range: 655,360 ~ 8,294,400
- Maximum side length ≤
Common size combinations
| Ratio | size | K |
|---|---|---|
| 1:1 Square | 1024×1024 | 1K |
| 1:1 Square | 2048×2048 | 2K |
| 1:1 Square | 2880×2880 | 4K |
| 16:9 Widescreen | 1280×720 | 1K |
| 16:9 Widescreen | 2048×1152 | 2K |
| 16:9 Widescreen | 3840×2160 | 4K |
| 9:16 Story | 720×1280 | 1K |
| 9:16 Story | 1152×2048 | 2K |
| 9:16 Story | 2160×3840 | 4K |
| 5:4 Print | 1040×832 | 1K |
| 5:4 Print | 2080×1664 | 2K |
| 5:4 Print | 3200×2560 | 4K |
| 4:5 Feed | 832×1040 | 1K |
| 4:5 Feed | 1664×2080 | 2K |
| 4:5 Feed | 2560×3200 | 4K |
| 4:3 Classic | 1024×768 | 1K |
| 4:3 Classic | 2048×1536 | 2K |
| 4:3 Classic | 3264×2448 | 4K |
| 3:4 Vertical | 768×1024 | 1K |
| 3:4 Vertical | 1536×2048 | 2K |
| 3:4 Vertical | 2448×3264 | 4K |
| 3:2 Photo | 1008×672 | 1K |
| 3:2 Photo | 2064×1376 | 2K |
| 3:2 Photo | 3504×2336 | 4K |
| 2:3 Portrait | 672×1008 | 1K |
| 2:3 Portrait | 1376×2064 | 2K |
| 2:3 Portrait | 2336×3504 | 4K |
| 21:9 Exclusive | 1344×576 | 1K |
| 21:9 Exclusive | 2016×864 | 2K |
| 21:9 Exclusive | 3808×1632 | 4K |
| Auto (matches reference image size) | auto | - |
curl Examples
- Supported endpoints:
/v1/images/generations/v1/images/edits
Text to Image
shell
curl https://api.openai-hk.com/v1/images/generations \
-H 'Authorization: Bearer hk-replace-with-your-key' \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "a white siamese cat",
"n": 1,
"size": "1024x1024",
"quality": "low"
}'curl https://api.openai-hk.com/v1/images/generations \
-H 'Authorization: Bearer hk-replace-with-your-key' \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "a white siamese cat",
"n": 1,
"size": "1024x1024",
"quality": "low"
}'
Image Editing
shell
curl -X POST "https://api.openai-hk.com/v1/images/edits" \
-H "Authorization: Bearer hk-replace-with-your-key" \
-F "model=gpt-image-2" \
-F "image[]=@body-lotion.png" \
-F "image[]=@bath-bomb.png" \
-F "image[]=@incense-kit.png" \
-F "image[]=@soap.png" \
-F 'prompt=Generate a photorealistic image of a gift basket on a white background labeled "Relax & Unwind" with a ribbon and handwriting-like font, containing all the items in the reference pictures'curl -X POST "https://api.openai-hk.com/v1/images/edits" \
-H "Authorization: Bearer hk-replace-with-your-key" \
-F "model=gpt-image-2" \
-F "image[]=@body-lotion.png" \
-F "image[]=@bath-bomb.png" \
-F "image[]=@incense-kit.png" \
-F "image[]=@soap.png" \
-F 'prompt=Generate a photorealistic image of a gift basket on a white background labeled "Relax & Unwind" with a ribbon and handwriting-like font, containing all the items in the reference pictures'
Response Data
json
{
"created": 1776220106,
"data": [
{
"revised_prompt": "your original prompt",
"url": "https://myfile.addmao.com/20260427/d3272fe0-92c9-4f20-a50b-3114affc45c5.png",
"b64_json": "data:image/png;base64 returned when response_format is b64_json"
}
],
"usage": {
"input_tokens": 6,
"input_tokens_details": {
"image_tokens": 0,
"text_tokens": 6
},
"output_tokens": 275,
"total_tokens": 281
}
}{
"created": 1776220106,
"data": [
{
"revised_prompt": "your original prompt",
"url": "https://myfile.addmao.com/20260427/d3272fe0-92c9-4f20-a50b-3114affc45c5.png",
"b64_json": "data:image/png;base64 returned when response_format is b64_json"
}
],
"usage": {
"input_tokens": 6,
"input_tokens_details": {
"image_tokens": 0,
"text_tokens": 6
},
"output_tokens": 275,
"total_tokens": 281
}
}Online Testing
Note
- Visit https://gpt4o.ddaiai.com/ (if blocked, try changing the subdomain prefix to
suibian)
2. If it is blocked, you can change the address yourself:https://suibian.ddaiai.com— replacesuibianwith something else, e.g.https://2025.ddaiai.com
Setup
- Configure in the corresponding fields shown below
- OpenAI API Base URL: https://api.openai-hk.com
- OpenAI API KEY: hk-your-apiKey

Result
Enter your prompt in the input box
Abstractify, optimize the style
Upload a reference image using the image+ button

OpenAi-HK