Create a batch
completion_window
completion_window
The time window after which the batch expires. Currently only
"24h" is supported.endpoint
endpoint
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.input_file_id
input_file_id
The
id of the uploaded input file (created with purpose="batch").metadata (optional)
metadata (optional)
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.
output_expires_after (optional)
output_expires_after (optional)
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 between3600(1 hour) and2592000(30 days). Defaults to2592000(30 days).
Retrieve a batch
batch_id
batch_id
The
id of the batch to retrieve.List batches
after (optional)
after (optional)
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.limit (optional)
limit (optional)
An integer between
1 and 100. The returned list will have at most limit elements. Defaults to 20.| Field | Type | Description |
|---|---|---|
object | string | The object type, always "list". |
data | array | A list of Batch objects. |
first_id | string | The id of the first batch in the list. |
last_id | string | The id of the last batch in the list. |
has_more | boolean | true if there are more batches after last_id. |
Cancel a batch
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:
batch_id
batch_id
The
id of the batch to cancel.