> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://www.respan.ai/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://www.respan.ai/docs/_mcp/server.

# Vertex AI (gateway)

> Set up Vertex AI through the Respan gateway.

Route Vertex AI requests through the Respan gateway after Vertex AI credentials and model access are configured in your Respan account. The client talks to Respan's OpenAI-compatible endpoint with `RESPAN_API_KEY`; Respan handles provider authentication.

## Setup

#### Install packages

**`Python`**

```bash Python
pip install openai
```

**`TypeScript`**

```bash TypeScript
npm install openai
```

#### Set environment variables

```bash
export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
```

Configure Vertex AI credentials in Respan before using Vertex-specific model slugs. The setup below uses `vertex_ai/claude-opus-4-8@default`, which is marked Live in the model catalog. Enable the model in your Google Cloud project and configure a supported region in Respan.

#### Point the OpenAI client to the Respan gateway

**`Python`**

```python Python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["RESPAN_API_KEY"],
    base_url="https://api.respan.ai/api",
)

response = client.chat.completions.create(
    model="vertex_ai/claude-opus-4-8@default",
    messages=[{"role": "user", "content": "Say hello in one sentence."}],
)
print(response.choices[0].message.content)
```

**`TypeScript`**

```typescript TypeScript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.RESPAN_API_KEY,
  baseURL: "https://api.respan.ai/api",
});

const response = await client.chat.completions.create({
  model: "vertex_ai/claude-opus-4-8@default",
  messages: [{ role: "user", content: "Say hello in one sentence." }],
});
console.log(response.choices[0]?.message?.content);
```

## Switch models

Change the `model` value to a Vertex AI model slug configured for your Respan gateway account, or to any other model available through your gateway key.

**`Python`**

```python Python
response = client.chat.completions.create(model="vertex_ai/claude-opus-4-8@default", messages=messages)
response = client.chat.completions.create(model="openai/gpt-6-sol", messages=messages)
```

**`TypeScript`**

```typescript TypeScript
await client.chat.completions.create({ model: "vertex_ai/claude-opus-4-8@default", messages });
await client.chat.completions.create({ model: "openai/gpt-6-sol", messages });
```

See the [full model list](https://platform.respan.ai/platform/models).