OpenClaw
Use OpenClaw (formerly Moltbot, formerly Clawdbot) with AIRouter24
AIRouter24 adaptation
reviewVerify that the target tool supports custom OpenAI-compatible base URLs before relying on every setting.
What is OpenClaw?
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.
Setup
Recommended: Use the OpenClaw Setup Wizard
The easiest way to configure OpenClaw with AIRouter24 is using the built-in setup wizard:
openclaw onboardThe wizard will guide you through:
- Choosing AIRouter24 as your provider
- Entering your API key
- Selecting your preferred model
- Configuring messaging channels
This is the recommended approach for new users and ensures everything is configured correctly.
Quick Start (CLI)
If you already have your AIRouter24 API key and want to skip the wizard, use this one-line command:
openclaw onboard --auth-choice apiKey --token-provider airouter24 --token "$AIROUTER24_API_KEY"This automatically configures OpenClaw to use AIRouter24 with the recommended model (airouter24/auto).
Manual Configuration
Warning: 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:
Step 1: Get Your AIRouter24 API Key
- Sign up or log in at AIRouter24
- Navigate to your API Keys page
- Create a new API key
- Copy your key (starts with
sk-***)
Step 2: Set Your API Key
Add your AIRouter24 API key to your ~/.openclaw/openclaw.json:
{
"env": {
"AIROUTER24_API_KEY": "sk-***"
},
"agents": {
"defaults": {
"model": {
"primary": "airouter24/~anthropic/claude-sonnet-latest"
},
"models": {
"airouter24/~anthropic/claude-sonnet-latest": {}
}
}
}
}Or set it as an environment variable in your shell profile:
export AIROUTER24_API_KEY="sk-***"Note: That's it! OpenClaw has built-in support for AIRouter24. You don't need to configure
models.providers- just set your API key and reference models with theairouter24/<author>/<slug>format.
Step 3: Choose Your Model
Update the primary model and add it to the models list. Here are some popular options:
Anthropic Claude:
"model": {
"primary": "airouter24/~anthropic/claude-sonnet-latest"
},
"models": {
"airouter24/~anthropic/claude-sonnet-latest": {}
}Google Gemini:
"model": {
"primary": "airouter24/~google/gemini-pro-latest"
},
"models": {
"airouter24/~google/gemini-pro-latest": {}
}DeepSeek:
"model": {
"primary": "airouter24/deepseek/deepseek-chat"
},
"models": {
"airouter24/deepseek/deepseek-chat": {}
}Moonshot Kimi:
"model": {
"primary": "airouter24/~moonshotai/kimi-latest"
},
"models": {
"airouter24/~moonshotai/kimi-latest": {}
}Browse all available models at airouter24.com/models.
Step 4: Start OpenClaw
After updating your configuration, start or restart OpenClaw:
openclaw gateway runYour agents will now use AIRouter24 to route requests to your chosen model.
Model Format
OpenClaw uses the format airouter24/<author>/<slug> for AIRouter24 models (prefix the author with ~ to track the latest version in a family). For example:
airouter24/~anthropic/claude-sonnet-latestairouter24/~google/gemini-pro-latestairouter24/~moonshotai/kimi-latestairouter24/airouter24/auto(Auto router that picks the most cost effective model for your prompt)
You can find the exact format for each model on the AIRouter24 models page.
Multiple Models with Fallbacks
OpenClaw supports model fallbacks. If the primary model is unavailable, it will try the fallback models in order:
{
"agents": {
"defaults": {
"model": {
"primary": "airouter24/~anthropic/claude-sonnet-latest",
"fallbacks": [
"airouter24/~anthropic/claude-haiku-latest"
]
},
"models": {
"airouter24/~anthropic/claude-sonnet-latest": {},
"airouter24/~anthropic/claude-haiku-latest": {}
}
}
}
}This provides an additional layer of reliability on top of AIRouter24's provider-level failover.
Using Auto Model for Cost Optimization
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 AIRouter24 Auto Model (airouter24/airouter24/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:
{
"agents": {
"defaults": {
"model": {
"primary": "airouter24/airouter24/auto"
},
"models": {
"airouter24/airouter24/auto": {}
}
}
}
}You can also combine Auto Model with fallbacks for maximum reliability:
{
"agents": {
"defaults": {
"model": {
"primary": "airouter24/airouter24/auto",
"fallbacks": [
"airouter24/~anthropic/claude-haiku-latest"
]
},
"models": {
"airouter24/airouter24/auto": {},
"airouter24/~anthropic/claude-haiku-latest": {}
}
}
}
}Learn more about how Auto Model works at airouter24.com/models/airouter24/auto.
Using Auth Profiles
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:
{
"auth": {
"profiles": {
"airouter24:default": {
"provider": "airouter24",
"mode": "api_key"
}
}
}
}Then use the OpenClaw CLI to set the key in your system keychain:
openclaw auth set airouter24:default --key "$AIROUTER24_API_KEY"This keeps your API key out of your config file and stores it securely in your system keychain.
Monitoring Usage
Track your OpenClaw usage in real-time:
- Visit the AIRouter24 Activity Dashboard
- See requests, costs, and token usage across all your OpenClaw agents
- Filter by model, time range, or other criteria
- Export usage data for billing or analysis
Common Errors
"No API key found for provider 'airouter24'"
OpenClaw can't find your AIRouter24 API key.
Fix:
- Ensure the
AIROUTER24_API_KEYenvironment variable is set:echo $AIROUTER24_API_KEY - Or verify your auth profile exists:
openclaw auth list - Run the onboard command:
openclaw onboard --auth-choice apiKey --token-provider airouter24 --token "$AIROUTER24_API_KEY"
Authentication errors (401/403)
If you see authentication errors:
Fix:
- Verify your API key is valid at airouter24.com/keys
- Check that you have sufficient credits in your account
- Ensure your key hasn't expired or been revoked
Model not working
If a specific model isn't working:
Fix:
- Verify the model ID is correct on the AIRouter24 models page
- Use the format
airouter24/<author>/<slug>, optionally prefixing the author with~for the latest version in a family (e.g.,airouter24/~anthropic/claude-sonnet-latest) - Add the model to
agents.defaults.modelsin your config
Advanced Configuration
Per-Channel Models
Configure different models for different messaging channels:
{
"telegram": {
"agents": {
"defaults": {
"model": {
"primary": "airouter24/~anthropic/claude-haiku-latest"
}
}
}
},
"discord": {
"agents": {
"defaults": {
"model": {
"primary": "airouter24/~anthropic/claude-sonnet-latest"
}
}
}
}
}