# How do I use LM Studio as a server?

> LM Studio is a desktop app that also runs a local server and a command line. It lets you pick MLX or llama.cpp per model and is free but closed source.

LM Studio is a chat app with a runtime inside it. Turn on its server and every other app on your machine can use the models you downloaded, through an OpenAI-compatible API on port 1234.

## The local server and the command line

The server lives in the **Developer** tab. Switch it on and it listens on `http://localhost:1234/v1`. The same tab shows the request log, which is the first place to look when a tool cannot connect.

LM Studio also ships a command line tool called `lms`. It does everything the server tab does, which makes it handy for scripts and for machines you reach over SSH.

```bash
lms server start          # start the API server
lms ls                    # models on disk
lms get qwen3-8b          # search for and download a model
lms load qwen3-8b         # load a model into memory
lms ps                    # models loaded right now
lms unload --all          # free the memory
lms server stop
```

If your shell cannot find `lms`, open LM Studio once, then run its bootstrap step to add it to your path. The LM Studio docs list the command for each OS. 

**Try it.** 

```bash
lms server start && curl http://localhost:1234/v1/models
```

You get a JSON list of the models LM Studio can serve. That list is what other apps see.

The server can load models on demand. When a request names a model that is not loaded, LM Studio loads it first, so the first request waits. [How do I call a local model from code?](https://localagi.co/local-api) shows how to call it from code.

## MLX or llama.cpp per model

LM Studio carries two engines. On a Mac it has both [MLX](https://localagi.co/mlx) and [llama.cpp](https://localagi.co/llama-cpp). On Windows and Linux it has llama.cpp only.

The engine follows the file you download. An MLX build of a model runs on MLX, and a GGUF build runs on llama.cpp. The search results label which is which, so you choose the engine when you choose the download.

**Rule of thumb.** 
On a Mac, download the MLX build of a model first. Keep the GGUF build only if a model has no MLX version, or if you need a feature that only llama.cpp has.

LM Studio also lets you pick which llama.cpp backend it uses, such as CUDA, Vulkan or CPU. It updates these engine packages separately from the app itself. That matters, because a new model often needs a newer engine before it will load. [What is a runtime, and what sits under my app?](https://localagi.co/the-stack) explains why the engine build changes speed.

## Per-conversation settings

LM Studio splits settings into two kinds. Load settings apply when the model loads. Inference settings apply to each answer and can change between conversations.

| Kind | Examples | When it takes effect |
| --- | --- | --- |
| Load | Context length, GPU offload, flash attention, KV cache type | Next time the model loads |
| Inference | Temperature, top-p, max tokens, system prompt | The next message |

The context length you set at load time is the ceiling for every conversation and every API call. Agents need 32K tokens or more. LM Studio shows a memory estimate as you change it, so you can see when it stops fitting.

API requests can set inference settings themselves, such as temperature, in the request body. They cannot raise the context past what the model was loaded with. [Should I touch temperature and the other sliders?](https://localagi.co/sampling) explains what each inference setting does.

**The catch.** 
A model loaded from the chat window keeps the settings you used there. A model loaded on demand by an API call uses its saved defaults. If an agent behaves differently from your chat test, check which context length the model actually loaded with.

## Closed source, free to use

LM Studio is free to download and use, including at work under its current terms. It is not open source. You cannot read or change the app's code, and its future depends on one company.

Its engines are a different story. llama.cpp and MLX are open source, and LM Studio's MLX engine is published on GitHub.  Your model files are standard GGUF and MLX files, so you can move them to another runtime at any time.

If open source matters to you, the same models run in [Ollama](https://localagi.co/ollama), [llama.cpp](https://localagi.co/llama-cpp) directly or Jan. [Which runtime should I use?](https://localagi.co/choosing-a-runtime) weighs them up.

## Go deeper

### Serving other machines

By default the server only answers on your own machine. The server settings include an option to serve on the local network, which lets a laptop use a desktop's GPU. There is no password by default, so only do this on a network you trust. [How do I share one model with my household or office?](https://localagi.co/sharing-a-model) covers the safer ways.

### Its own SDKs and API

Next to the OpenAI-compatible endpoints, LM Studio has its own REST API and SDKs for Python and TypeScript. They expose things the OpenAI format has no field for, such as loading a model with a given context length from code. Most tools only need the OpenAI endpoints.

### Headless use

LM Studio can run its service without the main window, so the server comes back after a reboot. That turns a desktop into a small model server for the house. For a team, a dedicated server such as [vLLM](https://localagi.co/vllm-and-sglang) scales better. [How do I set up a team server?](https://localagi.co/team-server) covers that setup.
