Skip to main content

OpenClaw

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

安裝 OpenClaw

OpenClaw 需要 Node.js 24.16+ 或 26.1+。可通過以下命令檢查 Node.js 版本:
node --version
如果未安裝或版本不符合要求,請訪問 Node.js 官網下載安裝。
  • macOS / Linux
  • Windows
推薦使用官方安裝指令碼:
curl -fsSL https://openclaw.ai/install.sh | bash
或通過 npm 全域安裝:
npm install -g openclaw@latest
首次安裝後,OpenClaw 會自動啟動引導式設定。2026.7.1 及以上可執行 openclaw onboard(引導式)或 openclaw onboard --classic(經典精靈);2026.6.35 及以下直接執行 openclaw onboard(即經典精靈)。
以下為設定精靈中的關鍵選擇。不同版本步驟可能不同,以實際介面為準。本文透過設定檔接入百煉,模型供應商統一選擇 Skip for now。
  • 安全提示:如出現,選擇 Yes。
  • 啟動方式:選擇 Quick start / QuickStart。
  • 建立對象:選擇 One agent(如出現)。
  • 模型供應商:選擇 Skip for now(本文透過設定檔接入,不在此選擇供應商)。
  • 預設模型:如出現,選擇 Keep current。
  • 頻道、技能、hooks:依需求跳過或稍後設定。
完成精靈後,按「配置接入憑證」章節編輯 ~/.openclaw/openclaw.json 接入百煉。

配置接入憑證

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 鑒權。
首次配置:複製以下內容到設定檔,將 YOUR_API_KEY 替換為 Token Plan 個人版 API Key。 已有配置:若需保留已有配置,請勿直接全量替換,詳見已有配置如何安全修改。
{
  "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.8-max",
            "name": "qwen3.8-max",
            "reasoning": true,
            "input": ["text", "image"],
            "contextWindow": 983616,
            "maxTokens": 131072,
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "compat": { "thinkingFormat": "openai" }
          },
          {
            "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-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": "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": "deepseek-v4.1-flash",
            "name": "deepseek-v4.1-flash",
            "reasoning": false,
            "input": ["text", "image"],
            "contextWindow": 1000000,
            "maxTokens": 393216,
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
          },
          {
            "id": "deepseek-v4.1-flash-1017",
            "name": "deepseek-v4.1-flash-1017",
            "reasoning": false,
            "input": ["text", "image"],
            "contextWindow": 1000000,
            "maxTokens": 393216,
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
          },          {
            "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-pro-0813",
            "name": "deepseek-v4-pro-0813",
            "reasoning": false,
            "input": ["text"],
            "contextWindow": 163840,
            "maxTokens": 32768,
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
          },
          {
            "id": "deepseek-v4-flash-0731",
            "name": "deepseek-v4-flash-0731",
            "reasoning": false,
            "input": ["text"],
            "contextWindow": 1000000,
            "maxTokens": 393216,
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
          }

        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "bailian-token-plan/qwen3.8-max"
      },
      "models": {
        "bailian-token-plan/qwen3.8-max": {},
        "bailian-token-plan/qwen3.7-max": {},
        "bailian-token-plan/qwen3.7-plus": {},
        "bailian-token-plan/qwen3.6-flash": {},
        "bailian-token-plan/glm-5.2": {},
        "bailian-token-plan/deepseek-v4.1-flash": {},
        "bailian-token-plan/deepseek-v4.1-flash-1017": {},
        "bailian-token-plan/deepseek-v4-pro": {},
        "bailian-token-plan/deepseek-v4-pro-0813": {},
        "bailian-token-plan/deepseek-v4-flash-0731": {}

      }
    }
  },
  "gateway": {
    "mode": "local",
    "auth": { "mode": "none" }
  }
}

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 鑒權。
  • 方式一:終端方式
  • 方式二:Web UI 方式
  1. 開啟設定檔
