feat(pricing): add Bedrock rows for Opus 4.8/4.7 and Sonnet 5 - #62327
feat(pricing): add Bedrock rows for Opus 4.8/4.7 and Sonnet 5#62327pgregg88 wants to merge 1 commit into
Conversation
`_OFFICIAL_DOCS_PRICING` had no bedrock rows for the current-gen Claude models, so `us.anthropic.claude-opus-4-8`, `-opus-4-7`, and `-sonnet-5` sessions priced as `unknown` on `/usage` — the NousResearch#50295 symptom, for the newest models specifically. Reproduce on main: from agent.usage_pricing import get_pricing_entry url = "https://bedrock-runtime.us-east-1.amazonaws.com" get_pricing_entry("us.anthropic.claude-opus-4-8", provider="bedrock", base_url=url) # None get_pricing_entry("us.anthropic.claude-sonnet-5", provider="bedrock", base_url=url) # None Rates are keyed to Anthropic's published list price (https://docs.anthropic.com/en/docs/about-claude/pricing + https://claude.com/pricing), which commercial Bedrock on-demand mirrors for the Claude line — the existing sonnet-4-5/4-6 rows already match Anthropic list exactly ($3/$15, cache $0.30/$3.75): Opus 4.8 / 4.7: $5 in / $25 out, cache-write $6.25 (5m TTL), cache-read $0.50 Sonnet 5: $3 in / $15 out, cache-write $3.75, cache-read $0.30 Sonnet 5 uses the STANDARD rate ($3/$15), not the promotional launch price ($2/$10 through 2026-08-31), so the snapshot does not silently under-report after the promo ends. Provenance note (in-code): AWS GovCloud carries a ~20% premium (Opus 4.8 = $6/$30 there), and the AWS Price List API had NOT published these SKUs machine-readably as of the 2026-07-07 us-east-1 offer, so these are the commercial-list figures pending an authoritative AWS machine source. Complements (does not overlap) open PR NousResearch#46299, which adds cache-cost fields to the *existing* rows; this adds *new* rows. Orthogonal to the `-v1` suffix normalizer change. Test: test_bedrock_current_gen_claude_rows_resolve asserts each model resolves via bare id + cross-region prefix, carries cache fields, and is well-formed (output > input). Full file: 16 passed; ruff clean. E2E: a cached opus-4-8 session now estimates $1.13 instead of unknown.
teknium1
left a comment
There was a problem hiding this comment.
Thanks for isolating the missing-row facet; the live main pricing table still lacks Bedrock entries for these models (agent/usage_pricing.py:515-561).
Problems
- The Sonnet 5 row records the post-promotion
$3/$15rate atagent/usage_pricing.py:607-610. AWS currently states that$2/$10applies through 2026-08-31, so this would overstate current/usageestimates. - AWS documents
au.anthropic.claude-opus-4-8as a Geo inference ID, but_normalize_bedrock_model_name()only stripsus.,global.,eu.,ap., andjp.(agent/usage_pricing.py:692). That model ID will still miss the new bare key.
Suggested changes
- Encode the currently billed Sonnet 5 promotional pricing (with AWS-confirmed cache values), then update to the standard rate after the promotion.
- Add
au.to the normalizer and cover it intest_bedrock_current_gen_claude_rows_resolve.
Automated hermes-sweeper review.
| "anthropic.claude-sonnet-5", | ||
| ): PricingEntry( | ||
| input_cost_per_million=Decimal("3.00"), | ||
| output_cost_per_million=Decimal("15.00"), |
There was a problem hiding this comment.
AWS's Bedrock pricing page says Sonnet 5 is currently $2/$10 per million input/output tokens through 2026-08-31. This $3.00/$15.00 standard-rate row will overstate /usage until then; please use the active rate (and corresponding confirmed cache rates) or defer this row until the promotion ends.
… $5/$25 Adds current-gen Claude Opus pricing rows on Bedrock keyed to Anthropic's published list price, which commercial Bedrock on-demand mirrors. Also corrects the existing Opus 4.6 row: it carried Claude-3-era Opus pricing ($15/$75); Opus 4.5+ list at $5/$25 with cache write 1.25x / read 0.1x. The AWS Price List API had not published these SKUs machine-readably as of 2026-07, so these are commercial-list snapshots pending an authoritative machine source. Reapplied from PR #62327 (commit authored under a placeholder identity, so cherry-pick was not usable; sonnet-5 row from that PR already landed via #67932). Co-authored-by: pgregg88 <4943027+pgregg88@users.noreply.github.com>
|
Merged via PR #67976 — your Opus 4.8/4.7 pricing rows landed (and prompted a correction of the existing Opus 4.6 row, which still carried Claude-3-era $15/$75), credited via Co-authored-by. The sonnet-5 row had already landed via #67932. Your test matrix for cross-region resolution was carried over nearly verbatim — good test design. Note on attribution: your commit was authored under a placeholder identity ( |
… $5/$25 Adds current-gen Claude Opus pricing rows on Bedrock keyed to Anthropic's published list price, which commercial Bedrock on-demand mirrors. Also corrects the existing Opus 4.6 row: it carried Claude-3-era Opus pricing ($15/$75); Opus 4.5+ list at $5/$25 with cache write 1.25x / read 0.1x. The AWS Price List API had not published these SKUs machine-readably as of 2026-07, so these are commercial-list snapshots pending an authoritative machine source. Reapplied from PR NousResearch#62327 (commit authored under a placeholder identity, so cherry-pick was not usable; sonnet-5 row from that PR already landed via NousResearch#67932). Co-authored-by: pgregg88 <4943027+pgregg88@users.noreply.github.com>
Problem
_OFFICIAL_DOCS_PRICINGhas no bedrock rows for the current-gen Claude models, sous.anthropic.claude-opus-4-8,-opus-4-7, and-sonnet-5sessions reportTotal cost: unknownon/usage. This is the newest-models facet of #50295.Reproduce on
main(291eae63b):Fix
Add three rows keyed on the bare
anthropic.claude-*id (cross-region prefixes resolve via the existing normalizer):Sourcing. Rates are keyed to Anthropic's published list price (docs.anthropic.com + claude.com/pricing), which commercial Bedrock on-demand mirrors for the Claude line — the existing
sonnet-4-5/sonnet-4-6rows in this table already match Anthropic list exactly ($3/$15, cache $0.30/$3.75).Provenance caveat (also in an in-code comment): AWS GovCloud carries a ~20% premium (Opus 4.8 = $6/$30 there), and the AWS Price List API had not published these SKUs machine-readably as of the 2026-07-07
us-east-1offer (only Claude 2/3 are listed). So these are the commercial-list figures pending an authoritative AWS machine source. If a maintainer has confirmed commercialus-east-1Bedrock numbers that differ, those should win.Sonnet 5 uses the STANDARD rate ($3/$15), not the promotional launch price ($2/$10 in effect through 2026-08-31), so the snapshot doesn't silently under-report after the promo ends — matching the steady-state convention of every other row.
Scope / relationship to other work
-v1/date-suffix normalizer fix (separate PR). This test intentionally sticks to id shapes that resolve onmain(bare +us./global.prefix) so it's independent of that change.anthropic.claude-opus-4-6row ($15/$75, which predates Opus 4.6's actual $5/$25 list price) — flagged in Bedrock Claude /usage shows cost unknown — pricing table lacks cache cost fields + cross-region prefix normalization #50295 as a separate correctness fix to avoid conflicting with fix(bedrock): add prompt-cache pricing to Claude Bedrock entries #46299's edits to that row.Test
test_bedrock_current_gen_claude_rows_resolveasserts each model resolves via bare id + cross-region prefix, resolves to the same entry across id shapes, carries cache fields, and is well-formed (output > input) — an invariant check, not frozen literals.tests/agent/test_usage_pricing.py: 16 passed. Ruff clean. E2E: a cached Opus 4.8 session that previously priced asunknownnow estimates ~$1.13.