How I Track AI Token Spend Across Claude Code, Cursor, and Codex

CameronCat Intermediate 3h ago 142 views 1 likes 2 min read

I kept asking myself the same question after every coding sprint: how much did I actually spend today? Between Claude Code, Cursor, Codex, and the occasional Antigravity session, the bills stacked up fast — but I had zero visibility into which tool, which model, or which day was burning through my budget.

So I built TokenMaxxer — a lightweight CLI that reads the local log files these tools already write on disk and rolls everything into one dashboard.

What it does

  • Scans log directories from 18 supported tools (Claude Code, Cursor, Codex, Antigravity, and more)
  • Aggregates usage by tool, model, provider, and day
  • Shows cost estimates based on your configured pricing
  • Builds a profile page with daily activity trends, top models, and top tools
  • Includes a global leaderboard for people who like a little friendly competition

Quick start

# Install via pip
pip install tokenmaxxer

# Or run directly with Python
python -m tokenmaxxer scan

# View your dashboard
python -m tokenmaxxer serve

By default it looks in standard log locations, but you can point it anywhere:

tokenmaxxer scan --paths ~/.claude/logs,~/cursor/logs,~/codex/logs

The dashboard spins up locally on localhost:8000 and updates in real time as new logs appear.

Real-world results

After running it for a week I discovered that Claude 3.5 Sonnet was eating roughly 60% of my daily token budget, almost entirely through Claude Code sessions. That kind of insight is impossible to get when each tool reports in its own isolated UI.

The leaderboard currently tops out at 45.8 billion tokens — if you're a heavy user, that's a fun benchmark to chase.

Config and customization

You can override model pricing per provider, which is handy when you're on a free tier or using a self-hosted endpoint:

{
  "providers": {
    "anthropic": {
      "claude-3-5-sonnet-20241022": {
        "prompt_price": 3.0,
        "completion_price": 15.0
      }
    }
  }
}

Gotchas

  • Some tools rotate logs aggressively, so I recommend running the scan daily via cron
  • Antigravity support is community-contributed and may lag behind official releases
  • Cost estimates are based on published pricing — internal rate cards or discounted tiers aren't reflected

Feedback welcome

I'm actively working on support for additional tools (OpenCode, Windsurf, and Amp are on the roadmap), plus a VS Code extension so you can see token spend without leaving your editor.

If you try it out, drop a line with bugs, feature requests, or leaderboard screenshots — I'd love to see how your usage compares.

AI ProgrammingAI Coding
Step-by-step guides and pitfalls for this path are in an AI side-hustle playbook, with plenty of directly applicable cases.

All Replies (4)

S
Sam46 Advanced 3h ago
Also, don't forget to factor in the emotional cost of watching your API credits drain while your code still doesn't work.
0 Reply
A
AlexTinkerer Advanced 3h ago
Haha, that emotional toll is real! I caught myself staring at the usage dashboard like it's a stock portfolio. Any clever hacks to make monitoring feel less like watching paint dry?
0 Reply
Z
Zoe12 Novice 3h ago
I built a similar spreadsheet but added a "regret multiplier" column for those 3am debugging sessions.
0 Reply
N
NovaGuru Advanced 3h ago
How are you handling rate limits when switching between providers mid-session?
0 Reply

Write a Reply

Markdown supported