Gateway API reference
The WednesdayAI gateway exposes:- WebSocket control plane - all clients (CLI, web UI, mobile apps, nodes) connect here
- HTTP tools endpoint - invoke agent tools directly without a full agent run
- OpenAI-compatible endpoints -
POST /v1/chat/completionsandPOST /v1/responses
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):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 usestype: "req" with an id for correlation and type: "res" responses:
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.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.
openclaw:<agentId>) or headers:
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.
Control-UI HTTP surface and security headers
Whengateway.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:
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 withrole: "node" and advertise their capabilities:
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
- CLI reference - the
openclaw gateway callhelper - Gateway configuration reference -
gateway.http.*, auth, TLS - Gateway remote access
- Gateway authentication
- Plugin SDK