Skip to navigation

Create a batch

Create a batch from an uploaded input file. Requests are processed asynchronously within the completion window. Each line bills at its model’s list price less the model’s batch_discount_pct (0 when the model runs batch at list price). Only batch-eligible models may be used (check batch_supported on /v1/models). A line of the input file that names a url or a method must name the batch endpoint and POST. An /v1/embeddings line can set encoding_format to base64, as on the real-time endpoint. The window is 24h, and the batch expires at expires_at if it has not finished. When the batch ends, output_file_id holds the requests that succeeded and error_file_id the ones that did not; download them with GET /v1/files/{file_id}/content. An input file past its expires_at returns 404 with the code file_expired; upload it again.

Authentication

AuthorizationBearer

Pass your EmpirioLabs API key as a bearer token. The Anthropic-style x-api-key header is also accepted on every endpoint.

Request

This endpoint expects an object.
input_file_idstringRequired
Id of the uploaded JSONL input file.
endpointenumOptionalDefaults to /v1/chat/completions

API path every line of the file calls, for example /v1/chat/completions.

Allowed values:
completion_windowenumOptionalDefaults to 24h

Time window for the batch to finish. Only 24h is accepted.

Allowed values:
metadatamap from strings to stringsOptional

Your own labels for the batch: up to 16 pairs, each key up to 64 characters and each value a string of up to 512 characters. Anything else returns 400 with param metadata.

Response

Batch created.
idstringOptional
objectstringOptional
endpointstringOptional
errorsobject or nullOptional

Why the batch failed, when status is failed, for example input_file_unavailable when the input file could no longer be read. Null otherwise.

input_file_idstringOptional
completion_windowenumOptional
Allowed values:
statusenumOptional
output_file_idstring or nullOptional
The file of the requests that succeeded, once the batch has ended. Null when none succeeded.
error_file_idstring or nullOptional
The file of the requests that did not succeed, once the batch has ended. Null when every request succeeded.
request_countsobjectOptional

completed counts the lines of the output file and failed the lines of the error file.

metadataobject or nullOptional
created_atinteger or nullOptional
Unix time in seconds when the batch was created.
in_progress_atinteger or nullOptional
finalizing_atinteger or nullOptional
completed_atinteger or nullOptional
failed_atinteger or nullOptional
expired_atinteger or nullOptional
Unix time in seconds when the batch expired.
cancelling_atinteger or nullOptional
Unix time in seconds when the batch was asked to cancel.
cancelled_atinteger or nullOptional
Unix time in seconds when the batch was cancelled.
expires_atinteger or nullOptional
Unix time in seconds when the completion window ends, 24 hours after creation.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
429
Too Many Requests Error