Skip to content

Conversation

@dgokeeffe
Copy link

Summary

Adds Databricks Foundation Model APIs as a new provider, enabling opencode users to connect to their Databricks workspace's pay-per-token LLM endpoints.

Fixes #7983

Changes

  • Provider implementation (provider.ts): Full Databricks provider with OpenAI-compatible endpoint support at /serving-endpoints
  • Auth guidance (auth.ts): Added Databricks to auth login flow with clear authentication instructions
  • Test cleanup (preload.ts): Clear Databricks env vars between tests
  • Unit tests (databricks.test.ts): 12 tests covering config parsing, auth precedence, URL handling, and model capabilities

Authentication Methods

Supports three auth methods (in priority order):

  1. PAT token via DATABRICKS_TOKEN or opencode auth login
  2. OAuth M2M via DATABRICKS_CLIENT_ID + DATABRICKS_CLIENT_SECRET
  3. Azure AD Service Principal via ARM_CLIENT_ID + ARM_CLIENT_SECRET + ARM_TENANT_ID

Default Models

Includes default definitions for common Foundation Model API endpoints (Claude, Llama, GPT-5, Gemini). Users can add custom model endpoints via opencode.json.

Verification

  • All 12 new tests pass: bun test packages/opencode/test/provider/databricks.test.ts
  • Tested locally with PAT authentication against a Databricks workspace

Add Databricks Foundation Model APIs as a new provider supporting
OpenAI-compatible endpoints via /serving-endpoints.

Authentication methods (in priority order):
- Personal Access Token (DATABRICKS_TOKEN or stored auth)
- OAuth M2M (DATABRICKS_CLIENT_ID + DATABRICKS_CLIENT_SECRET)
- Azure AD Service Principal (ARM_CLIENT_ID/SECRET/TENANT_ID)

Includes default model definitions for Claude, Llama, GPT-5, and
Gemini models available through Databricks pay-per-token endpoints.

Closes anomalyco#7983
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

Add Azure CLI as a fallback authentication method for Azure Databricks
workspaces (.azuredatabricks.net). When no explicit credentials are
provided, attempts to use 'az account get-access-token' if logged in.

Also updates default models to current Databricks Foundation Model API
offerings (Claude 3.7/4/4.5, Llama 3.1/3.3/4).
The default models were being added as ModelsDev.Model objects directly,
but input.models expects Provider.Model objects with capabilities, api,
and other transformed properties.

Add toProviderModel() helper to properly transform models, matching the
fromModelsDevModel() pattern used elsewhere.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for Databricks Foundation Model APIs provider

1 participant