# `lms` — LM Studio's CLI

> Get starting with the `lms` command line utility.


## Install `lms`

`lms` ships with LM Studio, so you don't need to do any additional installation steps if you have LM Studio installed.

Just open a terminal window and run `lms`:

```shell
lms --help
```

## Open source

`lms` is **MIT Licensed** and is developed in this repository on GitHub: https://github.com/lmstudio-ai/lms

## Command quick links

| Command | Syntax | Docs |
| --- | --- | --- |
| Chat in the terminal | `lms chat` | [Guide](/docs/cli/local-models/chat) |
| Download models | `lms get` | [Guide](/docs/cli/local-models/get) |
| List your models | `lms ls` | [Guide](/docs/cli/local-models/ls) |
| See models loaded into memory | `lms ps` | [Guide](/docs/cli/local-models/ps) |
| Control the server | `lms server start` | [Guide](/docs/cli/serve/server-start) |
| Manage the inference runtime | `lms runtime` | [Guide](/docs/cli/runtime) |


### Verify the installation

```lms_info
👉 You need to run LM Studio _at least once_ before you can use `lms`.
```

Open a terminal window and run `lms`.

```lms_terminal
$ lms

lms is LM Studio's CLI utility for your models, server, and inference runtime. (v0.0.47)

Usage: lms [options] [command]

Local models
   chat               Start an interactive chat with a model
   get                Search and download models
   load               Load a model
   unload             Unload a model
   ls                 List the models available on disk
   ps                 List the models currently loaded in memory
   import             Import a model file into LM Studio

Serve
   server             Commands for managing the local server
   log                Log incoming and outgoing messages

Runtime
   runtime            Manage and update the inference runtime

Develop & Publish (Beta)
   clone              Clone an artifact from LM Studio Hub to a local folder
   push               Uploads the artifact in the current folder to LM Studio Hub
   dev                Starts a plugin dev server in the current folder
   login              Authenticate with LM Studio

Learn more:           https://lmstudio.ai/docs/developer
Join our Discord:     https://discord.gg/lmstudio
```

## Use `lms` to automate and debug your workflows

### Start and stop the local server

```bash
lms server start
lms server stop
```

Learn more about [`lms server`](/docs/cli/serve/server-start).

### List the local models on the machine

```bash
lms ls
```

Learn more about [`lms ls`](/docs/cli/local-models/ls).

This will reflect the current LM Studio models directory, which you set in **📂 My Models** tab in the app.

### List the currently loaded models

```bash
lms ps
```

Learn more about [`lms ps`](/docs/cli/local-models/ps).

### Load a model (with options)

```bash
lms load [--gpu=max|auto|0.0-1.0] [--context-length=1-N]
```

`--gpu=1.0` means 'attempt to offload 100% of the computation to the GPU'.

- Optionally, assign an identifier to your local LLM:

```bash
lms load openai/gpt-oss-20b --identifier="my-model-name"
```

This is useful if you want to keep the model identifier consistent.

### Unload a model
```
lms unload [--all]
```

Learn more about [`lms load and unload`](/docs/cli/local-models/load).


## Contributing

> Learn where to file issues and how to contribute to the `lms` CLI.


The `lms` CLI is open source on GitHub: https://github.com/lmstudio-ai/lms

If you spot a bug, want to request a feature, or plan to contribute:

- File issues or feature requests in the GitHub repository.
- Open pull requests against the `main` branch with a concise summary and testing notes.
- Review the repository README for setup instructions and coding standards.


## local-models

### `lms chat`

> Start a chat session with a local model from the command line.


Use `lms chat` to talk to a local model directly in the terminal. This is handy for quick experiments or scripting.

### Flags 
```lms_params
- name: "[model]"
  type: "string"
  optional: true
  description: "Identifier of the model to use. If omitted, you will be prompted to pick one."
- name: "-p, --prompt"
  type: "string"
  optional: true
  description: "Send a one-off prompt and print the response to stdout before exiting"
- name: "-s, --system-prompt"
  type: "string"
  optional: true
  description: "Custom system prompt for the chat"
- name: "--stats"
  type: "flag"
  optional: true
  description: "Show detailed prediction statistics after each response"
- name: "--ttl"
  type: "number"
  optional: true
  description: "Seconds to keep the model loaded after the chat ends (default: 3600)"
```

### Start an interactive chat

```shell
lms chat
```

You will be prompted to pick a model if one is not provided.

### Chat with a specific model

```shell
lms chat my-model
```

### Send a single prompt and exit

Use `-p` to print the response to stdout and exit instead of staying interactive:

```shell
lms chat my-model -p "Summarize this release note"
```

### Set a system prompt

```shell
lms chat my-model -s "You are a terse assistant. Reply in two sentences."
```

### Keep the model loaded after chatting

```shell
lms chat my-model --ttl 600
```

### Pipe input from another command

`lms chat` reads from stdin, so you can pipe content directly into a prompt:

```shell
cat my_file.txt | lms chat -p "Summarize this, please"
```


### `lms get`

> Search and download models from the command line.


The `lms get` command allows you to search and download models from online repositories. If no model is specified, it shows staff-picked recommendations.

Models you download via `lms get` will be stored in your LM Studio model directory. 

### Flags 
```lms_params
- name: "[modelName]"
  type: "string"
  optional: true
  description: "The model to download. If omitted, staff picks are shown. For models with multiple quantizations, append '@' (e.g., 'llama-3.1-8b@q4_k_m')."
- name: "--mlx"
  type: "flag"
  optional: true
  description: "Include only MLX models in search results. If either '--mlx' or '--gguf' is set, only matching formats are shown; otherwise results match installed runtimes."
- name: "--gguf"
  type: "flag"
  optional: true
  description: "Include only GGUF models in search results. If either '--mlx' or '--gguf' is set, only matching formats are shown; otherwise results match installed runtimes."
- name: "-n, --limit"
  type: "number"
  optional: true
  description: "Limit the number of model options shown."
- name: "--always-show-all-results"
  type: "flag"
  optional: true
  description: "Always prompt you to choose from search results, even when there's an exact match."
- name: "-a, --always-show-download-options"
  type: "flag"
  optional: true
  description: "Always prompt you to choose a quantization, even when an exact match is auto-selected."
```

## Download a model

Download a model by name:

```shell
lms get llama-3.1-8b
```

### Specify quantization

Download a specific model quantization:

```shell
lms get llama-3.1-8b@q4_k_m
```

### Filter by format

Show only MLX or GGUF models:

```shell
lms get --mlx
lms get --gguf
```

### Control search results

Limit the number of results:

```shell
lms get --limit 5
```

Always show all options:

```shell
lms get --always-show-all-results
lms get --always-show-download-options
```


### `lms load`

> Load or unload models, set context length, GPU offload, TTL, or estimate memory usage without loading.


The `lms load` command loads a model into memory. You can optionally set parameters such as context length, GPU offload, and TTL. This guide also covers unloading models with `lms unload`.

### Flags 
```lms_params
- name: "[path]"
  type: "string"
  optional: true
  description: "The path of the model to load. If not provided, you will be prompted to select one"
- name: "--ttl"
  type: "number"
  optional: true
  description: "If provided, when the model is not used for this number of seconds, it will be unloaded"
- name: "--gpu"
  type: "string"
  optional: true
  description: "How much to offload to the GPU. Values: 0-1, off, max"
- name: "--context-length"
  type: "number"
  optional: true
  description: "The number of tokens to consider as context when generating text"
- name: "--identifier"
  type: "string"
  optional: true
  description: "The identifier to assign to the loaded model for API reference"
- name: "--estimate-only"
  type: "boolean"
  optional: true
  description: "Print a resource (memory) estimate and exit without loading the model"
```

## Load a model

Load a model into memory by running the following command:

```shell
lms load <model_key>
```

You can find the `model_key` by first running [`lms ls`](/docs/cli/local-models/ls) to list your locally downloaded models.

### Set a custom identifier

Optionally, you can assign a custom identifier to the loaded model for API reference:

```shell
lms load <model_key> --identifier "my-custom-identifier"
```

You will then be able to refer to this model by the identifier `my_model` in subsequent commands and API calls (`model` parameter).

### Set context length

You can set the context length when loading a model using the `--context-length` flag:

```shell
lms load <model_key> --context-length 4096
```

This determines how many tokens the model will consider as context when generating text.

### Set GPU offload

Control GPU memory usage with the `--gpu` flag:

```shell
lms load <model_key> --gpu 0.5    # Offload 50% of layers to GPU
lms load <model_key> --gpu max    # Offload all layers to GPU
lms load <model_key> --gpu off    # Disable GPU offloading
```

If not specified, LM Studio will automatically determine optimal GPU usage.

### Set TTL

Set an auto-unload timer with the `--ttl` flag (in seconds):

```shell
lms load <model_key> --ttl 3600   # Unload after 1 hour of inactivity
```

### Estimate resources without loading

Preview memory requirements before loading a model using `--estimate-only`:

```shell
lms load --estimate-only <model_key>
```

Optional flags such as `--context-length` and `--gpu` are honored and reflected in the estimate. The estimator accounts for factors like context length, flash attention, and whether the model is vision‑enabled.

