How Pacer counts

Pacer's numbers come from the transcripts Claude Code writes on your Mac and from Anthropic's own rate-limit readings. This is how it reads them, and where it differs from ccusage on purpose.

Where the numbers come from

  • Tokens and cost come from Claude Code's transcripts: one line per request, in ~/.claude and ~/.config/claude (Pacer reads both when both exist), or in CLAUDE_CONFIG_DIR when you set it.
  • Rate limits come from Anthropic, asked with your Claude Code login every few minutes. Between readings Pacer estimates from what you've spent since the last one, and marks the estimate with a decimal.
  • Every request is kept. Totals can always be rebuilt from those raw records, so a fix to how Pacer counts corrects your history, not just what comes next.

Rules it follows

  • Each request counts once. A resumed session copies earlier turns into a new file. Pacer matches requests by their message and request IDs and counts each one once, whichever file it reads first.
  • Claude Code's internal placeholder entries are skipped. They are not requests anyone pays for.
  • A broken line never stops a scan. The last line of a session that is still being written is often cut off. Pacer skips a line it can't read rather than stopping.
  • Pacer checks itself daily. Once a day it compares every request Claude Code answered with its own records. Some calls never reach a transcript, such as "while you were away" recaps and conversation compactions, and the check allows for those.

Why it differs from ccusage

ccusage is a good command-line tool, and Pacer started as a port of it. Pacer's numbers are checked against the raw transcripts, not against ccusage, and where the two disagree it is usually one of these:

ccusage Pacer Why
Cache writes One number. 5-minute and 1-hour writes kept apart. Anthropic prices them differently.
Streamed replies Keeps the first copy of a reply. Keeps the finished copy. Claude Code writes a reply to its transcript several times while it streams, and only the last copy has the full output count. Keeping the first under-counted output by about 63% in the transcripts where this was found. When Pacer shows more output than ccusage, this is usually why.
Price Today's price, for every day. The price in effect when the request was made. A price change shouldn't rewrite what you already spent.
Long prompts Only the tokens above 200k at the higher rate. The whole request at the higher rate once its prompt crosses the threshold. That is how Anthropic bills it.
Data residency Not priced. A multiplier on the standard rate (US-only routing, for example). Anthropic documents it as one.
Claude Desktop Not read. Its agent-mode sessions are counted too. Desktop usage draws on the same limits.
Rate limits Estimated from your logs. Anthropic's own reading for your account. Only Anthropic knows how full a window is.

Where a comparison with ccusage disagrees on one of these, Pacer's number is the intended one.

Pricing

  • Two ways to count cost. Use the cost Claude Code reports, or have Pacer price every request from its tokens. Switch in Settings.
  • Rates come from public price catalogs, plus a reviewed, dated price history for what catalogs can't hold: introductory rates, launch-day prices, changes over time. Each entry names its source. The history is public: price-history.json.
  • A new model is priced as soon as a catalog lists it, and Pacer rebuilds the history it had before then.

The rules in full, with the tests that hold Pacer to them, are in the repo's AGENTS.md.