claude-usage icon indicating copy to clipboard operation
claude-usage copied to clipboard

Bug: claude-sonnet-5 cost is calculated with stale ($3/$15) pricing instead of its actual ($2/$10) rate

Open mir-tazbinur-enosis opened this issue 3 months ago • 1 comments

Summary

The "Cost by Model" breakdown appears to be pricing claude-sonnet-5 usage at the old Sonnet 4.x rate ($3 / MTok input, $15 / MTok output) instead of Sonnet 5's actual, permanent rate ($2 / MTok input, $10 / MTok output). This overstates Sonnet 5's estimated cost by roughly 50%.

Evidence

Row from the dashboard for claude-sonnet-5:

Field Value
Turns 8.4K
Input 75.5K
Output 4.96M
Cache Read 1.99B
Cache Creation 28.81M
Displayed Est. Cost $779.2297

Recomputing with Sonnet 5's official current pricing (per Anthropic's pricing page: $2/MTok input, $2.50/MTok 5-min cache write, $0.20/MTok cache read, $10/MTok output):

Line item Calculation Cost
Input 75,500 × $2 / 1,000,000 $0.15
Output 4,960,000 × $10 / 1,000,000 $49.60
Cache read 1,990,000,000 × $0.20 / 1,000,000 $398.00
Cache creation (5m) 28,810,000 × $2.50 / 1,000,000 $72.03
Total ≈ $519.78

That's a ~$259.45 overcount (~50%) on this row alone.

For comparison, if you apply the old Sonnet 4.x rate ($3/$3.75/$0.30/$15) to the same token counts, you get ≈ $779.67 — which matches the dashboard's displayed value almost exactly. This strongly suggests the cost calculator still has Sonnet 5 mapped to the previous Sonnet pricing tier.

Every other row in the same table (Opus 5, Haiku 4.5, Sonnet 4.6, Opus 4.6) reconciles correctly against their documented per-model rates, so this looks isolated to the claude-sonnet-5 price mapping specifically.

Expected behavior

claude-sonnet-5 usage should be billed/estimated at $2 / MTok input, $2.50 / MTok 5-min cache write, $4 / MTok 1-hour cache write, $0.20 / MTok cache read, $10 / MTok output — its actual, permanent rate (the planned increase to $3/$15 on Sept 1, 2026 was cancelled; $2/$10 is the standing price, not a temporary introductory rate).

Actual behavior

claude-sonnet-5 usage is being priced as if it were still $3 / MTok input, $15 / MTok output.

Suggested fix

Update the pricing table/lookup used by the cost calculator so claude-sonnet-5 (and any alias/model-string variants) maps to the $2/$10 rate rather than falling through to the legacy Sonnet 4.x rate.

Reference

https://platform.claude.com/docs/en/about-claude/pricing

mir-tazbinur-enosis avatar Aug 28 '26 05:08 mir-tazbinur-enosis

Fixed the Sonnet 5 pricing lookup so claude-sonnet-5 now uses Anthropic's current /0 pricing instead of falling back to legacy Sonnet 4.x rates. Added regression coverage for exact, suffixed, and variant Sonnet 5 model names, and updated the changelog. Verified with pytest: 143 passed in 1.46s.

HaydenHaines avatar Aug 28 '26 10:08 HaydenHaines