Skip to main content
An OpenAI-compatible Batch API for submitting and managing asynchronous inference jobs. All endpoints are relative to:
These endpoints operate on the Batch object.

Create a batch

Creates and starts executing a batch job from an uploaded file of requests. Creating a batch requires the following parameters:
The time window after which the batch expires. Currently only "24h" is supported.
The endpoint to run the batch against. One of the batch-supported endpoints, currently /v1/chat/completions, /v1/completions, or /v1/embeddings. Must match the url used on every line of the input file.
The id of the uploaded input file (created with purpose="batch").
Up to 16 key–value string pairs, where each key is a string of up to 64 characters and each value is a string of up to 512 characters.
Controls how long the output and error files remain available. An object with two fields:
  • anchor (optional) — must be "created_at". The expiry is measured from when the output file is created. Defaults to "created_at".
  • seconds (optional) — the number of seconds the file stays available after the anchor. An integer between 3600 (1 hour) and 2592000 (30 days). Defaults to 2592000 (30 days).
This endpoint returns a Batch object.

Retrieve a batch

Returns information about a specific batch. Retrieving a batch requires the following parameters:
The id of the batch to retrieve.
This endpoint returns a Batch object.

List batches

Listing batches requires the following parameters:
A pagination cursor. The returned list starts from the object right after the batch with this id. If omitted, the list starts from the first batch.
An integer between 1 and 100. The returned list will have at most limit elements. Defaults to 20.
The returned object has the following fields:

Cancel a batch

Cancels a given batch. The batch moves to the cancelling status until it is finalized, at which point its status becomes cancelled. Requests that managed to finish are written to the output file, and the rest are written to the error file as cancelled. Cancelling a batch requires the following parameters:
The id of the batch to cancel.
This endpoint returns a Batch object.