Skip to main content

Select models or use Smart Routing

Unity Gateway lets you use different models in your coding agent. Choose a model when you start, switch while you work, or let Smart Routing select one for your task.

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.

Choose a model at launch

Add --model to your agent's launch command, using the full name of a model available to you:

Bash
ug claude --model system.ai.claude-sonnet-4-6
ug codex --model system.ai.gpt-5-5

The agent opens with that model, ready for your usual workflow. Without --model, it starts with its configured default.

To cut per-token cost for routine work, launch on an open source model, such as system.ai.glm-5-2:

Bash
ug codex --model system.ai.glm-5-2

With OpenCode, run ug opencode and select an open source model such as system.ai.glm-5-2. To see which agents support open models, see Supported coding agents. For the cost rationale, see Control spending.

To route through your organization's registered provider account instead, pass its Unity Catalog name to --provider. See Bring your own model providers.

Switch models during a session

In most coding agents, enter:

Text
/model

Select a model from the picker and continue working. You can use a faster model for routine edits and switch to a more capable model for a complex task.

The command varies by agent. If /model isn't available, check your agent's help menu for its model picker.

Use Smart Routing

Beta

Smart Routing is in Beta. An account admin must enable the Enhanced Unity Gateway preview from the account console Previews page. See Manage Databricks previews.

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 and Codex.

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. Allow 1–2 minutes after enablement for it to propagate to your workspace.
  • EXECUTE access to every candidate model Smart Routing can select. Smart Routing chooses only among system.ai-prefixed model services. If access is missing, routing fails with an error that identifies the required models.

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 your agent as usual:

Bash
ug claude
ug codex

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

Bash
ug claude --enable-smart-routing
ug codex --enable-smart-routing

To turn it off again, launch with --disable-smart-routing.

After you submit your first prompt, Smart Routing selects a model for the session. A notice in the agent shows the selected model and, when available, the reason for the choice:

Text
Using Unity Gateway Smart Router.
Selected Model : <model name>
Reason : <reason for the selection>

The agent continues with the selected model. If it delegates work to subagents, each subagent's task is routed independently and can use a different model.

To choose the model yourself, launch with --model. An explicit model selection takes precedence over Smart Routing for that launch.

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

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

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