All posts
Claude CodeOpenRouterAI toolsdeveloper tools

Free Claude Code? Here's How

Renato Dinis

You don't need an Anthropic subscription to run Claude Code. A free OpenRouter key plus a small local proxy gets you full Claude Code functionality on free models. Your paid Claude account, if you have one, stays completely untouched — they run on separate paths.

What's happening under the hood

OpenRouter is a single API that routes to hundreds of AI models. Some are free. Claude Code normally talks to Anthropic's servers directly. The proxy intercepts those calls and redirects them to OpenRouter, which forwards them to whichever model you pick.

Prerequisites

  • Claude Code installed
  • Homebrew (for installing pyenv)
  • Python 3.14 via pyenv
  • UV (Python package manager from Astral)

If you're missing any of these, the links are in the video description.

Step 1: Get a free OpenRouter API key

Go to openrouter.ai, click Get API Key, then New Key.

Name it whatever you want. The credit limit is optional — since we're using free models, it won't matter. Set an expiry if you want (the demo uses 1 day). Click Create, copy the key, save it somewhere.

Step 2: Clone the proxy repo

git clone git@github.com:Alishahryar1/free-claude-code.git
cd free-claude-code
cp .env.example .env

Open .env and update three variables:

OPENROUTER_API_KEY=your_key_here
MODEL=open_router/deepseek/deepseek-chat-v3-0324:free
ANTHROPIC_ALPHA_TOKEN=your_token_value

The ANTHROPIC_ALPHA_TOKEN already has the right value in the example file. Leave it.

For the model, prefix is always open_router/ followed by the model ID from OpenRouter. Free models have :free at the end. DeepSeek Flash is a solid free option for most coding tasks.

Save the file.

Step 3: Start the proxy

uv run uvicorn server:app --host 0.0.0.0 --port 8082

The first run creates a virtual environment and installs dependencies — takes a minute. On future runs it starts in seconds.

When you see Uvicorn running on http://0.0.0.0:8082, the proxy is ready.

Step 4: Start Claude Code through the proxy

Open a new terminal. Run:

ANTHROPIC_AUTH_TOKEN=ccc \
ANTHROPIC_BASE_URL=http://localhost:8082 \
CLAUDE_CODE_USE_BEDROCK=0 \
ENABLE_BACKGROUND_TASKS=1 \
claude --dangerously-skip-permissions --model-list-from-bedrock

The ANTHROPIC_BASE_URL points to your local proxy. The ANTHROPIC_AUTH_TOKEN value doesn't matter since we're not hitting Anthropic's servers — ccc works fine.

Claude Code opens. You'll see it's defaulting to Opus or Sonnet. That's the last model that was selected, not the free one yet.

Step 5: Switch to a free model

In the Claude Code session, type /model.

You'll see a full list of every model OpenRouter supports. Free models are marked with :free at the end of the model ID. Find one and select it.

For general coding tasks, DeepSeek Flash (free) works well. For something requiring more reasoning, browse the list. Free models have lower rate limits and aren't as capable as paid ones, but for a lot of tasks they're more than enough.

Step 6: Test it

create a simple tic-tac-toe game in a single index.html file

Claude Code sends the request through the proxy to OpenRouter, then to the free model. The file gets created. Open it in a browser and play a round. Everything works.

Verify it's not using your Anthropic account

If you have a Claude subscription, open the Claude Code app and check Usage. It shows zero. The proxy intercepts before requests reach Anthropic's infrastructure.

Check OpenRouter's activity log to confirm the requests went through there instead.

The alias shortcut

Typing all those environment variables every session is annoying. Add an alias to your shell config (~/.zshrc or ~/.bashrc):

alias claude-free='ANTHROPIC_AUTH_TOKEN=ccc \
  ANTHROPIC_BASE_URL=http://localhost:8082 \
  CLAUDE_CODE_USE_BEDROCK=0 \
  ENABLE_BACKGROUND_TASKS=1 \
  claude --dangerously-skip-permissions --model-list-from-bedrock'

Run source ~/.zshrc to reload. Now typing claude-free in any terminal starts the proxied session.

Two things to remember

  1. Start the proxy first, then run claude-free. Reverse order breaks the connection.
  2. Your normal claude command still works as before. The alias is separate.

If you're building AI automations for clients and want someone who's already done this in production, get in touch. See our AI consulting service for how we work.

Need this built for your business?

Atuals builds custom AI agents and workflows. Drop us a note — we reply within 24 hours with an honest take on whether we can help.


Atualsatuals
© 2026 Atuals · AI automation agency