vLLM or Ollama
| Aspect | vLLM | Ollama |
|---|---|---|
| Best for | Many users and requests at once | One or a few users, quick setup |
| Model format | Hugging Face models (16-bit and quantized) | GGUF builds from its library, mostly 4-bit |
| Throughput under load | High: requests are batched together | Lower: built for simplicity |
| API | OpenAI-compatible, port 8000 | Its own and OpenAI-compatible, port 11434 |
| Needs | NVIDIA GPU, compute capability 7.5+ | Runs on GPU or CPU |
Start with the NVIDIA driver and Container Toolkit, and check the model fits with how much VRAM a model needs.
1. Run vLLM in Docker
openssl rand -hex 24 > ~/.vllm-key # your API key
export HF_TOKEN=hf_... # only for gated models
docker run -d --name vllm --restart unless-stopped \
--runtime nvidia --gpus all \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=$HF_TOKEN" \
-p 127.0.0.1:8000:8000 \
--ipc=host \
vllm/vllm-openai:latest \
--model Qwen/Qwen3-8B \
--api-key "$(cat ~/.vllm-key)"
docker logs -f vllm # wait until the server reports it is readyThe first start downloads the model. --ipc=host gives vLLM the shared memory it needs. With several GPUs, add --tensor-parallel-size 2 (or the number of GPUs) to split the model across them.
2. Test the API
curl http://127.0.0.1:8000/v1/chat/completions \
-H "Authorization: Bearer $(cat ~/.vllm-key)" \
-H "Content-Type: application/json" \
-d '{"model": "Qwen/Qwen3-8B", "messages": [{"role": "user", "content": "Say hello"}]}'
curl -H "Authorization: Bearer $(cat ~/.vllm-key)" http://127.0.0.1:8000/v1/modelsFrom code, use any OpenAI client with the base URL set to your server's /v1 address and the key above. /health answers without a key, for monitoring.
3. Or Use Ollama
curl -fsSL https://ollama.com/install.sh | sh ollama pull llama3.1:8b ollama run llama3.1:8b "Say hello" nvidia-smi # the ollama process should be using the GPU
Ollama runs as a service and answers on port 11434 on the server itself, with an OpenAI-compatible API under /v1. It has no API keys of its own, so never open that port to the internet; put it behind a proxy that checks a key, or reach it over a VPN.
4. Put HTTPS in Front
sudo apt install -y caddy
sudo tee /etc/caddy/Caddyfile >/dev/null <<'EOF'
llm.example.com {
reverse_proxy 127.0.0.1:8000
}
EOF
sudo systemctl reload caddyPoint llm.example.com at the server and allow ports 80 and 443. Docker opens published ports past ufw, which is why the commands above bind to 127.0.0.1; see why ufw does not block Docker ports. For a team on fixed addresses, a WireGuard VPN keeps the API off the internet altogether.
Keeping It Running
- Watch the GPU with
nvidia-smiand the engine's logs; vLLM also exposes/metricsfor Prometheus. - Pin an image version once it works, and update deliberately: new releases can need a newer driver.
- Prompts and answers stay on your server; keep its logs to what you need.
No GPU yet? Small and quantized models also run on the processor; see running an LLM on a CPU server.