nano ~/.openclaw/openclaw.json
  1. 寫入配置 首次配置:複製以下內容到設定檔,將 YOUR_API_KEY 替換為 Token Plan 團隊版 API Key。 已有配置:若需保留已有配置,請勿直接全量替換,詳見已有配置如何安全修改。
{
  "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.8-max",
            "name": "qwen3.8-max",
            "reasoning": true,
            "input": ["text", "image"],
            "contextWindow": 983616,
            "maxTokens": 131072,
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "compat": { "thinkingFormat": "openai" }
          },
          {
            "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.1-flash",
            "name": "deepseek-v4.1-flash",
            "reasoning": false,
            "input": ["text", "image"],
            "contextWindow": 1000000,
            "maxTokens": 393216,
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
          },
          {
            "id": "deepseek-v4.1-flash-1017",
            "name": "deepseek-v4.1-flash-1017",
            "reasoning": false,
            "input": ["text", "image"],
            "contextWindow": 1000000,
            "maxTokens": 393216,
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
          },
          {
            "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-pro-0813",
            "name": "deepseek-v4-pro-0813",
            "reasoning": false,
            "input": ["text"],
            "contextWindow": 163840,
            "maxTokens": 32768,
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
          },
          {
            "id": "deepseek-v4-flash-0731",
            "name": "deepseek-v4-flash-0731",
            "reasoning": false,
            "input": ["text"],
            "contextWindow": 1000000,
            "maxTokens": 393216,
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
          },

          {
            "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.8-max"
      },
      "models": {
        "bailian-token-plan/qwen3.8-max": {},
        "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.1-flash": {},
        "bailian-token-plan/deepseek-v4.1-flash-1017": {},
        "bailian-token-plan/deepseek-v4-pro": {},
        "bailian-token-plan/deepseek-v4-pro-0813": {},
        "bailian-token-plan/deepseek-v4-flash-0731": {},

        "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" }
  }
}
  1. 儲存並退出 按 Ctrl+X,按 Y 確認儲存,按 Enter 確認檔案名稱。
  2. 使配置生效 運行以下命令重啟網關,使配置生效。
openclaw gateway restart

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 鑒權。
  • 方式一:終端方式
  • 方式二:Web UI 方式
  1. 開啟設定檔
nano ~/.openclaw/openclaw.json
  1. 寫入配置 首次配置:複製以下內容到設定檔,將 YOUR_API_KEY 替換為 Coding Plan API Key。 已有配置:若需保留已有配置,請勿直接全量替換,詳見已有配置如何安全修改。
{
  "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": "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": "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/MiniMax-M2.5": {},
        "bailian-coding-plan/glm-5": {},
        "bailian-coding-plan/kimi-k2.5": {}
      }
    }
  },
  "gateway": {
    "mode": "local",
    "auth": { "mode": "none" }
  }
}
  1. 儲存並退出 按 Ctrl+X,按 Y 確認儲存,按 Enter 確認檔案名稱。
  2. 使配置生效 運行以下命令重啟網關,使配置生效。
openclaw gateway restart

隨用隨付

配置項

說明

API Key

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

Base URL

請確保 Base URL、API Key 和模型歸屬同一地區,並將 WorkspaceId替換為真實的擷取Workspace ID

  • 華北2(北京):https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/apps/anthropic

  • 新加坡:https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/apps/anthropic

可用模型

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

以下配置以華北2(北京)地區為例,如使用其他地區請替換 baseUrl 為上表中對應地區的 URL。 設定檔位於 ~/.openclaw/openclaw.json,OpenClaw 啟動時會自動讀取。
樣本禁用了網關鑒權(auth.mode: none),僅適合單機本地使用。如需共用或遠端存取,請運行 openclaw doctor --fix 啟用 token 鑒權。
  • 方式一:終端方式
  • 方式二:Web UI 方式
  1. 開啟設定檔
nano ~/.openclaw/openclaw.json
  1. 寫入配置 首次配置:複製以下內容到設定檔,將 YOUR_API_KEY 替換為百鍊 API Key。 已有配置:若需保留已有配置,請勿直接全量替換,詳見已有配置如何安全修改。
{
  "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" }
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "bailian/qwen3.6-plus"
      },
      "models": {
        "bailian/qwen3.6-plus": {},
        "bailian/MiniMax-M2.5": {},
        "bailian/glm-5": {}
      }
    }
  },
  "gateway": {
    "mode": "local",
    "auth": { "mode": "none" }
  }
}
  1. 儲存並退出 按 Ctrl+X,按 Y 確認儲存,按 Enter 確認檔案名稱。
  2. 使配置生效 運行以下命令重啟網關,使配置生效。
openclaw gateway restart

接入訊息渠道

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
  1. 開啟手機 WhatsApp,掃描終端中的二維碼完成關聯。
  2. 重啟網關。
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"
    }
  }
}
  1. 配置完成後,重啟網關。
openclaw gateway restart
  1. 在 Telegram 中發送訊息給機器人,首次發送訊息會收到配對碼。
  2. 在終端執行以下命令,將 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"
  1. 執行以下命令完成 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
  1. 重啟網關使配置生效。
openclaw gateway restart

步驟三:配對與測試

  1. 在 Discord 中向機器人發送私信,首次發送會收到配對碼(Pairing Code)。
  2. 在終端執行以下命令完成配對,將 xxx 替換為實際的配對碼。
