Skip to content
Batchwork
Esc
navigateopen⌘Jpreview
On this page

Batchwork for Python

One typed async workflow for provider-native AI batch jobs.

Batchwork submits large text, embedding, and image workloads to seven provider-native batch APIs, then exposes one normalized job and result lifecycle.

from batchwork import BatchRequest, Batchwork

async with Batchwork() as client:
    job = await client.batch(
        model="openai/gpt-5.5",
        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.
  • 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.

Was this page helpful?