Use with LM Studio
Short answer. LM Studio’s local API server listens on http://localhost:1234 by default. Start it from the Developer tab with the Start server switch, or from a terminal:
lms server startCheck that it answers and see the model identifiers it serves:
curl http://localhost:1234/v1/modelsAtomic Agent ships a built-in LM Studio (local) preset for this address. Pick it in the desktop app or the terminal, choose a model, and the agent talks to LM Studio through its OpenAI-compatible endpoints. No API key is needed unless you turn on authentication in LM Studio.
LM Studio server cheat sheet
lms ships with LM Studio; run the app once before using it (lms docs).
| Command | What it does |
|---|---|
lms server start / lms server stop | Starts or stops the API server |
lms server status | Shows whether the server runs and on which port |
lms ls | Lists models on disk |
lms ps | Lists models loaded in memory |
lms load <model> --context-length=32768 | Loads a model with a given context window |
lms get qwen | Searches and downloads models |
The port, network access and authentication live in the server settings: Server Port, Serve on Local Network and Require Authentication (LM Studio server settings).
Common LM Studio server errors
- Connection refused on port 1234. The server is off. Flip Start server in the Developer tab or run
lms server start. - Connection refused, but the server is on. You changed Server Port. Run
lms server statusto see the real port and use that number everywhere below. - Model not found. The model id in the request does not match what
/v1/modelsreturns. Copy the id from that list. - First answer takes a long time. With Just in Time Model Loading on, LM Studio loads the model on the first request. Load it ahead of time with
lms load. - 401 Unauthorized. Require Authentication is on and the client sent no token or a wrong one. See Authentication below.
Use LM Studio with Atomic Agent
The preset is an openai-compatible provider with base URL http://localhost:1234. Atomic Agent reads model ids from /v1/models and chats through /v1/chat/completions; both are listed in LM Studio’s OpenAI compatibility docs.
Desktop app
-
In LM Studio, download a model and start the server.
-
Open Atomic Agent. On the first-run screen, click Already run Ollama or LM Studio? Use it instead, or pick the Cloud models card, which also lists the model apps on your computer.
-
Choose LM Studio (local) and pick a model from the list LM Studio returns.
Already set up? Open Settings › Models › Cloud providers, click Add provider and choose LM Studio (local).
Terminal
-
Install Atomic Agent with
curl -fsSL https://atomicagent.io/install | sh(Windows:irm https://atomicagent.io/install.ps1 | iex). -
Run
atomic-agent. In the first-run setup, choose Cloud models, then LM Studio (local), then a model. -
Later, add it from the LLM tab:
/llm, open Cloud, pressn, pick LM Studio (local). Switch with/llm provider lmstudioand change models with/model.
Configure by hand
{ "llm": { "activeTextProvider": "lmstudio", "providers": [ { "id": "local-llama", "kind": "llama-server" }, { "id": "lmstudio", "kind": "openai-compatible", "baseUrl": "http://localhost:1234", "apiKeyEnvVar": "LMSTUDIO_API_KEY", "defaultChatModel": "<model id from /v1/models>" } ] }}Keep the local-llama entry: it serves embeddings by default. defaultChatModel must be an id exactly as /v1/models returns it. An openai-compatible entry needs both baseUrl and defaultChatModel.
LM Studio on a different port or machine
The LM Studio (local) preset always saves http://localhost:1234. If you changed Server Port, or LM Studio runs on another computer with Serve on Local Network on, add an OpenAI-compatible provider instead (desktop: OpenAI-compatible API (custom base URL)) with the real address, for example http://192.168.1.20:1234, or edit baseUrl in the file.
If LM Studio requires authentication
With Require Authentication on, LM Studio expects a token in the Authorization header. Put the token in <stateDir>/.env (default ~/.atomic-agent/.env) as LMSTUDIO_API_KEY=..., the variable the preset names in apiKeyEnvVar, and restart the agent. With the variable unset, the agent sends no Authorization header at all.
Context length and tool calls
Atomic Agent reads only model ids from LM Studio, not each model’s context window. Set the window when you load the model (the load settings in the app, or lms load <model> --context-length=N). Agent sessions need room for tool definitions and history, so a few thousand tokens is not enough.
Tools go out in the OpenAI tools field, so the model must support tool calling. LM Studio describes this in its tool use docs. On Apple Silicon LM Studio can run both GGUF (llama.cpp) and MLX models (LM Studio docs); Atomic Agent does not care which engine serves the model, it only sees the API.
FAQ
What port does the LM Studio server use?
Port 1234 by default. You can change it in the server settings (Server Port). lms server status shows the port in use.
How do I start the LM Studio server without the app window?
Run lms server start. LM Studio also documents running headless as a service in its server docs.
Does Atomic Agent need an API key for LM Studio?
No, unless you enable Require Authentication. Then set LMSTUDIO_API_KEY in the agent’s .env.
Can Atomic Agent use MLX models from LM Studio?
Yes, as long as LM Studio serves them through its API. The agent sees an OpenAI-compatible server and a model id, whatever engine runs it.
Can I use Atomic Agent’s own model downloads instead?
Yes. The desktop app’s Local models route and the terminal’s atomic-agent models commands download GGUF models and run them on the agent’s built-in llama.cpp backend. See Use with llama.cpp.
Get updates by email
One email when a new version comes out.