Skip to content

[WIP] LM Studio support#1

Closed
rugvedS07 wants to merge 14 commits intomainfrom
rugved/lmstudio-support
Closed

[WIP] LM Studio support#1
rugvedS07 wants to merge 14 commits intomainfrom
rugved/lmstudio-support

Conversation

@rugvedS07
Copy link
Copy Markdown
Owner

@rugvedS07 rugvedS07 commented Mar 16, 2026

Summary

  • Problem: Users worldwide rely on LM Studio for running open models on their own hardware. Connecting LM Studio with OpenClaw is currently hard to do. This PR fixes it
  • Why it matters: Makes it easier for users to use local models in OpenClaw using LM Studio
  • What changed: Adds LM Studio in the onboarding, loads the default embedding model when required. Users can configure LM Studio to use models for inference and embedding generation
  • What did NOT change (scope boundary): Only affects changes regarding LM Studio and adds new functionality.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes # https://github.com/openclaw/openclaw/issues/40107 https://github.com/openclaw/openclaw/issues/32898
  • Related #

User-visible / Behavior Changes

image
image
image

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? Yes - stores lmstudio:default API-key auth profile / resolves LM_API_TOKEN (placeholder allowed for local no-auth setups), while real auth is enforced by the external LM Studio server.
  • New/changed network calls? Yes - uses LM Studio's API, /api/v1/load and /api/v1/models on the base URL the user has configured
  • Command/tool execution surface changed? No
  • Data access scope changed? No
  • If any Yes, explain risk + mitigation:
    Requests are made to users LM Studio instance (localhost in most cases) and the API token is used for the said instance only.

Repro + Verification

Environment

  • OS: Linux
  • Runtime/container: Node 22
  • Model/provider: LM Studio
  • Integration/channel (if any): NA
  • Relevant config (redacted): Default for LM Studio

Steps

  1. Run openclaw onboard
  2. Select LM Studio as provider and complete on-boarding
  3. To use LM Studio as an embeddings provider, use openclaw config set agents.defaults.memorySearch.provider lmstudio

Expected

  • LM Studio provider is configured and populates all the models available while setup
  • Uses LM Studio for LLM inference and embedding generation
  • Stores the LM_API_TOKEN in the auth profile

Actual

  • Works as above

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Tests were added in

  • src/commands/lmstudio-setup.test.ts
  • src/agents/lmstudio-models.test.ts
  • src/memory/embeddings-lmstudio.test.ts
  • src/agents/memory-search.test.ts
  • src/commands/onboard-non-interactive.provider-auth.test.ts
  • src/plugin-sdk/subpaths.test.ts
  • src/plugins/contracts/discovery.contract.test.ts
  • src/plugins/bundled-provider-auth-env-vars.test.ts

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: Using LM Studio with OpenClaw, chatting with the model, using tools and verifying if embeddings are generated when memory is updated
  • Edge cases checked: LM Studio server is off/unreachable, JIT setting in LM Studio is off
  • What you did not verify: NA

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: Reverting commit should remove the LM Studio as a provider
  • Files/config to restore: None, LM Studio provider will not be picked up
  • Known bad symptoms reviewers should watch for: NA

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

None

@rugvedS07 rugvedS07 marked this pull request as ready for review March 17, 2026 19:52
@rugvedS07 rugvedS07 marked this pull request as draft March 17, 2026 19:52
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would recommend adding a brief paragraph describing what LM Studio is

LM Studio is a friendly application that makes it seamless to run open source models locally on your own hardware.

I'd also add a sentence or two about how OpenClaw integrates with LM Studio (via our native api/v1 API endpoints) and why this integration makes the set up much simpler (what users don't need to do/think about)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change "open-weight" to "open source" (in this and other files)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ wondering what's the rationale for this?


See [/providers/sglang](/providers/sglang) for details.

### Local proxies (LM Studio, vLLM, LiteLLM, etc.)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we removing this? JW

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can keep it as is, removed as we have our own section above

@rugvedS07 rugvedS07 force-pushed the rugved/lmstudio-support branch from beaffc4 to 123a147 Compare March 23, 2026 19:27
@rugvedS07 rugvedS07 closed this Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants