openclaw gateway
Manage the OpenClaw WebSocket Gateway server.Usage
Commands
run
Run the WebSocket Gateway in the foreground.Options
Port for the gateway WebSocket server (default: 18789)
Bind mode:
loopback, lan, tailnet, auto, or customloopback: Bind to 127.0.0.1 (local only)lan: Bind to LAN interfacetailnet: Expose via Tailscaleauto: Choose automaticallycustom: Use custom bind address
gateway.bind or loopbackShared token required in connect.params.auth.token. Defaults to OPENCLAW_GATEWAY_TOKEN env if set
Gateway auth mode:
token or passwordPassword for auth mode=password
Tailscale exposure mode:
off, serve, or funnelReset Tailscale serve/funnel configuration on shutdown
Allow gateway start without gateway.mode=local in config
Kill any existing listener on the target port before starting
Enable verbose logging to stdout/stderr
WebSocket log style:
auto, full, or compact (default: auto)Alias for
--ws-log compactCreate a dev config + workspace if missing (no BOOTSTRAP.md)
Reset dev config + credentials + sessions + workspace (requires —dev)
status
Show gateway service status and probe reachability.Output JSON format
start
Start the gateway as a background service.stop
Stop the gateway background service.restart
Restart the gateway background service.discover
Discover gateways via Bonjour (local + wide-area if configured).Per-command timeout in ms (default: 2000)
Output JSON format
call
Call a Gateway RPC method directly.Method name:
health, status, system-presence, or cron.*JSON object string for params (default: )
Output JSON format
health
Fetch Gateway health status.Output JSON format
probe
Show gateway reachability + discovery + health + status summary (local + remote).Explicit Gateway WebSocket URL (still probes localhost)
SSH target for remote gateway tunnel (user@host or user@host:port)
SSH identity file path
Try to derive an SSH target from Bonjour discovery
Gateway token (applies to all probes)
Gateway password (applies to all probes)
Overall probe budget in ms (default: 3000)
Examples
The gateway runs as a WebSocket server that agents and channels connect to. For production use, run it as a background service with
openclaw gateway start.Authentication
The gateway supports three authentication modes:- Token: Clients must provide a shared token
- Password: Clients must provide a shared password
- None: No authentication (only for loopback)
~/.openclaw/openclaw.json:
Bind Modes
- loopback: Bind to 127.0.0.1 (local connections only)
- lan: Bind to LAN interface (accessible from local network)
- tailnet: Expose via Tailscale (requires Tailscale setup)
- auto: Automatically choose based on config
- custom: Use custom bind address from config
Troubleshooting
If the gateway fails to start:- Check if another process is using the port:
lsof -i :18789 - Use
--forceto kill existing listeners - Check configuration:
openclaw config get gateway - Run diagnostics:
openclaw doctor

