Create batch

Submit a batch of requests that run asynchronously on one model at batch rates.

Authentication

AuthorizationBearer
Your production key sent as a bearer token.

Request

This endpoint expects an object.
endpointstringRequired

Request shape of every line: /v1/chat/completions, /v1/embeddings, /v1/messages, or /v1/responses.

modelstringRequired
Model every line runs on.
requestslist of objectsRequired

Batch lines, each with a unique custom_id.

metadatamap from strings to any or nullOptional
Your metadata, echoed back unchanged.
providerobject or nullOptional

Vendor restrictions for the batch, for example {"only": ["anthropic"]}.

Response

The created batch.
idstring
Batch ID.
endpointstring
Request shape of the batch lines.
modelstring
Model the batch runs on.
statusstring

One of validating, in_progress, finalizing, cancelling, completed, failed, expired, or cancelled.

request_countsmap from strings to integers
Line counts by outcome.
created_atinteger
Unix timestamp in seconds.
expires_atinteger
Unix timestamp in seconds after which an unfinished batch expires.
object"batch"OptionalDefaults to batch
completed_atinteger or nullOptional
Unix timestamp in seconds when the batch finished.
usagemap from strings to any or nullOptional
Aggregate usage and cost, once known.
metadatamap from strings to any or nullOptional
Metadata you sent at creation.

Errors

422
Unprocessable Entity Error