Skip to content

LocalAI Guide (2026): Install, Run Models and Use the OpenAI-Compatible API

8–11 minutes
Excited woman with long dark wavy hair in a royal-blue top in a green-lit tropical greenhouse holding a card reading LOCALAI, with the text LocalAI Own AI Server

LocalAI is a free, open source server that runs AI models on your own computer and answers with the same API as OpenAI. Any app that can talk to ChatGPT’s API can talk to LocalAI instead, with nothing leaving your machine.

It goes well beyond chat. LocalAI handles text, vision, speech to text, text to speech, images, video, music, embeddings and reranking, all through one address. Version 5.0, released in November 2026, also added Projects, a desktop app and add-ons.

This guide shows how to install LocalAI on Linux, Mac, Windows or Docker, load your first model, call the API, turn on the GPU, lock it down with API keys and fix the common errors. It follows the official LocalAI README and docs as of November 2026.

TL;DR

  • What: a free, MIT-licensed local AI server with OpenAI- and Anthropic-compatible APIs.
  • Install (Linux/Mac): curl -sSL https://localai.io/install.sh | sh, then run local-ai.
  • Install (Windows): irm https://localai.io/install.ps1 | iex in PowerShell.
  • Docker: docker run -ti --name local-ai -p 8080:8080 localai/localai:latest.
  • Web UI and API: both on http://localhost:8080.
  • First model: local-ai run gemma-4-e2b-it-qat-q4_0 (about 4.3 GB, runs on a CPU).
  • Before sharing it: set LOCALAI_API_KEY or LOCALAI_AUTH=true.

What LocalAI Is

LocalAI was created by Ettore Di Giacinto and is released under the MIT license. It runs on a laptop, a server, in a container or on Kubernetes.

  • One API for many model types: chat, vision, speech to text, text to speech, images, video, music and sound, embeddings and reranking.
  • OpenAI and Anthropic formats: point an OpenAI SDK, or a client built for Claude’s Messages API, at your own server.
  • 80+ backends: llama.cpp, vLLM, transformers, whisper.cpp, MLX and many more. Each backend downloads only when a model needs it.
  • Any hardware: NVIDIA (CUDA 12 and 13), AMD (ROCm), Intel (oneAPI), Apple Silicon (Metal), Vulkan, NVIDIA Jetson or CPU only.
  • Built-in web UI: chats, a model gallery, agents, files and settings.

No GPU is needed. A GPU just makes replies faster.

LocalAI vs Ollama and LM Studio

Feature LocalAI Ollama LM Studio
License MIT, open source MIT, open source Free app, closed source
Main focus All-in-one API server Simple LLM runner Desktop chat app
Images, speech, video Yes, built in Mostly text and vision Mostly text and vision
OpenAI-compatible API Yes Yes Yes
Anthropic-style API Yes Yes Check current docs
Teams and user roles Yes (auth mode) No No
Best for Replacing several cloud APIs at once Quick model runs Beginners who want a GUI

If you only want to chat with one model, LM Studio is easier. Pick LocalAI when you want one server that also does speech, images and embeddings for your apps.

Install LocalAI

Linux and Apple Silicon Mac

  1. Run the install script. It downloads the release binary for your machine and checks it against the release checksums.
    curl -sSL https://localai.io/install.sh | sh
  2. Fix your PATH if asked. If the script says the folder isn’t on your PATH, run the export line it prints.
  3. Start the server. The script installs LocalAI but doesn’t start it.
    local-ai
  4. Check the log. Look for LocalAI is started and running with the address :8080.
  5. Open the web UI at http://localhost:8080.

Windows

LocalAI runs natively on Windows 10 and 11 (amd64 only, no arm64 build). You don’t need WSL or Docker Desktop.

  1. Open PowerShell as your normal user. No admin rights are needed.
  2. Run the script:
    irm https://localai.io/install.ps1 | iex
  3. Prefer to read it first? Download it, inspect it, then run it:
    irm https://localai.io/install.ps1 -OutFile install.ps1
    Get-Content .\install.ps1
    powershell -ExecutionPolicy Bypass -File .\install.ps1
  4. Install ffmpeg if you’ll use audio features: winget install Gyan.FFmpeg.
  5. Start it with local-ai.exe run.

