Python examples require
together>=2.0.0Check batch status
batches.retrieve() returns the batch object directly (no .job wrapper, unlike create()).
Poll every 30 to 60 seconds. Tighter loops will hit rate limits without giving the server time to make progress.
Retrieve results
When the batch reachesCOMPLETED, download the output file referenced by output_file_id. Per-request failures are stored separately in error_file_id. Always download both: a COMPLETED batch can still contain individual request failures.
custom_id from your input, so you can reconcile them with a single pass over each file. Line order does not match input order.
Cancel a batch
You can cancel a batch while it isVALIDATING or IN_PROGRESS. Requests that have already completed before the cancellation are still billed, and their responses are still returned in the output file.
List batches
Errors
Error codes
Error file format
Each line in the error file pairs acustom_id from your input with the failure reason:
batch_errors.jsonl