Skip to content
Agentic Control Plane

Claude Code Cost Tracking: What Exists, What's Missing, and How to Meter Every Session

David Crowe David Crowe · · Updated · 13 min read
claude-code cost tokens reference
Share X HN LinkedIn
The ACP Cost page for one week: $1,353 spent with the change against the week before, sessions, per-session average and cache hit, and spend by day stacked by model — Fable, Sonnet, Opus — with the prior week as a dashed line

Update, September 2026: the Cost page above is what the console opens on now. It shows the week against the week before, spend by day by model, and the levers to pull. The session X-ray below is where you take apart a single run.

Session cost X-ray of a real working day: $472.03 at API rates, 1,052 loop turns, 100% loop tax at a 100% cache hit rate, the cumulative bill curve, and 3,744 free tool calls beneath it — with 4,790 allowed, 6 denied, 115 PII findings

Just want the answer? Claude Code estimates a session total. It doesn't price calls. The ACP hook does, from the transcript Claude Code already writes:

curl -sf https://agenticcontrolplane.com/install.sh | bash
claude   # every model turn priced from the transcript; session X-ray in the console

Optional: launch with claude-acp to also route model calls through the proxy. On exit it prints the session total with a link to the breakdown:

ACP · session: 276 model calls · 1,697 tool calls · $148.16 @ API rates
→ https://cloud.agenticcontrolplane.com/sessions/…

Full Claude Code setup (both planes) →  ·  get a workspace key →

Claude Code does more on cost than most harnesses. It gives you an estimated session cost, a dollar figure in the status line, and a cost metric over OpenTelemetry. It won’t price a single call, show where in the session the money went, or give you a number that means much on a Max subscription.

This page covers what you can see natively, what each surface leaves out, and the setup that fills the gap.

What Claude Code shows natively

  • /usage. The Session block shows total estimated cost, API duration and usage by model. On Pro, Max, Team and Enterprise plans it also shows plan-usage bars and a breakdown by skills, subagents, plugins and MCP servers. The docs say the session cost figure is meant for API users. On a subscription it “isn’t relevant for billing.” Older builds called this /cost.
  • The status line. A statusLine script gets JSON on every refresh, including cost.total_cost_usd, cost.total_duration_ms, cost.total_api_duration_ms, context_window.used_percentage, rate-limit percentages on subscription plans, and a prompt_cache block after the first response. You get one running total per session.
  • OpenTelemetry. Set CLAUDE_CODE_ENABLE_TELEMETRY=1 plus the OTEL_* exporter variables and Claude Code emits claude_code.cost.usage (USD) and claude_code.token.usage (split into input, output, cache read and cache creation), tagged by model. With the logs exporter on, it also emits claude_code.tool_result and claude_code.tool_decision events per tool call. It’s the fullest native option, and it needs a collector to receive it.
  • Session transcripts. Every session writes a JSONL file under ~/.claude/projects/. Community tools such as ccusage read those files and total the tokens against a price list. The schema isn’t documented, so those tools follow the format, not an API.

So the native answer to “what did that session cost?” is an estimated total, with a caveat on subscriptions. That beats nothing, but it isn’t attribution.

What a session total can’t tell you

  1. Which calls the money went to. A session is a few hundred model calls. The total says $148.16. It doesn’t say the last 28 turns bought 10% of the output, or that one re-read of a large file cost more than the edit after it. For that you need a price on each call when it happens.
  2. Loop versus leaf. In agent sessions the bill is mostly the orchestration loop re-reading its own context to pick the next step, not the leaf work that produces answers. In our July research corpus (285,814 metered calls across our own workspaces) the loop was 97% of spend. A token total can’t separate the two. Per-call tagging can, and it changes which model you put on the loop.
  3. Cache cost per call. Cached input is billed at a fraction of the full rate, so two sessions with the same token count can differ several-fold in dollars. The status line’s prompt_cache block gives you the session’s overall shape. Only per-call metering shows the turn where the cached prefix stopped matching.
  4. The whole team. The native surfaces are per machine and per session. Cost by agent, by person, and run to run across a team isn’t in Claude Code.
  5. A cap. Claude Code has no budget. A runaway loop shows up on next month’s statement, or in the rate-limit bar after the money is gone.

The setup

There are two ways to get per-call cost. The first needs only the hook.

From the transcript (default). Every PostToolUse hook call carries transcript_path, and the session JSONL records each assistant turn’s input_tokens, cache_read_input_tokens, cache_creation_input_tokens, output_tokens and model. The installed ACP hook reads the turns it hasn’t reported yet and sends them along with the tool-output report it already makes. The gateway prices each turn at list rates with cache rates applied. You run plain claude, with no launcher or env var. On a subscription the figures are API-rate equivalents. The turns land beside tool calls as loop turns, so the Session X-ray, the loop-versus-leaf split and the daily ledger treat them like proxied calls.

