> 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.

# Connect your app

To send your app's calls through respan-gateway, change the base URL in your client. Your code and model names stay the same.

## Base URLs

| Client                                                                              | Base URL                                   |
| ----------------------------------------------------------------------------------- | ------------------------------------------ |
| OpenAI SDK, and frameworks built on it (LangChain, Vercel AI SDK, OpenAI Agents, …) | `http://localhost:8080/v1`                 |
| Anthropic SDK                                                                       | `http://localhost:8080`                    |
| Google GenAI SDK                                                                    | `http://localhost:8080`                    |
| Claude Code                                                                         | `ANTHROPIC_BASE_URL=http://localhost:8080` |

Use your gateway's address in place of `localhost:8080`. For the API key, send a [client key](/docs/gateway/open-source/configure#client-keys). With no client keys set, any value works.

## Examples

#### OpenAI (Python)

```python
from openai import OpenAI

client = OpenAI(base_url="http://localhost:8080/v1", api_key="your-client-key")
response = client.chat.completions.create(
    model="claude-sonnet-4-5-20250929",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
```

#### OpenAI (TypeScript)

```typescript
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "http://localhost:8080/v1", apiKey: "your-client-key" });
const response = await client.chat.completions.create({
  model: "claude-sonnet-4-5-20250929",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);
```

#### Anthropic

```python
from anthropic import Anthropic

client = Anthropic(base_url="http://localhost:8080", api_key="your-client-key")
message = client.messages.create(
    model="gpt-5.5",
    max_tokens=256,
    messages=[{"role": "user", "content": "Hello!"}],
)
print(message.content[0].text)
```

#### Google GenAI

```python
from google import genai

client = genai.Client(api_key="your-client-key", http_options={"base_url": "http://localhost:8080"})
response = client.models.generate_content(model="claude-sonnet-4-5-20250929", contents="Hello!")
print(response.text)
```

#### Claude Code

```bash
export ANTHROPIC_BASE_URL="http://localhost:8080"
export ANTHROPIC_API_KEY="your-client-key"
claude
```

Claude Code works through the gateway with Claude models. Other providers' models aren't supported from Claude Code yet.

## Use an integration guide

The guides under [Gateway integrations](/docs/integrations/gateway/overview) work with respan-gateway too. Follow a guide, then make two changes:

1. Replace its base URL, such as `https://api.respan.ai/api/`, with the gateway's from the table above.
2. Replace `RESPAN_API_KEY` with your client key.

Features of the hosted Respan gateway, such as `respan_params`, prompt management, caching and `span-router`, aren't part of respan-gateway. To log your calls in Respan, turn on [Respan tracing](/docs/gateway/open-source/configure#respan-tracing).