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
- Step 1.
Start LM Studio's local server (default port 1234), from the app or from the terminal with lms.
Terminallms server start --port 1234 - Step 2.
Set these environment variables so the claude CLI points to your local LM Studio.
Terminalexport ANTHROPIC_BASE_URL=http://localhost:1234 export ANTHROPIC_AUTH_TOKEN=lmstudio export CLAUDE_CODE_ATTRIBUTION_HEADER=0 - Step 3.
Run Claude Code against a local model.
Terminalclaude --model openai/gpt-oss-20b - 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>.
Terminalexport 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.
More setup guides
Same tool, other providers
Related reading
- LM Studio Bionic: A Local-First AI Agent for Open ModelsLM Studio launches Bionic, a standalone agent harness for open models with local inference, voice input, and zero data retention cloud options.
- Ollama vs LM Studio vs vLLM vs llama.cpp: Picking a Local Runtime for Coding AgentsOllama vs LM Studio vs vLLM vs llama.cpp for coding agents: what each local runtime is for, where they overlap, and which to pick for your setup.
- Claude Code denyInsteadOfPrompting: Deny Permission Prompts EverywhereClaude Code 2.1.319 adds permissions.denyInsteadOfPrompting: any call that would wait on a permission prompt is denied and the turn carries on, subagents included.
- Conductor Joins Meta: Shutdown Dates and AlternativesConductor is joining Meta. Cloud goes read-only Nov 13 and shuts down Nov 20, and the local Mac app winds down in early 2027. The dates, what to export, and what to move to.
- Claude Code Limits Draining Faster? What the Evidence ShowsWeekly Claude Code limits are draining faster for many users since mid-October. What the GitHub measurements show, the headless claude -p metering gap, and what to check first.
- Claude Code Game Rule: It Won't Remake Existing GamesClaude Code on Opus 5.5 now refuses to recreate specific existing games, even renamed. What the two-sentence rule says, what it blocks, and what builders do next.
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.