LocalAI — Run Any AI Model Locally, No GPU
LocalAI is an open-source AI engine running LLMs, vision, voice, and image models locally. 44.6K+ GitHub stars. OpenAI/Anthropic-compatible API, 35+ backends, MCP, agents. MIT licensed.
Installation avec revue préalable
Cet actif nécessite une revue. Le prompt copié demande un dry-run, affiche les écritures, puis continue seulement après confirmation.
npx -y tokrepo@latest install 34c0d47e-fb4c-442b-819c-9b6a5f921e13 --target codexDry-run d'abord, confirmez les écritures, puis lancez cette commande.
What it is
LocalAI is an open-source engine that runs large language models, vision models, voice synthesis, and image generation models on your local machine. It exposes an OpenAI-compatible API, so any application that calls OpenAI can point to LocalAI instead. It works on CPU, making it accessible to developers without GPU hardware.
The tool targets developers, privacy-conscious teams, and hobbyists who want to run AI models without sending data to external APIs. With 35+ model backends and MCP (Model Context Protocol) support, LocalAI covers a wide range of AI tasks.
How it saves time or tokens
LocalAI eliminates API costs entirely. Once a model is downloaded, inference runs on your hardware at zero marginal cost. For development and testing workflows where you iterate rapidly on prompts, this removes the financial friction of per-token pricing. The OpenAI-compatible API means zero code changes when switching from cloud to local.
How to use
- Install LocalAI via Docker or binary download.
- Download a model (GGUF, ONNX, or other supported format).
- Start the server and point your application's base URL to localhost.
# Run with Docker
docker run -p 8080:8080 --name localai \
-v ./models:/build/models \
localai/localai:latest
# Download a model
curl http://localhost:8080/models/apply -d '{
"url": "github:mudler/LocalAI/gallery/llama3.2-1b-instruct.yaml"
}'
# Query the OpenAI-compatible endpoint
curl http://localhost:8080/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{"model": "llama3.2-1b-instruct", "messages": [{"role": "user", "content": "Hello"}]}'
Example
# Use LocalAI with the OpenAI Python SDK
from openai import OpenAI
client = OpenAI(
base_url='http://localhost:8080/v1',
api_key='not-needed'
)
response = client.chat.completions.create(
model='llama3.2-1b-instruct',
messages=[{'role': 'user', 'content': 'Explain Docker in one paragraph.'}]
)
print(response.choices[0].message.content)
Related on TokRepo
- LocalAI on TokRepo — Detailed LocalAI configurations and model galleries
- Ollama local LLM — Compare LocalAI with Ollama for local model serving
Common pitfalls
- CPU inference is slow for large models (7B+ parameters). Quantized GGUF models (Q4_K_M) are the sweet spot for CPU speed vs quality.
- Docker images are large (several GB) because they bundle multiple backends. Use the minimal image if you only need one backend.
- Model download can take significant time and disk space. Pre-download models before demos or offline usage.
Questions fréquentes
Yes. LocalAI runs models on CPU using backends like llama.cpp and ONNX Runtime. Performance depends on model size and quantization. A 1-3B parameter model in Q4 quantization runs reasonably fast on modern CPUs. Larger models benefit from GPU acceleration if available.
Both run models locally with OpenAI-compatible APIs. LocalAI supports more model types (vision, voice, image generation) and more backends (35+). Ollama is simpler to set up and focuses primarily on text LLMs. Choose LocalAI for multi-modal needs, Ollama for quick text model serving.
Yes. Any tool that supports OpenAI-compatible API endpoints can use LocalAI by changing the base URL to your LocalAI server. MCP support also enables integration with AI agents that use the Model Context Protocol.
LocalAI supports GGUF (via llama.cpp), ONNX, PyTorch, TensorFlow, and various other formats through its 35+ backends. GGUF is the most common format for local LLM inference due to its quantization support and CPU efficiency.
LocalAI can serve production workloads for internal tools and edge deployments. For high-throughput public APIs, dedicated GPU serving frameworks like vLLM or SGLang may perform better. LocalAI is best suited for development, testing, privacy-sensitive deployments, and resource-constrained environments.
Sources citées (3)
- LocalAI GitHub— LocalAI runs AI models locally with OpenAI-compatible API and 35+ backends
- LocalAI Documentation— LocalAI documentation for installation and model management
- llama.cpp GitHub— GGUF format for efficient CPU inference via llama.cpp
En lien sur TokRepo
Source et remerciements
Created by Ettore Di Giacinto. Licensed under MIT. mudler/LocalAI — 44,600+ GitHub stars
Fil de discussion
Actifs similaires
Jan — Run AI Models Locally on Your Desktop
Open-source desktop app to run LLMs offline. Jan supports Llama, Mistral, and Gemma models with one-click download, OpenAI-compatible API, and full privacy.
Replicate — Run AI Models via Simple API Calls
Cloud platform to run open-source AI models with a simple API. Replicate hosts Llama, Stable Diffusion, Whisper, and thousands of models — no GPU setup or Docker required.
Minikube — Run Kubernetes Locally on Any OS
Runs a single-node Kubernetes cluster on your laptop so you can try Kubernetes features without a cloud bill.
Directus — Open Source Backend & Headless CMS for Any Database
Directus wraps any SQL database with instant REST & GraphQL APIs, an admin app, auth, file storage, and automation — no migration or proprietary schema needed.