Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.2.1 instead.
Reason given by maintainers: bundled a stale price sheet; use 0.1.1 instead

offpeak

Deadline-priced inference. Same model, same tokens, a different hour — for half the price.

CI PyPI License

OpenAI, Anthropic, and Google all sell batch inference at 50% off list price. Almost nobody uses it, because no API lets work say it can wait: every token runs "now" by default, and the batch workflow — build a file, upload, poll, download, match results back up — is enough friction that urgency gets bought by accident.

offpeak gives your code one new argument.

import offpeak

jobs = [offpeak.job("claude-haiku-4-5", f"Summarize:\n\n{doc}") for doc in docs]

results = offpeak.run(jobs, deadline="06:00")   # done by 6am, at batch prices

print(offpeak.receipt(results))
OFFPEAK SETTLEMENT ────────────────────────────
jobs      1,000 (1,000 ok, 2 sync fallback)
sla       1,000/1,000 met
venues    anthropic:batch 1,000
tokens    12,410,332 in · 3,104,551 out
list      $27.93
paid      $14.02
captured  $13.91 (49.8%)
prices    snapshot 2026-08 — override via offpeak.prices
───────────────────────────────────────────────

What it does

  • One argument, not a workflow. run(jobs, deadline=...) handles batching, submission, polling, collection, and result matching across providers.
  • Deadlines are guarded, not hoped for. If a batch hasn't landed by the time the remaining window shrinks to a risk buffer, offpeak cancels and re-runs the stragglers synchronously at list price. You state the deadline; it gets met.
  • Every run settles a receipt. List cost, paid cost, captured spread — arithmetic against public price sheets, not estimates.
  • Your keys, your perimeter. offpeak talks directly to the providers with your own API keys. There is no proxy and no third party in the data path.
  • Zero-dependency core. Provider SDKs load only via extras.

Install

pip install "offpeak[all]"        # OpenAI + Anthropic venues
pip install "offpeak[anthropic]"  # or one provider
pip install "offpeak[openai]"

Venues use the standard environment variables (OPENAI_API_KEY, ANTHROPIC_API_KEY), or pass a configured client: OpenAIBatch(client=my_client).

Deadlines

Deadlines are how software says "this can wait" — the full semantics live in SPEC.md.

Form Meaning
"06:00" the next 6am, local time (the canonical overnight form)
"4h", "90m", "2d" relative to now
"2026-08-21T06:00:00-07:00" ISO 8601, absolute
datetime / timedelta / seconds native Python forms

How a run works

  1. Jobs are grouped by venue (claude-* → Anthropic Message Batches, gpt-*/o* → OpenAI Batch) and submitted at the batch tier — 50% of list.
  2. offpeak polls the venues, backing off while the window is long.
  3. When remaining time reaches the risk buffer (default: 15% of the window, clamped to 1–10 minutes), unfinished jobs are cancelled and re-run synchronously so the deadline holds. Set fallback="none" to report them instead.
  4. Results come back in input order, each with a per-job Receipt; offpeak.receipt(results) settles the run.
results = offpeak.run(
    jobs,
    deadline="06:00",
    fallback="sync",       # meet the deadline at list price if the batch is at risk
    risk_buffer=600,       # seconds held in reserve (optional)
)

Receipts and prices

Receipts are computed against a bundled snapshot of public list prices (batch = 50% of list, as published). Providers change prices — verify and override at runtime:

import offpeak

offpeak.prices.register_price("my-fine-tune", input_per_m=4.0, output_per_m=16.0)

Unknown models settle with cost = None rather than a guess.

What this is (and the roadmap)

offpeak is the open client and spec for a simple claim: intelligence has a time value. A large share of AI work — embeddings, evals, backfills, report generation, overnight agents — has no human waiting on it, and the venues already price that patience at −50%. This library is the missing workflow.

The roadmap follows the same interface upward: more venues (Google batch, spot capacity, off-peak windows on your own GPUs), queue-latency forecasting instead of a fixed risk buffer, portfolio placement across venues, energy- and carbon-aware scheduling with per-job receipts. The venue interface (offpeak.Venue) is deliberately the extension point — a venue is anywhere deferred work can run.

A hosted desk that does the forecasting, cross-venue portfolio scheduling, and SLA insurance at fleet scale — payloads never leaving your perimeter — is being built by the same team. The SDK and the deadline spec stay open, Apache-2.0.

Contributing

Issues and PRs welcome — see CONTRIBUTING.md. Spec changes start as issues against SPEC.md.

License

Apache-2.0 © Offpeak

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

offpeak-0.1.0.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

offpeak-0.1.0-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file offpeak-0.1.0.tar.gz.

File metadata

  • Download URL: offpeak-0.1.0.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for offpeak-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cee8da38b051ea953f2ec5853fe42b3d2ce0ae7960df82d8b4e86796744c7743
MD5 71a1983656eb8ae4e47ae564f0f9978d
BLAKE2b-256 87bca2f1e85195bb71397cda0cd4198dc1f09e44cc1de6c8e7671bd56b14730e

See more details on using hashes here.

Provenance

The following attestation bundles were made for offpeak-0.1.0.tar.gz:

Publisher: publish.yml on offpeak-ai/offpeak

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file offpeak-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: offpeak-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for offpeak-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6eb04296f03c78e38040e9b5a38cc9dcbec3a38ac4bfc8cf9b1c619c68339c5d
MD5 1724203084bbd39fe07a9d52d2f91345
BLAKE2b-256 d850a1ac14c3dffede091d6f059f6b734ef6350332b65fa9c62575d45ad1cb53

See more details on using hashes here.

Provenance

The following attestation bundles were made for offpeak-0.1.0-py3-none-any.whl:

Publisher: publish.yml on offpeak-ai/offpeak

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.2.1

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page