Skip to main content
The Desktop engine is a small HTTP server on loopback — document it here if you’re wiring an alternate UI or an integration.
The engine binds to 127.0.0.1 only — nothing leaves your machine unless the model provider does. There is no auth because there is no remote surface: the loopback socket is the boundary.

Quick Start

1

Find the port

The shell prints PRAISONAI_PORT=<port> on startup and writes it to the lockfile. Every route below is served from http://127.0.0.1:<port>.
2

Probe health

GET /health returns {ok, version, data_dir} — the version confirms it’s the engine and not something else on the port.
3

Stream a chat

POST /chat returns a Server-Sent Events stream. See Chat & Streaming for the event vocabulary.

Routes


Status Codes

The engine returns real codes so a client can act, rather than dropping the connection.
A malformed /train/progress?cursor=abc used to drop the connection with no response. It now returns 400 Bad Request with {"error": "cursor must be an integer"}.
DELETE /chats/{cid} used to answer 200 {"ok": true} for every case, including permission errors and malformed ids. It now returns 400 or 500 with {"ok": false, "error": …} so a UI can react instead of blanking the transcript against a delete that never happened.

Bounded Deques

The training routes read from bounded in-memory buffers; the on-disk log is always the full record.

Best Practices

The kernel assigns a free port at bind time. Read it from the PRAISONAI_PORT= line or the lockfile — never hardcode one.
version distinguishes the engine from anything else that answers on the port. Check it before trusting the rest of the surface.
/train/progress replays from cursor then follows. Store the last cursor you saw so a reconnect resumes exactly where it left off.

Fine-Tuning

The training subsystem the /train/* routes drive

Data & Privacy

Why the loopback socket is the whole boundary