Example:

```bash
$ lms load --estimate-only gpt-oss-120b
Model: openai/gpt-oss-120b
Estimated GPU Memory:   65.68 GB
Estimated Total Memory: 65.68 GB

Estimate: This model may be loaded based on your resource guardrails settings.
```

## Unload models

Use `lms unload` to remove models from memory.

### Flags 
```lms_params
- name: "[model_key]"
  type: "string"
  optional: true
  description: "The key of the model to unload. If not provided, you will be prompted to select one"
- name: "--all"
  type: "flag"
  optional: true
  description: "Unload all currently loaded models"
- name: "--host"
  type: "string"
  optional: true
  description: "The host address of a remote LM Studio instance to connect to"
```

### Unload a specific model

```shell
lms unload <model_key>
```

If no model key is provided, you will be prompted to select from currently loaded models.

### Unload all models

```shell
lms unload --all
```

### Unload from a remote LM Studio instance

```shell
lms unload <model_key> --host <host>
```

## Operate on a remote LM Studio instance

`lms load` supports the `--host` flag to connect to a remote LM Studio instance. 

```shell
lms load <model_key> --host <host>
```

For this to work, the remote LM Studio instance must be running and accessible from your local machine, e.g. be accessible on the same subnet.


### `lms ls`

> List all downloaded models in your LM Studio installation.


The `lms ls` command displays a list of all models downloaded to your machine, including their size, architecture, and parameters.

### Flags 

```lms_params
- name: "--llm"
  type: "flag"
  optional: true
  description: "Show only LLMs. When not set, all models are shown"
- name: "--embedding"
  type: "flag"
  optional: true
  description: "Show only embedding models"
- name: "--json"
  type: "flag"
  optional: true
  description: "Output the list in JSON format"
- name: "--detailed"
  type: "flag"
  optional: true
  description: "Show detailed information about each model"
```

## List all models

Show all downloaded models:

```shell
lms ls
```

Example output:

```
You have 47 models, taking up 160.78 GB of disk space.

LLMs (Large Language Models)                       PARAMS      ARCHITECTURE           SIZE
lmstudio-community/meta-llama-3.1-8b-instruct          8B         Llama            4.92 GB
hugging-quants/llama-3.2-1b-instruct                   1B         Llama            1.32 GB
mistral-7b-instruct-v0.3                                         Mistral           4.08 GB
zeta                                                   7B         Qwen2            4.09 GB

... (abbreviated in this example) ...

Embedding Models                                   PARAMS      ARCHITECTURE           SIZE
text-embedding-nomic-embed-text-v1.5@q4_k_m                     Nomic BERT        84.11 MB
text-embedding-bge-small-en-v1.5                     33M           BERT           24.81 MB
```

### Filter by model type

List only LLM models:

```shell
lms ls --llm
```

List only embedding models:

```shell
lms ls --embedding
```

### Additional output formats

Get detailed information about models:

```shell
lms ls --detailed
```

Output in JSON format:

```shell
lms ls --json
```

## Operate on a remote LM Studio instance

`lms ls` supports the `--host` flag to connect to a remote LM Studio instance:

```shell
lms ls --host <host>
```

For this to work, the remote LM Studio instance must be running and accessible from your local machine, e.g. be accessible on the same subnet.


### `lms ps`

> Show information about currently loaded models from the command line.


The `lms ps` command displays information about all models currently loaded in memory.

## List loaded models

Show all currently loaded models:

```shell
lms ps
```

Example output:
```
   LOADED MODELS

Identifier: unsloth/deepseek-r1-distill-qwen-1.5b
  • Type:  LLM
  • Path: unsloth/DeepSeek-R1-Distill-Qwen-1.5B-GGUF/DeepSeek-R1-Distill-Qwen-1.5B-Q4_K_M.gguf
  • Size: 1.12 GB
  • Architecture: Qwen2
```

### JSON output

Get the list in machine-readable format:
```shell
lms ps --json
```

## Operate on a remote LM Studio instance

`lms ps` supports the `--host` flag to connect to a remote LM Studio instance:

```shell
lms ps --host <host>
```

For this to work, the remote LM Studio instance must be running and accessible from your local machine, e.g. be accessible on the same subnet.


### `lms import`

> Import a local model file into your LM Studio models directory.


Use `lms import` to bring an existing model file into LM Studio without downloading it.

