Bug Description
I noticed that PostHog prices a US Bedrock inference-profile event using the Global-equivalent provider entry, even though the existing cost catalog already contains the correct US entry.
For this input:
findCostFromModel('us.anthropic.claude-sonnet-5', {
$ai_provider: 'bedrock',
})
PostHog currently selects:
amazon-bedrock-claude-on-aws
It should select:
The raw model ID contains the us. inference-profile prefix, but findCostFromModel resolves it to the canonical model before provider selection. The provider resolver then sees only the generic bedrock provider and takes the first partial Amazon Bedrock match.
The catalog already has separate Global and US provider rows. At the current Claude Sonnet 5 promotional rates, the difference is:
| Token category |
Current selection |
US Geo rate |
| Input |
$2.00 / 1M |
$2.20 / 1M |
| Output |
$10.00 / 1M |
$11.00 / 1M |
| Cache read |
$0.20 / 1M |
$0.22 / 1M |
| 5-minute cache write |
$2.50 / 1M |
$2.75 / 1M |
| 1-hour cache write |
$4.00 / 1M |
$4.40 / 1M |
The one-hour rate is derived from the selected input price, so the wrong provider selection affects that bucket as well.
For these token categories, selecting Global-equivalent rates understates the correct US charge by 9.09%.
How to reproduce
-
Check out PostHog at 97295889b4dfa4399c9f4fe2d877bde32156375d.
-
Run:
const result = findCostFromModel('us.anthropic.claude-sonnet-5', {
$ai_provider: 'bedrock',
})
console.log(result?.cost.provider)
-
Observe:
amazon-bedrock-claude-on-aws
-
Compare it with the amazon-bedrock-us-east-1 entry already present for the same model.
Additional context
AWS documents distinct us.anthropic... and global.anthropic... inference-profile IDs. Its cross-Region inference documentation describes Global inference as approximately 10% cheaper than Geographic inference, and the exact token-category rates are listed on the Bedrock pricing page. Anthropic also documents the input, output, cache-read, 5-minute-write, and 1-hour-write categories in its pricing reference, while noting that Bedrock maintains its own regional pricing.
I think the matching rule should be:
- An explicit regional provider remains authoritative.
- With a generic Bedrock provider, a recognized inference-profile prefix can select the corresponding provider row when one exists.
global. selects the Global row.
- Unprefixed models and prefixes without a corresponding row retain the current fallback.
- The matcher uses prices already present in the provider catalog rather than hardcoding model names or rates.
This is separate from #71306 and #71323. Those changes preserve and price Anthropic’s cache TTL breakdown after a provider price has been selected; this issue is about selecting the correct regional provider price in the first place.
Debug info
Source-level reproduction against PostHog master at 97295889b4dfa4399c9f4fe2d877bde32156375d.
Synthetic model and provider values only; no project or customer data is required.
Bug Description
I noticed that PostHog prices a US Bedrock inference-profile event using the Global-equivalent provider entry, even though the existing cost catalog already contains the correct US entry.
For this input:
PostHog currently selects:
It should select:
The raw model ID contains the
us.inference-profile prefix, butfindCostFromModelresolves it to the canonical model before provider selection. The provider resolver then sees only the genericbedrockprovider and takes the first partial Amazon Bedrock match.The catalog already has separate Global and US provider rows. At the current Claude Sonnet 5 promotional rates, the difference is:
The one-hour rate is derived from the selected input price, so the wrong provider selection affects that bucket as well.
For these token categories, selecting Global-equivalent rates understates the correct US charge by 9.09%.
How to reproduce
Check out PostHog at
97295889b4dfa4399c9f4fe2d877bde32156375d.Run:
Observe:
Compare it with the
amazon-bedrock-us-east-1entry already present for the same model.Additional context
AWS documents distinct
us.anthropic...andglobal.anthropic...inference-profile IDs. Its cross-Region inference documentation describes Global inference as approximately 10% cheaper than Geographic inference, and the exact token-category rates are listed on the Bedrock pricing page. Anthropic also documents the input, output, cache-read, 5-minute-write, and 1-hour-write categories in its pricing reference, while noting that Bedrock maintains its own regional pricing.I think the matching rule should be:
global.selects the Global row.This is separate from #71306 and #71323. Those changes preserve and price Anthropic’s cache TTL breakdown after a provider price has been selected; this issue is about selecting the correct regional provider price in the first place.
Debug info
Source-level reproduction against PostHog master at 97295889b4dfa4399c9f4fe2d877bde32156375d. Synthetic model and provider values only; no project or customer data is required.