OpenClaw 🦞
OpenClaw 🦞
Use OpenClaw (formerly Moltbot, formerly Clawdbot) with OpenRouter
OpenClaw 🦞
Use OpenClaw (formerly Moltbot, formerly Clawdbot) with OpenRouter
OpenClaw (formerly Moltbot, formerly Clawdbot) is an open-source AI agent platform that brings conversational AI to multiple messaging channels including Telegram, Discord, Slack, Signal, iMessage, and WhatsApp. It supports multiple LLM providers and allows you to run AI agents that can interact across all these platforms.
The easiest way to configure OpenClaw with OpenRouter is using the built-in setup wizard:
The wizard will guide you through:
This is the recommended approach for new users and ensures everything is configured correctly.
If you already have your OpenRouter API key and want to skip the wizard, use this one-line command:
This automatically configures OpenClaw to use OpenRouter with the recommended model (openrouter/auto).
Advanced users only: The following manual configuration is for users who need to edit their config file directly. For most users, we recommend using the setup wizard above.
If you need to manually edit your OpenClaw configuration file, follow these steps:
sk-or-...)Add your OpenRouter API key to your ~/.openclaw/openclaw.json:
Or set it as an environment variable in your shell profile:
That’s it! OpenClaw has built-in support for OpenRouter. You don’t need to configure models.providers - just set your API key and reference models with the openrouter/<author>/<slug> format.
Update the primary model and add it to the models list. Here are some popular options:
Anthropic Claude:
Google Gemini:
DeepSeek:
Moonshot Kimi:
Browse all available models at openrouter.ai/models.
After updating your configuration, start or restart OpenClaw:
Your agents will now use OpenRouter to route requests to your chosen model.
OpenClaw uses the format openrouter/<author>/<slug> for OpenRouter models (prefix the author with ~ to track the latest version in a family). For example:
openrouter/~anthropic/claude-sonnet-latestopenrouter/~google/gemini-pro-latestopenrouter/~moonshotai/kimi-latestopenrouter/openrouter/auto (Auto router that picks the most cost effective model for your prompt)You can find the exact format for each model on the OpenRouter models page.
OpenClaw supports model fallbacks. If the primary model is unavailable, it will try the fallback models in order:
This provides an additional layer of reliability on top of OpenRouter’s provider-level failover.
OpenClaw agents perform many different types of actions, from simple heartbeat processing to complex reasoning tasks. Using a powerful model for every action wastes money on tasks that don’t require advanced capabilities.
The OpenRouter Auto Model (openrouter/openrouter/auto) automatically selects the most cost-effective model based on your prompt. This is ideal for OpenClaw because it routes simple tasks like heartbeats and status checks to cheaper models while using more capable models only when needed for complex interactions.
To configure Auto Model as your primary model:
You can also combine Auto Model with fallbacks for maximum reliability:
Learn more about how Auto Model works at openrouter.ai/models/openrouter/auto.
For more secure credential management, you can use OpenClaw’s auth profiles instead of environment variables. This is automatically configured when you use the openclaw onboard command.
To manually create an auth profile, add this to your openclaw.json:
Then use the OpenClaw CLI to set the key in your system keychain:
This keeps your API key out of your config file and stores it securely in your system keychain.
Track your OpenClaw usage in real-time:
OpenClaw can’t find your OpenRouter API key.
Fix:
OPENROUTER_API_KEY environment variable is set: echo $OPENROUTER_API_KEYopenclaw auth listopenclaw onboard --auth-choice apiKey --token-provider openrouter --token "$OPENROUTER_API_KEY"If you see authentication errors:
Fix:
If a specific model isn’t working:
Fix:
openrouter/<author>/<slug>, optionally prefixing the author with ~ for the latest version in a family (e.g., openrouter/~anthropic/claude-sonnet-latest)agents.defaults.models in your configConfigure different models for different messaging channels: