模型
OpenClaw 支持多种 AI 模型提供商。
支持的提供商
- Anthropic - Claude 系列
- OpenAI - GPT 系列、Codex
- Google - Gemini 系列
- OpenRouter - 多模型聚合
- 本地模型 - LM Studio、Ollama 等
模型配置
json
{
"agents": {
"defaults": {
"model": {
"primary": "anthropic/claude-sonnet-4-20250514",
"fallbacks": ["openai/gpt-4o"]
}
}
}
}设置模型
bash
# 设置默认模型
openclaw models set anthropic/claude-sonnet-4-20250514
# 查看模型状态
openclaw models status
# 列出可用模型
openclaw models list模型别名
可以定义简短别名:
bash
# 添加别名
openclaw models aliases add sonnet anthropic/claude-sonnet-4-20250514
# 列出别名
openclaw models aliases list内置别名:
opus→ Claude Opussonnet→ Claude Sonnetgpt→ GPT-4o
故障转移
配置备用模型:
bash
# 添加故障转移模型
openclaw models fallbacks add openai/gpt-4o
# 列出故障转移
openclaw models fallbacks list动态切换
在聊天中切换:
/model sonnet
/models