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,providersand one recipe. - One recipe needs no entrypoints. It serves
vllm-sr/auto. Several recipes needentrypoints, with exactly one chat entrypoint markeddefault: true. - Add
globalonly when needed: for shared services, default plugins, or runtime behavior that differs from the built-in defaults.
What belongs where
| Section | Owns |
|---|---|
version | Canonical schema version. Use v0.5. |
listeners | Public Router listeners: address, port, timeouts, client API keys, model allowlists, TLS and trusted identity. See Listeners. |
providers | Logical provider models: their backend endpoints, pricing, defaults, and the facts routing reads about each model (capabilities, modalities, context window, LoRA adapters). |
evaluation | Optional operator-owned benchmark definitions, versioned index DAGs, and model-linked records. |
recipes | Isolated routing profiles: each recipe's signals, projections, decisions, strategy, fallback, candidate requirements, model bindings, and default plugins. |
entrypoints | Public virtual model names mapped to a recipe; with several recipes, exactly one chat entrypoint is the default. |
global | Router 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
| Field | Meaning | Default |
|---|---|---|
timeout | The 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_keys | Client 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_files | Absolute 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 |
apis | The 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>.prefix | A 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>.models | The only request models an API accepts. | every model of its kind |
apis.<api>.unserved_models | What 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.schema | The 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_ms | The longest a System One request waits for a model. | 10 minutes |
apis.systemone.vsr | What 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_file | One-way TLS. | off |
identity.trust_headers, identity.trusted_peers | The 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[].pricingtakes an optional uppercase three-lettercurrency, plus non-negativeprompt_per_1m,completion_per_1m,cached_input_per_1m,cache_write_per_1mandcache_write_1h_per_1mrates. A model without it takes its provider's list price when the catalog lists one. A written block always wins and defaultscurrencytoUSD, 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, thenrecipes[].model_bindings.<type>, thenglobal.model_catalog.bindings.<type>. - Limits. A remote deployment's
limits.max_request_bytesandlimits.max_response_bytescap 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.
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 type | Use it to | Reusable fragment | Guide |
|---|---|---|---|
agent — heuristic signal | agent 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 signal | authz turns identity and policy bindings into reusable routing inputs under recipes[].signals.role_bindings. | config/fragments/signal/authz/ | Guide |
complexity — application signal | complexity rates how difficult a request is to answer well: easy, medium or hard. | config/fragments/signal/complexity/ | Guide |
context — heuristic signal | context detects requests that need a larger effective context window. | config/fragments/signal/context/ | Guide |
conversation — heuristic signal | conversation 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 signal | domains routes on the request's subject area, one of 14 that the decision model chooses. | config/fragments/signal/domain/ | Guide |
fact-check — application signal | fact_check detects requests whose answer relies on factual claims that should be verified. | config/fragments/signal/fact-check/ | Guide |
hallucination — application signal | hallucination finds the claims in the model's answer that its grounding context does not support. | config/fragments/signal/hallucination/ | Guide |
input-modality — heuristic signal | input_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 signal | jailbreak detects prompt-injection and jailbreak attempts, in the request before routing or in the model's answer. | config/fragments/signal/jailbreak/ | Guide |
keyword — heuristic signal | keyword matches explicit words and phrases in the request. | config/fragments/signal/keyword/ | Guide |
language — heuristic signal | language detects the request language and exposes it as a routing signal. | config/fragments/signal/language/ | Guide |
metadata — heuristic signal | metadata matches bounded string values supplied by the caller in request metadata. | config/fragments/signal/metadata/ | Guide |
modality — application signal | modality 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 signal | pii locates personal data in the request, with the exact characters of every span. | config/fragments/signal/pii/ | Guide |
refusal — application signal | refusal asks the decision model whether the model's answer declines the request. | config/fragments/signal/refusal/ | Guide |
safety — application signal | safety detects harmful content in the request or the model's answer, optionally in named harm categories. | config/fragments/signal/safety/ | Guide |
systemone — primitive signal | systemone 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 signal | turn_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 signal | user_feedbacks reads what the current user turn says about the previous answer. | config/fragments/signal/user-feedback/ | Guide |
Selectors
| Family and type | Use it to | Reusable fragment | Guide |
|---|---|---|---|
latency-aware — selector | To choose the fastest eligible candidate, weight Multi Factor on latency alone. | config/fragments/algorithm/selection/latency-aware.yaml | Guide |
multi-factor — selector | multi_factor chooses one candidate from quality, latency, cost, and load. | config/fragments/algorithm/selection/multi-factor.yaml | Guide |
random — selector | random picks one model uniformly from a decision's eligible candidates. | config/fragments/algorithm/selection/random.yaml | Guide |
static — selector | static provides deterministic model choice without metrics or learned state. | config/fragments/algorithm/selection/static.yaml | Guide |
systemone — selector | systemone asks a System One model which of a routing decision's modelRefs should answer the request. | config/fragments/algorithm/selection/systemone.yaml | Guide |
Executors
| Family and type | Use it to | Reusable fragment | Guide |
|---|---|---|---|
escalate — executor | escalate calls a decision's candidates one at a time, in order, and returns the first answer it accepts. | config/fragments/algorithm/looper/escalate.yaml | Guide |
fusion — executor | fusion asks several models to answer a request and a judge model to synthesize one final answer. | config/fragments/algorithm/looper/fusion.yaml | Guide |
ratings — executor | ratings 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.yaml | Guide |
remom — executor | remom runs several candidate models across bounded rounds and synthesizes their responses into one answer. | config/fragments/algorithm/looper/remom.yaml | Guide |
workflows — executor | workflows runs a bounded, multi-step Router Flow behind one OpenAI-compatible model name. | config/fragments/algorithm/looper/workflows.yaml | Guide |
Plugins and bundles
| Family and type | Use it to | Reusable fragment | Guide |
|---|---|---|---|
content-safety — plugin bundle | Content Safety combines supported route-local safety plugins into one reusable policy. | config/fragments/plugin/content-safety/ | Guide |
context — route plugin | context is the plugin that assembles the request's context. | config/fragments/plugin/context/ | Guide |
fast-response — route plugin | fast_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 plugin | header_mutation is a route-local plugin for adding, updating, or deleting downstream headers. | config/fragments/plugin/header-mutation/ | Guide |
masking — route plugin | masking 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 plugin | prompt_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 plugin | request_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 plugin | response_cache is the route-local plugin for reusing exact or semantically compatible prior responses. | config/fragments/plugin/response-cache/ | Guide |
response-guard — route plugin | response_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 plugin | Use 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 plugin | system_prompt is a route-local plugin for inserting or modifying the system prompt on matched traffic. | config/fragments/plugin/system-prompt/ | Guide |
tools — route plugin | tools 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.
- Configure models is the starting point.
- Model configuration patterns compares the catalog, custom, reasoning, provider and replica combinations.
- The Model and provider Day-0 guide is for contributors adding support to the repository catalog.
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.
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}
| Form | Expands to |
|---|---|
${VAR}, $VAR | The value of VAR |
${VAR:-default} | default when VAR is unset or empty |
${VAR-default} | default when VAR is unset |
$$ | A literal $ |
VARis 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:
entrypointsmaps their public model names, and exactly one chat entrypoint is markeddefault: true.vllm-sr/autois 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
| Field | Meaning |
|---|---|
entrypoints[].model_names | The public model aliases. |
entrypoints[].recipe | The recipe those aliases enter. |
entrypoints[].default | Marks the default chat entrypoint. |
entrypoints[].review_model | Optional 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_model | Optional 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:
| Setting | Default in | Overridden by |
|---|---|---|
| Strategy and fallback | global.router.strategy, global.router.fallback | Each recipe's strategy and fallback; a decision's fallback |
| Plugins | global.plugins | A recipe's plugins, then a decision's plugins |
| Deployments that answer signals | global.model_catalog.bindings | A 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 ispriority. - 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.pluginsbut skips what needs a recipe: the response cache, the context plugin's retrieval,response_guardand masking. - Model facts.
capabilities,modalities,context_window_size,max_output_tokensandlorassit on the model'sproviders.models[]entry.
If no decision matches, the recipe uses providers.defaults.model. The
virtual entrypoint name never reaches a backend.
- Models, Entrypoints, and Serving covers built-in virtual models, CLI serving, backend binding, forking, packaging and migration.
- Virtual Models has the complete schema.
Recipe candidate requirements
Set optional candidate requirements on a recipe:
candidate_requirements:
capabilities: declared
context: known_limits
| Requirement | A candidate is eligible when |
|---|---|
capabilities: declared | It declares support for the request's task, including tools and image input, and a compatible provider protocol. |
context: known_limits | The 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_tokensto a positive integer orauto. That default applies only when the caller omits a bound, andmax_tokens_limitstill 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
vllmprovider, one backend per model, the OpenAI Chat format, and declared context and output limits; - the backend's
/v1/chat/completions/renderAPI, enabled withvllm serve --enable-scale-outon 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_limitstill caps the budget. expected_output_tokensis a cost forecast, not a limit.multi_factorneeds it withauto, 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
| Where | What it sets |
|---|---|
global.services.router_replay | Shared storage and retention. |
No router_replay plugin on any layer | A record of each request's routing data, with no request or response text. |
A router_replay plugin in global.plugins | Whether capture is on, and the capture defaults. |
A recipe's or decision's router_replay plugin | Only the fields it sets. enabled: false turns capture off there; enabled: true opts in when the default is off. |
- Prompt text.
prompt_capturesays what a record keeps besides routing evidence.none, the default, keeps no request or response text and reads nothing for personal data.rawkeeps the text the capture switches allow, unverified.verifiedkeeps 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_datais the deprecated form:falseloads asverifiedandtrueasraw, with a warning. - Tool results stay redacted unless
capture_tool_results: true, which stores them underprompt_capture: rawonly. - 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.
| Page | Covers |
|---|---|
| Configuration Workflows | Which interface owns which part of the document, and how to avoid competing sources of truth. |
| Configuration Contract | The generated schema, the Router's discovery and validation APIs, and the safe authoring loop for tools and agents. |
| Configuration Management | How a change activates on a running Router, how a rejection is reported, and how to roll back. |
Reference sources
config/config.yamlis the exhaustive canonical example.config/fragments/contains reusable signal, decision, algorithm, and plugin fragments.- Providers and routing tutorials describe shared runtime configuration.
- Unified Config Contract v0.3 records the design the v0.5 structure builds on.
- Configuration Contract is the live discovery and validation contract for the current Router build.
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.