vLLM vs Ollama vs llama.cpp at a Glance
| Feature | vLLM | Ollama | llama.cpp |
|---|---|---|---|
| Best for | Many users at once on GPUs | Quickest setup, one user or a small team | Full control, CPU or CPU + GPU |
| Licence | Apache 2.0 | MIT | MIT |
| Models | Hugging Face models; FP8, MXFP4, AWQ, GPTQ, GGUF and more | The Ollama model library | GGUF files, from Hugging Face with -hf |
| Processor only | Supported, GPU-first design | Yes | Yes |
| Several GPUs | Tensor, pipeline, data and expert parallelism | Spreads a model across GPUs | Split by layer or tensor (--split-mode) |
| Many users at once | Continuous batching, prefix caching | One request per model by default (OLLAMA_NUM_PARALLEL) | Server slots (--parallel), continuous batching on |
| API key | --api-key or VLLM_API_KEY | None built in | --api-key or LLAMA_API_KEY |
| Default address | Port 8000 | 127.0.0.1:11434 | 127.0.0.1, set the port with --port |
Sources: the vLLM documentation, Ollama's FAQ and the llama-server README.
Which One Should You Choose?
- Trying models, a private chat, a few users: Ollama. One command installs it as a service, another downloads and runs a model. Put Open WebUI in front for a ChatGPT-style interface.
- A server with no GPU, or a GPU too small for the model: llama.cpp. It runs 4-bit GGUF models on the processor, and
--n-cpu-moekeeps a mixture-of-experts model's expert weights in system memory while the rest runs on the GPU. See running an LLM on a CPU server. - An API for an app with many users: vLLM. Continuous batching serves many requests together, and vLLM reserves the GPU memory left after the weights for the conversation cache, so spare memory means more users at once. See serving an LLM API on a GPU server.
- Agent workloads and large-scale serving: SGLang is worth testing next to vLLM. It is an Apache 2.0 serving framework for language and multimodal models, aimed at agentic workloads and large-scale serving, and runs on NVIDIA and AMD GPUs among others (SGLang on GitHub).
Whichever you choose, the model has to fit: check how much VRAM a model needs and whether a GPU or a CPU server is the better buy.
Ollama: Install and Run a Model
curl -fsSL https://ollama.com/install.sh | sh ollama run gemma4 # OpenAI-compatible API: http://127.0.0.1:11434/v1
Ollama listens on 127.0.0.1:11434 and has no API key, so keep it there and reach it over an SSH tunnel or through a proxy that checks a key. Its server settings are environment variables; add them with sudo systemctl edit ollama.service:
[Service] Environment="OLLAMA_NUM_PARALLEL=4" Environment="OLLAMA_CONTEXT_LENGTH=8192" Environment="OLLAMA_KEEP_ALIVE=-1"
OLLAMA_CONTEXT_LENGTH defaults to 4096 tokens, and models unload after 5 minutes idle unless OLLAMA_KEEP_ALIVE says otherwise. Run sudo systemctl daemon-reload && sudo systemctl restart ollama after editing.
llama.cpp: Run llama-server
Install llama.cpp from its releases or build it as the README describes, with CUDA if you have an NVIDIA GPU. Then start the server with a model from Hugging Face:
llama-server -hf ggml-org/gpt-oss-20b-GGUF --jinja \ -c 32768 --parallel 4 \ --host 127.0.0.1 --port 8080 \ --api-key "$(openssl rand -hex 24)"
-ngl sets how many layers go to the GPU (auto by default), --n-cpu-moe N keeps the experts of the first N layers on the CPU, and the built-in chat page is on the same address. The gpt-oss guide shows these flags on a real model.
vLLM: Serve an OpenAI-Compatible API
Install vLLM with the quickstart (it needs Python 3.11 or newer), or use the vllm/vllm-openai Docker image. Then:
vllm serve Qwen/Qwen2.5-1.5B-Instruct --api-key "$(openssl rand -hex 24)" # listening on http://localhost:8000/v1
Test Any of Them the Same Way
Only the port, the key and the model name change:
curl http://127.0.0.1:8000/v1/chat/completions \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "Qwen/Qwen2.5-1.5B-Instruct",
"messages": [{"role": "user", "content": "Say hello in five words."}]}'To give several apps or people their own keys and budgets across all your engines, put a LiteLLM proxy in front.