---
title: Unity Gateway quickstart
description: Send your first request through Unity Gateway, then see the model usage, performance, and cost metrics. You can start with raw HTTP with curl, or with the Python or TypeScript SDK.
canonical_url: https://docs.databricks.com/gcp/en/unity-gateway/quickstart
---

# Unity Gateway quickstart

Send your first request through Unity Gateway against the OpenAI-compatible endpoint.

## Requirements

* A Databricks workspace in a [Unity Gateway supported region](https://docs.databricks.com/gcp/en/resources/feature-region-support.md#model-serving-features-availability).
* To authenticate with OAuth, install the [Databricks CLI](https://docs.databricks.com/gcp/en/dev-tools/cli/install.md). Alternatively, use a [personal access token](https://docs.databricks.com/gcp/en/dev-tools/auth/pat.md), which does not require the Databricks CLI.

## Authenticate

To get started, use a personal access token. OAuth is recommended for production use cases. Set `DATABRICKS_TOKEN` to the token for your workspace.

### Personal access token

Export a [personal access token](https://docs.databricks.com/gcp/en/dev-tools/auth/pat.md):

```bash
export DATABRICKS_TOKEN=<your-personal-access-token>
```

### OAuth

Replace `<workspace-url>` with [your Databricks workspace URL](https://docs.databricks.com/gcp/en/workspace/workspace-details.md#workspace-url). Then log in with the [Databricks CLI](https://docs.databricks.com/gcp/en/dev-tools/auth/oauth-u2m.md) and export a short-lived OAuth token:

```bash
databricks auth login --host https://<workspace-url>
export DATABRICKS_TOKEN=$(databricks auth token --host https://<workspace-url> | jq -r .access_token)
```

## Pick a model

Databricks provides ready-to-use models that you can [browse in the UI under the `system.ai` schema](https://docs.databricks.com/gcp/en/machine-learning/foundation-models/pretrained-models.md), or see the complete list of supported models [here](https://docs.databricks.com/gcp/en/machine-learning/foundation-model-apis/supported-models.md).

This quickstart uses `system.ai.gpt-5-2`. To query a different model, swap in its fully qualified name.

## Send your request

Replace `<workspace-url>` with [your Databricks workspace URL](https://docs.databricks.com/gcp/en/workspace/workspace-details.md#workspace-url).

### Bash

```bash
curl https://<workspace-url>/ai-gateway/mlflow/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DATABRICKS_TOKEN" \
  -d '{
    "model": "system.ai.gpt-5-2",
    "max_output_tokens": 256,
    "input": [
      {
        "role": "user",
        "content": [{"type": "input_text", "text": "Hello!"}]
      },
      {
        "role": "assistant",
        "content": [{"type": "output_text", "text": "Hello! How can I assist you today?"}]
      },
      {
        "role": "user",
        "content": [{"type": "input_text", "text": "What is Databricks?"}]
      }
    ]
  }'
```

### Python

```python
from openai import OpenAI
import os

client = OpenAI(
  api_key=os.environ.get("DATABRICKS_TOKEN"),
  base_url="https://<workspace-url>/ai-gateway/mlflow/v1",
)

response = client.responses.create(
  model="system.ai.gpt-5-2",
  max_output_tokens=256,
  input=[
    {"role": "user", "content": [{"type": "input_text", "text": "Hello!"}]},
    {"role": "assistant", "content": [{"type": "output_text", "text": "Hello! How can I assist you today?"}]},
    {"role": "user", "content": [{"type": "input_text", "text": "What is Databricks?"}]},
  ],
)

print(response.output)
```

### TypeScript

```typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env.DATABRICKS_TOKEN,
  baseURL: 'https://<workspace-url>/ai-gateway/mlflow/v1',
});

const response = await client.responses.create({
  model: 'system.ai.gpt-5-2',
  max_output_tokens: 256,
  input: [
    { role: 'user', content: [{ type: 'input_text', text: 'Hello!' }] },
    { role: 'assistant', content: [{ type: 'output_text', text: 'Hello! How can I assist you today?' }] },
    { role: 'user', content: [{ type: 'input_text', text: 'What is Databricks?' }] },
  ],
});

console.log(response.output);
```

## See your request

Open the model you queried (`system.ai.gpt-5-2`) in Catalog Explorer and select the **Metrics** tab to see the request you just sent in the usage history, along with its token usage and latency. See [Unity Gateway observability](https://docs.databricks.com/gcp/en/ai-gateway/observability.md).

## Next steps

* [Query foundation and embedding models](https://docs.databricks.com/gcp/en/ai-gateway/query-model-services.md)
* [Custom model services](https://docs.databricks.com/gcp/en/ai-gateway/model-services.md)
* [Unity Gateway observability](https://docs.databricks.com/gcp/en/ai-gateway/observability.md)
