Skip to content

Conversation

Pratham-Mishra04
Copy link
Collaborator

Summary

Add weighted provider routing for virtual keys, allowing for load balancing between different providers that support the same model.

Changes

  • Added a new TableVirtualKeyProviderConfig table to store provider configurations for virtual keys
  • Replaced AllowedProviders field with ProviderConfigs in virtual keys to support weighted routing
  • Implemented weighted random selection algorithm for provider routing
  • Added middleware to handle provider routing for requests with virtual keys
  • Enhanced the pricing manager to track which models are available for each provider
  • Updated governance handlers to support CRUD operations for provider configs

Type of change

  • Feature
  • Refactor

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Plugins
  • UI (Next.js)
  • Docs

How to test

Test the weighted provider routing by creating a virtual key with multiple provider configurations:

# Create a virtual key with provider configs
curl -X POST http://localhost:8000/api/governance/virtual-keys \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Test VK with Routing",
    "provider_configs": [
      {"provider": "openai", "weight": 0.7},
      {"provider": "anthropic", "weight": 0.3}
    ]
  }'

# Use the virtual key to make requests without specifying provider
curl -X POST http://localhost:8000/v1/completions \
  -H "Content-Type: application/json" \
  -H "X-BF-VK: your-vk-value" \
  -d '{
    "model": "gpt-3.5-turbo",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

The system should automatically route to the appropriate provider based on the weights.

Breaking changes

  • Yes
  • No

This change replaces the AllowedProviders field with ProviderConfigs in virtual keys. Existing virtual keys will need to be updated to use the new provider configuration system.

Security considerations

The weighted routing system maintains the same security model as the previous implementation, with provider access still controlled by virtual key permissions.

Checklist

  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

Copy link
Contributor

coderabbitai bot commented Oct 2, 2025

Warning

Rate limit exceeded

@akshaydeo has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 56 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between f2bca7e and 5f648cc.

📒 Files selected for processing (35)
  • Makefile (1 hunks)
  • core/bifrost.go (1 hunks)
  • core/providers/bedrock.go (1 hunks)
  • core/schemas/bifrost.go (5 hunks)
  • framework/configstore/migrations.go (2 hunks)
  • framework/configstore/store.go (1 hunks)
  • framework/configstore/tables.go (3 hunks)
  • framework/logstore/tables.go (1 hunks)
  • framework/pricing/main.go (5 hunks)
  • framework/pricing/sync.go (1 hunks)
  • plugins/governance/resolver.go (2 hunks)
  • plugins/governance/tracker.go (0 hunks)
  • plugins/maxim/main.go (1 hunks)
  • plugins/semanticcache/test_utils.go (1 hunks)
  • transports/bifrost-http/handlers/completions.go (1 hunks)
  • transports/bifrost-http/handlers/governance.go (5 hunks)
  • transports/bifrost-http/handlers/middlewares.go (2 hunks)
  • transports/bifrost-http/handlers/server.go (5 hunks)
  • transports/bifrost-http/integrations/anthropic/types.go (1 hunks)
  • transports/bifrost-http/integrations/openai/types.go (2 hunks)
  • transports/bifrost-http/lib/config.go (4 hunks)
  • ui/app/providers/fragments/apiKeysFormFragment.tsx (2 hunks)
  • ui/app/teams-customers/views/customerTable.tsx (3 hunks)
  • ui/app/teams-customers/views/teamDialog.tsx (3 hunks)
  • ui/app/virtual-keys/views/virtualKeyDetailsDialog.tsx (3 hunks)
  • ui/app/virtual-keys/views/virtualKeyDialog.tsx (5 hunks)
  • ui/app/virtual-keys/views/virtualKeysTable.tsx (1 hunks)
  • ui/components/ui/dialog.tsx (2 hunks)
  • ui/components/ui/multiSelect.tsx (1 hunks)
  • ui/components/ui/numberAndSelect.tsx (3 hunks)
  • ui/components/ui/tagInput.tsx (1 hunks)
  • ui/hooks/useDebounce.ts (1 hunks)
  • ui/lib/constants/config.ts (1 hunks)
  • ui/lib/constants/logs.ts (1 hunks)
  • ui/lib/types/governance.ts (4 hunks)

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Provider-weighted routing for requests using virtual keys, auto-selecting providers per model.
    • Virtual key “Provider Configurations” with weights and per-provider allowed models.
  • API Changes

    • Virtual key create/update now accept provider_configs; allowed_models/allowed_providers removed.
    • Responses include provider_configs.
  • UI

    • Virtual Key dialog revamped with form validation, provider config editor, and enhanced budget/rate-limit inputs.
    • Virtual Key details show provider configs and key-specific allowances in tables.
    • Customers table adds a “Reset Period” column and clearer budget display.
  • Chores

    • Tracks loaded plugins in server config.
    • Added debounce hooks for UI interactions.

