The gateway exposes an HTTP API on port 7433 (configurable via
gateway.port). This API is used by the TUI (for LLM proxying and tool execution), by plugin channels, and can be used for custom integrations.
Base URL
config.json5:
Endpoints
Health Check
List Agents
Get Config
List Agent Models
:name— Agent name (URL-encoded)
Execute Tool
read, write, patch, exec) in the agent’s sandbox.
Parameters:
:name— Agent name (URL-encoded)
sessionKey is used to derive the channel and session context injected as environment variables into the sandbox (BEIGE_AGENT_NAME, BEIGE_CHANNEL, BEIGE_SESSION_KEY). If omitted, defaults to tui:<agentName>:default.
Response:
Examples:
Send Prompt
:name— Agent name (URL-encoded)
sessionKey is omitted, a default session key is used (api:<agentName>:default).
Response:
Stream LLM Response (LLM Proxy)
AssistantMessageEvent objects from the pi SDK).
This is the endpoint the TUI uses for all LLM calls — it never needs API keys locally.
Request Body:
application/x-ndjson).
Each line is a JSON object — standard pi AssistantMessageEvent types plus two gateway-specific event types:
Example:
List Sessions
:name— Agent name (URL-encoded)
Restart Gateway
- Drain all in-flight LLM/tool calls (including proxied TUI streams)
- Tear down sandboxes, sockets, API, and channels
- Reload config from disk
- Restart everything fresh
202 Accepted immediately; the restart happens asynchronously.
Example:
Hook Endpoints
These endpoints execute plugin hooks. They are used by the TUI for session lifecycle events and are available for custom integrations. The prePrompt and postResponse hooks for TUI LLM calls are now executed server-side inside the/api/chat/stream endpoint automatically.
Run prePrompt Hooks
Run postResponse Hooks
Fire sessionCreated Hook
{ "ok": true }
Fire sessionDisposed Hook
{ "ok": true }
Error Responses
All endpoints return errors in a consistent format:Authentication
The HTTP API currently has no authentication. It binds to127.0.0.1 by default and is intended for local use only.
If you expose the API to a network, you are responsible for adding authentication (e.g., via a reverse proxy with basic auth, or by modifying the gateway code).
