Skip to content

fix: normalize Together provider for pricing lookup - #6037

Merged
akshaydeo merged 1 commit into
maximhq:mainfrom
dani29:codex/rei-3127-together-pricing
Aug 11, 2026
Merged

akshaydeo merged 1 commit into
maximhq:mainfrom
dani29:codex/rei-3127-together-pricing

Conversation

@dani29

@dani29 dani29 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • normalize the runtime custom-provider name together to the pricing catalog's canonical together_ai identifier
  • apply provider normalization consistently when resolving catalog pricing, while preserving the runtime provider name for routing, metrics, and scoped overrides
  • add an end-to-end cost regression using real GLM-5.2 token counts and cached-input pricing

Root cause

Pricing rows are normalized when the hosted datasheet is ingested, but the runtime provider identifier was used verbatim during cost lookup. A custom OpenAI-compatible provider named together therefore could not match rows stored under together_ai; cost calculation returned zero even when the catalog contained the model.

The hosted catalog still needs a direct Together GLM-5.2 row. That data request is tracked in #6036. Once present, this change lets existing together deployments consume it without renaming a DB-backed provider.

Validation

  • go test ./modelcatalog/datasheet -run 'TestCalculateCost_TogetherAliasUsesTogetherAIPricingWithCache|TestGetPricing_' -count=1
  • go test ./modelcatalog/datasheet -count=1
  • the regression calculates $13.2067812 from 36,807,862 input tokens, including 33,829,760 cached tokens, and 54,932 output tokens

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Fixed pricing resolution for Together provider requests by recognizing the together alias.
    • Together usage now applies the correct cached-read, input, and output token rates.
  • Tests
    • Added regression coverage to verify end-to-end pricing for the Together provider alias.

Walkthrough

The pricing resolver now maps the together provider alias to together_ai for catalog lookups. Existing raw-provider handling remains unchanged. A regression test verifies cached-read, input, and output pricing.

Changes

Together provider alias pricing

Layer / File(s) Summary
Provider normalization
framework/modelcatalog/datasheet/types.go
normalizeProvider maps together to together_ai before existing normalization cases.
Normalized pricing resolution and regression coverage
framework/modelcatalog/datasheet/cost.go, framework/modelcatalog/datasheet/cost_test.go
resolvePricing uses the normalized provider for base pricing lookup. The regression test verifies Together AI cached-read, input, and output rates for the alias.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: tejasghatte, pratham-mishra04, impoiler

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the root cause, implementation, regression test, and validation, but omits several required template sections. Add the Changes, Type of change, Affected areas, How to test, Breaking changes, Related issues, Security considerations, and Checklist sections.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the provider normalization fix for Together pricing lookup.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@akshaydeo
akshaydeo merged commit 41c3a10 into maximhq:main Aug 11, 2026
5 checks passed
atharvamhaske pushed a commit to atharvamhaske/bifrost that referenced this pull request Aug 13, 2026
akhsaul pushed a commit to akhsaul/bifrost that referenced this pull request Aug 27, 2026
occcat pushed a commit to occcat/bifrost that referenced this pull request Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants