OmniRoute Routing Strategies: Complete Guide to All 19 Built-In Methods
OmniRoute provides 19 built-in routing strategies for dispatching requests across provider-model combos, ranging from simple deterministic ordering to intelligent multi-factor scoring and parallel fusion architectures.
The OmniRoute routing strategies determine how requests flow through the combo routing engine—a core component that distributes LLM calls across multiple provider-model targets. These strategies are implemented in the open-sse services layer and configurable via the strategy field in combo definitions.
Complete List of OmniRoute Routing Strategies
OmniRoute's combo service (open-sse/services/combo/...) implements 19 distinct routing strategies across four functional categories: deterministic selection, health-aware distribution, quota-aware optimization, and advanced composite patterns.
Deterministic Selection Strategies
These strategies provide predictable, rule-based target selection:
-
Priority – Uses deterministic ordering; the first healthy target in the list receives the request. Implemented in target resolution logic where targets are evaluated sequentially until a healthy candidate is found.
-
Weighted – Selects targets based on configurable weight factors, typically cost or custom business priorities. Higher-weighted targets receive proportionally more traffic.
-
Fill-first – Exhausts the quota of the first target before considering fallbacks. Optimizes for committed-use discounts and reserved capacity.
-
Round-robin – Distributes requests cyclically across all eligible targets in equal proportion. Simple load distribution without health consideration.
-
Random – Pure random selection among currently healthy targets. Provides basic load spreading with no predictable pattern.
-
Strict-random – Random selection that never falls back to secondary targets. Fails the request if the randomly selected target is unavailable.
Health-Aware Distribution Strategies
These strategies incorporate real-time health signals into routing decisions:
-
Power-of-2-choices (p2c) – Randomly selects two targets, then routes to the healthier of the two. Reduces tail latency compared to pure random selection.
-
Least-used – Routes to the target with the fewest recent requests. Prevents hot-spotting on fast-responding targets.
-
LKG-P – "Last-known-good-provider" strategy that sticks to the most recent successful target. Minimizes cold-start latency for session-heavy workloads.
Quota and Cost Optimization Strategies
These strategies optimize for economic and operational constraints:
-
Cost-optimized – Orders targets from cheapest to most expensive unit cost. Ideal for budget-conscious batch processing.
-
Reset-aware – Prefers targets whose quota-reset window is closest. Prevents request failures near rate-limit boundaries.
-
Reset-window – Rotates targets based on their reset-window timing patterns. Smooths traffic across staggered quota windows.
-
Headroom – Selects targets with the most remaining quota headroom. Proactive load balancing to prevent capacity exhaustion.
Intelligent and Context-Aware Strategies
These strategies incorporate request content and environmental signals:
-
Auto – The "smart" strategy that scores candidates across 14 distinct factors in the Auto-Combo engine. Considers latency, cost, health, context matching, and cache state simultaneously.
-
Context-optimized – Biases selection toward models whose capabilities match the request context (e.g., code generation, reasoning, multimodal).
-
Cache-optimized – Prioritizes targets with warm prompt-cache entries. Reduces latency and token costs for repeated or similar prompts.
-
Context-relay – Forwards request context metadata to downstream providers to enable their own routing optimizations.
Composite and Advanced Strategies
These strategies enable complex multi-model architectures:
-
Fusion – Fan-out requests to a panel of models in parallel, then synthesizes a final answer using a designated judge model. Implements ensemble reasoning with quality arbitration.
-
Pipeline – Sequential chaining of multiple combo steps (e.g., pre-filter → main model → post-process). Enables multi-stage processing workflows.
Implementation Architecture
The routing strategies are implemented across several key source files in the open-sse/services/combo/ directory:
| Component | Source File | Responsibility |
|---|---|---|
| Strategy normalization | targetResolution.ts |
Validates and normalizes the strategy field in combo configurations |
| Strategy dispatch | strategyDispatch.ts |
Routes requests to appropriate strategy implementation |
| Auto-Combo scoring | autoStrategy.ts |
14-factor candidate evaluation for "auto" strategy |
| Fusion implementation | fusion.ts |
Parallel panel execution and judge-based synthesis |
| Pipeline orchestration | pipeline.ts |
Sequential step chaining with state passing |
Configuration Examples
Basic Priority Routing
import { resolveComboTargets } from "@/open-sse/services/combo/comboSetup";
const combo = {
strategy: "priority",
targets: [
{ provider: "openai", model: "gpt-4o" },
{ provider: "anthropic", model: "claude-3-5-sonnet" },
{ provider: "google", model: "gemini-1.5-pro" },
],
};
await resolveComboTargets(combo, requestPayload);
The priority strategy attempts targets in order, falling back only when a target is unhealthy.
Intelligent Auto Routing
const autoCombo = {
strategy: "auto", // Activates 14-factor Auto-Combo scoring
targets: [...allAvailableTargets],
};
await resolveComboTargets(autoCombo, requestPayload);
The auto strategy automatically balances cost, latency, quality, and cache state without manual tuning.
Fusion Ensemble Pattern
const fusionCombo = {
strategy: "fusion",
panel: [
{ provider: "openai", model: "gpt-4o-mini" },
{ provider: "google", model: "gemini-1.5-flash" },
{ provider: "anthropic", model: "claude-3-haiku" },
],
judge: { provider: "anthropic", model: "claude-3-opus" },
};
await resolveComboTargets(fusionCombo, requestPayload);
The fusion strategy executes all panel models concurrently, then delegates final answer synthesis to the judge.
Strategy Selection Guide
| Use Case | Recommended Strategy | Rationale |
|---|---|---|
| Maximum reliability | priority |
Predictable fallback chain |
| Cost minimization | cost-optimized or auto |
Explicit or automatic cost ranking |
| Latency-sensitive | cache-optimized or LKG-P |
Warm caches or sticky success |
| Quality-critical | fusion |
Ensemble consensus with judge |
| High-throughput batch | weighted or headroom |
Controlled distribution or quota protection |
| Multi-stage processing | pipeline |
Composable workflow chains |
Summary
-
OmniRoute provides 19 routing strategies spanning deterministic, health-aware, quota-aware, intelligent, and composite categories.
-
Core implementation resides in
open-sse/services/combo/with strategy selection normalized intargetResolution.tsand dispatched viastrategyDispatch.ts. -
Auto-Combo (
autostrategy) implements the most sophisticated routing, scoring candidates across 14 simultaneous factors. -
Fusion and Pipeline enable advanced patterns: parallel ensemble reasoning and sequential multi-step processing.
-
All strategies are configurable via the
strategyfield in combo definitions passed toresolveComboTargets().
Frequently Asked Questions
How do I configure multiple routing strategies in a single combo?
You cannot mix strategies within a single combo definition. Each combo specifies exactly one strategy value. However, the Pipeline strategy enables sequential chaining where each step can use a different strategy, effectively composing multiple routing approaches.
What is the difference between "auto" and "cost-optimized" strategies?
Cost-optimized sorts targets strictly by unit price from lowest to highest. Auto considers cost as one of 14 scoring factors including latency, health status, context match, and cache warmth. Auto may select a more expensive target if it offers significantly better performance or reliability.
Does OmniRoute support custom routing strategies?
The built-in 19 strategies cover the implementation in open-sse/services/combo/. Custom routing logic can be achieved by using the Pipeline strategy to chain steps with custom pre/post processing, or by extending the base combo service classes according to the patterns in strategyDispatch.ts.
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 →