Skip to main content

网关 CLI

网关是 OpenClaw 的 WebSocket 服务器(支持频道、节点、会话、钩子)。

运行网关

openclaw gateway
前台别名:
openclaw gateway run

参数选项

  • --port <port>:WebSocket 端口(默认 18789
  • --bind <loopback|lan|tailnet|auto|custom>:监听绑定模式
  • --auth <token|password>:认证模式覆盖
  • --token <token>:token 覆盖
  • --password <password>:密码覆盖
  • --tailscale <off|serve|funnel>:通过 Tailscale 暴露网关
  • --allow-unconfigured:允许无 gateway.mode=local 配置启动
  • --force:启动前杀死指定端口上已有监听进程
  • --verbose:启用详细日志

查询运行中的网关

gateway health

openclaw gateway health --url ws://127.0.0.1:18789

gateway status

openclaw gateway status
openclaw gateway status --json
参数:
  • --url <url>:覆盖探测 URL
  • --token <token>:探测时的令牌认证
  • --password <password>:探测时的密码认证
  • --timeout <ms>:探测超时
  • --no-probe:跳过 RPC 探测
  • --deep:扫描系统级服务

gateway probe

openclaw gateway probe
openclaw gateway probe --json

gateway call <method>

低级 RPC 辅助命令。
openclaw gateway call status
openclaw gateway call logs.tail --params '{"sinceMs": 60000}'

管理网关服务

openclaw gateway install
openclaw gateway start
openclaw gateway stop
openclaw gateway restart
openclaw gateway uninstall

发现网关 (Bonjour)

gateway discover

openclaw gateway discover
openclaw gateway discover --timeout 4000
openclaw gateway discover --json | jq '.beacons[].wsUrl'
参数:
  • --timeout <ms>:单次命令超时(默认 2000 毫秒)
  • --json:机器可读输出

相关文档