Back to Blog

Run Claude Code for Free with OpenRouter and Free Models

Published on April 12, 2026 | By Sofia

claude code free with openrouter

If you are a solo builder, developer, or small business owner, Claude Code can feel like a superpower—but the Pro / Max subscription is not always in the budget.
The good news: you can run Claude Code itself for free by routing it through OpenRouter and using their free coding models, while still keeping a smooth, agentic coding experience in your terminal.

This guide is designed for founders and teams who want a serious AI coding setup without locking into expensive monthly plans.
You will learn how to connect Claude Code to OpenRouter, pick solid free models, and structure your work so you actually ship real automation projects—like WhatsApp chatbots, CRM workflows, and internal tools—without burning your budget.

In this guide, you will:

  • Install Claude Code on your machine (Mac / Windows)
  • Connect it to OpenRouter instead of paying for a Claude subscription
  • Configure project-level settings using .claude/settings.json.local
  • Pick free OpenRouter models that work well for coding
  • Use disciplined habits so you actually ship real apps—not just “vibe code”
  • See how this workflow fits perfectly with Kousouf-style AI automation projects (WhatsApp bots, CRM workflows, Trello agents, and more)

1. Who this guide is for

This article is written for:

  • Developers & solo builders who want a serious AI coding setup without recurring Claude Pro fees.
  • Small business owners / agency founders who want to test automation ideas cheaply (WhatsApp bots, Trello automations, internal tools) before investing in a full build.
  • Future Kousouf clients who like to understand the tools first, then bring in an expert team when it is time to scale.

If you just want a “click one button and magic happens” tool, this guide is not for you.
If you want real control, transparent costs, and scalable automation later, keep reading.


2. What you need before you start

You only need four things:

  1. Node.js (for installing Claude Code)
  2. VS Code or a terminal you like
  3. Claude Code CLI
  4. An OpenRouter account + API key

2.1 Install Node.js

  • Go to nodejs.org and download the installer for your OS.
  • Install it like any regular app.
  • Confirm it works:
node -v

If you see a version (for example v22.x.x), you are good to go.

2.2 Install Claude Code

Claude Code is Anthropic’s agentic coding CLI.
It runs directly in your terminal and can read files, edit code, run commands, and use tools like git, npm, or pytest.

Install it globally with npm:

npm install -g @anthropic-ai/claude-code

After installation, confirm it works:

claude --version

You should see a version string similar to claude-code 1.x.x.

If you were previously logged into Claude Code with Anthropic, use:

claude /logout

This clears cached credentials so the OpenRouter configuration can take over.


3. Create your OpenRouter account and API key

OpenRouter is an API gateway that aggregates hundreds of models (Claude-like, GPT-like, and open-source) behind one unified endpoint.
We will use it as the engine behind Claude Code.

  1. Visit openrouter.ai.
  2. Create a free account and verify your email.
  3. Go to Dashboard → API Keys.
  4. Click Create Key, name it something like claude-code-free, and copy it.

Your key will look like:

sk-or-v1-XXXXXXXXXXXXXXXXXXXXXXXX

Treat this like a password.
Never commit it to Git, paste it in public repos, or share it in screenshots.

3.1 Optional: add a small credit buffer

Even if you plan to use only free models, it is smart to add a small amount of credit (for example 5–10 USD) for two reasons:

  • Some guides and SDKs expect a non-zero balance.
  • You might later switch from a free model to a paid, stronger model for heavy production work.

But for this tutorial, we will stay with free models.


4. Pick a free coding model on OpenRouter

OpenRouter exposes many …:free models.
You can choose from MiniMax, Qwen, NVIDIA Nemotron and other strong open or hybrid models that are tagged for coding.

To pick a model:

  1. Go to openrouter.ai/models.
  2. Search for free.
  3. Filter for models tagged as good for programming / coding.
  4. Click into a model and copy its model ID.

The ID looks like this:

