Whether you are a student, a hobbyist, or a developer on a budget, running a high-end AI coding agent usually comes with a price tag. But by combining Claude Code (Anthropic's command-line tool) with OpenRouter's free tier, you can build an AI-powered dev environment without spending a cent or owning a powerful GPU.
Open PowerShell. Run the following command to install the Claude Code package globally:
irm https://claude.ai/install.ps1 | iex
To make Claude Code talk to OpenRouter instead of Anthropic's direct servers, you need to tell your system where to look.
C:\Users\Zephyrus\.local\binOpenRouter acts as a bridge, allowing you to access various AI models through a single API.
To Expire or Not to Expire?
When creating your key, you’ll see an option to set an expiration date.
Why use an expiration? It is a security best practice. If your key is ever accidentally pushed to GitHub or leaked, it will eventually become useless on its own.
Why skip it? If you are working in a private, secure environment and don't want the hassle of updating your project settings every 30–90 days, you can leave it to "Never expire."
Instead of manually setting temporary variables in your terminal, you can permanently configure Claude Code by editing its global configuration file. This method makes it much easier to switch between free models from OpenRouter.
C:\Users\Zephyrus\.claude\settings.json.claude folder, you may need to run the claude command once in PowerShell to initialize it.settings.json file with Notepad or VS Code and paste the following structure:
{
"env": {
"ANTHROPIC_BASE_URL": "https://openrouter.ai/api",
"ANTHROPIC_AUTH_TOKEN": "<your-openrouter-api-key>",
"ANTHROPIC_API_KEY": ""
}
}
Replace <your-openrouter-api-key> with the key you generated in Step 3.nvidia/nemotron-3-super-120b-a12b:free). Add them to your env block like this:
{
"env": {
"ANTHROPIC_BASE_URL": "https://openrouter.ai/api",
"ANTHROPIC_AUTH_TOKEN": "sk-or-v1-...",
"ANTHROPIC_API_KEY": "",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "nvidia/nemotron-3-super-120b-a12b:free",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "poolside/laguna-m.1:free",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "openai/gpt-oss-120b:free"
}
}
4. Save the file. Now, whenever you run `claude` in your terminal, it will automatically route through OpenRouter using the free models you specified without any extra setup.
Note on Usage Limits: Since you are using OpenRouter’s free models, keep in mind that there is a strict daily quota of 50 requests per day. Because Claude Code is an agentic tool that often makes multiple background calls to analyze files and run commands, you may reach this limit quickly during intensive coding sessions. To manage this, be specific with your prompts and monitor your usage on the OpenRouter dashboard to avoid service interruptions.
By following this setup, you have successfully transformed Claude Code from a paid-tier tool into a versatile, zero-cost AI workstation.
The Power of Redirection: By pointing ANTHROPIC_BASE_URL to OpenRouter, you’ve unlocked a massive library of models without changing the Claude CLI experience.
Persistent Configuration: Using the settings.json file in your user directory ensures your API keys and model preferences are ready every time you open PowerShell.
Hybrid Flexibility: By mapping specific keys like ANTHROPIC_DEFAULT_SONNET_MODEL to free IDs (like Gemini Flash or Llama 3), you can toggle between "high-intelligence" or "high-speed" free models instantly.
With this configuration, you can now enjoy agentic coding letting AI read your files and run terminal commands all while keeping your budget at exactly $0. Happy coding!
Claude Code
As the founder and passionate educator behind this platform, I’m dedicated to sharing practical knowledge in programming to help you grow. Whether you’re a beginner exploring Machine Learning, PHP, Laravel, Python, Java, or Android Development, you’ll find tutorials here that are simple, accessible, and easy to understand. My mission is to make learning enjoyable and effective for everyone. Dive in, start learning, and don’t forget to follow along for more tips and insights!. Follow him