token-finops-cli
A small, read-only CLI to keep an eye on your GitHub Copilot CLI token usage and estimate a "runway" — how many days your monthly AI-unit budget will last at your current burn rate.
It reads directly from the Copilot CLI's own local telemetry database
(~/.copilot/session-store.db, table assistant_usage_events) — no
external API calls, no scraping, nothing leaves your machine. The database
is opened in immutable/read-only mode so it can never interfere with a
live Copilot CLI session.
Why
GitHub's Copilot usage-metrics REST API is enterprise-admin-only (requires
manage_billing:copilot / read:enterprise scopes) — there's no
individual-seat endpoint to query your own quota. This tool works around
that by reading the CLI's own local usage log and letting you supply your
own monthly budget number (from the Copilot billing page) so it can project
a runway estimate.
Install
With uv (recommended):
uv tool install token-finops-cli
token-finops --since 7d
Or from source, editable, in a venv:
uv venv
uv pip install -e ".[dev]"
.venv/bin/token-finops --since 7d
Or plain pip:
pip install token-finops-cli
Usage
token-finops # full report, last 7 days
token-finops --since 30d # last 30 days
token-finops --since all # all-time
token-finops --session <id> # filter to one session
# Budget / runway
token-finops --budget 50000 --cycle-day 1
token-finops --compact # 2-line minimal output
token-finops --watch 5 # live-refreshing view every 5s
Try it without your own data (synthetic demo)
A small script generates a throwaway SQLite DB with fake usage events (same
columns the tool reads, nothing from your real ~/.copilot/session-store.db
is ever touched):
python3 examples/generate_synthetic_db.py /tmp/demo.db --days 20
token-finops --db-path /tmp/demo.db --since 7d
token-finops --db-path /tmp/demo.db --compact
Or point the tool at any DB via the TOKEN_FINOPS_DB env var instead of
--db-path.
Options
| Flag | Description |
|---|---|
--since {1d,7d,30d,all} |
Time window for the usage summary |
--session ID |
Filter to a single session |
--budget N |
Monthly AI-unit budget (default 50000) — get this from your Copilot billing page |
--cycle-day N |
Day of month your billing cycle resets on (default 1) |
--watch SECONDS |
Live-refreshing view, redraws every N seconds |
--compact / -c |
2-line minimal output (budget bar + runway status) |
--verbose / -vv |
Full report (overrides --compact) |
What it measures
The "AI unit" is GitHub's own cost/usage unit for a mixed
included-quota + pay-per-use Copilot plan, taken from the
total_nano_aiu column (divided by 1e9) — this matches what's shown on
the Copilot billing page. It is not raw token counts.
Requirements
- Python 3 (standard library only — no dependencies)
- GitHub Copilot CLI installed and used at least once (so
~/.copilot/session-store.dbexists)
Optional: use as a Copilot CLI skill
You can drop a SKILL.md into ~/.copilot/skills/token-finops-cli/ so any
Copilot CLI session can answer "what's my usage/runway?" on demand by
invoking this script. See the CLI's skills documentation for the expected
format.
Roadmap
- Support reading local usage/session logs from other coding agents (e.g. Claude Code), so this becomes a general "agentic coding tool finops" CLI rather than Copilot-only.
License
AGPL-3.0 — see LICENSE.
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_finops_cli-0.1.0.tar.gz.
File metadata
- Download URL: token_finops_cli-0.1.0.tar.gz
- Upload date:
- Size: 20.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b522cf411cd2363a056302eff486e888cb672a8779fa8b425747ac46ec9dbdb
|
|
| MD5 |
d6a7120b99b2ea2ff186a46dec17ae0f
|
|
| BLAKE2b-256 |
1ee775e5e44d69b603a13ef0949b775cf206d48ed3440cd66b34f06083964baf
|
Provenance
The following attestation bundles were made for token_finops_cli-0.1.0.tar.gz:
Publisher:
release.yml on oh-my-agent-code/token-finops-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
token_finops_cli-0.1.0.tar.gz -
Subject digest:
1b522cf411cd2363a056302eff486e888cb672a8779fa8b425747ac46ec9dbdb - Sigstore transparency entry: 2340415560
- Sigstore integration time:
-
Permalink:
oh-my-agent-code/token-finops-cli@15e039b5085bb51adfac6a260ac0336fd666d166 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/oh-my-agent-code
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@15e039b5085bb51adfac6a260ac0336fd666d166 -
Trigger Event:
push
-
Statement type:
File details
Details for the file token_finops_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: token_finops_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
215b5a3284c551d966c7a545b08a0e5582a1598bbdf7ac0421ff282a06133bb6
|
|
| MD5 |
f6989fe728d7f643a990e5edd70b5f35
|
|
| BLAKE2b-256 |
89a1da03f8d2b89a12162e6512c8a9acef70ca8127d37c73ce4f794f04529636
|
Provenance
The following attestation bundles were made for token_finops_cli-0.1.0-py3-none-any.whl:
Publisher:
release.yml on oh-my-agent-code/token-finops-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
token_finops_cli-0.1.0-py3-none-any.whl -
Subject digest:
215b5a3284c551d966c7a545b08a0e5582a1598bbdf7ac0421ff282a06133bb6 - Sigstore transparency entry: 2340415566
- Sigstore integration time:
-
Permalink:
oh-my-agent-code/token-finops-cli@15e039b5085bb51adfac6a260ac0336fd666d166 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/oh-my-agent-code
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@15e039b5085bb51adfac6a260ac0336fd666d166 -
Trigger Event:
push
-
Statement type: