Executable programs and extensions

LM Studio guide: download a model and start chatting

Connect an LM Studio chat model to your own application

LM Studio is a desktop app for finding and downloading models to chat on your computer. Starting its API1 server lets an editor or your own program call the same model. We will cover starting a chat and connecting another app.

If the interface answers questions about a document but the same model called through the API does not know it, the model may be unchanged while the interface's document retrieval and request assembly are missing. Check server connectivity and document input as separate stages.

Requirements and key details
  • Load GGUF and Apple Silicon MLX files through their compatible runtime paths.
  • A memory estimate is a reference, not a substitute for observing actual loading.
  • A document attached in the interface is not automatically included in an API request.

Find and load a model, then start with a short chat

Use the LM Studio search screen to choose a small multilingual model, checking its file size and the application's fit information. Memory use varies with model size, quantization2, and format. After downloading, load the file from the model selector in the chat screen before sending a prompt3.

Request a short sentence correction to check the response. Then ask about a known item, such as an address in an installation guide, and compare with the source. Increasing the input from short chat to document questions lets you check responses, document processing, and memory in sequence.

A dashed line from an open server and colored block drawers leads to a window diagram while a hand draws the same connection in a notebook
Documents attached in the interface are not automatically included in API requests.

Match the operating system to GGUF or MLX format

LM Studio supports llama.cpp-based GGUF4 and MLX5 execution on Apple Silicon Mac. Two distributions with the same model name are not interchangeable files; choose for the OS and actual runtime6, and record model revision, quantization, context, and engine. Renaming an extension does not convert the format.

Current requirements specify Apple Silicon and macOS 14 or later on Mac; Intel Mac is unsupported. On Windows x64, check AVX2 support. Application installation requirements differ from the memory needed for a model and long documents. If loading fails, check model size, available memory, app/engine version, and file format.

Test memory estimates, model loading, and document input separately

The CLI7 option lms load --estimate-only estimates memory without loading the model, but it does not guarantee usage in other applications or runtime behavior. First load the model with a short context and confirm basic chat, then add the required document input. Estimation, actual loading, and document processing are separate stages.

The example starts a server with the alias local-guide and a 4,096-token context. Send a short prompt first, then increase context only when the actual task requires it. This helps distinguish model-loading failure from document text missing in the API request.

Running lms load opens a selection of downloaded models. Choose the file and wait for loading to finish. You can inspect the files first with lms ls. The command assigns the API alias local-guide to the selected model; use that alias in the next request.

Set a model alias and start the server
lms ls
lms load --context-length 4096 --identifier local-guide
lms server start --bind 127.0.0.1 --port 1234
Run in an environment with LM Studio and lms ready. Start the server after selecting the model; do not start a duplicate if one is already running.
A laptop and monitor display blocks of different heights, with one group linked to a vertical server scale
After estimating memory, test actual loading with a short context.

Check the API address and model alias with curl

Start the server and send the request below. local-guide is the API alias from the previous step, not a filename. Both curl and the client should use 127.0.0.1:1234 and a supported API path. A returned sentence confirms model selection and server connectivity, but does not mean the guide attached in the interface was sent to the API.

If authentication is enabled, include its token8 in the request header. Use 127.0.0.1 for testing on the same computer; do not expose the server to the network or enable CORS as a diagnostic shortcut. Missing document content is not fixed by changing the address or CORS.

Send the same short text question in the interface and through the API. If both behave similarly but document questions differ, check whether the API input omitted document content. If even short questions differ, inspect the model alias, chat template, and generation settings.

Check a response using the API alias
curl -sS http://127.0.0.1:1234/v1/chat/completions -H "Content-Type: application/json" -d '{"model":"local-guide","messages":[{"role":"user","content":"Reply with one short sentence."}],"max_tokens":128,"stream":false}'
This checks a local server without authentication. It returns the completed answer at once, so it is not for measuring time to first token.

Include document content in requests from your API client

If API answers about the guide are wrong, check whether the application actually included the document in its request. Short material can be included directly; longer material may need retrieval of relevant passages. Processing triggered by attaching a file in the interface is not automatically carried over to API calls.

To investigate, include a sentence you already know from the guide directly in the API request and ask about it. If the model answers from that sentence, the model and API are processing text. If results differ only when you attach the file in the UI, check how the app retrieves document text and adds it to the API request.

If the answer format is still wrong with the text included directly, compare the model file, chat template, and generation settings. This test diagnoses the path used in this case; it does not measure general document-retrieval accuracy.

Test tool use separately from ordinary chat. Receiving a request, generating a tool-call format, executing the call in the application, and returning its result to the model are separate stages. After plain chat, add one needed tool, then connect the document task to isolate the failing boundary.

When the server must keep running without the app interface

If the API server must keep running after closing the application interface, consider LM Studio's separate llmster daemon. Using an API alone does not require switching products. A daemon needs its own startup, update, and restart-recovery plan, so a GUI may be simpler for short tasks that you supervise directly.

Before comparing acceleration or file support in another engine, record the model file, runtime, context, and request that produced the current answer. If including document content in the API solves the task, you can keep LM Studio. If retrieval/insertion is missing, improve the client; consider changing runtimes only when the current engine lacks a needed format or acceleration.

A server beside a small hub plugged into a wall outlet, with dotted lines connecting blocks, illustrated paper, and a box
A headless daemon also needs a startup, update, and restart-recovery plan.

Terminology notes

  1. API — A defined interface that lets other code call a program’s functions.

    Back to the text
  2. Quantization — A way to represent model weights or values with fewer bits, reducing storage and memory use. The coarser representation can also affect accuracy.

    Back to the text
  3. Prompt — The input text sent to a model. For generative models it describes the desired result and strongly shapes the output.

    Back to the text
  4. GGUF — A file format for model data, widely used by llama.cpp-based tools.

    Back to the text
  5. MLX — Apple’s machine-learning framework, which runs models using memory shared by the CPU and GPU on Apple Silicon.

    Back to the text
  6. Runtime — The software environment that provides facilities needed while a program runs. In local AI, it can also refer to a model execution engine.

    Back to the text
  7. CLI — Short for Command-Line Interface: operating a program by entering commands in a terminal.

    Back to the text
  8. Token — A unit into which a model divides input or output for processing.

    Back to the text

Frequently asked questions

What should you check first in this article?
LM Studio is a desktop app for finding and downloading models to chat on your computer. Starting its API server lets an editor or your own program call the same model. We will cover starting a chat and connecting another app.
How much memory does it need?
The CLI option lms load --estimate-only estimates memory without loading the model, but it does not guarantee usage in other applications or runtime behavior. First load the model with a short context and confirm basic chat, then add the required document input. Estimation, actual loading, and document processing are separate stages.
Change log

These entries record changes to the site's guidance. They do not automatically check your installed engine or model version.

  1. Added LM Studio model-loading and API guidance

    Added examples that set a context length and identifier when loading a model, then use the same name in a local API request. It distinguishes MLX and GGUF paths and explains that documents added in the app are not automatically included in API requests.