一、基础信息与启停命令
1. 查看版本
Bash
openclaw --version
作用:显示当前 OpenClaw 版本
2. 查看帮助
Bash
openclaw --help
作用:列出所有一级命令及简要说明,忘记命令时快速查阅。
3. 启动 TUI 交互界面(新手推荐)
Bash
openclaw tui
作用:终端可视化界面,支持鼠标/方向键操作,适合快速配置和调试。
4. 查看运行状态
Bash
openclaw status
作用:查看网关运行、通道连接、活跃会话、内存占用、模型状态等核心信息。
5. 启停服务
Bash
openclaw stop
openclaw restart
-
stop:优雅停止 OpenClaw 网关与所有会话。 -
restart:重启服务,常用于更新或配置生效。
6. 查看日志
Bash
openclaw logs
openclaw logs -f # 实时滚动
作用:排错首选,看启动、通道、模型调用、技能执行日志。
二、初始化与配置命令
1. 首次初始化向导
Bash
openclaw onboard
作用:引导完成提供商登录、工作区、默认模型、守护进程安装,5 分钟完成基础配置。
2. 重新进入配置向导
Bash
openclaw configure
作用:修改已有配置(模型、密钥、网关),不覆盖已有数据。
3. 健康检查与修复
Bash
openclaw doctor
openclaw doctor --fix
-
doctor:全面检测环境、依赖、配置、网络、通道连通性。 -
--fix:自动修复常见问题(权限、端口、依赖缺失)。
4. 配置项操作
Bash
openclaw config set <path> <value>
openclaw config unset <path>
示例:
Bash
openclaw config set plugins.entries.openclaw-weixin.enabled true
作用:修改/删除 JSON 配置,支持批量 JSON 导入。
三、模型管理命令(4.10 高频)
1. 列出所有模型
Bash
openclaw models list
作用:查看已配置模型名称、厂商、默认状态、可用性。
2. 按厂商筛选
Bash
openclaw models list -p ollama
作用:快速过滤本地/远程模型(ollama、openai、doubao 等)。
3. 设置默认模型
Bash
openclaw models set <model-name>
示例:
Bash
openclaw models set doubao-lite
4. 测试模型连通性
Bash
openclaw models test <model-name>
作用:发送测试prompt,验证 API Key、网络、返回格式是否正常。
四、通道(Channel)管理命令
1. 查看已配置通道
Bash
openclaw channels list
2. 查看通道状态
Bash
openclaw channels status
作用:检测网关可达性、认证有效性、健康状态,给出常见错误修复建议。
3. 添加通道(如微信)
Bash
openclaw channels add
-
无参数:向导式配置。
-
支持:weixin、dingtalk、feishu、telegram 等。
4. 登录/登出通道
Bash
openclaw channels login --channel <name>
openclaw channels logout --channel <name>
示例(微信):
Bash
openclaw channels login --channel openclaw-weixin
5. 查看通道日志
Bash
openclaw channels logs
五、技能(Skills)与智能体命令
1. 查看已加载技能
Bash
openclaw skills list
2. 启用/禁用技能
Bash
openclaw skills enable <skill-id>
openclaw skills disable <skill-id>
3. 智能体管理
Bash
openclaw agents list
openclaw agents start <agent-id>
openclaw agents stop <agent-id>
六、常用排错组合(建议收藏)
Bash
# 服务异常
openclaw doctor --fix
openclaw restart
# 微信通道连不上
openclaw channels status
openclaw channels logout --channel openclaw-weixin
openclaw channels login --channel openclaw-weixin
# 模型调用失败
openclaw models test <model-name>
openclaw logs | grep -i model
七、总结
OpenClaw 4.10 CLI 整体分为基础启停、配置、模型、通道、技能 五大类。日常记住:status、logs、doctor、channels、models 即可覆盖 90% 场景。