For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://modelgates.ai/docs/_mcp/server.
OpenClaw 🦞
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 ModelGates is using the built-in setup wizard:
openclaw onboardThe wizard will guide you through:
- Choosing ModelGates 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 ModelGates API key and want to skip the wizard, use this one-line command:
openclaw onboard --auth-choice apiKey --token-provider modelgates --token "$MODELGATES_API_KEY"This automatically configures OpenClaw to use ModelGates with the recommended model (modelgates/auto).
Manual Configuration
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 ModelGates API Key
- Sign up or log in at ModelGates
- Navigate to your API Keys page
- Create a new API key
- Copy your key (starts with
sk-mg-...)
Step 2: Set Your API Key
Add your ModelGates API key to your ~/.openclaw/openclaw.json:
{ "env": { "MODELGATES_API_KEY": "sk-mg-..." }, "agents": { "defaults": { "model": { "primary": "modelgates/anthropic/claude-sonnet-4.5" }, "models": { "modelgates/anthropic/claude-sonnet-4.5": {} } } }}Or set it as an environment variable in your shell profile:
export MODELGATES_API_KEY="sk-mg-..."That's it! OpenClaw has built-in support for ModelGates. You don't need to configure models.providers - just set your API key and reference models with the modelgates/<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": "modelgates/anthropic/claude-sonnet-4.5"},"models": { "modelgates/anthropic/claude-sonnet-4.5": {}}Google Gemini:
"model": { "primary": "modelgates/google/gemini-pro-1.5"},"models": { "modelgates/google/gemini-pro-1.5": {}}DeepSeek:
"model": { "primary": "modelgates/deepseek/deepseek-chat"},"models": { "modelgates/deepseek/deepseek-chat": {}}Moonshot Kimi:
"model": { "primary": "modelgates/moonshotai/kimi-k2.5"},"models": { "modelgates/moonshotai/kimi-k2.5": {}}Browse all available models at modelgates.ai/models.
Step 4: Start OpenClaw
After updating your configuration, start or restart OpenClaw:
openclaw gateway runYour agents will now use ModelGates to route requests to your chosen model.
Model Format
OpenClaw uses the format modelgates/<author>/<slug> for ModelGates models. For example:
modelgates/anthropic/claude-sonnet-4.5modelgates/google/gemini-pro-1.5modelgates/moonshotai/kimi-k2.5modelgates/modelgates/auto(Auto router that picks the most cost effective model for your prompt)
You can find the exact format for each model on the ModelGates 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": "modelgates/anthropic/claude-sonnet-4.5", "fallbacks": [ "modelgates/anthropic/claude-haiku-3.5" ] }, "models": { "modelgates/anthropic/claude-sonnet-4.5": {}, "modelgates/anthropic/claude-haiku-3.5": {} } } }}This provides an additional layer of reliability on top of ModelGates'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 ModelGates Auto Model (modelgates/modelgates/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": "modelgates/modelgates/auto" }, "models": { "modelgates/modelgates/auto": {} } } }}You can also combine Auto Model with fallbacks for maximum reliability:
{ "agents": { "defaults": { "model": { "primary": "modelgates/modelgates/auto", "fallbacks": [ "modelgates/anthropic/claude-haiku-3.5" ] }, "models": { "modelgates/modelgates/auto": {}, "modelgates/anthropic/claude-haiku-3.5": {} } } }}Learn more about how Auto Model works at modelgates.ai/models/modelgates/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": { "modelgates:default": { "provider": "modelgates", "mode": "api_key" } } }}Then use the OpenClaw CLI to set the key in your system keychain:
openclaw auth set modelgates:default --key "$MODELGATES_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 ModelGates 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 'modelgates'"
OpenClaw can't find your ModelGates API key.
Fix:
- Ensure the
MODELGATES_API_KEYenvironment variable is set:echo $MODELGATES_API_KEY - Or verify your auth profile exists:
openclaw auth list - Run the onboard command:
openclaw onboard --auth-choice apiKey --token-provider modelgates --token "$MODELGATES_API_KEY"
Authentication errors (401/403)
If you see authentication errors:
Fix:
- Verify your API key is valid at modelgates.ai/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 ModelGates models page
- Use the format
modelgates/<author>/<slug>(e.g.,modelgates/anthropic/claude-sonnet-4.5) - 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": "modelgates/anthropic/claude-haiku-3.5" } } } }, "discord": { "agents": { "defaults": { "model": { "primary": "modelgates/anthropic/claude-sonnet-4.5" } } } }}