AI Usage Tracker

How to Increase LM Studio Context Length on Mac

Increase LM Studio’s context length on Mac, estimate memory before reloading, and verify the setting on the exact model instance your client uses.

LM Studio can report that your model loaded with a 4,096-token context even when the model supports a much longer window. If you’re trying to fit a document or a long chat, start with the load settings for the model your client is actually using.

On this page

1. Change the setting for the next load

Open My Models in LM Studio and use the gear next to the model to edit its default load settings. Set Context Length, finish any requests using that model, then eject and reload it. For a one-off change, choose the load parameters when loading the model and leave the saved defaults alone. LM Studio’s per-model defaults

If you use the CLI, get the downloaded model key from lms ls. This example requests an estimate for 8,192 tokens and exits without loading. Use the exact key from your own list.

lms ls
lms load "your-model-key" --context-length 8192 --estimate-only

Larger context can raise memory requirements. If the estimate suits your Mac, unload the old instance after its work finishes. Then run the load command again without --estimate-only. Use 8,192 as an example to evaluate against your workload and model. LM Studio load and unload commands

2. Verify which instance got the setting

Run lms ps to identify the loaded instance. If you already use LM Studio’s local API server, its native /api/v1/models endpoint reports both the model’s maximum and the settings for each loaded instance. Use your server’s configured port in place of 1234. If it requires authentication, include your existing bearer token as shown in the API docs. The example uses jq to keep just the relevant fields.

curl -fsS http://127.0.0.1:1234/api/v1/models |
  jq -r '.models[] as $m |
    $m.loaded_instances[]? |
    [.id, .config.context_length, $m.max_context_length] |
    @tsv'

The output columns are instance ID, loaded context, and model maximum. Match the first column to the model ID in your client’s request. If the request succeeds but prints no rows, the server reported no loaded instances.

Illustrative readings for one model
work-chat
4,096 tokens loaded
long-chat
8,192 tokens loaded
Model maximum
32,768 tokens for both

In this example, a request to work-chat still uses the 4,096-token setting. A request to long-chat uses 8,192. Loaded models CLI · Native model-list API

3. Retry on the verified instance

If the reported context length is still too small, check the client’s server address and model ID before changing the load settings again. If those match but the loaded value differs from your request, note your LM Studio version, model and runtime. Some MLX users have reported auto-fit overriding their chosen value. If the instance reports the intended size and your long prompt still fails, keep the exact error and try a shorter document or a fresh chat with less history. MLX context-length report