← All sessions, cheat sheets & labs
Week 3 · Field guide · Self-hosted serving

vLLM & Ollama

Two ways to run open-weight models yourself: Ollama for dead-simple local development, vLLM for high-throughput production serving, both behind an OpenAI-compatible endpoint.

self-hosted servingopen sourceopen-weight models

What it is

Your laptop, or your production GPUs.

These are two ways to run open-weight models on your own hardware. Ollama is a dead-simple local runner for development and prototyping: install it, pull a model, and it is serving. vLLM is a high-throughput production inference server, with paged attention and continuous batching, built to serve many concurrent requests at scale. They sit at opposite ends of the same job, and both expose OpenAI-compatible endpoints, so your client code does not change between them.

The one job

Serve open models yourself.

Run open-weight models on your own infrastructure: Ollama on your laptop for development, vLLM for production throughput. Same models, same API shape, sized to the moment you are in.

Reach for it when

Skip it when

A minimal look

Point the same client at localhost.

import OpenAI from "openai";

// Ollama (11434) or vLLM (8000): both speak the OpenAI API
const client = new OpenAI({
  baseURL: "http://localhost:11434/v1",  // local Ollama server
  apiKey: "ollama",                       // unused, but required by the SDK
});

const res = await client.chat.completions.create({
  model: "llama3.1",
  messages: [{ role: "user", content: "classify this ticket" }],
});

The principle it teaches

Course principle

Right-size the model and the hosting. Week 3's cost math is not only which model to call; it includes build-versus-buy for the inference itself, because sometimes the cheapest token is one you serve rather than rent.

Where it fits your labs

This is a Week 3 tool. When you weigh cost against control, self-hosting is the "build" side of the ledger: Ollama lets you try an open model locally in minutes, and the same client code would point at vLLM in production.

Use in
Week 3 cost work, as the build-versus-buy option for inference.
week 3
Pairs with
Your existing OpenAI TS client, since both expose an OpenAI-compatible base URL.