Skip to content
,

Can You Run Claude Locally? No, But Here Is How to Run Claude Code With a Local Model (2026)

9–13 minutes
Smiling woman in an orange blazer in a neon-lit PC build room holding a card with the Claude logo, with the hook Claude Code on your own GPU

“Can I run Claude locally?” is one of the most common questions from people who love Claude but want privacy, offline use or no monthly bill. The short answer is no: you cannot download Claude and run it on your own PC. But that is not the end of the story.

You can run the Claude Code tool on your PC and point it at a free local model, so you keep the same agent, commands and workflow without sending your code to the cloud. You can also run strong open models that feel close to Claude for many tasks.

This guide explains why Claude itself can’t run locally, what your real options are, how to set up Claude Code with a local model through Ollama step by step, which hardware you need and how to fix the common problems.

TL;DR

  • Claude the model: no. As of November 2026, Anthropic does not offer downloadable Claude weights. Claude runs only on Anthropic’s servers and cloud partners.
  • Claude Code the tool: yes. It runs on your PC and can talk to a local model through Ollama’s Anthropic-compatible API.
  • Easiest setup: install Ollama and Claude Code, then run ollama launch claude.
  • Manual setup: set ANTHROPIC_BASE_URL=http://localhost:11434, ANTHROPIC_AUTH_TOKEN=ollama, ANTHROPIC_API_KEY="" and run claude --model qwen3.5.
  • Important: set the Ollama context length to 64k or more, or the agent will forget things and fail on tool calls.

Why You Can’t Run Claude Locally

To run an AI model on your own computer you need its weights, the huge files that hold everything the model learned. Open models like Qwen, Gemma, Llama or DeepSeek publish their weights, so tools like Ollama can download and run them.

Anthropic keeps Claude’s weights private. Claude is only available through:

  • the Claude apps (web, desktop and mobile),
  • the Claude API,
  • cloud partners such as Amazon Bedrock, Google Cloud and Microsoft Foundry.

All of these run Claude on remote servers. Even the Claude desktop app is just a window to those servers. So any website or video that claims to offer a “Claude download” or “Claude GGUF” is either fake, a renamed open model or malware. Avoid them.

Even if the weights were public, frontier models like Claude are far too big for a normal PC. That is why the practical route is to keep the Claude tooling you like and swap in a model that does fit on your hardware.

Your Real Options Compared

Option Runs locally? Cost Quality vs Claude Best for
Claude apps or API No Free tier, paid plans or pay-per-token The real thing Best quality
Claude Code + local model via Ollama Yes (the model runs on your GPU) Free after hardware Lower, depends on model and GPU Private coding, offline work
Claude Code + Ollama cloud models Tool local, model in the cloud Ollama account Varies by model Big open models without a big GPU
Local chat app with an open model Yes Free Lower Private everyday chat

If you only want Claude cheaper rather than local, read our Claude plans comparison and Claude Code pricing guide first.

What You Need

  • Claude Code installed. See our Claude Code install guide, or use the one-line installers below.
  • Ollama installed and running. See how to install Ollama.
  • A GPU with enough VRAM for your chosen model plus a 64k context. In practice, 16 GB is a comfortable minimum for useful coding models, and 24 GB or more is better. Apple Silicon Macs with plenty of unified memory also work.
  • A model that supports tool calling, because Claude Code relies on tools to read files, edit code and run commands.

Method 1: ollama launch claude (Easiest)

Recent Ollama versions can start Claude Code for you, already wired up.

  1. Install or update Ollama from ollama.com.
  2. Install Claude Code if you have not yet:
    # macOS / Linux
    curl -fsSL https://claude.ai/install.sh | bash
    
    # Windows PowerShell
    irm https://claude.ai/install.ps1 | iex
  3. Open a terminal in your project folder.
  4. Run:
    ollama launch claude
  5. Pick a model from the selector. Choose a local model that supports tools, or a cloud model if your GPU is small.
  6. Start working. Ask Claude Code to explain the repo, fix a bug or write a test, just as you normally would.

For scripts, Docker or CI you can skip the selector:

