Understanding the Error
When you see:
No API key found for provider "anthropic"It means OpenClaw can't authenticate with your AI model provider.
Authentication Methods
Option 1: Setup Token (OAuth)
For Claude with your Anthropic subscription:
openclaw auth login anthropicThis opens a browser for OAuth authentication.
Option 2: API Key
For pay-as-you-go API access:
openclaw config set models.anthropic.apiKey "sk-ant-..."Or in ~/.openclaw/openclaw.json:
{
"models": {
"anthropic": {
"apiKey": "sk-ant-api03-..."
}
}
}Setting Up Multiple Providers
Anthropic Claude (Primary)
{
"models": {
"default": "claude-sonnet-4-20250514",
"anthropic": {
"apiKey": "sk-ant-..."
}
}
}OpenAI GPT-4
{
"models": {
"openai": {
"apiKey": "sk-..."
}
}
}Local Models with Ollama
{
"models": {
"ollama": {
"enabled": true,
"baseUrl": "http://localhost:11434"
}
}
}Checking Model Status
# List available models
openclaw models list# Check provider status
openclaw models status
Model Fallback Chain
Configure fallbacks if primary model fails:
{
"models": {
"default": "claude-sonnet-4-20250514",
"fallback": ["gpt-4o", "claude-3-haiku"]
}
}Per-Agent Model Selection
Use different models for different agents:
{
"agents": {
"default": {
"model": "claude-sonnet-4-20250514"
},
"fast": {
"model": "claude-3-haiku"
}
}
}Troubleshooting
"All models failed"
openclaw models statusToken Refresh Failed
If OAuth token expired:
openclaw auth logout anthropic
openclaw auth login anthropicEnvironment Variables
You can also set keys via environment:
export ANTHROPIC_API_KEY="sk-ant-..."
export OPENAI_API_KEY="sk-..."Add to ~/.openclaw/.env for persistence.
Need Help?
Contact us for API key setup and configuration assistance.