OpenClaw
OpenClaw is an open-source, self-hosted personal AI assistant platform that connects messaging apps (Telegram, Discord, WhatsApp, iMessage, …) to AI agents on your own hardware. Add WRouter as a custom provider in openclaw.json and every wrouter-routed model becomes available to your agents.
- Website: https://openclaw.ai
- Docs: https://docs.openclaw.ai
- GitHub: https://github.com/openclaw/openclaw
Prerequisites
| Item | Requirement |
|---|---|
| Node.js | ≥ 22 |
| OpenClaw | latest |
| WRouter | A working sk- token |
Install & bootstrap
curl -fsSL https://openclaw.ai/install.sh | bash
openclaw onboard --install-daemonThe wizard sets up auth, the Gateway, and optional channels. Other install paths (Docker, manual) are in OpenClaw's Getting Started.
Configure WRouter via models.providers
OpenClaw discovers model providers from openclaw.json. You declare WRouter as a custom provider, list the models you want exposed, and then point your agent's default model at it.
Many built-in provider plugins ship a default catalog. Only declare an explicit
models.providers.<id>entry when you want to override the base URL, headers, or model list — which is exactly what we're doing here.
1. Provide the API key
In your shell, service env, or an .env file readable by OpenClaw:
export WROUTER_API_KEY="sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"2. Edit openclaw.json
Add (or merge into) the following:
{
models: {
mode: "merge",
providers: {
wrouter: {
baseUrl: "https://wrouter.ai/v1",
apiKey: "${WROUTER_API_KEY}",
api: "openai-completions",
models: [
{ id: "claude-sonnet-4-6", name: "Claude Sonnet 4.6" },
{ id: "gemini-2.5-flash", name: "Gemini 2.5 Flash" },
// multimodal model — pass images as native input
{ id: "gpt-5.4", name: "GPT-4o", input: ["text", "image"] },
],
},
},
},
agents: {
defaults: {
model: {
primary: "wrouter/claude-sonnet-4-6",
fallbacks: ["wrouter/gemini-2.5-flash"],
},
models: {
"wrouter/claude-sonnet-4-6": { alias: "sonnet" },
"wrouter/gemini-2.5-flash": { alias: "flash" },
},
},
},
}Key fields
| Field | Notes |
|---|---|
models.mode | Use "merge" so WRouter is added alongside OpenClaw's built-in providers, not replacing them |
models.providers.wrouter.baseUrl | WRouter base URL; must include /v1 |
models.providers.wrouter.apiKey | ${WROUTER_API_KEY} reads from env — avoids hard-coding the secret |
models.providers.wrouter.api | "openai-completions" for an OpenAI-compatible gateway like WRouter |
models.providers.wrouter.models[] | Each entry's id must match WRouter's actual model ID exactly |
models.providers.wrouter.models[].input | Set to ["text", "image"] on models that accept image input — lets WebChat and node attachments pass images as native input rather than text references |
agents.defaults.model.primary | Primary model — format is provider/model-id (e.g. wrouter/claude-sonnet-4-6) |
agents.defaults.model.fallbacks | Ordered fallback list when the primary fails |
agents.defaults.models | Optional aliases / per-model metadata — visibility-only, does not register a runtime model. Custom-provider models must also appear in models.providers.<provider>.models[] |
Verify
Send a message via any connected channel (Telegram, Discord, web UI). The agent should respond via WRouter using the primary model; failures auto-fall back per your config.
Recommended models
| Model | Use |
|---|---|
claude-sonnet-4-6 | Daily driver across channels |
gpt-5.4 | Multimodal (image attachments) — set input: ["text", "image"] |
gemini-2.5-flash | Long conversation history |
tts-1 + whisper-1 | Voice channels (TTS + STT) |
Common pitfalls
| Symptom | Likely cause |
|---|---|
404 from upstream | baseUrl is missing /v1 |
| Model "not registered" at runtime | Model only declared under agents.defaults.models — must also be in models.providers.<provider>.models[] |
| Image attachments arrive as text references | input: ["text", "image"] not set on that model entry |
| Fallback never triggers | fallbacks IDs don't match any models.providers.wrouter.models[].id |
Known limitations
- Channel integrations (Telegram bot, Discord webhook, WhatsApp Business) require separate setup with each platform.
- OpenClaw runs on your hardware; uptime and security are your responsibility.
- Voice quality depends on the OS (macOS / iOS / Android have differing STT/TTS support).