mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 12:50:42 +00:00
3.6 KiB
3.6 KiB
summary, read_when, title
| summary | read_when | title | ||
|---|---|---|---|---|
| Use OpenRouter's unified API to access many models in OpenClaw |
|
OpenRouter |
OpenRouter
OpenRouter provides a unified API that routes requests to many models behind a single endpoint and API key. It is OpenAI-compatible, so most OpenAI SDKs work by switching the base URL.
Getting started
Create an API key at [openrouter.ai/keys](https://openrouter.ai/keys). ```bash openclaw onboard --auth-choice openrouter-api-key ``` Onboarding defaults to `openrouter/auto`. Pick a concrete model later:```bash
openclaw models set openrouter/<provider>/<model>
```
Config example
{
env: { OPENROUTER_API_KEY: "sk-or-..." },
agents: {
defaults: {
model: { primary: "openrouter/auto" },
},
},
}
Model references
Model refs follow the pattern `openrouter//`. For the full list of available providers and models, see [/concepts/model-providers](/concepts/model-providers).Authentication and headers
OpenRouter uses a Bearer token with your API key under the hood.
On real OpenRouter requests (https://openrouter.ai/api/v1), OpenClaw also adds
OpenRouter's documented app-attribution headers:
| Header | Value |
|---|---|
HTTP-Referer |
https://openclaw.ai |
X-OpenRouter-Title |
OpenClaw |
X-OpenRouter-Categories |
cli-agent |