ollama launch claude --model qwen3.5 --yes -- -p "how does this repository work?"

--yes skips prompts and pulls the model if needed (it requires --model). Everything after -- is passed to Claude Code, so -p runs it in headless mode. Our claude -p guide explains headless mode in detail.

Method 2: Manual Setup With Environment Variables

If you prefer to control it yourself, or use an older Ollama, point Claude Code at Ollama’s Anthropic-compatible endpoint.

  1. Pull a model:
    ollama pull qwen3.5
  2. Set the environment variables (macOS / Linux):
    export ANTHROPIC_AUTH_TOKEN=ollama
    export ANTHROPIC_API_KEY=""
    export ANTHROPIC_BASE_URL=http://localhost:11434

    Windows PowerShell:

    $env:ANTHROPIC_AUTH_TOKEN="ollama"
    $env:ANTHROPIC_API_KEY=""
    $env:ANTHROPIC_BASE_URL="http://localhost:11434"
  3. Run Claude Code with the model:
    claude --model qwen3.5
  4. Check the connection inside Claude Code with /status.

The token value ollama is required by the client but ignored by the local server. Note that Claude Code settings files can override shell variables, so if it still talks to Anthropic, check ~/.claude/settings.json and your project’s .claude/settings.json for an env block.

A one-line version that does not change your shell:

ANTHROPIC_AUTH_TOKEN=ollama ANTHROPIC_BASE_URL=http://localhost:11434 ANTHROPIC_API_KEY="" claude --model qwen3.5

Other routers and gateways can also sit between Claude Code and other models. Our Claude Code Router guide covers that approach.

Set the Context Length (Do Not Skip)

This is the number one reason local Claude Code setups fail. Ollama picks a default context length based on your VRAM:

Your VRAM Ollama default context
Under 24 GiB 4k tokens
24 to 48 GiB 32k tokens
48 GiB or more 256k tokens

Ollama’s own docs say coding tools and agents need at least 64,000 tokens. With 4k, Claude Code’s system prompt and tool definitions barely fit, so the model forgets instructions and tool calls break.

How to raise it:

  • Ollama app: open Settings and move the context length slider to 64k or higher.
  • Command line: start the server with
    OLLAMA_CONTEXT_LENGTH=64000 ollama serve

Then check with ollama ps. The CONTEXT column should show your new value, and PROCESSOR should ideally say 100% GPU. If part of the model spills to the CPU, it will be much slower; pick a smaller model or quant. Our Ollama guide covers memory tuning in more depth.

Which Local Models to Use

Pick a model that supports tools and fits your VRAM with a 64k context. Ollama’s search page has a tools filter that lists compatible models.

Your hardware What to try What to expect
8 to 12 GB VRAM Small tool-capable models, or Ollama cloud models Fine for explaining code and small edits; struggles with big multi-file changes
16 to 24 GB VRAM Mid-size coding models such as the Qwen and Gemma families in Ollama’s library Good for everyday tasks in small to medium projects
32 GB+ VRAM, or two GPUs Larger open coding models and higher-precision quants Closest to cloud quality you will get locally
Mac with 64 GB+ unified memory Larger models at moderate speed Good quality, slower than a desktop GPU

Ollama’s Claude Code docs use qwen3.5 as the local example, and models such as gemma4 are popular general picks. Model names change often, so check the tools filter on ollama.com for the newest tool-capable releases before you pull.

Not sure how much VRAM a model needs? Our guides to fixing CUDA out of memory errors and GGUF quants explain how quantisation trades quality for memory.

How Private Is It Really?

With ANTHROPIC_BASE_URL pointing at localhost, your prompts and code go to the model on your own machine, not to Anthropic.

Claude Code itself can still send some operational data. According to Anthropic’s data usage docs, it sends usage metrics (which never include your code, prompts or file paths) and error reports by default. You can turn these off:

export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
# or individually
export DISABLE_TELEMETRY=1
export DISABLE_ERROR_REPORTING=1

Two things still reach the internet: installing or updating Claude Code, and the WebFetch tool’s domain safety check, which runs whatever model you use. If you need a fully offline machine, avoid WebFetch and install Claude Code before you disconnect.

