How to Use Auto-Combo Prefixes Like `auto/coding` in OmniRoute

Use OmniRoute's auto/* prefix system to route requests to the best-available provider without specifying a concrete model name, leveraging variants like auto/coding for quality-first routing or auto/fast for low-latency responses.

OmniRoute provides a built-in Zero-Config "auto" combo system that dynamically selects optimal AI providers based on your specific requirements. This feature, implemented in the diegosouzapw/OmniRoute repository, eliminates the need to hardcode specific model names by analyzing active connections and applying intelligent routing logic at request time.

Parsing the Auto Prefix

When a request contains a model string starting with auto, OmniRoute invokes the parseAutoPrefix function defined in open-sse/services/autoCombo/autoPrefix.ts. This utility parses the string and extracts an optional variant (such as coding, fast, or smart) that determines the routing strategy.

// https://github.com/diegosouzapw/OmniRoute/blob/release/v3.8.51/open-sse/services/autoCombo/autoPrefix.ts
export function parseAutoPrefix(model: string | null | undefined): AutoPrefixParseResult { … }

The parser identifies the variant segment after the auto/ delimiter and validates it against the VALID_VARIANTS constant. Invalid or missing variants trigger fallback behavior to ensure requests always resolve.

Creating Virtual Combos Dynamically

After parsing the prefix, OmniRoute calls createVirtualAutoCombo from open-sse/services/autoCombo/virtualFactory.ts to construct a virtual combo on-demand. This function gathers all active provider connections matching the requested variant, applies weighting and exploration logic, and returns a combo object executable like any persisted configuration.

// https://github.com/diegosouzapw/OmniRoute/blob/release/v3.8.51/open-sse/services/autoCombo/virtualFactory.ts
export async function createVirtualAutoCombo(variant?: AutoVariant, spec?: ComboSpec, …) { … }

The virtual factory evaluates real-time provider metrics including latency, token cost, and quota availability to assemble the optimal routing chain for each request.

Request Routing Flow

