Run Claude Code For Free
OpenRouter + Ollama setup 🚀
Claude Code is one of the most powerful AI coding tools right now.
It can read your codebase, edit files, and even execute commands.
But there’s one problem…
👉 It’s expensive and locked to Anthropic models.
Developers want flexibility — not restrictions.
The Problem
- Only works with Anthropic models out of the box
- High API costs for long coding sessions
- No flexibility to use better or cheaper models
The Solution
Use OpenRouter and Ollama to unlock multiple models and run Claude Code without paying Anthropic.
Step 1: Install Claude Code
Install the CLI using the method appropriate for your operating system. If you have used Claude Code before, run /logout first.
Mac / Linux
curl -fsSL https://claude.ai/install.sh | bash
Windows (PowerShell)
irm https://claude.ai/install.ps1 | iex
Alternatively, use npm:
npm install -g @anthropic-ai/claude-code
- Run
claudeto initialize. - Log in via the default Anthropic flow to authorize the CLI.
- You can close the "Add Credit" screen; once authorized, the terminal will show "Login successful."
Step 2: Configure OpenRouter
Create an API Key in OpenRouter > Activity > API Keys. Then, override the default settings using one of the methods below:
Method A: Shell Profile (Permanent)
Add these to your ~/.zshrc or ~/.bashrc:
export OPENROUTER_API_KEY="your-key-here" export ANTHROPIC_BASE_URL="https://openrouter.ai/api" export ANTHROPIC_AUTH_TOKEN="$OPENROUTER_API_KEY" export ANTHROPIC_API_KEY="" # Must be explicitly empty export ANTHROPIC_MODEL="openrouter/free" export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=true
Method B: Project Level
Edit .claude/settings.local.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://openrouter.ai/api",
"ANTHROPIC_AUTH_TOKEN": "<your-openrouter-api-key>",
"ANTHROPIC_API_KEY": "",
"ANTHROPIC_MODEL":"openrouter/free",
"CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "true"
}
}Step 3: Pick a Model
OpenRouter allows you to use various models. If you get a 402 error, check your balance or switch to a free model.
| Model Name | Best For |
|---|---|
| GPT OSS 120B (Free) | Basic testing / No credits |
| NVIDIA Nemotron | Coding and agentic tasks |
| Minimax 2.5 | UI components & Web Generation |
Tip: Use /model inside Claude Code to switch models on the fly.
Step 4: Verify & Build
Restart your terminal and run claude. If it asks for permissions, choose "Yes, allow all" to avoid repeated prompts.
Verification Prompt:
"Hi, how are you doing today?"
App Building Prompt:
Create a weather application showing rainy weather for Guwahati, stormy for Kohima, and sunny for Delhi. Include animations and a clean UI with navigation.
Alternative: Ollama Cloud
For faster performance and ideation, you can use the Ollama launch flow. This doesn't require high-end local hardware as models run in the cloud.
- Ensure Ollama is installed locally.
- Use the
--modelflag to specify cloud models.
ollama launch claude --model minimax-m2.7
You don’t need premium models for everything.
Most developers just need something that works well.
And now — you can do it for free.
Recommended Blogs
Read Our Blogs

How One B2B SaaS Founder Used Genuine Influencer Marketing to Reach 10 Paying Customers Organically
No customer database, no audience, and every personal contact already asked. How one founder used niche creators on Amplibee to go from 2 to 10 paying customers — with no ads and no bought engagement.

Why Cross-Posting Tools Like Postiz and Hootsuite Aren't Enough to Grow Fast
Schedulers like Postiz and Hootsuite are great at distributing posts to the audience you already have. Fast growth needs new, real audiences — which is where genuine influencer marketing comes in.

