Skip to content

fix: add Claude 5 models to output-price table - #744

Open
greenmile92 wants to merge 1 commit into
JuliusBrussee:mainfrom
greenmile92:fix/claude-5-pricing
Open

fix: add Claude 5 models to output-price table#744
greenmile92 wants to merge 1 commit into
JuliusBrussee:mainfrom
greenmile92:fix/claude-5-pricing

Conversation

@greenmile92

Copy link
Copy Markdown

Problem

priceForModel() matches by prefix against claude-3* and claude-4* only.
Every Claude 5 model id therefore falls through to null, which makes
formatStats() drop the Est. saved (USD) line and the statusline savings
suffix entirely.

Since claude-opus-5 is the current Claude Code default, this means
/caveman-stats shows 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:

Model Output $/M
Fable 5 / Mythos 5 50.00
Opus 5 25.00
Sonnet 5 15.00

Sonnet 5 is listed at its $15/M rate card; there is an introductory
$10/M price through 2026-08-31, noted in a comment rather than hard-coded
so the table doesn't silently expire.

The new prefixes do not overlap the existing claude-*-4 entries, so Claude 4
pricing is untouched — pinned by an assertion in the new test.

Tests

New case priceForModel covers the Claude 5 generation in
tests/test_caveman_stats.js, including the bracket-suffixed id Claude Code
actually reports for the 1M-context variant (claude-opus-5[1m]) — that
variant is what surfaced the bug.

  • node --test tests/*.js → 7/7 files pass
  • npm test (installer suite) → 112/112 pass

🤖 Generated with Claude Code

https://claude.ai/code/session_019TUPyH44JsgchW1iJ5DZ6K

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant