What AI coding agents cost per pull request, and how to track it
Dmitriy Solodukha · Updated · 4 min read
Checked against Caprock v0.199.0
Track what Claude Code and Codex cost per pull request: what OpenTelemetry gives, tools that attribute by branch or divide, and one Mac's measured figures.
No coding agent reports its cost per pull request. Claude Code's OpenTelemetry export has a cost metric and a count of pull requests, but nothing links one to the other. Tools that do it either follow each session's branch to the pull request it became and add up those sessions (LangSmith, LangWatch, Caprock), or divide total spend by merged pull requests (Dash0, DX).
Caprock joins every session to the branch it pushed and the pull request it opened, on your machine, and prices each pull request and release at list price. Free and open source.
What the agents give you
- Claude Code's OpenTelemetry metrics.
claude_code.cost.usageis an estimated cost in USD per API request;claude_code.pull_request.countcounts pull requests it created. They share a session ID, not a pull request: no metric carries a branch, and the repository only withOTEL_METRICS_INCLUDE_REPOSITORY=true. Setup: Claude Code OpenTelemetry. - Claude Code analytics (Team and Enterprise). Contribution metrics, in beta, count pull requests with Claude Code by matching session activity to merged diffs; the dashboard shows no cost.
- ccusage reports cost by day, session and, for Claude Code, project; Codex by day and session. It has nothing per branch or pull request.
Two ways to put a cost on a pull request
| Tool | Method | Needs |
|---|---|---|
| LangSmith | a session's repository and branch, matched to the pull request | its tracing plugins, GitHub or GitLab connected |
| LangWatch | sessions on the pull request's head branch, summed over its life | GitHub connected |
| Dash0 | total spend ÷ merged pull requests an agent assisted | GitHub or GitLab integration |
| DX | total estimated cost ÷ merged pull requests | Data Cloud and a supported AI tool source |
| Caprock | the branch a session pushed and the pull request it opened, on your machine | the desktop app; GitHub for pull request status |
- Attribution answers "which pull request was expensive, and why". It misses work that never reached a branch, and a session that worked on several pull requests has to be split.
- Division is one figure for a team and needs no per-session data, but it hides the one pull request that cost ten times the rest.
Prices, where each publishes one: LangSmith's Developer plan is free with 5k base traces a month and Plus is $39 a seat a month; LangWatch's Developer plan is free with 50k events a month and Growth is €29 a seat a month, and it can be self-hosted. Dash0 lists a 14-day trial; DX publishes no price.
What it came to on one Mac
Read from Caprock's own database on one developer's Mac, 29 September to 28 October 2026, at API list price — what the same work would cost on the API, not a bill:
- $7.89
- per merged pull request, dspv/caprock
- $3.04
- per merged pull request, cybrixcc/caprock-web
dspv/caprock: $5,699 over 722 merged pull requests. cybrixcc/caprock-web: $589 over 194 merged pull requests. That is the division method, project cost over pull requests merged in the window. In the seven days to 16 October 2026, dspv/caprock merged 45 pull requests for $343.78 of agent cost, $7.64 each, and the dearest one, #720, cost $71.13 — the spread an average hides. More on these figures: FinOps for coding agents.
What Caprock adds: the join, on your machine
Caprock is a free, open-source desktop app for macOS, Windows and Linux that records every Claude Code, Codex and OpenCode session on the machine, the ones started in your own terminal included, and prices each turn at list price as it is written:
- Session to pull request. A session's pull requests are found from the pull requests it opened and the branches it pushed; a pull request opened by a script gets the cost of the one session running a shell command in that repository at that moment, or stays unattributed.
- Shared sessions are split. A session that worked on several pull requests is divided between them and marked shared; every session is charged once.
- Per release. Each release costs what the pull requests it shipped cost, and the Pipeline lists the most expensive pull requests and releases.
- Local. The join happens on your machine; GitHub is read with your own token or
ghfor pull request status and CI.
The Pipeline is part of the free app. Every figure is at API list price, an estimate rather than your bill.
Which to use
- OpenTelemetry into your own backend — you already run one and will write the join yourself.
- LangSmith or LangWatch — a team that wants per-pull-request cost in a hosted tool, across developers.
- Dash0 or DX — one average per team, next to other engineering metrics.
- Caprock — your own machine, per pull request and per release, with no account; the join is done locally.
Questions people ask
- Does Claude Code report cost per pull request?
- No. Its OpenTelemetry export has a cost metric and a count of pull requests, but no attribute links the two, and the Team and Enterprise analytics dashboard shows pull requests with Claude Code but no cost.
- How do you calculate AI cost per pull request?
- Two ways: follow each session's branch to the pull request it became and add up those sessions (LangSmith, LangWatch, Caprock), or divide total spend by merged pull requests (Dash0, DX). The first tells you which pull request was expensive; the second is an average.
- What does an AI coding agent cost per pull request?
- It depends on the repository and the work. On one developer's Mac, 29 September to 28 October 2026, at API list price, it was about $7.89 per merged pull request in one repository and $3.04 in another.
- Can ccusage show cost per pull request?
- No. ccusage reports by day, week, month, session, 5-hour block and project; it has nothing per branch or pull request.
Sources
- Claude Code docs — Monitoring usage (OpenTelemetry): claude_code.cost.usage, pull_request.count, read 27 November 2026
- Claude Code docs — Analytics: contribution metrics, read 27 November 2026
- LangSmith docs — Coding agents: track pull requests, read 27 November 2026
- LangChain — LangSmith pricing, read 27 November 2026
- LangWatch docs — Coding agents: pull requests, read 27 November 2026
- LangWatch — pricing, read 27 November 2026
- Dash0 docs — Darkplane: track cost, read 27 November 2026
- DX docs — AI cost management, read 27 November 2026
- ryoppippi/ccusage on GitHub, read 27 November 2026
- Caprock CHANGELOG — 0.153.0 release cost, 0.157.0 one cost per pull request, 0.158.0 script-opened pull requests, 0.179.1
- Caprock docs — Pipeline: costs at API list price, shared sessions (docs/app.md)
Try it
The record of every coding agent you run, the sessions it did not start included. Free, open source; nothing leaves your machine.
Caprock is a desktop app: it installs on your computer, not your phone.
Or email yourself the link:
macOS, Windows and Linux. Your phone pairs with it by QR code. Install options →
Notarized by Apple. One file for Apple silicon and Intel, macOS 13 or later.
Windows 10 22H2 or later, x64. Windows may ask once whether to run it: click More info, then Run anyway.
Paste it into Claude Code, Codex or any coding agent.
See what it says ▾
Install the Caprock desktop app for me. It is open source (Apache-2.0), a local app for my coding agents: https://github.com/dspv/caprock What the install does and how to remove it: https://github.com/dspv/caprock/blob/master/docs/install-agent.md Run the install script for my system: https://caprock.dev/mac.sh, /win.ps1 or /linux.sh. Read it before you run it if you like. Leave my Claude Code settings alone; the app asks me itself. Tell me when it's open.
Or run it yourself:
Paste in Terminal: it installs Caprock and opens it.Or with Homebrew: brew install --cask dspv/tap/caprock-app
Or run it yourself:
Paste in PowerShell: it installs Caprock for you and opens it.
Or run it yourself:
Paste in a terminal: it installs Caprock for you, no sudo. Or download the AppImage