Batch Processing
The Python SDK exposes synchronous completion helpers underclient.completions. Async jobs that run in the background are managed under client.batches.
| Method group | Use for |
|---|---|
client.completions.classify/extract/summarize/enrich/run | Synchronous completion work that returns results in the current request |
client.batches.submit/retrieve/output/cancel | Async jobs that run in the background |
client.completions.classify(...) for inline classification. For async batch classification, submit operation="label" through client.batches.submit(...).
Sync Completions
Classify
classify is the classification helper. The backend prompts the model to return one of the provided categories. The lower-level batch operation name is still label.
Extract
Summarize
Enrich
Custom Run
Async Batches
Submit larger jobs withclient.batches.submit(...). The request accepts operation, items, optional model, and the same operation-specific fields used by the backend CompletionRequest.
submit_and_wait when you want the SDK to poll until the job reaches a terminal status:
Retrieve Status
wait polls until the batch completes, fails, is cancelled, or reaches the optional timeout:
Read Output
JSON output returns one page withid, status, offset, limit, and results.
jsonl or csv, output returns the response text:
Upload a File
Useupload_file when the batch input already lives in a local file:
Cancel
Methods
| Method | Description |
|---|---|
client.batches.submit(...) | Submit an async job |
client.batches.submit_and_wait(...) | Submit a job and poll until completion, failure, or cancellation |
client.batches.retrieve(batch_id) | Retrieve one job |
client.batches.wait(batch_id, ...) | Poll an existing job until it reaches a terminal status |
client.batches.output(batch_id, ...) | Read one JSON page or raw JSONL/CSV export |
client.batches.iter_output(batch_id, ...) | Iterate all JSON output rows across pages |
client.batches.download_output(batch_id, path, ...) | Save JSON, JSONL, or CSV output to a local file |
client.batches.upload_file(...) | Upload a batch input file and create a job |
client.batches.cancel(batch_id) | Cancel queued or running work |
client.completions.run(...) | Run a generic synchronous completion |
client.completions.classify(...) | Run synchronous classification/labeling |
client.completions.extract(...) | Run synchronous extraction |
client.completions.summarize(...) | Run synchronous summarization |
client.completions.enrich(...) | Run synchronous enrichment |

