Skip to content
AISeeker

Search

Search reports, topics, companies…

CH.05Tutorials
3 min read
Signal strength: 3/5Important
Verified · 6 Sources

Serving open-weight models: Ollama on the laptop, vLLM on the GPU server

Run open-weight LLMs behind an OpenAI-compatible API: Ollama for local prototyping, vLLM for multi-user GPU serving, plus the defaults that bite in production.

Key figures

0.34.0
vLLM release used (Nov 16)
4,096
Ollama default context (tokens)

Open-weight models are now good enough that many teams want to run some traffic themselves, for privacy, cost predictability or offline use. Two open-source servers cover most needs. Ollama makes a model run on a laptop or workstation in minutes. vLLM is built for throughput on GPU servers with many concurrent users. Both speak the OpenAI API, which means you can prototype on one and deploy on the other without rewriting application code. This tutorial sets up each, shows a shared client, and lists the defaults that cause trouble. Versions: vLLM 0.34.0 (released 16 November 2026) and Ollama 0.40.x.

Which one, when

OllamavLLM
Typical homeLaptop, workstation, small internal boxLinux GPU server or cluster
HardwaremacOS, Windows, LinuxNVIDIA, AMD, Intel and TPU backends; Apple Silicon via vLLM-Metal
Default endpointhttp://localhost:11434/v1http://localhost:8000/v1
Models fromollama pull from Ollama's libraryHugging Face (or ModelScope)
ConcurrencyOLLAMA_NUM_PARALLEL (1 by default on most backends)Designed for many simultaneous requests
AuthNone built in; bound to 127.0.0.1 by default--api-key or VLLM_API_KEY

1. Ollama: the five-minute path

bash
curl -fsSL https://ollama.com/install.sh | sh     # Linux; macOS/Windows use the installer
ollama pull gpt-oss:20b
ollama run gpt-oss:20b "Summarise what a KV cache is in two sentences."

When Ollama runs as a systemd service on Linux, configure it with environment variables: run sudo systemctl edit ollama, add lines such as Environment="OLLAMA_CONTEXT_LENGTH=16384" under [Service], then restart. The variables worth knowing:

  • OLLAMA_CONTEXT_LENGTH: the default context is 4,096 tokens, which silently truncates long RAG prompts.
  • OLLAMA_HOST: the bind address, 127.0.0.1:11434 by default.
  • OLLAMA_KEEP_ALIVE: models unload after five minutes idle; raise it to avoid cold starts.
  • OLLAMA_NUM_PARALLEL and OLLAMA_MAX_LOADED_MODELS: concurrency per model and models kept in memory.

The OpenAI-compatible API cannot set context size per request. If one app needs a larger window, create a model variant with PARAMETER num_ctx 16384 in a Modelfile and ollama create it under a new name.

2. vLLM: a GPU server for many users

On a Linux machine with a supported GPU (vLLM supports Python 3.11 to 3.14):

bash
uv venv --python 3.12 --seed && source .venv/bin/activate
uv pip install vllm --torch-backend=auto
vllm download-kernels

export VLLM_API_KEY="change-me"
vllm serve Qwen/Qwen2.5-1.5B-Instruct \
  --served-model-name assistant \
  --max-model-len 16k \
  --enable-auto-tool-choice --tool-call-parser hermes

--torch-backend=auto lets uv pick the PyTorch build that matches your CUDA driver, and vllm download-kernels fetches precompiled kernels so startup is faster. The small Qwen model is a smoke test; swap in the model you actually need and add --tensor-parallel-size 2 (or -tp 2) to split it across two GPUs. --served-model-name gives clients a stable name, so you can change the underlying model without touching application code. Tool calling only works with --enable-auto-tool-choice plus the right --tool-call-parser for the model family (hermes covers Qwen2.5); without a parser, requests that force a tool return HTTP 400.

If you are upgrading an older deployment, read the 0.34 notes first. The extensible KV cache is now on by default and sizes itself from memory left after warmup, so the project advises removing gpu_memory_utilization from most configs. The default block size changed from 16 to 64, and the old V1 model runner is gone.

3. One client for both

python
import os
from openai import OpenAI

client = OpenAI(base_url=os.environ["LLM_BASE_URL"],
                api_key=os.environ.get("LLM_API_KEY", "unused"))
resp = client.chat.completions.create(
    model=os.environ["LLM_MODEL"],
    messages=[{"role": "user", "content": "Give me three test cases for a date parser."}],
)
print(resp.choices[0].message.content)

Point it at Ollama with LLM_BASE_URL=http://localhost:11434/v1 and LLM_MODEL=gpt-oss:20b (the key is required by the client but ignored), or at vLLM with LLM_BASE_URL=http://gpu-box:8000/v1, LLM_MODEL=assistant and the real key. Both servers also offer /v1/embeddings and a /v1/responses endpoint, with Ollama supporting only its stateless form.

Production pitfalls

  • Partial authentication. vLLM's --api-key protects only the /v1, /v2, /inference and /cohere prefixes; other routes stay open. Put the server behind a reverse proxy and never expose it directly.
  • Exposing Ollama. Setting OLLAMA_HOST=0.0.0.0 publishes an unauthenticated API to your network. Use a proxy with auth if others need access.
  • Surprise sampling defaults. vLLM applies a model's generation_config.json if the repository ships one, overriding your defaults. Pass --generation-config vllm if you want vLLM's own.
  • Context versus memory. A larger --max-model-len reserves more KV cache; start with what your prompts need, not the model's maximum.
  • Unpinned upgrades. Both projects ship often, and vLLM 0.34 alone changed several defaults. Pin versions and benchmark on your own prompts before rolling forward.

Next steps

Prototype on Ollama, write an eval set, then move the same client to vLLM and measure throughput and latency under realistic concurrency before committing hardware.

Researched and drafted with AI assistance under editorial review. Report errors to support@aiseeker.dev.

Sources

This report synthesises the sources below. Primary sources are marked.

  1. [1]
    Quickstart

    vLLM Docs2026.11.28Primary

  2. [2]
    vllm serve

    vLLM Docs2026.11.28Primary

  3. [3]
    Tool Calling

    vLLM Docs2026.11.28Primary

  4. [4]
    vLLM v0.34.0

    vLLM (GitHub Releases)2026.11.16Primary

  5. [5]
    OpenAI compatibility

    Ollama Docs2026.11.28Primary

  6. [6]
    FAQ

    Ollama Docs2026.11.28Primary

Back to Tutorials →