Ga naar hoofdinhoud

How to Use Claude Code For Free Without a Subscription

Claude Code is not free by default. Learn about all alternative paths, with the exact setup commands and an honest account of what each one trades away from the original.
3 aug 2026  · 15 min lezen

Verkennen met AI

Openen in ChatGPTOpenen in ClaudeOpenen in Perplexity

You install Claude Code in about thirty seconds, run claude inside a project directory, and discover the account you already have does not open the door. That is where most people start searching for a free version — and where the answers get muddy, because "free" means different things depending on whether you want the terminal agent, the chat interface, or the Claude Code workflow with some other model doing the thinking underneath.

This article covers four routes to a setup that costs you nothing, ordered roughly by how close each gets you to the real thing. Prerequisites are minimal: a terminal, and Claude Code's supported platforms (macOS 13+, Windows 10 build 1809+, Ubuntu 20.04 or Debian 10+, 4 GB RAM). The native installer carries its own runtime, so Node.js only matters if you choose the npm route.

In a nutshell

  • The Claude.ai free plan does not include Claude Code.

  • New console accounts receive a one-time API credit that grants CLI access for a trial.

  • Claude Code reads its endpoint from ANTHROPIC_BASE_URL, which is what makes the OpenRouter and Ollama routes possible.

  • Those two routes give you the Claude Code workflow with a different model underneath, not Claude.

  • Open-source maintainers can get six months of access to the top-tier plan.

Introduction to Claude Models

Learn how to work with Claude using the Anthropic API to solve real-world tasks and build AI-powered applications.
Explore Course

What Is Claude Code?

Claude Code is Anthropic's agentic coding tool for the terminal. It runs inside your project directory, reads your files, edits them, executes commands, and handles multi-step tasks without you having to copy anything into a browser tab.

The reason it costs money is structural rather than commercial. Every action it takes is an API call, and agentic sessions are chatty by nature: the model re-reads context, calls tools, checks results, and tries again. A busy afternoon in a large repository can cost several dollars in tokens without feeling especially productive.

If you want the full picture of what the tool does day-to-day, our Claude Code tutorial covers setup, refactoring, and debugging in practice.

Is Claude Code Free?

The direct answer is no. Anthropic's setup documentation states that Claude Code requires a Pro, Max, Team, Enterprise, or Console account, and that the free Claude.ai plan does not include access. Pro starts at $20 per month, or $17 per month if you pay $200 up front for the year.

The alternative is console billing, where you pay per token with no subscription attached. Claude Sonnet 5 usually runs at $3 per million input tokens and $15 per million output tokens. Claude Opus 5 sits at $5 and $25, and Haiku 4.5 at $1 and $5.

Those two routes bill on completely different logic, and picking the wrong one is how people end up overpaying or getting throttled mid-task. Here is how they compare.

 

Claude subscription (Pro, Max, Team)

Console pay-per-token

What you pay for

A flat monthly fee covering a usage allowance

Only the tokens you actually send and receive

Cost

$20/month for Pro, $100 or $200 for Max, $125 per Team Premium seat

No monthly fee. Sonnet 5 at $2/$10 per million tokens, Opus 5 at $5/$25, Haiku 4.5 at $1/$5

Model access

Sonnet 5 by default, with Opus available on Pro and above

Every model on the rate card, including Haiku 4.5 for cheap work and Fable 5 at the top

What limits you

A rolling five-hour window plus a weekly cap, shared across Claude chat, Cowork, and Claude Code

Rate limits are tied to your usage tier (Start, Build, or Scale) rather than a message allowance

When you hit the wall

You wait for the window to reset, or buy extra usage at API rates

Nothing stops until your prepaid credits run out, at which point requests fail with a billing error

Cost predictability

Fixed. You know the number before the month starts

Variable. A heavy refactoring week costs several times as much as a quiet one

Free starting point

None. There is no trial on Pro or Max

A one-time starter credit on new accounts

Best for

Steady daily use, where the flat fee works out cheaper per token than metered billing

Bursty or occasional use, evaluation, and anyone who refuses a monthly commitment

