Presets
Save a model, system prompt and sampling parameters as a named preset and reference it with @preset/<slug> or @presets/<slug>.
A preset bundles a default model, system prompt, sampling parameters and routing rules under a slug, so request settings live in one place. Reference it in the model field with @preset/<slug> (config bundle) or @presets/<slug> (branch routing).
curl https://anyrouter.dev/api/v1/chat/completions \
-H "Authorization: Bearer sk-ar-your-key" \
-H "Content-Type: application/json" \
-d '{"model": "@preset/code-reviewer", "messages": [{"role": "user", "content": "Review this code: ..."}]}'To override the model and keep the rest of the preset, use "model": "openai/gpt-5.4-mini@preset/code-reviewer".
Create presets in /dashboard/presets (including the BYOK-route builder) or with the Presets API.
Config fields
| Field | Type | Description |
|---|---|---|
model | string | Default model (e.g. "z-ai/glm-4.7-flash") |
models | string[] | Fallback model list, tried in order |
system | string | System prompt prepended to messages |
temperature | number | Sampling temperature (0–2) |
max_tokens | number | Maximum response tokens |
max_completion_tokens | number | Max completion tokens |
top_p | number | Nucleus sampling threshold |
top_k | number | Top-K sampling |
frequency_penalty | number | Frequency penalty (-2 to 2) |
presence_penalty | number | Presence penalty (-2 to 2) |
repetition_penalty | number | Repetition penalty |
stop | string | string[] | Stop sequences |
seed | number | Reproducibility seed |
response_format | object | Response format (e.g. { "type": "json_object" }) |
tools | array | Tool definitions |
tool_choice | string | object | Tool selection strategy |
provider | object | Provider routing (sort including "exacto", min_context, require_params, only, ignore, etc.) |
require_params | string[] | Hard parameter requirements (for example ["tools"]). Same meaning as provider.require_params. |
reasoning | object | Reasoning config (effort, max_tokens) |
stream_options | object | Streaming options |
Merging
- Request fields override preset defaults.
provider.min_contexttakes the stricter (higher) floor, andrequire_paramslists are unioned. - With
<model>@preset/<slug>that model wins; otherwise the preset's first model is used. - The system prompt is prepended only when the request has no system message.
- When the preset's model is
anyrouter/auto, the storedproviderfloors (exacto, tools, minimum context) apply at member-pick time.
Messages and Responses
POST /v1/messages and POST /v1/responses accept @preset/<slug>, @presets/<slug> and <model>@preset/<slug> in model, and apply the preset's model, branch fallback, provider routing and require_params. A bare slug (code-reviewer) is not accepted; use the @preset/ prefix. The system prompt goes to system on Messages and instructions on Responses, only when the request sets none. The preset's temperature and top_p apply when the request omits them.
Reasoning on built-in routes
anyrouter/auto, anyrouter/free, anyrouter/cowork, anyrouter/hermes and anyrouter/latest resolve to concrete models at request time, and a reasoning control is applied to each resolved route.
- Chat uses flat
reasoning_effort; Responses usesreasoning.effort(disable withreasoning.enabled: false); Messages usesthinking.type(a non-native conversion mapsenabledtohighanddisabledtonone). For flat Chat and converted Messages,nonedisables reasoning and is never clamped. - The route's
reasoning.levels/default(or per-upstream override) decides the value sent upstream. An effort outside that set is clamped to the nearest lower level, or the model default for an unknown token. An omitted effort stays omitted. - Fallback branches are clamped independently; a branch does not inherit another's effort list.
- Preset
require_paramsis a hard constraint where preset candidate selection is used. Preset, key and request provider lists are unioned, but they are not a universal hard filter on every dispatch; built-in virtual routes use tool-related entries (and request tools) to pick tool-capable members.provider.require_parametersis the separate strict switch.min_contexttakes the stricter value, keyignoreis unioned, and key/requestonlylists intersect. With no declaredsupported_parameters, the router is permissive. The route's per-upstream list is the authority.
Fallback
List several models; the first is primary and the router tries the next on failure:
{
"models": ["anthropic/claude-sonnet-4-6", "openai/gpt-5.4-mini"],
"temperature": 0.2
}BYOK routes
Use @presets/<slug> to pin a branch to a specific upstream. A branch carries model_id and upstream_id, so a BYOK branch tries your key's upstream before managed providers for the same model.
Z-AI Standard API key pool (upstream_id: "zai"):
{
"version": 2,
"kind": "chat",
"mode": "fallback",
"paid_fallback": false,
"branches": [
{
"id": "br_zai_glm_byok",
"weight": 100,
"priority": 1,
"route": {
"model_id": "z-ai/glm-4.7-flash",
"upstream_id": "zai"
}
}
]
}For a Z-AI Coding Plan key, use upstream_id: "zai_coding" with the same model id:
{
"version": 2,
"kind": "chat",
"mode": "fallback",
"paid_fallback": false,
"branches": [
{
"id": "br_zai_glm_coding_byok",
"weight": 100,
"priority": 1,
"route": {
"model_id": "z-ai/glm-4.7-flash",
"upstream_id": "zai_coding"
}
}
]
}For OpenRouter, first save an OpenRouter key in Dashboard > BYOK. Then in the preset choose the model, select OpenRouter in BYOK route, enable the route, optionally enable paid fallback, and save. It stores model_id as the AnyRouter catalog id and upstream_id: "openrouter":
{
"version": 2,
"kind": "chat",
"mode": "fallback",
"paid_fallback": false,
"branches": [
{
"id": "br_openrouter_byok",
"weight": 100,
"priority": 1,
"route": {
"model_id": "openai/gpt-5.4-mini",
"upstream_id": "openrouter"
}
}
]
}AnyRouter routes requests to third-party models. Models and outputs are provided as is, with no warranty; you use them at your own risk. Disclaimer