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

# Cohere (gateway)

> Set up Cohere with the Respan gateway.

Route Cohere chat through the Respan gateway with the OpenAI-compatible API after you select a current Cohere model that is configured in Respan.

## Setup

> **Note**
>
> The example uses `cohere/command-a-reasoning-08-2025`, which is marked Live in the [model catalog](https://platform.respan.ai/platform/models). Connect your Cohere credentials in Respan before making requests.

#### 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"
```

No `CO_API_KEY` or `COHERE_API_KEY` is needed in your application when the Cohere model is already configured in Respan.

#### Point to the Respan gateway

**`Python`**

```python Python
import os
from openai import OpenAI

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

response = client.chat.completions.create(
    model="cohere/command-a-reasoning-08-2025",
    messages=[{"role": "user", "content": "Say hello in three languages."}],
)
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: "cohere/command-a-reasoning-08-2025",
  messages: [{ role: "user", content: "Say hello in three languages." }],
});
console.log(response.choices[0]?.message?.content);
```

## Switch models

Change the `model` parameter to use Cohere or any other gateway-supported model through the same gateway.

**`Python`**

```python Python
response = client.chat.completions.create(model="cohere/command-a-reasoning-08-2025", messages=messages)
response = client.chat.completions.create(model="openai/gpt-6-sol", messages=messages)
```

**`TypeScript`**

```typescript TypeScript
await client.chat.completions.create({ model: "cohere/command-a-reasoning-08-2025", messages });
await client.chat.completions.create({ model: "openai/gpt-6-sol", messages });
```

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