HTTP & WebSocket

Pie's native HTTP/SSE and WebSocket protocol.

All routes below are served on the [server] listen address alongside the OpenAI, Anthropic, and Gemini endpoints.

Routes

RoutePurpose
GET /v1/wsWebSocket for installing programs, launching inferlets, and running multi-turn sessions.
POST /v1/generateRun one inferlet over HTTP, streamed back as server-sent events (SSE).
GET /v1/modelsList the served model in OpenAI format.
POST /v1/chat/completions · /v1/completions · /v1/responsesOpenAI endpoints.
POST /v1/messagesAnthropic endpoint.
POST /v1beta/models/{model}:generateContent · :streamGenerateContentGemini endpoints.

WebSocket (GET /v1/ws)

Messages are binary MessagePack maps with a type field. Client requests include a corr_id, and the server replies with a response message carrying the same corr_id.

Client to server

typeFieldsPurpose
auth_identify · auth_proveusername · signatureAuthenticate the client connection.
check_programinferletCheck whether an inferlet is already installed.
add_programProgram bytes in chunksUpload and install an inferlet.
launch_processinferlet, input (JSON string), capture_outputs, props, session, filesStart an inferlet process.
attach_processprocess_idReconnect to a running process.
signal_processprocess_id, messageDeliver a message to the process's session.receive().
transfer_fileprocess_id, chunkStream a binary file chunk to session.receive_file().
terminate_processprocess_idStop a running process.
list_processes · query · ping—Inspect active processes or server status.

Server to client

typeFieldsMeaning
responsecorr_id, ok, resultReply to a client request.
process_eventprocess_id, event, valuemessage, stdout, stderr, return, or error.
fileprocess_id, chunk, nameA file sent by session.send_file(), in 256 KiB chunks.

The Python client (pie-client) and the JavaScript, Swift, and Kotlin clients implement this protocol, so you rarely need to construct MessagePack frames directly.

POST /v1/generate

The request body is a launch_process message encoded as JSON, and the response streams process_event messages as server-sent events until the process returns. When running behind an authenticating proxy, pass the caller's identity in the x-pie-identity header.

Props

launch_process can attach props: small typed values (such as priority or keep-ms) read by scheduling policies.