LocalAI in open-source AI tools: a self-hosted, OpenAI-compatible server for text, images and audio in 2026
What LocalAI is
Ettore Di Giacinto started LocalAI in 2023 as a self-hosted stand-in for the OpenAI API: anything written for OpenAI could point at your own server instead. It has grown into a general AI server. One container exposes chat, completions, embeddings, image generation, audio transcription, text-to-speech, reranking and realtime voice endpoints, all in OpenAI's request format, with Anthropic Messages and Open Responses formats added more recently.
LocalAI does not implement inference itself. It manages backends, separate engines for each job:
| Backend | Used for |
|---|---|
| llama.cpp | Language models in GGUF format on CPU and GPU |
| vLLM | High-throughput language model serving on data-center GPUs |
| MLX | Language models on Apple Silicon |
| whisper.cpp | Speech-to-text |
| diffusers, stable-diffusion.cpp | Image generation |
| Piper, Kokoro and others | Text-to-speech |
| Rerankers | Cross-encoder reranking for search |
Since version 4, backends are downloaded on demand when a model needs them, which keeps the base image small.
Which directory projects use it
| Project | Relationship |
|---|---|
| LocalAI | The server itself |
| Open WebUI | Chat front end via an OpenAI connection; can use LocalAI for images and voice too |
| LiteLLM | Routes requests to LocalAI as an OpenAI-compatible provider alongside hosted models |
Other apps that accept a custom OpenAI base URL, such as LibreChat, AnythingLLM and Dify, connect the same way.
What changed in 2026
LocalAI ships often. The v4 line reorganized the project around on-demand backends, added a distributed mode that shares models and work across several machines over a peer-to-peer network, and broadened API compatibility to Anthropic and Open Responses. Version 4.11.0, released October 2, 2026, added:
- Model failover under one public name, so a request for
chatcan fall back to a second model if the first fails. - Speaker memory for voice conversations.
- Model inspection, to see a model's metadata and settings from the API.
- Decision models, through a new endpoint for routing requests.
Running it
The quickest start is one Docker command:
docker run -p 8080:8080 --name local-ai -ti localai/localai:latest
Use the image tag for your hardware, for example a CUDA 12 image for NVIDIA GPUs, and pass the GPU through to the container. Open http://localhost:8080 to browse the gallery and install models. Mount a volume for /models so downloads survive restarts. For production, pin a specific version tag rather than latest.
Hardware sizing
| Workload | Minimum | Comfortable |
|---|---|---|
| 7 to 8B chat model, 4-bit | 8 GB RAM, CPU only (slow) | 12 GB GPU or Apple M-series |
| Whisper transcription | 4 cores | Any recent GPU |
| Embeddings for RAG | CPU | CPU or small GPU |
| Image generation (SDXL-class) | 8 GB GPU | 16 to 24 GB GPU |
| 70B chat model | 48 GB GPU memory | Two 24 GB GPUs or 64 GB Mac |
Running several model types at once adds up. LocalAI can unload idle models and limit how many stay loaded, which you will want on a single GPU shared between chat, images and speech.
LocalAI compared with Ollama and vLLM
| LocalAI | Ollama | vLLM | |
|---|---|---|---|
| Scope | Text, images, audio, embeddings, rerank | Mainly text and embeddings | Text and some multimodal |
| API | OpenAI, Anthropic, Open Responses | Native plus OpenAI-compatible | OpenAI-compatible |
| Setup | Docker, web UI gallery | One installer | Python or Docker, GPU required |
| Throughput | Depends on backend | Good for a few users | Highest for many users |
| Best for | One self-hosted endpoint for everything | Personal use and small teams | Production serving at scale |
A common setup uses LocalAI to provide images, speech and embeddings, and either LocalAI's vLLM backend or a separate vLLM server for heavy chat traffic.
Configuration
Each model has a YAML file defining its backend, file, context size, GPU layers, chat template and parameters. Editing these is how you tune behavior. The two most common fixes are setting context_size higher for long documents and setting the correct template when a model gives run-on or malformed answers. Gallery models come with sensible defaults.
Security
Like other local servers, LocalAI listens without authentication by default. Set API_KEY to require a bearer token, keep it on a private network, and put a reverse proxy with TLS in front for remote access. The distributed mode uses a shared token between nodes; treat it as a secret.
Costs
LocalAI has no fees. A modest home server with a 16 GB GPU, enough for chat with an 8B to 14B model, Whisper and image generation, draws 200 to 350 watts under load, around $10 to $25 a month in electricity for regular daytime use. Compared with hosted APIs, it makes sense when privacy rules out the cloud, when volume is high and steady, or when you want to experiment without a meter running.
A typical home-lab layout
A common LocalAI setup on a single server with one GPU looks like this:
| Service | Role | Port |
|---|---|---|
| LocalAI | Chat, embeddings, Whisper, image generation, text-to-speech | 8080 |
| Open WebUI | Chat interface with user accounts | 3000 |
| Qdrant or pgvector | Vector storage for document chat | 6333 or 5432 |
| Caddy or Traefik | TLS and authentication at the edge | 443 |
All four run in Docker Compose on one machine. Open WebUI sends chat requests to LocalAI's /v1/chat/completions, voice input to /v1/audio/transcriptions, and image prompts to /v1/images/generations. Users get one interface for text, voice and images, and nothing leaves the building. Add a second GPU machine in distributed mode when one card is no longer enough.
Upgrading safely
LocalAI releases frequently, and backends update on their own schedule. Pin the image tag, keep the /models volume and its YAML files under backup, and test a new version on a copy before upgrading the main server. Read the release notes for changes to configuration fields, since renamed options are the most common cause of models failing to load after an upgrade. Because backends download on demand, the first request after an upgrade can be slow while a new backend version installs.
Model choices that work well
For a general chat model, a 7B to 14B instruction-tuned model from the Qwen, Llama, Gemma or Mistral families at 4-bit quantization is a good start on a single consumer GPU. For embeddings, small open models such as Nomic Embed or BGE run fast on CPU. For speech-to-text, Whisper large-v3 or its faster turbo variant gives good accuracy in many languages. For images, SDXL-class models balance quality and memory. The gallery lists tested configurations for each.
Who should use it
LocalAI suits home-lab users who want one box for every AI feature, companies replacing OpenAI calls in existing software with an internal endpoint, and developers who need images and voice alongside text. If all you need is a chat model on a laptop, Ollama is the shorter path.
Related: Ollama stack, Hugging Face stack, OpenAI API stack, Docker stack, Stack index.
Frequently asked questions
What is the difference between LocalAI and Ollama?
Ollama is a focused, easy tool for running language models with a curated library. LocalAI is a broader server that also handles images, audio, embeddings and reranking, offers OpenAI and Anthropic-compatible endpoints, and can switch between backends such as llama.cpp and vLLM. Ollama is simpler; LocalAI covers more.
Does LocalAI need a GPU?
No. It runs on CPU, which is fine for small language models, embeddings and Whisper transcription. A GPU makes larger language models and image generation practical. LocalAI publishes container images for NVIDIA CUDA, AMD ROCm, Intel and Vulkan, and runs natively on Apple Silicon.
Can I use LocalAI with Open WebUI?
Yes. Add an OpenAI API connection in Open WebUI pointing at http://localai:8080/v1. Open WebUI will list LocalAI's models and can also use it for image generation and speech.
Is LocalAI free for commercial use?
LocalAI is MIT-licensed and free for commercial use. The models you run have their own licenses, which may restrict commercial use, so check each model card.
How do I install models in LocalAI?
Use the web UI's model gallery, run local-ai models install with a gallery name, or point to a Hugging Face or OCI URL. LocalAI downloads the model and the backend it needs, and writes a YAML config you can edit.