> For the complete documentation index, see [llms.txt](https://docs.warp.dev/llms.txt).
> Markdown versions of each page are available by appending .md to any URL.

# 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

-   **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](https://docs.warp.dev/agents/inference/bring-your-own-api-key/) 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

A custom router appears in the [model picker](https://docs.warp.dev/agents/inference/model-choice/#how-to-change-models) 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.

Note

Router targets must be concrete models. A router can’t target an Auto model or another router.

## Routing types

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

### 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

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

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.

## 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](https://docs.warp.dev/agents/inference/model-choice/#available-models) 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](https://docs.warp.dev/agents/inference/custom-inference-endpoint/).

A complexity router uses `type: complexity`. `default` is required. Unset levels follow the [complexity fallback rules](#complexity-based-routing).

```yaml title="~/.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:

```yaml title="~/.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.

## Use a router

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-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:

1.  Opens the [Admin Panel](https://app.warp.dev/admin/). 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.

## Usage and model availability

A custom router’s inference usage follows the model it selects. See [usage and billing](https://docs.warp.dev/support-and-community/plans-and-billing/credits/) for charge components and billing units.

### Using your own API keys (BYOK)

Custom routers work with [Bring Your Own API Key (BYOK)](https://docs.warp.dev/agents/inference/bring-your-own-api-key/). 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](https://docs.warp.dev/support-and-community/plans-and-billing/platform-credits/) 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](https://docs.warp.dev/enterprise/enterprise-features/team-managed-keys-and-endpoints/#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](https://docs.warp.dev/agents/inference/custom-inference-endpoint/) and never draws on your endpoint.

### 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

-   [Agent model choice](https://docs.warp.dev/agents/inference/model-choice/) - Supported models and `model_id` values, including Warp’s built-in Auto models
-   [Bring Your Own API Key](https://docs.warp.dev/agents/inference/bring-your-own-api-key/) - Use your own OpenAI, Anthropic, or Google API keys
-   [Custom inference endpoint](https://docs.warp.dev/agents/inference/custom-inference-endpoint/) - Route Warp through any OpenAI-compatible endpoint
-   [Team-managed LLM API keys and endpoints](https://docs.warp.dev/enterprise/enterprise-features/team-managed-keys-and-endpoints/) - Configure shared provider keys and custom endpoints
-   [Admin Panel for Enterprise workspaces](https://docs.warp.dev/enterprise/team-management/admin-panel/#models-settings) - Manage team-wide settings, including team-synced routers
