| Field | Type | Required | Description | Remarks |
|---|---|---|---|---|
| Image | File | ✅ | Original image file | ≤ 50 MB; Supports PNG/JPEG/WebP |
| mask | file | Mask Image | Must be the same size as the original image and contain an alpha channel | |
| prompt | string | ✅ | Edit prompt | Length ≤ 32 k (gpt-image-1.5) |
| model | string | ✅ | Model | gpt-image-1.5 / gpt-image-1 / gpt-image-1-mini |
| n | int | Number of output sheets | 1-10 | |
| size | string | Output size | Same as the generation interface, see the size table | |
| quality | string | Quality | low / medium / high / auto | |
| background | string | Background | transparent / opaque / auto | |
| input_fidelity | string | Input Fidelity | low / high; high better preserves face/Logo | |
| output_format | string | Output format | png / jpeg / webp | |
| output_compression | int | Compression ratio | 0-100; only for jpeg/webp | |
| moderation | string | moderation strictness | low / auto | |
| stream | bool | Streaming | Only for GPT-Image series | |
| partial_images | int | Streaming sharding | 0-3 | |
| async | query | Whether asynchronous | ?async=true returns task_id |
| Model | Text Input | Image Input | Image Output |
|---|---|---|---|
| gpt-image-1 | 5 PTC/1M Tokens | 10 PTC/1M Tokens | 40 PTC/1M Tokens |
| gpt-image-1-mini | 2 PTC/1M Tokens | 2.5 PTC/1M Tokens | 8 PTC/1M Tokens |
| gpt-image-1.5 | 5 PTC/1M Tokens | 8 PTC/1M Tokens | 32 PTC/1M Tokens |
The final price shall be based on the number of Tokens consumed as returned by the request
gpt-image-1: Price Reference
curl --location --request POST 'https://api.302.ai/v1/images/edits?response_format=url' \
--header 'Authorization: Bearer ' \
--form 'image=@""' \
--form 'prompt=""' \
--form 'model="gpt-image-1.5"' \
--form 'mask=@""' \
--form 'quality="auto"' \
--form 'size="1024x1024"' \
--form 'n="1"' \
--form 'background="auto"' \
--form 'output_format="png"' \
--form 'output_compression="100"' \
--form 'partial_images="0"' \
--form 'stream=""'{
"background": "opaque",
"created": 1765963391,
"data": [
{
"url": "https://file.302.ai/gpt/imgs/20251217/3de34788dedd4b84834bb428ae742615.png"
}
],
"output_format": "png",
"quality": "high",
"size": "1024x1024",
"usage": {
"input_tokens": 10977,
"input_tokens_details": {
"image_tokens": 10917,
"text_tokens": 60
},
"output_tokens": 4160,
"total_tokens": 15137
}
}