OpenClaw 提供命令行工具来管理和测试模型配置。
常用命令
# 列出可用模型
openclaw models list
# 测试模型连接
openclaw models test anthropic/claude-3-5-sonnet-20241022
# 查看模型详情
openclaw models info openai/gpt-4o
# 设置默认模型
openclaw config set agents.defaults.model anthropic/claude-3-5-sonnet-20241022
模型引用格式
使用 provider/model 格式:
anthropic/claude-3-5-sonnet-20241022openai/gpt-4oopenrouter/moonshotai/kimi-k2
认证配置
通过 CLI 配置 API 密钥:
# 设置 Anthropic API 密钥
openclaw auth add anthropic --api-key sk-ant-xxx
# 设置 OpenAI API 密钥
openclaw auth add openai --api-key sk-xxx
# 列出认证配置文件
openclaw auth list
# 测试认证
openclaw auth test anthropic
模型别名
为常用模型创建别名:
{
models: {
aliases: {
"sonnet": "anthropic/claude-3-5-sonnet-20241022",
"gpt4": "openai/gpt-4o"
}
}
}
提示
使用 CLI 工具可以快速测试和配置模型。模型别名可以简化配置和命令输入。