Skip to content

fix: claude_sonnet_5 was priced 50% high — fold into 0.16.6 - #154

Merged
yuanhao merged 1 commit into
release/0.16.xfrom
fix/0.16.x-sonnet-price
Aug 22, 2026
Merged

fix: claude_sonnet_5 was priced 50% high — fold into 0.16.6#154
yuanhao merged 1 commit into
release/0.16.xfrom
fix/0.16.x-sonnet-price

Conversation

@yuanhao

@yuanhao yuanhao commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Folds into the unreleased 0.16.6, which is merged to release/0.16.x but not yet tagged.

The drift

claude_sonnet_5 carried Sonnet 4.6's entire price row on this line:

field was correct ratio
input $3.00 $2.00 1.5×
output $15.00 $10.00 1.5×
cache read $0.30 $0.20 1.5×
cache write $3.75 $2.50 1.5×

Uniformly 1.5× is the signature of a whole row copied from the previous model. It shipped from v0.9.0 through v0.16.5 — 18 releases — overstating every cost_usd and session_cost_usd for the model by half, with nothing in the crate able to detect it.

Verified against Anthropic's pricing page and models.dev (2 / 10 / 0.2 / 2.5, no tiers) rather than copied from main.

The test was part of the problem

test_new_generation_presets pinned sonnet.cost.output_per_million == 15.0 — one field of four — so it failed on this change and had to be corrected. But a one-field assertion is how the original error survived, and it would let a partial correction pass just as quietly. It now pins all four.

Mutation-checked: leaving cache_read stale at 0.3 while fixing the rest fails it.

Scope note

The drift alarm that catches this class of error — tests/price_audit.rs, which diffs every priced preset against models.dev — is 0.18.0-only. This line now has the corrected numbers but not the guard, so future drift here is again undetected. Back-porting the audit is a larger change and not attempted here.

518 tests, clippy clean under -Dwarnings.

🤖 Generated with Claude Code

The preset carried Sonnet 4.6's entire price row — $3/$15 with
$0.30/$3.75 cache rates, uniformly 1.5x the real figures — from v0.9.0
through v0.16.5. Every cost_usd and session_cost_usd for that model
overstated spend by half, across 18 releases.

Now $2/$10 with $0.20/$2.50, verified against Anthropic's pricing page
and models.dev on 2026-08-23 rather than copied from main.

test_new_generation_presets pinned only output_per_million, so it failed
on this change and had to be corrected — but a one-field assertion is how
the original error survived, and would let a partial correction pass just
as quietly. It now pins all four rates. Mutation-checked: leaving
cache_read stale at 0.3 fails it.

Corrected on the 0.18.0 line by #121; this back-ports it. The drift alarm
that catches this class of error (tests/price_audit.rs) is 0.18.0-only,
so this line has the corrected numbers but not the guard.

518 passed, clippy clean under -Dwarnings.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@yuanhao
yuanhao merged commit f70785c into release/0.16.x Aug 22, 2026
5 checks passed
@yuanhao
yuanhao deleted the fix/0.16.x-sonnet-price branch August 22, 2026 23:07
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