Skip to main content

Gateway API reference

The WednesdayAI gateway exposes:
  1. WebSocket control plane - all clients (CLI, web UI, mobile apps, nodes) connect here
  2. HTTP tools endpoint - invoke agent tools directly without a full agent run
  3. OpenAI-compatible endpoints - POST /v1/chat/completions and POST /v1/responses
All endpoints share the same port (18789 by default) via HTTP/WebSocket multiplexing.

Authentication

All endpoints use the gateway auth configuration: Too many failed auth attempts returns HTTP 429 with a Retry-After header (tunable via gateway.auth.rateLimit).

WebSocket protocol

The WebSocket control plane is the primary integration surface. All CLI commands, the web control panel, and mobile nodes use this protocol. Connection: ws://localhost:18789 (or wss:// with TLS)

Handshake

The gateway sends a challenge before accepting the connection: Gateway -> Client (challenge):
Client -> Gateway (connect request):
Gateway -> Client (success):
The deviceToken in the response can be saved and passed as auth.token on subsequent connections to skip full re-authentication. The protocol version is currently 3.

Request/response pattern

After handshake, all communication uses type: "req" with an id for correlation and type: "res" responses:
On error, ok is false and error is set:

Server-push events

The gateway pushes events to all connected clients in this frame shape:
seq is a monotonically increasing broadcast sequence; stateVersion is present on state-snapshot events (presence, health). Slow consumers that cannot keep up are disconnected (close code 1008); discardable events are dropped instead. Pairing and exec-approval events are only delivered to operator connections holding the matching scope (or admin). Plugins and channel extensions can register additional methods and events beyond this table.

RPC methods

The table below is not exhaustive. The gateway registers dozens of methods and plugins can add more. To enumerate or call any method from the CLI, use openclaw gateway call <method> --params '<json>'. There is no public “list methods” RPC - the authoritative surface is the gateway source and the gateway call helper.
Common methods, grouped by namespace:
openclaw gateway status, openclaw gateway health, and openclaw gateway probe are CLI helpers that establish a connection and read the handshake/health payload - they are not single RPC method names. Likewise tools.invoke is exposed over HTTP (POST /tools/invoke), not as a control-plane method. Hooks have no RPC namespace either - manage them with the openclaw hooks CLI and the hooks.* config keys.

Config RPC rate limiting

config.apply and config.patch are rate-limited to 3 requests per 60 seconds per deviceId+clientIp. When limited, the call returns UNAVAILABLE with retryAfterMs. Both require a baseHash (from config.get) to prevent concurrent conflicting writes. Restarts are coalesced with a 30-second cooldown.

HTTP: Tool invocation

POST /tools/invoke - invoke a single agent tool directly. Always enabled; gated by gateway auth and tool policy. Maximum payload size: 2 MB
Tool availability is filtered through the tool policy chain (tools.*, agents.<id>.tools.*, and the HTTP-specific gateway.tools.deny/gateway.tools.allow overrides). If a tool is not allowed, the endpoint returns HTTP 404.

HTTP: OpenAI-compatible Chat Completions

POST /v1/chat/completions - drop-in replacement for the OpenAI Chat Completions API. Runs a full gateway agent turn. Disabled by default. Enable with gateway.http.endpoints.chatCompletions.enabled: true.
Target a specific agent via the model string (openclaw:<agentId>) or headers:
Tool calls, streaming (stream: true), and multi-turn conversations are supported.

HTTP: OpenAI-compatible Responses

POST /v1/responses - implements the OpenAI Responses API shape. Runs a full gateway agent turn and supports URL/file/image inputs. Disabled by default. Enable with gateway.http.endpoints.responses.enabled: true.
URL-input fetching is hardened via config. Set allowlists and limits before enabling URL fetch:
Both /v1/chat/completions and /v1/responses have full operator access to the gateway. A valid token here is equivalent to owner/operator credentials. Keep them on loopback or a private network - do not expose them to the public internet.

Control-UI HTTP surface and security headers

When gateway.controlUi.enabled is true, the gateway also serves the control panel and its assets over HTTP on the same port. Browser access is gated by the same auth modes plus device authorisation and origin checks (gateway.controlUi.allowedOrigins). For HTTPS deployments behind a reverse proxy you control, add HSTS:
Set strictTransportSecurity: false to omit the header. See Trusted proxy auth for TLS termination guidance.

Node connection (mobile/desktop nodes)

Nodes (iOS, Android, macOS app in node mode) connect with role: "node" and advertise their capabilities:
After connecting, the node listens for node.* RPC calls dispatched by the gateway agent and returns results. Approve pending nodes with openclaw nodes approve <requestId> (RPC: node.pair.approve).

See also