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.jsonagents.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.jsonmodels.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                                 │
│                                                            │
└────────────────────────────────────────────────────────────┘

总结

弄明白 primaryfallbackprovider 的关系,就自然懂了。

🚀 修改的 配置文件,有时候是必须的;同时 CLI 可以验证你的修改是否正确。双重保证。

有问题评论区见!

#minimax #openclaw


欢迎添加公_主_号小兵张咔咔xiaobinzhangkaka,获取更多技术文章和资源。

Logo

小龙虾开发者社区是 CSDN 旗下专注 OpenClaw 生态的官方阵地,聚焦技能开发、插件实践与部署教程,为开发者提供可直接落地的方案、工具与交流平台,助力高效构建与落地 AI 应用

更多推荐