一、安装Node.js(必须≥22.x)
OpenClaw要求Node.js版本≥22.x,Ubuntu默认源版本较低,需手动安装:
方法
# 验证版本
node -v # 应显示v22.x.x[11](@ref)
二、安装OpenClaw的方式
方式一:npm/pnpm全局安装
# npm安装
npm install -g openclaw@latest
# 或使用pnpm(性能更优)
npm install -g pnpm
pnpm add -g openclaw@latest[5,9,10](@ref)
方式二:Docker部署(适合服务器/生产环境)
# 安装Docker
curl -fsSL https://get.docker.com | bash
sudo systemctl start docker
sudo systemctl enable docker
# 一键Docker部署
curl -fsSL https://cdn.jsdelivr.net/gh/1186258278/OpenClawChineseTranslation@main/docker-deploy.sh | bash[5](@ref)
三、初始化配置
安装完成后,运行初始化向导完成基础配置:
openclaw onboard --install-daemon[9,11](@ref)
配置向导会引导完成以下步骤:
- 安全确认:输入Y确认授权
- 选择模式:推荐QuickStart(快速启动)
- 配置AI模型:选择模型提供商并输入API Key
- 设置渠道:可先跳过(后续再配置)
- 技能配置:选择Yes启用基础技能
四、配置文件刷新
刷新配置文件,关键是主model别忘记刷新:
"model": {
"primary": "codez/gpt-5.3-codex"
},
具体配置如下:
[root@OS .openclaw]# more openclaw.json
{
"meta": {
"lastTouchedVersion": "2026.2.9",
"lastTouchedAt": "2026-02-19T00:37:21.820Z"
},
"wizard": {
"lastRunAt": "2026-02-19T00:34:13.156Z",
"lastRunVersion": "2026.2.9",
"lastRunCommand": "onboard",
"lastRunMode": "local"
},
"models": {
"mode": "merge",
"providers": {
"codez": {
"baseUrl": "你的URL",
"apiKey": "你的key",
"api": "openai-completions",
"models": [
{
"id": "gpt-5.3-codex",
"name": "gpt-5.3-codex",
"reasoning": false,
"input": [
"text"
],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 200000,
"maxTokens": 8192,
"compat": {
"supportsStore": false
}
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "codez/gpt-5.3-codex"
},
"workspace": "/root/.openclaw/workspace",
"compaction": {
"mode": "safeguard"
},
"maxConcurrent": 4,
"subagents": {
"maxConcurrent": 8
}
}
},
"messages": {
"ackReactionScope": "group-mentions"
},
"commands": {
"native": "auto",
"nativeSkills": "auto"
},
"channels": {
"feishu": {
"enabled": true,
"appId": "cli_a9xxxxxxxx",
"appSecret": "5fZvLoxxxxxxxxx",
"domain": "feishu",
"groupPolicy": "open"
},
"timbot": {
"enabled": true,
"webhookPath": "/timbot",
"sdkAppId": "1600xxxxx",
"botAccount": "@RBxxxxx",
"token": "xiaxxxxxxx",
"secretKey": "2b489exxxxxxxxxxxxxxxxxxxxxxxx",
"dm": {
"policy": "open"
}
}
},
"gateway": {
"port": 18789,
"mode": "local",
"bind": "lan",
"controlUi": {
"allowInsecureAuth": false
},
"auth": {
"mode": "token",
"token": "61c689d8bda509xxxxxxxxxxxx5"
},
"tailscale": {
"mode": "off",
"resetOnExit": false
}
},
"skills": {
"install": {
"nodeManager": "npm"
}
},
"plugins": {
"entries": {
"feishu": {
"enabled": true
},
"qqbot": {
"enabled": true
},
"ddingtalk": {
"enabled": true
},
"wecom": {
"enabled": true
},
"adp-openclaw": {
"enabled": true
},
"timbot": {
"enabled": true
}
},
"installs": {
"qqbot": {
"source": "npm",
"spec": "@sliverp/qqbot@latest",
"installPath": "/root/.openclaw/extensions/qqbot",
"version": "1.4.4",
"installedAt": "2026-02-11T09:48:41.090Z"
},
"ddingtalk": {
"source": "npm",
"spec": "git+https://cnb.cool/lighthouse/lighthousebackend/openclaw-dingtalk.git",
"installPath": "/root/.openclaw/extensions/ddingtalk",
"version": "1.2.0",
"installedAt": "2026-02-11T09:49:01.618Z"
},
"wecom": {
"source": "npm",
"spec": "git+https://cnb.cool/lighthouse/lighthousebackend/openclaw-wecom.git",
"installPath": "/root/.openclaw/extensions/wecom",
"version": "2026.2.5",
"installedAt": "2026-02-11T09:49:25.555Z"
},
"adp-openclaw": {
"source": "npm",
"spec": "adp-openclaw",
"installPath": "/root/.openclaw/extensions/adp-openclaw",
"version": "0.0.24",
"installedAt": "2026-02-11T09:49:33.241Z"
},
"timbot": {
"source": "npm",
"spec": "timbot",
"installPath": "/root/.openclaw/extensions/timbot",
"version": "2026.2.11",
"installedAt": "2026-02-19T00:13:48.063Z"
}
}
}
}
五、验证安装与启动
验证安装
# 查看版本
openclaw --version
# 环境自检
openclaw doctor[9](@ref)
启动服务
# 后台启动网关(推荐)
openclaw gateway start
# 前台运行(调试用)
openclaw gateway run --verbose[9,11](@ref)
访问控制台
启动后可通过浏览器访问管理控制台:
- 本地访问:http://localhost:18789
- 远程访问:需配置网关绑定到局域网
26.3.4刷新后续使用openai-responses参数 问题:调用大模型无返回tool等相关参数,导致无法调用工具 相关测试: • 结论:两种都可以调工具(model.api=openai-responses 和 model.api=openai-completions 都成功触发了 toolCall/toolResult)。
我做的实测(同一提示词:必须先调用 shell 执行 echo AB_TEST_TOOL):
- model.api=openai-responses 证据在会话文件: 52598a82...jsonl:4(modelApi=openai-responses) 52598a82...jsonl:6(assistant 发出 toolCall) 52598a82...jsonl:7(toolResult 返回)
- model.api=openai-completions 证据在会话文件: ec9b5f86...jsonl:4(modelApi=openai-completions) ec9b5f86...jsonl:6(assistant 发出 toolCall) ec9b5f86...jsonl:7(toolResult 返回)
补充发现:你现在这版网关的 /v1/chat/completions 兼容路由不会按 OpenAI 方式输出 tool_calls(代码里直接拼文本返回)。相关代码: gateway-cli-BSPSAjqx.js:17051 gateway-cli-BSPSAjqx.js:17063
我已把临时开启的 HTTP 测试端点配置改回原状(enabled=false),模型配置也恢复到你原先的 model.api=openai-completions。
• 证据已经够了,我会按“请求入参被忽略 -> agent 调用参数缺失 -> 响应格式被扁平化 -> 客户端无法进入工具执行回合”这条链路给你完整说明,并附具体代码位 置。
• 本质是“兼容层实现不完整”,不是模型本身不会调工具。
- 请求侧就把 OpenAI 工具协议丢了
- /v1/chat/completions 只读了 messages/model/user/stream,没有处理 tools、tool_choice、parallel_tool_calls 等字段。 代码入口:gateway-cli-BSPSAjqx.js:17011
- 构造 agentCommand 入参时也没传 clientTools/toolChoice,只传了文本消息。 代码:gateway-cli-BSPSAjqx.js:16913
- 响应侧把结果“压扁”为纯文本
- resolveAgentResponseText 会把 payloads 直接拼成字符串。 代码:gateway-cli-BSPSAjqx.js:17006
- 非流式响应固定返回 choices[0].message.content,finish_reason 固定 "stop",没有 tool_calls。 代码:gateway-cli-BSPSAjqx.js:17051
- 流式同样不发 tool call 事件
- SSE 只写 delta.role 和 delta.content,最后 [DONE]。 代码:gateway-cli-BSPSAjqx.js:17084、gateway-cli-BSPSAjqx.js:16772
- 对照证据:/v1/responses 是有工具链路的
- 它会解析 tools/tool_choice 并传 clientTools。 代码:gateway-cli-BSPSAjqx.js:17668
- 当 stopReason 是 tool_calls 时会返回 function_call 项。 代码:gateway-cli-BSPSAjqx.js:17730
所以你看到“已收到、我会创建任务”但没有真正进入工具执行回合,核心就是这条 /v1/chat/completions 兼容路由没有按 OpenAI function/tool calling 协议输出 和驱动回合,只做了文本代理。 如果你要,我可以下一步直接给你补一个最小修复补丁(让它真正返回 tool_calls + finish_reason: tool_calls)。
针对openai的openai-responses和openai-completion对比: