tokenmeter
Know what every prompt costs you in Claude Code, Codex and Copilot, and how to spend less.
A free token usage and cost dashboard for Claude Code, Codex and many more, built from the logs your coding agents already keep. Private by default: it runs on localhost and nothing leaves your machine unless you ask for tips.
$ brew install serkankorkut/tap/tokenmeter && tokenmeter startPS> pipx install tokenmeter-dashboard; pipx ensurepath; & "$HOME\.local\bin\tokenmeter.exe" start$ pipx install tokenmeter-dashboard && pipx ensurepath && ~/.local/bin/tokenmeter startPaste that in a terminal. Your dashboard opens at http://127.0.0.1:7788 and keeps running in the background. Other ways to install
What does Tokenmeter do?
It tells you how to spend less.
Click Get tips and Tokenmeter hands your 5 or 10 most expensive prompts, with their token split and cost, to the AI you already use: Claude Code, Codex or Copilot CLI, running on your machine with your own login. Back comes one concrete fix per prompt and the habits that would save the most.
Nothing is sent until you click, and you see exactly what goes out. No AI command installed? Copy the prompt and paste it anywhere.
Tips for your 5 most expensive prompts 1. $13.88 refactor the billing module 84 turns in one session, context grew to 600K → start a new session after each finished step 2. $9.40 explain this stack trace a 40K-line log pasted as fresh input → paste only the failing part habits that save the most: /clear between tasks · cheaper model for reads · avoid idle gaps that expire the cache
It reads the logs your agents already keep.
Claude Code, Codex and Copilot CLI save every reply to disk with its token counts. Tokenmeter indexes them in about a second and follows along live.
No hooks, no proxy, no wrapper around your agent. Uninstall it and nothing about your setup changes.
$ tokenmeter start indexed 6,152 turns from 132 logs in 1.5s serving http://127.0.0.1:7788 claude code ~/.claude/projects codex ~/.codex/sessions copilot cli ~/.copilot/session-store.db
It prices every prompt, and shows its work.
Tokens are priced up to 200 times apart. A cached read is almost free; re-writing the cache is not. So a plain token count says little about what you paid.
Tokenmeter splits every number into cached, fresh and output, and prints the arithmetic under each prompt.
fix the flaky auth test 7 turns · 42s cached 3.88M × $0.25 /M = $0.97 fresh 0.61M × $20 /M = $12.28 output 12.7K × $50 /M = $0.63 ────────────────────────────────── total $13.88 on claude-fable-5-1
It finds the cache misses that quietly cost the most.
When a long conversation loses its cache, the whole context is sent again at full price. One miss can cost more than an hour of normal work.
Tokenmeter flags every miss, the prompt that was running, and what it cost, so you can see the pattern and avoid it.
Cache misses last 30 days Sep 18 16:52 lost 3.2M rewrote 614K $12.28 Sep 18 11:04 lost 2.9M rewrote 587K $11.73 Sep 21 16:28 lost 3.0M rewrote 600K $12.00 62 misses · $329 spent re-writing cache
It watches your limits and your plan.
Codex 5-hour and weekly windows, rolling usage for every tool, and a context gauge for each live session so you see compaction coming.
On a subscription you see what you actually pay first, and the API-equivalent value below it. Set a budget and get a desktop alert when you cross it.
Codex 5-hour █████████████░░░ 81% resets in 1.4h Codex weekly ████░░░░░░░░░░░░ 24% Context ██████░░░░░░░░░░ 35% 351K of 1M tokens Spend plan $120 API-equivalent $819
It never phones home.
The server listens on your machine only. No telemetry, no account, no update check. Your prompts stay where your agents wrote them.
Teams can opt in to share totals with one shared dashboard. Prompt text is stripped before anything leaves a laptop.
$ lsof -iTCP -sTCP:LISTEN | grep 7788 Python 76453 you TCP 127.0.0.1:7788 (LISTEN) $ tokenmeter --version tokenmeter 0.3.4
Every prompt, sortable
Text, turns, tokens by type, cost, duration, and a command to resume the session.
Cost per commit
Turns matched to the next git commit in each repo. What did that change cost to build?
By model and project
See which model, repo and session your budget goes to.
Team mode
Aggregates from every laptop in one dashboard, filtered by person.
CSV and JSON
Export any range, or read the local API from your own scripts.
Zero dependencies
Python standard library and one HTML file. Light and dark, phone to desktop.
Questions
How do I track Claude Code token usage?
Claude Code already writes every reply with its token counts to ~/.claude/projects. Install Tokenmeter with brew install serkankorkut/tap/tokenmeter or pipx install tokenmeter-dashboard, run tokenmeter start, and open http://127.0.0.1:7788. Every prompt shows up with its tokens and cost a few seconds after it finishes. Where the logs are and what they contain.
How much does a Claude Code prompt cost?
It depends on how much of the context was cached. A cache read costs 2.5 to 10 percent of fresh input, depending on the model, and output costs about five times input. A short prompt in a long session can cost a few cents or more than ten dollars. Tokenmeter shows the split and the arithmetic for every prompt, using list prices you can override. How Claude Code pricing works.
What is a cache miss in Claude Code?
The cached conversation expires after a break longer than its lifetime: one hour on a Claude subscription, five minutes on an API key. The next prompt then sends the whole context again at full price. Tokenmeter flags each cache miss with the prompt that caused it and what the re-write cost.
Is Tokenmeter a Claude Code usage monitor or a cost tracker?
Both. It monitors usage live, a few seconds after each prompt, with a context gauge for every running session so you see compaction coming. It tracks cost per prompt, per day, per project and per git commit, and can send a desktop alert when you cross a daily or monthly budget.
How can I reduce Claude Code token usage?
Find where the tokens go first. In Tokenmeter, sort prompts by cost, check the cache misses, and compare models and projects: most waste comes from cold sessions that re-send the whole context, long histories carried into unrelated tasks, and a large model doing routine work. Then clear or restart sessions between tasks and match the model to the job. Tokenmeter does not change what your agent sends; it shows you what to change. Ways to spend less.
How do I check my Codex usage limits?
Codex writes its 5-hour and weekly limits into every session log, with the percentage used and the reset time. Tokenmeter shows both windows as bars with a countdown. In Codex itself, /status shows the same numbers. How Codex usage limits work.
Does it work with Codex and GitHub Copilot CLI?
Yes. It reads Codex sessions in ~/.codex/sessions, including the 5-hour and weekly limit windows Codex records, and the Copilot CLI database in ~/.copilot/session-store.db. All three tools show up in one dashboard.
Does Tokenmeter show my Claude plan usage limit?
Only if a Claude Code login token is in your macOS keychain, because Anthropic does not write plan usage to disk. Otherwise Tokenmeter shows rolling 5-hour and 7-day totals from the logs.
How is Tokenmeter different from ccusage?
ccusage is a command-line report built from the same Claude Code logs, and Claude Code's own /usage covers the current session. Tokenmeter is a live web dashboard: cost per prompt split into cached, fresh and output tokens, a cache-miss detector, cost per git commit, and Claude Code, Codex and Copilot CLI in one view.
Is my data sent anywhere?
No. The server listens on 127.0.0.1 only, with no telemetry, no account and no update check. The one outbound request is Anthropic's usage endpoint, and only if a Claude Code token is already in your keychain. Team mode sends totals without prompt text, and only if you turn it on. Tips to spend less sends your most expensive prompts to the AI tool you pick, and only when you click Get tips.
Is this the same as other tools called TokenMeter?
No. This Tokenmeter is the open source Python dashboard by Serkan Korkut, published as tokenmeter-dashboard on PyPI and serkankorkut/tap/tokenmeter on Homebrew, with source at github.com/serkankorkut/tokenmeter. It is not related to other products that use the name.
Works where you work.
macOS with Homebrew, Windows and Linux with pipx or uv. Python 3.9 or newer.