Current Behavior
The Load-Balancing Strategy dropdown in the UI (Source → Targets configuration) currently offers only two options:
- Round-robin — rotates across all targets, honoring weights
- Lowest cost — picks the cheapest target per request
There is no option for a prioritized fallback strategy, where requests always go to the highest-priority (highest-weight) target, and only cascade to lower-priority targets when the primary is unavailable (e.g., circuit breaker open, rate-limited, or returning errors).
Desired Behavior
Add a third option: Weighted Fallback — or alternatively a Fallback strategy toggle.
Behavior:
- Targets are ordered by their assigned weight (highest first)
- Every request always tries the highest-weighted target first
- Only if that target fails or is in circuit breaker / unavailable state, the request falls back to the next target in priority order
- Continues cascading down the list until a healthy target responds or all targets are exhausted
Use Case
In setups where:
- One target is significantly more capable/reliable (e.g.,
kimicode/bge_m3_embed with weight 10)
- A secondary target exists as a cheap backup (e.g., local
ollama/qwen3-embedding:0.6b with weight 1)
…the user wants predictable prioritization — always use the best model unless it's down, rather than distributing traffic round-robin across tiers of very different quality.
Proposed UI Change
In the Load-Balancing Strategy dropdown, add:
Weighted fallback — tries highest-weight target first; falls back on circuit breaker
Optional Enhancement
Consider clarifying the weight semantics per strategy in the UI:
- Round-robin: weight = traffic distribution ratio
- Weighted fallback: weight = priority order (highest = primary)
Technical Context & Impacted Areas
To introduce this strategy, the codebase needs to register the new identifier and adjust target routing:
Current Behavior
The Load-Balancing Strategy dropdown in the UI (Source → Targets configuration) currently offers only two options:
There is no option for a prioritized fallback strategy, where requests always go to the highest-priority (highest-weight) target, and only cascade to lower-priority targets when the primary is unavailable (e.g., circuit breaker open, rate-limited, or returning errors).
Desired Behavior
Add a third option: Weighted Fallback — or alternatively a Fallback strategy toggle.
Behavior:
Use Case
In setups where:
kimicode/bge_m3_embedwith weight 10)ollama/qwen3-embedding:0.6bwith weight 1)…the user wants predictable prioritization — always use the best model unless it's down, rather than distributing traffic round-robin across tiers of very different quality.
Proposed UI Change
In the Load-Balancing Strategy dropdown, add:
Optional Enhancement
Consider clarifying the weight semantics per strategy in the UI:
Technical Context & Impacted Areas
To introduce this strategy, the codebase needs to register the new identifier and adjust target routing:
Backend Strategy Registry & Validation:
internal/virtualmodels/types.goandinternal/virtualmodels/validation.godefine and validate acceptable load-balancing strategy values. A new strategy value (e.g.,weighted_fallbackorfallback) needs to be supported here.Load-Balancing Logic:
internal/virtualmodels/balancer.gohouses target selection (balancedResolution). While it already filters out saturated targets usingtargetsWithCapacity, the routing logic needs to support a mode that selects the highest-weighted target from the remaining active pool (rather than cycling round-robin or picking by token cost). It should also gracefully fallback if all targets are saturated.Admin UI & Templates:
internal/admin/dashboard/templates/page-models.htmlmanages the strategy dropdown.internal/admin/dashboard/static/js/modules/virtual-models.jshandles label formatting and form visibility (such as ensuring weight inputs are shown when the fallback strategy is selected).Tests and Documentation:
internal/virtualmodels/balancer_test.goanddocs/features/virtual-models.mdxwill need updates to cover and document the priority fallback behavior.