openclaw - ✅(Solved) Fix [Bug]: OpenClaw breaks LM Studio's "Just In Time" system [2 pull requests, 2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#75921Fetched 2026-05-03 04:44:16
View on GitHub
Comments
2
Participants
3
Timeline
9
Reactions
2
Author
Timeline (top)
commented ×2cross-referenced ×2labeled ×2closed ×1

Since at least 2026.4.22, OC's use of LM Studio /api/v1/models/load API prevents LM Studio's JIT model loading from functioning.

Root Cause

None of the models unload. In fact, neither of them are recognized as "Just in time" loaded, because OC uses the /api/v1/models/load API from lmstudio which treats the models as being manually loaded.

Fix Action

Fixed

PR fix notes

PR #75925: fix(lmstudio): skip manual model load when skipModelLoad is enabled [AI-assisted]

Description (problem / solution / changelog)

🤖 AI-assisted (built with Hermes orchestration). Test level: fully tested. Prompt summary available on request.

Summary

  • Problem: When LM Studio JIT model loading is enabled, OpenClaw's call to /api/v1/models/load marks models as manually loaded, preventing LM Studio's JIT auto-unload from functioning.
  • Why it matters: Users who rely on JIT to swap between large models on memory-constrained hardware cannot benefit from automatic model lifecycle management.
  • What changed: Added a skipModelLoad boolean option to the LM Studio provider config (models.providers.lmstudio.skipModelLoad). When set to true, both inference preload and embedding warmup paths return early without calling the load API. Registered the new field in ModelProviderConfig, Zod schema, generated JSON schema, labels, and help text.
  • What did NOT change (scope boundary): Default behavior (false) is fully preserved. No changes to LM Studio model discovery, inference, or embedding logic outside the preload guard.

Change Type (select all)

  • Bug fix

Scope (select all touched areas)

  • Extensions / Plugins

Linked Issue/PR

  • Closes #75921
  • This PR fixes a bug or regression

Root Cause

  • Root cause: ensureLmstudioModelLoaded unconditionally calls /api/v1/models/load, which marks models as manually loaded in LM Studio, overriding JIT TTL-based lifecycle management.
  • Missing detection / guardrail: No config opt-out existed for the preload call.
  • Contributing context: The preload was added for reliability but conflicts with LM Studio's newer JIT auto-load/unload feature.

Regression Test Plan

  • Coverage level that should have caught this:
    • Unit test
  • Target test or file: extensions/lmstudio/src/stream.test.ts
  • Scenario the test should lock in: When skipModelLoad: true is set in provider config, ensureLmstudioModelLoaded must not be called.
  • Why this is the smallest reliable guardrail: The preload mock assertion directly verifies the skip path without requiring a live LM Studio instance.
  • Existing test that already covers this (if any): N/A (new behavior)
  • If no new test is added, why not: N/A (test added)

User-visible / Behavior Changes

New optional config key models.providers.lmstudio.skipModelLoad (boolean, default false). When true, OpenClaw does not call /api/v1/models/load before inference or embedding requests.

Diagram (if applicable)

N/A

Security Impact (required)

  • New permissions/capabilities? No
  • This change only adds an opt-in config flag that skips an outbound HTTP call to the user's own local LM Studio instance. No new secrets, dependencies, or broader permissions.

Changed files

  • extensions/lmstudio/src/embedding-provider.ts (modified, +19/-15)
  • extensions/lmstudio/src/stream.test.ts (modified, +24/-0)
  • extensions/lmstudio/src/stream.ts (modified, +6/-0)
  • src/config/schema.base.generated.ts (modified, +11/-0)
  • src/config/schema.help.ts (modified, +2/-0)
  • src/config/schema.labels.ts (modified, +1/-0)
  • src/config/types.models.ts (modified, +2/-0)
  • src/config/zod-schema.core.ts (modified, +1/-0)

PR #75939: fix: add sendLoadApi option for LM Studio provider

Description (problem / solution / changelog)

Summary

Adds a new provider config option sendLoadApi (default: true) that controls whether OpenClaw sends the /api/v1/models/load request to LM Studio before inference.

When set to false, OpenClaw skips the explicit model loading call, allowing LM Studio's Just-In-Time (JIT) model loading feature to work as intended. This lets LM Studio handle automatic model loading and unloading based on its own TTL and unload settings.

Changes

  • Added sendLoadApi?: boolean to ModelProviderConfig type
  • Added sendLoadApi: z.boolean().optional() to Zod schema
  • Added help text and label for models.providers.*.sendLoadApi
  • Modified ensureLmstudioModelLoadedBestEffort in stream.ts to skip load call when sendLoadApi === false
  • Modified createLmstudioEmbeddingProvider in embedding-provider.ts to also respect sendLoadApi === false

Testing

  • All 68 existing LM Studio extension tests pass
  • The fix was verified by checking that ensureLmstudioModelLoaded is not called when sendLoadApi is false

Fixes openclaw/openclaw#75921

