API reference · Schema
BatchLine
objectstringrequiredAlways `batch_line`: the type of this object
One of
batch_linelineintegerrequiredLine number in the input file, from 1
custom_idstringrequiredThe `custom_id` the line carries
modelstring | nullrequiredModel the line names (null when the line could not be read)
statusstringrequired`pending` (waiting to run, or waiting to be retried), `running`, `completed` (a response is in the output file), `failed` (an error is in the error file)
One of
pendingrunningcompletedfailedstatus_codeinteger | nullrequiredHTTP status of the recorded result (null until there is one)
errorobject | nullrequiredWhy the line failed (null unless `status` is `failed`)
ShowHide 2 fields of
errorcodestringrequiredMachine-readable reason, as in the error file
messagestringrequiredOne sentence for people
last_errorobject | nullrequiredWhy the latest attempt was put back to be retried (for example `model_unavailable` while the model has no running replica); null when none was
ShowHide 2 fields of
last_errorcodestringrequiredMachine-readable reason, as in the error file
messagestringrequiredOne sentence for people
attemptsintegerrequiredTimes the request was sent; retries after a failure count
usageobject | nullrequiredTokens of the completed request (null until it completes)
ShowHide 3 fields of
usageinput_tokensstringrequiredPrompt tokens (decimal string)
cached_input_tokensstringrequiredPrompt tokens served from cache (decimal string)
output_tokensstringrequiredGenerated tokens (decimal string)
coststring | nullrequiredCharged for this line, nano-USD (null until it completes; failures cost 0)
pattern ^-?[0-9]+$
started_atstring (date-time) | nullrequiredWhen its current attempt started (null until it ran)
finished_atstring (date-time) | nullrequiredWhen it completed or failed (null until then)
{
"object": "batch_line",
"line": 1,
"custom_id": "string",
"model": "string",
"status": "pending",
"status_code": 1,
"error": {
"code": "string",
"message": "string"
},
"last_error": {
"code": "string",
"message": "string"
},
"attempts": 1,
"usage": {
"input_tokens": "string",
"cached_input_tokens": "string",
"output_tokens": "string"
},
"cost": "1500000000",
"started_at": "2026-01-01T00:00:00.000Z",
"finished_at": "2026-01-01T00:00:00.000Z"
}Used by
- List the lines of a batch in input order: status, error, tokens and cost
GET /v1/batches/{batch_id}/lines