
LocalAI
A self-hosted, drop-in replacement for the OpenAI API.
GitHub Stars
48.4K
Contributors
233
PyPI / Month
—
LocalAI is an open-source serving engine that exposes a drop-in replacement for the OpenAI API. Maintained by the LocalAI team (MIT license, written in Go), it lets you serve open models behind an API that existing applications can call without any code changes. First released in 2023, it has grown to 47,188 GitHub stars and 214 contributors, making it one of the most popular self-hosted inference projects.
The engine’s design philosophy is pragmatic: give teams one endpoint that works with any model type — text, image, or audio — and runs on whatever hardware they already have, including plain CPUs. It competes directly with Ollama, vLLM, and LM Studio in the local/self-hosted serving category. Where Ollama emphasizes simplicity and vLLM optimizes for batch throughput, LocalAI targets versatility. It is built by a community that values privacy, hardware flexibility, and API compatibility over raw token speed.
LocalAI is a server you start with a single Docker command. The core abstraction is a model YAML configuration file that maps a model family to a backend. When a request hits the API, LocalAI routes it to the appropriate backend (llama.cpp, whisper.cpp, stable-diffusion.cpp, vLLM, MLX, etc.) and returns a response in the exact format the OpenAI client expects.
You load a model either by specifying it in the API call (model: llama-3-8b-q4) or by installing it from the built-in gallery. The engine then pulls the model file and its backend dependencies on demand. This “small core, not a bundle” approach means you only download what you actually use.
The API is fully OpenAI-compatible. Chat completions, embeddings, image generation, and audio transcription endpoints all mirror the OpenAI spec. Streaming, function calling, and structured output work out of the box. Engineers familiar with the OpenAI Python client can point their openai library to http://localhost:8080/v1 and start inferring.
LocalAI runs on NVIDIA GPUs (CUDA), AMD GPUs (ROCm), Intel GPUs, Apple Silicon, and plain CPUs. The confirmed capabilities include quantization, structured output, and streaming. You choose a Docker image that matches your hardware:
localai/localai:latest-cpu for CPU-onlylocalai/localai:latest-gpu-nvidia-cuda-12 for NVIDIAlocalai/localai:latest-gpu-hipblas for AMDlocalai/localai:latest-gpu-intel for Intellocalai/localai:latest-gpu-vulkan for Vulkan-compatible GPUsThe primary feature. Any app built against the OpenAI API — chat, embeddings, image generation, audio transcription, text-to-speech — works against LocalAI with no code changes. This includes structured output (JSON mode, function calling) and streaming responses.
No GPU required. LocalAI runs on CPU, NVIDIA, AMD, Apple Silicon, and Intel GPUs. The same container can serve models on a MacBook, an AWS EC2 instance without a GPU, or a rack server with an RTX 5090.
A single LocalAI server handles LLMs, image generation (Stable Diffusion), speech-to-text (whisper.cpp), and text-to-speech (TTS). Engineers running a local AI stack can consolidate multiple services into one port.
Models can be quantized (Q4, Q5, Q8, etc.) to fit memory constraints. You can also choose which backend to use per model — llama.cpp for most LLMs, vLLM for high-throughput LLM workloads, MLX for Apple Silicon, etc.
LocalAI includes a built-in web UI for chatting, installing models, and managing agents. It supports MCP (Model Context Protocol) tools, enabling autonomous agents with tool-calling capabilities.
Point internal apps at a LocalAI endpoint instead of OpenAI’s API. Data never leaves your hardware. This is a common pattern for enterprises with compliance requirements or sensitive user data.
Run models on servers that lack GPUs — edge devices, branch offices, air-gapped environments. Throughput is modest but functional for batch processing or low-volume chat.
Teams building local assistants (e.g., a document Q&A system that also generates images and transcribes audio) can run a single LocalAI server instead of juggling multiple services.
Developers iterate against a real model locally before deploying to production. The OpenAI-compatible API means they use the same client code in dev and prod.
LocalAI is a poor fit for high-QPS production serving of LLMs alone. If your workload is LLM-only and requires maximum throughput, vLLM or SGLang will yield better tokens-per-second and lower latency under load. Similarly, for simple single-model chat apps, Ollama’s minimal configuration is easier.
The quickest path to a running model:
1 docker run -p 8080:8080 --name local-ai -ti localai/localai:latest-cpu
For GPU, replace latest-cpu with the appropriate image (e.g., latest-gpu-nvidia-cuda-12) and add --gpus all.
http://localhost:8080. Navigate to the Models page, browse the gallery, and install a model (e.g., Llama 3 8B). Alternatively, place a GGUF model file in the models/ directory.1 import openai2 client = openai.OpenAI(base_url="http://localhost:8080/v1", api_key="not-needed")3 response = client.chat.completions.create(model="llama-3-8b-q4", messages=[{"role": "user", "content": "Hello"}])4 print(response.choices[0].message.content)
That’s it. No Python dependencies, no server configuration beyond the Docker command. Official documentation is at [localai.io](https://localai.io). Community support is active on Discord and GitHub.
Both offer OpenAI-compatible local serving. Ollama is simpler — one binary, one model store, no backends to configure. LocalAI is more versatile: it handles images and audio, runs on more hardware options (AMD, Intel, Vulkan), and supports vLLM as a backend for high-throughput LLM serving. Choose Ollama when you want the fastest setup for LLM-only chat. Choose LocalAI when you need multi-modal support or a wider hardware target.
vLLM is a dedicated LLM serving engine optimized for throughput with PagedAttention, continuous batching, and prefix caching. It achieves 2x+ more tokens per second than LocalAI on the same GPU. LocalAI, however, uses less VRAM and starts faster. It also runs on CPU and supports non-LLM models. Choose vLLM for production LLM serving where throughput is critical. Choose LocalAI when you need a general-purpose endpoint that also handles images and audio, or when GPU memory is tight.
What the engine gives you out of the box, in plain language.
Mirrors the OpenAI API so apps switch over with no code changes.
Works on CPU and on NVIDIA, AMD, and Apple Silicon, no GPU required.
Serve text, image, and audio models from one endpoint.
The jobs this engine is best suited for.
Keep data in house by pointing apps at your own endpoint.
Run models on servers with no GPU at all.
Serve text, image, and audio models from a single tool.

Side-by-Side
Add a second or third engine and see stars, downloads, and capabilities lined up next to each other.
Close alternatives worth a look before you decide.
High-throughput GPU serving with an OpenAI-compatible API out of the box.
High-throughput GPU serving
pip install vllmStars
88.8K
PyPI / mo
5.1M
Run open models locally with a single command.
One-line local model running
curl -fsSL https://ollama.com/install.sh | shStars
178.2K
PyPI / mo
—