Discord

← API reference

Async Jobs

Submit a single request that's OK to wait 1 or 6 hours for a deeper discount — same body as /v1/chat/completions, wrapped.

POST/v1/jobs

Requires the batch scope. Every field a /v1/chat/completions body accepts is valid here too — it's submitted as one deferred line.

Parameters

ParameterTypeDescription
completion_windowstringRequired. "1h" or "6h" — any other value 400s.
webhook_urlstringOptional. Must start with https://. Falls back to your org's saved default webhook if omitted.
model, messages, tools, max_tokens, ...—The rest of the body — everything /v1/chat/completions accepts. stream is rejected (jobs can't stream).

Example response (202)

{
  "id": "batch_...",
  "object": "job",
  "status": "in_progress",
  "completion_window": "1h",
  "webhook_url": null,
  "created_at": 1731430000,
  "estimated_completion": 1731433600
}

A job's id is a batch_... id under the hood (Jobs is a one-line Batch submission) — estimated_completion is the window's hard deadline, not a real ETA.

GET/v1/jobs/{id}

Parameters

ParameterTypeDescription
idstring (path)The id returned by POST /v1/jobs.

Example response (status: "completed")

{
  "id": "batch_...",
  "object": "job",
  "status": "completed",
  "completion_window": "1h",
  "webhook_url": null,
  "created_at": 1731430000,
  "estimated_completion": 1731433600,
  "result": { "...": "a normal chat.completion object" }
}

Once terminal: result (a plain chat completion object) is added on success, or error on failure. status is one of in_progress/completed/failed/expired/cancelling/cancelled.