chatcmpl-… for chat, img_… for images and video_… for videos. The generation endpoints work with all of them.
Asynchronous requests
Videos are always asynchronous. Image requests become asynchronous when you sendPrefer: respond-async:
202 Accepted with a generation in queued status, the response header Preference-Applied: respond-async, and estimated_cost, the amount held from your balance until the job finishes.
Idempotency
SendIdempotency-Key (up to 255 characters) with asynchronous requests. Within a project, a key is accepted only once: if a network retry sends the same request again, you get the existing generation back, and nothing is held or generated twice.
Look up a generation
GET /v1/generations/{id} returns the current state:
Poll every few seconds for images and every 10–15 seconds for videos, or use webhooks instead.
404 generation_not_found. To see every call in your organization, use GET /v1/organization/generations with an admin key.
List generations
GET /v1/generations?type=video&status=completed&limit=20&after=video_… lists the calls made with your key, newest first, in the OpenAI list format (data, first_id, last_id, has_more). limit defaults to 20, maximum 100.
Cancel
POST /v1/generations/{id}/cancel cancels a job. You are charged only if the model provider charges for it:
- Still queued: the job becomes
cancelledright away. You are not charged and the hold is released. - Already running at the model provider: the response stays
in_progresswithcancel_requested_atset, and the cancellation is passed on to the provider. If the provider stops the job or it fails, it becomescancelledand you are not charged. Some jobs can’t be stopped once they have started; if it completes anyway, it becomescompleted, is charged as usual and the result is delivered.
409 generation_not_cancellable.
Timeouts
Jobs that don’t finish within their deadline fail withgeneration_timeout and are not charged.