全部產品
Search
文件中心

Alibaba Cloud Model Studio:OpenClaw

更新時間:Jul 09, 2026

OpenClaw 是一個開源的個人 AI 助手平台,支援通過多種訊息渠道與 AI 互動。通過配置可接入阿里雲百鍊平台上的 AI 模型,支援隨用隨付、Coding Plan、Token Plan 團隊版三種接入方式。

安裝 OpenClaw

OpenClaw 需要 Node.js 22.19.0 或更高版本。可通過以下命令檢查 Node.js 版本:

node --version

如果未安裝或版本過低,請訪問 Node.js 官網下載安裝。

macOS / Linux

推薦使用官方安裝指令碼:

curl -fsSL https://openclaw.ai/install.sh | bash

或通過 npm 全域安裝:

npm install -g openclaw@latest

Windows

在 PowerShell 中執行:

iwr -useb https://openclaw.ai/install.ps1 | iex

或通過 npm 全域安裝:

npm install -g openclaw@latest

首次安裝後,OpenClaw 會自動啟動設定精靈,完成初始設定。也可以手動執行openclaw onboard命令進行配置。

配置項

建議配置

I understand this is powerful and inherently risky. Continue?

選擇 Yes

Onboarding mode

選擇 QuickStart

Model/auth provider

選擇 Skip for now(稍後配置百鍊模型)

Filter models by provider

選擇 All providers

Default model

選擇 Keep current

Select channel (QuickStart)

選擇 Skip for now(稍後配置渠道)

Configure skills now? (recommended)

選擇 No

Enable hooks?

按空格鍵選中選項,按斷行符號鍵進入下一步

How do you want to hatch your bot?

選擇 Do this later

配置接入憑證

Token Plan 團隊版

YOUR_API_KEY 替換為 Token Plan 團隊版專屬 API Key。可用模型請參考 Token Plan 團隊版支援的模型

API Key

Token Plan 團隊版專屬 API Key

Base URL

https://token-plan.ap-southeast-1.maas.aliyuncs.com/apps/anthropic

可用模型

Token Plan 團隊版支援的模型

設定檔位於 ~/.openclaw/openclaw.json,OpenClaw 啟動時會自動讀取。

說明

樣本禁用了網關鑒權(auth.mode: none),僅適合單機本地使用。如需共用或遠端存取,請運行 openclaw doctor --fix 啟用 token 鑒權。

方式一:終端方式

  1. 開啟設定檔

    nano ~/.openclaw/openclaw.json
  2. 寫入配置

    首次配置:複製以下內容到設定檔,將 YOUR_API_KEY 替換為 Token Plan 團隊版 API Key。

    已有配置:若需保留已有配置,請勿直接全量替換,詳見已有配置如何安全修改

    {
      "meta": {
        "lastTouchedVersion": "2026.2.1",
        "lastTouchedAt": "2026-02-03T08:20:00.000Z"
      },
      "models": {
        "mode": "merge",
        "providers": {
          "bailian-token-plan": {
            "baseUrl": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/apps/anthropic",
            "apiKey": "YOUR_API_KEY",
            "api": "anthropic-messages",
            "models": [
              {
                "id": "qwen3.7-max",
                "name": "qwen3.7-max",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 1000000,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "qwen3.7-plus",
                "name": "qwen3.7-plus",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 1000000,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "qwen3.6-plus",
                "name": "qwen3.6-plus",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 1000000,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "qwen3.6-flash",
                "name": "qwen3.6-flash",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 1000000,
                "maxTokens": 32768,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "deepseek-v4-pro",
                "name": "deepseek-v4-pro",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 163840,
                "maxTokens": 32768,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
              },
              {
                "id": "deepseek-v4-flash",
                "name": "deepseek-v4-flash",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 163840,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
              },
              {
                "id": "deepseek-v3.2",
                "name": "deepseek-v3.2",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 163840,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "kimi-k2.7-code",
                "name": "kimi-k2.7-code",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 262144,
                "maxTokens": 32768,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "kimi-k2.6",
                "name": "kimi-k2.6",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 262144,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "kimi-k2.5",
                "name": "kimi-k2.5",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 262144,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "glm-5.2",
                "name": "glm-5.2",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 1000000,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "glm-5.1",
                "name": "glm-5.1",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 202752,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "glm-5",
                "name": "glm-5",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 202752,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "MiniMax-M2.5",
                "name": "MiniMax-M2.5",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 204800,
                "maxTokens": 131072,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
              }
            ]
          }
        }
      },
      "agents": {
        "defaults": {
          "model": {
            "primary": "bailian-token-plan/qwen3.7-plus"
          },
          "models": {
            "bailian-token-plan/qwen3.7-max": {},
            "bailian-token-plan/qwen3.7-plus": {},
            "bailian-token-plan/qwen3.6-plus": {},
            "bailian-token-plan/qwen3.6-flash": {},
            "bailian-token-plan/deepseek-v4-pro": {},
            "bailian-token-plan/deepseek-v4-flash": {},
            "bailian-token-plan/deepseek-v3.2": {},
            "bailian-token-plan/kimi-k2.7-code": {},
            "bailian-token-plan/kimi-k2.6": {},
            "bailian-token-plan/kimi-k2.5": {},
            "bailian-token-plan/glm-5.2": {},
            "bailian-token-plan/glm-5.1": {},
            "bailian-token-plan/glm-5": {},
            "bailian-token-plan/MiniMax-M2.5": {}
          }
        }
      },
      "gateway": {
        "mode": "local",
        "auth": { "mode": "none" }
      }
    }
  3. 儲存並退出

    Ctrl+X,按 Y 確認儲存,按 Enter 確認檔案名稱。

  4. 使配置生效

    運行以下命令重啟網關,使配置生效。

    openclaw gateway restart

