Run Claude Code and Cowork Free with LM Studio Local Models
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.
"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.8so 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.





