openclaw gateway
Manage the OpenClaw WebSocket Gateway server.Usage
Commands
run
Run the WebSocket Gateway in the foreground.Options
number
Port for the gateway WebSocket server (default: 18789)
string
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 loopbackstring
Shared token required in connect.params.auth.token. Defaults to OPENCLAW_GATEWAY_TOKEN env if set
string
Gateway auth mode:
token or passwordstring
Password for auth mode=password
string
Tailscale exposure mode:
off, serve, or funnelboolean
Reset Tailscale serve/funnel configuration on shutdown
boolean
Allow gateway start without gateway.mode=local in config
boolean
Kill any existing listener on the target port before starting
boolean
Enable verbose logging to stdout/stderr
string
WebSocket log style:
auto, full, or compact (default: auto)boolean
Alias for
--ws-log compactboolean
Create a dev config + workspace if missing (no BOOTSTRAP.md)
boolean
Reset dev config + credentials + sessions + workspace (requires —dev)
status
Show gateway service status and probe reachability.boolean
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).number
Per-command timeout in ms (default: 2000)
boolean
Output JSON format
call
Call a Gateway RPC method directly.string
required
Method name:
health, status, system-presence, or cron.*string
JSON object string for params (default: )
boolean
Output JSON format
health
Fetch Gateway health status.boolean
Output JSON format
probe
Show gateway reachability + discovery + health + status summary (local + remote).string
Explicit Gateway WebSocket URL (still probes localhost)
string
SSH target for remote gateway tunnel (user@host or user@host:port)
string
SSH identity file path
boolean
Try to derive an SSH target from Bonjour discovery
string
Gateway token (applies to all probes)
string
Gateway password (applies to all probes)
number
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

