BFWR AI Tools
Local vs cloud

Ollama vs Claude

Ollama runs open models on your own hardware. Claude is Anthropic's hosted model family. Since Ollama v0.14.0 they also connect: Claude Code can run against a local model through Ollama's Anthropic-compatible API.

The short answer

These are different kinds of thing. Claude is a family of hosted models from Anthropic: you cannot download it, and you pay per token. Ollama is a runner for open-weight models on your own machine: free, private, and limited by your memory. The useful comparison is Claude against the best open model your hardware can hold, and on hard reasoning and long agentic coding sessions Claude is ahead. Since Ollama v0.14.0 (January 2026) the two also connect. Ollama speaks Anthropic's Messages API, so Claude Code, Anthropic's coding agent, can use a local model in place of Claude.

Ollama

Open models on your own hardware. Free after the hardware, private, works offline, limited by your VRAM.

Claude

Anthropic's hosted models. More capable, charged per token, and your prompts go to Anthropic.

Ollama vs Claude at a glance

FactorOllamaClaude
What it isA runner that downloads and serves open-weight modelsA family of hosted models, used through Anthropic's apps and API
Where inference runsOn your machineOn Anthropic's infrastructure, or a cloud provider that hosts Claude
CostHardware up front, then electricityPer input and output token — current rates in the table below
Your dataStays on the machineSent to Anthropic under its terms
Works offlineYes, once a model is downloadedNo
ModelsOllama also lists ':cloud' models, which run on Ollama's servers rather than locally.Any open model in the Ollama library, or a GGUF you importClaude models only
APIIts own API, plus OpenAI- and Anthropic-compatible endpointsThe Anthropic Messages API

Claude's API rates, and the local option we pair with each

Claude modelInput / 1M tokensOutput / 1M tokensContextLocal pairing (est. speed)
Claude Fable 5.1$10.00$50.001Mgpt-oss-120b (MXFP4) on Apple Mac Studio (M5 Max, 128GB, 2026), ~148 t/s
Claude Opus 5.5$4.00$20.001Mgpt-oss-120b (MXFP4) on Apple Mac Studio (M5 Max, 128GB, 2026), ~148 t/s
Claude Sonnet 5.5$2.00$10.001MQwen3.6 35B-A3B (Q4_K_M) on Apple Mac mini (M5 Pro, 48GB, 2026), ~91 t/s
Claude Haiku 5.5$0.10$0.501Mgpt-oss-20b (MXFP4) on Desktop with NVIDIA RTX 5060 Ti (16GB), ~132 t/s

Prices from Anthropic's pricing page as recorded in the API pricing tool's data; they change, so check before relying on them. The local pairings are the ones that tool uses, not an equivalence in quality. Speeds are estimates from memory bandwidth, not measurements.

Running Claude Code on a local model

Ollama v0.14.0, announced on 16 January 2026, added compatibility with Anthropic's Messages API at /v1/messages. Tools built for Claude can send requests to Ollama instead, and Ollama answers them with an open model running on your GPU.

For Claude Code you set two environment variables, ANTHROPIC_AUTH_TOKEN=ollama and ANTHROPIC_BASE_URL=http://localhost:11434, then start it with a local model name, for example claude --model gpt-oss:20b. Ollama's announcement suggests gpt-oss:20b or qwen3-coder for local use. It recommends a context length of at least 32K tokens, which you have to set yourself for local models.

The compatibility layer is not complete. Ollama documents support for messages, streaming, system prompts, images, tool calling and basic extended thinking. It does not support prompt caching, the Batches API, citations, PDF document blocks, the token-counting endpoint, tool_choice, or URL-based images. Thinking budgets are accepted but not enforced. A workflow that depends on any of those will behave differently on a local model.

Where the capability gap shows

Claude's frontier models are larger than anything that fits in consumer memory. The gap shows on exactly the work Claude Code is built for: planning across a large codebase, long chains of tool calls, and recovering after a step goes wrong. A local model driving the same agent will take more wrong turns and give up sooner.

The gap is much smaller on shorter, well-defined jobs such as explaining a function, writing a test, drafting a script or summarising a file. That is also where running locally has the most going for it. The code never leaves the machine, nothing is metered, and an agent can make as many attempts as it needs.

A practical split is to use a local model for the routine and private work and Claude for the hard cases. Because Ollama exposes an Anthropic-compatible endpoint, switching between the two is a base URL and a model name, not a code change.

Cost and privacy, honestly

Claude charges per input and output token, and agentic coding uses a lot of both, because the agent re-reads files and tool output on every turn. At that volume the meter adds up quickly. Ollama's marginal cost is the electricity, once you have bought hardware that holds a capable model.

Privacy is the cleaner argument. With a local model, prompts and code never reach a third party. With Claude, they go to Anthropic under its data terms. Some code and documents cannot be sent anywhere, and for that work the choice is made before capability comes into it.

One detail catches people out. Ollama's library includes ':cloud' models, and those run on Ollama's servers, not on your GPU. If privacy is the reason you chose Ollama, check that the model name has no ':cloud' suffix.

Choose Ollama when

  • The code or documents cannot leave your machine
  • You run a lot of routine agent or chat work and want a fixed cost
  • You need it to work offline
  • You have 16GB or more of VRAM for a capable open model

Choose Claude when

  • The task is a long, multi-step agentic job where capability decides the outcome
  • Your usage is occasional and a subscription or API bill is small
  • You need a very large context window or prompt caching
  • You do not want to own or maintain the hardware

Work it out for your own setup

Common questions

Can I run Claude in Ollama?
No. Anthropic has not released Claude's weights, so there is nothing to download. What you can run is Claude Code, Anthropic's coding agent, pointed at an open model served by Ollama. That works through Ollama's Anthropic-compatible API, available since v0.14.0.
Which local model should I use with Claude Code?
Ollama's announcement suggests gpt-oss:20b or qwen3-coder, with at least 32K tokens of context. The binding constraint is VRAM: the model and its context must both fit. The Ollama models page lists the memory each one needs at Q4 and Q8.
Is Ollama free?
Yes. Ollama is open source and free to run on your own hardware. The cost is the machine and its electricity. Its ':cloud' models are a separate, hosted service.
Is a local model as good as Claude?
Not on the hardest reasoning and long agentic coding. On short, well-defined tasks a good open model is close enough to be useful, and it stays private. Test on your own work rather than on a leaderboard.

Guides that go deeper

Longer reads on the concepts behind this comparison.