### Flags 
```lms_params
- name: "<file-path>"
  type: "string"
  optional: false
  description: "Path to the model file to import"
- name: "--user-repo"
  type: "string"
  optional: true
  description: "Set the target folder as <user>/<repo>. Skips the categorization prompts."
- name: "-y, --yes"
  type: "flag"
  optional: true
  description: "Skip confirmations and try to infer the model location from the file name"
- name: "-c, --copy"
  type: "flag"
  optional: true
  description: "Copy the file instead of moving it"
- name: "-L, --hard-link"
  type: "flag"
  optional: true
  description: "Create a hard link instead of moving or copying the file"
- name: "-l, --symbolic-link"
  type: "flag"
  optional: true
  description: "Create a symbolic link instead of moving or copying the file"
- name: "--dry-run"
  type: "flag"
  optional: true
  description: "Do not perform the import, just show what would be done"
```

Only one of `--copy`, `--hard-link`, or `--symbolic-link` can be used at a time. If none is provided, `lms import` moves the file by default.

### Import a model file

```shell
lms import ~/Downloads/model.gguf
```

### Keep the original file

```shell
lms import ~/Downloads/model.gguf --copy
```

### Pick the target folder yourself

Use `--user-repo` to skip prompts and place the model in the chosen namespace:

```shell
lms import ~/Downloads/model.gguf --user-repo my-user/custom-models
```

### Dry run before importing

```shell
lms import ~/Downloads/model.gguf --dry-run
```


## serve

### `lms server start`

> Start the LM Studio local server with customizable port and logging options.


The `lms server start` command launches the LM Studio local server, allowing you to interact with loaded models via HTTP API calls.

### Flags 
```lms_params
- name: "--port"
  type: "number"
  optional: true
  description: "Port to run the server on. If not provided, uses the last used port"
- name: "--cors"
  type: "flag"
  optional: true
  description: "Enable CORS support for web application development. When not set, CORS is disabled"
```

## Start the server

Start the server with default settings:

```shell
lms server start
```

### Specify a custom port

Run the server on a specific port:

```shell
lms server start --port 3000
```

### Enable CORS support

For usage with web applications or some VS Code extensions, you may need to enable CORS support:

```shell
lms server start --cors
```

Note that enabling CORS may expose your server to security risks, so use it only when necessary.

### Check the server status

See [`lms server status`](/docs/cli/serve/server-status) for more information on checking the status of the server.


### `lms server status`

> Check the status of your running LM Studio server instance.


The `lms server status` command displays the current status of the LM Studio local server, including whether it's running and its configuration.

### Flags 
```lms_params
- name: "--json"
  type: "flag"
  optional: true
  description: "Output the status in JSON format"
- name: "--verbose"
  type: "flag"
  optional: true
  description: "Enable detailed logging output"
- name: "--quiet"
  type: "flag"
  optional: true
  description: "Suppress all logging output"
- name: "--log-level"
  type: "string"
  optional: true
  description: "The level of logging to use. Defaults to 'info'"
```

## Check server status

Get the basic status of the server:

```shell
lms server status
```

Example output:
```
The server is running on port 1234.
```

### Example usage

```console
➜  ~ lms server start
Starting server...
Waking up LM Studio service...
Success! Server is now running on port 1234

➜  ~ lms server status
The server is running on port 1234.
```

### JSON output

Get the status in machine-readable JSON format:

```shell
lms server status --json --quiet
```

Example output:
```json
{"running":true,"port":1234}
```

### Control logging output

Adjust logging verbosity:

```shell
lms server status --verbose
lms server status --quiet
lms server status --log-level debug
```

You can only use one logging control flag at a time (`--verbose`, `--quiet`, or `--log-level`).


### `lms server stop`

> Stop the running LM Studio server instance.


The `lms server stop` command gracefully stops the running LM Studio server.

```shell
lms server stop
```

Example output:
```
Stopped the server on port 1234.
```

Any active request will be terminated when the server is stopped. You can restart the server using [`lms server start`](/docs/cli/serve/server-start).


### `lms log stream`

> Stream logs from LM Studio. Useful for debugging prompts sent to the model.


`lms log stream` lets you inspect the exact strings LM Studio sends to and receives from models, and (new in 0.3.26) stream server logs. This is useful for debugging prompt templates, model IO, and server operations.

### Flags

```lms_params
- name: "-s, --source"
  type: "string"
  optional: true
  description: "Source of logs: model or server (default: model)"
- name: "--stats"
  type: "flag"
  optional: true
  description: "Print prediction stats when available"
- name: "--filter"
  type: "string"
  optional: true
  description: "Filter for model source: input, output, or both"
- name: "--json"
  type: "flag"
  optional: true
  description: "Output logs as JSON (newline separated)"
```

### Quick start

Stream model IO (default):

```shell
lms log stream
```

Stream server logs:

```shell
lms log stream --source server
```

### Filter model logs

```bash