Skip to content
EN

Use LM Studio with Codex from the terminal

Use the Mandri CLI to connect Codex to a model served by LM Studio on the same computer.

Download and load a model that fits your computer’s memory. Choose a model with native tool use support for coding tasks.

In LM Studio’s Developer tab, select Start server. Note its address and port, then keep it running. The default address below assumes port 1234. See the LM Studio server documentation for its controls.

If server authentication is disabled, run:

Terminal window
mandri provider add lmstudio --kind lm_studio --base "http://localhost:1234" --key "lm-studio"

The current CLI requires a nonempty key even for a server without authentication. Here, lm-studio is a placeholder, not a credential. If your server requires authentication, omit --key and enter its actual key at the interactive prompt:

Terminal window
mandri provider add lmstudio --kind lm_studio --base "http://localhost:1234"

Use the address shown by your server if you changed its port. localhost refers to the computer running Mandri’s local service.

Terminal window
mandri provider models lmstudio

Copy the exact model ID, then replace <model-id> below. Run the command from your project folder:

Terminal window
mandri run --model "lmstudio/<model-id>" codex

Codex is included with Mandri. Enter your request in its terminal interface and review its actions and file changes.

The local model handles model requests for this session. The agent may still use other services or commands during a task. A local model alone does not make every action offline.

The server cannot be reached: check that LM Studio is running, the server is enabled and the port matches the command.

The model replies but cannot perform actions: check its tool use support. Memory, context and speed depend on the model and its settings.

For the graphical interface, see LM Studio in the app.