Create Batch
Create a batch job from a previously uploaded JSONL input file.
Create a batch job. Returns a
Batch object with
status: 'validating'.
POST /v1/batchesHeaders
AuthorizationBearerrequiredAPI key. See Authentication.
Content-TypestringrequiredMust be application/json.
Body
input_file_idstringrequiredThe id of an uploaded input file with purpose: 'batch'. See
Upload file.
endpointstringrequiredMust match the url used by every line in the input file, or the
request is rejected with 400.
Allowed values:
/v1/chat/completions/v1/responsescompletion_windowstringoptionalDefault 24hOnly 24h is supported.
metadataobjectoptionalArbitrary string key/value pairs, echoed back on every subsequent read of this batch.
Response
idstringoptionalUnique batch identifier, prefixed with avn-batch_.
object'batch'optionalAlways batch.
endpointstringoptionalinput_file_idstringoptionalcompletion_windowstringoptionalstatus'validating'optionalInitial status is always validating.
request_countsobjectoptional{ total, completed, failed }.
created_atintegeroptionalexpires_atinteger | nulloptionalErrors
| Status | Reason |
|---|---|
400 | Missing/invalid field, unsupported model, or endpoint doesn't match the file's detected endpoint. |
401 | Missing or invalid API key. |
402 | Not enough credit, an unpaid balance, a spend limit was reached, or the batch's estimated cost is more than your balance plus the perks that cover the model. The estimate prices the input file and, for requests that set max tokens, their maximum output, at batch pricing. |
404 | input_file_id does not exist or belongs to another workspace. |
502 | The batch could not be submitted. Try again later. |
See Errors for the error.type of each status.