Changed files

  • extensions/lmstudio/src/embedding-provider.ts (modified, +21/-15)
  • extensions/lmstudio/src/stream.ts (modified, +7/-0)
  • src/config/schema.help.ts (modified, +2/-0)
  • src/config/schema.labels.ts (modified, +1/-0)
  • src/config/types.models.ts (modified, +1/-0)
  • src/config/zod-schema.core.ts (modified, +1/-0)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Since at least 2026.4.22, OC's use of LM Studio /api/v1/models/load API prevents LM Studio's JIT model loading from functioning.

Steps to reproduce

  1. Install LM Studio (GUI version to make it easy to see what's going on) v0.4.12 (latest of this bug report)
  2. Download at least 2 models to lmstudio. (called "one" and "two" here just for example)
  3. Configure the server to: 3a. Turn on Just-in-time model loading, 3b. Turn on Auto unload unused JIT loaded models 3c. Set Max idle TTL to 1 minute (makes it faster to test) 3d. Turn on Only keep Last JIT loaded model
  4. Set the LMStudio server to running
  5. Use "openclaw configure" (v 2026.4.22 or higher) to use the guided setup to add the new lmstudio provider and models (which will get named "lmstudio/one" and "lmstudio/two" (assuming the models were named "one" and "two")
  6. Start the gateway, log on the webchat/control-ui, select one of the two new models, and send "/new" to the chat window.
  7. After the model loads, wait 2 minutes (doing nothing)
  8. in the web chat window, switch to the other lmstudio model and send "/new" again.
  9. Wait 2 more minutes.

Expected behavior

Expected, using the steps from the steps to repeat above...

After # 7, the first model should unload (1 minute TTL) After # 8, the first model should unload (Only keep Last JIT loaded model) After # 9, the second model should unload (1 minute TTL)

Actual behavior

None of the models unload. In fact, neither of them are recognized as "Just in time" loaded, because OC uses the /api/v1/models/load API from lmstudio which treats the models as being manually loaded.

OpenClaw version

2026.4.22

Operating system

MacOS 26.4.1 (LM Studio), Debian Trixie (openclaw)

Install method

install.sh

Model

google/gemma-4-26b-a4b and google/gemma-4-e4b

Provider / routing chain

webchat/control-ui (via ssh tunnel) - everything else was plain network calls

Additional provider/model setup details

lmstudio provider documentation references JIT: https://docs.openclaw.ai/providers/lmstudio#just-in-time-model-loading

The text there says "make sure you have this enabled to avoid 'Model not loaded' errors. However, due to using the /api/v1/models/load API, the JIT options in lmstudio might as well be turned off as they're completely ignored. If OC were to skip that single API call, and lmstudio had JIT loading enabled, the model should load automatically (and then be subject to automatic unloading if desired by the user.)

Logs, screenshots, and evidence

Impact and severity

Affected: Anyone who wants to use lmstudio's JIT loading/unloading feature to be able to switch models without running out of memory.

Severity: Blocks the ability to use two (or more) high memory models on local servers with only enough memory for one at a time

Frequency: 100% repeatable

Consequence: Extra cost? In other to do the same thing, extra mac studio's need to be purchased. ;)

Additional information

I've desperately tried to find a work-around, but no luck. Ideal solution (in my opinion) would be to allow an option in the lmstudio provider to prevent sending manual load command.

Perhaps: models.providers.lmstudio.sendLoadApi : true | false. Defaults to "true" for existing behavior, but can be set to false to block sending /api/v1/models/load

extent analysis

TL;DR

The issue can be fixed by modifying the OpenClaw configuration to prevent sending the manual load command to LM Studio, allowing JIT loading to function as expected.

Guidance

  • The root cause of the issue is the use of the /api/v1/models/load API by OpenClaw, which treats models as manually loaded and prevents JIT loading from functioning.
  • To verify the issue, follow the steps to reproduce and check if the models are unloaded as expected.
  • A potential workaround is to add a configuration option to the LM Studio provider to prevent sending the manual load command, such as models.providers.lmstudio.sendLoadApi: false.
  • This option would need to be added to the OpenClaw configuration to allow JIT loading to function correctly.

Example

No code snippet is provided as the issue is related to configuration and API calls.

Notes

The ideal solution would be to add a configuration option to the LM Studio provider to prevent sending the manual load command. This would allow users to take advantage of JIT loading and unloading features in LM Studio.

Recommendation

Apply workaround: Add a configuration option to the LM Studio provider to prevent sending the manual load command, such as models.providers.lmstudio.sendLoadApi: false. This would allow JIT loading to function correctly and prevent models from being treated as manually loaded.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Expected, using the steps from the steps to repeat above...

After # 7, the first model should unload (1 minute TTL) After # 8, the first model should unload (Only keep Last JIT loaded model) After # 9, the second model should unload (1 minute TTL)

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: OpenClaw breaks LM Studio's "Just In Time" system [2 pull requests, 2 comments, 3 participants]