Skip to content

Agents > Inference & providers

Custom routers

Define a custom router that selects a conversation's model using task complexity or your routing rules.

Open in ChatGPT ↗
Ask ChatGPT about this page
Open in Claude ↗
Ask Claude about this page
Copied!

Custom routers choose a model for a conversation using complexity mappings or rules you define. Select a router instead of choosing a model directly.

  • Complexity-based routing - Warp classifies each task’s difficulty and routes to the model you mapped to that level.
  • Rule-based routing - Write natural-language rules that describe when to use each model.
  • Any supported model - Route to any concrete model you have access to, across providers.
  • BYOK support - With your own API keys configured, inference for models covered by your keys is billed through your provider account instead of Warp.
  • Settings or file - Create a router in settings, or author it as a YAML file that Warp loads automatically.
  • Team-synced routers - Admins can share a router with an entire team (Enterprise).

A custom router appears in the model picker as its own entry, alongside Warp’s built-in Auto models and individual models. You select it like any other model.

The router resolves to a concrete model when the conversation needs a selection. Warp normally reuses that choice for later prompts rather than routing every prompt independently.

Complexity-based routers can choose again after an easy prompt, such as a greeting or a short question. Rule-based routers keep their first selection while it remains available to the router. Check the conversation’s model indicator to see which model ran.

A router uses one of two routing types. You choose the type when you create the router.

Warp classifies each task as easy, medium, or hard and routes to the model you assigned to that level. An unset Easy or Hard level uses Medium. If Medium is unset, Warp uses Default. Default also applies when classification cannot select a level.

Use complexity-based routing to put lower-cost models on simple work and more capable models on harder tasks, without describing tasks yourself.

Rule-based routing routes each task using rules you write. Each rule pairs a classification prompt (a natural-language description of when to use a model, such as “debugging or fixing failing tests”) with the model to use when that rule matches.

  • Warp evaluates rules from top to bottom, and the first rule that matches wins. Rules higher in the list take precedence over those below.
  • If no rule matches, Warp uses the required default model.
  1. Open Settings > Agents > Warp Agent and find the Custom Routers section.
  2. Click Add router and enter a name.
  3. Under Routing type, choose Complexity-based or Rule-based.
  4. Configure the routing:
    • Complexity-based - Click the “Default” dropdown and select a model. Repeat for the “Easy”, “Medium”, and “Hard” dropdowns.
    • Rule-based - Click the “Default model” dropdown and select a model. For each rule, click Add rule and write a “Classification prompt” describing when to use the model. Click the rule’s model dropdown and select a model. Rules are matched top to bottom, so order them by precedence.
  5. Click Save.

Your router now appears in the model picker. Saving also writes a file: use Open file to edit it directly, or Delete to remove the router.

Custom routers are stored as YAML files in ~/.warp/custom_model_routers/, with one router per file. Warp loads every file in that directory and reloads automatically when you add, edit, or remove one, with no restart required. Routers you create in settings are saved here too.

Routing targets use the same model_id values listed on the Model choice page. Every target must be a concrete, Warp-supported model. You can’t route to an Auto model, another router, or a model from a custom inference endpoint.

A complexity router uses type: complexity. default is required. Unset levels follow the complexity fallback rules.

~/.warp/custom_model_routers/cost-saver.yaml
name: Cost saver
type: complexity
default: glm-5.3-fireworks
routing:
easy: minimax-3-fireworks
medium: glm-5.3-fireworks
hard: deepseek-v4.1-flash-fireworks

A rule-based router uses type: prompt. default is the required catch-all used when no rule matches, and routing is the ordered list of rules. Rules can describe your team’s specific workflows, so you can send routine work to cheaper models and reserve a frontier model for the tasks that need it:

~/.warp/custom_model_routers/by-task.yaml
name: By task
type: prompt
default: claude-5-5-sonnet-high
routing:
- description: writing or reviewing database migrations for the acme-payments service
model: glm-5.3-fireworks
- description: debugging production incidents or fixing failing CI tests
model: claude-5-5-opus-high
- description: scaffolding new services or boilerplate from our internal templates
model: kimi-k3-fireworks
- description: drafting release notes, runbooks, or API documentation
model: qwen-3.8-max-fireworks

If a file can’t be parsed, Warp shows a non-blocking error identifying the file and skips it; your other routers keep working.

  1. In the prompt input, click the model dropdown showing the current model name.
  2. Select your router from the list.

Your selection persists for future prompts, like any other model choice.

Team admins can create routers that are shared with the whole team, so everyone can use the same routing strategy. Team-synced routers are an Enterprise feature, and only admins can create or edit them.

To create one, an admin:

  1. Opens the Admin Panel. Under “Team admin”, clicks the team name, then Models. If the panel opens directly on a team, confirms that team and clicks Models.
  2. Finds the Custom Routers section and clicks New router.
  3. Chooses Complexity-based or Rule-based, sets the models or rules, and clicks Create.

Team-synced routers appear in the model picker for every team member, who can select them like any other router.

A custom router’s inference usage follows the model it selects. See usage and billing for charge components and billing units.

Custom routers work with Bring Your Own API Key (BYOK). After the router selects a model, Warp applies your API keys as it would when selecting that model directly. Your provider bills inference covered by a matching key; requests without a matching key use Warp-provided inference. Platform charges still apply to eligible runs.

Warp’s built-in Auto models use Warp-provided inference even when BYOK is configured.

  • Covering all routed models - Configure a provider key for every model the router references. Requests without a matching key use Warp-provided inference.
  • Team-managed keys - Follow member key precedence. A member’s key can take precedence in local runs only when the admin permits personal keys. Keys stored on a member’s device aren’t copied to cloud runs.
  • No custom inference endpoints - Routing targets must be Warp-supported models, so a router can’t resolve to a model from a custom inference endpoint and never draws on your endpoint.

If a router targets an unavailable model, Warp tries its default and then a built-in default, subject to your organization’s model policies. If no permitted model is available, the request fails rather than using a disabled model.