Claude Code with Local LLM
How to configure Claude Code with a local LLM
Overview
A local computer isn't going to compete with a datacenter anytime soon but maybe you're without Internet, want additional data privacy, or have hit your Claude Code subscription limit for the month. In such cases, we can setup Claude Code to work with local LLMs.
Setup
LM Studio
Download a model, for help checkout Discovering and Downloading Models
Start a server, via GUI see Start LM Studio Server or run this
## 25k recommended for claude code usage
lms load openai/gpt-oss-20b --context-length 25000
lms server start --port 1234Claude Code Setup — Terminal
In the terminal run the below making sure to swap out the port and model based on your needs
export ANTHROPIC_BASE_URL=http://localhost:1234
export ANTHROPIC_AUTH_TOKEN=lmstudioMake sure this is the model you've downloaded and have running locally
In Claude, we can see the local model is being used

Claude Code Setup — VS Code
In VS Code, hit
CMD + SHIFT + Pand openPreferences: Open User Settings (JSON)and paste this snippet within the main{ }Make sure swap out the the URL as needed
Validating Setup — Developer Logs
Within LMStudio, we can view the developer logs to validate our interaction with Claude is leveraging the local LLM

Resources
Last updated