aixsam.dev / tools / claude-code-free
Claude Code for $0
Claude Code is the agent: it reads your files, edits code and runs commands. It doesn't have to use Claude as its brain. Point it at OpenRouter and it runs on free models like Google's Gemma 4 or NVIDIA's Nemotron. Honest note: you get Claude Code, not Claude. Free models are weaker, and the free tier has a daily limit.
What is Claude Code for $0?
Claude Code is an AI coding agent: it reads your files, edits code and runs commands in your terminal. The agent and the model are separate pieces. By default it uses Claude as its brain, but it can talk to other models through OpenRouter, including free ones like Google's Gemma or NVIDIA's Nemotron.
That's what this guide sets up: the Claude Code agent with a free model behind it, so you can try agentic coding without a paid plan. Be clear about the trade-off: you get Claude Code's tools and workflow, not Claude's intelligence, and free models are weaker and rate-limited.
What Claude Code for $0 can do
- Real agent workflow Claude Code reads your project, edits files and runs commands, just with a different model.
- No card needed OpenRouter's free models work on a free account.
- Switch models anytime change one setting to try a different free model, or a paid one later.

What you need
- A terminal: Mac, Linux, or Windows (PowerShell or WSL).
- A free OpenRouter account. No card needed for the free models.
- No Claude subscription. If you already pay for Claude, you don't need this.
Setup, step by stepcopy each command with the button on the right
Install Claude Code
curl -fsSL https://claude.ai/install.sh | bashAlready installed? Skip this. Have Node.js 18+?
npm install -g @anthropic-ai/claude-codeworks too.Get your free OpenRouter key
Sign up at openrouter.ai → Keys → Create key → copy it. It starts with
sk-or-v1-.Treat it like a password. Never paste it in a comment or show it in a video.
Add these lines to your shell profile
Open
~/.zshrc(Mac) or~/.bashrc(Linux / WSL), paste this at the bottom, and put your key in the first line. The first four are the "3 lines" from the reel plus your key; the last five keep every request on the free model.export OPENROUTER_API_KEY="sk-or-v1-paste-your-key" export ANTHROPIC_BASE_URL="https://openrouter.ai/api" export ANTHROPIC_AUTH_TOKEN="$OPENROUTER_API_KEY" export ANTHROPIC_API_KEY="" export ANTHROPIC_MODEL="google/gemma-4-31b-it:free" export ANTHROPIC_DEFAULT_OPUS_MODEL="google/gemma-4-31b-it:free" export ANTHROPIC_DEFAULT_SONNET_MODEL="google/gemma-4-31b-it:free" export ANTHROPIC_DEFAULT_HAIKU_MODEL="google/gemma-4-31b-it:free" export CLAUDE_CODE_SUBAGENT_MODEL="google/gemma-4-31b-it:free"Keep the key line first: the third line reads it. Then reload with
source ~/.zshrc(or~/.bashrc), or open a new terminal.Launch and check
claudeInside Claude Code, run
/status. It should showhttps://openrouter.ai/api. If you ever logged in to Claude Code with a Claude account, run/logoutfirst, then quit and startclaudeagain.
Install Claude Code
irm https://claude.ai/install.ps1 | iexSet the variables and launch
Paste this into PowerShell with your key, then run
claudein the same window. These last until you close it; put them in your PowerShell$PROFILEto keep them.$env:ANTHROPIC_BASE_URL="https://openrouter.ai/api" $env:ANTHROPIC_AUTH_TOKEN="sk-or-v1-paste-your-key" $env:ANTHROPIC_API_KEY="" $env:ANTHROPIC_MODEL="google/gemma-4-31b-it:free" $env:ANTHROPIC_DEFAULT_OPUS_MODEL="google/gemma-4-31b-it:free" $env:ANTHROPIC_DEFAULT_SONNET_MODEL="google/gemma-4-31b-it:free" $env:ANTHROPIC_DEFAULT_HAIKU_MODEL="google/gemma-4-31b-it:free" $env:CLAUDE_CODE_SUBAGENT_MODEL="google/gemma-4-31b-it:free" claude
Pick another free model
Replace
google/gemma-4-31b-it:freewith any model on openrouter.ai/models?q=free, or start one session with it:claude --model nvidia/nemotron-3-super-120b-a12b:freeGemma 4 31B was the steadiest when I checked (21 Oct 2026). Nemotron 3 Super is built for agents but its free endpoint was up only about 60% of the time. The free list changes often.
Try this first
The free limits
- 50 requests a day and 20 a minute on free models. Failed requests count too.
- Every agent step (read a file, edit, run a command) is one request, so one task can use 10 or more.
- Buy $10 of OpenRouter credits once and the free-model limit goes up to 1,000 a day.
- Some free hosts log prompts, and some (NVIDIA's free endpoints included) have terms that allow training on them. Don't paste API keys, passwords or client code. Use it for side projects and learning.
Stuck?
"There's an issue with the selected model"
The model name is wrong or that free model was removed. Copy the exact name from openrouter.ai/models?q=free, including :free at the end.
It still uses my Claude subscription
Run /logout, quit, and start claude again. Check /status shows https://openrouter.ai/api. Make sure no old ANTHROPIC_API_KEY with a real key is set anywhere else in your profile.
Error 429 / rate limited
You hit 20 requests a minute or 50 a day. Wait a minute (or until the daily reset), or add $10 of credits for 1,000 a day.
The agent loops, or tool calls fail
Claude Code is built for Claude models, and OpenRouter only guarantees it with Anthropic's own models. Some free models handle its tools badly. Switch to another free model, keep tasks small, and clear the chat with /clear between tasks.
Will I get charged?
Free models cost $0. With a $0 balance, a paid model would just fail rather than bill you. If you add credits, the model lines in step 3 keep every request on the free model. You can check every request at openrouter.ai/activity.
Can I use it in VS Code?
Yes. The Claude Code extension uses the same settings. Set the variables in your shell profile (step 3) and open VS Code from that terminal.
Questions people ask
Is this really free?
The models marked :free on OpenRouter cost nothing, but they have daily request limits. Check OpenRouter's limits page for the current numbers.
Is it as good as Claude?
No. You get Claude Code, the agent, not Claude, the model. Free models make more mistakes, especially on long or tricky tasks.
Will it ever charge my Claude subscription?
Not with the settings in this guide: every model slot points to the free OpenRouter model, so nothing falls back to a paid Claude model. Run /status to check what it's using.
Is my OpenRouter key safe?
Treat it like a password: never paste it in a comment, a screenshot or a video. If it leaks, delete it in OpenRouter and make a new one.
OpenRouter says it isn't guaranteed to work
Right: Anthropic only guarantees Claude Code with its own models. Most things work with other models, but some features may not.
Still stuck?
DM me on Instagram with a screenshot of the error and which step you're on.
DM @aixsamdevMore setup guides
Claude Code Dev Team
Five free tools that turn Claude Code from one developer into a full team.
TEAMECC (Everything Claude Code)
Turns Claude Code into a whole engineering team.
GRAPHGraphify
Turns your whole codebase into a knowledge graph, so Claude Code, Cursor or Codex ask the graph instead of re-reading every file.
INSTAGRAMInstagram Agent Skill
13 free Claude skills for your Instagram. Nothing posts without you.