- Start LM Studio's local server first — OpenClaw checks the connection at startup and fails if the server isn't running
- Get the exact model identifier from /v1/models before writing your OpenClaw config — any mismatch causes silent failures
- The api_key field is required in OpenClaw config but LM Studio ignores it — use any placeholder string
- Test with a simple curl command before launching the full agent — saves debugging time if something is misconfigured
- Increase OpenClaw's request timeout for local models — local inference is slower than cloud APIs at peak load
Twelve minutes. That's how long this integration should take from opening LM Studio to getting your first agent response from a local model. The steps are straightforward — but each one has a specific failure mode that trips up 40% of first-time setups. Here's the right sequence.
Prerequisites Before You Start
Before touching OpenClaw config, confirm these three things are in place. Skipping the check is the fastest way to waste an hour debugging the wrong problem.
- LM Studio installed: Download from lmstudio.ai — available for macOS, Windows, and Linux. Version 0.2.x or later has the OpenAI-compatible server built in.
- A model downloaded: Open LM Studio's Discover tab and download at least one model. Mistral 7B Instruct (Q4_K_M) is under 4GB and a reliable starting point.
- OpenClaw installed and running: Confirm you can start OpenClaw without the LM Studio provider — the basic installation should be working before adding a new provider.
Sound familiar? Most integration guides assume all of this is already done. Don't skip the check — knowing your baseline saves debugging time later.
Start the LM Studio Local Server
LM Studio's server doesn't start automatically. You must enable it manually each time — or configure it to start on login in LM Studio's preferences.
- Open LM Studio and click the server icon in the left sidebar (looks like a rack server)
- In the "Select a model to load" dropdown, choose your downloaded model
- Wait for the model to finish loading — the progress bar completes and the model name appears in the status area
- Click the green Start Server button
- Confirm the status shows "Server Running" with a green indicator
- Note the server address displayed — default is
http://localhost:1234
In LM Studio preferences, enable "Start server on app launch" and "Launch at login" to avoid manually starting the server every session. For development machines that you want always ready, this removes the startup step entirely — OpenClaw can always connect when it needs to.
Get the Exact Model Identifier
This step is where most integrations fail. The model name you see in LM Studio's UI is not always the same string you need in your OpenClaw config.
Hit the models endpoint directly and use what the API returns:
curl http://localhost:1234/v1/models
The response looks like this:
{
"object": "list",
"data": [
{
"id": "mistral-7b-instruct-v0.3",
"object": "model",
"owned_by": "local"
}
]
}
Copy the id field exactly. That string — mistral-7b-instruct-v0.3 in this example — goes directly into your OpenClaw config. Do not retype it. Do not guess at it. Copy it.
Configure OpenClaw
Open your OpenClaw agent config file. Find the model or provider section and add the LM Studio provider block:
model:
provider: openai-compatible
base_url: http://localhost:1234/v1
api_key: lm-studio-local
model: mistral-7b-instruct-v0.3
timeout: 120
Key points about each field:
- provider: Must be
openai-compatible— this tells OpenClaw to use the OpenAI API format - base_url: The full server URL including
/v1— don't omit the path suffix - api_key: Required by the schema but ignored by LM Studio — use any non-empty string
- model: The exact
idstring from the /v1/models response - timeout: Set to 120 seconds — local inference can be slow on first run when the model warms up
A common config mistake: setting base_url to http://localhost:1234/v1/v1 by accidentally including the path twice. OpenClaw appends endpoint paths to the base_url — if you include /v1 in the base_url (which you should), don't add it again in the endpoint paths.
Test the Connection Before Going Live
Don't start OpenClaw and wait for it to fail. Test the LM Studio endpoint directly first with a quick completions call:
curl http://localhost:1234/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "mistral-7b-instruct-v0.3",
"messages": [{"role": "user", "content": "Reply with: connected"}],
"max_tokens": 10
}'
If you get a JSON response with a message content field containing text, the server is working correctly. If you get a connection refused error, the LM Studio server isn't running. If you get a model not found error, the model identifier in your request doesn't match what's loaded.
Once this test passes, start OpenClaw. The agent should connect to the local model and respond to your first test message within a few seconds.
Common Integration Issues
- Connection refused on startup: LM Studio server isn't running. Start it before launching OpenClaw — the server must be up when OpenClaw initializes.
- Model not found errors: The model identifier in your config doesn't match what's loaded. Re-run the /v1/models curl and copy the id field fresh.
- Timeout on first request: Normal for CPU-only inference — the model is warming up. Increase the timeout value and wait. Subsequent requests will be faster.
- Empty responses: Usually a context length mismatch. LM Studio may have a lower context limit than what OpenClaw is requesting. Reduce max_tokens or context length in your agent config.
- Garbled output: Wrong chat template for the model. In LM Studio, check that the correct prompt template is selected in the model settings — Mistral needs the Mistral template, LLaMA needs the LLaMA template.
Frequently Asked Questions
How do I start the LM Studio server for OpenClaw?
Open LM Studio, go to the Local Server tab, load a model, then click Start Server. The server starts on http://localhost:1234 by default. Confirm the green status indicator before launching OpenClaw.
What URL do I put in OpenClaw for LM Studio?
Use http://localhost:1234/v1 as the base_url in your OpenClaw provider config. This is LM Studio's default OpenAI-compatible endpoint. If you changed the port in LM Studio preferences, substitute that port number.
How do I find the model name to put in OpenClaw config?
Run curl http://localhost:1234/v1/models and copy the id field from the response. That string — including version numbers and quantization tags — is exactly what goes in the model field of your OpenClaw config.
How do I test that OpenClaw is connected to LM Studio correctly?
Send a simple test message to your agent after starting it. A response confirms the connection. Also check OpenClaw logs for the model provider initialization line — it confirms the base URL and model name it connected to.
Can I use multiple models in LM Studio with OpenClaw?
LM Studio runs one model at a time per server instance. To use multiple models, run separate LM Studio server instances on different ports and configure separate OpenClaw provider entries pointing to each port.
Why does my OpenClaw agent timeout when using LM Studio?
Timeouts mean the model is generating too slowly for OpenClaw's default timeout. Increase the request timeout in your config, or switch to a smaller quantized model. CPU-only inference is the most common cause of slow generation.
J. Donovan specializes in making complex AI infrastructure setup approachable. Has documented integration processes for over 30 local and cloud LLM providers, with a focus on the failure modes that documentation typically glosses over.