DEV Community

Cover image for Optimizing your Claude Code usage (and spending less $$)
Anil Murty
Anil Murty

Posted on

Optimizing your Claude Code usage (and spending less $$)

This post from Anthropic is causing a lot of angst among its most ardent users. While it is disguised as a credit, it really is them tightening API token limits (aka charging more money). The reality is that this is going to become the norm across all model providers soon. Why? because all the labs have been deeply subsidizing tokens in a frenxy to attract the most number of users their platforms. They are doing this because more users leads to better models (more data to train on), drives mindshare and usage which drives up valuations.

Most Claude Code users I've talked to don't know how their tokens are being spent. Which project, which model, which sessions, what the monthly run rate is, when their credit pool runs out. Heck, I'll admit this was me until I started to work on tokenjam.dev

Here's the funny part: Claude Code already writes a JSONL log for every session to a folder on your laptop. Every API call, every tool result, every token count. The data you'd want to look at is sitting right there.

So we shipped a feature in TokenJam that reads and analyzes it.
it's called "tj optimize" see https://tokenjam.dev/claude-code

tj optimize does three things:

  1. Backfills up to 30 days of your existing Claude Code session logs into a local DuckDB.

  2. Flags sessions that match the structural shape of a smaller model's workload — short inputs, short outputs, few tool calls — and shows projected savings if you switched.

  3. Projects your monthly spend against a budget you set, per provider, and tells you when you'll run out.

Three commands:
pip install "tokenjam[mcp]"
tj onboard --claude-code
tj optimize

Would love your feedback! If you find it useful, please check out the repo and give us a star: https://github.com/metabuilder-labs/tokenjam

Top comments (0)