openclaw pairing approve discord xxx
配對碼有效期間為 1 小時,到期需重新發送訊息擷取新的配對碼。
  1. 執行以下命令檢查 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
  1. 在 OpenClaw 對話中輸入以下指令,自動完成 Skill 安裝。
Install this skill: https://github.com/public-clis/twitter-cli
  1. 安裝完成後,返回終端並重啟網關使 Skill 生效。
openclaw gateway restart
  1. 驗證 Skill 是否安裝成功。
openclaw skills list
  1. 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
  1. 驗證安裝。
yt-dlp --version
  1. (可選)配置 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 新聞並推送到 Discord(Cron 定時任務支援 discord 和 telegram 渠道)。
  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 discord \
  --announce
參數說明如下:| 參數 | 說明 | | --- | --- | | --name | 任務名稱 | | --cron | Cron 運算式,"0 9 * * *" 表示每天 9:00 執行 | | --tz | 時區,設為 "UTC" 即國際標準時間,可按需替換為您所在時區(如 "America/New_York"、"Europe/London") | | --message | 發送給 Agent 的提示詞,告訴 AI 要抓取什麼內容、如何總結 | | --channel | 推送渠道。Cron 定時任務支援 discord 和 telegram,此處設為 discord。 | | --announce | 將結果推送到已配置的 Discord 頻道中。 |建立成功後將返回 JSON 格式的任務資訊,包含任務 ID 和下次執行時間。 2. 建立任務後,可以立即手動觸發一次以驗證效果。
  1. 查看工作清單,擷取任務 ID。
openclaw cron list
  1. 手動觸發執行。
openclaw cron run <task_ID> --timeout 120000
  1. 查看執行結果。
openclaw cron runs --id <task_ID>
當輸出中 "status": "ok" 且 "delivered": true 時,表示新聞已成功推送到 Discord。

案例四:股市監控與分析

讓 OpenClaw 分析股票走勢,並提供技術面分析和投資建議。
AI 產生內容僅供參考,不構成實際的投資建議或決策依據。
  1. 安裝 Skill 在 OpenClaw 對話中輸入以下指令,OpenClaw 會自動完成安裝:
Install the manus-stock-analysis skill
  1. 安裝完成後,返回終端並重啟網關使 Skill 生效。
openclaw gateway restart
驗證 Skill 是否安裝成功。
openclaw skills list
  1. 在 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>
  1. 內建 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>
  1. 直接在 OpenClaw 中提問 在對話中直接描述需求,例如幫我找一個可以查天氣的 Skill,OpenClaw 會自動搜尋並安裝。

建立自訂 Skill

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

# My Custom Skill

當使用者請求 XXX 時,執行以下操作:

1. 使用 bash 工具運行 xxx 命令
2. 解析輸出結果
3. 以表格形式返回給使用者
  1. 重啟網關使 Skill 生效。
# 重啟網關
openclaw gateway restart

# 查看 Skill 是否生效
openclaw skills list
更多 Skill 配置說明請參考OpenClaw 官方文檔。

常見問題

在終端輸入openclaw tui,進入 OpenClaw 終端命令列,接著輸入/model查看模型列表。按斷行符號鍵選中模型,按Esc鍵退出模型列表。
可能原因:
  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 狀態正常。
  • 請勿直接全量覆蓋。直接"全部替換"會覆蓋掉自訂配置,請進行局部修改。
  • 可以選擇以下方式完成配置:
    • 若 OpenClaw 可正常對話:直接在 OpenClaw 對話中輸入指令完成配置合并。
    • 若 OpenClaw 未配置模型或無法對話:請手動編輯 ~/.openclaw/openclaw.json,只修改需要變更的欄位,保留原有配置不變。
重啟網關後,已有會話可能無法正常對話,請重啟會話。
詳細報錯資訊:
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 內建心跳機制(Heartbeat),網關運行期間會按固定間隔(預設 30 分鐘)自動調用已配置的模型,檢查是否有待處理任務。每次心跳都會消耗少量 Token。如何確認:查看 ~/.openclaw/agents/main/sessions/ 目錄下的會話記錄檔案(.jsonl),其中包含 [OpenClaw heartbeat poll] 標記的心跳調用記錄。解決方案:
  • 停止網關:不使用時執行 openclaw gateway stop,心跳隨即停止。
  • 增大心跳間隔:在 ~/.openclaw/openclaw.json 中設定 agents.defaults.heartbeat.every,例如 "2h" 表示每 2 小時一次。