fix(core): add pricing for current Claude models - #13078
Open
asjad3 wants to merge 1 commit into
Open
Conversation
calculateAnthropicCost returns null for any model missing from its prefix table, which means no cost is displayed at all. The table stopped at Opus 4.6 and Sonnet 4.6, so Opus 5/4.8/4.7, Sonnet 5, Sonnet 4.5, Haiku 4.5 and Fable 5 all showed nothing. Also corrected three comments that named the wrong model.
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
calculateAnthropicCostmatches the model against a prefix table and returnsnullwhennothing matches, so any model missing from the table shows no cost at all in the Console's
usage panel and in the CLI's per-request summary.
The table stops at Opus 4.6 / Sonnet 4.6, so most of the Claude models people are actually
running today fall through it:
claude-opus-5claude-opus-4-8claude-opus-4-7claude-sonnet-5claude-sonnet-4-5claude-haiku-4-5claude-fable-5Sonnet 4.5 and Haiku 4.5 are the ones I'd expect to bite people most — Opus 4.5 is in the
table but the two Claude 4.5 models next to it never were.
Cache-write and cache-read rates follow the same 1.25x / 0.1x relationship to input price
that every existing row uses.
Also relabelled three comments that named the wrong model (
claude-3-opuswas commented"Claude Opus 4 (legacy)",
claude-3-5-sonnetwas "Claude Sonnet 4"). Comments only, nobehaviour change.
Prices are Anthropic's list prices. Sonnet 5 currently has promotional input/output pricing
running to 2026-08-31; I used the list price rather than the promo, since the table has no
way to express a time-boxed rate and the promo expires shortly.
Checklist
Screen recording or screenshot
Not applicable — no UI change. The affected surfaces (
TotalUsage.tsx,useLLMSummary,useTotalUsage, and the CLI'sstreamChatResponse.helpers) all just consume the returnvalue of
calculateRequestCost, which was previouslynullfor these models.Tests
Added 8 cases to
calculateRequestCost.vitest.tscovering each newly-priced model, plus acombined cache-read + cache-write case for Opus 5.
With the test file kept and the change to
calculateRequestCost.tsstashed, exactly the 8new cases fail (
8 failed | 22 passed), so they're pinning the fix rather than passingeither way.
The existing
claude-unknown-model->nullcase still passes; none of the added prefixesmatch it.
Written with AI assistance (Claude Code); I reviewed the change and ran the tests above.