Categories
Self-Hosted AI AI Infrastructure Local LLM Model Serving GPU Management LLM Inference OpenAI-Compatible API Control PlaneStars
Forks
Watchers
Developer links
LapisLLM
Behind one OpenAI-compatible endpoint, LapisLLM turns the old gaming PC, the work laptop, and the Apple Silicon Mac you already own into a single self-hosted model fleet. A master keeps the registry and routes every request to the right machine, and a small agent on each box runs llama.cpp, vLLM, or MLX and reports its GPU or unified memory. Clients need one base URL and one API key, pick models by name, and see which machine answered in an X-Lapis-Node header. Admission checks free memory minus a reserve before any model starts, first on the master and again on the agent, and a refusal states the numbers. Best-fit placement packs small models onto small machines so the big box stays free, and previews each decision before you commit. New machines stay pending until an admin types the fingerprint printed on that machine, and scoped API keys are shown exactly once. Self-healing brings back the models that should be running after a restart, one at a time per node, while models you stopped stay stopped. Drain a machine out of rotation without clients noticing, export the fleet to JSON without secrets, and scrape Prometheus metrics. The lapis demo command runs a real master with five simulated nodes, so the console can be explored without a GPU. Running on a dedicated VPS on RepoCloud with guaranteed CPU, RAM, and SSD, full root SSH access, and a browser serial console. MIT licensed.
Benefits
- Spare machines become one fleet
- Gaming PCs, laptops, and Apple Silicon Macs you already own serve models behind one base URL and one API key, so clients never track which machine hosts which model.
- Refuses what will not fit
- Admission checks free memory minus a reserve on the master and again on the agent, and refusals name the numbers, so each model stays on the GPU admission chose.
- Machines join only when approved
- A new machine waits as pending until an admin types the fingerprint it prints, and only the agent holding that identity can claim the node secret.
- Restarts recover without babysitting
- After an agent or master restart, models that should run come back one at a time per node, and models you stopped stay stopped, so reboots need no manual recovery.
Features
- OpenAI-compatible /v1 gateway
- Models, chat completions, completions, and embeddings work with streaming through one endpoint, and an X-Lapis-Node header reports which machine answered each request.
- Per-GPU memory admission
- Every start is checked against free memory minus a reserve, per GPU on discrete cards, and the agent re-reads nvidia-smi on every heartbeat so other processes count.
- FastAPI master and agents
- A Python FastAPI master coordinates a small agent per machine, each running llama.cpp, vLLM, or MLX, with state in a JSON file and a TypeScript console.
- Fingerprint enrollment and keys
- Pending machines are approved by typing the fingerprint printed on them, and inference and metrics scoped API keys are stored as SHA-256 hashes and shown exactly once.
- Glass console and demo fleet
- A monochrome glass console with light and dark themes covers overview, models, nodes, a chat playground, and keys, while lapis demo fills it with five simulated machines.
- CLI memory estimator
- The lapis estimate command sizes a model from parameters and quantization, so 32B at q4 with an 8k context needs 19.10 GiB and is comfortable on a 24 GiB card.