minimax/minimax-01:free
qwen/qwen3-coder:free
nvidia/llama-3.1-nemotron-70b-instruct:free
openrouter/free

You will paste one of these into your Claude settings in the next step.

Tip: start with a single stable free model, then experiment.
For most projects, any coding-optimized …:free model is enough to ship your MVP.


5. Configure Claude Code for free OpenRouter models (per project)

Now the important part: tell Claude Code to talk to OpenRouter instead of Anthropic.
We will do this per project, so you keep full control and avoid messing with global shell settings.

5.1 Create the .claude folder and settings file

  1. Create a folder for your project (for example on Desktop):
mkdir cardioflow-demo
cd cardioflow-demo
  1. Open the folder in VS Code (or use your editor of choice).
  2. Inside the project root, create a new folder:
mkdir .claude
  1. Inside .claude, create a new file named:
settings.json.local

You now have:

cardioflow-demo/
  .claude/
    settings.json.local

5.2 Paste the OpenRouter configuration

Open settings.json.local and paste a configuration similar to this (adapt to your model):

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://openrouter.ai/api/v1",
    "ANTHROPIC_AUTH_TOKEN": "sk-or-v1-YOUR-OPENROUTER-KEY",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "minimax/minimax-01:free",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "minimax/minimax-01:free",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "minimax/minimax-01:free",
    "CLAUDE_CODE_SUBAGENT_MODEL": "minimax/minimax-01:free"
  }
}

Replace:

  • sk-or-v1-YOUR-OPENROUTER-KEY with your real API key.
  • minimax/minimax-01:free with the free model you chose.

You can later swap the model IDs to test other free or paid models.
Just update this file and restart Claude.

5.3 Add basic permission rules (optional but recommended)

To avoid constant prompts while staying safe, you can also add a minimal permissions block to the same file:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://openrouter.ai/api/v1",
    "ANTHROPIC_AUTH_TOKEN": "sk-or-v1-YOUR-OPENROUTER-KEY",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "minimax/minimax-01:free",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "minimax/minimax-01:free",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "minimax/minimax-01:free",
    "CLAUDE_CODE_SUBAGENT_MODEL": "minimax/minimax-01:free"
  },
  "permissions": {
    "allow": [
      "Read",
      "Grep",
      "Glob"
    ],
    "deny": [
      "Bash(rm -rf *)",
      "Bash(git push *)"
    ]
  }
}
  • Read, Grep, Glob keep codebase navigation smooth.
  • Dangerous commands like rm -rf or git push are explicitly blocked.

This follows a simple philosophy: trust the assistant with reads and searches, but fence off destructive actions.


6. Start Claude Code and verify the free setup

Inside your project folder (where .claude lives), open a terminal and run:

claude

Claude Code will:

  1. Load your settings.json.local.
  2. Use OpenRouter as its backend.
  3. Expose your chosen free model as the default.

To confirm:

  1. In the Claude prompt, type:
/model
  1. You should see your free model (for example minimax/minimax-01:free or openrouter/free) in the model picker.
  2. Select it, then send a simple message like Hi.

If everything is correct:

  • You will get a friendly reply from the model.
  • In your OpenRouter dashboard under Activity / Logs, you will see the request.
  • The cost will show as 0 for a free model.

If you get authentication errors, double-check your API key and ANTHROPIC_BASE_URL.
If Claude still tries to log in with Anthropic, run /logout inside Claude and restart.


7. Two configuration modes: local vs global

So far, we used project-level settings.
That is perfect if you:

  • Want some projects to use OpenRouter and others to use normal Claude.
  • Experiment with different models per project.

You can also configure global settings, so every Claude Code project uses OpenRouter by default:

7.1 Global settings (advanced)

  1. Locate your global Claude settings file:
  • On macOS / Linux: ~/.claude/settings.json
  • On Windows: usually inside your user folder under .claude/settings.json
  1. Add the same env block as above into that file.

This makes OpenRouter the default backend everywhere.
Use this only if you are comfortable editing global config files.

