OmniRoute Routing Strategies: The Complete Guide to All 19 Methods and When to Use Each

OmniRoute provides 19 distinct routing strategies that control how requests are dispatched across AI providers, ranging from simple priority-based selection to advanced dynamic optimization and multi-provider fusion.

The ROUTING_STRATEGY_VALUES constant in src/shared/constants/routingStrategies.ts defines the authoritative list used by OmniRoute's combo engine, UI, and API. This guide breaks down each strategy's mechanics, use cases, and implementation details based on the actual source code.

Basic Selection Strategies

These foundational strategies handle provider selection through straightforward rules.

Priority

Always routes to the first (highest-priority) target in the list. In src/shared/constants/routingStrategies.ts, this is the simplest strategy with zero runtime overhead.

Use when you have a clear preferred provider and want predictable, deterministic routing. Ideal for development environments or when one provider offers guaranteed superior performance.

Weighted

Distributes traffic proportionally based on assigned weights. Each target specifies a relative weight; the engine normalizes these to probabilities.

Use when you want controlled traffic splitting—such as 70% to a premium provider and 30% to a cost-efficient backup. The weights are configured per-target in the combo definition.

Round-Robin

Cycles through targets in fixed sequential order, advancing the pointer with each request.

Use for even load distribution across equivalent providers. Best when targets have similar capabilities and you want to prevent any single provider from receiving disproportionate traffic.

Fill-First

Saturates the first target until reaching a configured limit, then overflows to subsequent targets.

Use for tiered capacity planning—exhausting a cheaper or preferred quota before falling back to alternatives. Common in cost-optimized deployments with usage-based pricing tiers.

Load-Aware Strategies

These strategies incorporate real-time or historical load information to improve routing decisions.

Least-Used

Selects the target with the lowest recent usage count.

Use when you want to minimize individual provider load without complex metrics. Simple but effective for basic fairness across a provider pool.

P2C (Power-of-Two-Choices)

Randomly samples two targets and selects the one with lower current load. This algorithm—implemented in OmniRoute's routing engine—provides near-optimal load balancing with minimal coordination overhead.

Use at scale when you need distributed load balancing without a centralized load oracle. The stochastic approach avoids thundering-while-herd problems that plague naive least-loaded strategies.

Headroom

Chooses the target with the most remaining quota headroom.

Use when providers have hard rate limits or quota caps. Prioritizes providers that can absorb traffic spikes without throttling, making it resilient for bursty workloads.

Reset-Aware and Reset-Window

Reset-aware prefers targets that have recently reset usage counters. Reset-window implements a sliding-window policy for quota management.

Use these when providers enforce rolling time-window quotas (e.g., "10,000 requests per hour"). These strategies synchronize routing decisions with quota boundary events to maximize usable capacity.

Cost and Context Strategies

These strategies optimize for economic efficiency and request-specific requirements.

Cost-Optimized

Selects the cheapest target that can satisfy the request constraints.

Use when cost minimization is the primary objective. The engine evaluates provider pricing against the request's model requirements and token estimates to find the lowest-cost eligible option.

Context-Optimized

Prioritizes providers that handle the current context size efficiently.

Use for requests with large context windows. Some providers charge disproportionately for long contexts or have technical limitations; context-optimized routing matches payload characteristics to provider strengths.

Cache-Optimized

Prefers providers where cached results are most likely to benefit the request.

Use for workloads with high cacheability—repeated prompts, similar embeddings, or templated queries. The strategy factors in cache hit rates and provider-specific caching behavior.

Dynamic and Adaptive Strategies

These strategies respond to runtime conditions and historical performance.

Auto

OmniRoute's built-in "Auto Combo" strategy that dynamically selects targets based on real-time metrics. According to src/app/(dashboard)/dashboard/combos/page.tsx, this is exposed as a first-class option in the combo configuration UI.

Use when you want hands-off optimization. The strategy continuously evaluates latency, error rates, cost, and utilization to route each request optimally without manual tuning.

LKGP (Last-Known-Good-Provider)

Falls back to the provider that most recently succeeded for the same request type.

Use for resilience in heterogeneous workloads. By tracking per-request-type success patterns, LKGP avoids repeatedly attempting providers that have failed on similar inputs.

Advanced Composition Strategies

These strategies combine or chain multiple providers for sophisticated processing patterns.

Context-Relay

Relays the request to the next target while preserving full conversation context.

Use for multi-turn conversations that need to migrate between providers mid-stream. The strategy ensures context continuity when switching providers for cost, capability, or reliability reasons.

Fusion

Combines results from multiple providers into a single unified response.

