AI 提供商设置
OpenClaw 支持多种 AI 模型提供商,你可以根据需要选择和配置。
支持的提供商
A
Anthropic Claude
推荐 | 强大的推理能力
{
"agents": {
"defaults": {
"model": "anthropic/claude-sonnet-4"
}
},
"providers": {
"anthropic": {
"apiKey": "your-anthropic-api-key"
}
}
}O
OpenAI GPT
GPT-4 / GPT-3.5
{
"agents": {
"defaults": {
"model": "openai/gpt-4"
}
},
"providers": {
"openai": {
"apiKey": "your-openai-api-key"
}
}
}G
Google Gemini
Google AI 模型
{
"agents": {
"defaults": {
"model": "google/gemini-pro"
}
},
"providers": {
"google": {
"apiKey": "your-google-api-key"
}
}
}配置说明
1. 获取 API Key
访问对应提供商的控制台,创建 API Key。请妥善保管,不要泄露给他人。
2. 配置 openclaw.json
将 API Key 添加到配置文件的 providers 部分。
3. 重启 Gateway
配置更改后需要重启 Gateway 才能生效。
💡 提示
你可以同时配置多个提供商,在对话中通过 /model 命令切换模型。