方式二:Web UI 方式

  1. 啟動 Web UI

    在終端運行以下命令啟動 Web UI:

    openclaw dashboard

    在瀏覽器開啟的頁面中,單擊左側菜單 設定,將編輯器模式從 Form 切換為 Raw

  2. 寫入配置

    首次配置:複製以下內容到設定檔,將 YOUR_API_KEY 替換為 Token Plan 團隊版 API Key。

    已有配置:若需保留已有配置,請勿直接全量替換,詳見已有配置如何安全修改

    {
      "meta": {
        "lastTouchedVersion": "2026.2.1",
        "lastTouchedAt": "2026-02-03T08:20:00.000Z"
      },
      "models": {
        "mode": "merge",
        "providers": {
          "bailian-token-plan": {
            "baseUrl": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/apps/anthropic",
            "apiKey": "YOUR_API_KEY",
            "api": "anthropic-messages",
            "models": [
              {
                "id": "qwen3.7-max",
                "name": "qwen3.7-max",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 1000000,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "qwen3.7-plus",
                "name": "qwen3.7-plus",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 1000000,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "qwen3.6-plus",
                "name": "qwen3.6-plus",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 1000000,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "qwen3.6-flash",
                "name": "qwen3.6-flash",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 1000000,
                "maxTokens": 32768,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "deepseek-v4-pro",
                "name": "deepseek-v4-pro",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 163840,
                "maxTokens": 32768,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
              },
              {
                "id": "deepseek-v4-flash",
                "name": "deepseek-v4-flash",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 163840,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
              },
              {
                "id": "deepseek-v3.2",
                "name": "deepseek-v3.2",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 163840,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "kimi-k2.7-code",
                "name": "kimi-k2.7-code",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 262144,
                "maxTokens": 32768,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "kimi-k2.6",
                "name": "kimi-k2.6",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 262144,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "kimi-k2.5",
                "name": "kimi-k2.5",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 262144,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "glm-5.2",
                "name": "glm-5.2",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 1000000,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "glm-5.1",
                "name": "glm-5.1",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 202752,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "glm-5",
                "name": "glm-5",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 202752,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "MiniMax-M2.5",
                "name": "MiniMax-M2.5",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 204800,
                "maxTokens": 131072,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
              }
            ]
          }
        }
      },
      "agents": {
        "defaults": {
          "model": {
            "primary": "bailian-token-plan/qwen3.7-plus"
          },
          "models": {
            "bailian-token-plan/qwen3.7-max": {},
            "bailian-token-plan/qwen3.7-plus": {},
            "bailian-token-plan/qwen3.6-plus": {},
            "bailian-token-plan/qwen3.6-flash": {},
            "bailian-token-plan/deepseek-v4-pro": {},
            "bailian-token-plan/deepseek-v4-flash": {},
            "bailian-token-plan/deepseek-v3.2": {},
            "bailian-token-plan/kimi-k2.7-code": {},
            "bailian-token-plan/kimi-k2.6": {},
            "bailian-token-plan/kimi-k2.5": {},
            "bailian-token-plan/glm-5.2": {},
            "bailian-token-plan/glm-5.1": {},
            "bailian-token-plan/glm-5": {},
            "bailian-token-plan/MiniMax-M2.5": {}
          }
        }
      },
      "gateway": {
        "mode": "local",
        "auth": { "mode": "none" }
      }
    }
  3. 儲存並應用

    先單擊 Save 按鈕將配置寫入磁碟,再單擊 Apply 按鈕重啟網關使配置生效。

Coding Plan

YOUR_API_KEY 替換為 Coding Plan 專屬 API Key(格式為 sk-sp-xxxxx)。可用模型請參考 Coding Plan 支援的模型

API Key

Coding Plan 專屬 API Key,格式為 sk-sp-xxxxx

Base URL

https://coding-intl.dashscope.aliyuncs.com/apps/anthropic

