Mindket

LM Studio tutorial: run local models in a desktop app

A black banner titled "Local AI" over the line "Run models on your own computer".

LM Studio is a desktop app for running open AI models on your own computer, with a built-in model search, a chat window and a local server that speaks the OpenAI API. This LM Studio tutorial downloads a model from the built-in search, loads it and chats with it, starts the server for your code and covers the lms command line.

In this lesson

  • Pick a download size your machine can hold before the progress bar starts.
  • Ask questions about a PDF without the file leaving your computer.
  • Reuse code written for OpenAI against a model sitting on your own desk.
  • Load and unload models from a terminal or a script.
All courses
On this page
  1. Before you start
  2. Download a model and chat with it
  3. Run the local server for your code
  4. Drive LM Studio from the terminal with lms
  5. What Qwen's team says a 9B model needs in LM Studio
  6. Common mistakes
  7. Try it yourself
  8. Check yourself
  9. Frequently asked questions
  10. Sources

Before you start

LM Studio wraps the same kind of engine as Ollama in a desktop app. On every system it runs GGUF files through llama.cpp. GGUF is a single-file format that holds a model's weights and a standard set of metadata, built to load quickly, as Hugging Face's GGUF page puts it. On Apple silicon Macs, LM Studio can also run models with MLX, Apple's own machine learning framework, which uses separate MLX downloads.

The app's overview page lists what it covers. It downloads and runs open models such as gpt-oss, Llama and Qwen. It chats with them. It also connects MCP servers, which are tools a model can call through the Model Context Protocol, and serves OpenAI-like endpoints on your machine or across your network.

The app runs on all three desktop systems, and the requirements page sets the floor for each. On x64 Windows the processor must support AVX2, a CPU instruction set the builds depend on, and the x64 Linux build ships with AVX2 support by default. Downloads need an internet connection.

  • macOS: Apple silicon (M1, M2, M3 or M4) and macOS 14.0 or newer. 16GB of RAM or more is recommended.
  • Windows: x64 with AVX2, or ARM (Snapdragon X Elite). At least 16GB of RAM and 4GB of dedicated VRAM are recommended.
  • Linux: Ubuntu 20.04 or newer, on x64 or ARM64. The app ships as an AppImage, a single file that runs without an installer.
LM Studio releases that shaped this lesson
  1. The lms command line

    lms arrives with the app, to load models and run the server from a terminal.

    Source: LM Studio blog: lms, the LM Studio CLI (read November 5, 2026)

  2. Apple MLX

    Apple silicon Macs can run MLX models next to GGUF ones.

    Source: LM Studio blog: LM Studio 0.3.4 ships with Apple MLX (read November 5, 2026)

  3. MCP in LM Studio

    LM Studio becomes an MCP host, so a model can call tools from servers you add.

    Source: LM Studio blog: MCP in LM Studio (read November 5, 2026)

  4. LM Studio 0.4.0

    A headless core called llmster, parallel requests on llama.cpp, a stateful /v1/chat route and lms daemon up.

    Source: LM Studio blog: LM Studio 0.4.0 (read November 5, 2026)

  5. LM Studio Bionic

    A separate agent app for open models, beside LM Studio itself.

    Source: LM Studio blog: Introducing LM Studio Bionic (read November 5, 2026)

  6. Splash engine

    An experimental backend in Bionic 1.1.5 or newer, for an M3 or newer Mac on macOS 26.4 or later with at least 36GB of unified memory.

    Source: LM Studio blog: Splash engine (read November 5, 2026)

Download a model and chat with it

Everything starts in the model search tab, which searches Hugging Face from inside the app. Press ⌘ + 2 on a Mac, or Ctrl + 2 on Windows and Linux, to jump there from anywhere. You can search by keyword, by a user/model name, or by pasting a full Hugging Face address.

Each model comes in several download options, with names like Q3_K_S or Q8_0. They are copies of the same model at different levels of quantization, which shrinks the file by storing each weight in fewer bits and costs some quality. The download page advises a 4-bit option or higher if your machine can run it. Lesson 4 turns those labels into gigabytes. Until then, compare file sizes with your free memory.

Downloading and loading are separate steps. Loading puts the weights into memory. The model loader at the top of the Chat tab does it, and you can set load parameters first. Two of them also appear as flags on lms load: the share of work given to the GPU and the context length, which is how much text the model can hold at once.

