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.