可用模型

Coding Plan 支援的模型

設定檔位於 ~/.openclaw/openclaw.json,OpenClaw 啟動時會自動讀取。

說明

樣本禁用了網關鑒權(auth.mode: none),僅適合單機本地使用。如需共用或遠端存取,請運行 openclaw doctor --fix 啟用 token 鑒權。

方式一:終端方式

  1. 開啟設定檔

    nano ~/.openclaw/openclaw.json
  2. 寫入配置

    首次配置:複製以下內容到設定檔,將 YOUR_API_KEY 替換為 Coding Plan API Key。

    已有配置:若需保留已有配置,請勿直接全量替換,詳見已有配置如何安全修改

    {
      "meta": {
        "lastTouchedVersion": "2026.2.1",
        "lastTouchedAt": "2026-02-03T08:20:00.000Z"
      },
      "models": {
        "mode": "merge",
        "providers": {
          "bailian-coding-plan": {
            "baseUrl": "https://coding-intl.dashscope.aliyuncs.com/apps/anthropic",
            "apiKey": "YOUR_API_KEY",
            "api": "anthropic-messages",
            "models": [
              {
                "id": "qwen3.7-plus",
                "name": "qwen3.7-plus",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 1000000,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "qwen3.6-plus",
                "name": "qwen3.6-plus",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 1000000,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "qwen3.5-plus",
                "name": "qwen3.5-plus",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 1000000,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "qwen3-max-2026-01-23",
                "name": "qwen3-max-2026-01-23",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 262144,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "qwen3-coder-next",
                "name": "qwen3-coder-next",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 262144,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
              },
              {
                "id": "qwen3-coder-plus",
                "name": "qwen3-coder-plus",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 1000000,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
              },
              {
                "id": "MiniMax-M2.5",
                "name": "MiniMax-M2.5",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 204800,
                "maxTokens": 131072,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
              },
              {
                "id": "glm-5",
                "name": "glm-5",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 202752,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "glm-4.7",
                "name": "glm-4.7",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 202752,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
              },
              {
                "id": "kimi-k2.5",
                "name": "kimi-k2.5",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 262144,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              }
            ]
          }
        }
      },
      "agents": {
        "defaults": {
          "model": {
            "primary": "bailian-coding-plan/qwen3.7-plus"
          },
          "models": {
            "bailian-coding-plan/qwen3.7-plus": {},
            "bailian-coding-plan/qwen3.6-plus": {},
            "bailian-coding-plan/qwen3.5-plus": {},
            "bailian-coding-plan/qwen3-max-2026-01-23": {},
            "bailian-coding-plan/qwen3-coder-next": {},
            "bailian-coding-plan/qwen3-coder-plus": {},
            "bailian-coding-plan/MiniMax-M2.5": {},
            "bailian-coding-plan/glm-5": {},
            "bailian-coding-plan/glm-4.7": {},
            "bailian-coding-plan/kimi-k2.5": {}
          }
        }
      },
      "gateway": {
        "mode": "local",
        "auth": { "mode": "none" }
      }
    }
  3. 儲存並退出

    Ctrl+X,按 Y 確認儲存,按 Enter 確認檔案名稱。

  4. 使配置生效

    運行以下命令重啟網關,使配置生效。

    openclaw gateway restart

方式二:Web UI 方式

  1. 啟動 Web UI

    在終端運行以下命令啟動 Web UI:

    openclaw dashboard

    在瀏覽器開啟的頁面中,單擊左側菜單 設定,將編輯器模式從 Form 切換為 Raw

  2. 寫入配置

    首次配置:複製以下內容到設定檔,將 YOUR_API_KEY 替換為 Coding Plan API Key。

    已有配置:若需保留已有配置,請勿直接全量替換,詳見已有配置如何安全修改

    {
      "meta": {
        "lastTouchedVersion": "2026.2.1",
        "lastTouchedAt": "2026-02-03T08:20:00.000Z"
      },
      "models": {
        "mode": "merge",
        "providers": {
          "bailian-coding-plan": {
            "baseUrl": "https://coding-intl.dashscope.aliyuncs.com/apps/anthropic",
            "apiKey": "YOUR_API_KEY",
            "api": "anthropic-messages",
            "models": [
              {
                "id": "qwen3.7-plus",
                "name": "qwen3.7-plus",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 1000000,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "qwen3.6-plus",
                "name": "qwen3.6-plus",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 1000000,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "qwen3.5-plus",
                "name": "qwen3.5-plus",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 1000000,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "qwen3-max-2026-01-23",
                "name": "qwen3-max-2026-01-23",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 262144,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "qwen3-coder-next",
                "name": "qwen3-coder-next",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 262144,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
              },
              {
                "id": "qwen3-coder-plus",
                "name": "qwen3-coder-plus",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 1000000,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
              },
              {
                "id": "MiniMax-M2.5",
                "name": "MiniMax-M2.5",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 204800,
                "maxTokens": 131072,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
              },
              {
                "id": "glm-5",
                "name": "glm-5",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 202752,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "glm-4.7",
                "name": "glm-4.7",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 202752,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
              },
              {
                "id": "kimi-k2.5",
                "name": "kimi-k2.5",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 262144,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              }
            ]
          }
        }
      },
      "agents": {
        "defaults": {
          "model": {
            "primary": "bailian-coding-plan/qwen3.7-plus"
          },
          "models": {
            "bailian-coding-plan/qwen3.7-plus": {},
            "bailian-coding-plan/qwen3.6-plus": {},
            "bailian-coding-plan/qwen3.5-plus": {},
            "bailian-coding-plan/qwen3-max-2026-01-23": {},
            "bailian-coding-plan/qwen3-coder-next": {},
            "bailian-coding-plan/qwen3-coder-plus": {},
            "bailian-coding-plan/MiniMax-M2.5": {},
            "bailian-coding-plan/glm-5": {},
            "bailian-coding-plan/glm-4.7": {},
            "bailian-coding-plan/kimi-k2.5": {}
          }
        }
      },
      "gateway": {
        "mode": "local",
        "auth": { "mode": "none" }
      }
    }
  3. 儲存並應用

    先單擊 Save 按鈕將配置寫入磁碟,再單擊 Apply 按鈕重啟網關使配置生效。

