Overview
The/v1/batches endpoint lets you submit a large number of chat-completion requests asynchronously and retrieve the results later. It supports both a native Allternit request array and a file-based input format compatible with common batch SDKs.
A background worker validates each batch, submits it to the configured batch provider, polls for completion, and stores the results. You can cancel a batch while it is still validating or in_progress.
Base URL
Endpoints
Create a batch
Native request array
Submit the requests inline as a JSON array. Each element is a chat-completion request body.File-based input
Submit a batch that references a JSONL file uploaded to the gateway’s batch input directory.JSONL input file format
Each line is a JSON object. The standard shape includescustom_id, method, url, and body. Plain request objects are also accepted as a fallback.
Request body fields
* One of
requests or input_file_id must be provided.
Example response
List batches
Get a batch
Cancel a batch
Retrieve results
Batch statuses
Validation and permissions
- Every request inside a batch is validated individually.
- Each request’s
modelis checked against the virtual key’s allowlist. - The maximum number of retries for transient provider errors is three.
Error codes
Related pages
- Chat Completions — request shape for batch items
- Files — upload batch input files
- Models — model registry and pricing