The crossover point is usage consistency, not volume. A subscription buys tokens at a much better effective rate than the API right up until you hit the plan ceiling, so daily users almost always come out ahead on Pro. Metered billing wins when your weeks look nothing like each other, since you pay nothing at all in the quiet ones.

So where does "free" come from? Three places, roughly. 

  • Starter credit that Anthropic hands new API accounts
  • The fact that Claude Code will happily talk to any server that speaks the Anthropic Messages format, including free ones, whether hosted (OpenRouter) or local (Ollama)
  • A grant program aimed at open-source maintainers

That second category deserves a warning up front. Pointing Claude Code at a free model gets you the interface and the agent loop, not Claude. The quality gap on multi-step reasoning is real, and I will come back to it.

Does the Free Plan Include Claude Code?

Let me deal with the most common misunderstanding first, because it wastes a lot of people's evenings.

The free tier does not include Claude Code. Not a limited version, not a trial version, none of it. Anthropic's own documentation is unambiguous: the free plan covers Claude on web, iOS, Android, and desktop; the terminal agent is not included.

What you do get is genuinely decent. Since July 1, 2026, the free plan runs Claude Sonnet 5 as its default model, alongside web search, file uploads, Projects, and Artifacts, all of which used to sit behind the paywall. For pasting a stack trace and asking what went wrong, it holds up well.

Free tier limits developers hit first

Anthropic does not publish a message count, and anyone quoting an exact number is guessing. The company describes Pro as at least five times the per-session usage of Free, which makes Free the baseline rather than a fixed quota. In practice, reports cluster around 15 to 40 messages per rolling 5-hour window, with longer messages and attachments burning through it faster.

A few limits matter more than the message count:

  • The five-hour window starts rolling when you send your first message.
  • No Claude Code CLI access. This is the hard one, and no workaround changes it.
  • Limits flex with server load, which means peak hours are worse.
  • Long conversations cost more per message because the whole thread is reread each turn.

Where this lands: the free chat tier is fine for one-off questions and code review, and it falls apart the moment you want sustained back-and-forth on a codebase. Which is precisely what Claude Code is for.

Option 1: Anthropic API Free Credits

This is the least-known official route and, in my view, the one most people should start with.

Creating an account at platform.claude.com grants a one-time starter credit. Anthropic's pricing documentation describes it as only "a small amount of free credits" without specifying a figure, though third-party reports consistently put it at around $5.

API credits authenticate the Claude Code CLI. You get the real agent, running real Claude models, on your real codebase. The credits do not renew and expire after 14 days, so treat this as a trial rather than a supply.

Setting up an API account and claiming credits

The whole path runs from a cold signup to a working agent in about 10 minutes, and most of that time is spent waiting on the installer. I have broken it into five steps because the third one contains a trap that costs people a restart.

Step 1: Create your Console account

Go to platform.claude.com and sign up with your email address. The console is a separate product from the claude.ai chat interface, so an existing Claude account does not carry over, and you may need to register again with the same address.

Anthropic Claude Console dashboard showing the main navigation menu after a new account signup.

For clarification, some accounts are asked to verify their phone number at this stage. Once you are through, the starter credit is applied automatically rather than claimed from a promo field.

Step 2: Check your credit balance

Open the Billing section from the console navigation. Your starting balance appears there, along with the option to add a payment method, which you do not need yet.

Check this before you do anything else. If the balance reads zero, no amount of correct configuration later will produce a working session.

Step 3: Create an API key

Go to Settings > API Keys and create a new key. Give it a name you will recognize in three months, since most people end up with several.

Claude Console dialog displaying a newly created API key with a copy button and a warning that it will not be shown again.

The full key value is displayed exactly once. Copy it into your password manager the moment it appears, because closing that dialog without copying means losing the key and starting the step again.

Step 4: Export the key and install Claude Code

Export the key as an environment variable in your shell, then install the CLI. Anthropic recommends the native installer, which carries its own runtime and needs no Node.js at all.

export ANTHROPIC_API_KEY="sk-ant-your-key-here"
curl -fsSL https://claude.ai/install.sh | bash

Installing Claude code in our machine.

