LM Studio Local LLM Setup: Download, Models and API
LM Studio is a desktop app with the lms CLI for Windows, macOS and Linux, free for personal and work use. It runs GGUF models and native Apple Silicon MLX builds, shows VRAM fit badges before downloading, and serves an OpenAI-compatible API on port 1234.
# install LM Studio from lmstudio.ai/download, then enable the CLI:
~/.lmstudio/bin/lms bootstrap
lms server start# install LM Studio from lmstudio.ai/download, then in PowerShell:
lms server start# download the Linux AppImage from lmstudio.ai/download
chmod +x LM-Studio-*.AppImage
./LM-Studio-*.AppImageDesktop GUI vs Headless CLI Workflow
LM Studio bridges visual model exploration and developer automation. You can browse Hugging Face quantizations with live hardware-fit badges in the desktop app, or drive the exact same local engine headlessly from your terminal with lms.
Visual Model Discovery in the App
- Search Hugging Face directly inside the app and compare
Q4_K_M,Q6_K,Q8_0and Apple MLX builds side by side. - Adjust GPU offload layers, context length and KV cache quantization visually before loading a model.
- Inspect real-time tokens/sec, time-to-first-token and prompt token counts underneath every reply.
Headless Automation With the LMS CLI
lms get llama-3.2-3b-instruct— download a model directly from the terminal.lms server start— start the OpenAI-compatible HTTP server on port 1234 without opening chat windows.lms lsandlms unload --all— list installed models and free GPU VRAM immediately.
GGUF vs Apple Silicon MLX and Model Storage
On Windows, Linux and Intel Macs, LM Studio executes GGUF files via llama.cpp. On Apple Silicon Macs (M1–M4), LM Studio also supports Apple's native MLX backend, which frequently achieves higher tokens-per-second on unified memory.
| Operating System | Default Models Folder | Moving Storage |
|---|---|---|
| macOS | ~/.lmstudio/models | Change anytime in My Models → Models Directory |
| Linux | ~/.lmstudio/models | Change anytime in My Models → Models Directory |
| Windows | C:\Users\<you>\.lmstudio\models | Change anytime in My Models → Models Directory |
Local API Server on Port 1234
Start the server on the Developer tab (or via lms server start) and point any OpenAI SDK client at http://localhost:1234/v1. Pass the exact model slug reported by lms ls.
import os
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:1234/v1",
api_key="ollama",
)
r = client.chat.completions.create(
model="llama-3.2-3b-instruct",
messages=[{"role": "user", "content": "Hello"}],
)
print(r.choices[0].message.content)curl http://localhost:1234/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"llama-3.2-3b-instruct","messages":[{"role":"user","content":"Hello"}]}'Fixing Slow Speed or Context Length Errors
If generation is slow, open the model load settings and verify GPU Offload is maxed out for your VRAM. If an IDE or coding agent returns a context-overflow error, raise Context Length on the Developer tab and reload the model.
LM Studio Questions
Is LM Studio Free for Commercial and Work Use?
Yes. LM Studio is free for both personal and workplace use under its desktop license, while its lms CLI and TypeScript/Python SDKs are open source.
Where Are LM Studio Models Stored?
By default in ~/.lmstudio/models on macOS/Linux and C:\Users\<you>\.lmstudio\models on Windows. You can move the folder to another drive under My Models > Models Directory.
Should I Pick MLX or GGUF in LM Studio on a Mac?
On Apple Silicon Macs (M1/M2/M3/M4), try MLX first for faster native unified-memory throughput, and use GGUF when an MLX quantization is not yet available for a model.
Can LM Studio Run Completely Offline?
Yes. Once GGUF or MLX weights are downloaded to your disk, LM Studio runs offline with zero external network requests.