Attach a .docx, .pdf or .txt file to a chat and the model answers from it. A short file goes into the conversation whole, as long as it fits in the model's context. The documents page calls context the model's working memory and counts it in tokens, at about three quarters of a word each. Whole files work best with models that take a long context, and the page names Llama 3.1 and Mistral Nemo. A long one switches LM Studio to retrieval: it picks out the passages that look relevant and hands the model only those. Your question steers what it finds. The same page suggests putting into your question the terms you expect the answer to contain, and the RAG course builds the same retrieval in code.

  1. Download the installer for your system from LM Studio's Downloads page and install it. On Linux the download is an AppImage.
  2. Open the model search tab and look for a model, for example gemma or llama.
  3. Choose a download option at 4-bit or higher that fits your memory, and download it.
  4. Open the Chat tab, open the model loader, select the model and load it.
  5. Ask a question. To work with a file, attach it to the chat and ask about what it says.

Run the local server for your code

The server turns the loaded model into an OpenAI-style API. In the app, open the Developer tab and switch on Start server. From a terminal, lms server start does the same. Its options are --port to choose a port and --cors to let web pages call the server. Without --port it reuses the last port. Any free port works.

LM Studio's examples use port 1234, so the base URL is http://localhost:1234/v1. The routes are GET /v1/models and, for POST, /v1/chat/completions, /v1/responses, /v1/completions and /v1/embeddings. The model field takes the identifier LM Studio shows for the loaded model. Codex, OpenAI's coding agent, can use the server because LM Studio implements POST /v1/responses.

The code is LM Studio's own chat completions example. If you wrote code against Ollama's /v1 route in lesson 2, the same client works here with a different base URL. The key is a placeholder, and the system message travels in messages like any other.

The chat completions page adds that LM Studio applies the prompt template on its own for chat-tuned models. A prompt template is the wrapping of special tokens a model was trained to expect around each message, so your code sends plain roles and text.

A request does not need a model you loaded by hand. With JIT loading, short for just-in-time, the server loads the model a request names. Idle TTL is how long such a model stays in memory with no requests, and the TTL page sets it at 60 minutes by default. Auto-Evict unloads the last JIT-loaded model before it loads a new one. A request can carry its own ttl in seconds.

Out of the box the server accepts requests with no key. Authentication is a switch in Server Settings on the Developer page, and tokens come from its Manage Tokens button. Copy a new token straight away, because the app shows it only once. With the switch on, the docs say calls through the REST API and the two SDKs need a valid token, sent as a bearer token in the Authorization header.

Other devices on your network can reach the server through the Serve on Local Network setting, or with lms server start --bind 0.0.0.0. The network page warns that any bind other than 127.0.0.1 exposes the server beyond your computer, and it recommends turning on authentication. The uses it names include a strong machine serving weaker ones and one copy shared by several people.

The OpenAI routes are not the only way in. The same server speaks an Anthropic-compatible format and LM Studio's own REST API, and LM Studio publishes SDKs for Python and TypeScript, lmstudio-python and lmstudio-js.

from openai import OpenAI

client = OpenAI(base_url="http://localhost:1234/v1", api_key="lm-studio")

completion = client.chat.completions.create(
  model="model-identifier",
  messages=[
    {"role": "system", "content": "Always answer in rhymes."},
    {"role": "user", "content": "Introduce yourself."}
  ],
  temperature=0.7,
)

print(completion.choices[0].message)

Drive LM Studio from the terminal with lms

The lms command ships with LM Studio. There is nothing more to install. Start the app at least once, then run lms --help to check it works.

If you took lesson 1, the commands look familiar, with one difference: loading is its own step. You download with lms get, put a model in memory with lms load and talk to it with lms chat. Ollama does the loading inside ollama run. LM Studio keeps it apart.

Scripts lean on the load flags. The --gpu flag takes a fraction from 0 to 1, max for every layer or off for none, and LM Studio picks for you when you leave it out. The --context-length flag sets the context. The --identifier flag gives the loaded model a fixed name, so the model field in your code keeps working when you swap the file behind it. A model loaded this way has no TTL until you add one, as in --ttl 3600 for an idle hour.

Two more commands matter on a machine without a screen. The lms daemon up command starts the headless daemon, a background service with no app window. The lms runtime command manages and updates the inference runtime, the engine that runs the models.

Downloads take a quantization after an @ sign, as in lms get llama-3.1-8b@q4_k_m, and --mlx or --gguf limits the search to one format. Models fetched this way land in the same folder as the app's downloads. When code gets a strange answer, lms log stream prints the messages going in and out of the model.

lms get llama-3.1-8b@q4_k_m        # download one quantization
lms ls                             # models on disk
lms load openai/gpt-oss-20b --identifier="my-model-name"
lms ps                             # models in memory
lms server start --port 3000       # the API server, on a port you choose
lms log stream                     # watch requests and replies
lms unload --all
From the lms reference and Ollama's CLI reference, read on 5 November 2026.
lmsWhat it doesClosest Ollama command
lms getSearches and downloads modelsollama pull
lms lsLists the models on diskollama ls
lms loadLoads a model into memoryollama run, which loads as it opens a chat
lms psLists the models loaded in memoryollama ps
lms unloadUnloads a model, or all of them with --allollama stop
lms chatStarts an interactive chatollama run
lms server startStarts the local API serverollama serve
lms importImports a model file into LM StudioNo single command
lms runtimeManages and updates the inference runtimeNo single command

What Qwen's team says a 9B model needs in LM Studio

Alibaba's Qwen team, which publishes open foundation models, posted on X in March that Qwen3.5-9B had arrived in LM Studio and needed only about 7GB to run locally. The post quotes LM Studio's own announcement, which adds that the model takes images as input, can think and calls tools.

About 7GB is the download, not the whole bill. The context takes memory on top of the file, so a machine that holds the file with little to spare can still run short in a long chat or with a big document.

To try it, search for Qwen3.5-9B in the model search tab and pick an option whose size leaves a few gigabytes free. Load it, open your system's memory monitor and compare what it uses with the figure in the post, then do the same after a long conversation.

Qwen3.5-9B is now available on LM Studio. Requires only ~7GB to run locally

Qwen, Alibaba's Qwen team account, which publishes open foundation models · X (read November 5, 2026)
Qwen (@Alibaba_Qwen) on X, 3 March 2026: Qwen3.5-9B is now available on LM Studio, and requires only about 7GB to run locally. It quotes LM Studio's post saying the model takes images as input, can think and calls tools.
Qwen on X, 3 March 2026

A screenshot of X's own embed of the post, taken on 5 November 2026, with the time in UTC. Select it to open the post on X.

Common mistakes

  • Picking the largest download option because it sounds best. Every option is the same model, and the bigger files need more memory to load.
  • Sending a model value that does not match the identifier LM Studio shows. Copy it from the app, or fix it yourself with --identifier.
  • Running lms on a machine where the app has never started. The docs ask for one launch first.
  • Installing an MCP server from a source you do not trust. LM Studio's MCP page warns that some servers can run arbitrary code, read your local files and use your network.
  • Expecting a JIT-loaded model to free its memory as soon as a reply ends. It stays for its idle TTL, an hour by default.
  • Asking a vague question about a long attached file. Retrieval only hands the model the passages it found, so name the terms the answer should contain.
  • Turning on --cors for a server that only your scripts call. CORS, short for cross-origin resource sharing, is the browser rule that lets a web page on another address reach the server, and a script never needs it.

Try it yourself

  • Download a 4-bit and an 8-bit option of one model and compare their sizes in My Models.
  • Ask the same question about a one-page note and a long PDF, using the words you expect in the answer.
  • Start the server, call curl http://localhost:1234/v1/models and copy an identifier into the Python example.
  • Load a model with --identifier, then point the Python example at that name.
  • Run lms log stream in one terminal while the Python example runs in another, and read what was sent.
  • With JIT loading on, name a model you have not loaded in a request, then look for it in lms ps.

Next: both tools offered one model in several sizes and asked how much of it to put on the GPU. Lesson 4 works out which model and which quantization fit your computer, starting from the parameter count.

Check yourself

  1. On Windows, which shortcut opens the model search in LM Studio?

    Show answer

    C. Ctrl + 2 Ctrl + 2 on Windows and Linux, or ⌘ + 2 on a Mac, opens the tab that searches Hugging Face from inside the app.

  2. Which download option does LM Studio suggest if your machine can run it?

    Show answer

    A. A 4-bit option or higher The download page advises a 4-bit option or higher when the machine is capable enough.

  3. Your Python code reaches the server but names the wrong model. What fixes it for good?

    Show answer

    D. Loading the model with --identifier and using that name A fixed identifier keeps the model field working even when you swap the file behind it.

  4. What happens to a long PDF attached to a chat?

    Show answer

    B. LM Studio retrieves the relevant passages and gives the model those A file too long for the context switches LM Studio to retrieval, and the document stays on your machine.

Frequently asked questions

Does LM Studio work offline?