Walkthrough

Adds provider-config support for virtual keys (DB table, store CRUD, migrations), switches governance checks to provider-first, adds VK-based provider routing middleware, extends pricing with model-provider pools, updates HTTP handlers and UI for provider-configs, and includes assorted formatting and minor logging tweaks.

Changes

Cohort / File(s) Summary
Governance data model & store
framework/configstore/tables.go, framework/configstore/migrations.go, framework/configstore/store.go, framework/configstore/sqlite.go
Add TableVirtualKeyProviderConfig, provider-config relations on TableVirtualKey, migration to create governance_virtual_key_provider_configs, store interface methods and SQLite CRUD/preloads for provider configs, GetVirtualKeyByValue.
Governance resolver & tracker
plugins/governance/resolver.go, plugins/governance/tracker.go
Resolver now performs provider-first checks and per-provider model allowance via VK.ProviderConfigs; method signatures updated accordingly. Removed one startup summary log line in tracker.
HTTP handlers & middleware
transports/bifrost-http/handlers/governance.go, transports/bifrost-http/handlers/middlewares.go, transports/bifrost-http/handlers/server.go, transports/bifrost-http/lib/config.go
Replace AllowedProviders/AllowedModels with ProviderConfigs in create/update VK requests and persist provider-config lifecycle; add VKProviderRoutingMiddleware that selects a provider and prefixes model; server records LoadedPlugins and injects middleware; Config gains LoadedPlugins map.
Pricing manager
framework/pricing/main.go, framework/pricing/sync.go
Add modelPool mapping providers→models, populate on init, thread-safe accessors GetModelsForProvider/GetProvidersForModel; minor error-variable adjustment in syncPricing.
Virtual keys UI
ui/app/virtual-keys/views/virtualKeyDialog.tsx, ui/app/virtual-keys/views/virtualKeyDetailsDialog.tsx, ui/app/virtual-keys/views/virtualKeysTable.tsx, ui/lib/types/governance.ts
Dialog refactored to React Hook Form/Zod with provider_configs, weights validation and edit/create flows; details view adds Provider Configurations table; types updated to use provider_configs.
UI constants, hooks & components
ui/lib/constants/config.ts, ui/lib/constants/logs.ts, ui/hooks/useDebounce.ts, ui/components/ui/numberAndSelect.tsx, ui/components/ui/tagInput.tsx, ui/components/ui/multiSelect.tsx, ui/components/ui/dialog.tsx
Add MODEL_PLACEHOLDERS and isKeyRequiredByProvider; update known provider list; add debounce hooks; small component API/style tweaks (labelClassName, input behavior, spacing/className adjustments).
Customer/team UI changes
ui/app/teams-customers/views/customerTable.tsx, ui/app/teams-customers/views/teamDialog.tsx
Add "Reset Period" column and adjust budget styling; swap icon in team dialog and minor spacing tweak.
Core / schemas / transports / plugins (formatting & small error message change)
core/bifrost.go, core/providers/bedrock.go, core/schemas/bifrost.go, transports/bifrost-http/integrations/*, transports/bifrost-http/handlers/completions.go, plugins/*
Mostly whitespace/formatting edits; bifrost error message made more specific by including model; minor logging/formatting tweaks and removed debug line.
Makefile
Makefile
Change default APP_DIR to non-empty default (affects whether -app-dir is included in commands).
Frontend misc
ui/app/providers/fragments/apiKeysFormFragment.tsx, ui/app/teams-customers/views/customerTable.tsx, ui/app/virtual-keys/*
Import MODEL_PLACEHOLDERS, various UI adjustments tied to provider-config work.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client
  participant S as HTTP Server
  participant MW as VKProviderRoutingMiddleware
  participant CS as ConfigStore
  participant H as Handler

  C->>S: POST /completions (x-bf-vk, body:{model})
  S->>MW: Invoke middleware
  alt no header / model absent / model already prefixed
    MW-->>S: pass-through
  else
    MW->>CS: GetVirtualKeyByValue(x-bf-vk)
    CS-->>MW: VirtualKey + ProviderConfigs
    MW->>MW: filter ProviderConfigs by model
    MW->>MW: weighted random select provider
    MW->>S: rewrite body.model to "provider/model"
  end
  S->>H: call next handler with possibly rewritten body
  H-->>C: response
Loading
sequenceDiagram
  autonumber
  participant R as BudgetResolver
  participant VK as VirtualKey (ProviderConfigs)

  R->>VK: isProviderAllowed(provider)
  alt ProviderConfigs empty
    R-->>R: provider allowed
  else provider present?
    R-->>R: allow or provider_blocked
  end
  R->>VK: isModelAllowed(provider, model)
  alt provider config AllowedModels empty
    R-->>R: model allowed
  else model in AllowedModels?
    R-->>R: allow or model_blocked
  end
Loading
sequenceDiagram
  autonumber
  participant PM as PricingManager
  participant Src as Pricing Data

  PM->>Src: load pricing
  PM->>PM: populateModelPool()
  PM-->>PM: modelPool{provider:[models]}
  Note over PM: exposes GetModelsForProvider / GetProvidersForModel
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60–90 minutes

Possibly related PRs

  • v1.2.0 #259 — Large migration touching configstore/vectorstore and related governance/store types; overlaps schema/store changes and handler signatures that align with provider-config and governance migrations in this PR.

Poem

I hopped through tables, keys in tow,
Weighted winds decide where models go.
Provider prefixes, routes that sing,
Middleware nudges each small thing.
UI blooms, configs in a row—
Rabbit cheers: "Deploy! Watch it flow!" 🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.84% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly describes the core feature of adding a virtual key provider configuration table with weighted routing, accurately reflecting the main change without extraneous details or generic phrasing.
Description Check ✅ Passed The pull request description follows the repository template by including a concise summary, detailed list of changes, type of change, affected areas, testing instructions, breaking changes information, security considerations, and a completion checklist.

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

Copy link
Collaborator Author

Pratham-Mishra04 commented Oct 2, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Pratham-Mishra04 Pratham-Mishra04 mentioned this pull request Oct 2, 2025
15 tasks
@akshaydeo akshaydeo force-pushed the 09-15-seggreate_http_server_into_a_separate_struct branch 4 times, most recently from 254cb83 to 73aadec Compare October 3, 2025 11:19
@Pratham-Mishra04 Pratham-Mishra04 force-pushed the 10-02-feat_vk_provider_routing_added branch from c7b303f to e53188c Compare October 3, 2025 12:22
@Pratham-Mishra04 Pratham-Mishra04 marked this pull request as ready for review October 3, 2025 12:22
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ui/app/teams-customers/views/customerTable.tsx (1)

106-106: Fix the colSpan value to match the column count.

The table now has 6 columns (Name, Teams, Budget, Reset Period, Virtual Keys, Actions), but the empty state colSpan is set to 5. This will cause misalignment.

Apply this diff:

-<TableCell colSpan={5} className="text-muted-foreground py-8 text-center">
+<TableCell colSpan={6} className="text-muted-foreground py-8 text-center">
🧹 Nitpick comments (1)
ui/hooks/useDebounce.ts (1)

5-5: Use generic type parameter for better type safety.

The function signature uses any for both the value parameter and return type, which loses type information. Consider using a generic type parameter to preserve the input type.

Apply this diff to improve type safety:

-export function useDebouncedValue(value: any, delay: number): any {
+export function useDebouncedValue<T>(value: T, delay: number): T {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 73aadec and e53188c.

📒 Files selected for processing (36)
  • core/bifrost.go (1 hunks)
  • core/providers/bedrock.go (1 hunks)
  • core/schemas/bifrost.go (5 hunks)
  • framework/configstore/migrations.go (2 hunks)
  • framework/configstore/sqlite.go (5 hunks)
  • framework/configstore/store.go (1 hunks)
  • framework/configstore/tables.go (3 hunks)
  • framework/logstore/tables.go (1 hunks)
  • framework/pricing/main.go (5 hunks)
  • framework/pricing/sync.go (1 hunks)
  • plugins/governance/resolver.go (2 hunks)
  • plugins/governance/tracker.go (0 hunks)
  • plugins/maxim/main.go (1 hunks)
  • plugins/otel/converter.go (1 hunks)
  • plugins/semanticcache/test_utils.go (1 hunks)
  • transports/bifrost-http/handlers/completions.go (1 hunks)
  • transports/bifrost-http/handlers/governance.go (5 hunks)
  • transports/bifrost-http/handlers/middlewares.go (2 hunks)
  • transports/bifrost-http/handlers/server.go (5 hunks)
  • transports/bifrost-http/integrations/anthropic/types.go (1 hunks)
  • transports/bifrost-http/integrations/openai/types.go (2 hunks)
  • transports/bifrost-http/lib/config.go (4 hunks)
  • ui/app/providers/fragments/apiKeysFormFragment.tsx (1 hunks)
  • ui/app/teams-customers/views/customerTable.tsx (3 hunks)
  • ui/app/teams-customers/views/teamDialog.tsx (3 hunks)
  • ui/app/virtual-keys/views/virtualKeyDetailsDialog.tsx (3 hunks)
  • ui/app/virtual-keys/views/virtualKeyDialog.tsx (5 hunks)
  • ui/app/virtual-keys/views/virtualKeysTable.tsx (1 hunks)
  • ui/components/ui/dialog.tsx (3 hunks)
  • ui/components/ui/multiSelect.tsx (1 hunks)
  • ui/components/ui/numberAndSelect.tsx (2 hunks)
  • ui/components/ui/tagInput.tsx (1 hunks)
  • ui/hooks/useDebounce.ts (1 hunks)
  • ui/lib/constants/config.ts (1 hunks)
  • ui/lib/constants/logs.ts (1 hunks)
  • ui/lib/types/governance.ts (4 hunks)
💤 Files with no reviewable changes (1)
  • plugins/governance/tracker.go
🧰 Additional context used
🧬 Code graph analysis (24)
plugins/semanticcache/test_utils.go (1)
core/schemas/bifrost.go (1)
  • OpenAI (41-41)
transports/bifrost-http/integrations/openai/types.go (2)
core/schemas/bifrost.go (1)
  • Tool (332-336)
ui/lib/types/logs.ts (1)
  • Tool (136-140)
framework/configstore/migrations.go (2)
framework/configstore/internal/migration/migrator.go (3)
  • New (131-149)
  • DefaultOptions (100-106)
  • Migration (62-69)
framework/configstore/tables.go (2)
  • TableVirtualKeyProviderConfig (644-650)
  • TableVirtualKeyProviderConfig (691-693)
framework/logstore/tables.go (2)
core/schemas/bifrost.go (4)
  • BifrostEmbedding (635-639)
  • ModelParameters (296-313)
  • Tool (332-336)
  • ToolCall (613-617)
ui/lib/types/logs.ts (4)
  • BifrostEmbedding (115-119)
  • ModelParameters (154-166)
  • Tool (136-140)
  • ToolCall (147-151)
core/bifrost.go (1)
core/schemas/account.go (1)
  • Key (8-16)
ui/app/virtual-keys/views/virtualKeyDetailsDialog.tsx (2)
ui/lib/constants/icons.tsx (2)
  • RenderProviderIcon (564-568)
  • ProviderIconType (570-570)
ui/lib/constants/logs.ts (2)
  • ProviderLabels (38-53)
  • ProviderName (20-20)
transports/bifrost-http/handlers/server.go (2)
transports/bifrost-http/handlers/middlewares.go (1)
  • VKProviderRoutingMiddleware (49-195)
transports/bifrost-http/lib/config.go (1)
  • Config (115-142)
plugins/otel/converter.go (3)
core/providers/gemini.go (1)
  • Content (40-48)
core/schemas/bifrost.go (2)
  • ModelChatMessageRoleAssistant (30-30)
  • ModelChatMessageRoleSystem (32-32)
plugins/otel/types.go (1)
  • KeyValue (21-21)
transports/bifrost-http/handlers/middlewares.go (6)
transports/bifrost-http/lib/config.go (1)
  • Config (115-142)
core/schemas/logger.go (1)
  • Logger (28-55)
framework/configstore/store.go (1)
  • ConfigStore (15-111)
transports/bifrost-http/handlers/utils.go (1)
  • SendError (27-36)
framework/configstore/tables.go (2)
  • TableVirtualKeyProviderConfig (644-650)
  • TableVirtualKeyProviderConfig (691-693)
core/schemas/bifrost.go (1)
  • ModelProvider (38-38)
plugins/governance/resolver.go (3)
ui/lib/types/governance.ts (1)
  • VirtualKey (50-69)
framework/configstore/tables.go (2)
  • TableVirtualKey (618-641)
  • TableVirtualKey (690-690)
core/schemas/bifrost.go (1)
  • ModelProvider (38-38)
transports/bifrost-http/handlers/completions.go (2)
core/schemas/bifrost.go (1)
  • Tool (332-336)
ui/lib/types/logs.ts (1)
  • Tool (136-140)
framework/configstore/sqlite.go (1)
framework/configstore/tables.go (4)
  • TableVirtualKey (618-641)
  • TableVirtualKey (690-690)
  • TableVirtualKeyProviderConfig (644-650)
  • TableVirtualKeyProviderConfig (691-693)
framework/configstore/store.go (1)
framework/configstore/tables.go (4)
  • TableVirtualKey (618-641)
  • TableVirtualKey (690-690)
  • TableVirtualKeyProviderConfig (644-650)
  • TableVirtualKeyProviderConfig (691-693)
framework/pricing/main.go (1)
core/schemas/bifrost.go (1)
  • ModelProvider (38-38)
transports/bifrost-http/handlers/governance.go (1)
framework/configstore/tables.go (2)
  • TableVirtualKeyProviderConfig (644-650)
  • TableVirtualKeyProviderConfig (691-693)
ui/components/ui/numberAndSelect.tsx (1)
ui/components/ui/input.tsx (1)
  • Input (13-67)
ui/components/ui/tagInput.tsx (2)
ui/lib/utils.ts (1)
  • cn (4-6)
ui/components/ui/input.tsx (1)
  • Input (13-67)
ui/app/virtual-keys/views/virtualKeyDialog.tsx (6)
ui/lib/types/governance.ts (2)
  • VirtualKeyProviderConfig (71-76)
  • UpdateVirtualKeyRequest (101-110)
ui/components/ui/multiSelect.tsx (1)
  • MultiSelect (286-1049)
ui/lib/constants/logs.ts (3)
  • ProviderNames (22-22)
  • ProviderLabels (38-53)
  • ProviderName (20-20)
ui/lib/constants/icons.tsx (2)
  • RenderProviderIcon (564-568)
  • ProviderIconType (570-570)
ui/components/ui/tagInput.tsx (1)
  • TagInput (16-74)
ui/lib/constants/config.ts (1)
  • MODEL_PLACEHOLDERS (5-21)
core/schemas/bifrost.go (1)
ui/lib/types/logs.ts (3)
  • BifrostMessage (105-113)
  • Tool (136-140)
  • ToolCall (147-151)
ui/app/teams-customers/views/teamDialog.tsx (1)
ui/lib/utils/governance.ts (1)
  • formatCurrency (27-29)
transports/bifrost-http/lib/config.go (1)
framework/configstore/store.go (1)
  • ConfigStore (15-111)
ui/lib/constants/config.ts (1)
ui/lib/constants/logs.ts (1)
  • ProviderName (20-20)
ui/app/teams-customers/views/customerTable.tsx (2)
ui/lib/utils.ts (1)
  • cn (4-6)
ui/lib/utils/governance.ts (2)
  • formatCurrency (27-29)
  • parseResetPeriod (4-25)
ui/components/ui/dialog.tsx (1)
ui/lib/utils.ts (1)
  • cn (4-6)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
🔇 Additional comments (16)
plugins/maxim/main.go (1)

395-401: Whitespace normalization looks good.
No functional changes introduced; the formatting tweak is fine.

framework/logstore/tables.go (1)

105-108: No functional impact here.

Alignment-only tweaks; existing JSON field parsing remains intact.

transports/bifrost-http/integrations/openai/types.go (2)

22-22: Field alignment looks good. Schema reuse unchanged; no functional impact.


143-145: Formatting tweak acknowledged. Pointer semantics preserved; streaming delta behavior unaffected.

ui/components/ui/numberAndSelect.tsx (1)

14-14: LGTM! Clean styling enhancement.

The optional labelClassName prop is properly typed and consistently applied to both Label components, providing useful styling flexibility without breaking existing usage.

Also applies to: 23-23, 28-30, 34-36

plugins/otel/converter.go (1)

132-132: LGTM! Formatting-only changes.

The whitespace adjustments in the message role handling logic maintain code hygiene without altering behavior.

Also applies to: 138-138, 141-141

ui/components/ui/multiSelect.tsx (1)

813-813: Confirm hover feedback removal is intentional.

The removal of hover:bg-white/20 and p-0.5 makes the remove button more minimalist but eliminates visual hover feedback. This could reduce discoverability for users who rely on hover states to identify interactive elements.

Verify that:

  1. This styling change aligns with the design system used elsewhere in the PR (e.g., provider config UI components)
  2. The reduced visual feedback doesn't negatively impact UX, especially for users who depend on hover cues
  3. The focus state (focus:outline-none) provides sufficient alternative feedback for keyboard navigation

Consider re-adding a subtle hover effect (e.g., hover:opacity-70) if user testing indicates discoverability issues.

ui/app/teams-customers/views/customerTable.tsx (3)

21-21: LGTM: Import adjustments align with refactored UI.

The removal of DollarSign and addition of cn utility correctly support the updated budget display logic that now uses conditional styling instead of icon-based indicators.

Also applies to: 25-25


98-98: LGTM: New column header improves data organization.

The separate "Reset Period" column header provides clearer information architecture by splitting previously combined budget/reset-period data.


140-158: LGTM: Budget display refactor improves clarity and maintainability.

The changes successfully:

  • Use cn for conditional styling when usage exceeds limit
  • Apply proper formatting via formatCurrency for both usage and limit
  • Separate reset period into its own cell with parseResetPeriod
  • Maintain consistent fallback behavior with dashes for missing data
ui/app/teams-customers/views/teamDialog.tsx (1)

17-17: LGTM: Building icon enhances customer visual hierarchy.

The addition of the Building icon provides a consistent visual indicator for customer assignments, aligning with the pattern of using icons (Users, Key) to denote different entity types throughout the governance UI.

Also applies to: 188-188

core/bifrost.go (1)

1579-1579: LGTM! Improved error context.

The enhanced error message now includes both provider and model information, making debugging easier when keys are unavailable for a specific provider-model combination.

ui/app/providers/fragments/apiKeysFormFragment.tsx (1)

10-10: LGTM! Good refactoring to centralize constants.

Moving MODEL_PLACEHOLDERS to a centralized config module improves maintainability and reduces duplication.

transports/bifrost-http/lib/config.go (1)

138-138: LGTM! Useful addition for plugin tracking.

The LoadedPlugins field provides a clear way to track which plugins are active, supporting the plugin management features introduced in this PR.

ui/lib/constants/config.ts (1)

5-38: LGTM! Useful centralized provider configuration.

The new MODEL_PLACEHOLDERS and isKeyRequiredByProvider constants provide centralized provider-specific configuration that improves UI consistency and maintainability.

ui/lib/types/governance.ts (1)

55-76: Missing migration for provider_configs table
I didn’t find any DB migration to create or migrate data into the new provider_configs structure. Ensure you add a migration script that transitions existing virtual keys from allowed_models/allowed_providers to provider_configs.

@Pratham-Mishra04 Pratham-Mishra04 force-pushed the 10-02-feat_vk_provider_routing_added branch 2 times, most recently from 4eb7256 to f2bca7e Compare October 3, 2025 13:14
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e53188c and f2bca7e.

📒 Files selected for processing (37)
  • Makefile (1 hunks)
  • core/bifrost.go (1 hunks)
  • core/providers/bedrock.go (1 hunks)
  • core/schemas/bifrost.go (5 hunks)
  • framework/configstore/migrations.go (2 hunks)
  • framework/configstore/sqlite.go (5 hunks)
  • framework/configstore/store.go (1 hunks)
  • framework/configstore/tables.go (3 hunks)
  • framework/logstore/tables.go (1 hunks)
  • framework/pricing/main.go (5 hunks)
  • framework/pricing/sync.go (1 hunks)
  • plugins/governance/resolver.go (2 hunks)
  • plugins/governance/tracker.go (0 hunks)
  • plugins/maxim/main.go (1 hunks)
  • plugins/otel/converter.go (1 hunks)
  • plugins/semanticcache/test_utils.go (1 hunks)
  • transports/bifrost-http/handlers/completions.go (1 hunks)
  • transports/bifrost-http/handlers/governance.go (5 hunks)
  • transports/bifrost-http/handlers/middlewares.go (2 hunks)
  • transports/bifrost-http/handlers/server.go (5 hunks)
  • transports/bifrost-http/integrations/anthropic/types.go (1 hunks)
  • transports/bifrost-http/integrations/openai/types.go (2 hunks)
  • transports/bifrost-http/lib/config.go (4 hunks)
  • ui/app/providers/fragments/apiKeysFormFragment.tsx (1 hunks)
  • ui/app/teams-customers/views/customerTable.tsx (3 hunks)
  • ui/app/teams-customers/views/teamDialog.tsx (3 hunks)
  • ui/app/virtual-keys/views/virtualKeyDetailsDialog.tsx (3 hunks)
  • ui/app/virtual-keys/views/virtualKeyDialog.tsx (5 hunks)
  • ui/app/virtual-keys/views/virtualKeysTable.tsx (1 hunks)
  • ui/components/ui/dialog.tsx (3 hunks)
  • ui/components/ui/multiSelect.tsx (1 hunks)
  • ui/components/ui/numberAndSelect.tsx (3 hunks)
  • ui/components/ui/tagInput.tsx (1 hunks)
  • ui/hooks/useDebounce.ts (1 hunks)
  • ui/lib/constants/config.ts (1 hunks)
  • ui/lib/constants/logs.ts (1 hunks)
  • ui/lib/types/governance.ts (4 hunks)
💤 Files with no reviewable changes (1)
  • plugins/governance/tracker.go
✅ Files skipped from review due to trivial changes (2)
  • plugins/semanticcache/test_utils.go
  • transports/bifrost-http/integrations/anthropic/types.go
🚧 Files skipped from review as they are similar to previous changes (18)
  • ui/components/ui/numberAndSelect.tsx
  • ui/app/teams-customers/views/customerTable.tsx
  • framework/logstore/tables.go
  • core/schemas/bifrost.go
  • ui/app/virtual-keys/views/virtualKeysTable.tsx
  • ui/app/providers/fragments/apiKeysFormFragment.tsx
  • core/bifrost.go
  • transports/bifrost-http/lib/config.go
  • transports/bifrost-http/integrations/openai/types.go
  • transports/bifrost-http/handlers/completions.go
  • ui/components/ui/tagInput.tsx
  • core/providers/bedrock.go
  • ui/components/ui/dialog.tsx
  • plugins/otel/converter.go
  • ui/lib/types/governance.ts
  • plugins/maxim/main.go
  • ui/hooks/useDebounce.ts
  • ui/components/ui/multiSelect.tsx
🧰 Additional context used
🧬 Code graph analysis (12)
transports/bifrost-http/handlers/middlewares.go (6)
transports/bifrost-http/lib/config.go (1)
  • Config (115-142)
core/schemas/logger.go (1)
  • Logger (28-55)
framework/configstore/store.go (1)
  • ConfigStore (15-111)
transports/bifrost-http/handlers/utils.go (1)
  • SendError (27-36)
framework/configstore/tables.go (2)
  • TableVirtualKeyProviderConfig (644-650)
  • TableVirtualKeyProviderConfig (691-693)
core/schemas/bifrost.go (1)
  • ModelProvider (38-38)
ui/app/virtual-keys/views/virtualKeyDetailsDialog.tsx (2)
ui/lib/constants/icons.tsx (2)
  • RenderProviderIcon (564-568)
  • ProviderIconType (570-570)
ui/lib/constants/logs.ts (2)
  • ProviderLabels (38-53)
  • ProviderName (20-20)
framework/pricing/main.go (1)
core/schemas/bifrost.go (1)
  • ModelProvider (38-38)
transports/bifrost-http/handlers/server.go (3)
plugins/telemetry/main.go (1)
  • PluginName (18-18)
transports/bifrost-http/handlers/middlewares.go (1)
  • VKProviderRoutingMiddleware (50-195)
transports/bifrost-http/lib/config.go (1)
  • Config (115-142)
plugins/governance/resolver.go (3)
ui/lib/types/governance.ts (1)
  • VirtualKey (50-69)
framework/configstore/tables.go (2)
  • TableVirtualKey (618-641)
  • TableVirtualKey (690-690)
core/schemas/bifrost.go (1)
  • ModelProvider (38-38)
ui/app/virtual-keys/views/virtualKeyDialog.tsx (6)
ui/lib/types/governance.ts (2)
  • VirtualKeyProviderConfig (71-76)
  • UpdateVirtualKeyRequest (101-110)
transports/bifrost-http/handlers/governance.go (1)
  • UpdateVirtualKeyRequest (60-75)
ui/lib/constants/logs.ts (3)
  • ProviderNames (22-22)
  • ProviderLabels (38-53)
  • ProviderName (20-20)
ui/lib/constants/icons.tsx (2)
  • RenderProviderIcon (564-568)
  • ProviderIconType (570-570)
ui/components/ui/tagInput.tsx (1)
  • TagInput (16-74)
ui/lib/constants/config.ts (1)
  • MODEL_PLACEHOLDERS (5-21)
framework/configstore/sqlite.go (1)
framework/configstore/tables.go (4)
  • TableVirtualKey (618-641)
  • TableVirtualKey (690-690)
  • TableVirtualKeyProviderConfig (644-650)
  • TableVirtualKeyProviderConfig (691-693)
ui/lib/constants/config.ts (1)
ui/lib/constants/logs.ts (1)
  • ProviderName (20-20)
ui/app/teams-customers/views/teamDialog.tsx (1)
ui/lib/utils/governance.ts (1)
  • formatCurrency (27-29)
transports/bifrost-http/handlers/governance.go (1)
framework/configstore/tables.go (2)
  • TableVirtualKeyProviderConfig (644-650)
  • TableVirtualKeyProviderConfig (691-693)
framework/configstore/migrations.go (2)
framework/configstore/internal/migration/migrator.go (3)
  • New (131-149)
  • DefaultOptions (100-106)
  • Migration (62-69)
framework/configstore/tables.go (2)
  • TableVirtualKeyProviderConfig (644-650)
  • TableVirtualKeyProviderConfig (691-693)
framework/configstore/store.go (1)
framework/configstore/tables.go (4)
  • TableVirtualKey (618-641)
  • TableVirtualKey (690-690)
  • TableVirtualKeyProviderConfig (644-650)
  • TableVirtualKeyProviderConfig (691-693)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (31)
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
🔇 Additional comments (3)
ui/app/teams-customers/views/teamDialog.tsx (3)

17-17: Semantic improvement: Building icon is more appropriate for customers.

The change from User to Building icon better represents organizational/customer entities in the UI.


188-188: LGTM!

Icon usage correctly updated to match the import change.


217-218: Minor readability improvement.

Adding explicit spacing around the slash improves visual clarity for the usage ratio display.

@akshaydeo akshaydeo force-pushed the 09-15-seggreate_http_server_into_a_separate_struct branch 5 times, most recently from 2dd56b4 to 3d2a3bb Compare October 5, 2025 21:10
@akshaydeo akshaydeo force-pushed the 10-02-feat_vk_provider_routing_added branch from f2bca7e to 6874fcd Compare October 5, 2025 21:27
cursor[bot]

This comment was marked as outdated.

@akshaydeo akshaydeo force-pushed the 09-15-seggreate_http_server_into_a_separate_struct branch from 3d2a3bb to b91d410 Compare October 5, 2025 21:37
@akshaydeo akshaydeo force-pushed the 10-02-feat_vk_provider_routing_added branch 2 times, most recently from 9f3d9bf to ba7b44c Compare October 5, 2025 21:38
cursor[bot]

This comment was marked as outdated.

@akshaydeo akshaydeo force-pushed the 10-02-feat_vk_provider_routing_added branch from ba7b44c to 1756b0c Compare October 5, 2025 21:49
@akshaydeo akshaydeo force-pushed the 09-15-seggreate_http_server_into_a_separate_struct branch from b91d410 to 612a214 Compare October 5, 2025 21:49
cursor[bot]

This comment was marked as outdated.

@akshaydeo akshaydeo force-pushed the 09-15-seggreate_http_server_into_a_separate_struct branch from 612a214 to c2781b9 Compare October 5, 2025 21:56
@akshaydeo akshaydeo force-pushed the 10-02-feat_vk_provider_routing_added branch from 1756b0c to 56fe8f3 Compare October 5, 2025 21:56
@akshaydeo akshaydeo mentioned this pull request Oct 5, 2025
18 tasks
cursor[bot]

This comment was marked as outdated.

@akshaydeo akshaydeo force-pushed the 10-02-feat_vk_provider_routing_added branch from 56fe8f3 to 9cf6597 Compare October 5, 2025 22:00
cursor[bot]

This comment was marked as outdated.

@akshaydeo akshaydeo force-pushed the 10-02-feat_vk_provider_routing_added branch from 9cf6597 to 29dfa54 Compare October 5, 2025 22:14
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Table Empty State Column Mismatch

The 'No customers found' empty state row has a colSpan of 5. This causes misalignment because the table now has 6 columns after adding the 'Reset Period' column.

ui/app/teams-customers/views/customerTable.tsx#L104-L106

{customers?.length === 0 ? (
<TableRow>
<TableCell colSpan={5} className="text-muted-foreground py-8 text-center">

Fix in Cursor Fix in Web


@akshaydeo akshaydeo force-pushed the 09-15-seggreate_http_server_into_a_separate_struct branch from c2781b9 to a825810 Compare October 5, 2025 22:29
@akshaydeo akshaydeo force-pushed the 10-02-feat_vk_provider_routing_added branch from 29dfa54 to 555eb29 Compare October 5, 2025 22:35
@akshaydeo akshaydeo force-pushed the 10-02-feat_vk_provider_routing_added branch from 555eb29 to 5f648cc Compare October 5, 2025 22:36
@akshaydeo akshaydeo closed this Oct 5, 2025
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