In Windows PowerShell, the installer is irm https://claude.ai/install.ps1 | iex. If you prefer npm, note that as of Claude Code v2.1.198, the package expects Node.js 22 or later, which is a change from the Node.js 18 floor that older guides still quote:

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

Add the export line to your ~/.zshrc or ~/.bashrc if you want the key to survive a new terminal window. Then confirm the install landed:

claude --version

Step 5: Run your first session

Change into a project directory and start the agent. Running claude from your home directory technically works, though the tool is close to useless without a codebase to read.

cd ~/projects/my-app
claude

On first launch with ANTHROPIC_API_KEY set, Claude Code prompts you once to approve the key rather than opening a browser for OAuth. Approve it, and you land on the welcome screen with your working directory confirmed at the bottom:

Claude Code on our machine.

To confirm the billing route rather than just the install, run /status inside the session. The API key line naming ANTHROPIC_API_KEY is what tells you the session is drawing on Console credits instead of a saved claude.ai login.

If anything looks wrong at this point, claude doctor prints installation and settings diagnostics without starting a session, and it is a faster first move than searching error strings.

How far do the free credits go?

Rough math, using Sonnet 5 at its current introductory rates. Picture fifteen exchanges on a real repository, each sending about 30,000 tokens of context and producing around 1,500 tokens of output. The first turn pays the full input price, and the fourteen after it mostly hit the prompt cache at 10% of that price.

Line item

Calculation

Cost

First turn, uncached input

30,000 tokens at $2/MTok

$0.06

Fourteen later turns, cache reads

420,000 tokens at $0.20/MTok

$0.08

Output across all fifteen turns

22,500 tokens at $10/MTok

$0.23

Session total

 

$0.37

Same session with no caching

450,000 input tokens at full price

$1.13

Treat that as an order of magnitude rather than a quote. The model above assumes flat context and ignores the cache write premium, which is 1.25 times the base input price for a five-minute cache, so your real sessions will land somewhere on either side of it.

The gap between the last two rows is the part worth internalizing. Caching takes roughly three-quarters off the bill, which is why Claude Code sessions cost far less than a naive token count suggests, and why anything that breaks the cache (jumping between repositories, restarting sessions constantly, switching models mid-session) quietly triples what you pay. Anthropic's pricing documentation has the full multiplier table if you want to model this properly.

Model rate differences

Model choice moves the number more than anything else you control. Running the same fifteen-exchange session across the lineup:

Model

Input / output per MTok

Cost per session

Sessions per $5

Haiku 4.5

$1 / $5

$0.18

about 27

Sonnet 5 (introductory, through Aug 31, 2026)

$2 / $10

$0.37

about 13

Sonnet 5 (standard, from Sept 1, 2026)

$3 / $15

$0.55

about 9

Opus 5

$5 / $25

$0.92

about 5

Fable 5

$10 / $50

$1.85

fewer than 3

So a five-dollar balance buys you somewhere between five and twenty-seven sessions, depending entirely on which model you point at. Sonnet 5 is the sensible default for evaluation.

Spend that balance on one genuine task rather than toy examples. Refactor a module you actually own, or chase a bug across three files, because that is the only way to learn whether the tool earns a place in your week.

When the balance hits zero, there is no fallback. Console billing is pay-as-you-go, and Claude Code has no free tier waiting underneath.

Option 2: OpenRouter Free Models

OpenRouter is an API gateway sitting in front of a few hundred models, and a rotating handful of them cost nothing to call. No credit card, no monthly fee, no subscription.

The reason this connects to Claude Code at all is that the CLI reads its endpoint from an environment variable. Change the variable, change where the requests go. OpenRouter runs what it calls an "Anthropic Skin", an endpoint that accepts the Anthropic Messages format and passes through thinking blocks and native tool use untouched, so no local proxy is involved.

Be clear about what you are getting, because these are not Claude models. You keep the Claude Code interface, the agent loop, the file editing, and the slash commands, while a Qwen or Llama variant does the reasoning.

OpenRouter's own documentation warns that Claude Code is only guaranteed to work with Anthropic's first-party provider and "may not work correctly with other providers". I would rather quote that than pretend otherwise.

