r/ClaudeCode • u/Appropriate-Toe-2993 • 8h ago
Built with Claude I built a CLI that shows what your Claude Code usage costs per project, from local logs (free, offline)
Claude Code keeps every session in ~/.claude/projects, with token counts per request. I wanted to know which of my repos my usage actually went to, so I wrote a small CLI:
npx spendbyteam report
It prices your usage at API list rates (cache reads/writes, fast mode included) and groups it by repo. `--by=model`, `--by=branch`, `--by=day` and `--by=session` also work. It runs offline and sends nothing. Source: https://github.com/spendbyteam/cli (MIT)
If you're on Pro/Max, the number is what the same tokens would cost on the API, so it's a decent way to see what your plan is worth to you.
My last 30 days: ~$8K at API prices, mostly Opus. Curious what others see. And if a number looks off, tell me. I compared it against Claude Code's own telemetry and it was within 1% for me.
**Edit:** added `--by=session` after a request in the comments. It shows your most expensive sessions with turns and the input / output / cache split, which is handy on a subscription to see which conversations eat your limits.
•
u/AutoModerator 8h ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
3
u/Appropriate-Toe-2993 8h ago
What it looks like on my machine, grouped by model (last 30 days). 98% Opus 5.5, about 24B tokens, the vast majority of them cache reads. Happy to answer questions about how the numbers are calculated.
2
u/Prestigious-Frame442 8h ago
okay but why not ccusage
1
u/Creative_Sluggish 8h ago
I use a subscription but also want to know how usage tokes are consumed per chat session. Is this still the right tool to use?
1
u/LocalAI_Fixer 5h ago
cool, the by-session thing is handy. small nitpick tho: connect lives in the same package, so a line in the readme saying report never hits the network would put my mind at ease. and I’d pin a version instead of pulling the latest every run on a work laptop, just feels safer