GPT Image 2 API-Dokumente
GPT Image 2 API-Dokumente
GPT Image 2 APIQuickstartAuthenticationPricing
API referenceGenerate imageGenerate videoGet task status
API reference

Get task status

GET /api/ai/tasks/{id} — fetch the current snapshot of a submitted task.

Returns the current state of a task. Works for both image and video tasks — the type field distinguishes them.

The database is the source of truth. Terminal rows (status: 1 or status: 2) return immediately. Pending rows may trigger a single upstream provider query at most every 30 seconds, so callers can safely poll as often as every 2 seconds without hitting rate limits.

Status values

statusMeaningNext step
0PENDINGContinue polling.
1COMPLETEDRead imageUrls[] or videoUrl.
2FAILEDRead errorCode / errorMessage. Credits have been refunded (or will be shortly).
GET
/api/ai/tasks/{id}

Authorization

bearerAuth
AuthorizationBearer <token>

API keys are in closed beta — send your key as Authorization: Bearer <key>. In the meantime, first-party usage from the web dashboard is authenticated via session cookie. See Authentication for details.

In: header

Path Parameters

id*string

The taskId returned from /api/ai/image/generate or /api/ai/video/generate.

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://gptimage2api.org/api/ai/tasks/tsk_01J9XA5M2R9W4QZC4PYJF3N7ND"
{
  "taskId": "string",
  "type": "image",
  "status": 0,
  "model": "string",
  "prompt": "string",
  "imageUrls": [
    "http://example.com"
  ],
  "videoUrl": "http://example.com",
  "errorCode": "STORAGE_ERROR",
  "errorMessage": "string",
  "creditsUsed": 0,
  "creditsRefunded": true,
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z"
}
{
  "error": "Unauthorized"
}
{
  "error": "Task not found"
}
{
  "error": "string"
}

Generate video

POST /api/ai/video/generate — submit a text-to-video or image-to-video task across Kling, Sora, Veo, Hailuo, Wan, and Seedance.

Polling strategy

How to poll GET /api/ai/tasks/{id} efficiently without rate-limiting yourself or our upstream providers.

Inhaltsverzeichnis

Status values