GPT Image
GPT Image
GPT Image 1.5 for high-quality image generation and editing
- Endpoint
- POST /api/v1/images/generate
- model
- gpt-image-1.5
- Output
- Image
- Credits
- from 2
1
Submit a task
POST
/api/v1/images/generateParameters
modelstringRequiredMust be "gpt-image-1.5"
typestringOptionalDefaulttext-to-image"text-to-image" or "image-to-image" (default: text-to-image)
text-to-imageimage-to-imagepromptstringRequiredText description of the image
qualitystringOptionalDefaultmedium"low", "medium", or "high" (default: medium)
lowmediumhighimage_sizestringOptional"1024x1024", "1536x1024", or "1024x1536"
1024x10241536x10241024x1536num_imagesnumberOptionalNumber of images (1-4)
image_urlsstring[]OptionalInput image URLs or base64 for image editing
input_imagestringOptionalDeprecated. Alias for image_urls[0]
Request
curl -X POST https://www.bananapro.site/api/v1/images/generate \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-1.5",
"prompt": "A serene Japanese garden with cherry blossoms",
"quality": "high",
"image_size": "1024x1024"
}'Response200
{
"success": true,
"data": {
"task_id": "task_gpt123",
"credits_used": 30,
"remaining_credits": 470,
"model": "gpt-image-1.5"
}
}The credits_used values shown in these examples are illustrative. Actual usage is calculated when you submit and returned by the API.
2
Query the task
GET
/api/v1/images/{task_id}status
pending- Accepted and waiting to start. Keep polling.
processing- Running. Keep polling.
completed- Finished. Read image_url; output holds the full result.
failed- Ended without a result. error_message says why and credits_refunded shows what was returned.
Poll every 5 to 10 seconds and stop at completed or failed, or register a webhook to be notified instead. Failed tasks are refunded automatically.
Request
curl https://www.bananapro.site/api/v1/images/task_abc123 \
-H "Authorization: Bearer sk-your-api-key"Response200
{
"success": true,
"data": {
"task_id": "task_abc123",
"model": "gpt-image-1.5",
"status": "completed",
"output": { "images": [{ "url": "https://..." }] },
"primary_url": "https://...",
"image_url": "https://...",
"error_message": null,
"credits_used": 30,
"credits_refunded": 0,
"created_at": "2026-10-04T10:00:00.000Z",
"updated_at": "2026-10-04T10:01:12.000Z",
"completed_at": "2026-10-04T10:01:12.000Z"
},
"request_id": "req_abc123"
}Wait for the result
TASK_ID=task_abc123
while true; do
TASK=$(curl -s https://www.bananapro.site/api/v1/images/$TASK_ID \
-H "Authorization: Bearer sk-your-api-key")
STATUS=$(echo "$TASK" | jq -r '.data.status')
if [ "$STATUS" = "completed" ] || [ "$STATUS" = "failed" ]; then
echo "$TASK" | jq
break
fi
sleep 10
donePricing
| Quality | 1024×1024 | 1536×1024 |
|---|---|---|
| low | 2 | 3 |
| medium | 8 | 10 |
| high | 30 | 40 |
Total credits = base_credits × num_images
Features
- Text-to-image generation
- Image editing with prompts
- Multiple quality levels
- Flexible image sizes