Use Local Inference with LM Studio
This tutorial exposes an LM Studio server on the gateway host to selected sandboxes. The provider attachment grants access; the workload calls LM Studio’s OpenAI- or Anthropic-compatible endpoint directly.
Prerequisites
- Complete the Quickstart.
- Install LM Studio on the gateway host.
For a headless installation:
Linux/macOS
Windows
Start the daemon and server:
Load a model:
Create the Provider Profile
Save this as lmstudio.yaml:
The profile intentionally has no credential. LM Studio does not require one by default, but the provider attachment still supplies its policy boundary.
Attach and Call the Native Endpoint
OpenAI-compatible request:
Anthropic-compatible request:
Configure SDKs with the same native base URL. Some SDKs require a non-empty
API key even when LM Studio ignores it; use a literal non-secret value such as
unused. Keep the actual model ID in the client request.
Troubleshooting
- Enable Serve on Local Network in the LM Studio Developer tab, or use
lms server start --bind 0.0.0.0. - Use
host.openshell.internal, not127.0.0.1orlocalhost, in the sandbox. - Confirm the model is loaded with
lms ps. - Confirm the attachment with
openshell sandbox provider list lmstudio-client. - Inspect endpoint and binary policy with
openshell policy get lmstudio-client --full. - A remote gateway cannot reach an LM Studio process on your laptop without a tunnel or shared network path.