Skip to main content

token-oracle — know when you'll hit the limit

PyPI version CI Python versions MIT license

oracle dash demo

Live dashboard — staged multi-subscription forecast for Claude Code and Grok, with time left before each cap. No API keys; reads local logs, optionally verifies against the sites.

Live usage in your status bar

Wire it once:

oracle statusline --install

Claude Code (and tmux) then shows a live headline such as:

◔ 5h 26% · wk 60% · $8 today

(The 5h/wk numbers come from the rate-limit header self-ingest; cost uses local ledger.)


Install

Run it instantly — no install, using a runner you probably already have:

npx token-oracle dash         # Node
bunx token-oracle dash        # Bun
uvx token-oracle dash         # uv

Or install the token-oracle command onto your PATH:

curl -fsSL https://raw.githubusercontent.com/muslewski/token-oracle/main/install.sh | sh
uv tool install token-oracle   # uv (isolated, fast)
pipx install token-oracle      # pipx (isolated)
pip install token-oracle       # pip

npx/bunx/uvx fetch and run the latest release on demand; the installers put it on your PATH. All routes are the same offline-first tool — see SETUP.md for live web data and configuration.

Quickstart

token-oracle init         # guided setup (or --preset max20 for non-interactive)
token-oracle forecast     # live forecast — time left before your cap
token-oracle report       # what you spent, day by day (tokens + cost + % of weekly cap)
token-oracle dash         # full-screen TUI — Past ledger / Present live / Future prophecy
token-oracle doctor       # check configuration + data sources

oracle forecast demo

▶ demo

oracle doctor demo

Config can live globally (~/.config/token-oracle/config.json) or per-project (.token-oracle.json walking up from the cwd). Run token-oracle --help for all subcommands.

How it works

token-oracle reads your agent'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. Ships with pro/max5/max20 plan presets and an offline USD pricing snapshot for cost estimates, both user-overridable via plan, cost_mode, and pricing config keys.

Supported sources (first-class agent harnesses):

Source source value Log location
Claude Code claude_code ~/.claude/projects/*/*.jsonl
Grok Build grok ~/.grok/sessions/*/*/updates.jsonl + signals.json (contextTokensUsed for live)
Generic (file) generic JSON file of [timestamp, tokens] pairs via source_opts.events_path

Multi-subscription: put "profiles": {"claude": {...}, "grok": {...}} in config.json to track both Claude Code (Max20 etc) and Grok/SuperGrok Heavy simultaneously. oracle dash shows side-by-side with reset alarms.

Future tab (in oracle dash): per-window prophecy lines, observational cap ETA warnings, and a next-24h expected-burn sparkline from the hour-of-week profile — the projection math rendered, not just a single %.

Parts & options

All subcommands accept --config FILE. Without it, resolution is $TOKEN_ORACLE_CONFIG.token-oracle.json (cwd walk-up) → XDG global.

Subcommand Extra flags Description
init --preset, --force Starter config (TTY wizard if no flags; non-clobbering)
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
report --days, --by, --json, --since/--until Daily (or week/model) token + cost ledger
dash Full-screen TUI: Past ledger, Present live, Future prophecy + 24h sparkline
clean --yes Remove config, cache, and snapshot files

Grok Build users: {"source": "grok"} (or with source_opts.sessions_dir) in config; then oracle tmux / statusline / forecast surface usage. Hooks in ~/.grok/hooks/ can drive oracle snapshot.

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

CLI reference

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

token-oracle init       [--config FILE] [--preset NAME] [--force]
token-oracle forecast   [--config FILE] [--json]
token-oracle report     [--config FILE] [--days N] [--by day|week|model] [--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]
token-oracle clean      [--config FILE] [--yes]

Adapters

Output adapters let token-oracle feed your status bar or terminal multiplexer (works for Grok, Claude, etc.):

  • tmux — writes a tmux-formatted status-right fragment (e.g. set -g status-right '#(oracle tmux)')
  • statusline — writes a plain-text/ANSI fragment for any status line

See ADAPTERS.md for setup and configuration. Grok users in tmux get token status in bottom bar directly.

Colors

The forecast bar uses colour thresholds on projected usage at window end (as a % of cap) to signal urgency:

Colour Projected % of cap
🟢 Green < 85 %
🟡 Lime 85 – 100 %
🟠 Orange 100 – 120 %
🔴 Red ≥ 120 %

Works with agentic-sage

agentic-sage is a companion JS tool. Division of labor: oracle owns tokens, cost, and forecasts; sage owns sessions, fleet coordination, and guidance. Point sage at oracle's snapshot:

{
  "tokenForecastPath": "~/.local/share/token-oracle/forecast.json"
}

oracle doctor detects sage and prints the exact link hint (or flags a stale snapshot). Enable "snapshot_writethrough": true so forecast/statusline/tmux keep the file fresh automatically.

Contributing

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

License

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

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.2.tar.gz (5.0 MB 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.2-py3-none-any.whl (139.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: token_oracle-0.1.2.tar.gz
  • Upload date:
  • Size: 5.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for token_oracle-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3f6c440e0935ef19947faa64d13f761c541ec7e60379532c922c8a4aa58db3a2
MD5 ae4cbaa26d32b794e1cfeb6b50f43f2a
BLAKE2b-256 52a01a3d31fc9cf68a74ce4cdbdeb672492a7043bbaa2500f7d5c0a14ee88543

See more details on using hashes here.

Provenance

The following attestation bundles were made for token_oracle-0.1.2.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.2-py3-none-any.whl.

File metadata

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

File hashes

Hashes for token_oracle-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2e095d82a7ea50a908b4e1d664357a922efd64dcd22cbdf23a22b899c96c254a
MD5 5f4ca7917e4d8ae1d472549db7a1157a
BLAKE2b-256 bf2b2d3a6f1ea1589ec6b009ce0dc90dee2f87208c41553f556afe0bd7fccc56

See more details on using hashes here.

Provenance

The following attestation bundles were made for token_oracle-0.1.2-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.

Release history Release notifications | RSS feed

0.1.3

2 files

This release

0.1.2 This release

2 files

0.1.1

2 files

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