MonoRelay’s model router translates the model name in each incoming request into a concreteDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Excurs1ons/MonoRelay/llms.txt
Use this file to discover all available pages before exploring further.
(model, provider) pair before the request is forwarded upstream. The translation pipeline runs in a fixed order: alias expansion first, then provider mapping, then model overrides, then complexity scoring, and finally provider auto-detection. Understanding this order helps you predict which upstream endpoint will handle a given request.
Routing resolution order
When a request arrives with a model name, the router applies each step in sequence and stops as soon as a provider is determined:- Provider suffix — if the model string contains
@(e.g.,gpt-4o@openrouter), the suffix is used directly and remaining steps are skipped. - Alias — the model name is looked up in
aliases. The result may itself be an alias; resolution loops until no further alias is found. - Provider mapping — the resolved name is matched against
provider_mappingfnmatch patterns. The first match determines the provider. - Model overrides — if still unresolved,
model_overridesfnmatch patterns can rename the model string. - Complexity routing — if enabled, message content is scored and routed to
simple,moderate, orcomplexmodel targets. - Provider auto-detection — the router scans each enabled provider’s
models.includelist for an exact or normalized match. The first provider whose include list is empty (meaning it accepts any model) also acts as a catch-all.
Provider suffix syntax
Append@providername to any model string to force a specific provider, bypassing alias and mapping rules.
OpenRouter, openrouter, and open_router all resolve to the same provider.
Model aliases
Aliases let you expose short, stable names to clients while keeping the actual model target flexible. Values can themselves be aliases, enabling chains.config.yml
model: "fast" will have it resolved to openai/gpt-4o-mini before any further routing step runs.
Provider mapping
provider_mapping maps fnmatch glob patterns to a provider name. This is the primary mechanism for directing model families to the right upstream without listing every model explicitly.
config.yml
fnmatch patterns support
* (any sequence of characters) and ? (single character). Patterns like "meta/*" match the literal slash in model names such as meta/llama-4-scout.Model overrides
model_overrides renames the model string before it reaches the upstream, also using fnmatch patterns. Use this to canonicalize model names or silently redirect deprecated aliases.
config.yml
Complexity routing
When enabled, MonoRelay scores the content of the request messages and routes to one of three model tiers. This lets a single endpoint automatically use a cheaper model for simple requests and a stronger one for difficult tasks.config.yml
[-1.0, 1.0]. Routing thresholds:
| Score | Target |
|---|---|
< 0 | simple |
0 to < 0.35 | moderate |
≥ 0.35 | complex |
complex.
Cascade fallback
Cascade tries each model in a prioritized list, moving to the next entry if the current one fails. This provides resilience when upstream services are degraded.config.yml
Payload transformation
Transformation rules can inject or override request body parameters for requests matching specific model patterns.config.yml
inject_params— adds keys only if they are not already present in the request body.override_params— always sets the key, replacing any existing value. Supports dot-notation for nested keys (e.g.,"generationConfig.thinkingBudget").
Global params
global_params applies a default set of parameters and an optional system prompt to every request.
config.yml
| Mode | Behavior |
|---|---|
default | Applies params only when the key is absent in the request; prepends system_prompt to an existing system message |
override | Always sets params and replaces any existing system message |