How the redirect works

Three variables do the work:

  • ANTHROPIC_BASE_URL points at https://openrouter.ai/api rather than Anthropic's endpoint.

  • ANTHROPIC_AUTH_TOKEN carries your OpenRouter key and is sent as an Authorization: Bearer header.

  • ANTHROPIC_API_KEY must be set to an explicitly empty string; otherwise, Claude Code may fall back to authenticating against Anthropic.

You can set these in your shell profile or in a Claude Code settings file. One thing to avoid: a project .env file will not work, because the native installer does not read standard .env files.

json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://openrouter.ai/api",
    "ANTHROPIC_AUTH_TOKEN": "sk-or-v1-your-openrouter-key",
    "ANTHROPIC_API_KEY": ""
  }
}

Where you put that file matters more than it looks. Use ~/.claude/settings.json for a global configuration, or .claude/settings.local.json for a single project, since Claude Code adds the latter to your gitignore. 

Do not put a credential in a project's .claude/settings.json, because that file is committed and shared with everyone who clones the repository.

Setting up Claude Code with OpenRouter

  1. Install Claude Code with the native installer if you have not already.

  2. Create a free account at openrouter.ai and generate a key under Settings > Keys. No card is required for an account that only calls free models.

  3. Write the configuration into ~/.claude/settings.json using the block above, or export the same three variables in your shell profile.

  4. If you have ever logged in to Claude Code with an Anthropic account, run /logout inside the CLI, then quit and relaunch. A cached session overrides your variables and surfaces as confusing model-not-found errors.

  5. Start claude and check where the requests are going.

> /status
Auth token: ANTHROPIC_AUTH_TOKEN
Anthropic base URL: https://openrouter.ai/api

Your requests should also appear in the OpenRouter activity dashboard within a few seconds, which is the quickest way to confirm the redirect took.

Choosing a free model on OpenRouter

Free model IDs end in :free, and the roster shifts constantly as providers add, pull, or reprice models. The OpenRouter free models collection shows which models are available at no cost. openrouter/free is OpenRouter's auto-router for free models. It picks whatever is available and matches your request, which keeps your setup working after individual models rotate out. Simplest starting point, but quality varies strongly.

Pricing, credit amounts, and the free model roster on OpenRouter all change on a monthly cadence, and some of them changed while I was writing this. Check Anthropic's pricing page and OpenRouter's free filter before you commit to a plan based on any number here.

Then there are the rate limits, which bite harder than the model choice. Free models allow 20 requests per minute regardless of your account, and 50 requests per day if you have never bought credits. Purchase $10 of credits once, ever, and that daily allowance rises to 1,000 and stays there even after the balance drops back to zero.

Fifty requests a day sounds workable until you remember that an agentic session spends requests the way a chatty colleague spends your afternoon. One reasonably involved task can consume a third of the daily allowance. Failed attempts count too, so blind retries make the situation worse rather than better.

To route specific model roles, Claude Code exposes separate variables for each tier:

bash
export ANTHROPIC_DEFAULT_SONNET_MODEL="cohere/north-mini-code:free"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="cohere/north-mini-code:free"
export CLAUDE_CODE_SUBAGENT_MODEL="cohere/north-mini-code:free"

Simple refactors, single-file edits, and explanation tasks hold up well. That said, long multi-step work degrades noticeably, and the failure mode is usually tool calling rather than raw code quality, so the model picks the wrong tool, misreads a result, or loops.

If you want a more deliberate approach to mixing models by task, our Claude Code Router guide covers multi-model routing in detail.

Option 3: Ollama Local Models

Ollama runs open models on your own machine. No API keys, no rate limits, and no internet connection needed once the weights are downloaded.

In January 2026, Ollama added compatibility with the Anthropic Messages API in v0.14.0, which made this workflow practical. Before that, you needed a translation proxy in the middle. Now Claude Code talks directly to localhost.

The cost doesn't disappear; it shifts to hardware — specifically, to memory bandwidth, not just capacity. 

  • On Apple Silicon, unified memory is the number to watch: 16 GB runs a ~14B model like gpt-oss:20b, but the 30B-class coding models worth using want 32 GB or more once you add a 32K context window. 

  • On a Windows or Linux machine, the relevant figure is GPU VRAM, not system RAM — a model that fits in RAM but runs on CPU is too slow for agentic work, where every task fires dozens of calls.

Setting up Ollama with Claude Code

  1. Install Ollama. On macOS and Linux, that is curl -fsSL https://ollama.com/install.sh | sh, and on Windows, you download the installer from ollama.com and run it.

  2. Pull a coding model. Although it cannot compete with current Claude models, Qwen3-Coder is a decent choice: ollama pull qwen3-coder.

  3. Confirm the model is present with ollama list.

  4. Raise the context length, because this is the setting people forget and then blame the model for. Ollama suggests at least 32K tokens for Claude Code.

  5. Point Claude Code at the local endpoint and pick your model.

bash
export OLLAMA_CONTEXT_LENGTH=32768
export ANTHROPIC_AUTH_TOKEN=ollama
export ANTHROPIC_BASE_URL=http://localhost:11434

claude --model qwen3-coder

The auth token is required by the protocol and ignored by Ollama, so its value does not matter. If you would rather keep the configuration permanent, the same three keys go in the env block of ~/.claude/settings.json.

Two gaps are worth knowing before you judge the results:

  • Anthropic's prompt caching does not apply, so every request reprocesses the system prompt and the full conversation history from scratch, which is slow rather than expensive here.

  • Ollama's compatibility layer also ignores tool_choice, the field Claude Code occasionally uses to force a specific tool call, and when that matters, the agent can pick the wrong tool and get stuck in a loop.

For a deeper walkthrough of this setup, we have a dedicated tutorial on using Claude Code with Ollama local models, as well as separate guides for running Qwen 3 and DeepSeek R1 locally.

Hardware reality check

Unified memory / VRAM

What runs

Honest verdict

8 GB

7B models only

Struggles with multi-file reasoning. Fine for single-function questions, frustrating for anything agentic.

16 GB

7B-14B comfortably: gpt-oss:20b fits but tightens once you add a 32K context window

Workable for straightforward edits and explanations at 32K context.

24 GB

gpt-oss:20b with headroom; the 30B qwen3-coder at moderate context

The practical floor for agentic coding. A single 24 GB card (RTX 3090/4090) or a 24 GB Mac lands here.

32 GB+

30B-class coding models at the full 32K context

This is where local stops feeling like a compromise and starts competing with the free cloud options.

For most developers, OpenRouter beats Ollama unless you have 32 GB or more of unified memory/VRAM, need offline access, or want your code never to leave the machine. That last reason is a good one, and it is why I would not dismiss this route on performance alone.

Option 4: The Claude for Open Source Program

Most guides on this topic stop at three options and miss the one that gives you the actual product, at the highest tier, for half a year.

Anthropic launched Claude for Open Source in February 2026 and expanded it in July. Qualifying maintainers and contributors receive six months of Claude Max 20x, the $ 200-per-month plan, at no cost. That includes Claude Code, with usage headroom at the top consumer tier.

The published eligibility tracks are broader than most people assume:

  • Maintainers of packages with 500 or more dependent repositories, 100 or more dependent packages, or 200,000 or more combined monthly downloads across npm, PyPI, crates.io, RubyGems, or similar registries.
  • Listed committers on recognized foundation or language projects such as CPython, the Rust team, the Node.js TSC, an Apache PMC, CNCF, Kubernetes, the Linux kernel, Django, or Rails.
  • Anyone who has authored 100 or more merged pull requests into repositories they do not own in the last twelve months.
  • Community builders whose repository has drawn 20 or more unique external contributors with merged pull requests in the last year.
  • Maintainers of anything with an OpenSSF criticality score of 0.4 or above.

Anthropic's page explicitly invites borderline cases to apply anyway and explain what the ecosystem quietly depends on. The program is capped at 10,000 recipients and is reviewed on a rolling basis; applications go through claude.com/contact-sales/claude-for-oss.

