> ## Documentation Index
> Fetch the complete documentation index at: https://docs.portkey.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Databricks

> Integrate Databricks Model Serving with Prisma AIRS AI Gateway

The AI Gateway provides a robust and secure gateway to integrate various Large Language Models (LLMs) into applications, including [Databricks Model Serving](https://docs.databricks.com/en/machine-learning/model-serving/index.html) endpoints.

With the AI Gateway, take advantage of features like fast AI gateway access, observability, and more, while securely managing API keys through [Model Catalog](https://docs.portkey.ai/docs/aigw/product/model-catalog.md).

> [!NOTE]
>
> Provider Slug: `databricks`

## How It Works

By default, AI Gateway routes requests to Databricks' [AI Gateway](https://docs.databricks.com/aws/en/machine-learning/foundation-model-apis/api-reference) endpoint (`/ai-gateway/...`) when no serving endpoint name is specified. This uses Databricks' pay-per-token Foundation Model APIs.

If you specify a `databricksServingEndpointName` (or `databricks_serving_endpoint_name`) in your provider configuration, the AI Gateway will route to `/serving-endpoints/<name>/invocations` instead, which is useful for provisioned throughput endpoints or custom model deployments.

> [!NOTE]
>
> **Pricing in Logs:** Databricks currently only supports [custom pricing](https://docs.portkey.ai/docs/aigw/product/model-catalog/custom-models.md). Cost data will only appear in your AI Gateway logs if you configure custom pricing for your Databricks models in the Model Catalog.

## Quick Start

Get Databricks working in 3 steps:

```sh cURL icon="square-terminal" theme={"system"}
# 1. Add @databricks provider in model catalog
# 2. Use it:

curl https://aigw.portkey.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $PORTKEY_API_KEY" \
  -d '{
    "model": "@databricks/databricks-meta-llama-3-1-70b-instruct",
    "messages": [
      { "role": "user", "content": "Say this is a test" }
    ]
  }'
```

```python OpenAI Py icon="python" theme={"system"}
from openai import OpenAI

# 1. Install: pip install openai
# 2. Add @databricks provider in model catalog
# 3. Use it:

client = OpenAI(
    api_key="PORTKEY_API_KEY",  # AI Gateway API key
    base_url="https://aigw.portkey.ai/v1"
)

response = client.chat.completions.create(
    model="@databricks/databricks-meta-llama-3-1-70b-instruct",
    messages=[{"role": "user", "content": "Say this is a test"}]
)

print(response.choices[0].message.content)
```

```js OpenAI JS icon="square-js" theme={"system"}
import OpenAI from "openai"

// 1. Install: npm install openai
// 2. Add @databricks provider in model catalog
// 3. Use it:

const client = new OpenAI({
    apiKey: "PORTKEY_API_KEY",  // AI Gateway API key
    baseURL: "https://aigw.portkey.ai/v1"
})

const response = await client.chat.completions.create({
    model: "@databricks/databricks-meta-llama-3-1-70b-instruct",
    messages: [{ role: "user", content: "Say this is a test" }]
})

console.log(response.choices[0].message.content)
```

> [!NOTE]
>
> **Tip:** You can also send `x-portkey-provider: @databricks` as a header and use just `model="databricks-meta-llama-3-1-70b-instruct"` in the request.

## Add Provider in Model Catalog

1. Go to [**Model Catalog → Add Provider**](https://stratacloudmanager.paloaltonetworks.com/)
2. Select **Databricks**
3. Choose existing credentials or create new by entering your [Databricks personal access token](https://docs.databricks.com/en/dev-tools/auth/pat.html) and workspace name
4. Name your provider (e.g., `databricks-prod`)

### Configuration Parameters

| Parameter | Description | Required |
| - | - | - |
| `apiKey` | Databricks personal access token | Yes |
| `databricksWorkspace` | Databricks workspace name (used to construct the URL: `https://<workspace>.cloud.databricks.com`) | Yes |
| `databricksServingEndpointName` | Name of a specific serving endpoint. When set, requests route to `/serving-endpoints/<name>/invocations` instead of the default AI Gateway endpoint. | No |

When using headers directly, pass the workspace name via the `x-portkey-databricks-workspace` header and the serving endpoint name via the `x-portkey-databricks-serving-endpoint-name` header.

> **[Complete Setup Guide →](https://docs.portkey.ai/docs/aigw/product/model-catalog.md)**
>
> See all setup options, code examples, and detailed instructions

***

## Supported Endpoints

| Endpoint | Support |
| - | - |
| `/chat/completions` | Supported |
| `/completions` | Supported |
| `/embeddings` | Supported |
| `/responses` | Supported |
| `/messages` | Supported (Anthropic models only) |

## Supported Features

| Feature | Support |
| - | - |
| Thinking/Reasoning | Supported via `thinking` and `reasoning_effort` parameters |
| Streaming | Supported |

***

## Embeddings

Generate embeddings using Databricks-hosted embedding models:

```sh cURL theme={"system"}
curl https://aigw.portkey.ai/v1/embeddings \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $PORTKEY_API_KEY" \
  -d '{
    "model": "@databricks/databricks-bge-large-en",
    "input": "The quick brown fox jumps over the lazy dog"
  }'
```

***

## Responses API

Use the OpenAI Responses API format with Databricks models:

```sh cURL theme={"system"}
curl https://aigw.portkey.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $PORTKEY_API_KEY" \
  -d '{
    "model": "@databricks/databricks-meta-llama-3-1-70b-instruct",
    "input": "Tell me a three sentence bedtime story about a unicorn."
  }'
```

***

## Messages API

Use the Anthropic Messages API format with Databricks-hosted Anthropic models (e.g., Claude):

> [!NOTE]
>
> The `/messages` endpoint is only supported for Anthropic models deployed on Databricks. It routes to Databricks' `/ai-gateway/anthropic/v1/messages` endpoint.

```sh cURL theme={"system"}
curl https://aigw.portkey.ai/v1/messages \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $PORTKEY_API_KEY" \
  -d '{
    "model": "@databricks/claude-sonnet-4-20250514",
    "max_tokens": 250,
    "messages": [
      { "role": "user", "content": "Say this is a test" }
    ]
  }'
```

***

## Supported Models

Databricks Model Serving supports a variety of foundation models and custom endpoints:

* **Meta Llama Models**: `databricks-meta-llama-3-1-70b-instruct`, `databricks-meta-llama-3-1-405b-instruct`
* **DBRX**: `databricks-dbrx-instruct`
* **Embedding Models**: `databricks-bge-large-en`, `databricks-gte-large-en`
* **Custom Endpoints**: Any model deployed as a Databricks serving endpoint

For the complete list of available models, refer to the [Databricks Foundation Model APIs documentation](https://docs.databricks.com/en/machine-learning/foundation-model-apis/index.html).

***

## Next Steps

> **[Add Metadata](https://docs.portkey.ai/docs/aigw/product/observability/metadata.md)**
>
> Add metadata to your Databricks requests

> **[Gateway Configs](https://docs.portkey.ai/docs/aigw/product/ai-gateway/configs.md)**
>
> Add gateway configs to your Databricks requests

> **[Tracing](https://docs.portkey.ai/docs/aigw/product/observability/traces.md)**
>
> Trace your Databricks requests

> **[Fallbacks](https://docs.portkey.ai/docs/aigw/product/ai-gateway/fallbacks.md)**
>
> Setup fallback strategies with Databricks


## Related topics

- [Enterprise Gateway](https://docs.portkey.ai/docs/changelog/enterprise.md)
- [Gateway Compatibility](https://docs.portkey.ai/docs/aigw/integrations/libraries/claude-code-gateway-compatibility.md)
- [Enforcing Saved-Only Resources](https://docs.portkey.ai/docs/aigw/product/administration/enforce-saved-only-config.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.