Published: 2026-05-31

Run Claude Code and Cowork Free with LM Studio Local Models

Chapters / key moments (click to jump — plays here on the page)

Claude's desktop app has a built-in "third-party inference" gateway that lets you swap Anthropic's API for any local model running in LM Studio, Ollama, or a cloud provider on OpenRouter — all without creating an Anthropic account. Bart Slodyczka walks through the full setup, including the model naming trick that makes Claude's discovery accept non-Anthropic models.

Source video

"Claude Code + LM Studio: FREE Unlimited AI Agents (Don't Pay $200/month)" by Bart Slodyczka — Watch on YouTube →

Key Takeaways

  • Enable developer mode in the Claude desktop app, then open "Configure Third-Party Inference" to set a local LM Studio gateway URL as the model backend.
  • In LM Studio's Developer panel, rename the loaded model's API identifier to a Claude name like claude-opus-4.8 so the desktop app's model discovery accepts it.
  • Local models don't include Anthropic's built-in web search — restore it by adding a Brave Search MCP server in the Claude config file.
  • Gemma 4B and 2B models work well for agentic tasks on most consumer GPUs — look for the green "full GPU offload" indicator in LM Studio.
  • The same gateway configuration works with OpenRouter, giving Claude Code and Cowork access to hundreds of paid and free cloud models at a fraction of the direct API cost.

Step-by-Step Setup

First, download and install the Claude desktop app (works on Mac and Windows). In the top menu, enable Developer Mode via Help → Troubleshooting → Enable Developer Mode. A new Developer menu appears — open "Configure Third-Party Inference," set the connection type to Gateway, and use static API key as the credential kind.

In LM Studio, enable developer mode in Settings and navigate to the Developer panel. Load your chosen model and find the API identifier field — replace it with claude-opus-4.8 (or any claude-* name). Copy the gateway base URL shown in LM Studio's developer panel and paste it into Claude's third-party inference settings. Set the API key field to any placeholder value like lm-studio, toggle "disable built-in tools," and save. Claude will now route all requests to your local model.

What You Lose and How to Get It Back

Local models don't have Anthropic's native web search capability. To restore web search, add a Brave Search MCP server to the claude_desktop_config.json file. This works for any local-model setup, not just LM Studio. The same config file approach works for adding other MCP tools your workflows depend on.

What you can actually set up from this

Extracted from the video's own transcript — the specifics the original summary left out.

Reproducible steps

  1. Enable the desktop app's Developer menu

    Claude desktop: Help → Troubleshooting → Enable Developer Mode (the app restarts with a Developer menu). Confirmed in the Claude Code docs.

  2. Open Configure Third-Party Inference

    Developer → Configure Third-Party Inference. Connection type: gateway. Credential: static API key. Gateway base URL: copy it from LM Studio's Developer tab (turn on Developer mode in LM Studio settings first).

  3. Load a model that fits and keep it loaded

    In LM Studio pick a model with the green "full GPU offload possible" badge (he used Gemma 4 E4B/E2B and a 26B Gemma), then load it in the Developer tab so it is awake, with as large a context window as you can.

  4. Rename the model so Claude can discover it

    "Gateway returned no usable models" happens because discovery looks for Sonnet/Opus/Haiku-style names. When loading, set LM Studio's API identifier to a Claude-style name (he used an Opus name), then re-run Test model discovery.

  5. Replace built-in web search with an MCP server

    Local models have no built-in web search/fetch. Disable built-in tools and add a search MCP (he used Brave Search, which needs its own API key) through Developer → Edit configuration.

  6. Sign in through the gateway

    If you were already signed in, sign out; the sign-in screen then offers the gateway option alongside claude.ai.

Gotchas

  • Per the docs, with the gateway configuration active the desktop app runs sessions locally only — no SSH or Anthropic-hosted cloud environments, and Remote Control is unavailable.
  • An administrator-distributed third-party configuration takes precedence and makes the local form read-only.
  • Local prefill is the bottleneck: Claude's first request is ~30K tokens before your prompt, so even an M3 Ultra (512 GB) is slow to start.
  • Dynamic workflows run on local models too, within the documented limits (16 concurrent agents by default, 1,000 per run).

Weekly Digest — In Your Inbox

Get the week's top AI agent news, updates, and guides — every Friday.