Developer Resources
GPT Image 1.5 API Documentation
Integrate OpenAI's GPT Image 1.5 model into your applications. Support for text-to-image and image-to-image generation with simple REST API.
1
Authentication
The GPT Image 1.5 API uses Bearer Token authentication. Pass your API Key in the request header.
Authentication
Authorization: Bearer sk-your-api-key-here
Keep your API key secure. Do not share it in client-side code.
Pricing
| Type | Cost | Description |
|---|---|---|
| Text to Image | 10 Credits | Generate images from text prompts. |
| Image to Image | 10 Credits | Edit existing images with text prompts. |
2
Create Task
POST
https://gptimage15.ai/api/generateAsync Generation
Pricing
Each generation request costs 10 Credits, regardless of whether it's text-to-image or image-to-image.
Initiate a generation task. The API returns a task_id immediately, which you use to poll for results.
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| prompt | string | Required | The text description for image generation. Max 2000 characters. |
| size | string | Optional | Image size: 1024*1024, 1024*1536, or 1536*1024. Default: 1024*1024 |
| quality | string | Optional | Image quality: low, medium, or high. Default: medium |
| images | array | Optional | For Image-to-Image mode. Array of image URLs to edit. |
| input_fidelity | string | Optional | Fidelity to input image: low or high. Default: high. Only for image-to-image. |
| callback_url | string | Optional | Webhook URL for task completion notification. |
Request Examples
Text-to-Image (cURL)
curl -X POST https://gptimage15.ai/api/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A serene mountain landscape...",
"size": "1536*1024",
"quality": "high"
}'Image-to-Image (Edit Mode)
{
"prompt": "Add a rainbow in the sky",
"images": [
"https://example.com/landscape.jpg"
],
"input_fidelity": "high",
"quality": "medium"
}Success Response
{
"code": 200,
"data": {
"task_id": "n36abc123def456gptimg",
"status": "IN_PROGRESS"
}
}Error Response
{
"code": 400,
"message": "Bad Request: 'prompt' is required.",
"data": null
}3
Check Status
GET
https://gptimage15.ai/api/statusPoll this endpoint to check the progress of your task. We recommend polling every 5-10 seconds.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| task_id | string | The task ID received from the generate endpoint. Required |
Status Values
PENDINGTask is queuedIN_PROGRESSProcessingSUCCESSCompletedFAILEDError occurredcURL
curl -X GET "https://gptimage15.ai/api/status?task_id=n36abc123def456gptimg" \
-H "Authorization: Bearer YOUR_API_KEY"Response (In Progress)
{
"code": 200,
"data": {
"task_id": "n36abc123def456gptimg",
"status": "IN_PROGRESS",
"consumed_credits": 10,
"created_at": "2024-12-19T10:00:00Z"
}
}Response (Completed)
{
"code": 200,
"data": {
"task_id": "n36abc123def456gptimg",
"status": "SUCCESS",
"response": [
"https://cdn.example.com/image.png"
]
}
}Response (Failed)
{
"code": 200,
"message": "success",
"data": {
"task_id": "n36abc123def456gptimg",
"status": "FAILED",
"consumed_credits": 0,
"error_message": "Content policy violation detected",
"created_at": "2024-12-19T10:00:00Z",
"request": { ... },
"response": null
}
}Error Codes
| Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad Request - Invalid parameters (missing prompt, invalid size/quality, etc.) |
| 401 | Unauthorized - Missing or invalid API key |
| 404 | Not Found - Task ID does not exist |
| 500 | Internal Server Error - Please retry or contact support |