在 OpenClaw 中使用阿里雲百鍊模型。
快速開始
- 1
- 2
獲取 API Key
Token Plan
依 Token Plan 版本取得 API Key:
- Token Plan 個人版:建立或查看 API Key
- Token Plan 團隊版:分配席位並取得 API Key
按量計費
從 百鍊 API Key 頁面 獲取百鍊 API Key。
Coding Plan
從 Coding Plan 頁面 獲取 Coding Plan API Key。
- 3
配置模型
按計費方案執行對應命令,並按提示輸入 API Key。
Token Plan
openclaw onboard --auth-choice qwen-token-plan-cn按量計費
openclaw onboard --auth-choice qwen-standard-api-key-cnCoding Plan
openclaw onboard --auth-choice qwen-api-key-cn - 4
驗證
執行以下命令確認模型列表和呼叫結果:
openclaw models list --provider qwen-token-plan openclaw agent --model qwen-token-plan/qwen3.8-max --message "只回复 ok"
透過設定檔接入
適用於無法安裝 Qwen 外掛或需要手動管理配置的場景。
- 1
開啟或新建設定檔
~/.openclaw/openclaw.json只更新
models、agents和gateway中對應欄位,不要全量替換已有配置。 - 2
寫入設定
Token Plan 個人版
將
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": "auto", "name": "auto", "reasoning": false, "input": [ "text" ], "contextWindow": 1000000, "maxTokens": 393216, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "qwen4-max-preview", "name": "qwen4-max-preview", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 131072, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "qwen4-max", "name": "qwen4-max", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 262144, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "qwen3.8-max", "name": "qwen3.8-max", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 131072, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "qwen3.8-flash", "name": "qwen3.8-flash", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 131072, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "qwen3.7-max", "name": "qwen3.7-max", "reasoning": true, "input": [ "text" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "qwen3.7-plus", "name": "qwen3.7-plus", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "qwen3.6-flash", "name": "qwen3.6-flash", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "deepseek-v4.1-flash", "name": "deepseek-v4.1-flash", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "deepseek-v4.1-flash-1017", "name": "deepseek-v4.1-flash-1017", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "deepseek-v4-pro", "name": "deepseek-v4-pro", "reasoning": true, "input": [ "text" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "deepseek-v4-pro-0813", "name": "deepseek-v4-pro-0813", "reasoning": true, "input": [ "text" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "deepseek-v4-flash-0731", "name": "deepseek-v4-flash-0731", "reasoning": true, "input": [ "text" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "glm-5.3", "name": "glm-5.3", "reasoning": true, "input": [ "text" ], "contextWindow": 202752, "maxTokens": 16384, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "glm-5.2", "name": "glm-5.2", "reasoning": true, "input": [ "text" ], "contextWindow": 202752, "maxTokens": 16384, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } } ] } } }, "agents": { "defaults": { "model": { "primary": "bailian-token-plan/auto" } } }, "gateway": { "mode": "local", "auth": { "mode": "none" } } }Token Plan 團隊版
將
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": "auto", "name": "auto", "reasoning": false, "input": [ "text" ], "contextWindow": 1000000, "maxTokens": 393216, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "qwen4-max-preview", "name": "qwen4-max-preview", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 131072, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "qwen4-max", "name": "qwen4-max", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 262144, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "qwen3.8-max", "name": "qwen3.8-max", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 131072, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "qwen3.8-flash", "name": "qwen3.8-flash", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 131072, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "qwen3.7-max", "name": "qwen3.7-max", "reasoning": true, "input": [ "text" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "qwen3.7-plus", "name": "qwen3.7-plus", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "qwen3.6-plus", "name": "qwen3.6-plus", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "qwen3.6-flash", "name": "qwen3.6-flash", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "deepseek-v4.1-flash", "name": "deepseek-v4.1-flash", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "deepseek-v4.1-flash-1017", "name": "deepseek-v4.1-flash-1017", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "deepseek-v4-pro", "name": "deepseek-v4-pro", "reasoning": true, "input": [ "text" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "deepseek-v4-pro-0813", "name": "deepseek-v4-pro-0813", "reasoning": true, "input": [ "text" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "deepseek-v4-flash-0731", "name": "deepseek-v4-flash-0731", "reasoning": true, "input": [ "text" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "kimi-k2.7-code", "name": "kimi-k2.7-code", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 262144, "maxTokens": 98304, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "kimi-k2.6", "name": "kimi-k2.6", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 262144, "maxTokens": 98304, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "kimi-k2.5", "name": "kimi-k2.5", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 262144, "maxTokens": 98304, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "glm-5.3", "name": "glm-5.3", "reasoning": true, "input": [ "text" ], "contextWindow": 202752, "maxTokens": 16384, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "glm-5.2", "name": "glm-5.2", "reasoning": true, "input": [ "text" ], "contextWindow": 202752, "maxTokens": 16384, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "glm-5.1", "name": "glm-5.1", "reasoning": true, "input": [ "text" ], "contextWindow": 202752, "maxTokens": 16384, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "glm-5", "name": "glm-5", "reasoning": true, "input": [ "text" ], "contextWindow": 202752, "maxTokens": 16384, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "MiniMax-M2.5", "name": "MiniMax-M2.5", "reasoning": true, "input": [ "text" ], "contextWindow": 196608, "maxTokens": 32768, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } } ] } } }, "agents": { "defaults": { "model": { "primary": "bailian-token-plan/auto" } } }, "gateway": { "mode": "local", "auth": { "mode": "none" } } }按量計費
將
YOUR_API_KEY替換為百鍊 API Key,並將{WorkspaceId}替換為 Workspace ID。{ "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.8-max", "name": "qwen3.8-max", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 131072, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "qwen3.7-plus", "name": "qwen3.7-plus", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "qwen3.8-flash", "name": "qwen3.8-flash", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 131072, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "deepseek-v4-pro-0813", "name": "deepseek-v4-pro-0813", "reasoning": true, "input": [ "text" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "deepseek-v4.1-flash", "name": "deepseek-v4.1-flash", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } } ] } } }, "agents": { "defaults": { "model": { "primary": "bailian/qwen3.8-max" } } }, "gateway": { "mode": "local", "auth": { "mode": "none" } } }Coding Plan
將
YOUR_API_KEY替換為 Coding Plan API Key。{ "models": { "mode": "merge", "providers": { "bailian-coding": { "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": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "qwen3.6-plus", "name": "qwen3.6-plus", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "kimi-k2.5", "name": "kimi-k2.5", "reasoning": true, "input": [ "text", "image" ], "contextWindow": 262144, "maxTokens": 98304, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "glm-5", "name": "glm-5", "reasoning": true, "input": [ "text" ], "contextWindow": 202752, "maxTokens": 16384, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "MiniMax-M2.5", "name": "MiniMax-M2.5", "reasoning": true, "input": [ "text" ], "contextWindow": 196608, "maxTokens": 32768, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "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 } } ] } } }, "agents": { "defaults": { "model": { "primary": "bailian-coding/qwen3.7-plus" } } }, "gateway": { "mode": "local", "auth": { "mode": "none" } } }說明使用 qwen4-max-preview 時,可用
params.cacheRetention設定short、long或none,long對應 1 小時 TTL。說明使用 qwen4-max 時,可用
params.cacheRetention設定short、long或none,long對應 1 小時 TTL。qwen4-max 的上下文長度為 1M Token;非思考模式最大輸出 131,072 Token,思考與最終回答合計最大 262,144 Token;預設 reasoning_effort=high,thinking_budget=131072。
說明gateway.auth.mode: none 僅適合單機本地使用。需要共享或遠端訪問時,執行 openclaw doctor --generate-gateway-token 生成 token,再重啟 Gateway。
接入訊息渠道
釘釘
說明使用輕量應用伺服器或無影雲電腦部署 OpenClaw 時,通常已內建釘釘外掛,並可透過圖形化介面完成配置。
- 1
- 2
安裝釘釘渠道外掛
openclaw plugins install @soimy/dingtalk openclaw plugins list輸出中應包含
dingtalk外掛且狀態為loaded。 - 3
配置釘釘渠道
在
~/.openclaw/openclaw.json中新增以下配置。將YOUR_DINGTALK_APPKEY和YOUR_DINGTALK_APPSECRET替換為步驟一獲取的憑證,不要覆蓋已有的models、agents等配置。{ "channels": { "dingtalk": { "enabled": true, "clientId": "YOUR_DINGTALK_APPKEY", "clientSecret": "YOUR_DINGTALK_APPSECRET", "robotCode": "YOUR_DINGTALK_APPKEY", "dmPolicy": "open", "groupPolicy": "open", "messageType": "markdown" } }, "plugins": { "allow": ["dingtalk"], "entries": { "dingtalk": { "enabled": true } } } }dmPolicy和groupPolicy設為open適用於測試或個人使用。生產環境建議改為allowlist,並新增allowFrom欄位:"dmPolicy": "allowlist", "groupPolicy": "allowlist", "allowFrom": ["你的工号", "群ID"] - 4
驗證
openclaw gateway restart openclaw status在 Channels 部分,DingTalk 應顯示為
ON,狀態為OK - configured。在釘釘群聊中向機器人傳送訊息測試。
飛書
- 1
建立飛書應用
- 訪問飛書開放平臺,點選建立企業自建應用,填寫應用名稱和描述,選擇應用圖示後點選建立。
- 在憑證與基礎資訊頁面複製 App ID(格式如
cli_xxx)和 App Secret。 - 在許可權管理頁面點選批次匯入/匯出許可權,貼上以下 JSON,點選下一步,確認新增許可權,再點選申請開通。
{ "scopes": { "tenant": [ "aily:file:read", "aily:file:write", "application:application.app_message_stats.overview:readonly", "application:application:self_manage", "application:bot.menu:write", "cardkit:card:write", "contact:user.employee_id:readonly", "corehr:file:download", "docs:document.content:read", "event:ip_list", "im:chat", "im:chat.access_event.bot_p2p_chat:read", "im:chat.members:bot_access", "im:message", "im:message.group_at_msg:readonly", "im:message.group_msg", "im:message.p2p_msg:readonly", "im:message:readonly", "im:message:send_as_bot", "im:resource", "sheets:spreadsheet", "wiki:wiki:readonly" ], "user": ["aily:file:read", "aily:file:write", "im:chat.access_event.bot_p2p_chat:read"] } }- 在新增應用能力頁面選擇按能力新增,找到機器人卡片並點選配置。
- 在事件與回撥的事件配置頁籤中,將訂閱方式設為使用長連線接收事件並儲存;再新增事件
im.message.receive_v1。 - 在版本管理與釋出頁面建立版本,填寫版本號和更新說明,儲存並提交稽核釋出。
- 2
配置飛書機器人
執行
openclaw channels add,按提示選擇 Feishu,輸入 App ID 和 App Secret,再重啟閘道器:openclaw gateway restart在飛書群聊中新增機器人,或向機器人傳送訊息。機器人會回覆一條包含配對碼的訊息,複製最後一行並在 OpenClaw 對話中傳送,完成配對。
- 3
驗證
openclaw status在 Channels 部分,Feishu 應顯示為
ON,狀態為OK。在飛書中傳送訊息測試。
微信
說明微信版本需要 8.0.70 或更高。
- 1
安裝微信渠道外掛
npx -y @tencent-weixin/openclaw-weixin-cli@latest install安裝完成後終端會顯示二維碼,使用微信掃碼完成身份繫結。繫結成功後微信會自動開啟 ClawBot 聊天頁面。
執行
openclaw plugins list,輸出中應包含openclaw-weixin外掛且狀態為loaded。 - 2
驗證
openclaw gateway restart在微信中找到 ClawBot,傳送訊息測試。
- 1
安裝 QQ 渠道外掛
openclaw plugins install @sliverp/qqbot openclaw plugins list輸出中應包含
qqbot外掛且狀態為loaded。 - 2
建立 QQ 機器人
- 訪問 QQ 開放平臺,註冊並登入開發者賬號。
- 在 OpenClaw 頁面 建立機器人,獲取 AppID 和 AppSecret。
說明AppSecret 不支援明文儲存,二次檢視會強制重置,請妥善儲存。
- 3
配置 QQ 渠道
在
~/.openclaw/openclaw.json中新增以下配置。將YOUR_APP_ID和YOUR_APP_SECRET替換為步驟二獲取的憑證,不要覆蓋已有的models、agents等配置。{ "channels": { "qqbot": { "enabled": true, "appId": "YOUR_APP_ID", "clientSecret": "YOUR_APP_SECRET", "dmPolicy": "open", "allowFrom": ["*"] } }, "plugins": { "allow": ["qqbot"], "entries": { "qqbot": { "enabled": true, "config": {} } } } }dmPolicy設為open表示允許私聊,allowFrom設為["*"]表示允許全部來源的訊息,適用於測試或個人使用。生產環境建議限制訪問範圍。 - 4
驗證
openclaw gateway restart在 QQ 中向機器人傳送訊息測試。
郵箱
透過郵箱渠道,可以使用 163 郵箱等支援 IMAP/SMTP 協議的郵箱與 OpenClaw 進行互動。
步驟一:安裝郵箱渠道外掛
- 1
在終端中執行以下命令安裝郵箱渠道外掛:
openclaw plugins install @openclaw/email - 2
安裝完成後,執行以下命令確認外掛已載入:
openclaw plugins list輸出中應包含
email外掛且狀態為loaded。
步驟二:配置郵箱渠道
在 ~/.openclaw/openclaw.json 中新增 channels 和 plugins.allow 配置。請將 channels 和 plugins 新增到已有設定檔的對應位置,不要覆蓋已有的 models、agents 等配置。
以 163 郵箱為例,將 YOUR_EMAIL 替換為 163 郵箱地址,將 YOUR_AUTH_CODE 替換為 163 郵箱的授權碼(非登入密碼,需在 163 郵箱設定中開啟 IMAP 服務後獲取)。
{
"channels": {
"email": {
"enabled": true,
"imap": {
"host": "imap.163.com",
"port": 993,
"secure": true,
"user": "YOUR_EMAIL",
"password": "YOUR_AUTH_CODE"
},
"smtp": {
"host": "smtp.163.com",
"port": 465,
"secure": true,
"user": "YOUR_EMAIL",
"password": "YOUR_AUTH_CODE"
}
}
},
"plugins": {
"allow": ["email"],
"entries": {
"email": {
"enabled": true
}
}
}
}
步驟三:測試
- 1
執行以下命令重啟閘道器。
openclaw gateway restart - 2
執行以下命令檢查郵箱渠道狀態。
openclaw status在 Channels 部分,Email 應顯示為
ON且狀態為OK。 - 3
向配置的郵箱地址傳送一封郵件,驗證機器人是否自動回覆。
錯誤碼
配置過程中遇到報錯,參考對應計費方案的常見問題文件:
- Token Plan:個人版常見問題 · 團隊版常見問題
- 按量計費:錯誤代碼
- Coding Plan:Coding Plan 常見問題
常見問題
如何按量計費接入節省計劃?
按量計費接入方式不變,使用百煉通用 API Key 和 Base URL。購買節省計劃後自動生效,呼叫費用按抵扣順序自動抵扣。詳情參見節省計劃。
如何檢視已配置的模型?
在終端輸入 openclaw tui,進入 OpenClaw 終端命令列,接著輸入 /model 檢視模型列表。按回車鍵選中模型,按 Esc 鍵退出模型列表。
為什麼報錯“HTTP 401: Incorrect API key provided.”、“No API key found for provider xxx”或“HTTP 401: invalid_iam_token”?
可能原因:
- API Key 無效、過期、為空、格式錯誤,或與端點環境不匹配。請檢查 API Key 是否與所使用的付費方式匹配,並確保複製完整且無空格;確認訂閱狀態有效。
- OpenClaw 的歷史配置快取導致配置錯誤,請刪除
~/.openclaw/agents/main/agent/models.json檔案中的providers配置項,並重啟 OpenClaw。 invalid_iam_token表示 API Key 經 IAM 鑑權校驗失敗。常見場景:API Key 已被吊銷或禁用、API Key 歸屬的地域與 Base URL 所指地域不一致(例如 API Key 在新加坡,但 Base URL 指向其他地域)、使用 STS 臨時憑證且已過期。請核對 API Key 與 Base URL 歸屬同一地域,並確認 API Key 狀態正常。
我已經配置過釘釘等其他渠道,如何安全地新增新套餐模型?
- 不要直接全量覆蓋。全量替換會覆蓋自定義配置,請進行區域性修改。
- 若 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 小時一次。