---
title: Select models or use Smart Routing
description: Choose and switch models with /model in Codex CLI and Claude Code, use the model picker in ChatGPT desktop, or let Smart Routing select models for delegated tasks.
canonical_url: https://docs.databricks.com/aws/en/ai-gateway/coding-agent-model-selection
---

# Select models or use Smart Routing

Unity Gateway lets you use different models in your coding agent. Choose and switch models with the agent's model picker, or let Smart Routing select models for delegated tasks.

<a id="choose-a-model-at-launch" />

<a id="switch-models-during-a-session" />

## <a id="choose-a-model" />Choose a model

`ug` discovers the models available through your workspace. What you can choose depends on the agent's model support, your organization's configuration, and the access granted to you.

Launch Codex CLI with `ug codex`, Claude Code with `ug claude`, or GitHub Copilot CLI with `ug copilot`. In the agent, enter:

```text
/model
```

Select an available model from the picker and continue working. Use the same picker for supported open-source models, such as **GLM 5.3** (`system.ai.glm-5-3`). Enter `/model` again whenever you want to switch, such as choosing a faster model for routine edits or a more capable model for a complex task.

See [Use open-source models](https://docs.databricks.com/aws/en/ai-gateway/coding-agent-open-source-models.md) for setup examples and [Control spending](https://docs.databricks.com/aws/en/ai-gateway/coding-agent-costs.md#open-models) for the cost rationale.

For scripted launches, see the [ug CLI reference](https://docs.databricks.com/aws/en/ai-gateway/coding-agent-ug-cli.md#launch-an-agent).

In ChatGPT desktop, use the model picker in a Codex conversation to choose a model, including supported open-source models. See [Use open-source models in ChatGPT desktop](https://docs.databricks.com/aws/en/ai-gateway/coding-agent-open-source-models.md#use-chatgpt-desktop). In GitHub Copilot in Visual Studio Code, select a model from the **Databricks** group in the Copilot Chat model picker. In other agents, check the help menu for the model picker.

![Copilot Chat model picker in VSC with the Databricks group selected](https://docs.databricks.com/aws/en/images/ai-gateway/copilot-vscode-model-picker.png)

To use your organization's registered provider account, see [Bring your own model providers](https://docs.databricks.com/aws/en/ai-gateway/coding-agent-bring-your-own-providers.md#bring-your-own-model-providers).

<a id="smart-routing" />

## Use Smart Routing

> [!NOTE]
> **Beta**
>
> Smart Routing is in [Beta](https://docs.databricks.com/aws/en/release-notes/release-types.md). An account admin must enable the **Enhanced Unity Gateway** preview from the account console **Previews** page. See [Manage Databricks previews](https://docs.databricks.com/aws/en/admin/workspace-settings/manage-previews.md).

Smart Routing selects the lowest-cost model capable of handling your task, so you don't choose a model for every request. It works with Claude Code. Smart Routing for Codex is paused in the Unity Gateway CLI. GitHub Copilot doesn't support Smart Routing.

<a id="requirements" />

### Requirements

* The **Enhanced Unity Gateway** preview enabled for your account. An account admin enables it from the account console **Previews** page. See [Manage Databricks previews](https://docs.databricks.com/aws/en/admin/workspace-settings/manage-previews.md). Allow 1–2 minutes after enablement for it to propagate to your workspace.
* `EXECUTE` access to every candidate model Smart Routing can select. Candidate models come from the agent's [model source](https://docs.databricks.com/aws/en/ai-gateway/coding-agent-configure-govern.md#choose-model-sources-for-each-agent). With the **Unity Gateway Managed Configuration** beta, a `sources` model source can include external models behind a model provider service. If access is missing, routing fails with an error that identifies the required models.

- A Databricks workspace in an [Unity Gateway supported region](https://docs.databricks.com/aws/en/resources/feature-region-support.md#model-serving-aws).

### Use Smart Routing with the Unity Gateway CLI

If your admin enables Smart Routing in your agent's workspace configuration, `ug` applies it automatically. Launch Claude Code as usual:

```bash
ug claude
```

To turn on Smart Routing yourself for a launch, add `--enable-smart-routing`:

```bash
ug claude --enable-smart-routing
```

To turn it off for a launch, including when your admin enables it, launch with `--disable-smart-routing`.

To turn Smart Routing off or back on during a session, enter `/smart-router off` or `/smart-router on`.

With Smart Routing on, your agent hands off tasks to subagents. Each subagent's task is routed independently and can use a different model. The agent shows each subagent's selected model and, when available, the reason for the choice. The main session stays on its default model: your admin's [default or smart default](https://docs.databricks.com/aws/en/ai-gateway/coding-agent-costs.md#set-model-defaults-and-smart-defaults) if one is set, otherwise the agent's configured default. To keep a task in the main session, ask the agent not to use subagents.

For automatic tool-call safety checks with Claude Code subagents using non-Anthropic foundation models hosted by Databricks, see [Auto mode](https://docs.databricks.com/aws/en/ai-gateway/coding-agent-claude.md#auto-mode).

To choose the model yourself, turn off Smart Routing with the session command above, then use `/model`. Changing the model with `/model` alone doesn't turn off Smart Routing.

### Use Smart Routing in Omnigent

Omnigent can select both the coding harness and the model for a task, including work delegated to subagents. Use version v0.8.0 or later.

Configure Claude Code and Codex for your Databricks workspace:

```bash
omni setup
```

Connect your computer to the Omnigent server:

```bash
omni host --server <workspace-url>
```

Replace `<workspace-url>` with your Databricks workspace URL.

In the Omnigent UI, select **Smart Routing** as the harness to let it choose both the harness and model:

![Selecting Smart Routing as the harness in Omnigent](https://docs.databricks.com/aws/en/images/ai-gateway/smart-routing-omnigent-harness.png)

To keep Claude Code or Codex, select that harness, open its gear menu, and choose **Smart Routing** for the model:

![Selecting Smart Routing as the model in Omnigent](https://docs.databricks.com/aws/en/images/ai-gateway/smart-routing-omnigent-model.png)

You can also enable model routing from the CLI for a chosen harness:

```bash
omni claude --smart-routing --server <workspace-url>
omni codex --smart-routing --server <workspace-url>
```

The Unity Gateway CLI routes among models within the selected supported harness. Omnigent also selects across harnesses; the `omni claude` and `omni codex` examples explicitly choose a harness.

## Next steps

* [ug CLI reference](https://docs.databricks.com/aws/en/ai-gateway/coding-agent-ug-cli.md)
* [Supported coding and work agents](https://docs.databricks.com/aws/en/ai-gateway/coding-agent-supported-agents.md)
