---
title: "What Claude Code actually bills you for"
description: "Most people picture their Claude Code bill as the text that scrolls past. It"
canonical: https://caveman.so/news/what-claude-code-bills-you-for
last-updated: 2026-09-15
---

# What Claude Code actually bills you for

Most people picture their Claude Code bill as the text that scrolls past. It
is not. The reply is the smallest of four counters, and the largest one is
charged for text you wrote turns ago and have not looked at since.

This is a plain description of what the meter counts, so the fixes in
[the cost guide](/news/how-to-cut-claude-code-costs) make sense.

## The four counters

Every response from Anthropic's API carries a `usage` block with four
numbers. Claude Code sums them into what `/cost` shows.

| Counter | What it is | Relative price |
| --- | --- | --- |
| `input_tokens` | Prompt tokens the model read fresh this turn | Base input rate |
| `cache_creation_input_tokens` | Prompt tokens written to the prompt cache | About 1.25 times base input for the five minute cache |
| `cache_read_input_tokens` | Prompt tokens served from the cache | About a tenth of base input |
| `output_tokens` | Tokens the model wrote, including thinking | Several times base input |

The exact per-model rates are on Anthropic's pricing page and change with
model generations. The ratios above have held across recent models and are
the part worth remembering.

## Why input dominates

The API is stateless. On every turn Claude Code sends the entire conversation
again: system prompt, `CLAUDE.md`, tool definitions, every message, and every
tool result the agent has read so far. Turn thirty carries the weight of
turns one through twenty nine.

That is why agent bills look nothing like chat bills. In our pinned Claude
Code benchmark, six tool-heavy tasks run three times each consumed 885,793
input-side tokens across 18 runs, about 49,000 per task. The replies were a
small fraction of that.

Whether those tokens are cheap or expensive depends on the cache. A stable
prefix means most of the resend is billed at the cache read rate. A prefix
that changes early forces a fresh read of everything after the change.

## What sits in the prefix

Order matters, because a cache is a prefix match. Anthropic renders a request
as tools, then system, then messages. In Claude Code that means:

1. Tool definitions, including every connected MCP server's schemas. We
   captured one real configuration sending 224,655 characters of tool
   definitions before the first message, from 91 tools.
2. The system prompt Claude Code composes, plus your `CLAUDE.md` files and
   memory files.
3. The conversation, oldest first, with tool results inline.

A change in layer one or two invalidates everything below it. A tool result
in layer three only invalidates what comes after it, which is nothing yet.

## Output is small but dear

Across ten ordinary coding prompts through the real API, Claude wrote an
average of 1,214 output tokens per reply when left to its defaults. The
Caveman skill brought that to 294. Output tokens cost several times what
input tokens do, so a 65 percent cut in output is worth more than the same
percentage of fresh input, but it is applied to a much smaller number.

Thinking tokens count as output. Longer reasoning settings raise this counter
without changing what you see.

## Reading your own numbers

Inside a session, `/cost` prints the running spend and `/context` shows what
is occupying the window and how much of it is tool definitions. Anthropic's
console breaks usage down per API key.

If you log the API yourself, the number that compares fairly across runs is
the sum of the three input-side counters. That is what our benchmarks use:

```text
input_tokens + cache_read_input_tokens + cache_creation_input_tokens
```

Summing them without price weights overstates the cost of cache reads and
understates writes. It is a token count, not a bill. Weight by price when
you have the rates.

`caveman learn` reads your local Claude Code session logs and ranks the
recurring sinks, per server and per file, without an account.

## Per-token is not the only meter

Some tools price by request rather than by token. GitHub Copilot's premium
requests are one example. A shorter answer is still one request, so
output-side savings do nothing there. Before applying any token-side fix,
check which meter your plan runs on.

## Questions people ask

### Why did my Claude Code cost jump when I added an MCP server?

Because every tool the server exposes goes into the prompt before your first
message, and it sits early in the cache prefix. If the server connects after
the session starts, it also invalidates the cache for that turn. One real
configuration we captured carried 224,655 characters of tool schemas from 91
tools, about 69 percent of it from tools never called that week.

### Are cache reads free?

No. They are billed at about a tenth of the fresh input rate. On a long
session that is the difference between a bill you can live with and one you
cannot, but it is not zero, and a large stable prefix still costs money every
turn.

### Does `/compact` save money?

It replaces the conversation with a summary, which shrinks layer three of the
prefix for later turns. It also discards detail the agent may need again and
costs one summarisation call. It helps most on long sessions that have moved
past their early context.

### Do thinking tokens cost extra?

They are billed as output tokens. Higher effort settings produce more of them.
You do not see them itemised in the reply, but `/cost` includes them.

### How do I know if the prompt cache is working?

Compare `cache_read_input_tokens` to `input_tokens` on consecutive turns. In a
healthy session reads dwarf fresh input after the first turn. If reads stay
near zero, something early in the prefix is changing between turns.

## Sources

- [Anthropic, prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for rates and the prefix rule.
- [CaveBench Wrap benchmark](https://github.com/JuliusBrussee/caveman/blob/main/docs/WRAP-BENCHMARK.md) for the input figures.
- [Your agent pays before it works](/news/your-agent-pays-before-it-works) for the first-turn capture.
- [Honest numbers](https://github.com/JuliusBrussee/caveman/blob/main/docs/HONEST-NUMBERS.md) for the per-request pricing cases.
