Return Home

Use Claude Code for Free

Reference Claude Code AI Windows

What is Claude Code

Claude Code is an AI Agent that runs in your terminal and can work on your behalf. It gives you the ability to prompt an LLM directly from your terminal, describing changes in plain English.

Similar to cell phone minute charges in the mid-90s to early-2000s, Claude Code usage is expensive. It genuinely feels like you're being charged by the minute, and might need to take out a small loan. There are a few things you can do to combat this (hosted models, cheaper inference, etc), I'm trying a simple solution; OpenRouter.

OpenRouter is an API aggregator that provides a single endpoint to access many LLMs, including numerous open source (free) models. By pointing Claude Code at OpenRouter and using these free models, you can run Claude Code free of charge. All you need is an OpenRouter account and an API key. Below, I'm going to give step by step instructions on how to set this up on Windows.

This method only provides ~50 free requests per day. If you need more, you can either purchase $10 worth of credits from OpenRouter, which increases your quota to ~1000 requests per day, or you can set up your own local instance of an open source model and point Claude Code to it. This tutorial will only cover the OpenRouter method, but I may write a follow-up article on how to set up a local instance in the future.

Update (As of 15 June 2026)

After testing this method, and multiple others, I would not expect great results from most free or local models with coding agents or assistants yet. While the technology is quickly improving, free open source solutions still have major limitations. There were distinct issues with tool calling and file traversal because these open source models do not provide input in the way Anthropic expects it. After diagnosing the issue, I attempted to try something similar with a series of locally hosted models, and even attempted to use CCR Claude Code Router proxy with all open source model/Claude Code combinations to no avail.

To escape OpenRouter and incompatibility purgatory, I tested three different locally hosted Qwen models across three agents; Claude Code, Cline, and Continue. The overall experience was wildly inconsistent. Just for reference, I have an RTX 3070 with 8GB of VRAM, an AMD Ryzen 7 5800X, and 32GB of DDR4. I thought this was enough, but AI says it's time for an upgrade.

Starting with Qwen3-Coder, which was the largest model I tried, the experience made me fear for my poor GPU. I did not have the overhead to run this efficiently, it quickly maxed out my GPU's VRAM, and the model lacked the ability to call tools with Claude Code. I then tried to use this model with Continue, and Cline. I ran into similar issues with the context window being too large or too small for the agents or my GPU, and still lacked the tool calling that Claude natively provides.

I was actually pleasantly surprised with Qwen-2.5-7B, which fit comfortably within my GPU's VRAM. This model provided some tool calling and had a decent context window size. However, the quality of responses was inconsistent, and having to manually provide file content as context was tedious. My least favorite interaction was when the model entered a planning loop. It would repeatedly ask for context for an issue, I would provide it, and then it would repeat like groundhog day. I was able to break out of this loop temporarily by forcing an action, but it would very quickly revert to the planning loop, even in act mode.

I then tried a combination of Qwen-2.5-7B and Qwen-Coder-1.5B. I used 2.5 for general purpose and 1.5 for autocomplete. This combination worked pretty well, and was for a brief while usable. I think 1.5B is great for autocomplete and is probably all you need for it. Then I encountered the planning loop issue... again... on 2.5B, and it was inescapable.

To recap: My biggest issues were open source models missing tool-calling support, weak codebase/file traversal, and hardware limitations when attempting to run locally. To avoid VRAM limits, I had to reduce context window size, which hurt usefulness on larger tasks. I'm sure there are reliable local solutions, but not many that provide the features I want with my current hardware constraints. I am continuing to test new options and I will provide alternative solutions as I discover them in new articles.

Setup

  1. Install Claude Code or type "npm install -g @anthropic-ai/claude-code" in your terminal.
  2. Create a free OpenRouter account and store off your API key. We will not be using paid models, but ensure you change the Credit Limit associated with your API key to 0. If you get a 402 error, remove this, and it will still work without incurring charges.
  3. Open "Edit the system environment variables" from the Windows Start menu, click "Environment Variables", and add the following environment variables:
Variable Value
ANTHROPIC_AUTH_TOKEN your-openrouter-key
ANTHROPIC_BASE_URL https://openrouter.ai/api
ANTHROPIC_DEFAULT_SONNET_MODEL openrouter/free
ANTHROPIC_DEFAULT_HAIKU_MODEL openrouter/free
ANTHROPIC_DEFAULT_OPUS_MODEL openrouter/free

Launch Check

From a PowerShell terminal in your project or the project's directory, type:

claude

The welcome screen should show your configured model name, not Anthropic Opus or Sonnet (in our case, openrouter/free).

If the welcome screen still shows an Anthropic model, double check the variables in PowerShell:

$env:ANTHROPIC_BASE_URL="https://openrouter.ai/api"
$env:ANTHROPIC_AUTH_TOKEN="your-openrouter-key"
$env:ANTHROPIC_API_KEY=""
$env:ANTHROPIC_DEFAULT_SONNET_MODEL="openrouter/free"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL="openrouter/free"
$env:ANTHROPIC_DEFAULT_OPUS_MODEL="openrouter/free"

claude

Drawbacks and Limits

Using "openrouter/free" lets OpenRouter choose from a small list of available models instead of relying on a single one, cutting down on wait time. This inevitably results in inconsistent quality of responses due to different models being used. Not only that, but not every model supports the same features as the Anthropic models, so you may find that some features of Claude Code do not work.

To change your model to a specific one that supports the features you need, click here to view the available free models and their references. Simply change the environment variables above to point to the model(s) you want to use. This may increase wait times.

Additionally, Claude Code can use multiple requests in a single prompt when performing advanced tasks like parsing file structures, or multi-step tasks. Here are the usage limits that apply to free models:

  • Up to 20 requests per minute
  • Up to 50 requests per day if you have purchased less than $10 in credits
  • Up to 1000 requests per day if you have purchased at least $10 in credits
  • Failed attempts still count toward the daily quota