---
title: "Connect your app"
subtitle: "Point your SDK at the gateway by changing its base URL."
---

To send your app's calls through the gateway, change the base URL in your client. Your code stays the same, and the model can be from any provider the gateway has.

## Base URLs

Each SDK takes the base URL its own API uses. For a gateway on `localhost:8080`:

| Client | Base URL | Requests go to |
| --- | --- | --- |
| OpenAI SDK, and frameworks built on it | `http://localhost:8080/v1` | `/v1/chat/completions`, `/v1/responses`, `/v1/images/...`, `/v1/audio/...`, `/v1/embeddings`, `/v1/videos` |
| Anthropic SDK | `http://localhost:8080` | `/v1/messages` |
| Google GenAI SDK | `http://localhost:8080` | `/v1beta/models/{model}:generateContent` |

Use your gateway's address in place of `localhost:8080`. `GET /v1/models` lists every provider's models. For every endpoint, see [API formats](/docs/oss-gateway/api-formats).

## API keys

Pass a [client key](/docs/oss-gateway/client-keys) as the SDK's API key. The gateway accepts it as `Authorization: Bearer`, `x-api-key` or `x-goog-api-key`, which covers all three SDKs, and removes it before calling the provider.

With no client keys set, any value works, and the gateway only answers on loopback.

## Examples

<Tabs>
<Tab title="OpenAI (Python)">
```python
from openai import OpenAI

client = OpenAI(base_url="http://localhost:8080/v1", api_key="your-client-key")
reply = client.chat.completions.create(
    model="claude-haiku-5-5",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(reply.choices[0].message.content)
```
</Tab>
<Tab title="OpenAI (TypeScript)">
```typescript
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "http://localhost:8080/v1", apiKey: "your-client-key" });
const reply = await client.chat.completions.create({
  model: "claude-haiku-5-5",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(reply.choices[0].message.content);
```
</Tab>
<Tab title="Anthropic">
```python
from anthropic import Anthropic

client = Anthropic(base_url="http://localhost:8080", api_key="your-client-key")
reply = client.messages.create(
    model="gpt-6-luna",
    max_tokens=256,
    messages=[{"role": "user", "content": "Hello!"}],
)
print(reply.content[0].text)
```
</Tab>
<Tab title="Google GenAI">
```python
from google import genai

client = genai.Client(
    api_key="your-client-key",
    http_options={"base_url": "http://localhost:8080"},
)
reply = client.models.generate_content(model="claude-haiku-5-5", contents="Hello!")
print(reply.text)
```
</Tab>
<Tab title="curl">
```bash
curl http://localhost:8080/v1/chat/completions \
  -H "Authorization: Bearer your-client-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-haiku-5-5",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
```
</Tab>
</Tabs>

A model name such as `claude-haiku-5-5` goes to the provider that lists it. To pick the provider yourself, write `provider/model`, such as `anthropic/claude-haiku-5-5`. To define names of your own with fallback, see [Routes and fallback](/docs/oss-gateway/routes).

## Claude Code

`respan-gateway proxy --anthropic` relays Anthropic's whole API with each client's own credentials, and needs no config file or keys of its own. Use it to put Claude Code behind the gateway, with Claude models:

```bash
respan-gateway proxy --anthropic
```

In another terminal:

```bash
ANTHROPIC_BASE_URL=http://127.0.0.1:8080 claude
```

Claude Code keeps its own login or API key. Calls through the proxy show up in the web UI at `/ui/`.

<Note>
Coding agents such as Claude Code, Codex and Gemini CLI don't work with another vendor's models through the gateway yet. Use them with their own vendor's models.
</Note>

## Integration guides

The guides under [Gateway integrations](/docs/integrations/gateway/overview) (Vercel AI SDK, LangChain, Pydantic AI and more) work with this 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` and prompt management, aren't part of this gateway. To log your calls in Respan, turn on the `respan` plugin; see [Plugins](/docs/oss-gateway/plugins).
