Skip to content

fix(ai): Preserve provider-specific model metadata - #128733

Open
akasakariko wants to merge 1 commit into
getsentry:masterfrom
akasakariko:fix/ai-provider-model-pricing
Open

akasakariko wants to merge 1 commit into
getsentry:masterfrom
akasakariko:fix/ai-provider-model-pricing

Conversation

@akasakariko

@akasakariko akasakariko commented Oct 24, 2026 •

Copy link
Copy Markdown

Summary

  • Preserve provider boundaries and full model IDs when importing AI model prices and context sizes
  • Add optional provider tables while retaining the version 1 model-only table for older Relay versions and spans without a provider
  • Apply OpenRouter API precedence only within OpenRouter and the legacy table
  • Add provider-local aliases without replacing exact IDs or introducing ambiguous short names

Reproduction

  • Reproduced on upstream commit 86b1728 before changing production code
  • A regression fixture with Cloudflare Workers AI and OpenRouter selected the OpenRouter rate of $42 per billion input tokens instead of the Cloudflare rate of $240
  • The same fixture showed Poe pricing overwriting Anthropic pricing for the same model
  • The regression failed before the fix and passes with separate provider tables

Verification

  • 40 relevant Python tests passed across metadata import, model normalization, and cache detection pricing
  • Repository pre-commit checks passed
  • Targeted repository mypy pre-push check passed with the local Sentry configuration
  • Added coverage for provider separation, OpenRouter precedence, full IDs, ambiguous aliases, and snapshot normalization

Rollout

  • Requires companion fix(ai): Use provider-specific model pricing relay#6558 for provider-aware lookup to fix ingestion end to end
  • Both changes can be deployed in either order because the legacy models table and metadata version remain supported
  • Existing Python model-only consumers remain unchanged

AI assistance

  • Substantial implementation and test work was generated with an AI coding assistant and reviewed against the producer and consumer paths

Fixes #128011

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@akasakariko
akasakariko requested a review from a team as a code owner October 24, 2026 05:30
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI cost uses the price of a different provider for the same model

1 participant