πΊ Watch the Video: Click here to watch the full step-by-step tutorial
This repository is the official guide for my YouTube tutorial. It helps you set up Claude Code on Windows using WSL2 and powers it with Google Gemini using the Claude Code Router.
Important: This is the first thing you need to do. We are setting up a Linux environment where Claude Code will run.
- Press the Windows key
- Search for PowerShell
- Click Run as administrator
- Click Yes
wsl --install- Windows will download and install WSL
- Ubuntu will launch automatically
- Stay in the same window while it provisions
- Enter a username
- Enter a password
- Confirm the password
β οΈ Password typing is hidden. This is normal in Linux.
When you see something like:
hammad@PC:/mnt/c/WINDOWS/system32$
Keep this terminal open and continue.
Inside your WSL / Ubuntu terminal, run:
curl -sSL https://raw.githubusercontent.com/devhammad0/claude-code-router-setup/main/scripts/install.sh | bash
After the script finishes:
source ~/.bashrcReplace YOUR_KEY_HERE with your key from Google AI Studio:
echo 'export GOOGLE_API_KEY="YOUR_KEY_HERE"' >> ~/.bashrcsource ~/.bashrcccr codesudo apt update && sudo apt upgrade -y
sudo apt install -y curl git build-essentialcurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
source ~/.bashrc
nvm install --ltsnpm install -g @anthropic-ai/claude-code @musistudio/claude-code-routerRun:
echo $SHELL- If output contains
/bashβ use~/.bashrc - If output contains
/zshβ use~/.zshrc
mkdir -p ~/.claude-code-router ~/.claudeRun the following command to create your configuration:
cat > ~/.claude-code-router/config.json << 'EOF'
{
"LOG": true,
"LOG_LEVEL": "info",
"HOST": "127.0.0.1",
"PORT": 3456,
"APIKEY": "your_secure_password_here",
"API_TIMEOUT_MS": 600000,
"Providers": [
{
"name": "gemini",
"api_base_url": "https://generativelanguage.googleapis.com/v1beta/models/",
"api_key": "$GOOGLE_API_KEY",
"models": [
"gemini-3-flash-preview",
"gemini-3-pro-preview",
"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
}
}
EOFBefore you run the agent, check the current limits for the models included in the config above. These limits are reset at Midnight Pacific Time (PT).
| Model Name | RPM (Req/Min) | TPM (Tokens/Min) | RPD (Req/Day) | Status/Notes |
|---|---|---|---|---|
| gemini-2.5-flash-lite | 30 | 1,000,000 | 1,500 | β Recommended for Coding |
| gemini-2.0-flash | 10 | 1,000,000 | 1,000 | Stable legacy option |
| gemini-3-flash-preview | 2 | 100,000 | 100 | |
| gemini-3-pro-preview | 0 - 2* | 32,000 | 5 - 10 | π« Effectively Paid-Only |
Free Tier Quota Note:
- RPM (Requests Per Minute) is strictly enforced. If Claude Code fires multiple background file reads, you may hit a brief 429 error.
- Gemini 3 Pro Preview is currently highly restricted for free users; frequent use in the
thinkorlongContextroutes will likely exhaust your daily quota (RPD) in minutes.TIP:
*Why use Flash-Lite? Claude Code performs many small background tasks (reading files, checking status). Using a model with less than 10 RPM will cause "Rate Limit" errors almost immediately. Flash-Lite is the only free model that provides a smooth experience for complex coding.
Use the shell configuration file you identified in Step 1. Replace YOUR_KEY_HERE with your actual Google AI Studio API key.
If using bash:
echo 'export GOOGLE_API_KEY="YOUR_KEY_HERE"' >> ~/.bashrc
source ~/.bashrcIf using zsh:
echo 'export GOOGLE_API_KEY="YOUR_KEY_HERE"' >> ~/.zshrc
source ~/.zshrcccr codeccr start/ccr stop/ccr statusβ Manage the background router service.ccr modelβ Quick interactive configuration of your model providers.ccr uiβ Dashboard athttp://localhost:3456
If ccr code shows a "Timeout" error, the background service might just need a manual kickstart. Run these separately:
ccr start
ccr codeThis usually means a "ghost" process is already using the port. Run this to clear it:
# Find any process on port 3456
sudo lsof -i :3456
# Use the PID found to kill it: sudo kill -9 <PID>Use these commands to verify your setup:
ccr statusβ Check if the background service is running./statusβ (Inside Claude) Verify the Base URL is 127.0.0.1:3456.
Maintained by Muhammad Hammad | LinkedIn Profile
