How It Works

MyTokenTracker gives you full visibility into your Claude Code usage — tokens, costs, and plan limits — with self-learning accuracy that improves every time you use it.

1

Install in 10 Seconds

Paste one line into Claude Code. It adds a hook that fires when sessions end. No scripts, no dependencies. Claude Code will ask you to confirm — that's normal.

2

Use Claude Normally

Every session is automatically tracked. Token counts, model used, project context, and duration — all captured silently.

3

Track Everything

Real-time dashboard with cost estimates, plan usage bars, model breakdowns, and self-learning accuracy.

Your Code Stays Private

We never see your conversations, prompts, or code. The hook only sends aggregate token counts and metadata — the same numbers you'd see on Claude's usage screen.

Token counts only — no prompts, no responses, no file contents
All data sent over HTTPS — your token is never exposed in URLs
Your API token is hashed — we can't read it even if we wanted to

Heads up: During install, Claude Code will show a security prompt asking you to confirm the hook. This is normal — Claude Code flags any hook that sends data externally, which is good security practice. Say yes to proceed. The hook only sends the metadata described above.

How Tokens & Rate Limits Work

Every Claude interaction consumes tokens — small chunks of text (~4 characters each). There are four types:

Input Tokens

New text sent to Claude — your prompts, file contents, context.

Output Tokens

What Claude writes back. 5x more expensive than input.

Cache Read Tokens

Context reused from a previous turn. 90% cheaper than input, but massive in volume.

Cache Write Tokens

New context being cached for the first time. 1.25x input price.

Rate limits are cost-weighted, not token-counted. Anthropic calculates your usage % as API-equivalent dollar spend divided by your plan's dollar budget. Cache reads are cheap per token but dominate total cost because of their extreme volume.

Plan Budgets & Windows

Your Claude plan has two budget windows. We track both and show your usage as a percentage — just like Claude's built-in usage screen.

Session Window

A rolling 5-hour window. Resets continuously as older usage ages out. This is the "Current session" bar in Claude.

Weekly Window

Resets on a fixed day/time (e.g., "Resets Thu 10:00 AM"). Configure this in Settings to match your account.

Plan Session Budget Weekly Budget
Free$5.00$10.00
Pro ($20/mo)$27.00$10.00
Max $5 ($100/mo)$135.00$50.00
Max $20 ($200/mo)$535.00$200.00
Team$27.00$10.00

Budgets are API-equivalent dollars — what you'd pay at Anthropic's per-token API pricing.

How We Estimate Cost

We calculate the API-equivalent cost of each session using Anthropic's published per-token pricing. This isn't what your subscription charges — it's the raw API cost that drives rate limit calculations.

Model Input Output Cache Read Cache Write
Opus$15.00$75.00$1.50$18.75
Sonnet$3.00$15.00$0.30$3.75
Haiku$0.80$4.00$0.08$1.00

Prices per million tokens. If your total estimated cost exceeds your subscription price, your plan is saving you money.

Self-Learning Accuracy

Since Anthropic doesn't publish their exact rate limit formula, our percentages won't perfectly match Claude's out of the box. Quick Sync fixes this by learning from your data.

How Quick Sync Works

  1. 1. Open Claude's usage screen and note the session/weekly percentages
  2. 2. Enter those numbers in the Quick Sync bar on your dashboard
  3. 3. We calculate the ratio between Claude's number and ours (e.g., Claude: 34%, ours: 29% = 1.17x correction)
  4. 4. This factor is stored and applied automatically. A weighted average of all your syncs produces the final factor — recent syncs count more

The more you sync, the more accurate it gets. After 3-5 syncs over a few sessions, the factor converges and your numbers will closely track Claude's without further effort.

Tips: Sync when your usage is moderate (10-50%) for best accuracy — very low or very high percentages amplify small errors.

The correction compensates for pricing differences, token counting differences, and even changes Anthropic makes to their rate limit formula.

Note: We only track Claude Code usage. Claude's weekly limit includes web, mobile, and API usage too — so our weekly % may be lower than Claude shows. The gap reflects your non-Code usage.

What Gets Tracked

Every time a Claude Code session ends, the following is captured automatically:

Token counts — input, output, cache read, cache write
Model used — Opus, Sonnet, or Haiku
Project context — which project directory you're working in
Session duration — how long the session lasted
Estimated cost — API-equivalent cost calculated from token counts
Session ID — groups related entries together

Privacy & Security

We never see your conversations. The hook only receives aggregate token counts and metadata — not the content of your prompts or Claude's responses.

Your API token is hashed. We store a hash for authentication and an encrypted copy so you can always see it in Settings. The encryption uses your app's unique key.

HTTPS only. All data is transmitted over TLS. Your token is sent as a Bearer header, never in URLs or query strings during API calls.

Works with Claude Code CLI, VS Code, and JetBrains. Anywhere Claude Code runs with ~/.claude/settings.json, the hook works automatically.