5 分钟看懂 OpenClaw 模型调用
本文图解OpenClaw模型调用全流程,通过CLI命令和配置文件对照说明。核心流程:将主模型拆分为provider+modelId→查找模型参数→获取API Key→发起请求。关键命令包括查看当前模型、模型列表、Provider配置和API Key配置。文章强调理解primary/fallback/provider关系的重要性,并指出配置文件和CLI命令的双重验证机制。附完整调用流程图,帮助开发者
·
5 分钟看懂 OpenClaw 模型调用
用一张图讲清楚 OpenClaw 从「配置模型」到「实际调用」的完整链路。同时本文将 CLI 命令 和 对应的配置文件 都罗列出来,方便对比。
一句话说明
primary: "minimax/MiniMax-M2.5-highspeed"
↓ 拆分为
provider: "minimax" + modelId: "MiniMax-M2.5-highspeed"
↓ 查找
models.providers.minimax → 获取 baseUrl、cost、contextWindow
↓ 查找
auth.profiles.minimax:default → 获取 API Key
↓ 请求
https://api.minimaxi.com/anthropic
Provider:千问、智谱、minimax 等厂家。
Model:每个厂家推出的模型,比如 qwen3、glm4。
关键命令
1. 查看当前用哪个模型
$ openclaw agents list
Agents:
- main (default)
Workspace: ~/.openclaw/workspace
Agent dir: ~/.openclaw/agents/main/agent
Model: minimax/MiniMax-M2.5-highspeed ✅
配置路径:~/.openclaw/openclaw.json → agents.defaults.model
2. 查看模型列表
$ openclaw models list
Model Input Ctx Tags
minimax/MiniMax-M2.5-highspeed text 195k default,alias:Minimax 2.5 高速
minimax/MiniMax-M2.5 text 195k configured,alias:Minimax 2.5 标准
minimax/MiniMax-M2.1 text 195k configured
配置路径:~/.openclaw/openclaw.json → models.providers
3. 查看 Provider 配置
$ openclaw config get models.providers.minimax
{
"baseUrl": "https://api.minimaxi.com/anthropic",
"api": "anthropic-messages",
"models": [
{
"id": "MiniMax-M2.5-highspeed",
"name": "MiniMax M2.5 高速",
"cost": { "input": 20, "output": 80 },
"contextWindow": 200000,
"maxTokens": 8192
}
]
}
4. 查看 API Key 配置
$ openclaw config get auth
{
"profiles": {
"minimax:default": { "provider": "minimax", "mode": "api_key" } ✅
}
}
配置路径:~/.openclaw/agents/main/agent/auth-profiles.json
完整流程图
┌────────────────────────────────────────────────────────────┐
│ OpenClaw 模型调用链 │
├────────────────────────────────────────────────────────────┤
│ │
│ agents.defaults.model.primary = "minimax/MiniMax-M2.5-highspeed" │
│ │ │
│ ▼ 拆分为 │
│ provider: "minimax" │
│ modelId: "MiniMax-M2.5-highspeed" │
│ │ │
│ ▼ 查找 │
│ models.providers.minimax.models[] │
│ → 找到 baseUrl、cost、contextWindow │
│ │ │
│ ▼ 查找 │
│ auth.profiles.minimax:default │
│ → 找到 API Key │
│ │ │
│ ▼ 请求 │
│ https://api.minimaxi.com/anthropic │
│ + Bearer token │
│ │
└────────────────────────────────────────────────────────────┘
总结
弄明白 primary、fallback 和 provider 的关系,就自然懂了。
🚀 修改的 配置文件,有时候是必须的;同时 CLI 可以验证你的修改是否正确。双重保证。
有问题评论区见!
#minimax #openclaw
欢迎添加公_主_号,小兵张咔咔,xiaobinzhangkaka,获取更多技术文章和资源。
更多推荐


所有评论(0)