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).

bash
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

FieldTypeDescription
modelstringDefault model (e.g. "z-ai/glm-4.7-flash")
modelsstring[]Fallback model list, tried in order
systemstringSystem prompt prepended to messages
temperaturenumberSampling temperature (0–2)
max_tokensnumberMaximum response tokens
max_completion_tokensnumberMax completion tokens
top_pnumberNucleus sampling threshold
top_knumberTop-K sampling
frequency_penaltynumberFrequency penalty (-2 to 2)
presence_penaltynumberPresence penalty (-2 to 2)
repetition_penaltynumberRepetition penalty
stopstring | string[]Stop sequences
seednumberReproducibility seed
response_formatobjectResponse format (e.g. { "type": "json_object" })
toolsarrayTool definitions
tool_choicestring | objectTool selection strategy
providerobjectProvider routing (sort including "exacto", min_context, require_params, only, ignore, etc.)
require_paramsstring[]Hard parameter requirements (for example ["tools"]). Same meaning as provider.require_params.
reasoningobjectReasoning config (effort, max_tokens)
stream_optionsobjectStreaming options

Merging

  • Request fields override preset defaults. provider.min_context takes the stricter (higher) floor, and require_params lists 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 stored provider floors (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 uses reasoning.effort (disable with reasoning.enabled: false); Messages uses thinking.type (a non-native conversion maps enabled to high and disabled to none). For flat Chat and converted Messages, none disables 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_params is 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_parameters is the separate strict switch. min_context takes the stricter value, key ignore is unioned, and key/request only lists intersect. With no declared supported_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:

json
{
  "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"):

json
{
  "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:

json
{
  "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":

json
{
  "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