Through the proxy (optional). The proxy adds what a transcript can’t give you: policy on the model call itself and the declared tool surface, read from request bodies. The installer writes a launcher for it, ~/.acp/bin/claude-acp. It sets the base URL and the workspace key for that launch only and forwards your own Claude login unchanged, so don’t set those variables by hand. Plain claude keeps its normal model path and is still priced from the transcript. Through the launcher, a Max or Pro login stays subscription traffic and an API key stays API traffic. The usage fields on the way back are priced at list rates, and each call lands as a row in the console with model, tokens, cached share, dollars, and whether it was a loop turn or leaf work. If ACP is unreachable, the launcher starts plain claude.

When a claude-acp session exits, it prints the session’s bill and a link to its cost X-ray:

ACP · session: 276 model calls · 1,697 tool calls · $148.16 @ API rates
→ https://cloud.agenticcontrolplane.com/sessions/…

That line is from a real working day on a Max subscription. The page it links to shows the curve.

Subscription and API-key billing

The proxy doesn’t change who pays. A subscription login is forwarded unchanged, and Anthropic bills the subscription as before. ACP labels every dollar figure for that traffic as an API-rate equivalent: what the same tokens would have cost through the API, not a charge. API-key traffic is billed by Anthropic at standard rates. ACP doesn’t mark up your tokens.

Budget limits

Claude Code has none. Through the proxy, workspace-billed traffic is subject to your workspace’s daily LLM cost cap, enforced at the gateway before the call goes upstream. Subscription and bring-your-own-key traffic is billed or quota-limited by Anthropic. ACP meters it but can’t enforce a cap on an account it doesn’t hold.

Troubleshooting

Calls work but nothing appears in the console. Launch with claude-acp and check that ~/.acp/credentials holds your workspace key. The proxy needs that key to attribute the call, and without it the request gets a 401. If you only want transcript pricing, check that the hook is installed and that you’re signed in to the workspace.

/usage and the console disagree. They measure different things. /usage is Claude Code’s own estimate for the session. The console prices each call from the usage fields in the transcript or API response. On a subscription, only the console figure is labelled as an API-rate equivalent.

The status line shows cost but the console shows nothing. The status line reads Claude Code’s internal estimate and works with no ACP at all. Console rows need the hook installed, or the session launched through claude-acp. A launcher run in one shell doesn’t cover a session started from an IDE.

OTel metrics stopped after I changed the base URL. Probably unrelated. The docs note ANTHROPIC_BASE_URL isn’t passed to spawned subprocesses, but telemetry export is set by the OTEL_* variables. Check the collector endpoint first.

What this pairs with

Cost is one of two planes. The other is controlling what Claude Code does, through the PreToolUse hook covered in the Claude Code hooks reference. They’re separate: the hook sees tool calls and not token usage, while the proxy sees model calls and not what your shell ran. Ways to set up ACP wires both and tells you which planes you have.

Frequently asked questions

Does Claude Code track cost?

It estimates it. /usage shows a session total at list rates, the status line can display cost.total_cost_usd, and OpenTelemetry emits a claude_code.cost.usage metric. On a Pro or Max subscription the docs say the session figure isn’t relevant for billing. None of these price an individual call, split the orchestration loop from the leaf work, or roll up across a team’s agents.

How do I see what a Claude Code session actually costs at API rates?

Install the ACP hook. Claude Code hands it the session transcript, which records every model turn’s tokens and model. The hook reports each new turn and ACP prices it at list rates with cache rates applied. Plain claude sessions are priced with no launcher and no env var. The claude-acp launcher adds the proxy path, for policy on the model call and the declared tool surface.

Does this work on a Max or Pro subscription?

Yes. The subscription login is forwarded unchanged, so Anthropic bills you as before. ACP prices each call at API list rates and labels the figures as API-rate equivalents, not charges.

Can I set a budget that stops a Claude Code session?

Not in Claude Code itself. Through the proxy, workspace-billed traffic is subject to a daily LLM cost cap enforced at the gateway before the call goes upstream. Subscription or bring-your-own-key traffic is billed by Anthropic. ACP meters it but can’t cap the upstream account.

What does the loop tax mean for a Claude Code session?

Most of the spend in an agent session is the orchestration loop re-reading its own context to pick the next step, not the answers. In one metered working day, 276 model calls cost $148.16 at API rates and the loop was all of it. A token total can’t show that. Per-call attribution can.

If the hook can't see tokens, how does it price anything?

It reads them from the transcript Claude Code writes. The PreToolUse hook sees only tool calls. The PostToolUse hook receives transcript_path, and the session JSONL records every model turn’s usage. The proxy sees model requests directly.

Where to read more

Running Claude Code? One command adds a hook. Each tool call is recorded, the session's model calls are priced, and a force-push, destructive SQL or curl | sh waits for your OK in the session.

macOS · Linux · WSL
curl -fsSL https://agenticcontrolplane.com/install.sh | bash
Windows · PowerShell
irm https://agenticcontrolplane.com/install.ps1 | iex

What the installer writes  ·  Claude Code guide  ·  free up to 5 agents

Share X HN LinkedIn
Get the next data drop
What agents actually cost, new tool-surface captures, and the occasional incident post-mortem — sent when we publish something worth your inbox, not on a schedule. Unsubscribe anytime.
Share: Twitter LinkedIn
Related posts

← back to blog