fix(pricing): resolve versioned Bedrock profile IDs - #50437
Conversation
|
Thanks for the focused Bedrock pricing regression coverage. The premise remains valid on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
f831530 to
bd1d63a
Compare
|
Merged via PR #67976 — both of your commits (the region-prefix expansion + version/date suffix strip, and the follow-up restricting normalization to anchored trailing forms) were cherry-picked onto current main with your authorship preserved (rebase merge). You were the earliest submission for this fix. Thanks for the careful anchoring so model versions like |
Summary
Follow-up to #50307 and the now-closed #50295.
#50307 fixed the main
/usagefailure for Bedrock Claude cache tokens and exact cross-region profile IDs such asus.anthropic.claude-sonnet-4-5. Two profile shapes can still miss the official pricing table:us.anthropic.claude-sonnet-4-6-20250514-v1:0apac.Those IDs normalize to a valid Bedrock Claude model family, but the lookup only tried an exact key. Since the pricing snapshot is keyed by the shorter model-family ID (
anthropic.claude-sonnet-4-6), these still fell through toNone.This PR leaves the cache pricing rows from #50307 alone and only tightens the Bedrock pricing lookup.
Changes
global.,us.,eu.,ap.,apac.,jp.,ca.,sa.,me., andaf..us./global.Claude profile IDs and anapac.Claude Haiku profile ID.Validation
Before this patch on current
origin/main:us.anthropic.claude-sonnet-4-6us.anthropic.claude-sonnet-4-6-20250514-v1:0global.anthropic.claude-sonnet-4-6-20250514-v1:0apac.anthropic.claude-haiku-4-5-20251001-v1:0Tests run:
python3 -m pytest tests/agent/test_usage_pricing.py -q-> 17 passedpython3 -m ruff check agent/usage_pricing.py tests/agent/test_usage_pricing.pygit diff --checkpython3 -m py_compile agent/usage_pricing.py tests/agent/test_usage_pricing.pyNote:
bash scripts/run_tests.sh tests/agent/test_usage_pricing.pycould not run in this local checkout because the wrapper requires a.venvorvenvdirectory.