Skip to content

How-ToRAM

How to Use the LM Studio CLI (lms): Load, Chat and Serve

LM Studio's lms command-line tool lets you list models with lms ls, see loaded ones with lms ps, load with context length, GPU offload and TTL options, check memory with --estimate-only, chat with lms chat and start the local API with lms server start.

By , Editorial team

3 min read

How to Use the LM Studio CLI (lms): Load, Chat and Serve

LM Studio has a desktop app, but it also ships a command-line tool called lms. You can download models, load them into memory, chat in a terminal and start the local API server without opening the window. This guide is based on LM Studio's CLI documentation; Forge PC hasn't timed the commands on its own hardware.

Install and check it works

lms ships with LM Studio, so you don't need a separate installer if the app is already on your PC. Open a terminal and run (per LM Studio's docs):

lms --help

LM Studio notes that lms is MIT-licensed and developed in a public GitHub repository.

List models on disk, and what's in memory

lms ls lists every model you've downloaded, with size, architecture and parameter count. Useful flags:

  • --llm shows only chat models

  • --embedding shows only embedding models

  • --json prints machine-readable output

  • --detailed adds more information

lms ps lists models that are currently loaded. You can add --json here too. Both commands accept --host to talk to a remote LM Studio instance on the same network, provided that instance is running and reachable.

Load a model (and estimate memory first)

lms load <model_key>

Get the model key from lms ls. If you omit the key, lms prompts you to pick one. Optional flags, from LM Studio's load guide:

  • --context-length 4096 sets how many tokens the model will consider as context

  • --gpu 0.5, --gpu max or --gpu off controls how much is offloaded to the GPU (values are 0–1, max or off). If you omit this, LM Studio says it will choose automatically

  • --ttl 3600 unloads the model after that many seconds of inactivity

  • --identifier "my-custom-identifier" gives the loaded model a name you can use in API calls

  • --estimate-only prints a memory estimate and exits without loading. LM Studio says optional flags such as --context-length and --gpu are included in the estimate

To take a model out of memory:

lms unload <model_key>

lms unload --all unloads every loaded model. Both load and unload also accept --host.

If you want more control over offload from the app rather than the CLI, see how to set GPU offload in LM Studio.

Chat from the terminal

lms chat

You'll be asked to pick a model if you don't pass one. Useful flags:

  • -p or --prompt sends a one-off prompt, prints the reply and exits

  • -s or --system-prompt sets a custom system prompt

  • --stats shows prediction statistics after each response

  • --ttl keeps the model loaded for that many seconds after the chat ends (the default is 3600)

lms chat can also read from standard input, so you can pipe a file into a prompt:

cat my_file.txt | lms chat -p "Summarise this, please"

Start the local server

lms server start

That launches the HTTP API for whatever models are loaded. Optional flags:

  • --port uses a specific port (otherwise it reuses the last one)

  • --cors turns on CORS for web apps. LM Studio warns this can expose the server and recommends enabling authentication

  • --bind 0.0.0.0 listens on all IPv4 interfaces. LM Studio warns that any bind other than 127.0.0.1 exposes the server beyond localhost, and again recommends authentication. You can also set this with the LMS_SERVER_HOST environment variable

Check that it's up with lms server status (add --json --quiet for a script-friendly reply). Stop it with lms server stop. For using the API itself, see how to use the LM Studio server.

Download a model

lms get llama-3.1-8b

Append a quantisation, for example llama-3.1-8b@q4_k_m. --mlx and --gguf filter the search to those formats; --limit caps how many results you see.

If you prefer a graphical workflow, our guide to running AI models locally with Ollama and LM Studio covers the apps side by side.

Our verdict

Use lms ls and lms ps to see what's on disk and in memory, lms load --estimate-only before you commit VRAM, and lms chat or lms server start when you want the terminal or an API instead of the desktop window. Set a TTL if you don't want models sitting in memory after you finish.

The bottom line

Use lms ls and lms ps to see what's on disk and in memory, lms load --estimate-only before you commit VRAM, and lms chat or lms server start when you want the terminal or an API instead of the desktop window. Set a TTL if you don't want models sitting in memory after you finish.

Sources

  1. 01LM Studio Docs, lms — LM Studio's CLI
  2. 02LM Studio Docs, lms load
  3. 03LM Studio Docs, lms ls
  4. 04LM Studio Docs, lms ps
  5. 05LM Studio Docs, lms chat
  6. 06LM Studio Docs, lms get
  7. 07LM Studio Docs, lms server start
  8. 08LM Studio Docs, lms server status

About the author

Forge PC Staff

Editorial team

The shared byline for articles researched, written and edited by the Forge PC editorial team. How we source, check and correct our work is set out in our editorial policy.

More from Forge PC Staff

Read next

How to Run MiniMax H3 Image Locally in ComfyUI

How-To

How to Run MiniMax H3 Image Locally in ComfyUI

ComfyUI natively supports MiniMax H3 Image, an open-weights model for text-to-image and reference-image editing in six fixed steps at up to 4096x4096. Update ComfyUI, download the diffusion model, VAE and Qwen3-VL text encoder, load the template, and connect images and the VAE to edit.

Forge PC Staff3 min

How to Speed Up LLM Text Generation in ComfyUI With MTP

How-To

How to Speed Up LLM Text Generation in ComfyUI With MTP

ComfyUI v0.45.0 rebuilt local LLM text generation for Qwen3.x models with multi-token prediction and adaptive tree drafting, which Comfy says can roughly double token rates on the same GPU. Update ComfyUI, leave mtp on auto in the Text Generate node and measure your own gains.

Forge PC Staff3 min

G.SKILL Flare X5X vs Flare X5: Is AMD EXPO ULL Worth Choosing?

Versus

G.SKILL Flare X5X vs Flare X5: Is AMD EXPO ULL Worth Choosing?

G.SKILL's Flare X5X and Flare X5 32GB DDR5-6000 CL36 kits share speed, primary timings and 1.35V. The Flare X5X adds an AMD EXPO ULL profile with extra-tuned sub-timings (36-36-36-76) but has no Intel XMP; the Flare X5 offers EXPO and XMP 3.0. Pick the X5X for ULL-ready AM5 boards.

Forge PC Staff3 min