Use Claude Code for Free and Without Limits, Running on Your Own Machine
说明与用途
开发者可以通过运行本地 Ollama 服务器来免费使用 Claude Code,消除每次请求费用并保持代码私密。
问题
Users face usage‑based pricing when using Claude Code, limiting frequent or large‑scale use.
结果
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.
工作流
- 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).
证据
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.
- 记录日期: 2026-09-17T15:00:37.433Z