Overview
The Allternit Cloud API is the only public API. It is the hosted control plane that binds user accounts to self-hosted and managed data-plane nodes. It provides the runtime pairing protocol, the browser-to-runtime relay, hosted runtime lifecycle, Allternit-provisioned instances, the BYO-VPS deploy wizard, the Cowork Runtime execution API, and the/v1 model gateway.
The API is built from cmd/allternit-cloud-api and runs at https://api.allternit.com in production (Postgres). The Allternit API (:8013, SQLite) is the private data plane — never a public hostname. See API Overview. The /v1/chat/completions model gateway is on this origin.
Base URL
Authorization: Bearer <token> header.
Runtime pairing
First-party device pairing binds a desktop or VPS runtime to a human account without giving the runtime the human’s Clerk session token. The runtime generates an Ed25519 keypair, polls for approval, and exchanges the pairing for a revocable device credential.Pairing endpoints
Create a pairing
Response
Exchange a pairing
The runtime signs the challenge with its Ed25519 private key and polls the exchange endpoint.Response
428:
Capability scopes
Paired computers
A user can pair one of their own machines (a Mac, a Linux box, a VPS) as a remote computer. Their devices can then view it and take it over, and the Allternit Factory can run bots on it, all over the private Allternit mesh. Pairing records the organization that was active when the code was made. Members of that organization see the computer too and can use it, markedshared: true.
Cloud computers as paired computers
An Allternit cloud computer pairs itself the first time its allternit-api starts, using the runtime device token it was provisioned with (POST /api/v1/computers/paired/self). It saves the answer in ~/.allternit/computer/paired.json, the same file allternit computer pair writes. Then it joins the owner’s mesh with mesh-node, forwarding only the Factory engine’s peer port (3019), and reports its mesh address every minute. Its screen is never served over the mesh: you view a cloud computer through the app as before. The pairing is deleted when the cloud computer is deleted. The row links to the instance through paired_computers.provisioned_instance_id (migration 067).
Each runtime mirrors a cloud computer’s pairing as a hidden computer (role factory_peer). That keeps it out of the Computers list, where the cloud computer already shows, while --on can still name it. Set ALLTERNIT_CLOUD_PEER=0 on a cloud computer to turn this off.
Peer tickets
A peer ticket is a data-plane JWT (EdDSA) withsub = the user, aud = the computer id and scope = factory:peer. It lives 5 to 15 minutes (ALLTERNIT_DP_JWT_TTL_SECS, default 600). The computer’s Factory engine checks it offline against GET /api/v1/auth/dp-jwks, and accepts only tickets addressed to itself. See Factory agents (--on <computer>).
Runtime relay
Once paired, a runtime opens an outbound WebSocket to the cloud API. A Clerk-authenticated browser can then proxy HTTP requests and WebSocket traffic to that runtime without exposing the runtime’s loopback API publicly.Relay endpoints
Proxy a request to a runtime
WebSocket ticket
For streaming endpoints, request a ticket first:Response
Live desktop viewer token
“Sign in on the cloud computer” opens the computer’s desktop in the browser. The desktop is served by the cloud computer itself and tunnelled through its outbound relay connection, so no Sessions computer record and no shared secret are involved. The viewer token uses the same signed format as the Sessionscomputers ws-token (purpose vnc, computer_id set to the runtime id), is signed with that runtime’s own relay key (the digest cloud-api already stores for it, credential_hash), and lives 300 seconds. The runtime’s allternit-api checks it at GET /api/v1/runtime-viewer/vnc?token=… and proxies to its local VNC server (ALLTERNIT_RUNTIME_VNC_ADDR, default 127.0.0.1:5900). wsUrl carries a 30-second relay socket ticket: connect right away, and ask again to reconnect.
readOnly is optional and defaults to false (signing in needs keyboard and mouse). Errors: 401 unauthenticated; 404 for an unknown, revoked, or someone else’s runtime (the same answer for all three); 409 not_a_cloud_computer for a Desktop or BYO runtime; 503 runtime_warming or runtime_offline when the computer is still waking or unreachable (a sleeping computer is woken the same way the relay proxy wakes it); 400 no_host when the request carries no host to build the public address from. No environment variable is required; ALLTERNIT_VIEWER_WS_BASE optionally overrides the public ws base (default: the request’s own host over wss://).
Checking the live desktop without a browser
GET /api/v1/runtime-devices/:id/viewer-check verifies the whole path a person would use, so it can be tested against any real cloud computer by a script or an orchestrator. It does the same ownership, cloud-computer and wake steps as viewer-token, then asks the runtime, over the relay with a 60-second view-only token, to connect to its VNC socket and read the RFB banner (GET /api/v1/runtime-viewer/vnc-check?token=… on the runtime, same token rules as the viewer). Nothing is opened or sent to the VNC server, and no session is created.
{ "ok": false, "runtimeId", "stage", "reason" } and the status says where it stopped:
A green check proves the relay, the token and the VNC server; it can’t prove a human can see pixels, so the first real “Sign in on the cloud computer” on a new image is still worth one look. Run it after provisioning a cloud computer and after changing the desktop image.
Allowed relay paths
The runtime proxy only accepts paths under the following prefixes:Relayed data-plane namespaces
These Cloud API routes authenticate with a Clerk session, resolve the caller’s default healthy node, and relay the request to Allternit API on that node. They do not store a second copy of the resource in Cloud API Postgres.
HTTP 428 means the account has no healthy node (pair a desktop/VPS or start a provisioned instance). The original
Authorization header is forwarded. SSE is not buffered.
Artifacts v2
Unlike the relayed namespaces above, artifacts are stored in Cloud API Postgres itself, so every surface sees the same records. That includes the ones made on a cloud computer or by gizzi. Routes are under/api/v2/artifacts, plus a no-auth public link route /api/v2/public/artifacts/{id} and /api/v2/org/artifact-settings. See Artifacts v2.
Provisioned instances
Paid subscriptions can get an Allternit-provisioned data-plane instance (isolated container, per-instance SQLite, auto-pair). These routes are control-plane only: they create/start/stop the instance. Traffic to Allternit API inside the instance still goes through the runtime relay.
Host registration (
/api/v1/provisioned-hosts) is operator-only.
Restore points and downloadable copies
Restore points are disk-only Incus snapshots of the computer, nameduser-<UTC timestamp>. They are copy-on-write on the host’s btrfs pool, and an owner can keep 5 per computer. Internal snapshots (for example the cancel snapshot kept after a subscription ends) are never listed, restored or deleted through these routes. All of them need the computer to be running, stopped or sleeping (409 otherwise).
A downloadable copy is an incus export of the whole computer (instance only, zstd) that the host prepares in the background and deletes 24 hours later. Poll the export until status is ready (or failed). The response then carries downloadPath, which works without a session header for one hour (downloadExpiresAt), so a plain link or <a download> streams it to disk:
incus import computer.tar.zst. Export jobs live in cloud-api’s memory: after a cloud-api restart, ask for a new copy.
Separately from these owner controls, every customer computer is backed up off-site every night: encrypted incus export archives in R2, kept 8 days (plus Sunday copies for 35 days). Operator details and restore steps: infrastructure/computer-backup/README.md in the platform repo.
Hosted runtimes
Paid users can provision managed runtimes as Fly Machines. Theagent-daemon inside the machine auto-pairs using a one-time bootstrap token.
Hosted runtime endpoints
Create a hosted runtime
Response
BYO-VPS deploy wizard
The wizard provisions a self-hosted runtime on Hetzner, DigitalOcean, AWS, or a manual SSH target. It runs idempotent bootstrap over SSH, joins the box to the mesh, registers it as a gizzi instance, and mints a one-time pairing token.Wizard endpoints
Start a wizard
Response
apiToken, sshPrivateKey, and sshPassword are never echoed.
Bootstrap the box
Response
409:
Cowork Runtime
Runs are the core execution unit in the Cowork Runtime. The cloud API exposes run lifecycle, event streaming, schedules, approvals, jobs, and checkpoints.Run endpoints
Create a run
Response
Stream events
Schedule endpoints
Approval endpoints
Health and metrics
Error codes
Rate limits
- Authenticated API routes: 60 requests per minute by default (
RATE_LIMIT_RPM). - Public pairing and relay routes: 30 requests per minute by default (
PUBLIC_RATE_LIMIT_RPM).