Claude Code and Codex are logging your token usage locally. Here is how to read it. Claude Code and Codex store detailed token usage logs locally, including prompt cache hit rates, which developers can analyze without API calls. A developer created ModelMeter, a tool that reads these logs and displays cache efficiency metrics in a dashboard. Your AI coding agent's token data is already on your machine. You just haven't looked at it yet. Claude Code and Codex both write local logs after every session. Those logs include detailed token breakdowns: uncached input, cache hits, cache writes, output. No API call needed, no provider dashboard, no guessing. The number that matters most, your prompt cache hit rate, has been sitting on your disk every time you wondered why you were burning through your weekly limit so fast. Claude Code writes a JSONL transcript for every session under ~/.claude/projects/ . Each assistant message carries a usage block: { "type": "assistant", "uuid": "f0c8...", "message": { "model": "claude-opus-4-...", "usage": { "input tokens": 137, "cache read input tokens": 815193, "cache creation input tokens": 5521, "output tokens": 4260 } } } That split is the whole game. input tokens is uncached input. cache read input tokens is context served from the prompt cache. cache creation input tokens is context written to cache. output tokens is the response. On a long agent session, cache read should dwarf input tokens . If it does not, you are re-paying for the same context on every single turn. Codex writes rollouts under ~/.codex/sessions/ . It emits token count events with a cumulative running total per session: { "type": "token count", "info": { "total token usage": { "input tokens": 0, "cached input tokens": 0, "output tokens": 0, "reasoning output tokens": 0 }}} Because Codex counts are cumulative, you take the delta between events rather than summing them. A few lines of Node walk the JSONL, sum usage per model per day, and dedupe by message uuid for Claude and by session delta for Codex, so you never double-count: js import { readFileSync } from 'node:fs' for const line of readFileSync file, 'utf8' .split '\n' { if line.trim continue const o = JSON.parse line const u = o.message?.usage if u || seen.has o.uuid continue seen.add o.uuid // accumulate u.input tokens, u.cache read input tokens, // u.cache creation input tokens, u.output tokens by o.message.model } Notice what you do not need: the prompt text, the response text, or any API key. Model names and token counts are enough to compute everything useful. A usage tool should never have to read what you typed, and this one does not. Once you aggregate, one metric matters more than the rest: your prompt cache hit rate. hit rate = cache read / cache read + cache creation + uncached input On a flat plan, this is your real efficiency lever. A high hit rate means you are reusing context instead of resending it. A low one means you are burning tokens, and your usage limit, on the same context over and over. The fix is usually structural: stabilize the front of your prompt so the cache prefix stays intact, keep tool definitions lean, and stop reshuffling system context between turns. One honest caveat: on a subscription you do not pay per token, so any dollar figure is an API list-price equivalent, not your actual cost. It is a useful sense of scale, nothing more. The signals that genuinely matter are token volume and cache hit rate. Any tool that flashes a "you spent $X this month" number at a flat-plan user is being a little loose with what that number means. I wrapped all of this into ModelMeter https://modelmeter.dev . A one-line collector reads those local logs and sends the token counts, and only the token counts, to a dashboard that shows your cache hit rate, ranks where your tokens are going, and labels every figure by how it was derived: computed from real tokens, a gated estimate, or "coming" when it needs request-level data the logs do not contain. npx modelmeter-collect init