The SSE handler in src/sse/handlers/autoRouting.ts intercepts chat requests specifying an auto/* model. It orchestrates the prefix parsing and virtual combo creation before handing the result to the standard chat pipeline.

// https://github.com/diegosouzapw/OmniRoute/blob/release/v3.8.51/src/sse/handlers/autoRouting.ts
const parsed = parseAutoPrefix(model);
const virtualCombo = await createVirtualAutoCombo(parsed.variant);

This integration ensures that auto-prefixed requests benefit from the same streaming, error handling, and fallback mechanisms as statically configured combos.

Supported Auto Variants

The current set of valid variants is defined in the VALID_VARIANTS array within autoPrefix.ts. These variants control provider selection criteria:

  • coding – Quality-first routing with a small exploration bump for better code generation results.
  • fast – Prioritizes low latency and minimal time-to-first-token.
  • cheap – Selects providers with the lowest per-token cost.
  • offline – Prefers providers with the most quota headroom and available capacity.
  • smart – Quality-first routing with a modest 10% exploration factor for balanced performance.
  • lkgp – "Least-known-good-provider" fallback strategy for maximum resilience.
  • chaos – Experimental panel-broadcast mode used for debugging and benchmark comparisons.
// https://github.com/diegosouzapw/OmniRoute/blob/release/v3.8.51/open-sse/services/autoCombo/autoPrefix.ts#L9-L16
export const VALID_VARIANTS: AutoVariant[] = [ "coding", "fast", "cheap", "offline", "smart", "lkgp", "chaos" ];

Advanced Composition Patterns

OmniRoute supports suffix composition and family-based routing in addition to standard variants.

Suffix Variants

Append constraints using colon notation to refine provider selection. The suffixComposition.ts handler parses patterns like auto/coding:free to filter for free-tier providers within the coding category.

curl -X POST https://your.omniroute.instance/v1/chat/completions \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
        "model": "auto/coding:free",
        "messages": [{ "role": "user", "content": "Write a short poem about sunrise" }]
      }'

Model Family Routing

Use family prefixes to constrain routing to specific model architectures. The modelFamily.ts service resolves identifiers like auto/glm, auto/gemini, or auto/claude to providers hosting those specific model families.

Discovering Available Auto Combos

The /api/combos/auto endpoint in src/app/api/combos/auto/route.ts enumerates all supported auto-prefix variants, including built-in templates (auto/best-coding, auto/pro-*) and dynamic family variants.

import fetch from "node-fetch";

async function listAutoCombos() {
  const res = await fetch("https://your.omniroute.instance/api/combos/auto");
  const data = await res.json();
  console.log(data.combos);
}

listAutoCombos();

Clients can consume this catalog to populate user-friendly dropdown menus labeled "Auto Coding", "Auto Smart", or "Auto Fast" without hardcoding variant names.

Practical Usage Examples

Basic Coding Request

Route a programming question to the best available coding-optimized provider:

curl -X POST https://your.omniroute.instance/v1/chat/completions \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
        "model": "auto/coding",
        "messages": [{ "role": "user", "content": "Explain the quicksort algorithm" }]
      }'

Latency-Critical Applications

Minimize response time for real-time interactions:

curl -X POST https://your.omniroute.instance/v1/chat/completions \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
        "model": "auto/fast",
        "messages": [{ "role": "user", "content": "Summarize this paragraph" }]
      }'

Key Implementation Files

Area File Role
Prefix parser [open-sse/services/autoCombo/autoPrefix.ts](https://github.com/diegosouzapw/OmniRoute/blob/release/v3.8.51/open-sse/services/autoCombo/autoPrefix.ts) Parses auto/* strings and extracts variant
Virtual combo factory [open-sse/services/autoCombo/virtualFactory.ts](https://github.com/diegosouzapw/OmniRoute/blob/release/v3.8.51/open-sse/services/autoCombo/virtualFactory.ts) Builds on-demand combo objects from active connections
Suffix composition [open-sse/services/autoCombo/suffixComposition.ts](https://github.com/diegosouzapw/OmniRoute/blob/release/v3.8.51/open-sse/services/autoCombo/suffixComposition.ts) Handles auto/<category>:<tier> variants
Model family resolution [open-sse/services/autoCombo/modelFamily.ts](https://github.com/diegosouzapw/OmniRoute/blob/release/v3.8.51/open-sse/services/autoCombo/modelFamily.ts) Provides auto/glm, auto/gemini, etc., combos
Auto-routing handler [src/sse/handlers/autoRouting.ts](https://github.com/diegosouzapw/OmniRoute/blob/release/v3.8.51/src/sse/handlers/autoRouting.ts) Integrates the auto combo into the chat pipeline
API endpoint for discovery [src/app/api/combos/auto/route.ts](https://github.com/diegosouzapw/OmniRoute/blob/release/v3.8.51/src/app/api/combos/auto/route.ts) Exposes the list of available auto combos for clients
Built-in catalog definitions [open-sse/services/autoCombo/builtinCatalog.ts](https://github.com/diegosouzapw/OmniRoute/blob/release/v3.8.51/open-sse/services/autoCombo/builtinCatalog.ts) Registers template, suffix, and family variants used by the auto system

Summary

  • auto/* prefixes enable zero-configuration routing to optimal providers based on use-case variants.
  • parseAutoPrefix extracts routing strategies like coding, fast, or cheap from model names.
  • createVirtualAutoCombo assembles dynamic provider chains from active connections at request time.
  • Suffix notation (:free, :pro) and family prefixes (auto/glm) provide additional filtering capabilities.
  • The /api/combos/auto endpoint allows clients to discover available variants dynamically.

Frequently Asked Questions

What is the difference between auto/coding and auto/smart?

Both variants prioritize quality, but auto/coding specifically optimizes for code generation tasks with a small exploration bump, while auto/smart provides balanced quality with a 10% exploration factor suitable for general reasoning tasks. According to the OmniRoute source code in autoPrefix.ts, these variants map to different weighting algorithms in the virtual combo factory.

How do I discover which auto prefixes my OmniRoute instance supports?

Query the /api/combos/auto endpoint defined in src/app/api/combos/auto/route.ts. This returns a JSON list of all supported variants including built-in combos like auto/best-coding, family-based options like auto/gemini, and any custom variants registered in the builtinCatalog.ts configuration.

Can I combine auto prefixes with specific provider constraints?

Yes. OmniRoute supports suffix composition using colon notation. For example, auto/coding:free routes to coding-optimized providers offering free tiers, while auto/fast:pro prioritizes low-latency providers on professional tiers. The suffixComposition.ts handler parses these constraints and passes them to the virtual combo factory as filtering parameters.

What happens if no providers match my auto variant criteria?

OmniRoute implements a fallback chain through the lkgp (least-known-good-provider) mechanism. If the primary variant criteria yield no healthy providers, the system automatically degrades to available alternatives. The autoRouting.ts handler maintains the standard error handling pipeline, ensuring requests fail gracefully with appropriate HTTP status codes only when all provider options are exhausted.

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 →