AGENTIC AI · 16 OCTOBER 2026

How to Track AI Coding Agent Costs per Engineer and per Pull Request

For engineering leads who pay for coding agents on their own API keys and want to know what each team, repo and pull request costs.

Quick answer: Seat-priced coding tools are a flat line in the budget. The variable part is agents that run on your own API keys: PR reviewers, CI fixers, coding agents. Track them like any other product feature. Label every call with the agent as the feature and the team or repo as the customer, then divide spend by merged PRs. Cost per merged PR tells you whether an agent is worth what it costs.

Ask an engineering lead what AI coding costs and you usually get the seat count. That's the easy half. The other half arrives on the provider invoice as one number, and nobody can say which team, which repo or which bot spent it.

This is part of our guide to LLM and AI cost optimization.

Two kinds of AI coding cost

Seats. A subscription per developer. Predictable, and listed on each vendor's pricing page. Check whether the plan includes usage limits, and what happens past them.

API-billed agents. Anything that calls a model with your company's API key: a PR review bot, a CI step that fixes failing tests, a coding agent someone runs from the terminal. These scale with tokens, and tokens scale with diff size, repo size and how often the agent runs.

The second kind is where the surprises come from. It's also the part you can measure per team and per PR.

What one PR review costs

A worked example. An agent reviews each PR in five model calls. Each call sends 40,000 input tokens (the diff, the files around it and the instructions) and gets 1,500 tokens back. The model is claude-sonnet-5 at $2 per million input tokens and $10 per million output tokens.

Per call: 40,000 × $2 / 1M = $0.08 for input, and 1,500 × $10 / 1M = $0.015 for output. Five calls make $0.475 per review.

Now turn on prompt caching for the 30,000 tokens that repeat across the five calls (the instructions and the unchanged files). The first call writes them to the cache at $2.50 per million, and the next four read them at $0.20 per million:

CALLCACHED TOKENSUNCACHED INPUTOUTPUTCOST
130,000 written10,0001,500$0.110
2 to 5, each30,000 read10,0001,500$0.041
Total for 5 calls$0.274

Caching takes the review from $0.475 to $0.274, about 42% less. Rates are from each provider's published schedule on 16 October 2026; check today's on the AI API pricing sheet.

From cost per review to cost per merged PR

Reviews run more than once. If the agent re-runs on every push and a PR averages three pushes, one PR costs three reviews. PRs that are closed without merging still cost money.

A team example: 10 engineers open 300 PRs a month, 240 of them get merged, each PR averages 3 review runs, and each run is the cached $0.274 review.

Cost per merged PR is the number to watch. It climbs when agents re-run on every push, when PRs are abandoned, and when the context sent with each call grows. None of that shows in a monthly invoice total. An agent stuck retrying a failing test is the coding version of a runaway agent loop.

How to track it

Label each call with what ran and who it ran for:

With the Node and Python cost tracking SDKs:

import { LLMtrack, fromAnthropicUsage } from 'llmtrack'

const llmtrack = new LLMtrack({
  apiKey: process.env.LLMTRACK_API_KEY,
  onError: (e) => console.warn(e.code, e.message),
})

const res = await anthropic.messages.create({ model: 'claude-sonnet-5', max_tokens: 2000, messages })

llmtrack.track({
  provider: 'anthropic',
  model: res.model,
  feature: 'pr-review',
  customerId: 'team-payments',
  metadata: { pr: 4812, repo: 'api' },
  ...fromAnthropicUsage(res.usage),
})

The dashboard then shows pr-review cost by team, and the cache hit rate per feature shows the day someone edits the agent's instructions and breaks caching. For cost per merged PR, export the month's cost by team as CSV and divide by the merges from your Git host. If your agents call models through a gateway, connect the gateway instead: see all integrations.

Three ways to cut it

FAQ

How much do AI coding tools cost per developer?

Seat prices are on each vendor's pricing page and change often. The variable part, agents on your API keys, depends on tokens per run and runs per PR. The example above comes to about $25 per engineer a month.

What is cost per merge?

Total agent spend in a period divided by the PRs merged in that period. It includes the cost of re-runs and abandoned PRs, which a per-run number hides.

Should we track per engineer or per team?

Per team or per repo is usually enough to act on, and it keeps a cost report from turning into a performance review.

Does our code leave our servers?

Not to LLMtrack. It receives token counts, the model, a feature name, a customer ID and any metadata you add. Keep code and prompts out of metadata.

See what each agent costs per team and per PR from the next run. The free plan includes every feature: start free.

Related guides

Last updated 16 October 2026. Rates quoted were each provider's published rates that day and change often.