Baseframe Labs

How to track what Claude Code and Codex cost you

Updated · Baseframe Labs

Claude Code, Codex and other AI command-line tools write usage records to files on your machine as they work. A local reader such as TokenTrace can turn those files into cost by model, project and session, without a proxy, an account or sending your prompts anywhere.

Where the numbers already live

Every session an AI CLI runs leaves token usage on disk. The records are there, but they are spread across files and don't say which project or model cost the most this week.

Open a local dashboard

Run npx tokentrace. TokenTrace reads those files, starts a dashboard on a localhost port from 3030 and opens your browser. Install it with npm install -g tokentrace to keep the tokentrace command on your PATH. It needs Node.js 20.9.0 or later on macOS, Linux or Windows.

Read the breakdown

The dashboard splits cost by model, project and session. Each figure is labelled exact, estimated or unknown, so you can see how much of a total was measured and how much was estimated.

Every total links back to the sessions and source files that produced it. Export any total as an Evidence Pack when you need to show your working.

See cost while you work

tokentrace statusline setup claude adds a live status line to Claude Code. npx tokentrace mcp starts an MCP server, so an agent can ask for its own usage.

What stays on your machine

Everything goes into one local SQLite database. TokenTrace has no account and no telemetry, and it doesn't proxy or intercept traffic. Its one optional network call refreshes public model rate data so the cost estimates stay current.

TokenTrace is in maintenance mode: it keeps working and gets security and breaking-bug fixes, with no new parsers or integrations.

Questions and answers

Is TokenTrace an official Anthropic or OpenAI tool?
No. TokenTrace is an independent, MIT-licensed tool from Baseframe Labs. It reads files the CLIs already write.
Does TokenTrace read my prompts?
It reads usage records and skips raw prompt and response bodies by default. Everything it stores stays in a local database.
Can I break costs down by project?
Yes. TokenTrace groups usage by model, project and session, and each total links to the records behind it.

The tool in this guide