> AI agents: For documentation discovery and navigation, see [llms.txt](/llms.txt).

# Automatic model selection and routing in VS Code

Instead of picking an individual model for every chat request, you can let Visual Studio Code choose models automatically. Use Auto or Copilot Fusion when you want Copilot to decide for you, or define a model router when you want requests routed across models and workflows that you specify.

For background on how these options work and how they affect [AI credit usage](/docs/agents/concepts/language-models.md#ai-credits-and-model-costs), see [Understand language models](/docs/agents/concepts/language-models.md#choose-the-right-model). To pick individual models, configure thinking effort, or manage model visibility, see [Choose and configure language models](/docs/agent-customization/language-models.md).

## Choose an automatic selection option

| Option | Who chooses | How it works | When to use it |
|--------|-------------|--------------|----------------|
| **[Auto](#use-auto-model-selection)** | Copilot | Selects a single model per request based on task complexity and availability. | Everyday coding when you want good defaults without hand-picking models. |
| **[Copilot Fusion](#use-copilot-fusion)** | Copilot | Chooses one model or orchestrates multiple models (for example, drafting, reviewing, and revising) for a task. | Substantial, well-scoped coding tasks where multi-step review is worth extra time and AI credits. |
| **[Model routers](#use-model-routers)** `feature(model-routers)` | Your rules | Routes requests automatically using rules, models, and optional guidance that you define. | Recurring workflows where you already know which models you prefer for different kinds of work. |

For a hands-on workflow to evaluate options on your own codebase, see [Compare and choose models for your coding tasks](/docs/agents/guides/choose-a-model.md).

## Use auto model selection

With auto model selection, VS Code evaluates task complexity and real-time model availability to route each request to the optimal model. For background on how auto model selection works, see [Auto model selection](/docs/agents/concepts/language-models.md#auto-model-selection).

To use auto model selection, select **Auto** from the model picker in chat.

In [Copilot harness sessions](/docs/agents/run/agent-harnesses.md#copilot), **Copilot Fusion** replaces **Auto** when dynamic Auto tiers are enabled and the service offers a Fusion tier your account can run. If the picker shows **Copilot Fusion**, follow the [Copilot Fusion instructions](#use-copilot-fusion) instead.

Use **Optimize for**, when available, to choose a tier that matches your priorities. The offered tiers depend on the service and can include:

* **Efficiency**: favors lower AI credit consumption.
* **Balance**: balances capability and credit consumption.
* **Intelligence**: favors more capable models for complex tasks.

Your organization can set a starting tier for new chats. The managed tier appears as **Default** in the **Optimize for** menu, but you can still choose a different tier. An explicit choice is preserved when the managed default changes or is removed.

You can see which model is used for generating a response by hovering over the chat response.

![Screenshot of a chat response, showing the selected model on hover.](images/language-models/chat-response-selected-model.png)

## Use Copilot Fusion

Copilot Fusion chooses models and a workflow to complete your task, so you don't need to select a model for each step. For background on how Fusion differs from Auto and when to use it, see [Copilot Fusion concepts](/docs/agents/concepts/language-models.md#copilot-fusion).

For details about orchestration, effort levels, availability, and AI credit usage, see [GitHub Copilot Fusion](https://docs.github.com/en/copilot/concepts/models/copilot-fusion) in the GitHub documentation.

To use Copilot Fusion:

1. Verify that `setting(chat.copilot.dynamicAutoTiers.enabled)` is enabled in the Settings editor. Changing it restarts the Copilot runtime after active requests finish.

1. Start a new chat with the [Copilot harness](/docs/agents/run/agent-harnesses.md#copilot).

1. In the model picker, select **Copilot Fusion**, then choose an available tier: **Standard**, **High**, or **Max**.

Enabling the setting doesn't grant access to Fusion tiers. If the service doesn't offer a Fusion tier that your account can run, the picker continues to show **Auto** instead.

## Use model routers

`feature(model-routers)`

Unlike Auto or Copilot Fusion, which choose models for you, a model router applies routing rules that you define. Define routes for recurring work, such as a faster model for small edits and a reasoning model for multi-file changes, and select the router from the model picker like any other model.

> [!NOTE]
> Model routers are available in VS Code Insiders for [Copilot harness sessions](/docs/agents/run/agent-harnesses.md#copilot) on desktop and are off by default.

### Create and select a router

Use the **Model Routers** editor to create a router without writing YAML by hand:

1. Enable `setting(chat.copilot.modelRouter.enabled)` in the Settings editor.

1. Open a **Copilot** chat in the Chat view or [Agents window](/docs/agents/run/agents-window.md).

1. Open the **Model Routers** editor in either of these ways:

    * In the model picker, select **Routers** > **Create a Router** (or **New Router** if you already have one).
    * Run **Chat: Manage Language Models** from the Command Palette (`kb(workbench.action.showCommands)`), or select **Manage Language Models** (gear icon) in the model picker, and switch to the **Model Routers** tab in the modal editor header.

1. Select **Add Router** to open the router form.

    ![Screenshot showing the New Model Router form with fields for name, description, and route settings.](images/language-models/model-router-form-2026113001.png)

1. Enter a **Name** and **Description** for the router.

1. Configure your routes. For each route, optionally enter a **Name**, select a **Model**, optionally adjust **Effort** and **Context**, describe **When to use it**, and optionally add **Guidance** for the agent. Select **Add Route** to add more routes (up to 10).

    Put your preferred fallback route first: when no route clearly fits a chat's first request, the router uses the first available route.

1. Select **Create**.

    VS Code writes `<name>.model-router.yaml` to `~/.agents/model-routers/` on macOS or Linux, or `%USERPROFILE%\.agents\model-routers\` on Windows. The router appears in the **Model Routers** list and on the model picker's **Routers** tab without reloading.

1. Open the model picker, go to the **Routers** tab, and select your router.

Send a task. The routing line above the response identifies the selected route, model, and effort, and the response footer identifies the answering model. You can also open a router's **Details** in the model picker to inspect its routes, switching mode, and file link.

> [!NOTE]
> In a remote window, router files live on the remote machine. Selecting **Add Router** starts a chat with the `/model-router` skill instead of opening the local form.

### Manage routers in the Model Routers editor

When `setting(chat.copilot.modelRouter.enabled)` is enabled, **Chat: Manage Language Models** opens a modal editor with **Language Models** and **Model Routers** tabs in its header. Moving the modal editor into the editor area opens both views as regular editor tabs.

![Screenshot showing the Model Routers tab in the Language Models modal editor with a router, its routes, the Route switching toggle, and Add Router.](images/language-models/model-routers-editor-2026113001.png)

From the **Model Routers** tab, you can:

* **Search routers:** Filter by router name, description, file name, or a route's name, model, or `when` description.
* **Toggle route switching:** Turn **Route switching** on or off directly on a router's row to control whether a chat can switch routes after its first message.
* **Edit a router:** Select a router (or open **More Actions** > **Edit**) to update its name, description, or routes in the form.
* **Open the router file:** Open **More Actions** > **Open File** to edit the YAML file directly.
* **Refine or fix with AI:** Open **More Actions** > **Edit with AI** to start a chat with `/model-router` targeting that file. If a router shows a warning, **More Actions** also offers **Fix with AI**.

Form saves and **Route switching** toggles require the router file to have no unsaved changes in an editor and not to have changed on disk since you opened it. In remote windows, inline form editing and **Route switching** toggles are unavailable; use **Open File** or **Edit with AI** instead.

### Edit with AI or YAML

Use **Edit with AI** (the built-in `/model-router` skill) or **Open File** when you want AI assistance refining route wording or when you need options that the form preserves from existing files without exposing as fields, such as model preference lists, route `examples`, top-level `guidance`, or top-level `effort: off`.

To find your router files from VS Code, run **Chat: Open Model Routers Folder** from the Command Palette on desktop to open `~/.agents/model-routers/` in your file manager. Routers in `~/.copilot/model-routers/` are also detected; for duplicate names, `~/.agents/` takes precedence.

While `setting(chat.copilot.modelRouter.enabled)` is enabled, opening a `*.model-router.yaml` file provides key and value completion and reports validation issues in the **Problems** panel. New and edited files are picked up without reloading.

Adapt this example's models to your account, manually or with `/model-router`:

```yaml
version: 1
display-name: Daily Driver
description: Reasoning for multi-file work, faster responses for small edits.
routes:
  - name: build
    model: [opus, sonnet]
    effort: high
    when: Debugging, implementing features, or changing behavior across files.
    guidance: Inspect the relevant code before editing. Run the relevant tests after changes.
  - name: quick
    model: haiku
    effort: low
    when: Small, well-defined edits, such as renaming a local variable or updating a comment.
```

* **Models:** Use a family for its newest available released model, an exact ID for a particular version, or a preference list such as `[opus, sonnet]`.
* **Criteria:** Describe the work in `when`, with optional `examples` to distinguish requests. A router with a single route and `guidance` can omit `when`.
* **Effort:** Set a supported `effort` level, or leave it unset so the router chooses per request. Top-level `effort: off` keeps model defaults and ignores route effort.
* **Context:** Set `context-size: long` for a larger supported window. Once a chat uses long context, subsequent models retain it where supported.

After manual edits, ask `/model-router` to check for unavailable models, unsupported effort levels, and invalid YAML using `check_model_router`.

### Control switching and route guidance

By default, the first message after you select a router determines its route for the rest of the chat. To switch routes automatically when the work clearly changes, turn on **Route switching** on the router's row in the **Model Routers** editor, or add `switching: auto` at the top level of its YAML file.

Short continuation replies (such as "ok, continue") stay on the current route. Evaluate edited routing criteria in a new chat.

A route's `guidance` instructs the main agent, including steps, [skills](/docs/agent-customization/agent-skills.md), or [custom agents](/docs/agent-customization/custom-agents.md) to use. Switching routes replaces that guidance. Running background subagents delay guidance changes until a routed turn after they finish.

Top-level `guidance` in YAML influences routing decisions, not the agent's work. Put instructions such as running tests in route guidance. Guidance doesn't enforce workflows or permissions.

Switching models resets the prompt cache and can increase [AI credit usage](/docs/agents/concepts/language-models.md#ai-credits-and-model-costs). Guidance changes, higher effort, and larger context windows can also add cost.

### Check unexpected routing

If a router shows a warning in the **Model Routers** editor or model picker, open **More Actions** > **Fix with AI** to repair invalid YAML, missing `when` descriptions, or unavailable models. For unexpected route picks, open **More Actions** > **Edit with AI** to review overlapping criteria and add representative examples. Models must be available to your account and permitted by organization policies.

| Condition | Behavior |
|---|---|
| All models in a route are unavailable | The route is skipped and the router shows a warning. |
| Router file is invalid, missing, or has no available models | The chat keeps its current model and shows a notice. |
| Routing is unavailable for the first request | The first available route is used, with a notice. |
| Routing fails for a later request | The current route is kept. |

A fallback isn't necessarily the best match for your task.

## Related resources

* [Choose and configure language models](/docs/agent-customization/language-models.md)
* [Understand language models](/docs/agents/concepts/language-models.md)
* [Compare and choose models for your coding tasks](/docs/agents/guides/choose-a-model.md)
