Integrate coding agents with model provider services
this feature is in Beta. Account admins can manage access to this feature from the account console Previews page. See Manage Databricks previews.
This page describes how to route coding agents like Claude Code and Codex CLI through a model provider service. The agent runs against an external provider you registered in Unity Catalog, such as your own OpenAI, Anthropic, or Amazon Bedrock account. Unity AI Gateway supplies the stored credentials at request time and applies governance and usage tracking, so the coding agent doesn't handle the provider's secret.
To route an agent to Databricks-provided models instead, see Integrate with coding agents.
Features
- Bring your own provider. Point Claude Code or Codex CLI at your own OpenAI, Anthropic, Amazon Bedrock, or other registered provider through a single governed Unity Catalog securable.
- Centralized governance. The
EXECUTEprivilege gates access to the model provider service, and you can apply rate limits and service policies at the service level. - Observability. Unity AI Gateway captures requests in usage tracking and, when configured, inference tables.
Requirements
- Unity AI Gateway preview enabled for your account. See Manage Databricks previews.
- A model provider service you can query. The following permissions are needed. See Discover and govern access to model provider services.
EXECUTEon the model provider serviceUSE CATALOGon the catalogUSE SCHEMAon the schema
- The
ucodeCLI. Requires Python 3.12 or later anduv.
Route a coding agent to a model provider service with ucode
ucode (Unity AI Gateway Coding CLI) installs, authenticates, and configures supported coding agents to route through Unity AI Gateway. To route an agent through a model provider service instead of Databricks-provided models, pass the service's three-part name to --provider.
Step 1: Install ucode
uv tool install git+https://github.com/databricks/ucode
###Step 2: Open an agent against a model provider service
Pass the model provider service's fully qualified name (<catalog>.<schema>.<name>) to --provider:
ucode claude --provider main.default.openai_prod # Claude Code
ucode codex --provider main.default.openai_prod # Codex CLI
On first open, ucode prompts for your Databricks workspace URL, authenticates, and writes the agent's configuration file so requests route through the model provider service. ucode attaches the Databricks-Model-Provider-Service header to every request. Unity AI Gateway resolves the service, supplies the stored credentials, and forwards the request to the external provider.
--provider is supported for ucode claude and ucode codex. If the model provider service feature is not enabled on your workspace, or you lack EXECUTE on the service, ucode prints a descriptive error.
Step 3 (optional): Configure agents interactively
To select a model provider service through a guided flow instead of passing --provider, run:
ucode configure
For Claude Code and Codex CLI, ucode configure lists the model provider services available to you and enables you to select one. Choosing none routes the agent through Databricks-provided models.
For the full command reference, run ucode --help.
How routing works
When you route an agent through a model provider service, ucode sets the agent's base URL to your Unity AI Gateway endpoint and adds the Databricks-Model-Provider-Service header naming the service:
- Claude Code authenticates against
https://<workspace-url>/ai-gateway/anthropicand carries the header inANTHROPIC_CUSTOM_HEADERS. For an Amazon Bedrock–backed service,ucodepins the provider-side model IDs (for example,us.anthropic.claude-sonnet-4-6). - Codex CLI authenticates against
https://<workspace-url>/ai-gateway/codex/v1withwire_api = "responses"and carries the header in the provider'shttp_headers.
The model the agent sends must be one the model provider service allows. See Create and manage model provider services for allow_all_targets and targets.