> ## 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 Portkey's AI Gateway

Portkey 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 Portkey, take advantage of features like fast AI gateway access, observability, prompt management, and more, while securely managing API keys through [Model Catalog](https://docs.portkey.ai/docs/product/model-catalog.md).

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

## How It Works

By default, Portkey 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, Portkey 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/product/model-catalog/custom-models.md). Cost data will only appear in your Portkey logs if you configure custom pricing for your Databricks models in the Model Catalog.

## Quick Start

Get Databricks working in 3 steps:

```python Python icon="python" theme={"system"}
from portkey_ai import Portkey

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

portkey = Portkey(api_key="PORTKEY_API_KEY")

response = portkey.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 Javascript icon="square-js" theme={"system"}
import Portkey from 'portkey-ai'

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

const portkey = new Portkey({
    apiKey: "PORTKEY_API_KEY"
})

const response = await portkey.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)
```

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

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

client = OpenAI(
    api_key="PORTKEY_API_KEY",  # Portkey API key
    base_url=PORTKEY_GATEWAY_URL
)

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"
import { PORTKEY_GATEWAY_URL } from "portkey-ai"

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

const client = new OpenAI({
    apiKey: "PORTKEY_API_KEY",  // Portkey API key
    baseURL: PORTKEY_GATEWAY_URL
})

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)
```

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

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

> [!NOTE]
>
> **Tip:** You can also set `provider="@databricks"` in `Portkey()` 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://app.portkey.ai/model-catalog/providers)
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.

> [card] [Complete Setup Guide →](https://docs.portkey.ai/docs/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:

```python Python theme={"system"}
from portkey_ai import Portkey

portkey = Portkey(api_key="PORTKEY_API_KEY")

response = portkey.embeddings.create(
    model="@databricks/databricks-bge-large-en",
    input="The quick brown fox jumps over the lazy dog"
)

print(response.data[0].embedding[:5])
```

```js Javascript theme={"system"}
import Portkey from 'portkey-ai'

const portkey = new Portkey({
    apiKey: "PORTKEY_API_KEY"
})

const response = await portkey.embeddings.create({
    model: "@databricks/databricks-bge-large-en",
    input: "The quick brown fox jumps over the lazy dog"
})

console.log(response.data[0].embedding.slice(0, 5))
```

```sh cURL theme={"system"}
curl https://api.portkey.ai/v1/embeddings \
  -H "Content-Type: application/json" \
  -H "x-portkey-api-key: $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:

```python Python theme={"system"}
from portkey_ai import Portkey

portkey = Portkey(api_key="PORTKEY_API_KEY")

response = portkey.responses.create(
    model="@databricks/databricks-meta-llama-3-1-70b-instruct",
    input="Tell me a three sentence bedtime story about a unicorn."
)

print(response)
```

```js Javascript theme={"system"}
import Portkey from 'portkey-ai'

const portkey = new Portkey({
    apiKey: "PORTKEY_API_KEY"
})

const response = await portkey.responses.create({
    model: "@databricks/databricks-meta-llama-3-1-70b-instruct",
    input: "Tell me a three sentence bedtime story about a unicorn."
})

console.log(response)
```

```sh cURL theme={"system"}
curl https://api.portkey.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "x-portkey-api-key: $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.

```python Python theme={"system"}
from portkey_ai import Portkey

portkey = Portkey(api_key="PORTKEY_API_KEY")

response = portkey.with_options(
    headers={"x-portkey-anthropic-version": "2023-06-01"}
).post(
    "/v1/messages",
    body={
        "model": "@databricks/claude-sonnet-4-20250514",
        "max_tokens": 250,
        "messages": [{"role": "user", "content": "Say this is a test"}]
    },
    cast_to=object
)

print(response)
```

```js Javascript theme={"system"}
import Portkey from 'portkey-ai'

const portkey = new Portkey({
    apiKey: "PORTKEY_API_KEY"
})

const response = await portkey.post("/v1/messages", {
    body: {
        model: "@databricks/claude-sonnet-4-20250514",
        max_tokens: 250,
        messages: [{ role: "user", content: "Say this is a test" }]
    },
    headers: { "x-portkey-anthropic-version": "2023-06-01" }
})

console.log(response)
```

```sh cURL theme={"system"}
curl https://api.portkey.ai/v1/messages \
  -H "Content-Type: application/json" \
  -H "x-portkey-api-key: $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

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

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

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

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

For complete SDK documentation:

> [card] [SDK Reference](https://docs.portkey.ai/docs/api-reference/sdk/list.md)
>
> Complete Portkey SDK documentation

***

> [card] [Portkey is now PRISMA AIRS AI Gateway. See it in action.](https://www.paloaltonetworks.in/ai-security/ai-gateway?utm_source=portkey\&utm_medium=referral\&utm_campaign=prisma_airs\&utm_content=docs_nav#contact)
>
> Contact Us


## Related topics

- [August](https://docs.portkey.ai/docs/changelog/2026/august.md)
- [Backend](https://docs.portkey.ai/docs/changelog/backend.md)
- [Enterprise Gateway](https://docs.portkey.ai/docs/changelog/enterprise.md)
- [February](https://docs.portkey.ai/docs/changelog/2026/february.md)
- [Frontend](https://docs.portkey.ai/docs/changelog/frontend.md)


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