On Windows, only the llama.cpp backend has native support so far. For other backends, use Docker or a Linux machine.

Desktop app

The 5.0 release added a desktop app for macOS and Linux. It installs, updates, starts and stops the server for you and shows the web UI in its own window. The Windows docs also point to a desktop app with a tray icon. Download it from the latest GitHub release.

Run LocalAI in Docker (CPU and GPU)

Docker is the easiest route on an Intel Mac or a server. The CPU image:

docker run -ti --name local-ai -p 8080:8080 localai/localai:latest

To restart the same container later, use docker start -i local-ai. For a GPU, pick the image that matches your hardware:

Hardware Image tag Extra flags
CPU only localai/localai:latest None
NVIDIA, CUDA 12 latest-gpu-nvidia-cuda-12 --gpus all
NVIDIA, CUDA 13 latest-gpu-nvidia-cuda-13 --gpus all
AMD (ROCm) latest-gpu-hipblas --device=/dev/kfd --device=/dev/dri --group-add=video
Intel (oneAPI) latest-gpu-intel --device=/dev/dri/card1 --device=/dev/dri/renderD128
Vulkan latest-gpu-vulkan Device flags for your GPU

For example, on an NVIDIA RTX card:

docker run -ti --name local-ai -p 8080:8080 --gpus all localai/localai:latest-gpu-nvidia-cuda-12

New to GPUs in containers? Our Ollama in Docker with GPU guide covers installing the NVIDIA Container Toolkit, which LocalAI needs too.

Load Your First Model

From the web UI

  1. Open http://localhost:8080.
  2. Accept the suggested model on the first-run card, or open Models, then Explore.
  3. Search for gemma-4-e2b-it-qat-q4_0 and choose Install. It’s a small Google Gemma 4 model that runs on a CPU and can read images.
  4. Open Chats, pick the model and send a message. The first reply is slower because the model has to load.

From the command line

Name a model after run and LocalAI downloads it before starting the API:

local-ai run gemma-4-e2b-it-qat-q4_0
local-ai run llama-3.2-1b-instruct:q4_k_m

You can also pull models from other places:

Source Example
Model gallery local-ai run gemma-4-e2b-it-qat-q4_0
Hugging Face local-ai run huggingface://TheBloke/phi-2-GGUF/phi-2.Q8_0.gguf
Ollama registry local-ai run ollama://gemma:2b
OCI registry local-ai run oci://localai/phi-2:latest

To browse or install without starting the server, use local-ai models list and local-ai models install <name>. Not sure which model fits your PC? See how much RAM you need for local AI.

Use the OpenAI-Compatible API

Any OpenAI SDK or client works when you point it at http://localhost:8080. A quick test with curl:

curl http://localhost:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemma-4-e2b-it-qat-q4_0",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

The reply text is in choices[0].message.content. In Python, set the base URL on the normal OpenAI client:

from openai import OpenAI
client = OpenAI(base_url="http://localhost:8080/v1", api_key="not-needed")
r = client.chat.completions.create(
    model="gemma-4-e2b-it-qat-q4_0",
    messages=[{"role": "user", "content": "Explain RAG in one line"}])
print(r.choices[0].message.content)

If you turned on API keys, send Authorization: Bearer <your-key> and use the real key in api_key. LocalAI also speaks the Anthropic Messages API and the Open Responses API.

LocalAI also offers a terminal agent that talks to a running server. It asks you to approve anything that changes state:

local-ai chat --model gemma-4-e2b-it-qat-q4_0

GPU Acceleration

When you install a model, LocalAI detects your hardware and downloads the matching backend. Most people don’t need to configure anything.

  • Force a backend type: set LOCALAI_FORCE_META_BACKEND_CAPABILITY to default (CPU), nvidia, amd or intel.
  • Offload layers: in a model’s YAML config, gpu_layers sets how many llama.cpp layers go to the GPU.
  • Pick GPUs: use CUDA_VISIBLE_DEVICES=0,1 on NVIDIA or HIP_VISIBLE_DEVICES on AMD.
  • Several NVIDIA GPUs: llama.cpp spreads layers across them automatically.

A minimal model YAML with GPU offload looks like this:

name: my-model
parameters:
  model: my-model-Q4_K_M.gguf
context_size: 8192
gpu_layers: 99

