OmniRoute's 19 Routing Strategies: A Complete Guide to Intelligent LLM Request Distribution
OmniRoute provides 19 distinct routing strategies—from priority and weighted to fusion and pipeline—that determine how requests are distributed across provider and model combinations based on load, cost, context, and performance requirements.
All routing strategies in OmniRoute are defined in the canonical source file src/shared/constants/routingStrategies.ts and exposed through the ROUTING_STRATEGY_VALUES constant. These values drive the combo configuration UI, the public API, and the internal routing engine's decision-making for every request.
Core Load-Balancing Strategies
The foundation of OmniRoute's combo engine rests on eight strategies that handle basic traffic distribution patterns.
priority always selects the first target in the ordered list. Use this when you have a preferred provider that should handle all traffic unless explicitly overridden.
weighted distributes requests according to assigned weight values. This suits scenarios where providers have different capacity limits or you want gradual migration between models.
round-robin cycles through targets in fixed order. Ideal for evenly distributing load across equivalent providers.
fill-first saturates the first target until reaching a configured limit, then spills over to subsequent targets. Deploy this when tiering providers by cost or capability.
p2c (Power-of-Two-Choices) randomly samples two targets and selects the one with lower current load. This provides near-optimal load balancing with minimal overhead.
random performs uniform random selection across all targets. Useful for stress testing or when you want statistically even distribution without tracking state.
least-used prefers targets with minimal recent activity. Optimal when request patterns vary significantly and you want to maximize cache warmth across providers.
strict-random enforces random selection with stronger fairness guarantees than basic random. Use when audit requirements demand provably unbiased distribution.
Cost and Quota Management Strategies
Four strategies optimize for economic efficiency and rate-limited quota preservation.
cost-optimized selects the cheapest provider that can satisfy the request constraints. Essential for budget-conscious deployments with multiple provider accounts.
headroom targets providers with the most remaining quota capacity. Critical when operating near rate limits and avoiding hard throttling.
reset-aware prefers providers that have recently reset their usage counters. Valuable for workflows that align with provider billing cycles or daily quota windows.
reset-window applies a sliding-window policy for quota management rather than fixed reset points. Better for providers with rolling rate limits or when you need smoother distribution over time.
Context and State-Aware Strategies
Three strategies incorporate request context and historical success patterns.
context-relay forwards requests to the next target while preserving conversation context. Necessary for multi-turn interactions where continuity matters across provider switches.
context-optimized prioritizes providers that handle the current context size efficiently. Prevents token waste when some models charge disproportionately for large contexts.
lkgp (Last-Known-Good-Provider) falls back to the last provider that succeeded for this request type. Reduces latency for retry scenarios and exploit provider-specific strengths for particular prompt patterns.
Advanced Orchestration Strategies
Four strategies enable sophisticated multi-provider workflows.
auto runs OmniRoute's built-in Auto Combo engine, which dynamically selects targets based on real-time latency, success rate, and cost metrics. Best when you want hands-off optimization without manual strategy selection.
cache-optimized prefers providers that benefit from cached results. Maximizes hit rates when your workload has high result similarity.
fusion combines outputs from multiple providers into a single response. Use for ensemble approaches, consensus verification, or aggregating diverse model perspectives.
pipeline pipes the output from one provider as input to the next, forming sequential processing chains. Enables multi-stage workflows like draft-then-refine or classification-then-generation patterns.
Internal Quota-Sharing Strategy
OmniRoute defines one additional strategy that does not appear in the public API or UI:
quota-share — used exclusively by automatically generated combos for internal quota distribution. You cannot select this manually; the system injects it when creating derived combo configurations.
Working with Routing Strategies in Code
Listing All Available Strategies
import { ROUTING_STRATEGY_VALUES } from '@/shared/constants/routingStrategies';
// Returns all 19 public strategies as string array
console.log('Available strategies:', ROUTING_STRATEGY_VALUES);
The ROUTING_STRATEGY_VALUES constant in src/shared/constants/routingStrategies.ts serves as the single source of truth. Changes to this array automatically propagate to validation logic, the combo dashboard at src/app/(dashboard)/dashboard/combos/page.tsx, and the combo engine initialization in open-sse/services/combo/comboSetup.ts.
Creating a Combo with a Specific Strategy
import { createCombo } from '@/lib/db/combo';
import { ROUTING_STRATEGY_VALUES } from '@/shared/constants/routingStrategies';
async function setupWeightedCombo() {
const combo = await createCombo({
name: 'cost-aware-gpt4',
strategy: 'cost-optimized',
targets: [
{ provider: 'openai', model: 'gpt-4-turbo', weight: 2 },
{ provider: 'anthropic', model: 'claude-3-opus', weight: 1 },
],
});
return combo;
}
The createCombo function in src/lib/db/combo.ts validates the strategy field against ROUTING_STRATEGY_VALUES before persistence.
Normalizing User Input
import { normalizeRoutingStrategy } from '@/src/shared/constants/routingStrategies';
const input = 'Auto Combo'; // user-friendly label
const normalized = normalizeRoutingStrategy(input);
console.log(normalized); // → "auto"
The normalizeRoutingStrategy helper maps case variations, labels, and aliases to canonical strategy identifiers.
Strategy Selection Decision Framework
| If your goal is... | Choose... |
|---|---|
| Maximum reliability with fallback ordering | priority |
| Fine-grained traffic proportion control | weighted |
| Even load across equivalent providers | round-robin or p2c |
| Tiered capacity utilization | fill-first |
| Minimize request cost | cost-optimized |
| Avoid rate limit exhaustion | headroom or reset-aware |
| Preserve conversation continuity | context-relay |
| Optimize for token efficiency | context-optimized |
| Reduce retry latency | lkgp |
| Hands-off dynamic optimization | auto |
| Generate consensus or ensemble outputs | fusion |
| Build multi-stage processing flows | pipeline |
Summary
-
OmniRoute's 19 routing strategies are declared in
src/shared/constants/routingStrategies.tsand exported throughROUTING_STRATEGY_VALUES. -
The strategies span five functional categories: load balancing, cost/quota management, context awareness, advanced orchestration, and internal quota sharing.
-
normalizeRoutingStrategyand theROUTING_STRATEGY_VALUESconstant ensure consistent validation across the combo UI, API, and database layer. -
Only 18 strategies are user-selectable;
quota-shareis reserved for internal auto-generated combos. -
Strategy selection directly impacts latency, cost, reliability, and functionality—choose
fusionorpipelinewhen you need multi-provider coordination,autofor adaptive optimization, andcost-optimizedorheadroomfor resource-constrained deployments.
Frequently Asked Questions
How do I add a custom routing strategy to OmniRoute?
Extend the ROUTING_STRATEGY_VALUES array in src/shared/constants/routingStrategies.ts with your new strategy identifier, then implement the corresponding selection logic in the combo engine. The modular architecture in src/lib/db/combo.ts and open-sse/services/combo/comboSetup.ts will automatically pick up the new value for validation and UI display.
Why does OmniRoute have both random and strict-random strategies?
The strict-random strategy enforces stronger statistical fairness guarantees than basic random, which may cluster selections in edge cases. Use strict-random when audit requirements demand provably unbiased distribution, or when running long-duration tests where random's variance could skew results.
Can I combine multiple routing strategies in sequence?
Not directly—each combo uses exactly one strategy. However, you can achieve sequential behavior by chaining combos with pipeline, or by creating hierarchical combo structures where one combo's output routes through another. For true strategy composition, implement custom logic in a fusion-based combo that delegates to sub-combos with different strategies.
What happens when a provider fails under the auto strategy?
The auto strategy continuously monitors success rates and latency for all targets. When a provider fails or degrades, the strategy automatically reduces its selection probability and redistributes load to healthier alternatives. Failed providers are periodically retried at reduced volume to detect recovery, with full restoration once performance normalizes.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →