Skip to main content

Free Claude Code Setup

This lesson provides free alternatives to use Claude Code without a subscription. You'll choose between Open Router, oGoogle Gemini or DeepSeek as your backend, learning the same Claude Code CLI interface and features covered in Lesson 2.

⚠️ Important (January 2026): Google significantly reduced Gemini API free tier limits in December 2025. Daily request limits dropped 50-80% for most models. OpenRouter free models have daily request limits that vary by model. OpenRouter offers 30+ free models AI Free API but with daily request limits. Models rotate and quality varies. DeepSeek is not truly "free" but offers very low pricing (~$0.028-$0.42 per million tokens). Both deepseek-chat and deepseek-reasoner follow the same pricing: $0.028 per million input tokens (cache hit), $0.28 per million input tokens (cache miss), and $0.42 per million output tokens. Groq has a Free Tier for its API via GroqCloud. Plan your usage accordingly and have backup options ready.

All features work identically: Subagents, skills, MCP servers, hooks, and all other capabilities covered in Lessons 05-15 function the same way with free backends. The only difference is the backend AI model and API provider.

Free Ongoing Usage

By using Gemini's free tier or DeepSeek's competitive API, you get ongoing free or low-cost consumption—no subscription required. This setup isn't just for learning; many developers use it as their daily driver. The free tiers are generous enough for real development work.


Choose Your Free Backend

Before setup, decide which backend suits you. All three options provide identical Claude Code functionality:

FactorOpenRouterGeminiDeepSeek
Available Models5+ free optionsGemini 2.5 FlashDeepSeek Chat/Reasoner
Free TierDaily request limits per modelDaily request limitsToken-based (~$0.028-$0.42/M tokens)
SpeedVery FastVery FastFast
Setup ComplexityManual, most transparentEasiest (few steps)Slightly more involved
Reasoning ModelsAvailable (Qwen, Llama)Native supportNative support

OpenRouter Setup

This section guides you through configuring Claude Code with OpenRouter's multi-model platform.

OpenRouter aggregates multiple AI models (including Gemini, Qwen, Llama) under one API. This gives you maximum flexibility to experiment with different models without re-configuring.

Step 1: Get Your OpenRouter API Key

  1. Go to: OpenRouter API Keys
  2. Click "Create Key"
  3. Name it (e.g., "Claude Code Router")
  4. Copy the key (starts with: sk-or-v1-...)

Step 2: Install and Configure

Select your operating system:

Verify Node.js

node --version  # Should show v18.x.x or higher

If missing, install from nodejs.org


Install Tools

Open PowerShell and run:

npm install -g @anthropic-ai/claude-code @musistudio/claude-code-router

Create Config Directories

New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.claude-code-router"
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.claude"

Create the Config File

  1. Open Notepad (search "Notepad" in Windows Start menu)
  2. Copy and paste this exactly:
{
"LOG": true,
"LOG_LEVEL": "info",
"HOST": "127.0.0.1",
"PORT": 3456,
"API_TIMEOUT_MS": 600000,
"Providers": [
{
"name": "openrouter",
"api_base_url": "https://openrouter.ai/api/v1",
"api_key": "$OPENROUTER_API_KEY",
"models": [
"qwen/qwen-coder-32b-vision",
"google/gemini-2.0-flash-exp:free",
"meta-llama/llama-3.3-70b-instruct:free",
"qwen/qwen3-14b:free",
"xiaomi/mimo-v2-flash:free"
],
"transformer": {
"use": ["openrouter"]
}
}
],
"Router": {
"default": "openrouter,qwen/qwen-coder-32b-vision",
"background": "openrouter,qwen/qwen-coder-32b-vision",
"think": "openrouter,meta-llama/llama-3.3-70b-instruct:free",
"longContext": "openrouter,qwen/qwen-coder-32b-vision",
"longContextThreshold": 60000
}
}
Do NOT Change $OPENROUTER_API_KEY

Leave "api_key": "$OPENROUTER_API_KEY" exactly as written. The router reads your key from the environment variable you'll set in the next step.

  1. Click File → Save As
  2. In the "File name" field, type exactly: %USERPROFILE%\.claude-code-router\config.json
  3. Click Save

Set Your API Key

Run PowerShell as Administrator:

  1. Search "PowerShell" in Windows Start menu
  2. Right-click on "Windows PowerShell"
  3. Click "Run as administrator"
  4. Click "Yes" if prompted

Run this command (replace YOUR_KEY_HERE with your key from Step 1):

[System.Environment]::SetEnvironmentVariable('OPENROUTER_API_KEY', 'YOUR_KEY_HERE', 'User')
  1. Close PowerShell completely (not just the tab—close the whole window)
  2. Open a new regular PowerShell (not as admin)
  3. Verify it worked:
echo $env:OPENROUTER_API_KEY

You should see your API key displayed ✅


Verify Setup

claude --version     # Should show: Claude Code v2.x.x
ccr version # Should show version number
echo $env:OPENROUTER_API_KEY # Should show your key

Done! Proceed to Step 3: Daily Workflow below.


Step 3: Daily Workflow

Every time you want to code:

PowerShell 1 - Start router FIRST:

ccr start

Leave this window running. You'll see a warning message—that's normal!

PowerShell 2 - Open a NEW PowerShell window and run:

cd C:\your\project\folder
ccr code
First Startup Takes Time

Wait 10-20 seconds after running ccr code on first startup. The router needs time to initialize.

When done: Press Ctrl+C in both windows.


Gemini Setup

This section guides you through configuring Claude Code with Google's Gemini API.

Step 1: Get Your Free Google API Key

  1. Go to: Google AI Studio
  2. Click "Get API Key"
  3. Sign in with Google
  4. Click "Create API Key"
  5. Copy the key (looks like: AIzaSyAaBbCcDd...)

Step 2: Install and Configure

Select your operating system:

Step 0: Install Node.js (Skip if Already Installed)

Check if you have Node.js:

Open PowerShell (search "PowerShell" in Windows Start menu) and type:

node --version
  • If you see v18.x.x or higher → Skip to Step 1 ✅
  • If you see an error or version lower than v18 → Follow these steps:
  1. Go to: nodejs.org
  2. Click the big green button that says "Download Node.js (LTS)"
  3. Run the downloaded file (it's called something like node-v20.x.x-x64.msi)
  4. Click NextNextNextInstall
  5. Wait for it to finish
  6. Close ALL PowerShell windows completely
  7. Open a new PowerShell window
  8. Type node --version again to confirm it works

You should now see a version number like v20.11.0


Step 1: Install Tools

Open PowerShell and run:

npm install -g @anthropic-ai/claude-code @musistudio/claude-code-router

Step 2: Create Config Directories

Enable running scriptson your system first:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Now create directories:

New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.claude-code-router"
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.claude"

Step 3: Create the Config File

  1. Open Notepad (search "Notepad" in Windows Start menu)
  2. Copy and paste this text exactly as-is:
{
"LOG": true,
"LOG_LEVEL": "info",
"HOST": "127.0.0.1",
"PORT": 3456,
"API_TIMEOUT_MS": 600000,
"Providers": [
{
"name": "gemini",
"api_base_url": "https://generativelanguage.googleapis.com/v1beta/models/",
"api_key": "$GOOGLE_API_KEY",
"models": [
"gemini-2.5-flash-lite",
"gemini-2.0-flash"
],
"transformer": {
"use": ["gemini"]
}
}
],
"Router": {
"default": "gemini,gemini-2.5-flash-lite",
"background": "gemini,gemini-2.5-flash-lite",
"think": "gemini,gemini-2.5-flash-lite",
"longContext": "gemini,gemini-2.5-flash-lite",
"longContextThreshold": 60000
}
}
Do NOT Change $GOOGLE_API_KEY

Leave "api_key": "$GOOGLE_API_KEY" exactly as written. Do NOT replace it with your actual key here—the router will automatically read your key from the environment variable you set in Step 4.

  1. Click File → Save As
  2. In the "File name" field, type exactly: %USERPROFILE%\.claude-code-router\config.json
  3. Click Save

Step 4: Set Your API Key

Run PowerShell as Administrator:

  1. Search "PowerShell" in Windows Start menu
  2. Right-click on "Windows PowerShell"
  3. Click "Run as administrator"
  4. Click "Yes" if prompted

Run this command (replace YOUR_KEY_HERE with your actual API key from Step 1):

[System.Environment]::SetEnvironmentVariable('GOOGLE_API_KEY', 'YOUR_KEY_HERE', 'User')
  1. Close PowerShell completely (not just the tab—close the whole window)
  2. Open a new regular PowerShell (not as admin this time)
  3. Verify it worked:
echo $env:GOOGLE_API_KEY

You should see your API key displayed ✅


Verify Setup

claude --version     # Should show: Claude Code v2.x.x
ccr version # Should show version number
echo $env:GOOGLE_API_KEY # Should show your key

Done! Proceed to Step 3: Daily Workflow below.


Step 3: Daily Workflow

Every time you want to code:

PowerShell 1 - Start router FIRST:

ccr start

Leave this window running. You'll see a warning message—that's normal!

PowerShell 2 - Open a NEW PowerShell window and run:

cd C:\your\project\folder
ccr code
First Startup Takes Time

Wait 10-20 seconds after running ccr code on first startup. The router needs time to initialize. If it seems stuck, just wait—it's working!

When done: Press Ctrl+C in both windows.


DeepSeek Setup

This section guides you through configuring Claude Code with DeepSeek's API.

If you already completed the Gemini Setup above, you already have Node.js and the Claude Code Router installed. You only need to create the DeepSeek configuration and set your API key.

Step 1: Get Your DeepSeek API Key

  1. Go to: DeepSeek API Platform
  2. Sign up or log in with your account
  3. Navigate to API Keys section
  4. Click "Create API Key"
  5. Copy the key (looks like: sk-...)

Step 2: Configure DeepSeek

Create the config file: Open Notepad and paste:

{
"LOG": true,
"LOG_LEVEL": "info",
"HOST": "127.0.0.1",
"PORT": 3456,
"API_TIMEOUT_MS": 600000,
"Providers": [
{
"name": "deepseek",
"api_base_url": "https://api.deepseek.com/v1",
"api_key": "$DEEPSEEK_API_KEY",
"models": [
"deepseek-chat",
"deepseek-reasoner"
],
"transformer": {
"use": ["openai"]
}
}
],
"Router": {
"default": "deepseek,deepseek-chat",
"background": "deepseek,deepseek-chat",
"think": "deepseek,deepseek-reasoner",
"longContext": "deepseek,deepseek-chat",
"longContextThreshold": 60000
}
}
Do NOT Change $DEEPSEEK_API_KEY

Leave "api_key": "$DEEPSEEK_API_KEY" exactly as written.

Save as: %USERPROFILE%\.claude-code-router\config.json

Set your API key (Run PowerShell as Administrator):

[System.Environment]::SetEnvironmentVariable('DEEPSEEK_API_KEY', 'YOUR_KEY_HERE', 'User')

Close and reopen PowerShell, then verify:

echo $env:DEEPSEEK_API_KEY

Verification

Both Gemini and DeepSeek use the same daily workflow and verification process.

Start a Claude session and say hi:

hi

Expected: Claude responds with a greeting confirming it's working! ✅ Success!


Troubleshooting

"command not found" or "not recognized"

Close and reopen PowerShell completely. If still failing, the npm global bin directory isn't in your PATH.

"API key not found" or empty variable

  1. Make sure you ran the SetEnvironmentVariable command as Administrator
  2. Close ALL PowerShell windows and open a fresh one
  3. Check with echo $env:GOOGLE_API_KEY

Stuck at "starting service"

Wait 20-30 seconds on first run. This is normal.

Router starts but Claude hangs

Make sure ccr start is running in PowerShell 1 before running ccr code in PowerShell 2.


Try With AI

Once your free setup is working, try these prompts to verify everything works:

Verify Basic Functionality:

"Hello! Confirm you're working by telling me: (1) what model you're using, (2) can you see files in this directory? List them if so."

Test File Operations:

"Create a simple test file called hello.txt with the text 'Free Claude Code setup works!' Then read it back to confirm."

Understand the Architecture:

"Explain the architecture of my current setup: I'm using Claude Code CLI with a router pointing to a free backend. What's happening when I send you a message? Walk me through the request flow."


That's it. Proceed to Lesson 05 to learn about teaching Claude your way of working.