Skip to content

Keep the prices discovery returns for a loaded model - #773

Merged
mlsmaycon merged 1 commit into
mainfrom
agent-network/bedrock-discovered-model-pricing
Aug 24, 2026
Merged

Keep the prices discovery returns for a loaded model#773
mlsmaycon merged 1 commit into
mainfrom
agent-network/bedrock-discovered-model-pricing

Conversation

@mlsmaycon

@mlsmaycon mlsmaycon commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

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 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 the model had no cost set — while GET /agent-network/catalog/providers/models had 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: decorate prices each listed id off its normalized form (eu.anthropic.claude-opus-4-7anthropic.claude-opus-4-7), so the response carries input_per_1k, output_per_1k and 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 main today and shouldn't wait behind it.

Issue ticket number and link

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

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 main when omitted.

management-cloud-tag: main
reverse-proxy-tag: main


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Preserved reported input, output, and cache pricing for discovered AI models.
    • Ensured catalog pricing remains authoritative when model IDs overlap.
    • Added pricing support for geography-prefixed Bedrock models.

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.
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c711e8b9-f77c-4f00-b2b9-88757977f471

📥 Commits

Reviewing files that changed from the base of the PR and between 3be6dda and a191c0f.

📒 Files selected for processing (1)
  • src/modules/agent-network/AIProviderModal.tsx

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The 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.

Changes

Model pricing merge

Layer / File(s) Summary
Preserve discovered model pricing
src/modules/agent-network/AIProviderModal.tsx
The merge documentation states that catalog entries win ID collisions. Discovered models retain input, output, cached-input, cache-read, and cache-creation rates.

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

Merge Risk: ⚪ Minimal · up to a191c

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: braginini

Poem

I’m a rabbit with rates in my chart,
Cache prices stay, each one has a part.
Catalogs lead when model IDs meet,
Bedrock geography keeps pricing complete.
Hop, hop—no zeros where values should be!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: preserving prices returned during model discovery.
Description check ✅ Passed The description clearly explains the bug, Bedrock impact, implementation, testing context, and documentation decision; the issue ticket link remains pending.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent-network/bedrock-discovered-model-pricing

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.

@mlsmaycon
mlsmaycon merged commit d72f417 into main Aug 24, 2026
7 of 8 checks passed
@mlsmaycon
mlsmaycon deleted the agent-network/bedrock-discovered-model-pricing branch August 24, 2026 08:54
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