How to Use Claude Code for Free in 2026: OpenRouter Free Models, Ollama & Free GPU Credits
说明与用途
在2026年通过将Claude Code连接到OpenRouter免费模型、本地Ollama模型或免费GPU信用,免费使用Claude Code,避免Anthropic API费用。
问题
Using Claude Code with Anthropic’s Claude models normally costs money, limiting developers’ ability to experiment and iterate freely.
结果
By routing Claude Code through OpenRouter free models or running it locally with Ollama, developers can use the full coding‑agent experience without incurring Anthropic API costs, enabling free experimentation and small‑scale automation.
工作流
- Install Claude Code via the official installer
- Create an OpenRouter account and obtain an API key
- Install OpenRouter’s Ori CLI and authenticate with
ori login - Start Claude Code through OpenRouter with
ori claude - Select a free model using the
openrouter/freerouter or a specific free model ID - (Optional) Install Ollama and pull a coding model such as
gpt-oss:20b - Configure environment variables
ANTHROPIC_AUTH_TOKEN=ollamaandANTHROPIC_BASE_URL=http://localhost:11434 - Run Claude Code with the local model using
claude --model gpt-oss:20bor launch viaollama launch claude
证据
OpenRouter’s Free plan lists more than 25 free models and allows up to 50 requests per day for free accounts.
In January 2026, Ollama added Anthropic Messages API compatibility, enabling tools such as Claude Code to use Ollama models.
- 记录日期: 2026-09-05T18:15:30.033Z