GitHub - wartzar-bee/tokenscope: See what your AI-coding session actually cost — and what is eating your context. Local, read-only CLI for Claude Code. · GitHub
/" data-turbo-transient="true" />
Skip to content
Search or jump to...
Search code, repositories, users, issues, pull requests...
-->
Search
Clear
Search syntax tips
Provide feedback
--><br>We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
Saved searches
Use saved searches to filter your results more quickly
-->
Name
Query
To see all available qualifiers, see our documentation.
Cancel
Create saved search
Sign in
/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
wartzar-bee
tokenscope
Public
Notifications<br>You must be signed in to change notification settings
Fork
Star
main
BranchesTags
Go to file
CodeOpen more actions menu
Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit
History<br>1 Commit<br>1 Commit
bin
bin
src
src
test
test
.gitignore
.gitignore
README.md
README.md
launch.md
launch.md
package.json
package.json
View all files
Repository files navigation
tokenscope ⏣
See what your AI-coding session actually cost — and what's eating your context.<br>A local, read-only CLI that parses your Claude Code session logs and shows where the money goes: model output vs. context being re-sent every turn (the hidden 60%+ of most bills).
$ npx tokenscope
tokenscope ⏣ latest session<br>──────────────────────────────────────────────────────<br>Total cost $868.84 over 967 model turns
Where the money went<br>output (model writing) ████░░░░░░░░░░░░░░░░░░░░ 16% $137.24<br>cache read (re-sent ctx) ████████████████░░░░░░░░ 66% $577.59<br>cache write (new ctx) ████░░░░░░░░░░░░░░░░░░░░ 18% $153.67
Context size per turn (peak 822k · avg 404k · now 822k tokens)<br>▁▁▁▁▁▂▂▂▂▂▂▂▃▃▃▃▃▃▃▄▄▄▄▄▅▅▅▅▅▆▆▆▆▇▇▇▇▇▇█
Insights<br>• Re-sent (cached) context cost $577.59 (66% of spend) — context re-read every turn.<br>• Peak context ~822k tokens — /compact or a fresh session would cut per-turn cost.<br>• Only 16% of spend is the model's actual output.
(A real session, default Opus pricing. Your numbers will differ — prices are overridable.)
Why
Agentic coding (Claude Code, etc.) produces surprise bills, and the cause is mundane: as a session grows, the whole context is re-sent every turn , so cost balloons even when the model writes little. Existing dashboards show totals; tokenscope shows the attribution — output vs. cache-read vs. cache-write vs. fresh input, the per-turn context-growth curve, cost by model, subagent spend, and which tools fill your context — with concrete "trim this" insights.
Install / run
# a specific session .jsonl<br>npx tokenscope --json # machine-readable">npx tokenscope # your most recent Claude Code session<br>npx tokenscope --all # aggregate every session<br>npx tokenscope # a specific session .jsonl<br>npx tokenscope --json # machine-readable
Reads ~/.claude/projects/**/*.jsonl. Read-only, local, no network, no telemetry — open the source; nothing leaves your machine.
Pricing
Uses documented default prices (Anthropic cache multipliers: write 1.25×/2×, read 0.1× of input). Verify and override for your exact model/tier via ./.tokenscope.json:
{ "pricing": { "claude-opus-4": { "in": 15, "out": 75 } } }
Unknown models are flagged (never silently counted as $0). Token counts are read straight from the logs; cost = those counts × the prices shown.
Status / roadmap
v0.1: Claude Code session cost + context attribution + insights. 20/20 unit tests on the cost math (npm test).
Next (evidence-driven): per-tool/-file token attribution; daily/budget alerts; a --watch live meter; OpenAI/Codex log support.
MIT. Not affiliated with Anthropic.
About
See what your AI-coding session actually cost — and what is eating your context. Local, read-only CLI for Claude Code.
Topics
cli
developer-tools
claude
cost-analysis
anthropic
token-usage
llm-cost
claude-code
agentic-coding
ai-cost
Resources
Readme
Uh oh!
There was an error while loading. Please reload this page.
Activity
Stars
stars
Watchers
watching
Forks
forks
Report repository
Releases
tokenscope v0.1.0
Latest
May 28, 2026
Packages
Uh oh!
There was an error while loading. Please reload this page.
Contributors
Uh oh!
There was an error while loading. Please reload this page.
Languages
JavaScript<br>100.0%
You can’t perform that action at this time.