OpenClaw 是一个开源的 AI 网关服务,支持多模型接入、统一 API 调用和丰富的技能扩展。本文记录安装配置过程和常用指令。
安装
官方安装
1
2
3
4
5
| curl -fsSL https://openclaw.ai/install.sh | bash
# 跳过新手引导
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard
npm install -g openclaw@latest
|
低资源服务器安装
在 2GB 内存的阿里云服务器上,官方安装脚本可能因内存不足失败。使用阿里云优化的安装脚本:
1
| curl -fsSL https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260225/azxgob/openclaw_installer.sh -o openclaw_installer.sh && bash openclaw_installer.sh
|
配置
配置文件
默认路径:/root/.openclaw/openclaw.json
常用配置项
1
2
3
4
5
| // 关闭私聊心跳(保留心跳功能)
"agents.defaults.heartbeat.directPolicy": "block"
// 完全关闭心跳
"agents.defaults.heartbeat.every": "0m"
|
阿里云 Coding 接入
阿里云 Coding Plan 接入 OpenClaw
Brave Search API 配置
官网教程 | 配置 Brave Search
Dashboard 转发
通过 SSH 端口转发访问远程服务器的 Dashboard:
1
2
3
4
5
6
7
8
| # 前台转发
ssh -N -L 18789:127.0.0.1:18789 Aliyun
# 后台转发
ssh -fN -L 18789:127.0.0.1:18789 Aliyun
# 关闭转发
pkill -f "ssh -fN -L 18789"
|
常用指令
核心操作
| 指令 | 作用 | 示例 |
|---|
openclaw -v / openclaw version | 查看 OpenClaw 版本(验证安装) | openclaw -v |
openclaw help | 查看所有指令的帮助文档 | openclaw help config(查看 config 子命令帮助) |
openclaw start | 启动 OpenClaw 网关服务(默认前台运行) | openclaw start |
openclaw start -d | 后台启动网关(守护进程模式) | openclaw start -d |
openclaw stop | 停止后台运行的 OpenClaw 服务 | openclaw stop |
openclaw restart | 重启网关服务(配置修改后常用) | openclaw restart |
配置管理
| 指令 | 作用 | 示例 |
|---|
openclaw config list | 列出所有当前配置项(含默认值) | openclaw config list |
openclaw config get <key> | 查询单个配置项的值 | openclaw config get memory.backend |
openclaw config set <key> <value> | 设置配置项(核心) | openclaw config set model.catalog.mode merge
openclaw config set api.port 8080 |
openclaw config unset <key> | 重置配置项为默认值 | openclaw config unset model.catalog.mode |
openclaw config edit | 直接编辑配置文件(适合批量修改) | openclaw config edit(会打开系统默认编辑器) |
模型与服务商管理
| 指令 | 作用 | 示例 |
|---|
openclaw provider list | 列出已配置的 AI 服务商(OpenAI/智谱/Anthropic 等) | openclaw provider list |
openclaw provider add <name> | 添加自定义服务商(如智谱 Coding API) | openclaw provider add zhipu-coding (按提示输入 API 地址/Key/模型名) |
openclaw provider remove <name> | 删除指定服务商 | openclaw provider remove zhipu-coding |
openclaw model list | 列出所有可用模型(含内置+自定义) | openclaw model list |
进阶操作
| 指令 | 作用 | 适用场景 |
|---|
openclaw logs | 查看网关运行日志(调试排错) | 服务启动失败、API 调用报错时 |
openclaw health | 检查网关健康状态(端口/依赖/配置) | 验证服务是否正常运行 |
openclaw update | 升级 OpenClaw 到最新版本 | 体验新功能/修复 bug |
openclaw clean | 清理缓存(日志/模型索引/临时文件) | 磁盘占用过高、索引异常时 |
| | |
| | |
服务控制
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| # 停止服务
openclaw gateway stop
# 启动服务
openclaw gateway start
# 重启服务
openclaw gateway restart
# 查看模型列表
openclaw models list
# systemd 服务重启
systemctl --user daemon-reload
systemctl --user restart openclaw-gateway.service
|
技能安装
官方技能仓库:Clawhub
安装 Clawhub
1
2
3
4
5
6
| # 安装 clawhub
npm i -g clawhub
pnpm add -g clawhub
# 或使用最新版本
npx clawhub@latest install <skill-slug>
|
Clawhub 用法
1
2
3
4
5
6
7
8
| # 安装技能
clawhub install <skill-slug>
# 更新所有已安装技能
clawhub update --all
# 同步(扫描 + 发布更新)
clawhub sync --all
|
GitHub Token 配置
部分技能需要 GitHub Token:
1
2
3
4
5
6
7
8
| # 生成新令牌(GitHub 网站操作)
# 1. 访问 https://github.com/settings/tokens
# 2. 选择 fine-grained tokens 或 classic tokens
# 3. 设置权限范围:至少包含 repo, read:packages
# 在 OpenClaw 配置中启用令牌
echo 'export GITHUB_TOKEN="ghp_your_token_here"' >> ~/.bashrc
source ~/.bashrc
|
OpenClaw 技能管理
openclaw skills 不支持 install 子命令,仅提供以下功能:
1
2
3
4
5
6
7
8
| # 列出所有可用的 skills
openclaw skills list
# 查看某个 skill 的详细信息
openclaw skills info <name>
# 检查哪些 skills 就绪、哪些缺少依赖
openclaw skills check
|
推荐技能
核心必装(所有设备通用)
- @openclaw/standard-skills - 标准基础能力(指令解析、调度)
- @openclaw/system-skills - 执行命令、通知、进程管理
- @openclaw/file-skills - 文件读写、复制、删除、搜索
- @openclaw/network-skills - 网络检测、端口扫描、请求
Android / 手机专用
- @openclaw/canvas-skills - 截图、屏幕控制、图像识别
- @openclaw/camera-skills - 相机拍照、录像
电脑 / 服务器专用
- @openclaw/automation-skills - 桌面自动化
- @openclaw/shell-skills - 高级终端命令执行
运维 / 效率专用
- @openclaw/schedule-skills - 定时任务
- @openclaw/notify-skills - 消息推送(微信/钉钉/邮件)
可扩展方向
- 和米家生态联动
- [[安卓设备作为节点加入OpenClaw]]
实用案例
https://cloud.tencent.com/developer/article/2630341
Comments