Local Claude Code token activity graphs with explicit source accuracy
Project description
Claude Usage TUI
An independent, local-only terminal viewer for Claude Code token activity. It draws daily, weekly, and cumulative graphs and always reports how much of the calendar is backed by exact turns versus historical aggregate allocation.
Install
With uv:
uv tool install claude-usage-tui
Or with pipx:
pipx install claude-usage-tui
For development, install from a checkout:
uv tool install .
The runtime uses only the Python standard library and sends no data anywhere.
Use
# Open the interactive daily graph
claude-usage
# Open a particular view
claude-usage weekly
claude-usage cumulative
# Compatibility with the earlier prototype
claude-usage usage daily
# Show exactly how much is observed and reconstructed
claude-usage audit
# Refresh only the local JSONL index
claude-usage scan
Inside the TUI, use the arrow keys or d, w, and c to change views. Press
q to exit. Add --once --no-color for a non-interactive plain-text render.
Where the numbers come from
The tool never queries Anthropic and does not scrape CodexBar. It reads files already maintained on your machine:
| Source | Owner | Used for | Accuracy |
|---|---|---|---|
~/.claude/projects/**/*.jsonl |
Claude Code | Per-turn timestamp, model, input/output and cache tokens | Exact for records that still exist when indexed |
~/.claude/usage-tui.db |
This tool | Incremental, durable index of the exact JSONL fields above | Exact copy of parsed token records |
~/.claude/stats-cache.json |
Claude Code | Retained model totals and per-day direct-token activity | Real local aggregate; may outlive original transcripts |
The index deliberately retains already parsed turns if Claude Code later removes their JSONL file. It contains token metadata only, not prompts, responses, filenames from source code, or transcript content.
Exact versus reconstructed
For each model, the tool first sums exact indexed turns. If Claude's local
modelUsage total is larger, the difference is known to exist but its original
cache-token timestamps are no longer available. The tool distributes only that
difference across Claude's retained dailyModelTokens activity dates.
Consequently:
Lifetimereconciles to the newest available local per-model total.- Exact JSONL dates keep their exact token counts.
- Historical daily, weekly, peak, and streak values are approximate wherever
an aggregate-only difference exists; the TUI marks these with
≈. claude-usage auditprints exact and allocated totals globally and per model.- Missing dates cannot be invented. If neither JSONL nor
stats-cache.jsoncovers a period, the tool has no evidence for that period.
This is token activity, including cache reads and cache creation. It is not the percentage of a Claude subscription quota, an Anthropic invoice, or a server-authoritative account history. Subscription windows and dynamic limits are not present in these local history files.
Privacy and storage
- All parsing and rendering happens locally.
- There are no runtime dependencies, telemetry, network requests, or API keys.
- The database defaults to
~/.claude/usage-tui.dband can be overridden withCLAUDE_USAGE_TUI_DBor--db. CLAUDE_STATS_CACHEcan point at a different stats cache.- Use
--projects-dir PATHto scan one non-default transcript directory.
Project scope and provenance
This is a focused implementation containing only:
- a minimal incremental JSONL collector;
- source reconciliation and accuracy reporting;
- the terminal renderer and command dispatcher;
- tests and packaging.
It does not include the browser dashboard, pricing model, Docker setup, VS Code
extension, or general session analytics from
phuryn/claude-usage. That project
informed the early prototype and is credited, with its MIT notice, in
THIRD_PARTY_NOTICES.md. The visual presentation is
inspired by the Codex token activity interface; no Codex source or assets are
included.
Development
python3 -m unittest discover -s tests -v
python3 -m py_compile cli.py collector.py usage_tui.py
Releases use PyPI Trusted Publishing: a signed vX.Y.Z tag must exactly match
collector.VERSION. GitHub Actions tests and builds the distributions, uploads
them to PyPI through short-lived OIDC credentials, and then creates the GitHub
Release. See RELEASING.md.
License
MIT © 2026 Ivan Oparin. See LICENSE and
THIRD_PARTY_NOTICES.md.
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 claude_usage_tui-0.1.0.tar.gz.
File metadata
- Download URL: claude_usage_tui-0.1.0.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5692406db5effbdfcd7254faef3207980df53a4ceb4a5638758217fa77acd1e
|
|
| MD5 |
e978ab164bf3945dadc65fa845ea0398
|
|
| BLAKE2b-256 |
43247df156bf208a0245b606f1d8bed3a4bf10e15245f73c10fe384dd984d8b7
|
Provenance
The following attestation bundles were made for claude_usage_tui-0.1.0.tar.gz:
Publisher:
publish.yml on ivanopcode/claude-usage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_usage_tui-0.1.0.tar.gz -
Subject digest:
b5692406db5effbdfcd7254faef3207980df53a4ceb4a5638758217fa77acd1e - Sigstore transparency entry: 2165427428
- Sigstore integration time:
-
Permalink:
ivanopcode/claude-usage@ce24f40cd15a346c96ff9ff8c92559dc00beb066 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ivanopcode
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ce24f40cd15a346c96ff9ff8c92559dc00beb066 -
Trigger Event:
push
-
Statement type:
File details
Details for the file claude_usage_tui-0.1.0-py3-none-any.whl.
File metadata
- Download URL: claude_usage_tui-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.9 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 |
3aca8c4c270361b2cbdf8803133c367abcb7ce72992441d4d8b8baa1a3d87d99
|
|
| MD5 |
df72a7bac625396ede82e3e7f6f91cce
|
|
| BLAKE2b-256 |
9719b8002106bc81a4335c5552eeb42f4815f0312ef2547a124f9a750d06f9d0
|
Provenance
The following attestation bundles were made for claude_usage_tui-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on ivanopcode/claude-usage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_usage_tui-0.1.0-py3-none-any.whl -
Subject digest:
3aca8c4c270361b2cbdf8803133c367abcb7ce72992441d4d8b8baa1a3d87d99 - Sigstore transparency entry: 2165427433
- Sigstore integration time:
-
Permalink:
ivanopcode/claude-usage@ce24f40cd15a346c96ff9ff8c92559dc00beb066 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ivanopcode
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ce24f40cd15a346c96ff9ff8c92559dc00beb066 -
Trigger Event:
push
-
Statement type: