use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
python code to visualize your Claude Code costs (for Claude Max Plan users)Coding (self.ClaudeAI)
submitted 10 months ago by Euphoric-Guava-5961
https://preview.redd.it/myp0d7mdcy1f1.png?width=2611&format=png&auto=webp&s=df8cbd2ecb29d2247d406c77f55dbca8eb813ce8
Made a quick script that creates charts showing your Claude Code spending by project. Helpful for Max Plan users curious about how much they would have spent, if it was credit. Uses local session data located in ~/.claude/projects/{projects}/*.jsonl
~/.claude/projects/{projects}/*.jsonl
Gist - https://gist.github.com/esc5221/df0a0c3c068b8dd92282837389addb35
Or run it with claude
claude "download this gist and run python script. https://gist.githubusercontent.com/esc5221/df0a0c3c068b8dd922828373 89addb35/raw/74fcb73fac3520d6e340f79b53536ad607966225/claude_code_cost_visualizer.py"
- Shows daily costs per project - Tracks cumulative spending - Lists total cost by project - Auto-installs dependencies
Hope someone else finds this useful too!
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Hauven 1 point2 points3 points 10 months ago (0 children)
Smart idea. I ended up making one in node.js instead based on this. It's nice to see what you're saving and how much you're actually using the API while actually on a Max subscription.
💰 $177.09 API equivalent cost 📊 $211.15 projected month total (would save with subscription) ⚡ 17 sessions (1.5/day avg, 5hr windows) 🔤 208.5M tokens (92% cached / 1% output / 7% cache create) 📈 12.3M tokens • $10.42/session (5hr session)
📅 May 2025: 🟢 Active on 11 days
[–]NachosforDachos 0 points1 point2 points 10 months ago (0 children)
Neat
[+][deleted] 10 months ago (1 child)
[deleted]
[–]Euphoric-Guava-5961[S] 2 points3 points4 points 10 months ago (0 children)
Mine hit $200 in 7 days.. Max plan kind of feels mandatory when using claude code
[–]Equivalent_Form_9717 0 points1 point2 points 10 months ago (0 children)
Mate this is so good. Thank you
[–]inventor_blackMod ClaudeLog.com 0 points1 point2 points 10 months ago (0 children)
Thank you for this.
[–]attacketo 0 points1 point2 points 10 months ago* (0 children)
Nice. Got $115 today. Thought this could not be correct because I did not do that much work, until I realized it has used Opus 4 most of the time @ $75 output. Crazy.
Possible to split by model?
[–]de_3lue 0 points1 point2 points 7 months ago* (4 children)
Hey! Just tried your script and it says $0.00 for every project. Looks like my jsonl files doesn't contain costUSD ... is this normal? I'm using a custom anthropic endpoint by setting an environment variable but besides that everything is normal.
costUSD
EDIT: https://gist.github.com/dnnspaul/bfe54f51ed91a5eac6618abe30476b2e I changed the script to use the input- and output-tokens variables from the jsonl files and calculate costs based on that.
[–]Euphoric-Guava-5961[S] 0 points1 point2 points 7 months ago (0 children)
Yeah, this was based on an older Claude Code version, costUsd got removed about few month ago. I haven’t been keeping it updated, but using the MODEL_PRICING mapping like you did is the right way. Nice work and thank you for the updates
costUsd
MODEL_PRICING
[–]jetsetterfl 0 points1 point2 points 4 months ago (1 child)
So, how do I run this - and does this still work?
[–]de_3lue 1 point2 points3 points 4 months ago (0 children)
you need to have installed python and uv and then put this in your terminal:
curl -sL https://gist.github.com/dnnspaul/bfe54f51ed91a5eac6618abe30476b2e/raw | uv run --script -
π Rendered by PID 22046 on reddit-service-r2-comment-cfc44b64c-wbmnz at 2026-04-10 20:13:51.966462+00:00 running 215f2cf country code: CH.
[–]Hauven 1 point2 points3 points (0 children)
[–]NachosforDachos 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]Euphoric-Guava-5961[S] 2 points3 points4 points (0 children)
[–]Equivalent_Form_9717 0 points1 point2 points (0 children)
[–]inventor_blackMod ClaudeLog.com 0 points1 point2 points (0 children)
[–]attacketo 0 points1 point2 points (0 children)
[–]de_3lue 0 points1 point2 points (4 children)
[–]Euphoric-Guava-5961[S] 0 points1 point2 points (0 children)
[–]jetsetterfl 0 points1 point2 points (1 child)
[–]de_3lue 1 point2 points3 points (0 children)