You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support LM Studio servers with required API key authentication #28
LM Studio can be configured to require authentication for its local OpenAI-compatible server. In that mode, /v1/models only works when the request includes an Authorization: Bearer header.
The plugin currently appears to call LM Studio health-check and model-discovery endpoints without forwarding an API key or authorization header. As a result, authenticated LM Studio servers are reported as offline even though the server is reachable and works correctly with an authenticated HTTP request.
Reproduction
Enable the LM Studio local server on 127.0.0.1:1234.
[opencode-lmstudio] LM Studio appears to be offline
baseURL: "http://127.0.0.1:1234"
[opencode-lmstudio] No models discovered - LM Studio might be offline
This is misleading: LM Studio is online, but the plugin-internal fetch calls are unauthenticated.
Expected behavior
The plugin should support authenticated LM Studio servers by forwarding an API key or authorization header when doing:
or a plugin-specific setting that reads an environment variable, for example:
"lmstudio": {
"apiKeyEnv": "LM_API_TOKEN"
}
The important part is that plugin-internal fetch() calls should include:
Authorization: Bearer
when an API key is configured.
Notes
The README configuration examples currently show only baseURL; there does not appear to be a documented way to provide an LM Studio API key for plugin-driven discovery.
Direct HTTP requests with a Bearer token succeed, but plugin discovery reports the server as offline. This indicates the issue is likely in the plugin’s internal health/model-discovery logic, not in LM Studio itself.
Activity
trigger2k20 commentedon Jun 12, 2026
@agustif solved by patching your plugin. Please review the pending fork.