Skip to main content
Version: Latest (main)

Configuration

Semantic Router uses one canonical YAML document across the CLI, Dashboard, Helm, and Operator. The top-level structure is:

version:
listeners:
providers:
evaluation:
recipes:
entrypoints:
global:
  • Start small. Most deployments begin with version, listeners, providers and one recipe.
  • One recipe needs no entrypoints. It serves vllm-sr/auto. Several recipes need entrypoints, with exactly one chat entrypoint marked default: true.
  • Add global only when needed: for shared services, default plugins, or runtime behavior that differs from the built-in defaults.

What belongs where​

SectionOwns
versionCanonical schema version. Use v0.5.
listenersPublic Router listeners: address, port, timeouts, client API keys, model allowlists, TLS and trusted identity. See Listeners.
providersLogical provider models: their backend endpoints, pricing, defaults, and the facts routing reads about each model (capabilities, modalities, context window, LoRA adapters).
evaluationOptional operator-owned benchmark definitions, versioned index DAGs, and model-linked records.
recipesIsolated routing profiles: each recipe's signals, projections, decisions, strategy, fallback, candidate requirements, model bindings, and default plugins.
entrypointsPublic virtual model names mapped to a recipe; with several recipes, exactly one chat entrypoint is the default.
globalRouter services, stores, integrations, observability, learning, the default plugins every request runs (global.plugins), and the models the Router asks (global.model_catalog).

Keep these boundaries clear:

  • signals detect facts;
  • projections combine evidence;
  • decisions define eligibility and route policy;
  • algorithms choose or coordinate candidate models;
  • plugins add behavior at route-specific hook points; and
  • providers bind logical model names to inference endpoints.

The Routing Pipeline explains the design, and the pages under Capabilities document each signal, projection, decision, algorithm, plugin and global block.

Listeners​

FieldMeaningDefault
timeoutThe whole call, including its streamed response; it also bounds a stalled stream. 0s lifts both limits. To lift only one model's call limit, set that model's total_timeout: 0s.300s
api_keysClient API keys the listener requires. A "${NAME}" entry reads the key from that environment variable, with an uppercase NAME as every reference in the configuration.none
api_key_filesAbsolute paths of owner-only files that each hold one more client key, read at every load. Standalone mode reads them; --gateway extproc refuses them. See Keep credentials out of configuration.none
apisThe APIs the listener serves, by API name: chat_completions, responses, messages, images and systemone (openai and anthropic are accepted as aliases of chat_completions and messages). Any other API path answers 404 with a detail naming the listener. Standalone mode serves systemone; --gateway extproc refuses a listener that serves it.the four LLM APIs, no systemone
apis.<api>.prefixA path root the API is also served under, as an AI Gateway registers a provider's endpoints: prefix: /anthropic on messages serves /anthropic/v1/messages and /anthropic/v1/messages/count_tokens as /v1/messages. The API's own paths keep working, and the upstream request never carries the prefix. Segments only, with a leading slash and no trailing slash.none
apis.<api>.modelsThe only request models an API accepts.every model of its kind
apis.<api>.unserved_modelsWhat chat_completions, responses and messages do with a request whose model they do not accept or the Router does not serve: {policy: reject} answers 403 model_not_allowed or 404 model_not_found; {policy: route, route_to: <model>} routes it as if it named route_to, one of the API's models that names an entrypoint. The Replay record keeps the name the client gave in requested_model, and x-vsr-trace in requested_model. Standalone mode applies it; --gateway extproc refuses it. See Model names the harness picks itself.reject
apis.systemone.schemaThe System One schema the listener speaks to its clients: vllm-sr/5.0, or vllm-sr/4.0, which also accepts every request form of the earlier contract. See System One schemas.vllm-sr/5.0
apis.systemone.max_deadline_msThe longest a System One request waits for a model.10 minutes
apis.systemone.vsrWhat the vSR agent plugins pointed at the listener do: redact, shield, guard, check, escalate, router and router_turns on or off, and router_goal (quality, balanced or save). The listing (GET /v1/systemone/models) hands it to the plugins, and each field set here wins over the plugin's own option. The Dashboard edits each field as Default (left out), On or Off under Settings › Router settings › vSR agent plugins. See Agent harnesses.the plugins' own options
tls.cert_file, tls.key_fileOne-way TLS.off
identity.trust_headers, identity.trusted_peersThe identity sources the listener trusts, in standalone mode.none

Providers and model facts​

  • Facts. The facts routing reads about a model sit on its providers.models[] entry.
  • Pricing. providers.models[].pricing takes an optional uppercase three-letter currency, plus non-negative prompt_per_1m, completion_per_1m, cached_input_per_1m, cache_write_per_1m and cache_write_1h_per_1m rates. A model without it takes its provider's list price when the catalog lists one. A written block always wins and defaults currency to USD, so zero rates mark a model free.
  • Backend format. Protocol Compatibility helps you choose a backend's api_format. Check Backend Target Compatibility before moving bindings between Docker, Helm, the Operator and the Dashboard.

The Router's own models​

The decision model that answers signals and the embedding model that recall uses are deployments under global.model_catalog.deployments. They run in the model runtime, or point to a remote API.

  • One default. The decision model answers every model-judged signal unless something names another deployment.
  • Overrides, most specific first: a rule's own deployment, then recipes[].model_bindings.<type>, then global.model_catalog.bindings.<type>.
  • Limits. A remote deployment's limits.max_request_bytes and limits.max_response_bytes cap one exchange with it.

Choose a model for a signal explains the rule, and the model catalog reference lists every deployment field.

Evaluation records​

Measurements belong in evaluation.records[], and reference a canonical Model Card identity through model. Built-in benchmark IDs work directly; define new benchmarks and indices beside the records. See Custom evaluations.

Debug surfaces stay closed

global.services.observability.profiling serves Go pprof endpoints only when enabled, on 127.0.0.1:6060 unless you change bind. The Router reads it once at startup, so a change needs a restart. See API and Observability.

Capability catalog​

Use this catalog to choose a reusable building block, then open its guide for configuration details. The inventory comes from config/fragments/; each one-line goal comes from the matching guide's Overview. The documentation build regenerates this block and fails if the checked-in catalog has drifted.

Signals​

Family and typeUse it toReusable fragmentGuide
agent — heuristic signalagent matches the agent a request belongs to: the main agent or a subagent, the harness that sent it, the type the harness gives the subagent, and the request's class, such as a compaction.config/fragments/signal/agent/Guide
authz — heuristic signalauthz turns identity and policy bindings into reusable routing inputs under recipes[].signals.role_bindings.config/fragments/signal/authz/Guide
complexity — application signalcomplexity rates how difficult a request is to answer well: easy, medium or hard.config/fragments/signal/complexity/Guide
context — heuristic signalcontext detects requests that need a larger effective context window.config/fragments/signal/context/Guide
conversation — heuristic signalconversation routes on chat structure and protocol facts, such as message count, developer instructions, available tools, explicit tool-use constraints, or an active tool loop.config/fragments/signal/conversation/Guide
domain — application signaldomains routes on the request's subject area, one of 14 that the decision model chooses.config/fragments/signal/domain/Guide
fact-check — application signalfact_check detects requests whose answer relies on factual claims that should be verified.config/fragments/signal/fact-check/Guide
hallucination — application signalhallucination finds the claims in the model's answer that its grounding context does not support.config/fragments/signal/hallucination/Guide
input-modality — heuristic signalinput_modality deterministically matches which kinds of input — text, image, audio, or video — are present in the parsed request.config/fragments/signal/input-modality/Guide
jailbreak — application signaljailbreak detects prompt-injection and jailbreak attempts, in the request before routing or in the model's answer.config/fragments/signal/jailbreak/Guide
keyword — heuristic signalkeyword matches explicit words and phrases in the request.config/fragments/signal/keyword/Guide
language — heuristic signallanguage detects the request language and exposes it as a routing signal.config/fragments/signal/language/Guide
metadata — heuristic signalmetadata matches bounded string values supplied by the caller in request metadata.config/fragments/signal/metadata/Guide
modality — application signalmodality reads which output the request asks for: text, an image, text with an image, speech, audio or video.config/fragments/signal/modality/Guide
pii — application signalpii locates personal data in the request, with the exact characters of every span.config/fragments/signal/pii/Guide
refusal — application signalrefusal asks the decision model whether the model's answer declines the request.config/fragments/signal/refusal/Guide
safety — application signalsafety detects harmful content in the request or the model's answer, optionally in named harm categories.config/fragments/signal/safety/Guide
systemone — primitive signalsystemone asks the decision model a typed question you write, and turns the answer into a routing fact.config/fragments/signal/systemone/Guide
turn-relation — application signalturn_relation asks the decision model how the current user turn relates to the conversation before it.config/fragments/signal/turn-relation/Guide
user-feedback — application signaluser_feedbacks reads what the current user turn says about the previous answer.config/fragments/signal/user-feedback/Guide

Selectors​

Family and typeUse it toReusable fragmentGuide
latency-aware — selectorTo choose the fastest eligible candidate, weight Multi Factor on latency alone.config/fragments/algorithm/selection/latency-aware.yamlGuide
multi-factor — selectormulti_factor chooses one candidate from quality, latency, cost, and load.config/fragments/algorithm/selection/multi-factor.yamlGuide
random — selectorrandom picks one model uniformly from a decision's eligible candidates.config/fragments/algorithm/selection/random.yamlGuide
static — selectorstatic provides deterministic model choice without metrics or learned state.config/fragments/algorithm/selection/static.yamlGuide
systemone — selectorsystemone asks a System One model which of a routing decision's modelRefs should answer the request.config/fragments/algorithm/selection/systemone.yamlGuide

Executors​

Family and typeUse it toReusable fragmentGuide
escalate — executorescalate calls a decision's candidates one at a time, in order, and returns the first answer it accepts.config/fragments/algorithm/looper/escalate.yamlGuide
fusion — executorfusion asks several models to answer a request and a judge model to synthesize one final answer.config/fragments/algorithm/looper/fusion.yamlGuide
ratings — executorratings calls every candidate model and returns one OpenAI-compatible choice per successful model. max_concurrent limits parallel work; it does not limit the total number of candidates executed.config/fragments/algorithm/looper/ratings.yamlGuide
remom — executorremom runs several candidate models across bounded rounds and synthesizes their responses into one answer.config/fragments/algorithm/looper/remom.yamlGuide
workflows — executorworkflows runs a bounded, multi-step Router Flow behind one OpenAI-compatible model name.config/fragments/algorithm/looper/workflows.yamlGuide

Plugins and bundles​

Family and typeUse it toReusable fragmentGuide
content-safety — plugin bundleContent Safety combines supported route-local safety plugins into one reusable policy.config/fragments/plugin/content-safety/Guide
context — route plugincontext is the plugin that assembles the request's context.config/fragments/plugin/context/Guide
fast-response — route pluginfast_response is a route-local plugin that returns a deterministic fallback message immediately, or, with block: true, refuses the request with it.config/fragments/plugin/fast-response/Guide
header-mutation — route pluginheader_mutation is a route-local plugin for adding, updating, or deleting downstream headers.config/fragments/plugin/header-mutation/Guide
masking — route pluginmasking is a route-local plugin that detects personal data (emails, phone numbers, names, and other configured entity types) in the provider-bound request and replaces each occurrence with a deterministic placeholder, such as [EMAIL_ADDRESS_0], immediately before the request is encoded and sent to the model provider.config/fragments/plugin/masking/Guide
prompt-cache — route pluginprompt_cache is a route-local plugin that inserts Anthropic prompt-cache breakpoints on a matched route.config/fragments/plugin/prompt-cache/Guide
request-params — route pluginrequest_params is a route-local plugin that validates and trims OpenAI Chat Completions request bodies before they are forwarded to backends.config/fragments/plugin/request-params/Guide
response-cache — route pluginresponse_cache is the route-local plugin for reusing exact or semantically compatible prior responses.config/fragments/plugin/response-cache/Guide
response-guard — route pluginresponse_guard is a route-local plugin that blocks or annotates the model's answer on the signals it is checked with.config/fragments/plugin/response-guard/Guide
router-replay — route pluginUse Router Replay to inspect requests in the Dashboard's Requests page: the selected route, model, token usage, response, and tool trajectory.config/fragments/plugin/router-replay/Guide
system-prompt — route pluginsystem_prompt is a route-local plugin for inserting or modifying the system prompt on matched traffic.config/fragments/plugin/system-prompt/Guide
tools — route plugintools is the route-local plugin for the request's tools.config/fragments/plugin/tools/Guide

Minimal example​

version: v0.5
listeners:
- name: http-8899
address: 0.0.0.0
port: 8899
timeout: 300s
providers:
defaults:
model: local/general
models:
- name: local/general
provider_model_id: my-served-model
backend_refs:
- name: primary
endpoint: host.docker.internal:8000
protocol: http
provider: vllm
capabilities: [chat]
recipes:
- name: default
strategy: priority
signals:
keywords:
- name: needs_explanation
operator: OR
keywords: ["explain", "walk me through"]
decisions:
- name: explanatory_answer
description: Prefer an explanatory answer when the request asks for one.
priority: 100
rules:
operator: AND
conditions:
- type: keyword
name: needs_explanation
modelRefs:
- model: local/general
global:
services:
observability:
metrics:
enabled: true

