Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
OpenClaw's LM Studio provider fails due to two critical issues:
Environment variables ($LMSTUDIO_API_KEY) not expanded in API calls
API endpoint incompatibility (uses /v1/chat/completions but LM Studio's OpenAI-compatible API returns HTTP 200 with errors)
Steps to reproduce
- Configure LM Studio provider in openclaw.json with apiKey: "$LMSTUDIO_API_KEY"
- Set environment variable LMSTUDIO_API_KEY with valid token
- Attempt to use any LM Studio model
- Observe 401 error with literal string $LMSTUDIO_API_KEY
Expected behavior
- Environment variables should be expanded before sending API requests
- Should detect and use LM Studio's working endpoints (/api/v1/chat for native API or /v1/completions for OpenAI-compatible)
Actual behavior
- $LMSTUDIO_API_KEY sent literally, causing 401 errors
- Attempts to use /v1/chat/completions which LM Studio returns HTTP 200 with error: "Unexpected endpoint or method
OpenClaw version
2026.5.7
Operating system
Linux (containerized)
Install method
docker
Model
google/gemma-4-26b-a4b
Provider / routing chain
openclaw -> LM Studio
Additional provider/model setup details
Additional Context:
- LM Studio has functional native API at /api/v1/chat (different format)
- LM Studio's OpenAI-compatible API at /v1/chat/completions is buggy (returns 200 with errors)
- LM Studio's old OpenAI completions API at /v1/completions works but uses deprecated format
- Other providers (OpenRouter, Gemini) properly expand environment variables
Proposed Solutions:
- Fix environment variable expansion in LM Studio provider
- Add support for LM Studio's native API (/api/v1/chat)
- Implement endpoint fallback logic for LM Studio's inconsistent API
Logs, screenshots, and evidence
Impact and severity
- Priority: High - prevents users from using local LM Studio inference with OpenClaw
Additional information
Related Links:
Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
OpenClaw's LM Studio provider fails due to two critical issues:
Environment variables ($LMSTUDIO_API_KEY) not expanded in API calls
API endpoint incompatibility (uses /v1/chat/completions but LM Studio's OpenAI-compatible API returns HTTP 200 with errors)
Steps to reproduce
Expected behavior
Actual behavior
OpenClaw version
2026.5.7
Operating system
Linux (containerized)
Install method
docker
Model
google/gemma-4-26b-a4b
Provider / routing chain
openclaw -> LM Studio
Additional provider/model setup details
Additional Context:
Proposed Solutions:
Logs, screenshots, and evidence
Impact and severity
Additional information
Related Links: