Skip to main content

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 custom
  • loopback: Bind to 127.0.0.1 (local only)
  • lan: Bind to LAN interface
  • tailnet: Expose via Tailscale
  • auto: Choose automatically
  • custom: Use custom bind address
Defaults to config gateway.bind or loopback
string
Shared token required in connect.params.auth.token. Defaults to OPENCLAW_GATEWAY_TOKEN env if set
string
Gateway auth mode: token or password
string
Password for auth mode=password
string
Tailscale exposure mode: off, serve, or funnel
boolean
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 compact
boolean
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

When binding to anything other than loopback, you must configure authentication (--token or --password) to prevent unauthorized access.
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:
  1. Token: Clients must provide a shared token
  2. Password: Clients must provide a shared password
  3. None: No authentication (only for loopback)
Configure authentication in ~/.openclaw/openclaw.json:
Or use environment variables:

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:
  1. Check if another process is using the port: lsof -i :18789
  2. Use --force to kill existing listeners
  3. Check configuration: openclaw config get gateway
  4. Run diagnostics: openclaw doctor
  • daemon - Manage gateway as a system service
  • logs - View gateway logs
  • doctor - Diagnose gateway issues