I priced every API call in my Claude Code session logs at Anthropic's published rates and matched the cost to the pull requests each session opened: 466 merged PRs across 52 repos, most of them from October and November 2026.
Half of them cost $4 to $20.
Whole sessions, so no splitting calls between PRs.
Those re-reads were 59% of the cost.
Claude Code's plan prices tell you what a month costs. I wanted to know what one finished piece of work costs, so I measured it from the logs Claude Code keeps on my Mac.
Every call to the model records how many tokens it read and wrote. I priced each call at the published API rate for its model, added up the calls behind each PR, and looked at the 466 PRs that merged. The most expensive one cost about $630, and the 8 PRs over $100 each pull the average up to about twice the median.
8 in 10 merged PRs cost between $2 and $50
Cost of the Claude Code calls behind each merged PR, at Anthropic's published API prices.
| $0-$1 | 35 |
|---|---|
| $1-$2 | 29 |
| $2-$5 | 82 |
| $5-$10 | 98 |
| $10-$20 | 104 |
| $20-$50 | 82 |
| $50-$100 | 28 |
| $100-$200 | 4 |
| $200+ | 4 |
9 in 10 merged PRs came from sessions that opened 4 or more, so their cost depends on how I split each session's calls between its PRs. The 42 PRs from smaller sessions need no split, and their median is about twice the overall one. They are also different tasks, so I can't tell how much of the gap comes from the split and how much from the work. That is why I give both numbers.
I pay a flat monthly Max plan, so these are what the same tokens would cost on the API. They are the numbers to use if you run Claude Code on an API key, and a way to see what a plan is worth.
I sorted each PR into a task type by its title, branch name and the files it changed. Feature PRs cost about $13 at the median, against about $8 for a bug fix. The median feature PR also changed about 900 lines of code, where a bug fix changed 50.
Feature PRs cost more than bug fixes at the median
Dot: median. Bar: the middle half of PRs. Merged PRs in brackets.
| Task type | Merged PRs | Median | 25th pct | 75th pct | 90th pct | Median lines changed |
|---|---|---|---|---|---|---|
| Bug fix | 55 | $7.82 | $3.97 | $14.69 | $31.77 | 50 |
| Feature | 249 | $12.88 | $5.69 | $22.04 | $47.01 | 872 |
| Refactor | 13 | $6.60 | $5.41 | $16.72 | $36.32 | 488 |
| Tests | 8 | $5.05 | $1.54 | $9.35 | $11.68 | 648 |
| Docs and content | 97 | $5.10 | $1.92 | $13.83 | $30.96 | 159 |
| CI, deps and config | 44 | $10.10 | $3.54 | $16.35 | $26.96 | 656 |
Docs and content PRs, such as a README rewrite or a blog post, cost about $5 at the median. The refactor and tests groups have under 30 PRs each, too few to compare. I write tests inside the feature or fix PR that needs them, so only 8 merged PRs were mainly tests.
A model keeps no memory between calls. Each time Claude Code asks it for the next step, it sends the whole conversation again: the instructions, every file it read and every command output so far.
Prompt caching makes that affordable. The provider keeps the start of the conversation it has already seen and bills a re-read, a cache read, at a fraction of the normal input price. On Opus 5.5 a cache read costs 5% of a fresh input token. Writing new context into the cache costs more than a fresh token, 1.25 to 2 times as much.
Cache writes were 2% of the tokens and 26% of the cost
All Claude Code calls in sessions that opened a PR: 24 billion tokens.
| Tokens | 23,817,994,787 | 378,729,211 | 68,859,386 | 5,103,517 |
|---|---|---|---|---|
| Cost | 5,873.14 | 2,596.11 | 1,389.7 | 27 |
Everything the model writes, code and reasoning included, was under 1% of the tokens and 14% of the cost. So the cost of a task follows how much context the agent carries, and for how many steps.
To compare like with like, I took only the main conversation of each coding session, left out subagents, which keep a separate context, and kept Opus 5.5 calls so the price per token stays the same.
A call deep in a session costs about twice as much as an early one
Median cost in US cents of main-thread Opus 5.5 calls in my coding sessions, subagents left out, at Anthropic's published API prices.
| Call 1 | 32.7 cents |
|---|---|
| Calls 2 to 50 | 6.7 cents |
| Calls 51 to 200 | 10.0 cents |
| Calls 201 to 1,000 | 13.1 cents |
| Call 1,001+ | 11.4 cents |
Each session runs on the model I pick. Opus 4.8 ran my sessions in June and July, and Opus 5.5 from October. Sonnet 5.5 ran almost all of its calls in subagents, the helpers a session starts for searches and reviews.
Opus 5.5 handled 84% of the tokens and 69% of the cost
All Claude Code calls in sessions that opened a PR.
| Opus 5.5 | 68.7% |
|---|---|
| Opus 4.8 | 20.8% |
| Fable 5 | 8.4% |
| Sonnet 5.5 | 2.1% |
To see what the model choice changes, I priced the same tokens as if every call had gone to one model. The median merged PR would cost about $9 on Opus 5.5, $4 on Sonnet 5.5 and $2 on Haiku 5.5. This compares prices only. A different model would take a different number of steps and land a different share of PRs.
$9 to $19 for a merged PR is less than I expected.
Counting the PRs I closed or left open too, the average comes to about $21 per merged PR. At that average, a dev merging 20 PRs a week would spend about $420 a week at API prices.
What I do with this:
CLAUDE.md. It rides along on every call. The first call of a session carries about 94,000 tokens at the median: the system prompt, tool definitions, CLAUDE.md files and my first message.I will rerun this each quarter with the same script, so the numbers move with new models and prices. The 3 changes I measured in April, a code graph, tool-output compression and prompt caching, attack the same cache-read share from different sides.
The numbers I left out, and the limits:
The script that produces every number here is scripts/claude-code-cost.mjs. It reads the logs on the machine it runs on and writes only the totals below, with no prompts, repo names or file paths. Run it on your logs with node scripts/claude-code-cost.mjs; it needs the GitHub CLI to look up your PRs.
| Model | Input | 5 min cache write | 1 hour cache write | Cache read | Output |
|---|---|---|---|---|---|
| Opus 5.5 | $4 | $5 | $8 | $0.2 | $20 |
| Opus 4.8 | $5 | $6.25 | $10 | $0.5 | $25 |
| Fable 5 | $10 | $12.5 | $20 | $1 | $50 |
| Sonnet 5.5 | $2 | $2.5 | $4 | $0.1 | $10 |
| Haiku 4.5 | $1 | $1.25 | $2 | $0.1 | $5 |
| Haiku 5.5 | $0.1 | $0.125 | $0.2 | $0.01 | $0.5 |
The aggregate numbers as CSV, free to reuse with credit (CC BY 4.0).
I publish a data study when the numbers are in, with its method and raw data. One email per study.
I use analytics only to see which pages are useful, and you can decline. Privacy