OmniRoute Auto Strategy Scoring: Breaking Down the 15 Factors That Drive Provider Selection

OmniRoute's auto routing strategy uses 15 weighted factors defined in open-sse/services/autoCombo/scoring.ts to score providers, with quota (0.15), health (0.30), costInv (0.05), latencyInv (0.35), taskFit (0.10), and tierPriority (0.05) carrying default weights that sum to 1.0, while nine additional factors remain available for custom configuration at 0.00.

OmniRoute's zero-configuration auto strategy (triggered by the auto/ model prefix) dynamically routes each request to the optimal AI provider using a multi-factor scoring algorithm. This system, implemented in the diegosouzapw/OmniRoute repository, evaluates candidates against 15 IS (Importance/Score) factors that balance operational health, cost efficiency, and task suitability. Understanding these factors enables precise customization of the DEFAULT_WEIGHTS object or per-request weight overrides to meet specific latency, budget, or quality requirements.

How OmniRoute Auto Strategy Scoring Works

The auto strategy operates as a virtual combo generator that selects providers at request time rather than using static routing. When a request arrives with model: "auto", OmniRoute executes the scoring function located in open-sse/services/autoCombo/scoring.ts.

This function calculates a composite score for each candidate provider by multiplying live metric values against static weights defined in the DEFAULT_WEIGHTS constant. The provider with the highest score receives the request. Weights are normalized to sum to 1.0 in the default configuration, ensuring consistent probability distributions across the candidate pool.

The scoring engine integrates with open-sse/services/autoCombo/virtualFactory.ts to build the candidate pool and consults open-sse/services/autoCombo/taskFitness.ts to determine taskFit values based on the specific operation type (chat, embedding, etc.).

The 15 Factors in OmniRoute's Auto Scoring Function

The DEFAULT_WEIGHTS object in scoring.ts defines the following 15 factors, divided between actively weighted defaults and zero-weight placeholders available for custom profiles:

Active Default Factors (Weighted)

These six factors carry non-zero weights in the default configuration and drive the primary routing decisions:

  • latencyInv (0.35): Inverse latency metric where lower response times generate higher scores. This is the heaviest-weighted factor in the default profile.
  • health (0.30): Provider health status derived from circuit-breaker state and availability checks.
  • quota (0.15): Remaining budget or quota availability for the provider, preventing overages.
  • taskFit (0.10): Alignment score between the model's capabilities and the requested task type, looked up via taskFitness.ts.
  • tierPriority (0.05): Preference weighting for higher-tier or paid models over free tiers.
  • costInv (0.05): Inverse cost factor where cheaper models receive higher scores, promoting economic efficiency.

Inactive Default Factors (Zero-Weight Placeholders)

These nine factors default to 0.00 but can be activated via custom weight profiles in open-sse/services/autoCombo/modePacks.ts or per-request configuration:

  • stability: Historical error rate and reliability consistency of the specific model.
  • recentErrors: Rolling window count of recent errors for the model or connection.
  • cacheAffinity: Preference for providers where the request would hit a cached response.
  • resetWindowAffinity: Affinity for models currently within their rate-limit reset window.
  • modelAge: Freshness score of the model version, favoring newer deployments.
  • providerScore: External provider ratings such as Arena ELO or composite quality scores.
  • tokenDensity: Cost-efficiency metric measuring tokens processed per dollar spent.
  • regionLatency: Geographic latency component separate from the primary latency calculation.
  • bandwidthUtil: Current bandwidth utilization percentage of the provider endpoint.

Customizing Factor Weights for Specific Use Cases

While the default weights optimize for low latency and healthy providers, OmniRoute supports custom weight profiles defined in modePacks.ts (such as ship-fast, cost-saver, quality-first, and offline-friendly) and runtime overrides via the request body.

Using the Default Auto Strategy

Request a chat completion with the balanced default weights:

// Request using default auto scoring weights
await fetch("https://localhost:20128/v1/chat/completions", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    model: "auto",
    messages: [{ role: "user", content: "Explain quantum tunneling." }]
  })
});

Overriding Weights Per-Request

Adjust the 15 factors for a single request by passing a custom weights object in the config.auto.weights property:

