Use FREE Claude Code with OpenRouter Models (No GPU, No Cost)

Sovary May 11, 2026 17
4 minutes read

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.

Step 1: Download & Install Claude Code via PowerShell

Open PowerShell. Run the following command to install the Claude Code package globally:

irm https://claude.ai/install.ps1 | iex

Step 2: Set Environment Variables in Windows 11 

To make Claude Code talk to OpenRouter instead of Anthropic's direct servers, you need to tell your system where to look.

  1. Press the Windows Key and search for "Edit the system environment variables."
  2. Click Environment Variables at the bottom right.
  3. Under PATH variables, click Edit and append the location of Claude installed. Example: C:\Users\Zephyrus\.local\bin

Step 3: Register OpenRouter with Google Auth

OpenRouter acts as a bridge, allowing you to access various AI models through a single API.

  1. Go to OpenRouter.ai and sign in using Google Auth for a quick setup.
  2. Navigate to Keys in the dashboard and click Create Key.
  3. Then copy the key and paste to somewhere that we will use later on.

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

Step 4: Configure Claude Code & Free Models

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.

  1. Locate the Settings File: Navigate to your user profile directory. For your setup, the file is located at: C:\Users\Zephyrus\.claude\settings.json
    Note: If you don't see the .claude folder, you may need to run the claude command once in PowerShell to initialize it.
  2. Edit the JSON Configuration: Open the 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.
  3. Map Free Models to Claude Keys:
    To trick Claude Code into using free models, you can map the standard Anthropic model names to OpenRouter’s free model strings.
    Go to the OpenRouter Models page, search for the "Free" keyword, and copy the model IDs (e.g., 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.

Key Takeaways

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

  • Sustainability: Managing your rate limits by rotating models or setting key expirations keeps your development environment secure and functional without unexpected interruptions.

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 
Author

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