Skip to main content

Observed-Rate Allowance & Cap-Limit Estimator — provider-agnostic token usage-cap forecaster

Project description

🔮 token-oracle

Provider-agnostic token usage-cap forecaster — know when you'll hit your limit before you hit it.

PyPI version CI Python versions MIT license


Install

pipx install token-oracle   # recommended — isolated environment
pip install token-oracle    # fallback
uvx token-oracle            # uv users

Quickstart

token-oracle forecast     # live forecast — time left before your cap
token-oracle dash         # full-screen TUI dashboard
token-oracle doctor       # check configuration + data sources

Run token-oracle --help to list all subcommands.

How it works

token-oracle reads your provider's local usage logs, computes an observed token-consumption rate over a configurable sliding window, and estimates how long you have before you exhaust your current allowance or hit your plan cap. No provider API calls — purely offline inference from log files already on your machine.

Supported sources:

Source Log location
Claude Code ~/.claude/projects/*/*.jsonl
Generic (stdin) pipe any JSON usage stream

Parts & options

All subcommands accept --config FILE (default: ~/.config/token-oracle/config.toml).

Subcommand Extra flags Description
forecast --json Print forecast (default: statusline format)
snapshot --out FILE Write snapshot JSON to a file, print the path
statusline Emit plain-text/ANSI statusline fragment
tmux Emit tmux status-right fragment
doctor Check configuration and data sources
dash Launch full-screen TUI dashboard

Full reference: token-oracle <subcommand> --help

CLI reference

token-oracle {forecast,snapshot,statusline,tmux,doctor,dash} [OPTIONS]

token-oracle forecast   [--config FILE] [--json]
token-oracle snapshot   [--config FILE] [--out FILE]
token-oracle statusline [--config FILE]
token-oracle tmux       [--config FILE]
token-oracle doctor     [--config FILE]
token-oracle dash       [--config FILE]

Adapters

Output adapters let token-oracle feed your status bar or terminal multiplexer:

  • tmux — writes a tmux-formatted status-right fragment
  • statusline — writes a plain-text/ANSI fragment for any status line

See ADAPTERS.md for setup and configuration.

Colors

The forecast bar uses colour thresholds to signal urgency:

Colour Meaning
🟢 Green > 40 % remaining
🟡 Yellow 15 – 40 % remaining
🔴 Red < 15 % remaining

Works with agentic-sage

agentic-sage is a companion JS tool for managing Claude Code skill definitions. token-oracle is provider-agnostic and complements it by surfacing usage-cap forecasts independently of any AI framework.

Contributing

See CONTRIBUTING.md. In brief: fork → branch from mainpytest + ruff check + mypy → pull request.

License

MIT — Copyright (c) 2026 Mateusz Muślewski.

Project details


Download files

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

Source Distribution

token_oracle-0.1.1.tar.gz (29.6 kB view details)

Uploaded Source

Built Distribution

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

token_oracle-0.1.1-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file token_oracle-0.1.1.tar.gz.

File metadata

  • Download URL: token_oracle-0.1.1.tar.gz
  • Upload date:
  • Size: 29.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for token_oracle-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3e745feb10abd53d6c7a0e1c9a3411b433eab7f4ec46b618ad2434f3ebd41da2
MD5 54021113c04c158a37c836339c601d48
BLAKE2b-256 edafe01b4bd6c05e86ed61ae2f8f2942e1d77c76bcbd0445c080e706e0c1b29e

See more details on using hashes here.

Provenance

The following attestation bundles were made for token_oracle-0.1.1.tar.gz:

Publisher: publish.yml on muslewski/token-oracle

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

File details

Details for the file token_oracle-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: token_oracle-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for token_oracle-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5c855f9810c1e15fa78b10bd8721ea8bd3a8c0ee6f79cb9de55b0b0ca9d2d18e
MD5 104ca65cecb95ab298569499a533682e
BLAKE2b-256 9ced5109bcf632e336ef1d788bcae47ca6fcec742fb63531efc34cc6e1c96a11

See more details on using hashes here.

Provenance

The following attestation bundles were made for token_oracle-0.1.1-py3-none-any.whl:

Publisher: publish.yml on muslewski/token-oracle

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

Supported by

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