#7568: feat(agents): add LM Studio auto-discovery and provider support
docs
agents
Cluster:
Model Authentication Enhancements
This PR adds support for **LM Studio** as a local model provider.
### Changes
- **Auto-Discovery:** Automatically detects models served by LM Studio at `http://localhost:1234/v1`.
- **Configuration:** Defaults to 32k context window and 8k max tokens.
- **Provider:** Adds `buildLMStudioProvider` to `models-config.providers.ts`.
- **Documentation:** Adds setup instructions in `docs/providers/lmstudio.md`.
- **Testing:** Includes unit tests for provider resolution behavior.
This simplifies using local models with OpenClaw without manual config editing.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
Adds an LM Studio local provider that can be enabled via `LMSTUDIO_API_KEY`/auth profiles and auto-discovers models from the default LM Studio OpenAI-compatible endpoint (`http://127.0.0.1:1234/v1/models`). This wires the provider into implicit provider resolution, extends env var API-key resolution to include `lmstudio`, adds a small unit test asserting the provider is not implicitly enabled without credentials, and introduces user-facing setup docs under `docs/providers/lmstudio.md`.
<h3>Confidence Score: 4/5</h3>
- This PR looks safe to merge; changes are localized and follow existing provider patterns.
- LM Studio support is added via the same implicit-provider/auth mechanisms used for other providers, with network discovery guarded by explicit credential presence and timeouts. Main concerns are testability of discovery (hard-disabled in test env) and a small docs grammar issue; no obvious runtime-breaking logic was found in the reviewed diffs.
- src/agents/models-config.providers.ts (discovery behavior in tests)
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#6968: Add LM Studio onboarding option
by i3T4AN · 2026-02-02
81.6%
#12059: feat(agents): Add Azure AI Foundry credential support
by lisanyambere · 2026-02-08
79.2%
#7113: feat(providers): add CommonStack provider support
by flhoildy · 2026-02-02
78.1%
#22069: fix(agents): add provider-specific hints for local model auth errors
by pierreeurope · 2026-02-20
77.8%
#4782: fix: Auto-discover Ollama models without requiring explicit API key
by spiceoogway · 2026-01-30
77.4%
#9822: fix: allow local/custom model providers for sub-agent inference
by stammtobias91 · 2026-02-05
77.4%
#7278: feat(ollama): optimize local LLM support with auto-discovery and ti...
by alltomatos · 2026-02-02
77.1%
#9739: #9291 fix(models): preserve existing models in models.json when mer...
by ximzzzzz · 2026-02-05
77.0%
#20965: feat: Add comprehensive model configuration and discovery for various…
by rodeok · 2026-02-19
76.3%
#13079: feat: Add OpenAI-compatible API option to CLI for self-hosted models
by MikeWang0316tw · 2026-02-10
76.0%