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.
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-rightfragment - 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 main → pytest + ruff check + mypy → pull request.
License
MIT — Copyright (c) 2026 Mateusz Muślewski.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e745feb10abd53d6c7a0e1c9a3411b433eab7f4ec46b618ad2434f3ebd41da2
|
|
| MD5 |
54021113c04c158a37c836339c601d48
|
|
| BLAKE2b-256 |
edafe01b4bd6c05e86ed61ae2f8f2942e1d77c76bcbd0445c080e706e0c1b29e
|
Provenance
The following attestation bundles were made for token_oracle-0.1.1.tar.gz:
Publisher:
publish.yml on muslewski/token-oracle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
token_oracle-0.1.1.tar.gz -
Subject digest:
3e745feb10abd53d6c7a0e1c9a3411b433eab7f4ec46b618ad2434f3ebd41da2 - Sigstore transparency entry: 2022165744
- Sigstore integration time:
-
Permalink:
muslewski/token-oracle@e57f901254c37130ac62d8904836430df56d930f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/muslewski
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e57f901254c37130ac62d8904836430df56d930f -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c855f9810c1e15fa78b10bd8721ea8bd3a8c0ee6f79cb9de55b0b0ca9d2d18e
|
|
| MD5 |
104ca65cecb95ab298569499a533682e
|
|
| BLAKE2b-256 |
9ced5109bcf632e336ef1d788bcae47ca6fcec742fb63531efc34cc6e1c96a11
|
Provenance
The following attestation bundles were made for token_oracle-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on muslewski/token-oracle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
token_oracle-0.1.1-py3-none-any.whl -
Subject digest:
5c855f9810c1e15fa78b10bd8721ea8bd3a8c0ee6f79cb9de55b0b0ca9d2d18e - Sigstore transparency entry: 2022165845
- Sigstore integration time:
-
Permalink:
muslewski/token-oracle@e57f901254c37130ac62d8904836430df56d930f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/muslewski
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e57f901254c37130ac62d8904836430df56d930f -
Trigger Event:
workflow_dispatch
-
Statement type: