Guides / track llm cost anthropic

How to track LLM cost on Anthropic

Anthropic splits streamed usage across two events, one carrying input and a later one carrying output, and it's the only provider here that charges to create a cache. Culpa, a local-first LLM cost, margin, and forecast ledger, meters both cache writes and cache reads as separate quantities, and takes the cheaper reading whenever the response leaves the cache duration unstated.

Why this happens

Anthropic's response shape carries more cost-bearing detail than any other, which is a benefit and an exposure at once. Cache creation bills above the input rate and cache reads bill far below it, so a ledger that folds them together gets the direction of its own error wrong. Streaming makes it harder again, because the input count arrives at the start of the message and the final output count arrives at the end. Capture that sees only one of those events holds half the arithmetic.

What this usually looks like

  • Cache writes and cache reads are one number in your reporting, or one of them is absent.
  • Streamed calls carry an input count with no output count, or the reverse.
  • Your cache spend looks flat while your prompts are being rebuilt constantly.
  • Nobody can say which cache duration your calls actually used.

Free, no card, no account

Run the free Cost Leak Scan

It shows your most expensive conversation before you install anything.

Run a free scan

Mistakes that cost the most

MistakeWhy it hurtsDo instead
Treating cache creation as if it were a cache read.A write bills above the input rate and a read bills at a tenth of it, so folding them inverts the sign of the effect.Keep them as separate quantities all the way through, because they price in opposite directions.
Capturing only the first event of a streamed message.You get input tokens and no output tokens, on a model where output bills five times input.Capture through to the final event, and check that both counts land on a streamed call.
Reading an unstated cache duration as the cheaper one and moving on.It's a deliberate floor, so the real cost can be higher and your forecast inherits the optimism.State the duration explicitly on your requests so the ledger prices the one you actually used.

Run this check tonight

  1. Check that cache writes and cache reads appear as two quantities rather than one.
  2. On a streamed call, confirm both an input count and an output count arrived.
  3. Look at whether your requests state a cache duration at all.
  4. Total your cache-creation tokens for a month and price them at both durations.
  5. Treat the gap between those two totals as the exposure your floor is absorbing.

What an unstated cache duration costs a forecast

Illustrative example

20 million cache-creation tokens a month on Claude Opus 4.8, at real rates of $5.00 per million input, $6.25 for a five-minute cache write and $10.00 for a one-hour write. Volumes are modelled.

Priced at the five-minute write rate: 20 x $6.25 = $125.00
Priced at the one-hour write rate: 20 x $10.00 = $200.00
With no duration stated the ledger takes the five-minute rate, so it records $125.00
If the calls were really one-hour caches, the floor sits $75.00 below the truth
The floor errs downward on purpose, because a number that reads low and says so beats one that reads high and doesn't

A $75 gap on $200 of cache creation, absorbed deliberately rather than guessed away. State the duration on your requests and the floor stops being needed.

Every number, with its confidence and source

FigureWhat it meansConfidenceSource
$125.00 to $200.00modelled monthly cost of 20M cache-creation tokens at the five-minute against the one-hour write rateestimatedBoth endpoints at real Claude Opus 4.8 cache-write rates from the price book, effective 2026-07-02. A range because the cache-creation volume is modelled.
$75.00modelled exposure absorbed by taking the cheaper write rate when the duration is unstatedcalculated$200.00 minus $125.00, from the teardown arithmetic at real price-book rates.

What a generic answer can’t know

The provider bills a cache write correctly and tells you nothing about which of your prompts keeps rebuilding one. Matching write volume to the feature that caused it needs the call and your own prompt structure side by side. Culpa holds both on your infrastructure, keeps your prompts and responses there, and counts the calls to run your plan.

Questions founders ask next

Why does Anthropic capture need more care than other providers?

Because its responses carry more cost-bearing fields. Cache creation and cache reads price in opposite directions from plain input, and on a streamed message the input and output counts arrive in different events, so partial capture produces partial arithmetic.

What happens when a response doesn't say which cache duration was used?

The cheaper five-minute write rate is applied, which makes the recorded figure a floor. That's the conservative direction by design, so a missing detail can never inflate your reported spend.

Is Anthropic the only provider that charges for cache writes?

Among the providers in Culpa's price book, yes. OpenAI doesn't charge to create a cache, and Gemini's caching bills for storage time rather than for written tokens, which puts it outside token accounting altogether.

On your infrastructure

Culpa runs on your infrastructure. Your prompts and responses never leave it. Culpa counts calls to run your plan, and it fails open, so if it ever breaks your app keeps running.


How Culpa works

Find the culprit. Not just the total.

Your dashboard shows what you spent. It stops short of who spent it. Culpa shows the conversation, the user and the feature behind it.

Your prompts stay local.

Culpa runs on your own infrastructure. What you send to a model reaches us at no point.

Every dollar has a name.

Follow any charge to the conversation, the user, the feature and the customer behind it.

See the bill before it lands.

Cost your next feature before you ship it. You get the likely bill and the worst case, at best, median, p90 and p99.

Three steps to your first answer.

1

Change one base URL.

Or drop in the Python or TypeScript library.

2

Find your most expensive conversation.

In the first session, not the first week.

3

Cost your next feature before you ship it.

Base URLhttp://localhost:4545/v1Your traffic keeps flowing if Culpa ever stops.

Why the bill went up

Example dashboard

Calls traced

418,209

across 3 projects

Spend this week

$378.41

+ $182 vs last week

Failed calls

312

74% retried, and you paid for all of them

+ $182 this week traced to one culprit

Spend over 14 days

$0$20$40$60$8024262830020406
user_384report_generatorconv_91fprompt_v1894,220 tokens3 retries$6.81

Most expensive users

user_384$38.42
user_119$21.07
user_562$14.90
user_204$8.30
user_871$5.10

Next week forecast

Best$180
Median$240
p90$310
p99$395

Graded against reality. Accuracy shown as results land.

Free, no card, no account

Run the free Cost Leak Scan

It shows your most expensive conversation before you install anything.

Run a free scan

Keep reading


Sources: Anthropic pricing. Last reviewed 2026-08-02. Plain text version.