DEV Community

Cover image for Your Anthropic bill doesn't fit FOCUS. Here's how to convert it (and the cached-token trap)
Mandar S
Mandar S

Posted on

Your Anthropic bill doesn't fit FOCUS. Here's how to convert it (and the cached-token trap)

FOCUS is the FinOps Foundation's open billing format. AWS, Azure and Google Cloud can export it, so cloud costs from different providers land in the same columns. AI providers don't export it yet, and their CSVs don't map cleanly.

The cached-token trap

Anthropic's Console splits input tokens into four buckets, each at a different price:

Token type Price relative to base input
Uncached input 1x
Cache read 0.1x
Cache write, 5 minutes 1.25x
Cache write, 1 hour 2x

OpenAI does it differently: cached tokens are counted inside prompt tokens. If you treat both exports the same way, you either count cached input twice (OpenAI) or lose the cache writes (Anthropic). Cache writes are billed, not just reported, which surprises people.

One row per meter

The fix is to give every token type its own row, its own SKU and its own unit price, like a cloud bill does for each meter. Here's one real day from my own October Anthropic export after conversion (a few of the 40 columns shown; prices are per million tokens):

ChargePeriodStart SkuId SkuMeter ConsumedQuantity ListUnitPrice BilledCost
2026-10-28 anthropic/claude-sonnet-4-5/input Input Tokens 52 3.00 0.000156
2026-10-28 anthropic/claude-sonnet-4-5/cache-read Cache Read Input Tokens 5,775 0.30 0.0017325
2026-10-28 anthropic/claude-sonnet-4-5/cache-write-5m Cache Write Input Tokens (5 min) 1,925 3.75 0.00721875
2026-10-28 anthropic/claude-sonnet-4-5/output Output Tokens 16 15.00 0.00024
2026-10-28 anthropic/claude-haiku-4-5/cache-write-5m Cache Write Input Tokens (5 min) 23,016 1.25 0.02877

Look at the Sonnet rows: 52 uncached input tokens, but 7,700 tokens went through the cache. A converter that only reads "input tokens" reports 52 and misses most of that day's input cost. The 1-hour cache write gets its own .../cache-write-1h row when it appears; this month's file didn't have any.

The total of the rows has to match the provider's own figure. If the computed price doesn't round to the cost in the export, the converter trusts the provider's number and records that it did so.

For the whole month: 41 rows, $1.06 in FOCUS BilledCost against $1.06 on Anthropic's own cost export.

Try it

For Anthropic, pass both the Cost and the Usage exports from the Console:

npx ai-bill-to-focus convert cost.csv usage.csv -o focus.csv
npx ai-bill-to-focus check focus.csv
Enter fullscreen mode Exit fullscreen mode

Or in the browser, where the file never leaves your machine: https://www.cognocient.com/tools/focus-checker

What isn't tested yet

Anthropic is tested on real Console exports. OpenAI and Together AI are built from their published formats, and I haven't had a real file. If you have one, npx ai-bill-to-focus report <your files> prints a summary with no dollars or account names that you can paste into an issue.

Repo (MIT): https://github.com/mandarvshinde/ai-bill-to-focus

I build Cognocient AI, which tracks AI spend per feature, team and customer. This tool is standalone and needs no account.

Top comments (0)