隨用隨付

YOUR_API_KEY 替換為阿里雲百鍊 API Key(格式為 sk-xxxxx)。可用模型請參考模型廣場

API Key

阿里雲百鍊 API Key,格式為 sk-xxxxx

Base URL

請確保 Base URL、API Key 和模型歸屬同一地區:

  • 華北2(北京):https://dashscope.aliyuncs.com/apps/anthropic

  • 新加坡:https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/apps/anthropic,請將WorkspaceId替換為真實的擷取Workspace ID

可用模型

填入模型廣場中支援的模型

以下配置以華北2(北京)地區為例,如使用其他地區請替換 baseUrl 為上表中對應地區的 URL。

設定檔位於 ~/.openclaw/openclaw.json,OpenClaw 啟動時會自動讀取。

說明

樣本禁用了網關鑒權(auth.mode: none),僅適合單機本地使用。如需共用或遠端存取,請運行 openclaw doctor --fix 啟用 token 鑒權。

方式一:終端方式

  1. 開啟設定檔

    nano ~/.openclaw/openclaw.json
  2. 寫入配置

    首次配置:複製以下內容到設定檔,將 YOUR_API_KEY 替換為百鍊 API Key。

    已有配置:若需保留已有配置,請勿直接全量替換,詳見已有配置如何安全修改

    {
      "meta": {
        "lastTouchedVersion": "2026.2.1",
        "lastTouchedAt": "2026-02-03T08:20:00.000Z"
      },
      "models": {
        "mode": "merge",
        "providers": {
          "bailian": {
            "baseUrl": "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/apps/anthropic",
            "apiKey": "YOUR_API_KEY",
            "api": "anthropic-messages",
            "models": [
              {
                "id": "qwen3.6-plus",
                "name": "qwen3.6-plus",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 1000000,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "MiniMax-M2.5",
                "name": "MiniMax-M2.5",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 204800,
                "maxTokens": 131072,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
              },
              {
                "id": "glm-5",
                "name": "glm-5",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 202752,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "deepseek-v3.2",
                "name": "deepseek-v3.2",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 163840,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              }
            ]
          }
        }
      },
      "agents": {
        "defaults": {
          "model": {
            "primary": "bailian/qwen3.6-plus"
          },
          "models": {
            "bailian/qwen3.6-plus": {},
            "bailian/MiniMax-M2.5": {},
            "bailian/glm-5": {},
            "bailian/deepseek-v3.2": {}
          }
        }
      },
      "gateway": {
        "mode": "local",
        "auth": { "mode": "none" }
      }
    }
  3. 儲存並退出

    Ctrl+X,按 Y 確認儲存,按 Enter 確認檔案名稱。

  4. 使配置生效

    運行以下命令重啟網關,使配置生效。

    openclaw gateway restart

