What is LM Studio?
LM Studio is a desktop app for macOS, Windows, and Linux that lets you download, manage, and run local LLMs through a graphical interface. No command line required.
Choose LM Studio when…
- You prefer a GUI over the terminal
- You want to try models visually before integrating them
- You need to share a local model server with non-technical teammates
- You want a built-in chat UI with model comparison
Choose Ollama when…
- You're scripting or automating model management
- You want the simplest CLI experience
- You're deploying on a headless server
- You want tighter LangChain integration
Setup
Download
Go to lmstudio.ai and download the installer for your OS. Available for macOS (Apple Silicon + Intel), Windows, and Linux.
Discover & download a model
Open the Discover tab (magnifying glass icon). Search for a model — e.g. "Llama 3.1". Click the model, choose a variant based on your RAM, and click Download.
Chat in-app
Switch to the Chat tab. Select your downloaded model from the dropdown. Type your message and chat immediately — no config required.
Start the local server
Go to the Local Server tab (server icon). Select a model, click Start Server. The server runs at http://localhost:1234 by default.
Using the local server API
LM Studio's local server is fully OpenAI-compatible. Point any OpenAI client at it and it just works.
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:1234/v1",
api_key="lm-studio", # required but not used
)
response = client.chat.completions.create(
model="llama-3.1-8b-instruct", # model name shown in LM Studio
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is gradient descent?"},
],
temperature=0.3,
)
print(response.choices[0].message.content)
The model name in the API call must match the identifier shown in LM Studio's server panel. This is the same code you'd write for OpenAI — just the base_url changes.
Key features
Model variants & quantization picker
LM Studio shows estimated RAM requirements for each variant before you download. It recommends the best quantization for your hardware automatically — no need to know Q4 from Q8 (covered next page).
System prompt editor
Edit the system prompt in the Chat sidebar. Changes take effect immediately — great for rapid persona testing without code.
Parameter controls
Sliders for temperature, top-p, top-k, repeat penalty, and context length in the Chat sidebar. Tweak and see the effect immediately.
Multi-model server
Load multiple models simultaneously (if RAM allows). Your API calls can specify which model to use per request — useful for routing simple tasks to small models and complex tasks to larger ones.
LM Studio vs Ollama — at a glance
| Feature | LM Studio | Ollama |
|---|---|---|
| GUI interface | ✓ | ✗ |
| CLI / scripting | Limited | ✓ |
| OpenAI-compatible API | ✓ | ✓ |
| Built-in chat UI | ✓ | ✗ |
| Headless / server install | ✗ | ✓ |
| LangChain integration | Via OpenAI compat | Native ChatOllama |
Performance tuning checklist
LM Studio works out of the box, but a few settings have outsized impact on tokens/sec and quality. Walk through these once after each new model download.
GPU offload layers
In Model Settings, set n_gpu_layers as high as your VRAM allows. On Apple Silicon, "Max" usually wins because unified memory lets every layer live on the GPU. On discrete GPUs, push the number up until you see VRAM saturate, then back off by 2–4 layers.
Context length (n_ctx)
Default is usually 4096. Long-context models advertise 32k+, but every doubling roughly doubles KV cache memory. Set this to the longest prompt you actually send — not the model's maximum — to keep RAM headroom for the weights.
Flash Attention
Toggle Flash Attention on if your model supports it. 10–30% speedup on long prompts at no quality cost. Older models or certain quantizations may silently produce gibberish with it on — verify output looks normal after enabling.
Mlock / keep model in memory
For interactive use, enable "Keep model in memory" so the weights stay resident between requests. Otherwise the OS may page them out and the next call costs 5–15 seconds of cold reload.
Server CORS & auth
If you're calling the local server from a browser app, enable CORS in the Server tab. LM Studio doesn't enforce API keys by default — bind to 127.0.0.1 only and never expose the port to the public network without a reverse proxy.
Troubleshooting LM Studio
"Model failed to load" or instant crash
Almost always RAM exhaustion. Check the estimated requirement next to the quantization. Switch to a smaller variant (Q4_K_S instead of Q5_K_M), or close other RAM-heavy apps. On Linux, OOM-killer logs in dmesg confirm this.
Slow tokens/sec on a capable machine
Three usual suspects: GPU offload set too low, context length too large, or the model swapped to disk. Watch Activity Monitor / Task Manager during inference — if disk activity spikes, you're paging. Lower n_ctx or pick a smaller quantization.
API client connects but model name "not found"
The model field must match the identifier shown in LM Studio's Server tab exactly — usually the file slug like llama-3.1-8b-instruct, not the friendly display name. Hit GET /v1/models to list the canonical names.
Garbled or repetitive output
Usually a chat template mismatch. LM Studio applies a default template per model family; if you picked a fine-tune that uses a different template, output degrades. Open Model Settings → Prompt Template and choose the one that matches the model card (Llama 3, ChatML, Mistral Instruct, etc.).
LM Studio FAQ
Is LM Studio free to use?
Yes. LM Studio is free to download and use. It runs open-source models locally on your machine, so there are no API costs or subscriptions.
What is the difference between LM Studio and Ollama?
LM Studio is a GUI desktop app ideal for visual model discovery and non-technical users. Ollama is a CLI tool better suited for scripting, automation, and headless server deployments. Both offer OpenAI-compatible APIs.
Does LM Studio have an API?
Yes. LM Studio exposes a local OpenAI-compatible server at localhost:1234/v1. Any code written for the OpenAI API works with LM Studio by changing the base_url — no other modifications needed.
What models can I run in LM Studio?
LM Studio supports any GGUF-format model from Hugging Face, including Llama 3, Mistral, Phi, Gemma, and thousands of community fine-tunes. It shows estimated RAM requirements before download and recommends the best quantization for your hardware.
Can I run multiple models at the same time in LM Studio?
Yes, if your machine has enough RAM. LM Studio supports loading multiple models simultaneously, and your API calls can specify which model to use per request — useful for routing simple tasks to small models and complex ones to larger models.
Related tutorials
Prefer the command line? See the Ollama setup guide for a CLI-first approach. To use your LM Studio server from Python code, learn how to connect LangChain to local models. Understanding model sizes? Read the quantization and performance guide.
Quick summary
- LM Studio = GUI app for downloading and running local models — no command line
- Download a model → chat in-app → start local server → use from any OpenAI client
- Local server runs at
localhost:1234/v1— fully OpenAI-compatible - Shows RAM requirements before download — picks the best quantization for your hardware
- Use LM Studio for exploration and non-technical users; Ollama for automation and servers