DEV Community

Henry Godnick
Henry Godnick

Posted on

Stop Guessing Your LLM Costs: Track Every Token in Real Time

If you're building with LLMs in 2026, you already know the pain: API costs creep up silently. You fire off a dozen Claude or GPT calls during a coding session, and by end of month your bill is double what you expected.

The problem isn't that LLMs are expensive — it's that you can't see what you're spending in real time.

The Invisible Cost Problem

Most developers track LLM costs reactively. You check your OpenAI dashboard once a week, maybe glance at Anthropic's usage page. By then the damage is done. That experimental RAG pipeline you left running? It burned through $40 in tokens overnight.

What we actually need is what every other metered resource has: a live counter. Your phone shows battery percentage. Your car shows fuel. Why don't we have this for tokens?

My Setup: Menu Bar Token Tracking

I've been using TokenBar — a macOS menu bar app that shows real-time token counts and costs across providers. It sits right next to my clock, and I can glance at it the same way I check the time.

Here's what changed for me:

  • I stopped over-engineering prompts — seeing the token count live made me realize half my system prompts were bloated
  • I caught runaway scripts immediately — not 3 days later on a billing page
  • I actually started comparing models by cost-per-task, not just vibes

It's $5 lifetime, which is basically nothing compared to what it saves you in wasted API calls.

Practical Tips for Token Budgeting

  1. Set mental budgets per session. I aim for under $2/day for dev work.
  2. Use smaller models for iteration, big models for final passes.
  3. Cache aggressively. Same prompt twice = money wasted.
  4. Monitor in real time. You can't optimize what you can't see.

The Bigger Picture

As LLMs become infrastructure (not just toys), cost visibility becomes a DevOps concern. We lint our code, monitor our servers, profile our queries — token tracking should be in the same category.

If you're spending more than $50/month on LLM APIs and you're NOT tracking per-session costs, you're flying blind.


What's your setup for tracking LLM costs? Curious what other devs are doing here.

Top comments (0)