方式二:Web UI 方式

  1. 啟動 Web UI

    在終端運行以下命令啟動 Web UI:

    openclaw dashboard

    在瀏覽器開啟的頁面中,單擊左側菜單 設定,將編輯器模式從 Form 切換為 Raw

  2. 寫入配置

    首次配置:複製以下內容到設定檔,將 YOUR_API_KEY 替換為百鍊 API Key。

    已有配置:若需保留已有配置,請勿直接全量替換,詳見已有配置如何安全修改

    {
      "meta": {
        "lastTouchedVersion": "2026.2.1",
        "lastTouchedAt": "2026-02-03T08:20:00.000Z"
      },
      "models": {
        "mode": "merge",
        "providers": {
          "bailian": {
            "baseUrl": "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/apps/anthropic",
            "apiKey": "YOUR_API_KEY",
            "api": "anthropic-messages",
            "models": [
              {
                "id": "qwen3.6-plus",
                "name": "qwen3.6-plus",
                "reasoning": false,
                "input": ["text", "image"],
                "contextWindow": 1000000,
                "maxTokens": 65536,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "MiniMax-M2.5",
                "name": "MiniMax-M2.5",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 204800,
                "maxTokens": 131072,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
              },
              {
                "id": "glm-5",
                "name": "glm-5",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 202752,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              },
              {
                "id": "deepseek-v3.2",
                "name": "deepseek-v3.2",
                "reasoning": false,
                "input": ["text"],
                "contextWindow": 163840,
                "maxTokens": 16384,
                "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                "compat": { "thinkingFormat": "openai" }
              }
            ]
          }
        }
      },
      "agents": {
        "defaults": {
          "model": {
            "primary": "bailian/qwen3.6-plus"
          },
          "models": {
            "bailian/qwen3.6-plus": {},
            "bailian/MiniMax-M2.5": {},
            "bailian/glm-5": {},
            "bailian/deepseek-v3.2": {}
          }
        }
      },
      "gateway": {
        "mode": "local",
        "auth": { "mode": "none" }
      }
    }
  3. 儲存並應用

    先單擊 Save 按鈕將配置寫入磁碟,再單擊 Apply 按鈕重啟網關使配置生效。

接入訊息渠道

WhatsApp

步驟一:安裝 WhatsApp 外掛程式

WhatsApp 渠道通過外掛程式方式接入,執行以下命令安裝外掛程式:

openclaw plugins install @openclaw/whatsapp

步驟二:配置 WhatsApp 渠道

在 OpenClaw 對話中輸入以下內容,OpenClaw 會詢問手機號碼(需使用 E.164 格式,即 + 號加國家代碼加手機號),然後自動將號碼填入配置並完成設定。

請幫我配置 WhatsApp 渠道。請先詢問My Phone號碼,然後將號碼自動填入以下配置中的 allowFrom 和 groupAllowFrom 欄位,完成配置。
{
  "channels": {
    "whatsapp": {
      "dmPolicy": "pairing",
      "allowFrom": ["<phone_number>"],
      "groupPolicy": "allowlist",
      "groupAllowFrom": ["<phone_number>"]
    }
  }
}
說明

建議使用單獨的手機號運行 WhatsApp 渠道,避免機器人響應日常聊天中的訊息。如果使用日常聊天的手機號,可在 OpenClaw 對話中輸入開啟 selfChatMode,機器人將僅在給自己發訊息的對話中響應,不影響其他聊天。

步驟三:關聯 WhatsApp

  1. 執行以下命令啟動 WhatsApp 關聯流程,終端會顯示二維碼。

    openclaw channels login --channel whatsapp
  2. 開啟手機 WhatsApp,掃描終端中的二維碼完成關聯。

  3. 重啟網關。

    openclaw gateway restart

步驟四:測試

  1. 執行以下命令檢查 WhatsApp 渠道狀態。

    openclaw status

    在 Channels 部分,WhatsApp 應顯示為 ON 且狀態為 OK

  2. 在 WhatsApp 中給自己發送一條訊息,驗證機器人是否正常響應。

Telegram

  1. 通過 BotFather 建立機器人

    發送 /newbot 命令,按提示輸入機器人名稱和使用者名稱(使用者名稱必須以 bot 結尾),複製並儲存返回的 Bot Token(格式為:123456789:ABCdefGHIjklMNOpqrsTUVwxyz)。

  2. 在 OpenClaw 對話中輸入如下內容,並將 xxxx 替換為實際的 Bot Token。OpenClaw 會自動完成配置。

    請幫我配置Telegram,配置項如下,我的Bot Token是xxxx。
    {
      "channels": {
        "telegram": {
          "enabled": true,
          "botToken": "xxxx",
          "dmPolicy": "pairing"
        }
      }
    }
  3. 配置完成後,重啟網關。

    openclaw gateway restart
  4. 在 Telegram 中發送訊息給機器人,首次發送訊息會收到配對碼。

  5. 在終端執行以下命令,將 xxx 替換為實際的配對碼。

    openclaw pairing approve telegram xxx

Discord

