GPT Image 2.5 API
Generate and edit images with an asynchronous REST API. Submit a request, keep the task ID, and poll for the final image URLs.
GPT Image 2.5: Choose variant: "flare" (default) or "sunburst" for text generation and image editing. Both support 13 aspect ratios, 1K / 2K / 4K and up to 16 reference images. This is an independent third-party API, not an official OpenAI endpoint.
Quickstart
- Sign in or register, then open API keys.
- Create a named key and set
GPTIMAGE25_API_KEYin your server environment. - Check your credit balance. Each generation costs 4 credits at 1K, 6 at 2K or 10 at 4K.
- Submit one request. Persist
data.task_idand poll with the same key. - On
SUCCESS, readdata.responseand download the images to your storage.
export GPTIMAGE25_API_KEY='YOUR_API_KEY'
curl --fail-with-body 'https://gptimage25api.com/api/v1/images/generate' \
-H "Authorization: Bearer $GPTIMAGE25_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2.5",
"variant": "flare",
"prompt": "Studio photograph of a translucent green glass chair",
"aspect_ratio": "3:2",
"resolution": "1K",
"public": false
}'
# Use data.task_id from the response, with the SAME key.
curl --fail-with-body \
'https://gptimage25api.com/api/v1/images/status?task_id=YOUR_TASK_ID' \
-H "Authorization: Bearer $GPTIMAGE25_API_KEY"Authentication
Both endpoints require Authorization: Bearer YOUR_API_KEY. Use an active key created on this site, associated with project gptimage25api-com. OpenAI keys, account login JWTs and keys from other projects are not accepted. A login cookie is not required.
Send requests from your server. Never expose keys in browser bundles, URLs, analytics, chat or source control. No public CORS support is enabled. Create, copy and delete keys in the account manager. A task can only be polled with the key that created it; finish outstanding tasks before deleting that key during rotation.
Generate image
POST https://gptimage25api.com/api/v1/images/generate
Send Content-Type: application/json. Supply a nonempty prompt (up to 20,000 characters) and optionally up to 16 reference images. This endpoint returns a task, not a completed image.
| Parameter | Contract |
|---|---|
modelstring | Optional. Must be gpt-image-2.5 when supplied. Uses GPT Image 2.5. |
variantstring | Optional. flare (default) or sunburst. Both support text-to-image and image-to-image. |
promptstring | Required for both generation and editing: 1–20,000 characters after trimming. |
imagesstring[] | Optional, at most 16 public HTTP(S) image URLs for editing. URL credentials, base64 and local files are not accepted. Upload to accessible storage first. Aliases: input_urls, inputUrls. |
aspect_ratiostring | Optional, defaults to auto. Values: auto, 1:1, 3:2, 2:3, 4:3, 3:4, 16:9, 9:16, 21:9, 27:16, 16:27, 9:8, 8:9. Alias: aspectRatio. |
resolutionstring | Optional, defaults to 1K. Values: 1K, 2K, 4K (case-insensitive). All 13 aspect ratios support all three resolutions. |
publicboolean | Optional visibility flag; defaults to false in the existing backend. Aliases: is_public, isPublic. Set false for private tasks. |
client_request_idstring | Optional trace label: 12-80 letters, numbers, underscores or hyphens. Alias: clientRequestId. NOT an idempotency key: repeated POSTs can create and charge separate tasks. |
Unknown fields are stripped. This interface does not implement OpenAI SDK compatibility, streaming, webhook callbacks or a batch endpoint. Image edits use publicly accessible HTTP(S) image URLs; upload local files to your own storage first.
Accepted response
{
"code": 200,
"message": "success",
"data": {
"task_id": "n42YOUR_TASK_IDgptimg",
"status": "IN_PROGRESS"
}
}Task status
GET https://gptimage25api.com/api/v1/images/status?task_id=YOUR_TASK_ID
task_id is required; taskId is an alias. Use the same API key used for generation. Poll about every 8 seconds and back off on transient errors. Keep a bounded deadline and support resuming status checks later.
| Status | Next action |
|---|---|
SUBMITTING | Task is being submitted. Keep polling. |
PENDING | Task is queued. Keep polling. |
IN_PROGRESS | Task is generating. Keep polling. |
SUCCESS | Generation finished. Read data.response, an array of image URLs. |
FAILED | Generation failed. Inspect data.error_message and consumed_credits. Stop polling. |
REFUND_PENDING | Generation failed and its credit refund is pending. Check at a slower interval until FAILED. |
Successful result
{
"code": 200,
"message": "success",
"data": {
"task_id": "n42YOUR_TASK_IDgptimg",
"status": "SUCCESS",
"consumed_credits": 4,
"created_at": "2026-09-09 08:00:00",
"error_message": null,
"request": {
"model": "gpt-image-2.5",
"variant": "flare",
"prompt": "Studio photograph of a translucent green glass chair",
"aspect_ratio": "3:2",
"resolution": "1K",
"public": false
},
"response": [
"https://your-image-storage.example/result.png"
]
}
}response can be null before success. On success it is an array of image URLs. request echoes the normalized input, including the selected GPT Image 2.5 variant. consumed_credits reports the task's credit value; failed or refunded tasks may show zero.
Complete integration examples
export GPTIMAGE25_API_KEY='YOUR_API_KEY'
curl --fail-with-body 'https://gptimage25api.com/api/v1/images/generate' \
-H "Authorization: Bearer $GPTIMAGE25_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2.5",
"variant": "flare",
"prompt": "Studio photograph of a translucent green glass chair",
"aspect_ratio": "3:2",
"resolution": "1K",
"public": false
}'
# Use data.task_id from the response, with the SAME key.
curl --fail-with-body \
'https://gptimage25api.com/api/v1/images/status?task_id=YOUR_TASK_ID' \
-H "Authorization: Bearer $GPTIMAGE25_API_KEY"Errors and safe retries
Check both the HTTP status and the { code, message, data } envelope. Error data may be null or contain a task ID and status; retain a returned task ID even on failure. Other upstream 4xx/5xx statuses may be preserved.
| HTTP status | Meaning |
|---|---|
| 400 | Invalid JSON, missing input or unsupported parameter combination. |
| 401 | Missing, malformed, invalid, disabled or deleted API key. |
| 402 | Insufficient account credits. |
| 403 | Key is not authorized, or belongs to another project. |
| 404 | Task is not found for this key. Use the key that created it. |
| 405 | Wrong HTTP method. Generate requires POST; status requires GET. |
| 415 | Use Content-Type: application/json for generation. |
| 429 | Rate limited. Back off; never blindly repeat a generation POST. |
| 502 | Service unavailable or invalid upstream response. |
| 503 | Service configuration or temporary availability issue. |
| 504 | Request timed out. Generation may still have been accepted. |
Do not automatically retry generation. client_request_id is a trace label, not a deduplication guarantee. If a POST times out, it may already have created a paid task. Resume status checks using the saved task ID. If no ID was received, inspect playground history or contact support before submitting again.
Credits, storage and operations
Flare and Sunburst each cost 4 credits at 1K, 6 at 2K and 10 at 4K, for both text-to-image and image editing. Billing and refunds remain handled by the generation backend. Failed tasks may enter REFUND_PENDING; check the task and account balance for the final result.
Use public: false for private tasks. Store images in your own storage promptly; permanent result retention is not promised. There is no published concurrency quota or delivery-time SLA here. Account pricing depends on the configured payment store.
For AI-assisted integration, use llms.txt, the full guide, OpenAPI or the coding prompt. These resources share the same API contract and examples.