Use when you want ensemble benefits—merging outputs from different models to improve quality, confidence, or coverage. The implementation aggregates results according to configurable fusion rules.

Pipeline

Chains providers sequentially, passing the output of one as input to the next.

Use for multi-stage processing workflows—such as routing through a cheap model for initial filtering, then a premium model for final generation. Defined in open-sse/services/combo/comboSetup.ts, this enables complex provider orchestration.

Randomization Strategies

These strategies introduce controlled randomness for specific operational goals.

Random

Uniformly random target selection.

Use for simple load distribution when targets are equivalent and you want minimal policy complexity. Avoids any state tracking overhead.

Strict-Random

Random selection with stricter fairness guarantees over bounded sequences.

Use when statistical fairness matters—ensuring no target receives systematically biased selection over observable windows. More computationally intensive than basic random but provides stronger fairness properties.

Internal and Specialized Strategies

Quota-Share

An internal-only strategy used by automatically generated combos for quota sharing. As noted in src/shared/constants/routingStrategies.ts, this is not exposed in the UI or public API.

Automatically applied by OmniRoute's infrastructure when distributing quota across organizational boundaries. Manual configuration is unsupported.

Working with Routing Strategies in Code

Listing All Available Strategies

The canonical enumeration is accessible through the constants module:

import { ROUTING_STRATEGY_VALUES } from '@/shared/constants/routingStrategies';

// All 19 user-facing strategies
console.log('Available routing strategies:', ROUTING_STRATEGY_VALUES);
// Output: ['priority', 'weighted', 'round-robin', 'context-relay', ...]

Creating a Combo with a Specific Strategy

Per src/lib/db/combo.ts, strategy selection is persisted at combo creation:

import { createCombo } from '@/lib/db/combo';
import { ROUTING_STRATEGY_VALUES } from '@/shared/constants/routingStrategies';

async function makeCostOptimizedCombo() {
  const combo = await createCombo({
    name: 'budget-conscious',
    strategy: 'cost-optimized',
    targets: [
      { provider: 'openai', model: 'gpt-4o-mini' },
      { provider: 'anthropic', model: 'claude-3-haiku' },
    ],
  });
  return combo;
}

Normalizing User Input

The normalizeRoutingStrategy helper handles case variations and aliases:

import { normalizeRoutingStrategy } from '@/shared/constants/routingStrategies';

const strategy = normalizeRoutingStrategy('round robin');
console.log(strategy); // → "round-robin"

Strategy Selection Decision Matrix

Goal Recommended Strategy
Maximum predictability priority
Controlled traffic split weighted
Even load distribution round-robin or p2c
Cost minimization cost-optimized
Large context handling context-optimized
Quota-limited environments headroom or reset-window
Hands-off optimization auto
Failure resilience lkgp
Multi-provider ensemble fusion
Multi-stage processing pipeline

Summary

  • OmniRoute defines 19 user-facing routing strategies in src/shared/constants/routingStrategies.ts, plus one internal quota-share strategy
  • Strategies span five categories: basic selection, load-aware, cost/context optimization, dynamic adaptation, and advanced composition
  • The auto strategy provides zero-config optimization; fusion and pipeline enable sophisticated multi-provider workflows
  • Strategy configuration persists through createCombo() in src/lib/db/combo.ts and is resolved at runtime by the combo engine
  • The normalizeRoutingStrategy() helper ensures robust input handling for user-provided strategy names

Frequently Asked Questions

How do I switch routing strategies without recreating my combo?

Update the combo's configuration through the dashboard UI at /dashboard/combos (implemented in src/app/(dashboard)/dashboard/combos/page.tsx) or via the API. The routing engine picks up strategy changes on the next request without requiring combo recreation.

What's the difference between random and strict-random in OmniRoute?

Random provides uniform independent sampling with no guarantees about short-term distribution. Strict-random enforces bounded fairness—ensuring that over any window of N requests, no target receives more than its proportional share plus a small delta. Use strict-random when statistical guarantees matter; use random when minimal overhead is priority.

Can I combine multiple routing strategies in a single combo?

Direct combination isn't supported—each combo specifies one strategy. However, the fusion and pipeline strategies inherently compose multiple providers, and nested combos (a combo as a target within another combo) can layer strategies indirectly. For complex policies, the auto strategy often outperforms manual composition.

Why don't I see quota-share in the strategy dropdown?

Quota-share is intentionally internal-only, used by OmniRoute's automated infrastructure for organizational quota management. It's excluded from ROUTING_STRATEGY_VALUES and the UI to prevent misconfiguration. If you need quota-aware routing, use headroom or reset-aware instead.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →