๐ค OpenClaw + Crazyrouter: Build Your AI Agent in Minutes
Use Crazyrouter as the LLM backend for OpenClaw โ an open-source AI agent that lives in your Telegram, Discord, WhatsApp, and more.
What is OpenClaw?
OpenClaw is an open-source autonomous AI agent framework. It connects to messaging platforms (Telegram, Discord, WhatsApp, Slack, Signal, iMessage...) and gives you a personal AI assistant that can:
- ๐ฌ Chat naturally across all your messaging apps
- ๐ง Execute code, browse the web, manage files
- โฐ Run scheduled tasks (cron jobs, reminders)
- ๐ง Maintain persistent memory across sessions
- ๐ Extend with custom skills and plugins
Crazyrouter is the perfect backend โ one API key gives OpenClaw access to 624+ models from OpenAI, Anthropic, Google, DeepSeek, and more.
Quick Start
Step 1: Install OpenClaw
# macOS / Linux
curl -fsSL https://openclaw.ai/install.sh | bash
# Windows (PowerShell)
iwr -useb https://openclaw.ai/install.ps1 | iex
Requires Node.js 22+.
Step 2: Get Your Crazyrouter API Key
- Go to crazyrouter.com
- Sign up and get your API key (
sk-...)
Step 3: Run the Onboarding Wizard
openclaw onboard --install-daemon
When prompted for auth, choose API key and enter your Crazyrouter key.
Or set it up non-interactively:
openclaw onboard \
--auth-choice apiKey \
--token-provider crazyrouter \
--token "sk-your-crazyrouter-key"
Step 4: Verify
openclaw gateway status
openclaw dashboard # Opens the web UI
Configuration
Edit ~/.openclaw/openclaw.json (JSON5 format):
Minimal Config (Crazyrouter Only)
{
models: {
providers: {
crazyrouter: {
baseUrl: "https://crazyrouter.com/v1",
apiKey: "sk-your-crazyrouter-key",
api: "openai-completions",
models: [
{
id: "claude-opus-4-6",
name: "Claude Opus 4.6",
reasoning: false,
input: ["text", "image"],
contextWindow: 200000,
maxTokens: 8192,
},
],
},
},
},
agents: {
defaults: {
model: { primary: "crazyrouter/claude-opus-4-6" },
workspace: "~/.openclaw/workspace",
},
},
}
Full Config with Multiple Models
{
models: {
providers: {
crazyrouter: {
baseUrl: "https://crazyrouter.com/v1",
apiKey: "sk-your-crazyrouter-key",
api: "openai-completions",
models: [
// Flagship - best for complex tasks
{
id: "claude-opus-4-6",
name: "Claude Opus 4.6",
reasoning: false,
input: ["text", "image"],
contextWindow: 200000,
maxTokens: 8192,
},
// Great all-rounder
{
id: "gpt-4o",
name: "GPT-4o",
reasoning: false,
input: ["text", "image"],
contextWindow: 128000,
maxTokens: 8192,
},
// Fast and cheap
{
id: "gpt-4o-mini",
name: "GPT-4o Mini",
reasoning: false,
input: ["text", "image"],
contextWindow: 128000,
maxTokens: 8192,
},
// Strong reasoning
{
id: "deepseek-reasoner",
name: "DeepSeek R1",
reasoning: true,
input: ["text"],
contextWindow: 64000,
maxTokens: 8192,
},
// Budget coding
{
id: "deepseek-chat",
name: "DeepSeek V3",
reasoning: false,
input: ["text"],
contextWindow: 64000,
maxTokens: 8192,
},
// Speed king
{
id: "gemini-2.0-flash",
name: "Gemini 2.0 Flash",
reasoning: false,
input: ["text", "image"],
contextWindow: 1000000,
maxTokens: 8192,
},
],
},
},
},
agents: {
defaults: {
model: {
primary: "crazyrouter/claude-opus-4-6",
fallbacks: ["crazyrouter/gpt-4o"],
},
models: {
"crazyrouter/gpt-4o-mini": { alias: "Mini" },
"crazyrouter/deepseek-chat": { alias: "DeepSeek" },
},
workspace: "~/.openclaw/workspace",
},
},
}
Add a Telegram Channel
{
// ... models config above ...
channels: {
telegram: {
enabled: true,
botToken: "123456:ABC-your-telegram-bot-token",
dmPolicy: "allowlist",
allowFrom: ["tg:YOUR_TELEGRAM_USER_ID"],
},
},
}
Add Discord
{
channels: {
discord: {
enabled: true,
botToken: "your-discord-bot-token",
dmPolicy: "pairing",
},
},
}
Switch Models On-the-fly
Once configured, you can switch models in chat:
/model crazyrouter/gpt-4o
/model crazyrouter/deepseek-chat
/model crazyrouter/gemini-2.0-flash
Or use aliases:
/model Mini
/model DeepSeek
Why Crazyrouter + OpenClaw?
| Feature | Benefit |
|---|---|
| 624+ models | Switch between any model without changing config |
| One API key | No need to manage separate keys for each provider |
| OpenAI-compatible | Native support in OpenClaw โ zero custom code |
| Competitive pricing | Run your agent 24/7 without breaking the bank |
| Fallback support | If one model is down, auto-switch to another |
| All channels | Same backend powers Telegram, Discord, WhatsApp, Slack... |
Cost Optimization Tips
- Use cheap models for sub-agents โ Set
gpt-4o-miniordeepseek-chatfor background tasks - Use powerful models for main chat โ
claude-opus-4-6orgpt-4ofor direct conversations - Enable compaction โ Reduces token usage for long conversations:
{
agents: {
defaults: {
compaction: { mode: "safeguard" },
},
},
}
- Set concurrent limits โ Control parallel sub-agent runs:
{
agents: {
defaults: {
maxConcurrent: 4,
subagents: { maxConcurrent: 8 },
},
},
}
Environment Variables (Alternative)
Instead of putting the API key in the config file:
export CRAZYROUTER_API_KEY="sk-your-crazyrouter-key"
Then reference it in config:
{
models: {
providers: {
crazyrouter: {
baseUrl: "https://crazyrouter.com/v1",
apiKey: "${CRAZYROUTER_API_KEY}",
api: "openai-completions",
// ...
},
},
},
}
Troubleshooting
Check Gateway Status
openclaw gateway status
openclaw doctor
View Logs
openclaw logs
openclaw logs --tail
Test the API Connection
curl https://crazyrouter.com/v1/models \
-H "Authorization: Bearer sk-your-crazyrouter-key" \
| head -20
Common Issues
| Issue | Fix |
|---|---|
| "Model not found" | Check model ID matches exactly (e.g. claude-opus-4-6) |
| Auth error | Verify API key at crazyrouter.com |
| Slow responses | Try a faster model like gemini-2.0-flash |
| Gateway won't start | Run openclaw doctor --fix |
Links
- ๐ Crazyrouter โ Get your API key
- ๐ OpenClaw Docs โ Full documentation
- ๐ OpenClaw GitHub โ Source code
- ๐ค Crazyrouter Demo โ Try models live
- ๐ฐ Pricing โ Model pricing comparison
- ๐ฌ Telegram Community
- ๐ฆ Twitter @metaviiii
- ๐ฎ OpenClaw Discord