Skip to content
EN

Use a local model with LM Studio and Codex

LM Studio can serve a model running on your computer. Add it as a provider in Mandri, then select that model for a Codex session. This guide keeps LM Studio and Mandri on the same computer.

Install LM Studio and download a model that fits your computer’s memory. For coding tasks, choose a model with native tool use support, identified by a hammer badge in LM Studio. The model needs to request actions such as reading or editing a file, not just produce text.

Load the model. In LM Studio’s Developer tab, turn on Start server and note the address and port. The default port is 1234. Keep the server running while you use the model in Mandri.

The LM Studio server guide covers these controls. Its tool use documentation explains the differences between models. Memory use, available context and speed depend on the model and its settings.

  1. Open Settings, then Providers, and select Add provider.
  2. Enter a Name, such as lmstudio.
  3. Set Kind to LM Studio.
  4. In Base URL, enter http://localhost:1234 if you use LM Studio’s default port. Otherwise, use the address shown by your server.
  5. Leave API key empty if your LM Studio server does not require authentication. If authentication is enabled, enter its key.
  6. Select Save and verify.

After saving, the provider appears in the list. Click its name to view its model catalog. Verification checks access to the server and catalog; it does not test every model’s ability to complete a coding task.

localhost refers to the computer running Mandri’s local service. This address will not reach an LM Studio server running on a different computer.

Start a Codex session with the local model

Section titled “Start a Codex session with the local model”
  1. Return to New chat and select your project folder.
  2. Choose Codex in the tool selector. It is included with Mandri.
  3. Open the model menu and select your local model under lmstudio, or the provider name you chose.
  4. Choose Ask for approval for actions that require your decision.
  5. Send a small request whose result you can check, such as asking the agent to explain a file in your project.

The selected LM Studio model handles this session’s model requests. The agent can still run commands or use other services as part of its task, according to its permissions. Selecting a local model alone does not make every action offline.

When you ask for an edit, follow the tool calls and review the changed files.

Mandri cannot verify the provider: confirm that the server is running and the port matches Base URL. If the server requires authentication, check its key.

The model is missing from the catalog: check that it is downloaded and available in LM Studio. Consult the model list in Mandri again after preparing it on the server.

The model answers but does not perform the task: tool use varies between models. Try a model with native tool use support and begin with a smaller task. A successful text answer is not a test of reliable file editing.

The task runs out of context or memory: review the model’s context and memory settings in LM Studio. A coding session includes file contents and tool results in addition to your prompt. The appropriate settings depend on your model and hardware.

To use a hosted model instead, see OpenRouter with Pi or Codex. For a walkthrough of the app, see Run your first task.