Skip to main content
Watch: Anthropic Just Hit the Brakes on Its Next AI Model

Setup guide - Documented by OpenCode

Use LM Studio in OpenCode

OpenCode has built-in local discovery for LM Studio. Its default LM Studio endpoint is http://127.0.0.1:1234/v1, and it discovers language models from /api/v1/models. Override settings.baseURL in opencode.jsonc when LM Studio runs on another host.

Last verified 3 steps2 official sources

Steps

  1. Step 1.

    Make sure the LM Studio server is running (LM Studio docs).

    Terminal
    lms server start --port 1234
  2. Step 2.

    OpenCode discovers LM Studio language models from /api/v1/models at the default endpoint http://127.0.0.1:1234/v1. Run /models to select one of its models.

    Snippet
    /models
  3. Step 3.

    To use LM Studio on another host, override settings.baseURL in opencode.jsonc (from the OpenCode Runtimes section, trimmed to the lmstudio entry).

    JSON
    {
      "$schema": "https://opencode.ai/config.json",
      "providers": {
        "lmstudio": {
          "settings": { "baseURL": "http://gpu-host:1234/v1" },
        },
      },
    }

Caveats

  • Step 1 comes from LM Studio's docs (server start), combined with OpenCode's documented LM Studio discovery.
  • The OpenCode Runtimes example also includes a vllm entry. It was trimmed here to the lmstudio entry; the remaining keys and values are verbatim.
  • The OpenCode providers page names no specific LM Studio model id. Models come from what LM Studio serves.
  • The earlier OpenCode LM Studio section (an @ai-sdk/openai-compatible provider with a google/gemma-3n-e4b example) is no longer on the providers page.

FAQ

How do I use LM Studio in OpenCode?

OpenCode has built-in local discovery for LM Studio. Its default LM Studio endpoint is http://127.0.0.1:1234/v1, and it discovers language models from /api/v1/models. Override settings.baseURL in opencode.jsonc when LM Studio runs on another host.

What base URL does OpenCode use for LM Studio?

Point OpenCode at http://127.0.0.1:1234/v1.

Is this an official LM Studio and OpenCode setup?

OpenCode documents this setup in its own docs. It was last checked against 2 official pages on November 8, 2026.

Sources

Last verified against 2 official pages.

Newsletter

New models, set up the day they ship

One email per week. New model releases, the coding tools that support them and how to wire them up.