Skip to content

fix(bedrock): add prompt-cache pricing to Claude Bedrock entries - #46299

Closed
jaketracey wants to merge 1 commit into
NousResearch:mainfrom
jaketracey:fix/bedrock-claude-cache-pricing
Closed

fix(bedrock): add prompt-cache pricing to Claude Bedrock entries#46299
jaketracey wants to merge 1 commit into
NousResearch:mainfrom
jaketracey:fix/bedrock-claude-cache-pricing

Conversation

@jaketracey

Copy link
Copy Markdown
Contributor

Problem

The Bedrock Claude pricing entries (added in bedrock-pricing-2026-04) set input_cost_per_million and output_cost_per_million but omit cache rates. As a result, cache_read_tokens and cache_write_tokens are billed at $0 in cost estimates — so a cached agentic session (where the cached system+tools prefix is usually the majority of input) reports a cost far below reality.

Fix

Add the standard Anthropic prompt-cache multipliers to the four Claude Bedrock entries (same rates apply on Bedrock):

  • cache read = 0.1× base input
  • 5-minute cache write = 1.25× base input
model input cache_read cache_write
claude-opus-4-6 15.00 1.50 18.75
claude-sonnet-4-6 3.00 0.30 3.75
claude-sonnet-4-5 3.00 0.30 3.75
claude-haiku-4-5 0.80 0.08 1.00

Input/output rates are unchanged. (Nova/other Bedrock models also support caching with different multipliers and could be added separately.)

🤖 Generated with Claude Code

The bedrock-pricing-2026-04 Claude entries set input/output rates but omit
cache_read/cache_write rates, so cache_read_tokens and cache_write_tokens are
costed at $0 -- under-reporting cached agentic sessions (often the bulk of
input). Add the standard Anthropic cache multipliers: read = 0.1x input,
5-minute write = 1.25x input, for opus-4-6, sonnet-4-6, sonnet-4-5, haiku-4-5.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/bedrock AWS Bedrock (boto3, IAM) provider/anthropic Anthropic native Messages API labels Jun 14, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused pricing correction. Current main already provides this exact behavior.

  • agent/usage_pricing.py:517-561 contains the same cache-read and 5-minute cache-write rates for all four Bedrock Claude entries.
  • agent/usage_pricing.py:939-965 returns unknown when a required cache rate is absent and otherwise includes both cache buckets in the estimate.
  • tests/agent/test_usage_pricing.py:255-324 now verifies both the cache-rate invariant and that a cached Bedrock Claude session produces an estimated cost; this also covers the symptom discussed in related Bedrock Claude /usage shows cost unknown — pricing table lacks cache cost fields + cross-region prefix normalization #50295.
  • The implementation is present in d682f320b35a13084371a541a835e1d988c982b8.

Automated hermes-sweeper review.

@teknium1 teknium1 closed this Jul 14, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists provider/anthropic Anthropic native Messages API provider/bedrock AWS Bedrock (boto3, IAM) sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants