CLI 参考
本页面描述当前的 CLI 行为。如果命令发生变化,请更新此文档。
全局标志
- ▹
--dev:在~/.openclaw-dev下隔离状态并移动默认端口 - ▹
--profile <name>:在~/.openclaw-<name>下隔离状态 - ▹
--no-color:禁用 ANSI 颜色 - ▹
--update:openclaw update的简写(仅源代码安装) - ▹
-V, --version, -v:打印版本并退出
输出样式
- ▹ANSI 颜色和进度指示器仅在 TTY 会话中渲染
- ▹OSC-8 超链接在支持的终端中渲染为可点击链接;否则回退到纯 URL
- ▹
--json(以及支持的--plain)禁用样式以获得干净的输出 - ▹
--no-color禁用 ANSI 样式;也遵守NO_COLOR=1 - ▹长时间运行的命令显示进度指示器(支持时使用 OSC 9;4)
主要命令
设置和入门
bash# 初始化配置 + 工作区 openclaw setup [--workspace <dir>] [--wizard] # 交互式入门向导 openclaw onboard [--workspace <dir>] [--install-daemon] # 配置向导 openclaw configure
网关管理
bash# 运行网关(前台) openclaw gateway [--port 18789] [--bind loopback] # 服务管理 openclaw gateway install openclaw gateway start openclaw gateway stop openclaw gateway restart openclaw gateway status [--deep] [--json] # 查看日志 openclaw logs [--follow] [--limit 200] [--json]
渠道管理
bash# 列出渠道 openclaw channels list [--json] # 检查渠道状态 openclaw channels status [--probe] # 添加渠道 openclaw channels add --channel telegram --token $TOKEN # WhatsApp 登录 openclaw channels login # 删除渠道 openclaw channels remove --channel telegram --delete
模型管理
bash# 显示模型状态 openclaw models status [--probe] [--json] # 列出可用模型 openclaw models list [--all] [--provider anthropic] # 设置默认模型 openclaw models set anthropic/claude-opus-4-6 # 设置图像模型 openclaw models set-image anthropic/claude-opus-4-6 # 扫描模型 openclaw models scan [--provider anthropic] [--set-default] # 身份验证 openclaw models auth add openclaw models auth setup-token --provider anthropic
代理和会话
bash# 运行代理 openclaw agent --message "Hello" [--to main] [--deliver] # 列出代理 openclaw agents list [--json] # 添加代理 openclaw agents add [name] --workspace <dir> # 删除代理 openclaw agents delete <id> [--force] # 列出会话 openclaw sessions [--json] [--active 60]
诊断和维护
bash# 健康检查 openclaw doctor [--deep] [--yes] # 系统状态 openclaw status [--all] [--deep] [--usage] # 健康检查 openclaw health [--json] # 重置 openclaw reset --scope config [--yes] # 卸载 openclaw uninstall [--all] [--yes]
浏览器控制
bash# 浏览器状态 openclaw browser status # 启动浏览器 openclaw browser start [--browser-profile default] # 截图 openclaw browser screenshot [--full-page] # 快照 openclaw browser snapshot [--format ai] # 导航 openclaw browser navigate <url> # 点击元素 openclaw browser click <ref>
节点管理
bash# 列出节点 openclaw nodes status [--connected] # 描述节点 openclaw nodes describe --node <id> # 批准配对 openclaw nodes approve <requestId> # 运行命令 openclaw nodes run --node <id> <command...> # 发送通知 openclaw nodes notify --node <id> --title "Hello" # 相机捕获 openclaw nodes camera snap --node <id> # Canvas openclaw nodes canvas present --node <id> --target <url>
定时任务
bash# 列出定时任务 openclaw cron list [--all] [--json] # 添加定时任务 openclaw cron add --name "backup" --every 1h --system-event "Backup" # 运行定时任务 openclaw cron run <id> # 删除定时任务 openclaw cron rm <id>
工具和插件
bash# 列出技能 openclaw skills list [--eligible] [--json] # 技能信息 openclaw skills info <name> # 列出插件 openclaw plugins list [--json] # 安装插件 openclaw plugins install <path> # 插件诊断 openclaw plugins doctor
内存和搜索
bash# 内存状态 openclaw memory status # 索引内存 openclaw memory index # 搜索内存 openclaw memory search "query"
其他工具
bash# 打开仪表板 openclaw dashboard # 配对管理 openclaw pairing list [--json] openclaw pairing approve <channel> <code> # 设备管理 openclaw devices list [--json] openclaw devices approve [requestId] # 安全审计 openclaw security audit [--deep] [--fix] # 文档搜索 openclaw docs [query...] # TUI openclaw tui [--session main] # DNS 设置 openclaw dns setup [--apply] # Webhooks openclaw webhooks gmail setup --account <email>
命令别名
- ▹
openclaw daemon→openclaw gateway(旧版别名) - ▹
openclaw clawbot→ 旧版命名空间 - ▹
openclaw models→openclaw models status(根命令)
配置命令
bash# 获取配置值 openclaw config get agents.defaults.model.primary # 设置配置值 openclaw config set agents.defaults.model.primary "anthropic/claude-opus-4-6" # 删除配置值 openclaw config unset agents.defaults.model.primary
非交互式模式
大多数命令支持 --non-interactive 或 --yes 标志用于脚本编写:
bash# 非交互式入门 openclaw onboard --non-interactive --auth-choice token --token $TOKEN # 非交互式重置 openclaw reset --scope config --yes --non-interactive # 非交互式卸载 openclaw uninstall --all --yes --non-interactive
JSON 输出
大多数命令支持 --json 用于机器可读输出:
bashopenclaw status --json openclaw channels list --json openclaw models status --json openclaw sessions --json openclaw gateway status --json
环境变量
常用环境变量:
- ▹
OPENCLAW_HOME:主目录路径 - ▹
OPENCLAW_STATE_DIR:状态目录 - ▹
OPENCLAW_CONFIG_PATH:配置文件路径 - ▹
OPENCLAW_GATEWAY_PORT:网关端口 - ▹
OPENCLAW_GATEWAY_TOKEN:网关身份验证令牌 - ▹
OPENCLAW_GATEWAY_PASSWORD:网关密码 - ▹
NO_COLOR:禁用颜色输出
退出代码
- ▹
0:成功 - ▹
1:一般错误 - ▹
2:配置错误或验证失败 - ▹
3:网关连接失败 - ▹
130:用户中断(Ctrl+C)