This tutorial describes how to configure OpenShell to route inference requests to a local LM Studio server.
The LM Studio server provides easy setup with both OpenAI and Anthropic compatible endpoints.
This tutorial covers:
First, complete OpenShell installation and follow the Quickstart.
Install the LM Studio app. Make sure that your LM Studio is running in the same environment as your gateway.
If you prefer to work without having to keep the LM Studio app open, download llmster (headless LM Studio) with the following command:
And start llmster:
Start the LM Studio local server from the Developer tab, and verify the OpenAI-compatible endpoint is enabled.
LM Studio listens to 127.0.0.1:1234 by default. For use with OpenShell, configure LM Studio to listen on all interfaces (0.0.0.0).
If you use the GUI, go to the Developer Tab, select Server Settings, then enable Serve on Local Network.
If you use llmster in headless mode, run lms server start --bind 0.0.0.0.
In the LM Studio app, head to the Model Search tab to download a small model like Qwen3.5 2B.
In the terminal, use the following command to download and load the model:
Choose the provider type that matches the client protocol you want to route through inference.local.
Add LM Studio as an OpenAI-compatible provider through host.openshell.internal:
Use this provider for clients that send OpenAI-compatible requests such as POST /v1/chat/completions or POST /v1/responses.
Set the managed inference route for the active gateway:
If the command succeeds, OpenShell has verified that the upstream is reachable and accepts the expected OpenAI-compatible request shape.
The active inference.local route is gateway-scoped, so only one provider and model pair is active at a time. Re-run openshell inference set whenever you want to switch between OpenAI-compatible and Anthropic-compatible clients.
Confirm the saved config:
You should see either Provider: lmstudio or Provider: lmstudio-anthropic, along with Model: qwen/qwen3.5-2b.
If setup fails, check these first:
OPENAI_BASE_URL uses http://host.openshell.internal:1234/v1 when you use an openai providerANTHROPIC_BASE_URL uses http://host.openshell.internal:1234 when you use an anthropic providerUseful commands: