pydo.batches.create()
Generated on 3 Aug 2026
from pydo version
v0.40.0
Usage
client.batches.create(
file_id=os.environ["BATCH_INPUT_FILE_ID"],
provider="openai",
endpoint="/v1/chat/completions",
completion_window="24h",
request_id=str(uuid.uuid4()),
)Serverless inference methods can authenticate with a model access key instead of a DigitalOcean API token:
client = Client(token=os.environ.get("MODEL_ACCESS_KEY"))Description
Submits a batch job against a previously uploaded JSONL input file. The upload must have completed before this call; otherwise the request is rejected.
Supply a unique request_id to make the submission idempotent — retries with the same value return the existing job. When provider is openai, the url on each JSONL line must match endpoint.
Parameters
file_idstring requiredExample:
a1b2c3d4-e5f6-4789-90ab-cdef12345678The
file_idreturned byPOST /v1/batches/files.providerstring requiredThe inference provider whose JSONL schema the input file conforms to.
openaifollows the OpenAI Batch API input schema (custom_id,method,url,body);anthropicfollows the Anthropic Message Batches JSONL conventions.endpointstring optionalInference endpoint each request is dispatched to. **Required when
providerisopenaiand must match theurlon every JSONL line. Must be omitted whenproviderisanthropic.**completion_windowstring requiredExample:
24hTime window in which the job must complete. Jobs that do not finish in time transition to
expired.request_idstring requiredExample:
c7e3ad1e-20c3-4e47-9bf2-6f2a4d6a2f11Client-supplied idempotency key. Retries with the same value return the existing job instead of creating a duplicate.
metadataobject or null optionalExample:
{'team': 'ml-eval', 'dataset': 'prompts_v1'}Optional string-valued metadata to attach to the job.
Request Sample
Response Example
More Information
See /v1/batches in the API reference for additional detail on responses, headers, parameters, and more.