If you are new to this, stay with the per-project .claude/settings.json.local method.
It is safer and harder to break.


8. How to actually build real apps with this free setup

Having Claude Code + OpenRouter wired up is step one.
Shipping real products is a different game.
Here are three key habits we use in real automation projects:

8.1 Keep your app modular

  • Keep files small and focused (aim under ~300–600 lines per file).
  • Split big components into smaller ones.
  • Let Claude refactor when a file grows too large.

Modular structure keeps the context window clean and avoids the messy “one giant file” problem that makes smaller models hallucinate.

8.2 Understand your building blocks before prompting

Do not just paste: “Build me a SaaS app.”
Instead, think like an architect:

  • What routes, pages, and core entities do I need?
  • Which database, APIs, and third-party tools are involved?
  • Where can race conditions or security problems appear?

Your job is not to type every line of code.
Your job is to know what to ask for.
The better your mental model, the more powerful Claude Code becomes.

8.3 One task per session

Free or smaller models can drift over long sessions.
Use this cycle:

  1. Plan one clear task (for example “Implement email verification flow”).
  2. Let Claude Code implement it.
  3. Test manually.
  4. Commit and push to Git.
  5. Run /clear and start a fresh session for the next task.

This keeps your project stable and makes it easy to roll back if a later step breaks something.


9. Great first projects to try (that match Kousouf-style automation)

Here are a few starter ideas where Claude Code + OpenRouter + Kousouf-style thinking fit perfectly:

  • WhatsApp lead capture page: Build a landing page that pushes every form submission straight into WhatsApp via an API.
  • Mini internal CRM: A lightweight dashboard to track leads, status, and last WhatsApp conversation.
  • Trello automation helper: Recreate some of the flows from your Trello boards using a tiny Node.js or Next.js backend.

Once you validate that these flows work with a free model, you can later upgrade to production-grade automations—WhatsApp bots, AI agents, and workflow engines—similar to the solutions we build in:


10. When to keep DIY, and when to call an AI automation agency

You should absolutely start DIY with this free setup if:

  • You are validating an idea.
  • You enjoy building and want to learn.
  • A few bugs or reworks are acceptable.

But you should consider partnering with an AI automation agency like Kousouf when:

  • The automation is mission-critical (sales, support, invoices, logistics).
  • You need WhatsApp chatbots, CRM workflows, Trello agents, or multi-step automations beyond what you can safely maintain alone.
  • You want ongoing monitoring, error handling, and cost optimization.

At Kousouf, we take the same principles from this guide—modular structure, clear workflows, safe permissions—but apply them with battle-tested architectures, enterprise tools, and production SLAs.
You own the ideas; we turn them into systems that run every day without drama.

If you ever reach that point, you can:

  • Book a quick strategy call via our website homepage.
  • Or reply to any WhatsApp CTA in our automation articles, and we will take it from there.

11. Quick recap

  • Install Node.js and Claude Code CLI.
  • Create an OpenRouter account and API key.
  • Pick a solid free coding model like minimax/minimax-01:free or another …:free coding model.
  • In each project, create .claude/settings.json.local and set ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, and default model env variables.
  • Start Claude Code with claude, pick your model via /model, and verify in the OpenRouter dashboard that your calls cost 0.
  • Use disciplined workflows (modular files, one task per session, clear building blocks) so this free setup produces real, shippable software.

From there, you are free to experiment—build internal tools, small SaaS products, or proof-of-concept automations.
And when you are ready to connect this to serious WhatsApp, CRM, or workflow automation, you know where to find us.


About Sofia (Author)

Sofia is a digital writer developed by Kousouf — a smart AI persona created to share ideas, insights, and useful content in a clear, human-like voice. While she’s not a real person, her words are carefully crafted to reflect Kousouf’s values: clarity, curiosity, and meaningful communication. Think of Sofia as your friendly guide through the content we create.

Learn more about Sofia