Keep the prices discovery returns for a loaded model - #773
Conversation
Loading a provider's models merged anything the catalog did not already carry by exact id, and hardcoded both rates to zero on the way in. The comment gave the reason: the discovery response carried no prices. That stopped being true when the endpoint began returning the same rates the proxy bills with. Bedrock feels all of it. Its listing returns geography-prefixed ids — eu.anthropic.claude-opus-4-7 — while the catalog holds the bare anthropic.claude-opus-4-7, so no Bedrock model ever matches by string and every one of them takes this branch. Selecting one filled its row with $0, and the form then warned that the model had no cost set, while the API had reported a rate for it. Usage against it records nothing. Exact-id matching stays. Collapsing a geography-prefixed id onto its catalog entry would hand back the bare form, and only the prefixed one is invocable at AWS.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe model merge now preserves all reported pricing rates for discovered models. Catalog entries remain authoritative when model IDs collide. Geography-prefixed Bedrock models retain vendor-reported pricing. ChangesModel pricing merge
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change preserves discovered model pricing when loading provider models, preventing valid prices from being replaced with zero. No actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Describe your changes
Loading a provider's models merges anything the catalog does not already carry by exact id — and hardcoded both rates to zero on the way in. The comment gave the reason: "the discovery response deliberately carries none." That stopped being true when netbirdio/netbird#7246 began returning the same rates the proxy bills with.
Bedrock feels all of it. Its listing returns geography-prefixed ids (
eu.anthropic.claude-opus-4-7) while the catalog holds the bareanthropic.claude-opus-4-7, so no Bedrock model ever matches by string and every one of them takes this branch. Selecting one filled its row with $0 and the form then warned the model had no cost set — whileGET /agent-network/catalog/providers/modelshad reported a real rate for it. Usage against a model saved that way records nothing, and past usage cannot be re-priced.The backend was right the whole way through:
decorateprices each listed id off its normalized form (eu.anthropic.claude-opus-4-7→anthropic.claude-opus-4-7), so the response carriesinput_per_1k,output_per_1kand the cache rates. The modal just dropped them.Exact-id matching stays. Collapsing a geography-prefixed id onto its catalog entry would hand back the bare form, and only the prefixed one is invocable at AWS — so both spellings continue to appear, which is correct: they are different routing targets that happen to cost the same.
Split out of #772 so it can land on its own. That PR keeps the refused-save handling, which depends on backend work that has not merged yet; this is a user-visible pricing bug on
maintoday and shouldn't wait behind it.Issue ticket number and link
Documentation
Select exactly one:
The docs already describe the intended behaviour — "a model the catalog already prices arrives priced" in Load Models from the Provider. This restores it; nothing to re-document.
Docs PR URL (required if "docs added" is checked)
Paste the PR link from https://github.com/netbirdio/docs here:
https://github.com/netbirdio/docs/pull/__
E2E tests
Optional: override the image tags used by the Playwright e2e workflow.
Defaults to
mainwhen omitted.management-cloud-tag: main
reverse-proxy-tag: main
Generated by Claude Code
Summary by CodeRabbit