OpenClaw 后台命令完整指南
OpenClaw是一个强大的本地/自托管 AI 代理框架,通过 CLI 命令行实现对后台、网关、模型、浏览器、定时任务等的全面控制。
这些命令就是 OpenClaw 的“后台命令”核心,全部通过终端输入 openclaw [子命令] 执行。以下按类别整理,包含语法、描述和示例。强烈建议把 openclaw –help 和 openclaw doctor 作为日常第一步!
1. 基础命令(Basics)
-
显示版本
openclaw –version -
显示所有命令帮助
openclaw –help -
打开终端 UI(TUI)
openclaw tui -
打开 Web 控制台(Dashboard)
openclaw dashboard -
重启服务
openclaw restart -
停止服务
openclaw stop -
更新到最新版
openclaw update
2. 诊断与故障排除(Diagnosis & Troubleshooting)
-
健康检查 & 自动修复
openclaw doctor
openclaw doctor –fix (强烈推荐出问题先跑这个!) -
查看整体状态
openclaw status
openclaw status –deep (深度检查) -
查看最近日志
openclaw logs -
实时跟踪日志
openclaw logs –follow
3. 设置与配置(Setup & Config)
-
交互式向导初始化
openclaw setup –wizard
openclaw onboard (最常用的一键入门) -
交互配置
openclaw configure -
安全审计 & 修复
openclaw security audit –fix -
获取配置项
openclaw config get agents.defaults.model.primary -
设置配置项
openclaw config set agents.defaults.timeoutSeconds 300 -
删除配置项
openclaw config unset agents.defaults.timeoutSeconds
4. 模型管理(Models)
-
查看模型状态
openclaw models status -
列出所有模型
openclaw models list –all -
列出本地模型
openclaw models list –local -
按提供商列出
openclaw models list –provider anthropic -
设置主模型
openclaw models set claude-3-5-sonnet-20241022 -
设置图像模型
openclaw models set-image claude-3-5-sonnet-20241022 -
添加认证(交互式)
openclaw models auth add -
设置 Token 认证
openclaw models auth setup-token –provider anthropic -
粘贴 Token
openclaw models auth paste-token –provider openai –token $OPENAI_API_KEY -
添加模型别名
openclaw models aliases add "claude" "claude-3-5-sonnet-20241022" -
添加 fallback 模型
openclaw models fallbacks add "claude-3-5-sonnet-20241022" "gpt-4o"
5. Gateway 管理(Gateway)
-
查看 Gateway 状态
openclaw gateway status -
启动 Gateway
openclaw gateway start -
停止 Gateway
openclaw gateway stop -
重启 Gateway
openclaw gateway restart (最常用命令之一!) -
安装为系统服务
openclaw gateway install -
卸载服务
openclaw gateway uninstall -
前台运行
openclaw gateway run
6. 通道管理(Channels)
-
列出所有通道
openclaw channels list -
检查通道状态
openclaw channels status –probe -
添加 Telegram Bot
openclaw channels add –channel telegram –account alerts –name "Alerts Bot" –token $TELEGRAM_BOT_TOKEN -
添加 Discord Bot
openclaw channels add –channel discord –account work –name "Work Bot" –token $DISCORD_BOT_TOKEN -
移除通道
openclaw channels remove –channel discord –account work
7. 技能与插件(Skills & Plugins)
-
列出技能
openclaw skills list -
安装技能(通过 clawhub)
npx clawhub install email -
列出插件
openclaw plugins list -
安装本地插件
openclaw plugins install –path ./custom-plugin -
启用/禁用插件
openclaw plugins enable voicecall
openclaw plugins disable voicecall
8. 浏览器自动化(Browser)
-
查看浏览器状态
openclaw browser status -
启动浏览器
openclaw browser start -
打开 URL
openclaw browser open –url https://docs.openclaw.ai -
截图
openclaw browser screenshot –target-id e12 –type png -
执行 JavaScript
openclaw browser evaluate –fn "document.title" –target-id e12
9. 节点管理(Nodes,例如手机/设备代理)
-
列出节点
openclaw nodes list -
在节点上运行命令
openclaw nodes run –node my-iphone –command "openclaw status" -
拍照
openclaw nodes camera snap –node my-iphone –facing back
10. 系统与定时任务(System & Cron)
-
列出 cron 任务
openclaw cron list –all -
添加定时任务
openclaw cron add –name "daily-summary" –at "2026-02-11T09:00:00Z" –system-event "Check emails" -
添加循环任务
openclaw cron add –name "hourly-check" –every 3600000 –message "Check for new messages" -
添加 cron 表达式任务
openclaw cron add –name "weekly-report" –cron "0 9 * * 1" –message "Generate weekly report"
11. ACP 协议桥接(用于 IDE 等集成)
-
运行 ACP 桥接
openclaw acp –url ws://127.0.0.1:19001 -
调试模式
openclaw acp client –server "node" –server-args openclaw.mjs