await fetch("https://localhost:20128/v1/chat/completions", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    model: "auto",
    config: {
      auto: {
        weights: {
          costInv: 0.5,      // Prioritize cheap models
          latencyInv: 0.2,
          health: 0.2,
          quota: 0.1
        }
      }
    },
    messages: [{ role: "user", content: "Write a short poem." }]
  })
});

Creating Persisted Custom Combos

Define reusable weight configurations by POSTing to the combos API:

POST /api/combos
{
  "name": "Auto-Fast-Cheap",
  "strategy": "auto",
  "config": {
    "auto": {
      "weights": {
        "latencyInv": 0.45,
        "costInv": 0.35,
        "health": 0.15,
        "quota": 0.05
      }
    }
  }
}

Key Source Files and Implementation Details

The auto strategy implementation spans several specialized modules:

File Purpose
open-sse/services/autoCombo/scoring.ts Contains DEFAULT_WEIGHTS and the core 15-factor scoring algorithm
open-sse/services/autoCombo/modePacks.ts Pre-defined weight profiles including ship-fast, cost-saver, quality-first
open-sse/services/autoCombo/autoPrefix.ts Parses the auto/ prefix and variant selectors from request models
open-sse/services/autoCombo/virtualFactory.ts Constructs the virtual combo and candidate provider pool per request
open-sse/services/autoCombo/taskFitness.ts Maps task types to model capability scores for the taskFit factor
src/sse/handlers/chat.ts Entry point that detects auto strategy requests and triggers scoring
docs/routing/AUTO-COMBO.md Technical documentation covering factor definitions and weight tuning

Summary

  • OmniRoute's auto strategy evaluates providers using 15 distinct factors defined in scoring.ts, combining live metrics with static weights.
  • Six factors carry default weights: latencyInv (0.35), health (0.30), quota (0.15), taskFit (0.10), tierPriority (0.05), and costInv (0.05).
  • Nine additional factors (stability, cacheAffinity, recentErrors, etc.) default to 0.00 but can be activated via custom profiles in modePacks.ts or per-request configuration.
  • Weights are normalized to sum to 1.0 in the default profile to ensure consistent probability scoring across the provider candidate pool.
  • The scoring engine integrates with virtualFactory.ts and taskFitness.ts to build dynamic provider pools matched to specific task requirements.

Frequently Asked Questions

What is the difference between latencyInv and regionLatency in OmniRoute auto scoring?

latencyInv (default weight 0.35) measures the inverse of current response latency for the specific model endpoint, making it the primary driver for speed optimization. regionLatency (default weight 0.00) represents geographic network latency between the OmniRoute instance and the provider's datacenter region. While latencyInv captures end-to-end model performance, regionLatency isolates network topology factors and remains inactive unless explicitly weighted in a custom configuration.

How do I activate the zero-weight factors like cacheAffinity or tokenDensity?

Create a custom weight profile in open-sse/services/autoCombo/modePacks.ts or pass an override object in the request's config.auto.weights field. For example, setting "cacheAffinity": 0.4 and reducing other weights proportionally will cause the scorer to favor providers where your prompt hash exists in the response cache. All 15 factors accept floating-point weights between 0 and 1, provided your total weight distribution reflects your intended priority balance.

Why does the default configuration ignore stability and recentErrors?

The stability and recentErrors factors default to 0.00 because the default profile prioritizes immediate operational metrics (health, quota, latency) over historical error rates. The health factor (0.30) already incorporates circuit-breaker state, which acts as a binary gate for severely degraded providers. However, for applications requiring fine-grained risk management, activating recentErrors with a positive weight allows the scorer to penalize models experiencing transient error spikes before the circuit breaker trips.

Can I use negative weights for factors I want to avoid?

The DEFAULT_WEIGHTS object and TypeScript interfaces in scoring.ts expect positive floating-point values between 0 and 1. To penalize undesirable characteristics (such as high cost), rely on inverse factors like costInv (where higher values indicate cheaper models) rather than negative weighting. If a specific provider characteristic should disqualify a candidate entirely, use the health circuit-breaker mechanism or filter the candidate pool in virtualFactory.ts rather than applying negative scoring weights.

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 →