Batchwork for Python
One typed async Python API for provider-native AI batch jobs across OpenAI, Anthropic, Google Gemini, Groq, Mistral, Together, and xAI.
Batchwork submits large text, embedding, and image workloads to seven provider-native batch APIs, then exposes one normalized job and result lifecycle. Use it as a typed async Python library, or from the terminal with the batchwork CLI, which gives scripts and coding agents the same lifecycle with stable JSON output and exit codes.
from batchwork import BatchRequest, Batchwork
async with Batchwork() as client:
job = await client.batch(
model="openai/gpt-5.6-sol",
requests=[BatchRequest(custom_id="hello", prompt="Say hello")],
)
await job.wait(timeout=3600)
async for result in job.results():
print(result.custom_id, result.status, result.text)
Start here
- Installation: install with uv or pip and configure the first credential.
- Command-line interface: the same batch lifecycle from your terminal, scripts, or coding agents.
- Configuration: model syntax, credentials, limits, and shared matrices.
- Jobs: submit, poll, wait, cancel, and resume.
- Results: stream records, correlate IDs, and handle partial failures.
- Examples: complete text, embedding, media, and resume flows.
Workloads
Production
Reference
Provider processing is asynchronous and can take minutes or up to 24 hours. Output order is not stable; correlate through custom_id. Provider-owned pricing, limits, and model eligibility can change independently of Batchwork.