Overview

The Local Engine API is a thin, authenticated proxy to the Allternit Local Engine controller (services/local-engine). All routes are mounted under /api/local-engine and forward request bodies and responses verbatim, so the gateway never becomes a second source of model or runtime state. Use this surface to:
  • Inspect the health and host status of the local engine.
  • Manage cached models: list, import from disk, and queue downloads from Hugging Face.
  • Launch and stop local model runtimes.
  • Call a running local model through a chat-completions-compatible surface.

Base URL

Production:
Local development (against the Allternit API server):
The API server proxies requests to the Local Engine controller at the URL configured by LOCAL_ENGINE_URL, defaulting to http://127.0.0.1:3015.

Authentication

All routes require a valid bearer token in the Authorization header. Requests without a recognized user receive 401 Unauthorized. See Authentication for details.

Endpoints

Health

Returns the controller’s health and version.

Example request

Example response

Status

Returns host-level diagnostics, including active runtimes, cached models, CPU, RAM, disk, and GPU information when available.

Example response

List models

Returns every model currently tracked in the local cache.

Example response

Model object fields

Import a model

Imports a model that already exists on disk into the local cache. The path must be a directory and must be accessible to the controller.

Request body

Example request

Example response

Download a model

Queues a download from a Hugging Face repository. The returned state reflects the current tracking entry; the download continues asynchronously.

Request body

Example request

Example response

List runtimes

Returns all runtimes known to the controller, including starting, running, stopped, and errored instances.

Example response

Runtime object fields

Launch a runtime

Spawns a local backend process from a recipe and returns the runtime snapshot immediately. Health is checked in the background; poll GET /api/local-engine/runtimes to wait for status: "running".

Request body

Recipe variants

The recipe object is a tagged union keyed by backend.

Example request

Example response

Stop a runtime

Stops the runtime with the given id. The runtime entry remains in the list with status: "stopped".

Path parameters

Example request

Example response

Chat-completions models list

Returns a chat-completions-compatible model list backed by the local cache.

Example response

Chat completions

Proxies a chat-completions-shaped request to a healthy local runtime serving the requested model. Both non-streaming and streaming (stream: true) requests are supported; streaming responses are returned as server-sent events. The request body is forwarded verbatim, so all standard chat-completions options—temperature, max_tokens, tools, response_format, and stream—are supported when the underlying backend accepts them.

Request body

Example request

Example response

Streaming example

Set stream: true and Accept: text/event-stream to receive incremental deltas:

Error codes

Upstream status codes and response bodies are forwarded transparently whenever possible, so a 400 from the controller is returned as a 400 to the caller.