| Field | Type | Required | Description | Remarks |
|---|---|---|---|---|
| prompt | string | ✅ | Description text | Length ≤ 32k (gpt-image-1.5) |
| model | string | ✅ | Model | Optional: gpt-image-1.5 / gpt-image-1 / gpt-image-1-mini |
| n | int | Number of images to generate | 1-10; dall-e-3 only supports 1 | |
| size | string | Dimensions | 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), auto. When the dimension selection is auto, the model will automatically provide the optimal ratio based on the prompt. | |
| quality | string | Quality | low / medium / high / auto | |
| background | string | Background | transparent / opaque / auto | |
| output_format | string | Output format | png / jpeg / webp | |
| output_compression | int | Compression ratio | 0-100; only effective for jpeg/webp | |
| moderation | string | moderation strictness | low (lenient) / auto | |
| stream | bool | Streaming output | Only supported by the GPT-Image series | |
| partial_images | int | Number of streaming shards | 0-3; 0 = only return the final image | |
| async | query | Whether asynchronous | Returns task_id when passing ?async=true |
| Model | Text Input | Text Output | Image Output | Remarks |
|---|---|---|---|---|
| gpt-image-1 | 5 PTC/1M Tokens | 40 PTC/1M Tokens | High-quality model | |
| gpt-image-1-mini | 2 PTC/1M Tokens | 8 PTC/1M Tokens | Efficient and Economical Model | |
| gpt-image-1.5 | 5 PTC/1M Tokens | 10 PTC/1M Tokens | 32 PTC/1M Tokens | Balanced Model |
The final price shall be based on the number of Tokens consumed as returned by the request
gpt-image-1: Price Reference
{
"prompt": "A cute baby sea otter",
"model": "gpt-image-1.5",
"size": "1024x1024",
"n": 1,
"background": "auto",
"moderation": "auto",
"output_format": "png"
}curl --location --request POST 'https://api.302.ai/v1/images/generations?response_format=url&async=false' \
--header 'Authorization: Bearer ' \
--header 'Content-Type: application/json' \
--data-raw '{
"prompt": "A cute baby sea otter",
"model": "gpt-image-1.5",
"size": "1024x1024",
"n": 1,
"background": "auto",
"moderation": "auto",
"output_format": "png"
}'{
"background": "opaque",
"created": 1765956636,
"data": [
{
"url": "https://file.302.ai/gpt/imgs/20251217/cf55103f979340a0b3e92ddf38d33478.png"
}
],
"output_format": "png",
"quality": "medium",
"size": "1024x1024",
"usage": {
"input_tokens": 12,
"input_tokens_details": {
"image_tokens": 0,
"text_tokens": 12
},
"output_tokens": 1414,
"output_tokens_details": {
"image_tokens": 1056,
"text_tokens": 358
},
"total_tokens": 1426
}
}