Model configuration​

Models can inherit identity and reasoning from the built-in catalog or define a private model locally. This catalog-backed example lets the selected Provider mapping supply the native model ID, protocol, reasoning transport, and request path:

providers:
defaults:
model: production
reasoning_effort: medium
models:
- name: production
catalog: openai/gpt-5.6-sol
backend_refs:
- provider: openai
auth: {api_key_env: OPENAI_API_KEY}

The name remains the local Router alias. A private or newly released model omits catalog, and can define its own Model Card and reasoning contract under that alias.

When a signal fails

By default, a failed or late signal's condition does not match. Set rules.on_unknown on a decision to decide otherwise; see Decisions.

Validate and serve​

vllm-sr config validate --config config.yaml
vllm-sr serve --config config.yaml

Validation catches schema errors, unresolved references, incompatible recipe boundaries, invalid provider bindings, and unsupported plugin or algorithm settings before the Router starts.

Portable recipes

For a recipe shared without models, set recipes[].decisions[].algorithm.minimum_candidates to the smallest pool the decision needs. The empty recipe stays valid; publishing an entrypoint fails if its assigned models fall short.

Environment references and secrets​

Keep credentials outside the YAML file:

api_key: ${MODEL_API_KEY}
FormExpands to
${VAR}, $VARThe value of VAR
${VAR:-default}default when VAR is unset or empty
${VAR-default}default when VAR is unset
$$A literal $
  • VAR is an uppercase name: A-Z, digits and _, not starting with a digit. Any other $ text stays as written, such as $100, a template's {{range $i := ...}} or a ${user_content} placeholder.
  • A custom recipe must authorize the host variables it needs with --recipe-env NAME.
  • On Kubernetes, put sensitive values in Secrets, not ConfigMaps or Helm values. See Security Hardening.

Entrypoints and recipes​

  • One recipe: no entrypoints are needed. The recipe is the default, and is published as vllm-sr/auto.
  • Several recipes: entrypoints maps their public model names, and exactly one chat entrypoint is marked default: true. vllm-sr/auto is published only when an entrypoint names it.

Names have no implicit meaning: a recipe called MoM is just a name.

recipes:
- name: balanced
decisions: []
- name: private
decisions: []
entrypoints:
- model_names: [vllm-sr/auto]
recipe: balanced
default: true
- model_names: [acme/private]
recipe: private
FieldMeaning
entrypoints[].model_namesThe public model aliases.
entrypoints[].recipeThe recipe those aliases enter.
entrypoints[].defaultMarks the default chat entrypoint.
entrypoints[].review_modelOptional model name of another entrypoint in the same API namespace for agent approval reviews. The target cannot have its own review_model or memory_model. See Approve for me.
entrypoints[].memory_modelOptional model name of another entrypoint in the same API namespace for agent memory extraction and consolidation. The target cannot have its own review_model or memory_model. See Codex memories.
recipes[]One recipe's policy: its signals, projections, decisions, algorithms, plugins, cache, learning and routing state.

Providers, stores and the model catalog's deployments can be shared without letting policy state cross recipe boundaries. A concrete provider model name skips recipes: it bypasses signals, decisions, plugins, cache, learning and session routing.

Defaults and overrides​

Defaults live in global; a recipe overrides them, and a decision overrides its recipe:

SettingDefault inOverridden by
Strategy and fallbackglobal.router.strategy, global.router.fallbackEach recipe's strategy and fallback; a decision's fallback
Pluginsglobal.pluginsA recipe's plugins, then a decision's plugins
Deployments that answer signalsglobal.model_catalog.bindingsA recipe's model_bindings, then a rule's deployment
  • No inheritance between recipes. Each recipe resolves its own settings against global.
  • Sparse overrides. fallback: {enabled: false} keeps the other fallback defaults. The runtime strategy default is priority.
  • Plugins merge by type, field by field. Mappings merge key by key; a list or scalar replaces the value below it.
  • Unmatched requests. A request that matches no decision runs its recipe's layered plugins; a request for a concrete model runs global.plugins but skips what needs a recipe: the response cache, the context plugin's retrieval, response_guard and masking.
  • Model facts. capabilities, modalities, context_window_size, max_output_tokens and loras sit on the model's providers.models[] entry.

If no decision matches, the recipe uses providers.defaults.model. The virtual entrypoint name never reaches a backend.

