Ollama
Ollama is the most beginner-friendly local inference engine. It installs in one command, works on CPU and GPU, and exposes an OpenAI-compatible endpoint automatically. It has a large built-in model library and a simple CLI for pulling and running models.
Installation
# macOS
brew install ollama
# Linux
curl -fsSL https://ollama.com/install.sh | sh
# Start the server
ollama serve
Pull and run a model
# Pull a model
ollama pull llama3.2
# Run interactively
ollama run llama3.2
# The OpenAI-compatible endpoint is at:
# http://localhost:11434/v1
Test with curl
curl http://localhost:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "llama3.2",
"messages": [{"role": "user", "content": "Hello from Ollama"}],
"stream": false
}'
vLLM
vLLM is the fastest inference engine for GPU servers. It uses PagedAttention for efficient memory management, continuous batching for high throughput, and supports tensor parallelism across multiple GPUs. Best for production-like local deployments.
Installation
# Install via pip (requires CUDA)
pip install vllm
# Start the server with a model
python -m vllm.entrypoints.openai.api_server \
--model meta-llama/Llama-3.2-3B-Instruct \
--tensor-parallel-size 1 \
--max-model-len 8192 \
--host 0.0.0.0 \
--port 8000
Test with curl
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "meta-llama/Llama-3.2-3B-Instruct",
"messages": [{"role": "user", "content": "Hello from vLLM"}]
}'
LM Studio
LM Studio provides a graphical interface for downloading and running GGUF models. It is the best option for users who prefer a GUI over the command line. Built-in chat interface and local API server with one click.
Setup
- Download LM Studio from lmstudio.ai
- Search and download a model from the built-in model browser
- Go to the Server tab and click Start Server
- The endpoint is at
http://localhost:1234/v1
Test with curl
curl http://localhost:1234/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "your-model-name",
"messages": [{"role": "user", "content": "Hello from LM Studio"}]
}'
llama.cpp
llama.cpp is a C++ implementation of LLM inference optimized for CPU and Apple Silicon. It supports Metal acceleration on macOS, offers the best CPU inference performance, and gives fine-grained control over quantization, context size, and batching.
Installation
# Clone and build
git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp
make
# Or with Metal support (macOS)
LLAMA_METAL=1 make
# Start the server
./server -m models/llama-3.2-3b-instruct.Q4_K_M.gguf \
--host 0.0.0.0 \
--port 8080 \
--ctx-size 8192
Test with curl
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "llama-3.2-3b-instruct",
"messages": [{"role": "user", "content": "Hello from llama.cpp"}]
}'
LocalAI
LocalAI is a Docker-first local inference engine that emulates the full OpenAI API surface — including embeddings, image generation, audio transcription, and text-to-speech — in addition to chat completions. It wraps multiple backends (llama.cpp, transformers, diffusers) under one API.
Installation (Docker)
docker run -p 8080:8080 \
-v $PWD/models:/models \
localai/localai:latest-gpu-nvidia-cuda-12 \
/bin/bash -c "local-ai run"
Test with curl
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4",
"messages": [{"role": "user", "content": "Hello from LocalAI"}]
}'
Engine comparison
| Engine | Best for | GPU required | Setup difficulty | OpenAI compatibility |
|---|---|---|---|---|
| Ollama | Beginners, fast prototyping | No (CPU ok) | Very easy | Full |
| vLLM | High throughput, production-like testing | Yes | Advanced | Full |
| LM Studio | GUI users, chat experimentation | Recommended | Very easy | Full |
| llama.cpp | CPU/Apple Silicon optimization | No | Moderate | Full |
| LocalAI | Full OpenAI emulation (vision, audio, embeddings) | Optional | Moderate (Docker) | Extended |
| SGLang | Structured output, advanced scheduling | Yes | Advanced | Full |
Testing your API
Once your engine is running, verify the endpoint with a simple curl command. All engines expose the same /v1/chat/completions endpoint:
# Universal test — works with any engine
curl $BASE_URL/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "$MODEL_NAME",
"messages": [{"role": "user", "content": "Say hello in 5 words"}]
}'
Expected response: a JSON object with choices[0].message.content containing the model's reply. Streaming works by adding "stream": true — the response becomes a series of SSE events.
Python example
Here is the same code running against four different local engines — and Plugsky. Only the base_url and model change:
from openai import OpenAI
# Ollama
client = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")
r = client.chat.completions.create(model="llama3.2", messages=[{"role":"user","content":"Hi"}])
# vLLM
client = OpenAI(base_url="http://localhost:8000/v1", api_key="vllm")
r = client.chat.completions.create(model="meta-llama/Llama-3.2-3B-Instruct", messages=[{"role":"user","content":"Hi"}])
# LM Studio
client = OpenAI(base_url="http://localhost:1234/v1", api_key="lm-studio")
r = client.chat.completions.create(model="local-model", messages=[{"role":"user","content":"Hi"}])
# llama.cpp
client = OpenAI(base_url="http://localhost:8080/v1", api_key="llamacpp")
r = client.chat.completions.create(model="llama-3.2-3b-instruct", messages=[{"role":"user","content":"Hi"}])
# Plugsky (production)
client = OpenAI(base_url="https://api.plugsky.com/v1", api_key="sk-live-...")
r = client.chat.completions.create(model="plugsky-pro", messages=[{"role":"user","content":"Hi"}])
print(r.choices[0].message.content)
Migration to Plugsky
When your local setup hits limits — team access, uptime, multi-model access, audit logging, or scaling beyond a single GPU — the migration path is trivial:
- Same code. Your application uses the OpenAI SDK. No framework changes, no new SDK, no rewrites.
- Change two values:
base_urltohttps://api.plugsky.com/v1andmodelto a Plugsky model likeplugsky-pro. - Test on free tier. Plugsky's free tier gives you unlimited requests to
plugsky-microandplugsky-lite— no credit card, no commitment. - Graduate. Switch to a paid plan when you need team access, higher rate limits, frontier models, SLAs, or data residency.
Your code stays exactly the same. The same request body, the same response shape, the same streaming format, the same error codes. Migration is a configuration change, not an engineering project.
Build locally, deploy globally
Develop against any local engine with the OpenAI SDK. Deploy to Plugsky with a two-line config change. Same code, same tools, zero rework.
Start Free → Back to Local AI →