What Are the 19 Routing Strategies in OmniRoute? Complete Guide with Code Examples

OmniRoute provides 19 predefined routing strategies that control how requests are dispatched across AI providers, including priority, weighted, round-robin, cost-optimized, and advanced strategies like context-relay and pipeline.

Understanding these routing strategies is essential for optimizing performance, cost, and reliability in OmniRoute's combo engine. This article covers all 19 user-facing strategies defined in src/shared/constants/routingStrategies.ts, plus the internal-only quota-share strategy used for automatic quota management.

Basic Routing Strategies

These fundamental strategies handle straightforward request distribution without complex state tracking.

Priority

Always selects the first (highest-priority) target in your combo configuration. Use this when you have a clear preferred provider and only want fallbacks when it fails.

Weighted

Distributes requests according to assigned weights. If Provider A has weight 3 and Provider B has weight 1, Provider A receives 75% of traffic.

const combo = await createCombo({
  name: 'weighted-combo',
  strategy: 'weighted',
  targets: [
    { provider: 'openai', model: 'gpt-4', weight: 3 },
    { provider: 'anthropic', model: 'claude-3', weight: 1 },
  ],
});

Round-Robin

Cycles through targets in fixed order, giving each provider equal turns regardless of performance or load.

Random

Uniform random selection across all targets. Simple but lacks predictability for monitoring and debugging.

Strict-Random

Random selection with stricter fairness guarantees than basic random, ensuring statistical distribution converges faster to uniform over smaller sample sizes.

Load-Aware and Performance Strategies

These strategies incorporate runtime metrics to make smarter routing decisions.

P2C (Power-of-Two-Choices)

Randomly samples two targets and selects the one with lower load. This achieves near-optimal load balancing with minimal coordination overhead, avoiding the thundering herd problem that pure random selection can cause.

Least-Used

Prefers the target that has been used least recently. Tracks actual usage counters rather than just request counts.

Fill-First

Completely fills the first target's quota before moving to the next. Useful when you want to exhaust cheaper or preferred credits before consuming premium allocations.

Headroom

Selects the target with the most remaining quota headroom. Prioritizes providers with the largest margin before hitting rate limits.

Reset-Aware

Prefers targets that have recently reset their usage counters, taking advantage of fresh quota windows.

Reset-Window

Applies a sliding-window reset policy for quota management, smoothing out usage spikes across time windows rather than hard reset boundaries.

Cost and Efficiency Strategies

Optimize for financial and computational efficiency.

Cost-Optimized

Selects the cheapest target that satisfies the request's requirements. Compares pricing across providers in real-time.

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

const userInput = 'Cost';  // User-friendly input
const strategy = normalizeRoutingStrategy(userInput);
// Returns: "cost-optimized"

Context-Relay

Relays the request to the next target while preserving full context. Enables seamless failover without losing conversation history.

Context-Optimized

Prioritizes providers that can handle the current context size efficiently. Routes large contexts to models with better long-context pricing or performance.

Cache-Optimized

Prefers providers where cached results are available or likely, reducing latency and API costs for repeated or similar requests.

Advanced Composite Strategies

Complex strategies that transform or combine provider outputs.

Auto

OmniRoute's built-in Auto Combo strategy that dynamically selects the best target based on runtime metrics including latency, error rates, cost, and quota status. This is the default recommendation for most production deployments.

LKGP (Last-Known-Good-Provider)

Falls back to the last provider that succeeded for the same request type. Learns from historical success patterns to improve reliability.

Fusion

Combines results from multiple providers into a single unified response. Aggregates outputs rather than selecting one winner.

Pipeline

Pipes the output of one provider as input to the next, forming a processing chain. Enables multi-stage workflows like translation → refinement → formatting.

Internal Strategy: Quota-Share

OmniRoute defines one internal-only strategy not exposed in the UI or public API:

  • quota-share – Used by automatically generated combos for quota sharing across organization members. Reserved for internal system operations.

Complete Strategy Reference

List all 19 user-facing routing strategies in OmniRoute using the ROUTING_STRATEGY_VALUES constant:

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

// Full list of 19 strategies
console.log('Available routing strategies:', ROUTING_STRATEGY_VALUES);
// [
//   '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'
// ]

Key Implementation Files

File Purpose
src/shared/constants/routingStrategies.ts Canonical list of strategies and helper utilities
src/app/(dashboard)/dashboard/combos/page.tsx UI for displaying and editing combo strategies
open-sse/services/combo/comboSetup.ts Combo engine configuration
src/lib/db/combo.ts Database model for persisting combo configurations

Summary

  • 19 user-facing routing strategies in OmniRoute, defined in src/shared/constants/routingStrategies.ts
  • Basic strategies: priority, weighted, round-robin, random, strict-random
  • Load-aware strategies: p2c, least-used, fill-first, headroom, reset-aware, reset-window
  • Efficiency strategies: cost-optimized, context-relay, context-optimized, cache-optimized
  • Advanced strategies: auto, lkgp, fusion, pipeline
  • Internal strategy: quota-share (not exposed in UI/API)
  • Use ROUTING_STRATEGY_VALUES to enumerate all strategies programmatically
  • Use normalizeRoutingStrategy() to convert user-friendly inputs to canonical strategy names

Frequently Asked Questions

How do I choose the right routing strategy for my use case?

Start with auto for most scenarios—it adapts to real-time conditions. Use priority when you have a clear preferred provider, cost-optimized when minimizing spend is critical, and fusion or pipeline when you need to combine or chain model outputs. For high-throughput systems, p2c provides excellent load balancing without complex coordination.

Can I use multiple routing strategies in the same combo?

Individual combos use one strategy at a time, but you can nest combos to achieve multi-strategy behavior. Create separate combos with different strategies, then reference them as targets in a parent combo using priority or weighted to orchestrate between them.

What's the difference between reset-aware and reset-window strategies?

Reset-aware selects targets based on whether their usage counters recently reset—immediate opportunism. Reset-window uses a sliding time window for quota calculations, smoothing usage across arbitrary periods rather than provider-defined reset boundaries. Use reset-window when you need predictable, time-based quota enforcement independent of provider-specific reset schedules.

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 →