fix: add Claude 5 models to output-price table - #744
Open
greenmile92 wants to merge 1 commit into
Open
Conversation
priceForModel() matched only claude-3/4 prefixes, so every Claude 5 id returned null and formatStats dropped the "Est. saved (USD)" line and the statusline savings suffix. Sessions on claude-opus-5 (the current Claude Code default) showed no savings estimate at all. Adds Opus 5 ($25/M), Sonnet 5 ($15/M list), Fable 5 and Mythos 5 ($50/M). Prefixes do not overlap the existing claude-*-4 entries, so Claude 4 pricing is unaffected — pinned by an assertion. Also covers the bracket-suffixed id Claude Code actually reports for the 1M-context variant (claude-opus-5[1m]), which is what surfaced this. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019TUPyH44JsgchW1iJ5DZ6K
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.
Problem
priceForModel()matches by prefix againstclaude-3*andclaude-4*only.Every Claude 5 model id therefore falls through to
null, which makesformatStats()drop theEst. saved (USD)line and the statusline savingssuffix entirely.
Since
claude-opus-5is the current Claude Code default, this means/caveman-statsshows no dollar estimate at all for most users right now —silently, with no error.
Fix
Adds the four Claude 5 entries at the top of
MODEL_OUTPUT_PRICE_PER_M:Sonnet 5 is listed at its
$15/Mrate card; there is an introductory$10/Mprice through 2026-08-31, noted in a comment rather than hard-codedso the table doesn't silently expire.
The new prefixes do not overlap the existing
claude-*-4entries, so Claude 4pricing is untouched — pinned by an assertion in the new test.
Tests
New case
priceForModel covers the Claude 5 generationintests/test_caveman_stats.js, including the bracket-suffixed id Claude Codeactually reports for the 1M-context variant (
claude-opus-5[1m]) — thatvariant is what surfaced the bug.
node --test tests/*.js→ 7/7 files passnpm test(installer suite) → 112/112 pass🤖 Generated with Claude Code
https://claude.ai/code/session_019TUPyH44JsgchW1iJ5DZ6K