Also remember that if you pick an Ollama cloud model, your prompts go to Ollama’s servers instead.

What Works and What Doesn’t

Feature With a local model
Chat about your repository Works
Reading and editing files Works with tool-capable models
Running commands with permission prompts Works
Subagents Work, but each uses more memory and time
Images and screenshots Only with vision-capable models
Thinking controls Only with models that support thinking
Anthropic hosted web search Not fully supported; Ollama offers its own web search option
Advanced tool-choice controls and deferred tools Not fully supported by Ollama’s compatibility layer

Your CLAUDE.md files, skills and slash commands still load, because they belong to Claude Code, not the model. See our guides to CLAUDE.md and Claude Skills.

Be realistic about quality. A model that fits on one consumer GPU will not match Claude on hard, multi-file refactors. Use local models for private or routine work, and switch back to Claude for the hardest tasks.

Want a Local Chat App Instead?

If you do not code and just want a private, Claude-like chat window, skip Claude Code. Install Ollama and add a chat interface such as Open WebUI. Our Open WebUI + Ollama setup guide walks through it, and gives you a familiar chat interface running fully on your machine.

Troubleshooting

Problem Cause Fix
Claude Code still asks you to log in or uses your Claude plan Variables not set, or overridden by settings Set ANTHROPIC_AUTH_TOKEN and ANTHROPIC_BASE_URL, set ANTHROPIC_API_KEY="", check env blocks in settings.json, run /status
Connection refused on localhost:11434 Ollama not running Start the Ollama app or run ollama serve
Model “not found” Model not pulled or name typo Run ollama pull <model> and use the exact name from ollama list
Agent forgets instructions, tool calls fail Context too small (4k default) Set context length to 64k+ and confirm with ollama ps
Extremely slow responses Model spilling to CPU Check PROCESSOR in ollama ps; use a smaller model or quant, or lower context slightly
Model replies but never edits files Model lacks tool calling Choose a model from Ollama’s tools filter
Out of memory when raising context Context uses extra VRAM Use a smaller model, a lower quant, or an Ollama cloud model
Web search does not work Anthropic hosted search is not supported Set up Ollama’s web search capability instead

My Take

You can’t run Claude itself locally, and anyone selling a “Claude download” is not being honest. But running Claude Code against a good local model through Ollama gets you surprisingly far: the same agent, the same CLAUDE.md and skills, and your code never leaves your PC.

My setup advice is simple: use ollama launch claude, set context to 64k, confirm 100% GPU in ollama ps, and keep a real Claude plan for the jobs where quality matters most.

FAQ

Can I download Claude and run it offline?

No. Anthropic does not offer downloadable Claude weights. Claude runs only on Anthropic’s servers and its cloud partners.

Is there an open-source version of Claude?

No. Open models such as Qwen, Gemma, Llama and DeepSeek are different models from different companies. Some are strong at coding, but they are not Claude.

Does Claude Code work without the internet?

Mostly yes when pointed at a local Ollama model, after it is installed. Updates and the WebFetch safety check still need the internet.

Is Claude Code free with a local model?

Claude Code itself can be installed for free, and with a local model you pay nothing per token. You only pay for your hardware and electricity.

How much VRAM do I need to run Claude Code locally?

For useful coding, plan on 16 GB or more so the model and a 64k context fit on the GPU. Smaller GPUs work with small models or Ollama cloud models.

Which local model is closest to Claude?

The biggest tool-capable coding model that fits fully on your GPU. Check Ollama’s tools filter for the newest options, since rankings change monthly.

Is the Claude desktop app local?

No. The desktop app is an interface to Claude’s cloud servers, so it needs the internet.

Sources

Free weekly email

Get new AI guides every week

One short weekly email with our newest local AI, ComfyUI and AI tool guides. No spam, no pop-ups, just the good stuff.

Free. Unsubscribe anytime in one click. We only use your email to send this newsletter. See our privacy policy.

Smiling woman in an orange blazer in a neon-lit PC build room holding a card with the Claude logo, with the hook Claude Code on your own GPU