Yes, for everything except fetching things. Chats and attached documents stay on your machine and work with no connection. Searching for models, downloading them and updating the app or its runtimes need the internet, and the app checks for updates when it opens.

Is LM Studio better than Ollama?

They overlap more than they differ. Both run GGUF models through llama.cpp and serve an OpenAI-compatible API on your machine. LM Studio puts a model browser and a chat window in front, with documents you can attach. Ollama is built around its command line, its own API and a library of named tags.

Can LM Studio use MCP servers?

Yes, since version 0.3.17, when it became an MCP host. Open the Program tab in the right-hand sidebar, choose Install, then Edit mcp.json, and add servers in the mcpServers format. What is MCP explains what those servers add to a model.

Where does LM Studio store downloaded models?

In its models directory, which you can see and change under My Models. Models you fetch with lms get go to the same folder, and Hugging Face model pages offer LM Studio under "Use this model" for GGUF and MLX files.

Sources

  1. LM Studio Docs: Welcome to LM Studio (read November 5, 2026)https://lmstudio.ai/docs/app
  2. LM Studio Docs: System requirements (read November 5, 2026)https://lmstudio.ai/docs/app/system-requirements
  3. LM Studio Docs: Get started (read November 5, 2026)https://lmstudio.ai/docs/app/basics
  4. LM Studio Docs: Download an LLM (read November 5, 2026)https://lmstudio.ai/docs/app/basics/download-model
  5. LM Studio Docs: Chat with documents (read November 5, 2026)https://lmstudio.ai/docs/app/basics/rag
  6. LM Studio Docs: Offline operation (read November 5, 2026)https://lmstudio.ai/docs/app/offline
  7. LM Studio Docs: Use MCP servers (read November 5, 2026)https://lmstudio.ai/docs/app/mcp
  8. LM Studio Docs: Local server (read November 5, 2026)https://lmstudio.ai/docs/developer/core/server
  9. LM Studio Docs: Idle TTL and Auto-Evict (read November 5, 2026)https://lmstudio.ai/docs/developer/core/ttl-and-auto-evict
  10. LM Studio Docs: Authentication (read November 5, 2026)https://lmstudio.ai/docs/developer/core/authentication
  11. LM Studio Docs: Serve on Local Network (read November 5, 2026)https://lmstudio.ai/docs/developer/core/server/serve-on-network
  12. LM Studio Docs: OpenAI compatibility (read November 5, 2026)https://lmstudio.ai/docs/developer/openai-compat
  13. LM Studio Docs: Chat completions (read November 5, 2026)https://lmstudio.ai/docs/developer/openai-compat/chat-completions
  14. LM Studio Docs: lms CLI (read November 5, 2026)https://lmstudio.ai/docs/cli
  15. LM Studio Docs: lms server start (read November 5, 2026)https://lmstudio.ai/docs/cli/serve/server-start
  16. LM Studio Docs: lms get (read November 5, 2026)https://lmstudio.ai/docs/cli/local-models/get
  17. LM Studio Docs: lms load (read November 5, 2026)https://lmstudio.ai/docs/cli/local-models/load
  18. Hugging Face Docs: GGUF (read November 5, 2026)https://huggingface.co/docs/hub/gguf
  19. Hugging Face Docs: Use AI models locally (read November 5, 2026)https://huggingface.co/docs/hub/local-apps
  20. LM Studio blog: lms, the LM Studio CLI (read November 5, 2026)https://lmstudio.ai/blog/lms
  21. LM Studio blog: LM Studio 0.3.4 ships with Apple MLX (read November 5, 2026)https://lmstudio.ai/blog/lmstudio-v0.3.4
  22. LM Studio blog: MCP in LM Studio (read November 5, 2026)https://lmstudio.ai/blog/lmstudio-v0.3.17
  23. LM Studio blog: LM Studio 0.4.0 (read November 5, 2026)https://lmstudio.ai/blog/0.4.0
  24. LM Studio blog: Introducing LM Studio Bionic (read November 5, 2026)https://lmstudio.ai/blog/introducing-lm-studio-bionic
  25. LM Studio blog: Splash engine (read November 5, 2026)https://lmstudio.ai/blog/splash-engine
  26. Qwen on X: Qwen3.5-9B is now available on LM Studio (read November 5, 2026)https://x.com/Alibaba_Qwen/status/2028664203872251943

Share this lesson

Connect MCP servers to LM Studio

Browse MCP servers on Mindket with their setup notes, then add the ones you trust to LM Studio's mcp.json.

Browse MCP servers

This lesson as Markdown · Local AI course: run AI models on your own computer · All courses