34,434 real Claude Code requests, measured.
Claude Code writes a transcript of every session to ~/.claude/projects. Those files
carry the API’s own per-request usage accounting — and, in recent versions, the exact
shape of each request, including every tool schema sent with it.
That is enough to answer a question I had not seen answered with data: not “how do I cut my token bill”, but where does it actually go?
I started out expecting to find waste and cut it. I found the waste. Then I found out it was worth about a twentieth of what the standard arithmetic says.
59 tool schemas were sent on request after request and never once invoked, costing 30.67M tokens. That is the number a “cut your AI bill” post would quote. Multiply by the input rate and you get a headline: $117 of pure waste.
It isn’t $117. It’s about $7.43.
priced as cache reads $7.43 <- realistic
priced as fresh input $117 <- what the naive figure implies
Tool schemas sit at the very front of the prompt. That makes them the single most cached thing in it — and on this data 97.0% of input tokens were served from cache, billed at roughly a twentieth of the input rate. The tokens you would “save” by deleting a tool are the cheapest tokens you have.
The standard method — count removable tokens, multiply by the input price — overstates the saving here by about 16x. The trim is still worth doing. It is not the transformation it looks like.
| model | requests | input (incl. cache) | output | est. cost |
|---|---|---|---|---|
| Opus 5.5 | 16,202 | 3.17B | 12.07M | $1,362 |
| Opus 5 | 4,333 | 962.40M | 4.90M | $778 |
| Haiku 5.5 | 8,832 | 385.99M | 13.76M | $18.15 |
| Sonnet 5.5 | 4,634 | 177.69M | 2.63M | $90.46 |
| total | 34,434 | 4.70B | 33.37M | ~$2,249 |
Haiku did 8,832 requests — 26% of all traffic — for 0.8% of the cost. That ratio is the single biggest lever on this list, and it has nothing to do with trimming tool schemas.
served from cache 4.56B 97.0%
written to cache 138.72M 3.0%
of which 1h TTL 120.27M (billed at 2x input)
of which 5m TTL 18.45M (billed at 1.25x input)
never cached 71.04k
97% is healthy, and it is also the reason the waste number above collapses. Note the split: most cache writes were at the 1-hour TTL, which bills at 2x input, not 1.25x. Cache writes are not free, and a prompt prefix that keeps getting invalidated pays that premium every time.
Across 17,214 requests, before a single word of conversation: system prompt 43.28M tokens (2.51k per request) tool schemas 211.96M tokens (12.31k per request) fixed overhead 255.24M tokens
~14.8k tokens of fixed prefix on every single request, five-sixths of it tool schemas. As a share of all billed input that is only 5%, because conversations grow much larger than their prefix — but it is the part you pay on request one and on request ten thousand.
15.98M thinking tokens — 47.9% of all output. Billed as output. On a long
Opus session this is a bigger line item than anything in the schema table, and effort
is the lever.
| tool | per request | requests carried | total | actually called |
|---|---|---|---|---|
| Artifact | 7.56k | 3,841 | 29.03M | 161 |
| ScheduleWakeup | 1.32k | 15,937 | 20.97M | 2 |
| Agent | 1.17k | 17,119 | 20.10M | 119 |
| Bash | 1.10k | 17,120 | 18.80M | 24,921 |
| ReportFindings | 682 | 16,409 | 11.19M | 0 |
| Read | 543 | 17,120 | 9.30M | 339 |
| ListAgents | 560 | 16,409 | 9.19M | 1 |
Bash is what a well-earned schema looks like: 18.80M tokens, 24,921 calls.
ScheduleWakeup cost more than Bash and was called twice.
Rolled up by MCP server, which is the unit you actually toggle:
| server | tools | tokens | calls |
|---|---|---|---|
| claude-artifacts | 8 | 11.80M | 7 |
| Gmail | 19 | 11.12M | 106 |
| Claude Docs | 5 | 1.31M | 0 |
| Gumroad | 32 | 884.52k | 298 |
| Google Calendar | 2 | 552.30k | 0 |
| Google Drive | 2 | 548.09k | 0 |
Three servers carried on every request for eleven days and never called once. Gumroad is the counter-example worth noticing: 32 tools for 884k tokens — one thirteenth the cost of Gmail’s 19, and the most-used server on the list (298 calls). Tool count is a bad proxy for cost; schema size is the thing.
The transcripts are JSONL. Two record types carry everything above:
assistant records hold message.usage — input_tokens,
output_tokens, cache_read_input_tokens,
cache_creation_input_tokens, and cache_creation split into
ephemeral_5m_input_tokens / ephemeral_1h_input_tokens. Also
output_tokens_details.thinking_tokens.api-request-shape records hold the full system array and
tools array for a request shape, keyed by shapeHash;
api-request records reference that hash.So you can attribute cost to individual tool schemas without instrumenting anything. Here is the whole idea in twenty lines:
import json, glob, os, collections
usage = collections.Counter()
calls = collections.Counter()
for path in glob.glob(os.path.expanduser("~/.claude/projects/**/*.jsonl"), recursive=True):
for line in open(path, encoding="utf-8", errors="replace"):
try:
d = json.loads(line)
except ValueError:
continue
msg = d.get("message") or {}
u = msg.get("usage") or {}
for k in ("input_tokens", "output_tokens",
"cache_read_input_tokens", "cache_creation_input_tokens"):
usage[k] += u.get(k) or 0
for block in msg.get("content") or []:
if isinstance(block, dict) and block.get("type") == "tool_use":
calls[block["name"]] += 1
print(usage)
print(calls.most_common(20))
That gets you totals and call counts. Attributing schema cost needs the
api-request-shape join, and pricing it honestly needs the cache split — which is
the part everyone skips, and the part that produced the 16x correction above.
count_tokens if you need it
exact.I packaged this as token-xray — one Python file, no dependencies, 26 tests. It reads local transcripts, sends nothing anywhere, needs no API key, and prints every section above against your own data, including the honest-versus-naive bracket.
appenable.gumroad.com/l/token-xray — $39.
It is paid, which I would rather say plainly than bury. Everything needed to reproduce the method is above, and the twenty lines will get most people most of the way. Source of this page and the raw numbers on GitHub.
Also measured: which Claude Code token fixes actually save money — fifteen configurations measured; --allowedTools "" saves exactly zero tokens, and model choice beat every trim by 23x.
Also measured: your headless Claude Code evals
are probably not reading CLAUDE.md — a rule obeyed 3/3 when injected properly and 0/3
sitting in CLAUDE.md, because claude -p never put it in context.
Also measured: when Claude Code subagents actually pay for themselves — splitting the work costs 1.97x as much at 1,668 lines and is 4.3x cheaper at 10,328, and on a needle hunt it takes precision from 1.000 to 0.714.
Free, no signup past an email: What Claude Code actually follows — eight findings from 250+ isolated, graded runs: which CLAUDE.md rules get half-done, the broken file a passing test suite misses, and whether a model cheats on a test that contradicts its spec.