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

# Gateway quickstart

The Respan gateway is one endpoint for 1000+ models. Point your LLM client at it, and every call is logged in Respan, with fallbacks, caching, and limits ready when you need them.

## Set up with your coding agent

Paste this prompt into Claude Code, Cursor, Codex, or any coding agent:

```
Help me set up the Respan gateway: fetch and follow https://respan.ai/docs/agent-setup.md
```

## Step by step

#### Create an API key

In the [platform](https://platform.respan.ai), go to **Gateway** › **API keys** and click **New key**. Keep **Gateway** checked, pick **Production** or **Test**, and click **Create**.

![The Create new key dialog with Name, Environment (Production or Test), and Permissions: Read, Write, Gateway, and Admin](/docs/_fern-img/1780e946301a96a6ac3f872649a2639a6e460fd0d24a63156dac176abadb66d8.webp)![The Create new key dialog with Name, Environment (Production or Test), and Permissions: Read, Write, Gateway, and Admin](/docs/_fern-img/d667c8cacacbf220f2faa497ee1229ff4b8eb6f99bb04d90d8c407a8f66e01b8.webp)

Click **Copy**, then **Done**. You won't see the key again, so save it now:

```bash
export RESPAN_API_KEY="your-respan-api-key"
```

#### Choose who pays the provider

Each call needs Respan credits or your own provider key:

* **Credits:** go to **Gateway** › **Credits** and add credits. See [Billing and credits](/docs/documentation/admin/credits-billing).
* **Your own key:** on **Gateway** › **API keys**, click **Bring your own key** and add your provider's key. See [Provider keys](/docs/documentation/admin/llm-provider-keys).

#### Point your client at Respan

Set the base URL to Respan's and use your Respan API key. The rest of your code stays the same.

#### OpenAI (Python)

```python
import os
from openai import OpenAI

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

response = client.chat.completions.create(
    model="gpt-5.5",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
```

#### OpenAI (TypeScript)

```typescript
import OpenAI from "openai";

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

const response = await client.chat.completions.create({
  model: "gpt-5.5",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);
```

#### Anthropic

```python
import os
import anthropic

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

message = client.messages.create(
    model="claude-sonnet-4-5-20250929",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}],
)
print(message.content[0].text)
```

#### cURL

```bash
curl https://api.respan.ai/api/chat/completions \
  -H "Authorization: Bearer $RESPAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-5.5", "messages": [{"role": "user", "content": "Hello!"}]}'
```

Using a framework? Find its guide in [Integrations](/docs/integrations/gateway/overview).

#### Check the request in Logs

Run your code, then open **Gateway** › **Logs**. Your request is at the top.

![Gateway Logs listing the latest requests, newest first, with time, log ID, span name, model, system, and user message](/docs/_fern-img/f36657548eefc2019b84a862e370c07c8ba905f50f5fa594faf44d6619070711.webp)![Gateway Logs listing the latest requests, newest first, with time, log ID, span name, model, system, and user message](/docs/_fern-img/7c486142709d9fff237ca36f26631b8dbe5de41682c2a23d458911dad596d678.webp)

Click the row to see the full request and response. See [Logs](/docs/documentation/features/observe/explore-spans).