Claude Code Cost per Merged PR: How to Measure It
My Claude Code cost per merged PR rose from $52 to $65 in four weeks at list price. Cost per developer, the method, the 5 traps that broke my numbers.
My Claude Code cost per merged PR rose from $52 to $65 in four weeks from mid-September 2026, at Opus 5 list rates, with one flat week along the way. And 42% of the spend landed on repo-days that merged nothing that day, which is the number a budget review should ask about first.
Those figures come from a ledger I built after my first attempt at this broke in five ways. Below: the numbers, the method, the five traps, and the short list I'd give an engineering lead who has to answer "what are the agents costing us?"
How much does Claude Code cost per merged PR?
From my engineering ledger, across every Claude Code account I use, client and own work together, as totals:
| Week starting | Cost per merged PR | Merged PRs per day |
|---|---|---|
| 14 Sep 2026 | $52 | 11 |
| 21 Sep 2026 | $51 | 26 |
| 28 Sep 2026 | $56 | 22 |
| 5 Oct 2026 | $65 | 18 |
Dollars are tokens priced at Opus 5 list rates. Most of these sessions ran on Opus 5.5, whose list rates are lower, so real list cost was roughly half to two thirds of these figures. They ran on subscriptions, so none of it is an invoice. It's what the same work would cost at list price, and it's comparable week to week because the method didn't change inside the window.
Two more numbers, over the slightly wider ledger window of 11 September to 13 October:
- 42% of spend ($13,894 of $33,083) was on repo-days with no merged PR. Some of that is work whose PR merged the next day, so it isn't waste. But it's the share a weekly PR count can't explain.
- About a fifth of spend ran outside any repo: planning, research, orchestration. That's a floor, because orchestration sessions were only recorded from 5 October.
For a per-developer figure, Anthropic's costs docs put the enterprise average at about $13 per developer per active day, with 90% of users under $30. At Opus 5 list price my setup ran about $930 per active day in September, and more in early October, by the cost case study. I'm not a typical seat: up to 18 sessions at once and over a thousand subagents in 66 days. That's why I lead with cost per merged PR. It's the unit that travels between a heavy user and a light one.
Why measure it from week one
DORA's report on the ROI of AI-assisted development describes a J-curve: value dips before it rises, partly because of "the verification tax imposed by reviewing AI-generated code" (InfoQ, 11 May 2026; the report).
If value dips first, nobody asks for ROI in week one. In my experience the question arrives a few months in, as a budget line, when the early data has already expired.
The method: two sides, one unit
| Side | Number | Source | Strength |
|---|---|---|---|
| Cost | List-price cost per merged PR, weekly | transcripts priced at a stated rate, divided by GitHub merged PRs | measured, at a stated price |
| Delivery | Open-to-merge time per PR, median and 90th percentile | GitHub createdAt and mergedAt | measured |
| Delivery | Review fix commits per PR | git history | measured |
| Value | Hours the same work would take without agents | your own judgment, per batch | estimate, label it |
A merged PR is the unit because GitHub ties it to an account and someone reviewed it. My ledger, a nightly script over every Claude Code account I use, records the cost side per day. The delivery side is the review-wait data from 2–3x on my backlog. This post is how the numbers are made.
Trap 1: the data deletes itself
Claude Code removes session transcripts after cleanupPeriodDays, 30 by default, and /insights reports go with them (Claude Code docs). Until early October, three of my four accounts kept 30 days and one kept 60, so the earliest transcript left was from 6 August and August covered one account out of four. A pruned day can't be recovered from anywhere.
Avoid it: raise the setting on every account before you start, and archive daily. I set 365 on the three accounts I control; the fourth is an employer's account that keeps 60 days, so its history stays shorter. Or export the built-in OpenTelemetry metrics to a store you control:
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317That gives you claude_code.cost.usage, claude_code.commit.count and claude_code.active_time.total per session (monitoring docs).
Trap 2: one response, counted twice
Claude Code writes one transcript entry per content block (text, thinking, each tool call), and each entry repeats the full token usage of its API response. My first collector priced every entry. A 30-day re-scan priced both ways gave $45,295 per entry and $22,236 per response, a ratio of 2.04.
Avoid it: group entries by message ID and request ID and count each response once. If your history already mixes both methods, mark the date of the change and never compare across it. I made that mistake once in public, and the cost case study shows the correction.
Trap 3: spend that belongs to no repo goes missing
Attributing cost to a repo by the session's working directory drops two kinds of session. Worktree sessions run in a directory that isn't the repo's own, and orchestration sessions run in a parent folder above every repo. On 5 October, the transcript scan that evening found $191 of $702 in sessions outside any repo, 27%, and my ledger had been dropping them.
Avoid it: resolve each worktree back to its main repo through its .git file, and keep a catch-all row for spend outside every repo instead of discarding it. Every dollar should land somewhere, even in "unattributed".
Trap 4: a failed read recorded as zero
The merged-PR count comes from GitHub search, one call per account. For one GitHub owner my token could see only public repositories, so search returned nothing, and the ledger recorded 0 merged PRs in 30 days where GitHub had 102. Zero looked like a fact.
GitHub search also stops at 1,000 results, and a busy organization merges more than that in a month, so an unchunked query undercounts it in silence.
Avoid it: a failed or partial fetch keeps the previous value and says so, and a company you can't read shows "unknown", never 0. Split searches by month and halve any chunk that hits the cap.
Trap 5: the wrong denominator, and the wrong price
Denominator. Agents that commit every working step produce far more commits than a person, so cost per commit moves with commit habits. Claude Code's own counter claude_code.pull_request.count counts PRs created, not merged. Take merged PRs from GitHub.
Price. Every dollar figure in Claude Code, /usage and OpenTelemetry included, is an estimate at list price unless an admin sets the modelPricing managed setting (Claude Code 2.1.243 or later). List prices differ by model: Opus 5.5 lists cache reads at $0.20 per million and Opus 5 at $0.50 (Anthropic pricing), so a ledger priced at the wrong model can be off by 2.5x on cache reads alone. Even the built-in figure moves: Claude Code 2.1.296, released 9 Oct 2026, corrected /cost to price Sonnet 5.5 cache reads at $0.10 per million instead of $0.20 (changelog). And on a subscription, none of it is the invoice.
Avoid it: state the price table next to every chart, and keep one table for the whole series.
The value side: a break-even, labelled
ROI needs the hours the same work would have taken without agents, and nobody does the work twice. So I state the break-even and let the reader put their own rate in:
| Input | Value | Kind |
|---|---|---|
| Cost per merged PR | $65 | my latest full week at Opus 5 list price |
| Engineer cost per hour | $100 | illustrative, use your own |
| Break-even: time saved minus your review time, per merged PR | 39 minutes | arithmetic |
At those inputs a merged PR pays for its tokens if the time it saved, minus the time someone spent reviewing it, is at least 39 minutes. At Opus 5.5 list rates the cost is roughly half to two thirds, so 20 to 26 minutes. Review time is the term people leave out: the 30 agent PRs of my March run merged a median 44 minutes after opening, and part of that was me reading the diff. The hours saved per PR is the estimate in this table, so I label it every time.
What should an engineering lead track?
Four numbers, weekly, with the method written next to them:
- Cost per merged PR, at one stated price table.
- Review wait per agent PR, median and 90th percentile.
- Spend outside any repo, as its own row.
- Spend on repo-days with no merged PR.
These four tell you whether usage turned into shipped work. Stack Overflow's 2026 survey (6 October 2026) found that 28% of respondents' organizations reviewed AI spending data, next to other controls such as usage limits (38%).
Start this week
- Keep the data. Set
cleanupPeriodDaysabove 30 on every Claude Code account, today. - Count merged PRs weekly from GitHub, per repo, with failed reads marked as unknown.
- Price tokens at one stated rate, one response at a time, with spend outside any repo kept.
- Write the method down with the date of every change to it.
- Put review wait next to cost. In LinearB's 2026 data, AI-written PRs waited more than 16 hours for a reviewer.
After four weeks you'll have the first trend you can show someone. Mine, and what it caught, are in the cost case study, and the review-wait side is in where the AI speed-up goes.
If you'd rather have someone measure cost per merged PR on your setup, rank the fixes and ship the top one as a PR, that's the AI Code Audit on my services page.
Questions
How do you measure the ROI of Claude Code?
Put cost and delivery on the same unit. Cost per merged PR comes from token usage priced at a stated rate, divided by PRs merged on GitHub. Delivery comes from GitHub timestamps: open-to-merge time and review fix commits per PR. The value of the time saved needs an estimate of the work done without agents, and it should be labelled as an estimate.
How much does Claude Code cost per merged PR?
In my ledger, $52, $51, $56 and $65 in the four full weeks from 14 September to 11 October 2026, at Opus 5 list rates, across client and own work. That's replacement cost, not an invoice: the sessions ran on subscriptions, and most ran on Opus 5.5, whose list rates are lower. It rose 25% in four weeks, with one flat week. The cost case study's 42% is a different comparison: per active day, September against 1–11 October.
How long does Claude Code keep usage data?
Session transcripts are deleted after cleanupPeriodDays, which defaults to 30 days, and /insights reports follow the same schedule. Raise the setting or export OpenTelemetry metrics before the month you want to measure ages out. Git and GitHub data are permanent, so commits and merged PRs can always be recounted.
Does Claude Code report merged PRs?
Its OpenTelemetry counter claude_code.pull_request.count counts pull requests created through a shell command or an MCP tool, not merged ones. For ROI, take merged PRs from GitHub and join them to cost by day.
AI Code Audit · from €1,500
Find where your agent tokens go
I measure cost per commit and per merged PR on your setup, send the ranked fixes in 2–3 days, and ship the top one as a PR.
or book a free 30-minute scoping call →