One caveat: this covers the subscription, not API credits. Your ANTHROPIC_API_KEY usage still bills separately, so it is a personal plan rather than something to point a CI pipeline at.

Choosing the Right Free Option for You

Two questions settle this. What do you want Claude Code for, and how much setup are you willing to do before you get bored?

Comparison table

Option

Real Claude model?

Claude Code CLI

Limits

Best for

Setup effort

Claude.ai free tier (not Claude Code)

Yes (Sonnet 5)

No

~15 to 40 messages per 5 hours, dynamic

Occasional coding questions and code review

None

API free credits

Yes (any model)

Yes

One-time starter credit, around $5

Genuinely evaluating Claude Code

Low

OpenRouter free models

No (Qwen, Llama, GPT-OSS)

Yes

20 req/min, 50/day (1,000/day after a one-time $10 purchase)

Ongoing free use without local hardware

Medium

Ollama local models

No (local open models)

Yes

Hardware-bound, no rate limits

Offline work, privacy, no per-token cost

High

Claude for Open Source

Yes (Max 20x)

Yes

6 months, capped program, eligibility required

Qualifying OSS maintainers

Low, plus an application

Which should you pick?

  • If you have never used Claude Code and want to know whether it is worth $20 a month, take the API starter credits. It is the only route that shows you the actual product, and a dozen sessions are more than enough to form an opinion.
  • If you want ongoing free access and do not specifically need Claude, OpenRouter offers the best quality-to-effort ratio. Budget an evening for the first setup and expect to hit the daily request cap sooner than you would like.
  • If you need offline access, or your employer has opinions about where source code travels, Ollama is the answer, despite the hardware bill. Below 16 GB of unified memory/VRAM, I would not bother.
  • If you maintain anything that others build on, check the open-source grant before doing any of this. Six months at the top tier makes the whole question go away.

Troubleshooting the Redirect Setups

Options 3 and 4 share a failure surface, and the same handful of problems account for most of it. Since neither Anthropic nor the gateway providers can debug your particular combination, here is what to check first.

  • Claude Code keeps asking you to log in. The CLI has no credentials of its own, and a reachable base URL does not count as one. An env block in a project's .claude/settings.json only applies after the first-run wizard, so set ANTHROPIC_AUTH_TOKEN somewhere read earlier: a shell export or ~/.claude/settings.json.

  • A startup warning names two credential sources. A gateway credential and a saved login are both active. Run /logout to clear the saved login, or unset the variable to revert to the previous login.

  • 400 errors mentioning unrecognized fields. Claude Code sends fields to Anthropic-format endpoints that some upstreams reject. Setting CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 suppresses most pre-release fields and clarifies this.

  • 400 errors mentioning thinking or adaptive. The upstream model does not accept adaptive reasoning, which Claude Code requests for recent Claude models. This one usually requires updating the gateway's upstream rather than a client-side fix.

  • Remote control and voice dictation stop working. Both rely on a claude.ai identity and are unavailable while a gateway credential is set. Since v2.1.196, remote control is also disabled whenever ANTHROPIC_BASE_URL points at a non-Anthropic host.

When something is misbehaving, and you are not sure which layer is causing it, /status inside the session tells you which base URL and credential source are actually in play. That single command resolves more of these than any amount of re-exporting.

Final Thoughts

Four routes to using Claude Code for free, none of them perfect, and the trade-offs are the interesting part, rather than an afterthought.

My own recommendation is narrow. If what you want is the Claude Code CLI agent rather than a chat window, start with the API credits, because you learn more from one real session on the actual product than from an evening of configuring a substitute. If it earns a place in your workflow, $20 a month is a defensible line item. If it does not, you have lost nothing, and you now know why.

For the long game, OpenRouter is the most sustainable free option, and Ollama wins the moment privacy or offline access is non-negotiable rather than a nice-to-have.

For the habits that separate a useful session from a frustrating one, our Claude Code Best Practices covers planning, context transfer, and test-driven development on real projects. And if you're starting from scratch, Claude Code 101 teaches the fundamentals through interactive, structured lessons that take you from first install to a working workflow.

FAQs About Free Claude Code Access