Recipe candidate requirements​

Set optional candidate requirements on a recipe:

candidate_requirements:
capabilities: declared
context: known_limits
RequirementA candidate is eligible when
capabilities: declaredIt declares support for the request's task, including tools and image input, and a compatible provider protocol.
context: known_limitsThe estimated input plus the output reserve fits its declared limits. A request is refused only when it doesn't fit even without the estimate's reserves for structured data and media.

Omit a field to keep that dimension's default compatibility behavior.

  • An output bound is required. The request must set one, or its decision must set request_params.default_max_tokens to a positive integer or auto. That default applies only when the caller omits a bound, and max_tokens_limit still caps it.
  • Missing facts make a candidate ineligible, and so does a missing output bound. A model's maximum output is never used as a request default.
  • Input is estimated, especially for multimodal content. This is not an exact provider token-capacity guarantee.

For example, a decision can supply the bound through its existing plugin:

plugins:
- type: request_params
configuration:
default_max_tokens: 4096
max_tokens_limit: 8192

To use each model's available output capacity when the caller omits a limit:

algorithm:
type: multi_factor
multi_factor:
expected_output_tokens: 4096
plugins:
- type: request_params
configuration:
default_max_tokens: auto

With auto, the Router asks each candidate's backend to render the complete provider request, without generating an answer, and repeats the check after the final request changes. It then allocates min(max_output_tokens, context_window - input_tokens) from the real input length.

auto needs a render-capable vLLM backend
  • an explicit vllm provider, one backend per model, the OpenAI Chat format, and declared context and output limits;
  • the backend's /v1/chat/completions/render API, enabled with vllm serve --enable-scale-out on a vLLM version that supports it;
  • text and tool requests only: not multimodal input, provider truncation, LoRA, Looper or shadow dispatch.

A backend limit smaller than the declared one is a configuration error. An unavailable or invalid render API fails clearly.

  • Caller limits win. An explicit caller limit keeps its behavior and needs no render call; max_tokens_limit still caps the budget.
  • expected_output_tokens is a cost forecast, not a limit. multi_factor needs it with auto, bounded by the caller's limit or each candidate's capacity. Without it, other requests keep their usual cost calculation.
  • Overflow. A request that fits is never truncated by a length estimate. If every compatible candidate overflows, the Router applies the configured context compression once and checks the result with the backend; without a compression policy, overflow stays an error.
  • Preview. It reports execution_required, because it doesn't have the complete provider request.

For multi_factor, latency_metric: ttft compares time to first token and tpot time per output token; see Multi Factor.

Discover the current contract with vllm-sr config schema --section recipes.candidate_requirements. DSL ROUTING blocks support the same object, and the Kubernetes CRD keeps it for every recipe.

Replay capture defaults and decision overrides​

WhereWhat it sets
global.services.router_replayShared storage and retention.
No router_replay plugin on any layerA record of each request's routing data, with no request or response text.
A router_replay plugin in global.pluginsWhether capture is on, and the capture defaults.
A recipe's or decision's router_replay pluginOnly the fields it sets. enabled: false turns capture off there; enabled: true opts in when the default is off.
  • Prompt text. prompt_capture says what a record keeps besides routing evidence. none, the default, keeps no request or response text and reads nothing for personal data. raw keeps the text the capture switches allow, unverified. verified keeps the prompt alone once the PII rules find it clean, and omits it when PII is detected or its status is unknown; without a PII detector the prompt is omitted rather than blocking startup. capture_personal_data is the deprecated form: false loads as verified and true as raw, with a warning.
  • Tool results stay redacted unless capture_tool_results: true, which stores them under prompt_capture: raw only.
  • Rejected requests without a selected decision use their recipe's capture defaults.

These controls don't govern other stores or a backend's retention. See Router Replay for every field, or run vllm-sr config schema --section global.services.router_replay.

Configuration workflows​

The canonical document can be authored or applied through the local CLI and YAML, the Dashboard, Helm or vllm-sr serve --target k8s, the Kubernetes Operator, or the routing DSL.

PageCovers
Configuration WorkflowsWhich interface owns which part of the document, and how to avoid competing sources of truth.
Configuration ContractThe generated schema, the Router's discovery and validation APIs, and the safe authoring loop for tools and agents.
Configuration ManagementHow a change activates on a running Router, how a rejection is reported, and how to roll back.

Reference sources​

Avoid copying the exhaustive example as an application config. Start with the smallest document that describes the deployment, then add only the capabilities and services it uses.