Skip to content

feat(pricing): add Bedrock rows for Opus 4.8/4.7 and Sonnet 5 - #62327

Closed
pgregg88 wants to merge 1 commit into
NousResearch:mainfrom
pgregg88:feat/bedrock-pricing-current-gen-claude-rows
Closed

feat(pricing): add Bedrock rows for Opus 4.8/4.7 and Sonnet 5#62327
pgregg88 wants to merge 1 commit into
NousResearch:mainfrom
pgregg88:feat/bedrock-pricing-current-gen-claude-rows

Conversation

@pgregg88

Copy link
Copy Markdown
Contributor

Problem

_OFFICIAL_DOCS_PRICING has no bedrock rows for the current-gen Claude models, so us.anthropic.claude-opus-4-8, -opus-4-7, and -sonnet-5 sessions report Total cost: unknown on /usage. This is the newest-models facet of #50295.

Reproduce on main (291eae63b):

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-opus-4-7", provider="bedrock", base_url=url)  # None
get_pricing_entry("us.anthropic.claude-sonnet-5", provider="bedrock", base_url=url)  # None

Fix

Add three rows keyed on the bare anthropic.claude-* id (cross-region prefixes resolve via the existing normalizer):

Model Input Output Cache write (5m) Cache read
Opus 4.8 $5 $25 $6.25 $0.50
Opus 4.7 $5 $25 $6.25 $0.50
Sonnet 5 $3 $15 $3.75 $0.30

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-6 rows 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-1 offer (only Claude 2/3 are listed). So these are the commercial-list figures pending an authoritative AWS machine source. If a maintainer has confirmed commercial us-east-1 Bedrock 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

Test

test_bedrock_current_gen_claude_rows_resolve asserts 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 as unknown now estimates ~$1.13.

`_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.
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/bedrock AWS Bedrock (boto3, IAM) area/billing Account usage, credit usage, billing (cross-cutting) P3 Low — cosmetic, nice to have labels Jul 10, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/$15 rate at agent/usage_pricing.py:607-610. AWS currently states that $2/$10 applies through 2026-08-31, so this would overstate current /usage estimates.
  • AWS documents au.anthropic.claude-opus-4-8 as a Geo inference ID, but _normalize_bedrock_model_name() only strips us., global., eu., ap., and jp. (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 in test_bedrock_current_gen_claude_rows_resolve.

Automated hermes-sweeper review.

Comment thread agent/usage_pricing.py
"anthropic.claude-sonnet-5",
): PricingEntry(
input_cost_per_million=Decimal("3.00"),
output_cost_per_million=Decimal("15.00"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 11, 2026
teknium1 added a commit that referenced this pull request Jul 20, 2026
… $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>
@teknium1

Copy link
Copy Markdown
Contributor

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 (hermes@covered-call-strategy.local), which we can't cherry-pick with authorship — check git config user.email for future PRs so your commits survive salvage intact with full credit. Thanks!

#67976

randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
… $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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/billing Account usage, credit usage, billing (cross-cutting) comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have provider/bedrock AWS Bedrock (boto3, IAM) sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants