Skip to content

OpenClaw 配置指南

OpenClaw Version

OpenClaw 是一个自托管的消息网关,可以将 WhatsApp、Telegram、Discord、iMessage 等聊天平台与 AI Agent 连接起来。

以下配置以默认端点 iina.ai 为例,如需使用国内加速端点,请将 iina.ai 替换为 acc.iina.ai

安装 OpenClaw

shell
# 安装(需要 Node 22+)
curl -fsSL https://openclaw.ai/install.sh | bash

配置 API 密钥

  1. 获取 API 密钥:登录控制台新建令牌,建议留空 模型限制列表 以支持所有模型。

  2. 编辑配置文件,修改 authmodels 部分:

    ~/.openclaw/openclaw.json
    json
    {
      "auth": {
        "profiles": {
          "anthropic:default": {
            "provider": "anthropic",
            "mode": "api_key"
          }
        }
      },
      "models": {
        "mode": "merge",
        "providers": {
          "iina": {
            "baseUrl": "https://iina.ai/",
            "apiKey": "<API_KEY>",
            "auth": "api-key",
            "api": "anthropic-messages",
            "authHeader": true,
            "models": [
              {
                "id": "claude-opus-4-6",
                "name": "claude-opus-4-6",
                "reasoning": true,
                "input": [
                  "text",
                  "image"
                ],
                "cost": {
                  "input": 5,
                  "output": 25,
                  "cacheRead": 0.5,
                  "cacheWrite": 6.5
                },
                "contextWindow": 200000,
                "maxTokens": 64000,
                "compat": {
                  "supportsStore": true,
                  "supportsDeveloperRole": true,
                  "supportsReasoningEffort": true
                }
              }
            ]
          }
        }
      },
    }
  3. 设置默认模型,在 ~/.openclaw/openclaw.json 中将 agents.defaults.model.primary 设置为 iina/claude-opus-4-6

    json
    {
      "agents": {
        "defaults": {
          "model": {
            "primary": "iina/claude-opus-4-6"
          },
          ...
        }
      }
    }
  4. 删除已有的模型缓存文件并重启网关:

    shell
    rm ~/.openclaw/agents/main/agent/models.json
    openclaw gateway restart

使用 OpenClaw

其他配置请参考 OpenClaw 官方文档