OmniRoute Routing Strategies: Complete Guide to All 19 Routing Algorithms and When to Use Each
OmniRoute provides 19 distinct routing strategies for distributing LLM requests across providers, ranging from simple priority-based selection to advanced multi-provider fusion and pipeline patterns.
The OmniRoute combo engine powers intelligent request dispatch by selecting the optimal target model or provider for each incoming request. These strategies are defined in src/shared/constants/routingStrategies.ts and exposed through the ROUTING_STRATEGY_VALUES constant, used by the combo configuration UI, API, and internal routing engine. Whether you need predictable load distribution, cost optimization, or complex multi-stage processing, understanding these OmniRoute routing strategies lets you precisely control how your requests flow through the system.
Simple Selection Strategies
These foundational strategies provide deterministic or probabilistic target selection with minimal configuration overhead.
Priority
Always selects the first (highest-priority) target in your combo list.
When to use: Failover scenarios where you have a preferred primary provider and only want to fall back to alternatives when the first fails. Ideal for maintaining consistent behavior with a trusted provider.
Weighted
Distributes requests across targets proportionally to their assigned weights.
When to use: Gradual migration between providers, A/B testing new models, or traffic splitting based on capacity agreements. Configure weights in your combo target definitions.
Round-Robin
Cycles through targets in a fixed cyclic order.
When to use: Uniform load distribution when all targets have equivalent capability and you want to prevent any single provider from receiving disproportionate traffic.
Random
Selects a target uniformly at random from available options.
When to use: Simple load balancing without state tracking, useful when provider performance is consistent and you want minimal routing overhead.
Strict-Random
Random selection with stricter fairness guarantees than standard random.
When to use: Scenarios requiring statistical fairness guarantees over shorter time windows, such as compliance-sensitive deployments.
Load-Aware and Performance Strategies
These strategies incorporate runtime metrics or historical usage patterns to make smarter routing decisions.
P2C (Power-of-Two-Choices)
Randomly samples two targets and selects the one with lower current load.
When to use: Large pools of homogeneous providers where you want near-optimal load balancing without maintaining global state. Avoids the thundering herd problem of naive random selection.
Least-Used
Prefers the target that has been used least recently.
When to use: Maximizing cache hit rates across distributed inference clusters, or ensuring cold-start providers receive warmup traffic.
Headroom
Selects the target with the most remaining quota headroom.
When to use: Avoiding rate limit violations when providers have strict request or token quotas. Proactively distributes load before limits are reached.
Context-Optimized
Prioritizes providers that can handle the current request's context size efficiently.
When to use: Routing large-context requests (long documents, extended conversations) to providers with favorable context window pricing or performance characteristics.
Cache-Optimized
Prefers providers that benefit from cached results.
When to use: Workloads with repetitive prompts where prompt caching provides significant latency and cost reductions.
Cost and Quota Management Strategies
These strategies optimize for economic efficiency and quota compliance.
Cost-Optimized
Selects the cheapest target that satisfies the request requirements.
When to use: Cost-sensitive batch processing, non-latency-critical workloads, or maximizing throughput per dollar spent.
Reset-Aware
Prefers targets that have recently reset their usage counters.
When to use: Provider billing cycles with monthly or daily quotas where post-reset periods offer maximum capacity.
Reset-Window
Uses a sliding-window reset policy for quota management.
When to use: Providers with rolling quota windows rather than hard reset boundaries, ensuring smooth capacity utilization over time.
Advanced Relay and State Management Strategies
These strategies enable sophisticated request flow patterns beyond single-provider selection.
Context-Relay
Relays the request to the next target while preserving full conversation context.
When to use: Long-running conversations that exceed a single provider's context limit, or graceful degradation when a preferred provider fails mid-conversation.
Fill-First
Fills the first target until reaching a configured limit, then proceeds to the next.
When to use: Commitment-based pricing tiers where you want to exhaust committed capacity on preferred providers before utilizing on-demand alternatives.
LKGP (Last-Known-Good-Provider)
Falls back to the last provider that succeeded for the same request type.
When to use: Improving perceived reliability by learning from successful past interactions, particularly beneficial for specialized request patterns that certain providers handle better.
Multi-Provider Composite Strategies
These strategies combine or chain multiple providers for enhanced capabilities.
Fusion
Combines results from multiple providers into a single unified response.
When to use: Ensembling for improved accuracy (majority voting, confidence aggregation), or synthesizing complementary capabilities from different model families.
Pipeline
Pipes the output of one provider as input to the next, forming a processing pipeline.
When to use: Multi-stage workflows such as initial extraction followed by structured formatting, or reasoning chains where specialized models handle distinct phases.
Intelligent and Automated Strategies
These strategies leverage runtime intelligence to reduce manual configuration.
Auto
The built-in Auto Combo strategy that dynamically selects the best target based on real-time performance metrics.
When to use: Rapidly changing conditions where static configuration becomes suboptimal, or when you want OmniRoute's optimization engine to continuously adapt to observed latency, error rates, and cost patterns.
Internal-Only Strategy
Quota-Share
Used by automatically generated combos for quota sharing between organizational units or projects.
When to use: This strategy is not exposed in the UI or public API—it is reserved for system-internal resource allocation scenarios where OmniRoute automatically manages capacity distribution.
Working with Routing Strategies in Code
Listing All Available Strategies
import { ROUTING_STRATEGY_VALUES } from '@/shared/constants/routingStrategies';
// Print the full list of 19 strategies
console.log('Available routing strategies:', ROUTING_STRATEGY_VALUES);
// Output includes: 'priority', 'weighted', 'round-robin', 'context-relay',
// 'fill-first', 'p2c', 'random', 'least-used', 'cost-optimized',
// 'reset-aware', 'reset-window', 'headroom', 'strict-random', 'auto',
// 'lkgp', 'context-optimized', 'cache-optimized', 'fusion', 'pipeline'
Creating a Combo with a Specific Strategy
import { createCombo } from '@/lib/db/combo';
import { ROUTING_STRATEGY_VALUES } from '@/shared/constants/routingStrategies';
async function makeCostOptimizedCombo() {
const combo = await createCombo({
name: 'budget-batch-processor',
strategy: 'cost-optimized',
targets: [
{ provider: 'openai', model: 'gpt-3.5-turbo' },
{ provider: 'anthropic', model: 'claude-instant-1' },
{ provider: 'cohere', model: 'command-light' }
],
});
console.log('Combo created with strategy:', combo.strategy);
return combo;
}
Normalizing User Input to Valid Strategies
import { normalizeRoutingStrategy } from '@/shared/constants/routingStrategies';
// Handles case variations and common aliases
const userInput = 'Cost';
const strategy = normalizeRoutingStrategy(userInput);
console.log('Normalized strategy:', strategy); // → "cost-optimized"
// Additional normalization examples
normalizeRoutingStrategy('ROUND_ROBIN'); // → "round-robin"
normalizeRoutingStrategy('power of 2'); // → "p2c"
Key Source Files for Routing Strategy Implementation
| File | Purpose |
|---|---|
src/shared/constants/routingStrategies.ts |
Canonical enumeration of all 19 strategies and normalization utilities |
src/app/(dashboard)/dashboard/combos/page.tsx |
Dashboard UI for strategy selection and combo management |
open-sse/services/combo/comboSetup.ts |
Runtime strategy resolution for the combo engine |
src/lib/db/combo.ts |
Database persistence layer for combo configuration |
Summary
- OmniRoute routing strategies span four categories: simple selection, load-aware performance optimization, cost/quota management, and advanced multi-provider patterns.
- Begin with
priorityfor basic failover,weightedfor controlled traffic splitting, orround-robinfor uniform distribution. - Optimize costs with
cost-optimizedorheadroomwhen budget or quota constraints matter. - Handle complex workloads with
context-relay,fusion, orpipelinefor stateful, ensemble, or chained processing. - Enable autonomous optimization with
autowhen you want runtime metric-driven selection without manual tuning. - Reference
ROUTING_STRATEGY_VALUESinsrc/shared/constants/routingStrategies.tsas the authoritative source for all available strategies.
Frequently Asked Questions
How do I choose the right routing strategy for my use case?
Start by identifying your primary constraint: cost, latency, reliability, or capability. Use priority or lkgp for reliability, cost-optimized or headroom for budget control, p2c or least-used for performance, and fusion or pipeline when single providers cannot meet your requirements. The auto strategy provides a hands-off baseline that adapts to observed conditions.
Can I combine multiple routing strategies in a single combo?
Individual combos use one strategy at a time, but you can achieve combination effects through nested combos or by using composite strategies like fusion (parallel execution) and pipeline (serial execution). For sophisticated combinations, architect multiple single-strategy combos and orchestrate them at the application layer, or leverage auto to let OmniRoute's optimization engine discover effective patterns.
Why is the quota-share strategy not available in the dashboard?
The quota-share strategy is internal-only, reserved for system-generated combos that distribute organizational quota allocations. According to the source code in src/shared/constants/routingStrategies.ts, this strategy is excluded from ROUTING_STRATEGY_VALUES in public contexts and is never exposed through the API or configuration UI.
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 →