步驟一:建立 Discord 應用和機器人

  1. 建立 Discord 應用

    進入 Discord Developer Portal,單擊 New Application,輸入應用程式名稱,然後單擊 Create

  2. 建立機器人並開啟許可權

    1. 在左側導覽列單擊 Bot,設定機器人使用者名稱。

    2. 在 Bot 頁面向下滾動到 Privileged Gateway Intents,開啟以下許可權:

      • Message Content Intent

      • Server Members Intent

      • Presence Intent

      完成後單擊 Save Changes

  3. 擷取 Bot Token

    在 Bot 頁面頂部,單擊 Reset Token 產生令牌,複製並妥善儲存。此令牌僅顯示一次。

  4. 添加機器人到伺服器

    1. 在左側導覽列單擊 OAuth2,向下滾動到 OAuth2 URL Generator。

    2. 在 Scopes 中勾選 bot 和 applications.commands

    3. 在下方出現的 Bot Permissions 中勾選以下許可權:

      • View Channels

      • Send Messages

      • Read Message History

      • Embed Links

      • Attach Files

    4. 複製頁面底部產生的 URL,在瀏覽器中開啟,選擇目標伺服器並單擊 Continue 完成添加。

步驟二:在 OpenClaw 中配置 Discord

  1. 在運行 OpenClaw 的機器上,設定 Bot Token 環境變數。

    export DISCORD_BOT_TOKEN="YOUR_BOT_TOKEN"
  2. 執行以下命令完成 Discord 配置。

    openclaw config set channels.discord.token --ref-provider default --ref-source env --ref-id DISCORD_BOT_TOKEN
    openclaw config set channels.discord.enabled true --strict-json
  3. 重啟網關使配置生效。

    openclaw gateway restart

步驟三:配對與測試

  1. 在 Discord 中向機器人發送私信,首次發送會收到配對碼(Pairing Code)。

  2. 在終端執行以下命令完成配對,將 xxx 替換為實際的配對碼。

    openclaw pairing approve discord xxx
    說明

    配對碼有效期間為 1 小時,到期需重新發送訊息擷取新的配對碼。

  3. 執行以下命令檢查 Discord 渠道狀態。

    openclaw status

    在 Channels 部分,Discord 應顯示為 ON 且狀態為 OK

  4. 在 Discord 中發送訊息進行測試。

常見命令

命令

說明

樣本

/help

顯示可用命令的快速摘要。

/help

/status

查看當前模型、會話、網關等狀態資訊。

/status

/model <模型名稱>

切換當前會話使用的模型。

/model qwen3.7-max

/new

開始一個新會話。

/new

/compact

壓縮對話歷史,釋放上下文視窗空間。

/compact

/think <層級>

設定思考(推理)深度層級,可選 off、low、medium、high 等。

/think high

/skills

展示全部可用的 Skill。

/skills

使用案例

案例一:X(Twitter)自動營運

通過 OpenClaw 可自動化營運 X (Twitter) 帳號,支援發帖、回複、搜尋、時間軸瀏覽等操作。

配置步驟

  1. 在終端執行以下命令安裝 twitter-cli。

    uv tool install twitter-cli
  2. 在 OpenClaw 對話中輸入以下指令,自動完成 Skill 安裝。

    Install this skill: https://github.com/public-clis/twitter-cli
  3. 安裝完成後,返回終端並重啟網關使 Skill 生效。

    openclaw gateway restart
  4. 驗證 Skill 是否安裝成功。

    openclaw skills list
  5. twitter-cli 使用瀏覽器 Cookie 進行認證。請確保已在支援的瀏覽器(Chrome、Edge、Firefox、Arc 或 Brave)中登入 x.com,twitter-cli 會自動提取 Cookie。

    也可以通過環境變數手動設定認證資訊:

    export TWITTER_AUTH_TOKEN="your_auth_token"
    export TWITTER_CT0="your_ct0_token"
    說明

    Cookie 擷取方式:在瀏覽器中開啟 x.com,開啟開發人員工具,切換到 Application 面板,在 Cookies 中找到 auth_token 和 ct0 的值。

樣本一:自動發布文章

在 OpenClaw 對話中輸入查看 Sam Altman 最近的推文,總結要點後幫我發一條推文談談我的看法,OpenClaw 會自動擷取動態、分析內容並發布。

樣本二:搜尋熱門話題

輸入幫我搜尋昨天關於 harness engineering 的推文,OpenClaw 會搜尋相關推文並總結要點。

案例二:YouTube 視頻分析與下載

通過OpenClaw 可以搜尋 YouTube 視頻、提取視頻資訊並下載視頻,支援按關鍵詞搜尋、按日期排序、批量擷取視頻中繼資料等操作。

配置步驟

  1. 在終端執行以下命令安裝 yt-dlp。

    pip install yt-dlp
  2. 驗證安裝。

    yt-dlp --version
  3. (可選)配置 Cookie 認證。如果需要訪問年齡限制、會員專屬或私人視頻,需要配置 YouTube Cookie。確保已在瀏覽器中登入 youtube.com,然後在 OpenClaw 對話中輸入:

    我需要配置 YouTube 的 Cookie 認證,請使用 yt-dlp 從我的瀏覽器中提取 YouTube 的 Cookie

