Skip to content
AI Skills Central

Type to search Agent Skills, workflows, tutorials, tools and the glossary.

Cheat sheet

Local model servers cheat sheet

Start commands, default ports and OpenAI-compatible base URLs for Ollama, LM Studio, llama.cpp, MLX LM, vLLM and SGLang, checked against each project's docs.

By Checked Intermediate
Bookmark

Bookmarks are kept in your free account, so you can find this page again on any device.

Sign in to bookmark
On this page

Ollama, LM Studio, llama.cpp, MLX LM, vLLM and SGLang all run open-weight models on your own hardware and expose an OpenAI-compatible API, so the same client code works with each by changing the base URL. Ollama or LM Studio is the easiest start on a laptop; vLLM and SGLang are built for serving many users on GPUs.

Which local model server to use

Server Best for Hardware
Ollama One person, laptop or desktop, minimal setup CPU, Apple Silicon, NVIDIA and AMD GPUs
LM Studio Browsing and trying models in a desktop app, then serving one CPU, Apple Silicon (GGUF and MLX), most GPUs
llama.cpp Squeezing GGUF models onto modest hardware, embedding in apps CPU, Apple Silicon, most GPUs
vLLM Serving many users on your own GPUs Data-centre and workstation GPUs
MLX LM Running and fine-tuning models on an Apple silicon Mac from Python Apple Silicon only
SGLang High-concurrency and agent workloads with shared prompt prefixes Data-centre and workstation GPUs

Start commands

# Ollama: download and chat, or serve the API in the background
ollama run gemma4
ollama serve

# llama.cpp: pull a GGUF from Hugging Face and serve it
llama serve -hf ggml-org/Qwen3.5-0.8B-GGUF --port 8080

# LM Studio without the app (llmster), then start its server
curl -fsSL https://lmstudio.ai/install.sh | bash
lms daemon up
lms server start --port 1234

# MLX LM on an Apple silicon Mac
mlx_lm.server --model mlx-community/Mistral-7B-Instruct-v0.3-4bit

# vLLM
vllm serve Qwen/Qwen2.5-1.5B-Instruct

# SGLang
sglang serve Qwen/Qwen3-0.6B --host 0.0.0.0 --port 30000

Older guides use llama-server for llama.cpp and python -m sglang.launch_server for SGLang. Check which version you have installed.

Default ports and base URLs

Server Default port OpenAI-compatible base URL
Ollama 11434 http://localhost:11434/v1
LM Studio 1234 in its docs; lms server start reuses the last port http://localhost:1234/v1
llama.cpp 9931 (set --port to change) http://localhost:9931/v1
MLX LM 8080 http://localhost:8080/v1
vLLM 8000 http://localhost:8000/v1
SGLang none stated; docs use 30000 http://localhost:30000/v1

llama.cpp’s server README lists 9931 as the default. Many guides and its Docker examples use 8080, so pass --port to be explicit.

Call any of them

curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "Qwen/Qwen2.5-1.5B-Instruct", "messages": [{"role": "user", "content": "Say hello"}]}'

Change the port and the model name to match your server. Ollama uses its own model names, such as gemma4.

from openai import OpenAI

client = OpenAI(base_url="http://localhost:11434/v1", api_key="local")  # key is required by the SDK but ignored
reply = client.chat.completions.create(model="gemma4", messages=[{"role": "user", "content": "Say hello"}])
print(reply.choices[0].message.content)

List and check

Task Command
Models Ollama has downloaded ollama list
Models Ollama has loaded now ollama ps
Models any OpenAI-compatible server offers curl http://localhost:<port>/v1/models

Licences at a glance

Server Licence
Ollama, llama.cpp MIT
vLLM, SGLang Apache 2.0
MLX LM MIT
LM Studio Proprietary app for personal and internal business use; the lms CLI is MIT

To choose between the two desktop options, see Ollama vs LM Studio.

Common mistakes

  • Binding to 0.0.0.0 exposes the server to your network with no authentication. Keep localhost unless you put a proxy with auth in front.
  • A model that does not fit in GPU memory falls back to CPU or fails to load. Pick a smaller or more heavily quantised variant.
  • Context length defaults are often lower than the model supports. Set it explicitly when you need long prompts.

Go further

New to running models yourself? The Ollama tutorial starts from installation, and the local models skill page collects the tutorials and tools around it. For a chat interface on top of any of these servers, see Open WebUI. The glossary explains quantization and the GGUF format, which decide whether a model fits in memory.

For every Ollama subcommand, Modelfile instruction and environment variable, see the Ollama commands cheat sheet. On an Apple silicon Mac, MLX LM is another way to run and fine-tune open models locally.

Check your understanding

Local model servers quiz

Choosing Ollama, llama.cpp, vLLM or SGLang, OpenAI-compatible base URLs and default ports, listing models, and the mistakes that expose or slow a local server.

7 questions · pass mark 70%

Question 1 of 70 answered
  1. What lets the same client code talk to Ollama, llama.cpp, vLLM and SGLang?

Checked against

  • Run local models with Ollama

    Install Ollama, run an open-weight model on your own machine, call it from scripts over the local API and choose a model size your hardware can handle, offline.

    TutorialBeginner30 min

  • Ollama commands cheat sheet

    Ollama CLI commands, in-chat commands, Modelfile instructions, environment variables and API endpoints on one page, checked against the Ollama docs and source.

    Cheat sheetBeginner

  • Ollama vs LM Studio for running models locally

    Ollama vs LM Studio compared on interface, API compatibility, model formats, licence and terms for work use, headless servers and coding-agent support.

    Comparison

  • Local models

    Running open-weight models on your own hardware for privacy, cost or offline use.

    SkillBeginner

  • Quantization

    Storing model weights at lower numerical precision, such as 8 or 4 bits, to reduce memory use and speed up inference at a small quality cost.

    Glossary

Back to top