Use Claude Code for Free and Without Limits, Running on Your Own Machine
Description and use
Developers can use Claude Code for free by running a local Ollama server, eliminating per‑request costs and keeping code private.
Problem
Users face usage‑based pricing when using Claude Code, limiting frequent or large‑scale use.
Outcome
By redirecting Claude Code to a local Ollama server, users eliminate per‑request costs, keep code on‑premises, and gain offline capability, though model performance depends on local hardware.
Workflow
- Install Ollama on your machine.
- Pull the desired Claude model (e.g., claude‑3‑sonnet).
- Run
ollama launch claudeorollama launch claude --model <name>to start the local server. - Set environment variables:
CLAUDE_SERVER_ADDRESS=localhost,CLAUDE_SERVER_PORT=11434,CLAUDE_TOKEN=ollama,CLAUDE_KEY=(empty). - Configure Claude Code to point to the local server address.
- Use Claude Code as usual; requests are handled locally.
- Monitor performance and adjust model size based on available RAM (32 GB+ for 20‑30B models, 7‑14B for standard hardware).
Evidence
Claude Code talks to a model through environment variables that define a server address. Point that address at a local server instead of the company's, and every request goes to your machine.
Install Ollama, pull the model you want, then run one command: ollama launch claude and pick your model, or pass it directly with ollama launch claude --model <name>.
The token variable is where people get it wrong. Set it empty and the connection fails. It has to be the word ollama.
- Record date: 2026-09-17T15:00:37.433Z