Agents, Projects and Add-ons

LocalAI 5.0 turned the server into a small team workspace:

Feature What it does
Chats and agents Saved agents with instructions, tools, MCP servers, skills and files
Projects Group chats, files, notes and agents around one piece of work
Add-ons Office, Sandbox, Tables, chat apps, mail and calendar, installed from a library
Team features Users, roles, quotas and shared folders (some in development builds)
Distributed mode Spread models over several machines (PostgreSQL + NATS, or P2P)

To build an agent, install a model that supports tool calling, open Agents, choose New agent, add a name and instructions, then chat with it. If it never calls a tool, try a larger model.

Secure LocalAI Before You Expose It

The quickstart warns that LocalAI listens on port 8080 on all network interfaces. Don’t open that port to the internet without protection.

  • Single key: start with LOCALAI_API_KEY=your-key. Note that API keys give full admin access with no role separation.
  • Users and roles: start with LOCALAI_AUTH=true for admin and user roles, OAuth login, per-user API keys and usage tracking.
  • Stay updated: 4.12.1 fixed a security issue with user-supplied URLs, so keep up with new releases.

Where LocalAI Keeps Its Files

Folder Windows default Override
Models %LOCALAPPDATA%\LocalAI\models LOCALAI_MODELS_PATH
Backends %LOCALAPPDATA%\LocalAI\backends LOCALAI_BACKENDS_PATH
Data (chats, files) %LOCALAPPDATA%\LocalAI\data LOCALAI_DATA_PATH
Configuration %LOCALAPPDATA%\LocalAI\configuration LOCALAI_CONFIG_DIR

Running the uninstall option of the Windows script removes the program but keeps your models and settings in that folder.

Troubleshooting

Problem Likely cause Fix
local-ai: command not found Install folder not on PATH Run the export line the script printed, or open a new terminal
Web UI won’t open Server not started, or port 8080 in use Run local-ai and check the log, or map another port in Docker (-p 9090:8080)
Very slow replies Running on CPU Use a GPU image, or a smaller quantized model
GPU not used in Docker Missing --gpus all or device flags Use the GPU image tag plus the flags in the table above
Wrong backend downloaded Hardware detection missed your GPU Set LOCALAI_FORCE_META_BACKEND_CAPABILITY
Out of memory when loading Model too big for VRAM Lower gpu_layers or context_size, or use a smaller quant
Audio features fail on Windows ffmpeg missing winget install Gyan.FFmpeg or set LOCALAI_FFMPEG_PATH
401 Unauthorized API key turned on Send Authorization: Bearer <key>
Agent never uses tools Model lacks tool calling Switch to a larger model that supports tools

For memory errors, see our CUDA out of memory fix. Prefer a lighter server for plain GGUF chat? Try the llama-server guide or llama-swap for model switching.

FAQ

Is LocalAI free?

Yes. LocalAI is open source under the MIT license. The LocalAI name and logo are not covered by that license.

Does LocalAI need a GPU?

No. It runs on a CPU. A GPU from NVIDIA, AMD, Intel or Apple Silicon makes it much faster.

What port does LocalAI use?

8080 by default, for both the web UI and the API.

Is LocalAI a drop-in replacement for the OpenAI API?

For most apps, yes. Set the base URL to http://localhost:8080/v1 and use a model name you installed.

Can LocalAI generate images and speech?

Yes. It supports image and video generation, text to speech, speech to text, music and sound effects through backends that download on demand.

Does LocalAI work on Windows without Docker?

Yes, on Windows 10 or 11 amd64 with the PowerShell installer. Only the llama.cpp backend is native on Windows so far.

Can I use Ollama models in LocalAI?

Yes. Use local-ai run ollama://model:tag to pull from the Ollama registry.

How do I update LocalAI?

Run the install script again, or pull the newest Docker image and recreate the container.

Sources

Free weekly email

Get new AI guides every week

One short weekly email with our newest local AI, ComfyUI and AI tool guides. No spam, no pop-ups, just the good stuff.

Free. Unsubscribe anytime in one click. We only use your email to send this newsletter. See our privacy policy.

Excited woman with long dark wavy hair in a royal-blue top in a green-lit tropical greenhouse holding a card reading LOCALAI, with the text LocalAI Own AI Server