LocalAI CLI Cheatsheet - local-ai Self-hosted Inference Server Full Reference

Plenty of teams want to keep using the OpenAI SDK without shipping code off the network, and LocalAI is the swap-in path: point base_url at localhost and models, embeddings, and speech all stay on your own machine. This table groups service startup, model management, and API and fine-tuning, explaining the difference between run and serve under the local-ai entry point, how the models subcommands install and list what you have, and how the fine-tuning endpoints are called. The deciding variable is the match between hardware and model size: whether it runs without a GPU depends on parameter count and quantization level, not on LocalAI itself, so validate the whole chain with a few-hundred-megabyte quantized model before attempting anything larger. Reach for it when compliance requires data to stay inside the network, when a development environment must reproduce a model behavior offline, or when routing between a small local model and a large hosted one. Against GPU-only serving stacks such as vLLM, it behaves more like a local AI gateway with model management and multimodal support built in.

AI CLI·20 commands·Last updated 2026-09-10

Start Server 6

local-ai run
Start with default config
local-ai serve
Start the API server (same as run)
docker run -p 8080:8080 localai/localai
Run via Docker
local-ai start
Start resources from a file
local-ai --help
List all commands
local-ai serve --models-path ./models
Start with a custom model dir

Model Management 7

local-ai models list
List installed models
local-ai models install gpt4all
Install a gallery model
local-ai models pull gpt4all
Pull a model from the repo
local-ai models install llama-3-instruct
Install a named model
local-ai models apply
Apply model configuration
local-ai models list --help
models subcommand help
local-ai models install --help
Install flags

API and Finetune 7

local-ai api
Start the API service
curl http://localhost:8080/v1/chat/completions -d '{"model":"gpt4all","messages":[{"role":"user","content":"hi"}]}'
Call chat completions
curl http://localhost:8080/v1/models
List available models
local-ai finetune
Start a finetune job
local-ai api --help
api help
curl http://localhost:8080/v1/embeddings -d '{"input":"text"}'
Call embeddings
local-ai models apply --help
apply help

Tips

  • LocalAI is OpenAI-compatible; point an existing project base_url at port 8080 to go private.
  • It runs without a GPU: smaller quantized models still give basic completion on CPU.
  • models install pulls from the gallery; put custom weights in --models-path for easier management.

FAQ

How to choose between LocalAI and Ollama?

LocalAI focuses on OpenAI-compatible self-hosting (with embeddings and audio) and richer config; Ollama is lighter and quicker to start. Both run local models.

Can it run without a GPU?

Yes. LocalAI supports pure CPU inference, slower but workable with small quantized models.

Official References

Each command links to its official documentation below, so you can verify the latest usage and read deeper.

Maintained by LaoHand

Publicly updated on Sep 10, 2026, continuously proofread against official docs.

Contact Us

Wrong command or description? Send us corrections, business inquiries or product feedback by email.

Contact Us