Skip to main content
Watch: I Built an AI App Without Leaving Databricks

Setup guide - Documented by LM Studio

Use LM Studio in Claude Code

LM Studio documents a Claude Code integration through its Anthropic-compatible POST /v1/messages endpoint. You set ANTHROPIC_BASE_URL to the local LM Studio server, then run claude with a local model id.

Last verified 4 steps3 official sources

Steps

  1. Step 1.

    Start LM Studio's local server (default port 1234), from the app or from the terminal with lms.

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

    Set these environment variables so the claude CLI points to your local LM Studio.

    Terminal
    export ANTHROPIC_BASE_URL=http://localhost:1234
    export ANTHROPIC_AUTH_TOKEN=lmstudio
    export CLAUDE_CODE_ATTRIBUTION_HEADER=0
  3. Step 3.

    Run Claude Code against a local model.

    Terminal
    claude --model openai/gpt-oss-20b
  4. Step 4.

    If Require Authentication is enabled in LM Studio, create an API token and set it as the auth token. LM Studio accepts both x-api-key and Authorization: Bearer <token>.

    Terminal
    export LM_API_TOKEN=<LMSTUDIO_TOKEN>
    export ANTHROPIC_AUTH_TOKEN=$LM_API_TOKEN

Caveats

  • Only LM Studio documents this setup. Claude Code's own docs were not checked for an LM Studio mention, so officialBy is provider.
  • LM Studio advises: 'Use a model (and server/model settings) with more than ~25k context length. Tools like Claude Code can consume a lot of context.'
  • ibm/granite-4-micro is the model used in LM Studio's /v1/messages cURL examples, not on the Claude Code page itself.
  • The model must be downloaded in LM Studio. Model ids are whatever identifiers your LM Studio server exposes.

FAQ

How do I use LM Studio in Claude Code?

LM Studio documents a Claude Code integration through its Anthropic-compatible POST /v1/messages endpoint. You set ANTHROPIC_BASE_URL to the local LM Studio server, then run claude with a local model id.

Which LM Studio model ids work in Claude Code?

The official docs read for this guide list openai/gpt-oss-20b and ibm/granite-4-micro. Requests go to http://localhost:1234.

Is this an official LM Studio and Claude Code setup?

LM Studio documents this setup in its own docs. It was last checked against 3 official pages on October 17, 2026.

Sources

Last verified against 3 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.