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

# OpenClaw (gateway)

> Set up OpenClaw with the Respan gateway.

Route [OpenClaw](https://openclaw.ai)'s LLM calls through the Respan gateway for automatic logging, caching, and model switching. OpenClaw supports custom OpenAI-compatible providers, so only your `RESPAN_API_KEY` is needed.

## Setup

#### Install OpenClaw

```bash
npm install -g openclaw@latest
```

#### Add Respan as a custom provider

Edit `~/.openclaw/openclaw.json` and define a Respan provider under `models.providers`, then make it the default model:

```json5
{
  models: {
    providers: {
      respan: {
        baseUrl: "https://api.respan.ai/api",
        apiKey: "${RESPAN_API_KEY}",
        api: "openai-completions",
        models: [
          {
            id: "gpt-4o",
            name: "GPT-4o",
            reasoning: false,
            input: ["text", "image"],
            cost: { input: 2.5, output: 10, cacheRead: 1.25, cacheWrite: 0 },
            contextWindow: 128000,
            maxTokens: 16384,
          },
        ],
      },
    },
  },
  agents: {
    defaults: {
      model: { primary: "respan/gpt-4o" },
    },
  },
}
```

Set `RESPAN_API_KEY` in your shell or in `~/.openclaw/.env`:

```bash
RESPAN_API_KEY=YOUR_RESPAN_API_KEY
```

No separate provider key needed. The Respan gateway handles provider authentication.

#### Run OpenClaw

```bash
openclaw
```

To check the routing with a single local turn:

```bash
openclaw agent --local -m "your prompt"
```

All LLM calls now route through Respan.

## Switch models

Add more entries under `models` and change `model.primary` to use any of the 1000+ models available through the gateway.

```json5
model: {
  primary: "respan/gpt-4o",
  // primary: "respan/claude-sonnet-4-5-20250929"
  // primary: "respan/gemini/gemini-3.5-flash"
}
```

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