Overview

The Allternit Local Engine is a self-hosted service that downloads model weights (through Freeweights, falling back to the Hugging Face Hub), keeps them in a local cache, and manages the lifecycle of local inference backends. It exposes a small HTTP API for model download/import, runtime launch/stop, hardware status, and a /v1/chat/completions proxy that routes requests to a healthy backend serving the requested model.
Models, runtime logs, and inference traffic stay on the host. Nothing is sent to Allternit-managed inference endpoints unless you explicitly route traffic through them.

Base URL

Local development (default):
The host and port can be changed with environment variables:

What it does

  1. Model cache — tracks downloaded and imported models with their byte-level progress, status, and local paths.
  2. Verified downloads — every file is fetched through the model source contract: Freeweights first, then the publisher (Hugging Face), checked by sha256 or the git blob id. Partial downloads resume. Each model in GET /models carries a verification state, and POST /models/verify re-hashes the files on disk. Data with no hash is refused unless the request sets allow_unverified. Set ALLTERNIT_FREEWEIGHTS_URL to point at a different Freeweights base. See Freeweights.
  3. Local imports — registers models already on disk, including exports produced by Studio training jobs.
  4. Runtime manager — spawns inference backends on a free port, polls their health endpoint, and captures logs.
  5. Chat proxy — forwards /v1/chat/completions requests to the correct healthy runtime using the model field.
  6. Host diagnostics — reports CPU, RAM, disk, and GPU information so clients can pick compatible models.

Installation

The Local Engine is a Rust binary in the Allternit workspace.
Or from the workspace root:

Requirements

  • Rust toolchain (workspace edition 2021)
  • Engines come as engine packs: llama.cpp, MLX (Apple Silicon Macs only) and colibri. You do not put anything on PATH. The engine downloads the pack for your computer the first time a model needs it, checks it, and keeps it under its data directory. A computer with no pack gets a plain message saying so.
  • Sufficient disk space under the OS data directory for cached models
The service creates two directories on startup:
{data_dir} is dirs::data_dir() on your platform (for example, ~/Library/Application Support on macOS or ~/.local/share on Linux).

Endpoints

Model cache

Every cached model has a stable local ID derived from the source repo, revision, and optional quantization suffix:
For example, meta-llama/Llama-2-7b-hf at main becomes:

Model status values

List cached models

Response:

Download a model

Response:
The download runs in the background. Poll /models to watch downloaded_bytes and status. The engine filters the Hugging Face tree to keep only config/tokenizer files and weight files (.safetensors, .bin, .gguf, .mlx, .pt, .pth), while skipping READMEs, images, and metadata files. Partial .part files are resumed when possible.

Import a local model

Use this for weights already on disk or for Studio training exports.
Response:
source can be local_path or unsloth_output. The path must be a directory.

Launch a runtime

A recipe tells the engine which backend to spawn and how to configure it.
Response:
The engine allocates a free port on 127.0.0.1, spawns the backend, and polls its /health endpoint for up to 30 seconds. Once healthy, status becomes running. Logs are written to {data_dir}/allternit-local-engine/logs/runtimes/{runtime_id}.log.

Supported backends

The recipe schema supports four backends. Today, llama_cpp is fully implemented; the others are reserved for future releases.

Recipe fields for llama.cpp

List and stop runtimes

List runtimes

Response:

Stop a runtime

Response:

Chat completions proxy

Once a runtime is running, send chat completion requests through the Local Engine. The proxy reads the model field, finds a healthy runtime serving that model ID, and forwards the request to the backend.
The response shape is whatever the backend returns, so it works with any client that speaks the standard /v1/chat/completions schema.

Service status and diagnostics

Response:
GPU detection uses system_profiler on macOS, nvidia-smi on Linux, and on Windows nvidia-smi for NVIDIA cards, then the WMI adapter list (Win32_VideoController) for AMD/Intel. WMI can’t report VRAM of 4 GB or more, so those cards show no memory figure. On Apple Silicon, GPU memory is reported as shared system memory.

Error codes