Free Claude Code? What Works With Free Models (Honest Answer)
Claude Code can run through OpenRouter with a few environment variables, but OpenRouter only guarantees it with Anthropic's own models, which aren't free. Here are the honest options.
Checked 22 November 2026 from each provider's own docs. Free tiers change, so follow the source links before you build on one.
Connect Claude Code to OpenRouter
From OpenRouter's own guide. Add these lines to your shell profile, then reload it:
export OPENROUTER_API_KEY="<your-openrouter-api-key>"
export ANTHROPIC_BASE_URL="https://openrouter.ai/api"
export ANTHROPIC_AUTH_TOKEN="$OPENROUTER_API_KEY"
export ANTHROPIC_API_KEY=""
If you were logged in to Claude Code with an Anthropic account, run /logout once, then restart. Check with /status: it should show the OpenRouter base URL. Source: OpenRouter: Use Claude Code with OpenRouter.
The catch: it isn't really free
Usage is billed in OpenRouter credits
Requests go through your OpenRouter account and use its credits.
Free models may not work well
OpenRouter says Claude Code with OpenRouter is only guaranteed to work with Anthropic's first-party provider, and that Claude Code is optimized for Anthropic models and may not work correctly with others. You can point its model settings at other models, but expect broken tool calls with many free ones.
Free alternatives that do work
- OpenCode10 free models built in, no key needed
- GitHub Copilot Free2,000 completions a month and limited agent use, no card
- Free models for codingFree models with tool calling, for any agent that takes an OpenAI-compatible API
More free AI guides
- Free AI model APIEvery free LLM API, plus the free OpenRouter models Upcurrent checks every 30 minutes
- Free LLM APIs with no credit cardWhich free tiers start without a card
- How to get a free LLM API keyFive steps to your first request
Questions
Can I use Claude Code for free?
Not reliably. Claude Code can connect to OpenRouter, but usage is billed in OpenRouter credits, and OpenRouter says Claude Code is only guaranteed to work with Anthropic's own provider. Free models may not work correctly.
How do I connect Claude Code to OpenRouter?
Set ANTHROPIC_BASE_URL to https://openrouter.ai/api, put your OpenRouter key in ANTHROPIC_AUTH_TOKEN, and set ANTHROPIC_API_KEY to an empty string. Then run /logout once if you were logged in to Anthropic, and restart Claude Code.
What's a free alternative to Claude Code?
OpenCode has 10 free models built in, and GitHub Copilot Free includes limited agent use. Both are on the free AI coding tools page.
Get this in your inbox at 7am
One free email each morning with the AI repos, models and stories that are picking up speed, including new free models. Your own time zone, no spam.