安裝完成後,即可在 OpenClaw 對話中直接使用,OpenClaw 會自動調用 yt-dlp 命令執行視頻相關操作。

樣本一:視頻內容總結

在 OpenClaw 對話中輸入幫我總結這個視頻的主要內容:https://www.youtube.com/watch?v=XRgGFQ0EgM0,OpenClaw 會提取視頻資訊並產生內容摘要。

樣本二:視頻下載

在 OpenClaw 對話中輸入幫我下載這個視頻:https://www.youtube.com/watch?v=XRgGFQ0EgM0,OpenClaw 會調用 yt-dlp 將視頻下載到本地。

案例三:定時推送 AI 新聞

通過 OpenClaw 的 Cron 定時任務功能,每天自動抓取最新 AI 新聞並推送到 WhatsApp。

配置步驟

  1. 在終端執行以下命令:

    openclaw cron add \
      --name "ai-daily-news" \
      --cron "0 9 * * *" \
      --tz "UTC" \
      --message "Please visit https://techcrunch.com/category/artificial-intelligence/ to get today's AI news. Summarize the top 10 most important AI stories in a concise list format, each with a title and a one-sentence summary in English." \
      --channel whatsapp \
      --to "<your_phone_number>" \
      --announce

    參數說明如下:

    | 參數 | 說明 | | --- | --- | | --name | 任務名稱 | | --cron | Cron 運算式,"0 9 * * *" 表示每天 9:00 執行 | | --tz | 時區,設為 "UTC" 即國際標準時間,可按需替換為您所在時區(如 "America/New_York""Europe/London") | | --message | 發送給 Agent 的提示詞,告訴 AI 要抓取什麼內容、如何總結 | | --channel | 推送通道,設為 whatsapp | | --announce | 將結果推送到 WhatsApp 對話中 | | --to | 接收訊息的 WhatsApp 手機號(需使用 E.164 格式,即 + 號加國家代碼加手機號) |

    建立成功後將返回 JSON 格式的任務資訊,包含任務 ID 和下次執行時間。

  2. 建立任務後,可以立即手動觸發一次以驗證效果。

    1. 查看工作清單,擷取任務 ID。

      openclaw cron list
    2. 手動觸發執行。

      openclaw cron run <task_ID> --timeout 120000
    3. 查看執行結果。

      openclaw cron runs --id <task_ID>

      當輸出中 "status": "ok" 且 "delivered": true 時,表示新聞已成功推送到 WhatsApp。

案例四:股市監控與分析

讓 OpenClaw 分析股票走勢,並提供技術面分析和投資建議。

說明

AI 產生內容僅供參考,不構成實際的投資建議或決策依據。

配置步驟

  1. 安裝 Skill

    在 OpenClaw 對話中輸入以下指令,OpenClaw 會自動完成安裝:

    Install the manus-stock-analysis skill
  2. 安裝完成後,返回終端並重啟網關使 Skill 生效。

    openclaw gateway restart

    驗證 Skill 是否安裝成功。

    openclaw skills list
  3. 在 OpenClaw 對話中輸入股市相關問題,例如Analyze NVDA stock

瞭解更多

Skill

Skill 是可擴充的能力模組,Agent 會根據請求自動匹配並載入對應的 Skill。OpenClaw 支援查看和啟用內建 Skill,從 ClawHub安裝社區 Skill,或建立自訂 Skill。

查看已有 Skill

  1. 執行以下命令查看已安裝的 Skill 及其狀態。

    # 列出已安裝的 Skill
    openclaw skills list
    
    # 查看 Skill 狀態(已啟用、已禁用、缺少依賴等)
    openclaw skills check
    
    # 查看特定 Skill 的詳細資料
    openclaw skills info <skill-name>
  2. 內建 Skill 預設未啟用,需在 ~/.openclaw/openclaw.json 中通過 skills.allowBundled 白名單啟用,只有列在其中的內建 Skill 才會被載入。

    {
      "skills": {
        "allowBundled": [
          "github",
          "weather",
          "summarize",
          "coding-agent",
          "clawhub",
          "nano-pdf",
          "google-web-search",
          "image-lab"
        ]
      }
    }

部分內建 Skill需要配置對應的第三方 API Key 才能使用,請在 ~/.openclaw/openclaw.json 的 skills.entries 中配置,具體請參考 Skills 配置文檔

尋找更多 Skill

可以通過以下兩種方式尋找並安裝更多 Skill。

  1. 通過 ClawHub 搜尋安裝

    ClawHub 提供 3,000+ 個社區 Skill,可以在網站上瀏覽,也可以通過命令列搜尋。

    # 按關鍵詞搜尋
    npx clawhub search [關鍵詞]
    
    # 瀏覽最新動向的 Skill
    npx clawhub explore

    找到合適的 Skill 後,執行以下命令安裝,安裝完成後重啟網關即可使用。

    npx clawhub install <skill-name>
  2. 直接在 OpenClaw 中提問

    在對話中直接描述需求,例如幫我找一個可以查天氣的 Skill,OpenClaw 會自動搜尋並安裝。

