跳转到主要内容

安装

安装前请确保 Node>=22
执行安装指令
npm install -g openclaw@latest

终端配置

打开终端,运行以下指令开始配置
openlaw onboard
选择 Yes Oc 1 选择 QuickStart Oc 2 选择 Skip for now Oc 3 选择 All providers Oc 4 根据需求选择默认模型,可以先选择 Keep current ,下一步会在配置文件中修改 Oc 5 根据需求关联个人账户,如无相关需求请选择 Skip for now Oc 6 配置技能,选择 Yes Oc 7 选择 npm Oc 8 根据需求配置技能选择 Oc 9 全部选择 No Oc 10 选择 Skip for now Oc 11 选择 Hatch in UI

修改配置文件

打开 ~/.openclaw/openclaw.json 文件,增加以下配置:
{
"models": {
    "mode": "merge",
    "providers": {
      "aihubmix": {
        "baseUrl": "http://aihubmix.com/v1",
        "apiKey": "AIHUBMIX_API_KEY",
        "api": "openai-completions",
        "models": [
          {
            "id": "claude-sonnet-4-5",
            "name": "claude-sonnet-4-5",
            "reasoning": false,
            "input": [
              "text"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 1000000,
            "maxTokens": 64000
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "aihubmix/claude-sonnet-4-5"
      },
      "workspace": "your_workspace_path",
      "compaction": {
        "mode": "safeguard"
      },
      "maxConcurrent": 4,
      "subagents": {
        "maxConcurrent": 8
      }
    }
  }
}

启动

openclaw gateway

测试

在聊天页面输入 hello,如收到回复则说明配置成功。 Oc 12

常见问题

版本升级

npm update -g openclaw-aihubmix

Gateway 进程被占用

openclaw gateway stop
openclaw gateway