Skip to content

ug opencode: add --provider support for Unity Catalog Model Provider Services (BYOK) #608

Description

@mdaly1818

Feature Request: ug opencode — add --provider support for Unity Catalog Model Provider Services

Repo: databricks/unity-gateway
Component: src/ucode/agents/opencode.py
Version tested: ucode 0.1.0+110.gfd8b0e9

Issue

ug claude and ug codex both support a --provider .. flag that routes the agent through a Unity Catalog Model Provider Service (BYOK — e.g. Azure OpenAI, Microsoft Foundry, Amazon Bedrock) instead of a Databricks-hosted system.ai.* model. ug opencode has no equivalent — ug opencode --help exposes only --skip-preflight; there is no --provider option at all.

The underlying capability clearly exists in the codebase (list_model_provider_services / get_model_provider_service in src/ucode/databricks.py), and the routing mechanism itself is generic — per the "Integrate coding agents with model provider services" doc, it's just the AI Gateway forwarding on a Databricks-Model-Provider-Service header. agents/claude.py and agents/codex.py both wire this up; agents/opencode.py never did.

Impact

We use Azure AI Foundry to host several of our own OpenAI model deployments, and expected — based on Databricks' documented BYOK/model-provider-service feature — to be able to govern and route to them through Unity Gateway from any coding agent, OpenCode included. Because this flag is missing on the OpenCode integration specifically, our BYOK models are reachable from Claude Code and Codex CLI today, but not from OpenCode, with no documented workaround. This is the one coding agent on our team's approved list where "bring your own model" simply doesn't work yet, which is inconsistent with how the feature is marketed and documented (the docs describe BYOK as agent-agnostic governance, not agent-specific).

Proposed fix / resolution

Port the existing --provider handling from agents/codex.py (or agents/claude.py) into agents/opencode.py:

Add a --provider .. CLI option to the opencode subcommand, matching the existing flag's shape/help text on claude/codex.
When set, skip Databricks model-pinning/discovery and instead resolve the named Model Provider Service via the existing get_model_provider_service call.
Write the resulting OpenCode provider block (baseURL + Databricks-Model-Provider-Service header) the same way render_overlay() already does for the databricks-anthropic/databricks-google/databricks-oss families — OpenCode's own provider config format already supports arbitrary custom headers, so no change is needed on the OpenCode side at all.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions