A copy-paste path to a local OpenAI-compatible LLM endpoint with LM Studio, Ollama, or llama.cpp
- Models & engines
- LM Studio app plus `lms bootstrap` on PATH, or Ollama, or llama.cpp / llama-server
Sizing rule of thumb: model file size + ~20% ≤ available RAM/VRAM (8 GB → 7–8B Q4; 16 GB → 13–14B Q4 or a comfortable 8B; 32 GB → ~27–34B Q4)
Example model: Llama 3.1 8B (LM Studio key llama-3.1-8b, Ollama tag llama3.1:8b, or a bartowski GGUF for llama-server) - Key gotcha
- lms get can be flaky — download in the LM Studio app or import a Hugging Face GGUF instead.
What they built
Karytka published a copy-paste starter for getting a capable local model answering in about ten minutes plus download time: install a runner, pull a concrete model, serve an OpenAI-compatible endpoint, and make a first tool-calling probe.
The main path uses LM Studio’s lms CLI because it manages models and exposes a clean local API; parallel sections cover Ollama and llama.cpp for the same outcome.
An expanded Nov 3 update added full install steps for all three runners and a troubleshooting section based on reader feedback.
Setup
- LM Studio app plus `lms bootstrap` on PATH, or Ollama, or llama.cpp / llama-server
- Sizing rule of thumb: model file size + ~20% ≤ available RAM/VRAM (8 GB → 7–8B Q4; 16 GB → 13–14B Q4 or a comfortable 8B; 32 GB → ~27–34B Q4)
- Example model: Llama 3.1 8B (LM Studio key llama-3.1-8b, Ollama tag llama3.1:8b, or a bartowski GGUF for llama-server)
- jq helpful for inspecting API JSON
How it works
- With LM Studio: lms get / load with an explicit context length, then lms server start --port 1234 and call http://localhost:1234/v1.
- With Ollama: ollama pull llama3.1:8b and use http://localhost:11434/v1 (skip ollama serve if the desktop app already holds the port).
- With llama.cpp: llama-server -hf <gguf-repo:quant> -c 16384 --host 127.0.0.1 --port 8080.
- Send a small tools array and check for a structured tool_calls response before trusting the model for agents.
Results & numbers
- You get a working OpenAI-compatible local endpoint that scripts, LiteLLM and agent frameworks can point at with a dummy key.
- The author frames local as best for private, high-volume or pinned-model work, with hosted models still better for hardest reasoning.
Gotchas
- lms get can be flaky — download in the LM Studio app or import a Hugging Face GGUF instead.
- LM Studio may land on :1235 unless you pin --port; confirm with lms server status.
- Tool-calling that returns prose instead of tool_calls means that model or quant is unreliable for agents.
- llama-server can slow over long sessions as the KV cache grows — restart to reset.
“Why local, when hosted models are right there and genuinely good? Privacy is the obvious one: nothing leaves the machine.”— Mikalai Karytka
Do it yourself
- Install LM Studio, run ~/.lmstudio/bin/lms bootstrap, and open a new terminal
- lms get llama-3.1-8b --yes (or import a GGUF), then lms load llama-3.1-8b --context-length 16384 --yes
- lms server start --port 1234 && lms server status
- curl the /v1/models and /v1/chat/completions endpoints with a dummy Bearer token
- Optionally repeat the same chat call against Ollama :11434 or llama-server :8080
Similar setups
LM Studio vs Ollama on an RTX 5080: memory settings mattered more than the app
LK Wood IV ran LM Studio and Ollama on the same RTX 5080 with identical GGUF files and found the apps within 14% of each other, while one wrong offload or context setting cost up to 3.4x.
A one-script Ubuntu install that stands up Ollama and Open WebUI as a private ChatGPT in the browser
HendGrow’s guide 50 ships a Bash installer that detects NVIDIA GPU or CPU, deploys pinned Ollama and Open WebUI with Docker Compose on Ubuntu 24.04, pulls a small starter model, and opens the UI on port 3000.
Local AI: a one-click Windows app that picks a model for your PC and sets up Ollama for friends
Tired of setting up local LLMs for friends, a developer built a free MIT-licensed Windows app that detects your GPU and RAM, installs Ollama without admin rights, pulls a fitting model and opens a private chat.
L.A.T.E.: a local tool engine where code plans and a 3B model only writes
A Node.js engine plugs into Ollama, LM Studio or any OpenAI-compatible API and lets rules plan multi-step jobs and tools verify them, so a small model like qwen2.5:3b can't skip steps or fake success.