OpenClaw漢化版從零部署指南:手把手帶你完成安裝與進(jìn)階配置
前言
隨著AI應(yīng)用生態(tài)的持續(xù)演進(jìn),OpenClaw 作為一款功能強(qiáng)大的開源工具,正受到越來越多開發(fā)者的關(guān)注。然而,對于很多剛接觸的小伙伴來說,如何順利完成OpenClaw 漢化版的安裝與配置,往往成為上手的第一道門檻。
本文將為你提供一份從零開始的詳細(xì)安裝指南,涵蓋前提條件、安裝流程、初始化配置、運(yùn)行驗(yàn)證,再到進(jìn)階配置、模型調(diào)優(yōu)、守護(hù)進(jìn)程管理等完整鏈路。無論你是初學(xué)者還是希望深度定制的進(jìn)階用戶,都能在本篇文章中找到清晰可落地的操作步驟。
前提條件
1. 安裝 Node.js
OpenClaw 要求 Node.js >= 22.12.0。
檢查是否已安裝:
node -v # 應(yīng)輸出 v22.x.x 或更高
如果沒有安裝或版本過低:
| 系統(tǒng) | 推薦安裝方式 |
|---|---|
| Windows | 訪問 nodejs.org 下載 LTS 版本安裝包 |
| macOS | brew install node@22 或訪問 nodejs.org |
| Ubuntu / Debian | 見下方命令 |
| CentOS / RHEL | 見下方命令 |
Ubuntu / Debian 安裝 Node.js 22:
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - sudo apt-get install -y nodejs
CentOS / RHEL 安裝 Node.js 22:
curl -fsSL https://rpm.nodesource.com/setup_22.x | sudo bash - sudo yum install -y nodejs
使用 nvm 安裝(適用于所有系統(tǒng)):
# 安裝 nvm(如果還沒有) curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash # 國內(nèi)用戶如果下載慢,使用鏡像: export NVM_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node nvm install 22 nvm use 22
國內(nèi)用戶 Node.js 安裝加速:
# 方法1:使用淘寶 Node.js 鏡像(推薦) # Ubuntu / Debian curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - sudo apt-get install -y nodejs # 方法2:直接下載二進(jìn)制包 # 訪問 https://npmmirror.com/mirrors/node/ 下載對應(yīng)系統(tǒng)的安裝包
2. 驗(yàn)證環(huán)境
node -v # 應(yīng)顯示 v22.x.x npm -v # 應(yīng)顯示 10.x.x
第一階段:安裝
安裝漢化版
npm install -g @qingchencloud/openclaw-zh@latest
如果下載慢,加上淘寶鏡像源:
npm install -g @qingchencloud/openclaw-zh@latest --registry=https://registry.npmmirror.com
驗(yàn)證安裝
openclaw --version # 應(yīng)輸出類似:2026.2.4-zh.1 openclaw --help # 應(yīng)顯示中文幫助信息
如果提示 openclaw: command not found,需要將 npm 全局路徑加入 PATH:
# 查看 npm 全局路徑 npm prefix -g # 將輸出的路徑/bin 加入你的 shell 配置文件(~/.bashrc 或 ~/.zshrc) export PATH="$(npm prefix -g)/bin:$PATH"
第二階段:初始化配置
方式 A:交互式向?qū)Вㄍ扑]新手)
openclaw onboard
向?qū)龑?dǎo)你完成以下配置:
步驟1 ─→ 安全風(fēng)險確認(rèn)(輸入 y 確認(rèn))
步驟2 ─→ 選擇 AI 模型提供商
├─ Anthropic Claude(推薦)
├─ OpenAI GPT
├─ 本地模型(Ollama 等)
└─ 其他(Moonshot、智譜等)
步驟3 ─→ 輸入 API Key
步驟4 ─→ 選擇默認(rèn)模型
步驟5 ─→ 配置網(wǎng)關(guān)(端口、認(rèn)證方式)
步驟6 ─→ 配置聊天通道(可跳過)
├─ Telegram
├─ Discord
└─ ...
步驟7 ─→ 安裝技能(可跳過)
步驟8 ─→ 完成!
向?qū)е写蟛糠诌x項(xiàng)直接按回車用默認(rèn)值即可。
方式 B:快速非交互式初始化
如果你已經(jīng)有 API Key,想跳過向?qū)е苯优渲茫?/p>
# 第1步:創(chuàng)建基礎(chǔ)配置 openclaw setup # 第2步:設(shè)置網(wǎng)關(guān)模式 openclaw config set gateway.mode local # 第3步:設(shè)置 AI 模型和 API Key(以 Claude 為例) openclaw config set agents.defaults.model anthropic/claude-sonnet-4-20250514 openclaw config set auth.anthropic.apiKey sk-ant-你的API密鑰 # 第4步:設(shè)置網(wǎng)關(guān)認(rèn)證(推薦) openclaw config set gateway.auth.token 你設(shè)定的密碼
詳細(xì)的模型配置請參考下方 模型配置指南。
快速示例(Claude):
openclaw config set agents.defaults.model anthropic/claude-sonnet-4-20250514 openclaw config set auth.anthropic.apiKey sk-ant-你的API密鑰
第三階段:驗(yàn)證運(yùn)行
啟動網(wǎng)關(guān)
# 方式1:前臺運(yùn)行(可以看到實(shí)時日志,按 Ctrl+C 停止) openclaw # 方式2:安裝為守護(hù)進(jìn)程(后臺運(yùn)行,開機(jī)自啟) openclaw onboard --install-daemon
打開控制臺
openclaw dashboard
這會自動在瀏覽器中打開帶 Token 的 Dashboard 頁面。
如果瀏覽器沒有自動打開,手動訪問:http://localhost:18789
檢查運(yùn)行狀態(tài)
# 查看網(wǎng)關(guān)狀態(tài) openclaw status # 運(yùn)行診斷(檢查配置是否正確) openclaw doctor
第四階段:進(jìn)階配置(可選)
開啟內(nèi)網(wǎng)訪問
默認(rèn)情況下只能在本機(jī)通過 localhost 訪問。如果想讓內(nèi)網(wǎng)其他設(shè)備也能訪問:
# 綁定到局域網(wǎng) openclaw config set gateway.bind lan # 設(shè)置訪問密碼(必須) openclaw config set gateway.auth.token 你的密碼 # 重啟生效 openclaw gateway restart
然后在其他設(shè)備上 訪問 http://你的IP:18789,在「網(wǎng)關(guān)令牌」輸入框填入密碼。
配置聊天通道
# 添加 Telegram openclaw channels add telegram # 按提示輸入 Bot Token # 添加 WhatsApp openclaw channels add whatsapp # 掃描二維碼連接 # 查看已配置的通道 openclaw channels list
安裝技能
# 查看可用技能 openclaw skills list # 安裝技能 openclaw skills install
模型配置指南
OpenClaw 支持幾乎所有主流 AI 模型,包括國際服務(wù)、國產(chǎn)模型和本地模型。只要是兼容 OpenAI 接口的服務(wù)都可以接入。
模型名格式
模型名使用 提供商/模型ID 格式,例如:openai/gpt-4o、anthropic/claude-sonnet-4-20250514
國際主流模型
Anthropic Claude(推薦)
openclaw config set agents.defaults.model anthropic/claude-sonnet-4-20250514 openclaw config set auth.anthropic.apiKey sk-ant-你的API密鑰
獲取 API Key:console.anthropic.com
OpenAI GPT
openclaw config set agents.defaults.model openai/gpt-4o openclaw config set auth.openai.apiKey sk-你的API密鑰
獲取 API Key:platform.openai.com
Google Gemini
openclaw config set agents.defaults.model google/gemini-3-pro-preview openclaw config set auth.google.apiKey 你的API密鑰
獲取 API Key:aistudio.google.com
環(huán)境變量方式:export GEMINI_API_KEY=你的API密鑰
OpenRouter(聚合多模型)
一個 Key 可以調(diào)用幾百種模型,非常方便:
openclaw config set agents.defaults.model openrouter/auto openclaw config set auth.openrouter.apiKey sk-or-你的API密鑰
獲取 API Key:openrouter.ai
openrouter/auto 會自動選擇最佳模型。也可以指定具體模型,如 openrouter/anthropic/claude-3.5-sonnet
國產(chǎn)模型
月之暗面 Moonshot(Kimi)
# 國際版 openclaw config set agents.defaults.model moonshot/kimi-k2.5 openclaw config set auth.moonshot.apiKey 你的API密鑰 # 中國大陸版(自動使用 .cn 域名,更快) # 在 onboard 向?qū)е羞x擇 "Moonshot (.cn)" 即可
獲取 API Key:platform.moonshot.cn
環(huán)境變量方式:export MOONSHOT_API_KEY=你的API密鑰
智譜 Z.AI(GLM)
openclaw config set agents.defaults.model zai/glm-4.7 openclaw config set auth.zai.apiKey 你的API密鑰
獲取 API Key:open.bigmodel.cn
環(huán)境變量方式:export ZAI_API_KEY=你的API密鑰
MiniMax
openclaw config set agents.defaults.model minimax/MiniMax-M2.1 openclaw config set auth.minimax.apiKey 你的API密鑰
獲取 API Key:platform.minimaxi.com
環(huán)境變量方式:export MINIMAX_API_KEY=你的API密鑰
小米 MiMo
openclaw config set agents.defaults.model xiaomi/mimo-v2-flash openclaw config set auth.xiaomi.apiKey 你的API密鑰
獲取 API Key:platform.xiaomi.cn
環(huán)境變量方式:export XIAOMI_API_KEY=你的API密鑰
勝算云(API 聚合平臺)
勝算云是國內(nèi)知名的 AI API 聚合平臺,整合了 Kimi、DeepSeek、Qwen、Llama 等熱門模型,一個 Key 就能調(diào)用幾百種模型。
# 在 onboard 向?qū)е羞x擇 "勝算云 (國產(chǎn)模型)" 即可自動配置 # 或手動配置: openclaw config set agents.defaults.model shengsuanyun/openai/gpt-4.1-nano openclaw config set auth.shengsuanyun.apiKey 你的勝算云API密鑰
獲取 API Key:勝算云官網(wǎng)
Venice AI
openclaw config set agents.defaults.model venice/llama-3.3-70b openclaw config set auth.venice.apiKey 你的API密鑰
本地模型
Ollama(推薦)
先安裝 Ollama 并下載模型:ollama.com
# 確保 Ollama 正在運(yùn)行 ollama serve # 下載模型(以 llama3.2 為例) ollama pull llama3.2
在 OpenClaw 中配置:
openclaw config set agents.defaults.model ollama/llama3.2 openclaw config set auth.openai.apiKey ollama openclaw config set auth.openai.baseURL http://localhost:11434/v1
Docker 用戶注意:容器中 localhost 指容器自身。如果 Ollama 在宿主機(jī)運(yùn)行,使用:
docker exec openclaw openclaw config set auth.openai.baseURL http://host.docker.internal:11434/v1
LM Studio
# LM Studio 默認(rèn)監(jiān)聽 http://localhost:1234 openclaw config set agents.defaults.model openai/你加載的模型名 openclaw config set auth.openai.apiKey lm-studio openclaw config set auth.openai.baseURL http://localhost:1234/v1
自定義 OpenAI 兼容接口
適用于:OneAPI、New API、各種中轉(zhuǎn)站、企業(yè)私有部署、自建代理等。只要接口兼容 OpenAI 格式就能用。
方式 A:通過 config 命令(簡單)
# 設(shè)置自定義 API 地址 openclaw config set auth.openai.baseURL https://你的接口地址/v1 # 設(shè)置 API Key openclaw config set auth.openai.apiKey sk-你的密鑰 # 設(shè)置模型名(按你的接口實(shí)際支持的模型填寫) openclaw config set agents.defaults.model openai/gpt-4o
常見中轉(zhuǎn)站示例:
# OneAPI / New API openclaw config set auth.openai.baseURL https://your-oneapi.example.com/v1 openclaw config set auth.openai.apiKey sk-你的密鑰 openclaw config set agents.defaults.model openai/gpt-4o # 某中轉(zhuǎn)站 openclaw config set auth.openai.baseURL https://api.example.com/v1 openclaw config set auth.openai.apiKey sk-你的密鑰 openclaw config set agents.defaults.model openai/claude-3-5-sonnet
baseURL 末尾通常需要 /v1,但取決于你的接口。如果不確定,兩種都試試。
方式 B:通過配置文件(高級,支持自定義模型列表)
編輯 ~/.openclaw/openclaw.json,添加自定義提供商:
{
"models": {
"providers": {
"my-provider": {
"baseUrl": "https://你的接口地址/v1",
"api": "openai-completions",
"apiKey": "sk-你的密鑰",
"models": [
{
"id": "gpt-4o",
"name": "GPT-4o",
"reasoning": false,
"input": ["text", "image"],
"contextWindow": 128000,
"maxTokens": 16384
},
{
"id": "claude-3-5-sonnet",
"name": "Claude 3.5 Sonnet",
"reasoning": true,
"input": ["text", "image"],
"contextWindow": 200000,
"maxTokens": 8192
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "my-provider/gpt-4o"
}
}
}
}api 字段選擇:
| 值 | 說明 | 適用于 |
|---|---|---|
openai-completions | OpenAI Chat Completions 格式 | 大多數(shù)兼容接口、Ollama、OneAPI |
anthropic-messages | Anthropic Messages 格式 | Anthropic 代理、Cloudflare AI Gateway |
方式 C:通過環(huán)境變量
# 設(shè)置 API Key export OPENAI_API_KEY=sk-你的密鑰 # 啟動 OpenClaw(會自動檢測環(huán)境變量) openclaw
支持的環(huán)境變量:
| 環(huán)境變量 | 對應(yīng)提供商 |
|---|---|
ANTHROPIC_API_KEY | Anthropic Claude |
OPENAI_API_KEY | OpenAI |
OPENROUTER_API_KEY | OpenRouter |
GEMINI_API_KEY | Google Gemini |
MOONSHOT_API_KEY | Moonshot Kimi |
ZAI_API_KEY | 智譜 GLM |
MINIMAX_API_KEY | MiniMax |
XIAOMI_API_KEY | 小米 MiMo |
SHENGSUANYUN_API_KEY | 勝算云(聚合平臺) |
Cloudflare AI Gateway
通過 Cloudflare 網(wǎng)關(guān)代理調(diào)用 AI 模型,可以實(shí)現(xiàn)緩存、限速、監(jiān)控等功能:
# 在 onboard 向?qū)е羞x擇 "Cloudflare AI Gateway" # 或手動配置: openclaw config set agents.defaults.model cloudflare-ai-gateway/claude-sonnet-4-5
需要提供:Cloudflare Account ID + Gateway ID + API Key
配置后備模型
設(shè)置多個模型作為后備,主模型不可用時自動切換:
通過配置文件設(shè)置(編輯 ~/.openclaw/openclaw.json)
{
"agents": {
"defaults": {
"model": {
"primary": "anthropic/claude-sonnet-4-20250514",
"fallbacks": ["openai/gpt-4o", "openrouter/auto"]
}
}
}
}模型配置排查
如果模型調(diào)用沒有響應(yīng):
# 1. 檢查當(dāng)前配置的模型 openclaw config get agents.defaults.model # 2. 檢查 API Key 是否配置 openclaw config get auth # 3. 運(yùn)行診斷 openclaw doctor # 4. 查看實(shí)時日志(前臺啟動) openclaw
配置文件說明
所有配置存儲在 ~/.openclaw/ 目錄下:
~/.openclaw/
├── openclaw.json # 主配置文件
├── workspace/ # 工作區(qū)(AI 的文件空間)
├── sessions/ # 會話歷史記錄
├── credentials/ # OAuth 憑證
└── logs/ # 日志文件
Windows 路徑:%USERPROFILE%\.openclaw\
查看和修改配置
# 查看所有配置 openclaw config get # 查看某個配置項(xiàng) openclaw config get gateway.mode openclaw config get agents.defaults.model # 修改配置 openclaw config set gateway.mode local openclaw config set gateway.port 18789
守護(hù)進(jìn)程管理
安裝守護(hù)進(jìn)程后,OpenClaw 會在后臺自動運(yùn)行,開機(jī)自啟。
安裝守護(hù)進(jìn)程
openclaw onboard --install-daemon
查看狀態(tài)
openclaw gateway status
管理命令
| 操作 | macOS | Linux |
|---|---|---|
| 查看狀態(tài) | launchctl list | grep openclaw | systemctl --user status openclaw-gateway |
| 停止 | launchctl bootout gui/$UID/ai.openclaw.gateway | systemctl --user stop openclaw-gateway |
| 啟動 | launchctl bootstrap gui/$UID ~/Library/LaunchAgents/ai.openclaw.gateway.plist | systemctl --user start openclaw-gateway |
| 重啟 | 先停止再啟動 | systemctl --user restart openclaw-gateway |
| 查看日志 | cat /tmp/openclaw/*.log | journalctl --user -u openclaw-gateway |
Linux 保持后臺運(yùn)行(SSH 退出后不停止):
sudo loginctl enable-linger $USER
常用命令速查
| 命令 | 說明 |
|---|---|
openclaw | 啟動 OpenClaw(前臺模式) |
openclaw onboard | 運(yùn)行初始化向?qū)?/td> |
openclaw onboard --install-daemon | 初始化 + 安裝守護(hù)進(jìn)程 |
openclaw dashboard | 打開網(wǎng)頁控制臺 |
openclaw status | 查看運(yùn)行狀態(tài) |
openclaw doctor | 診斷檢查 |
openclaw config get | 查看配置 |
openclaw config set KEY VALUE | 修改配置 |
openclaw gateway start | 啟動網(wǎng)關(guān) |
openclaw gateway stop | 停止網(wǎng)關(guān) |
openclaw gateway restart | 重啟網(wǎng)關(guān) |
openclaw channels list | 查看通道列表 |
openclaw skills list | 查看技能列表 |
openclaw --help | 查看幫助 |
openclaw --version | 查看版本 |
總結(jié)
通過本文的逐步操作,相信你已經(jīng)順利完成了 OpenClaw 漢化版 從安裝到基礎(chǔ)運(yùn)行,并對其配置文件、模型接入、守護(hù)進(jìn)程管理有了更系統(tǒng)的了解。對于希望在生產(chǎn)環(huán)境或長期任務(wù)中穩(wěn)定使用的開發(fā)者,建議重點(diǎn)關(guān)注 第四階段進(jìn)階配置 與 守護(hù)進(jìn)程管理 部分,以確保服務(wù)的高可用性與資源可控性。
到此這篇關(guān)于一步步安裝和配置OpenClaw漢化版詳細(xì)安裝指南的文章就介紹到這了,更多相關(guān)OpenClaw漢化版教學(xué)內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!
相關(guān)文章

OpenClaw(Clawd/Moltbot)漢化版搭建指南
最近 GitHub 上有個項(xiàng)目火得離譜,OpenClaw,一周時間從 7800 Stars 飆升到 12 萬+,成為 GitHub 歷史上增長最快的項(xiàng)目之一,但全英文界面對中文用戶不友好,因此這篇文章從2026-03-13
OpenClaw第三方開源漢化中文發(fā)行版部署全指南以及常見問題解決方法
本文為大家?guī)砹薕penClaw(Clawdbot/Moltbot)第三方開源漢化中文發(fā)行版部署全指南:一鍵腳本/Docker/npm 三模式安裝+Ubuntu 環(huán)境配置+中文漢化界面適配開源版,需要的朋2026-03-03



