Skip to main content

batchkit

batchkit is a thin Python wrapper around the OpenAI Batch API.

It turns the low-level Batch workflow into a simpler Python flow:

  • map source items into batch requests
  • submit through the official openai SDK
  • wait for completion with status updates
  • fetch parsed results
  • retry failed rows without rebuilding the whole job by hand

Install from PyPI:

pip install batchkit-ai

Import as:

import batchkit

It is designed to remove the repetitive parts of batch usage:

  • building JSONL request files
  • uploading files and creating batches
  • polling batch status
  • downloading output and error artifacts
  • reconciling results back to the original inputs
  • retrying failed rows

Example

from openai import OpenAI
from batchkit import BatchClient


sdk = OpenAI()
client = BatchClient(sdk)

job = client.map(
    name="movie-classification",
    items=movies,
    model="gpt-4.1-mini",
    build_request=lambda movie: {
        "input": movie["overview"],
    },
)

results = job.wait(progress=True)

for row in results.rows:
    if row.ok:
        print(row.custom_id, row.response)
    else:
        print(row.custom_id, row.error)

What It Handles

  • request JSONL generation
  • batch file upload and creation
  • polling and terminal-state handling
  • local manifests under .batchkit/
  • output and error artifact download
  • result reconciliation by custom_id
  • retry job creation for retryable rows

Scope

Current scope:

  • OpenAI only
  • responses endpoint first
  • sync and async clients

Contributor setup and release workflow live in CONTRIBUTING.md.

Metadata

Release files for batchkit-ai 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for batchkit-ai 0.1.1
File Size Uploaded Provenance
batchkit_ai-0.1.1.tar.gz 20.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for batchkit-ai 0.1.1
File Interpreter ABI Platform
batchkit_ai-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 40.6 kB

Release files / batchkit_ai-0.1.1.tar.gz

Download URL batchkit_ai-0.1.1.tar.gz
Size 20.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f35b370f21473bac36e5b6f649e63ce3d7090a06887e0b9a43dad1f6443b3eca
BLAKE2b-256 checksum
How to use checksums
12e821f40c16cd147b7ac75e46302237d62b83d2e647b63ba4f9bb311d680406
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.

Transparency log

Release files / batchkit_ai-0.1.1-py3-none-any.whl

Download URL batchkit_ai-0.1.1-py3-none-any.whl
Size 20.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a875462d5a863f09d538d9395951f34f28b19b17f6de7deae43edde8ab60a89
BLAKE2b-256 checksum
How to use checksums
ab93171eb451241a367fe0e8ccd16253b8d33cd0904596499648c66b10c5c9d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.

Transparency log

Security for batchkit-ai 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for batchkit_ai-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page