aixsam.dev Follow

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.

Reel keyword: FREEClaude CodeOpenRouterFree models · no card

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.
Claude Code for $0 reel cover by aixsam.dev
From the reel · keyword FREE

What you need

Setup, step by stepcopy each command with the button on the right

Mac / Linux / WSLabout 2 minutes
  1. Install Claude Code

    curl -fsSL https://claude.ai/install.sh | bash

    Already installed? Skip this. Have Node.js 18+? npm install -g @anthropic-ai/claude-code works too.

  2. 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.

  3. 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.

  4. Launch and check

    claude

    Inside Claude Code, run /status. It should show https://openrouter.ai/api. If you ever logged in to Claude Code with a Claude account, run /logout first, then quit and start claude again.

Windows (PowerShell)no WSL
  1. Install Claude Code

    irm https://claude.ai/install.ps1 | iex
  2. Set the variables and launch

    Paste this into PowerShell with your key, then run claude in the same window. These last until you close it; put them in your PowerShell $PROFILE to 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
Switch the free modelany time
  1. Pick another free model

    Replace google/gemma-4-31b-it:free with any model on openrouter.ai/models?q=free, or start one session with it:

    claude --model nvidia/nemotron-3-super-120b-a12b:free

    Gemma 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

Explain what this project does and how the files fit together.
Find the bug in [file] and fix it. Run the tests after.
Write a README for this folder.
Add a dark mode toggle to index.html.

The free limits

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 @aixsamdev

More setup guides