Skip to content

prx gateway

Start the HTTP/WebSocket gateway server as a standalone process. Unlike prx daemon, this command only starts the gateway -- no channels, cron scheduler, or evolution engine.

This is useful for deployments where you want to expose the PRX API without the full daemon, or when running channels and scheduling as separate processes.

Usage

bash
prx gateway [OPTIONS]

Options

FlagShortDefaultDescription
--config-c~/.config/prx/config.tomlPath to configuration file
--port-p3120Listen port
--host-H127.0.0.1Bind address
--log-level-linfoLog verbosity: trace, debug, info, warn, error
--cors-origin*Allowed CORS origins (comma-separated)
--tls-certPath to TLS certificate file
--tls-keyPath to TLS private key file

Endpoints

The gateway exposes the following endpoint groups:

PathMethodDescription
/healthGETHealth check (returns 200 OK)
/api/v1/chatPOSTSend a chat message
/api/v1/chat/streamPOSTSend a chat message (streaming SSE)
/api/v1/sessionsGET, POSTSession management
/api/v1/sessions/:idGET, DELETESingle session operations
/api/v1/toolsGETList available tools
/api/v1/memoryGET, POSTMemory operations
/wsWSWebSocket endpoint for real-time communication
/webhooks/:channelPOSTIncoming webhook receiver for channels

See Gateway HTTP API and Gateway WebSocket for full API documentation.

Examples

bash
# Start on default port
prx gateway

# Bind to all interfaces on port 8080
prx gateway --host 0.0.0.0 --port 8080

# With TLS
prx gateway --tls-cert /etc/prx/cert.pem --tls-key /etc/prx/key.pem

# Restrict CORS
prx gateway --cors-origin "https://app.example.com,https://admin.example.com"

# Debug logging
prx gateway --log-level debug

Behind a Reverse Proxy

In production, place the gateway behind a reverse proxy (Nginx, Caddy, etc.) for TLS termination and load balancing:

# Caddy example
api.example.com {
    reverse_proxy localhost:3120
}
nginx
# Nginx example
server {
    listen 443 ssl;
    server_name api.example.com;

    location / {
        proxy_pass http://127.0.0.1:3120;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
    }
}

Signals

SignalBehavior
SIGHUPReload configuration
SIGTERMGraceful shutdown (finishes in-flight requests)

Released under the Apache-2.0 License.