Agents > Inference & providers
Custom routers
Define a custom router that selects a conversation's model using task complexity or your routing rules.
Custom routers choose a model for a conversation using complexity mappings or rules you define. Select a router instead of choosing a model directly.
Key features
Section titled “Key features”- 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).
How it works
Section titled “How it works”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.
Routing types
Section titled “Routing types”A router uses one of two routing types. You choose the type when you create the router.
Complexity-based routing
Section titled “Complexity-based routing”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
Section titled “Rule-based routing”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.
Create a router in Warp
Section titled “Create a router in Warp”- Open Settings > Agents > Warp Agent and find the Custom Routers section.
- Click Add router and enter a name.
- Under Routing type, choose Complexity-based or Rule-based.
- 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.
- 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.
Author a router as a file
Section titled “Author a router as a file”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.
name: Cost savertype: complexitydefault: glm-5.3-fireworksrouting: easy: minimax-3-fireworks medium: glm-5.3-fireworks hard: deepseek-v4.1-flash-fireworksA 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:
name: By tasktype: promptdefault: claude-5-5-sonnet-highrouting: - 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-fireworksIf a file can’t be parsed, Warp shows a non-blocking error identifying the file and skips it; your other routers keep working.
Use a router
Section titled “Use a router”- In the prompt input, click the model dropdown showing the current model name.
- Select your router from the list.
Your selection persists for future prompts, like any other model choice.
Team-synced routers
Section titled “Team-synced routers”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:
- 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.
- Finds the Custom Routers section and clicks New router.
- 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.
Usage and model availability
Section titled “Usage and model availability”A custom router’s inference usage follows the model it selects. See usage and billing for charge components and billing units.
Using your own API keys (BYOK)
Section titled “Using your own API keys (BYOK)”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.
Model availability and fallback
Section titled “Model availability and fallback”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.
Related pages
Section titled “Related pages”- Agent model choice - Supported models and
model_idvalues, including Warp’s built-in Auto models - Bring Your Own API Key - Use your own OpenAI, Anthropic, or Google API keys
- Custom inference endpoint - Route Warp through any OpenAI-compatible endpoint
- Team-managed LLM API keys and endpoints - Configure shared provider keys and custom endpoints
- Admin Panel for Enterprise workspaces - Manage team-wide settings, including team-synced routers