建立自訂 Skill

  1. 建立 Skill 目錄。

    mkdir -p ~/.openclaw/workspace/skills/my-custom-skill
  2. 在該目錄下建立 SKILL.md 檔案。檔案由 YAML 前置中繼資料和 Markdown 指令兩部分組成,其中 name 和 description 為必要欄位。Agent 根據 description 判斷是否載入該 Skill,請確保描述準確。

    ---
    name: my-custom-skill
    description: 簡短描述
    ---
    
    # My Custom Skill
    
    當使用者請求 XXX 時,執行以下操作:
    
    1. 使用 bash 工具運行 xxx 命令
    2. 解析輸出結果
    3. 以表格形式返回給使用者
  3. 重啟網關使 Skill 生效。

    # 重啟網關
    openclaw gateway restart
    
    # 查看 Skill 是否生效
    openclaw skills list

更多 Skill 配置說明請參考OpenClaw 官方文檔

常見問題

如何查看已配置的模型?

在終端輸入openclaw tui,進入 OpenClaw 終端命令列,接著輸入/model查看模型列表。按斷行符號鍵選中模型,按Esc鍵退出模型列表。

為什麼報錯"HTTP 401: Incorrect API key provided."、"No API key found for provider xxx"或"HTTP 401: invalid_iam_token"?

可能原因:

  1. API Key 無效、到期、為空白、格式錯誤,或與端點環境不匹配。請檢查 API Key 是否與所使用的付費方式匹配,並確保複製完整且無空格;確認訂閱狀態有效。

  2. OpenClaw 的歷史配置緩衝導致配置錯誤,請刪除~/.openclaw/agents/main/agent/models.json檔案中的providers配置項,並重啟 OpenClaw。

  3. invalid_iam_token 表示 API Key 經 IAM 鑒權校正失敗。常見情境:API Key 已被吊銷或禁用、API Key 歸屬的地區與 Base URL 所指地區不一致(例如 API Key 在華北2(北京),但 Base URL 指向新加坡)、使用 STS 臨時憑證且已到期。請核對 API Key 與 Base URL 歸屬同一地區,並確認 API Key 狀態正常。

我已經配置過DingTalk等其他渠道,如何安全地添加新套餐模型(防止原有配置丟失)?

  • 請勿直接全量覆蓋。直接"全部替換"會覆蓋掉自訂配置,請進行局部修改

  • 可以選擇以下方式完成配置:

    • 若 OpenClaw 可正常對話:直接在 OpenClaw 對話中輸入指令完成配置合并。

    • 若 OpenClaw 未配置模型或無法對話:請手動編輯 ~/.openclaw/openclaw.json,只修改需要變更的欄位,保留原有配置不變。

重啟網關後,已有會話可能無法正常對話,請重啟會話。

報錯 device identity required 怎麼辦?

詳細報錯資訊:

http://127.0.0.1:18791/15:05:56 [ws] closed before connect conn=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx remote=127.0.0.1 fwd=n/a origin=n/a host=127.0.0.1:18789 ua=n/a code=1008 reason=device identity required

原因:

用戶端串連網關時未提供裝置身份資訊,通常由以下原因導致:

  • 首次開啟瀏覽器訪問地址,尚未完成裝置配對。

  • 瀏覽器緩衝被清除,裝置密鑰丟失。

  • 重裝或升級 OpenClaw 後,~/.openclaw/identity/ 目錄下的密鑰檔案缺失。

解決方案:

在終端執行以下命令,允許當前裝置串連並重建瀏覽器訪問地址:

openclaw devices approve --latest
openclaw dashboard --no-open

如果仍未解決,先清除異常的裝置記錄再重試:

openclaw devices clear --pending --yes
openclaw dashboard --no-open

執行 openclaw devices list,確認裝置顯示在 Paired 列表中即為正常。

沒有主動使用 OpenClaw,但仍產生了 Token 消耗

原因:OpenClaw 內建心跳機制(Heartbeat),網關運行期間會按固定間隔(預設 30 分鐘)自動調用已配置的模型,檢查是否有待處理任務。每次心跳都會消耗少量 Token。

如何確認:查看 ~/.openclaw/agents/main/sessions/ 目錄下的會話記錄檔案(.jsonl),其中包含 [OpenClaw heartbeat poll] 標記的心跳調用記錄。

解決方案:

  • 停止網關:不使用時執行 openclaw gateway stop,心跳隨即停止。

  • 增大心跳間隔:在 ~/.openclaw/openclaw.json 中設定 agents.defaults.heartbeat.every,例如 "2h" 表示每 2 小時一次。