What is OpenRouter?
OpenRouter provides unified access to multiple AI models through a single API, including:
- OpenAI models (GPT-4, GPT-3.5)
- Anthropic models (Claude)
- Meta models (Llama)
- Mistral models
- Google models (Gemini)
- Many others
Pay-as-you-go pricing with one account instead of managing multiple provider accounts.
Getting Started with OpenRouter
- Go to openrouter.ai
- Click "Sign Up"
- Create account with email or OAuth
- Add credits to your account
Creating API Key
- Log in to OpenRouter
- Go to "Keys" section
- Click "Create Key"
- Give it a name
- Copy the key (starts with
sk-or-)
Configuration in AgentClaw
Add these environment variables:
OPENROUTER_API_KEY=sk-or-your-key AI_MODEL=anthropic/claude-4.5-sonnet OPENROUTER_APP_NAME=AgentClaw BotThen restart your instance.
Available Models
Popular models on OpenRouter (use these as AI_MODEL):
Anthropic/Claude
anthropic/claude-4.6-opusanthropic/claude-4.5-sonnetanthropic/claude-4.5-haiku
OpenAI
openai/gpt-4.1openai/gpt-4-turboopenai/gpt-3.5-turbo
Meta/Llama
meta-llama/llama-3.1-70b-instructmeta-llama/llama-3.1-8b-instruct
Mistral
mistralai/mistral-largemistralai/mistral-medium
See full list at openrouter.ai/models
Pricing
OpenRouter adds a small markup (~10-20%) to provider prices. Benefits:
- Single account for all models
- Unified billing
- Easy model switching
- No need to manage multiple API keys
Check current pricing at openrouter.ai/models
Advantages of OpenRouter
- Model variety: Access 50+ models
- Easy switching: Change
AI_MODELvariable, no new API key - Fallback support: Specify backup models if primary is unavailable
- Cost comparison: Compare prices across models easily
- One billing statement: All usage in one place
Monitoring Usage
- Log in to OpenRouter dashboard
- View usage statistics
- See breakdown by model
- Track credit balance
- Enable low balance alerts
Switching Models
To try different models:
- Update
AI_MODELenvironment variable - Use format:
provider/model-name - Save changes
- Restart instance
- Test with messages
Best Practices
- Start with credits: Add $10-20 to test
- Enable auto-top-up: Prevent service interruption
- Try multiple models: Find best balance of cost/quality
- Monitor usage: Some models more expensive than others
- Set spending limits: Configure alerts
Troubleshooting
"Invalid API key"
- Verify key starts with
sk-or- - Check variable name is
OPENROUTER_API_KEY - Ensure key wasn't revoked
"Model not found"
- Check model name format:
provider/model - Verify model exists at openrouter.ai/models
- Some models may be temporarily unavailable
"Insufficient credits"
- Add credits in OpenRouter dashboard
- Enable auto-top-up
- Check credit balance
When to Use OpenRouter
Good For:
- Experimenting with multiple models
- Avoiding vendor lock-in
- Accessing models not directly available
- Simplified billing across providers
May Not Be Best For:
- Production use requiring direct provider SLAs
- Situations where markup matters significantly
- When you only use one provider
Next Steps
- Compare with direct OpenAI access
- Compare with direct Anthropic access
- Learn about switching providers
- Read about choosing AI models