Is Claude Code free?

No. Claude Code needs a paid Claude subscription (Pro, Max, Team, or Enterprise) or a Console account billed per token. What exists instead are a few legitimate free routes, and each gives up something.

Can I use Claude Code on the free Claude plan?

No. The free plan covers the chat interface on web, mobile, and desktop, but Anthropic's own setup documentation states plainly that it does not include access to Claude Code. The terminal agent sits behind the paywall.

How far do the free API credits actually go?

Anthropic grants new Console accounts a small starter credit, widely reported to be around $5, although Anthropic does not publish the figure. At Sonnet 5 rates, with prompt caching doing its job, a focused session on a real repository comes out to about 30 or 40 cents. That works out to roughly a dozen sessions, which is enough to judge whether the tool suits your workflow.

Does Claude Code work with OpenRouter's free models?

Technically, yes, since OpenRouter exposes an endpoint that speaks the Anthropic Messages format. OpenRouter itself warns that Claude Code is only guaranteed to work when requests are routed to Anthropic's own models, so a free Qwen or Llama backend is a best-effort arrangement rather than a supported one.

What do I need to run Claude Code against Ollama?

Ollama v0.14.0 or later, as that release added compatibility with the Anthropic Messages API. You also want a model with at least 32K context and enough RAM to hold it, which in practice means 16 GB as a floor and 32 GB before the results stop feeling like a compromise. Two environment variables handle the rest of the wiring.


Josep Ferrer's photo
Author
Josep Ferrer
LinkedIn
Twitter

Josep is a freelance Data Scientist specializing in European projects, with expertise in data storage, processing, advanced analytics, and impactful data storytelling. 

As an educator, he teaches Big Data in the Master’s program at the University of Navarra and shares insights through articles on platforms like Medium, KDNuggets, and DataCamp. Josep also writes about Data and Tech in his newsletter Databites (databites.tech). 

He holds a BS in Engineering Physics from the Polytechnic University of Catalonia and an MS in Intelligent Interactive Systems from Pompeu Fabra University.

Onderwerpen

Learn Agentic Coding with DataCamp!

Cursus

Softwareontwikkeling met Cursor

1 Hr 30 Min
3.8K
Maak code die klaar is voor productie met Cursor. Leer over AI-prompts, refactoring, testen en geavanceerde workflows.
Bekijk detailsRight Arrow
Begin Met De Cursus
Meer zienRight Arrow
Gerelateerd

blog

Claude Code Alternatives: 7 Tools Compared for 2026

From free, open-source agents like OpenCode, Aider, and Cline to visual IDEs like Cursor, here are seven Claude Code alternatives and who each one is for.
Tom Farnschläder's photo

Tom Farnschläder

15 min

Tutorial

The Complete Guide to the Claude API: Setup, Cost Management, and Building Your First Project

Learn how to transition from subscription-based access to the Claude API to ensure uninterrupted use of Claude for your autonomous coding projects.
François Aubry's photo

François Aubry

Tutorial

Claude Code Channels With Discord: Step-by-Step Setup Guide

Learn how to use Claude Code Channels to connect to Discord. Create a bot, pair your account, manage permissions, and turn chat into a live AI workflow hub.
Abid Ali Awan's photo

Abid Ali Awan

Tutorial

Claude Code CLI: Command-Line AI Coding for Real Developer Workflows

Claude Code CLI allows developers to integrate AI-powered coding assistance into everyday terminal workflows. This guide walks through installation, authentication, core commands, and real-world workflows for analyzing and improving codebases.
Vikash Singh's photo

Vikash Singh

Tutorial

Claude Code in VS Code: How to Use the Extension

Learn how to install and use the Claude Code VS Code extension, what it can do across your codebase, and how it compares to working from the terminal.
Khalid Abdelaty's photo

Khalid Abdelaty

Tutorial

Claude Code Usage Limits Explained: How They Work and How to Avoid Hitting Them

Learn how Claude Code usage limits actually work, what silently consumes your quota, and the practical steps you can take to extend your available capacity before upgrading your plan.
Tim Lu's photo

Tim Lu

Meer ZienMeer Zien