Free Claude Code alternative: open-source OpenCode, or Claude Code on a local LLM
Home › Guides · Last checked 2026-11-20 · Facts verified from each project's docs unless marked tested
The closest free alternative to Claude Code is OpenCode, an open-source (MIT) coding agent with a terminal app, a desktop app for Mac, Windows and Linux and a new phone app. It ships a rotating set of free models you can use with no account, connects to 200+ providers and finds local models in Ollama or LM Studio on its own. Claude Code itself is not on Claude's free plan: it starts with Claude Pro at $17 a month billed yearly or $20 monthly (checked 2026-11-20). If you like Claude Code's workflow, Ollama's docs also show how to point Claude Code at a local model with one command. The catch: local models need real hardware and a 64k context window, and OpenCode's free models are limited-time offers whose privacy terms differ model by model.
| Claude Code | OpenCode | |
|---|---|---|
| Cost | Needs Claude Pro $17/mo yearly or $20 monthly, or Max $100 / Ultra $200 (Claude pricing page) | $0, MIT; limited-time free models; optional Go plan from $10/mo (opencode.ai home and FAQ) |
| License | Closed source | MIT, open source |
| Models | Claude models, or a local model through Ollama's Anthropic-compatible API ({N20_OLC}) | Free models, 200+ providers, or local via Ollama, LM Studio or vLLM |
| Use existing subscriptions | Claude plan | GitHub Copilot, ChatGPT Plus/Pro |
| Where it runs | Terminal, IDE and desktop apps | Terminal, desktop app, web, phone app, SDK |
| Usage cap | Plan limits every 5 hours and weekly | Your provider's limits or your hardware |
| Privacy | Anthropic's terms | Varies by free model; local models stay on your machine |
Option 1: OpenCode, free in 5 steps
- Install it:
curl -fsSL https://opencode.ai/v2/install | bashon Mac or Linux, ornpm install -g @opencode/cli(OpenCode 2 docs). On Windows, use the desktop app or the standalone binary. - For $0 with no account, start with a built-in free model. For fully local, install Ollama and run
ollama pull qwen3:8b; OpenCode finds it at 127.0.0.1:11434 with no setup (OpenCode 2 providers docs). - Open your project with
cd /path/to/projectand runopencode. - Type
/connectto add a provider key if you want a paid model, and/initso it writes an AGENTS.md describing your project (OpenCode docs: intro). - Press Tab for the read-only plan agent, ask it to explain the code, then switch back to build when you want edits.
Option 2: Claude Code on a local model
If you already know Claude Code and only want to stop paying per month, Ollama can stand in for Anthropic's servers (Ollama docs: Claude Code). Install Claude Code (curl -fsSL https://claude.ai/install.sh | bash on Mac, Linux or WSL, per the Claude Code setup docs), install Ollama, then run ollama launch claude and pick a model. Set the model's context to 64k or more first (Ollama docs: context length), or long sessions will lose track of your files. Ollama lists hosted web search and advanced tool controls as not fully supported, and a small local model will feel much weaker than Claude. We haven't tested this setup.
Check your GPU first
Local coding agents are only as good as the model your machine can hold with a 64k context. Our sister site Will It Run? estimates which models fit your GPU or Mac before you download gigabytes. It's an LLM fit checker, not a coding benchmark.
The catches
- Free models are temporary: OpenCode's free models rotate and are free for a limited time.
- Privacy varies: some free-model providers retain data and may train on it, so use a local model or your own key for private code.
- Local needs memory: coding agents want a 64k context, which costs VRAM on top of the model itself.
- No Claude plan sign-in in OpenCode: using Claude models there means an API key billed per use.
- Fast-moving: OpenCode shipped v2.3.0 to v2.3.2 between November 13 and 17, 2026, and version 1 and 2 install under different commands.
When Claude Code is still worth paying for
The trade is model quality against cost and control. If you already pay for Claude Pro for chat, Claude Code is included and draws from the same plan with no API bills, and you get Claude's top models at full strength. OpenCode wins when you want to switch models freely, reuse a Copilot or ChatGPT plan you already have or code with a local model at $0, at the price of weaker models and more setup.
Related: Aider vs Cline · Free Devin alternative (OpenHands) · Free GitHub Copilot alternatives · Free Cursor alternative · Ollama vs LM Studio · Free Claude alternative · All free coding tools
Sources: OpenCode README and GitHub license (MIT), OpenCode releases (v2.3.2, November 17, 2026), opencode.ai home and FAQ (free models, 200+ providers, apps, Go plan), OpenCode free models and privacy notes (per-model retention, OPENCODE_DISABLE_FREE_MODELS), OpenCode 2 docs (install, Windows), OpenCode 2 providers docs (Ollama and LM Studio discovery), OpenCode docs: intro (/init), Claude pricing page (plans; Claude Code not on Free), Claude Code setup docs (account requirement, install, 4 GB RAM minimum), Ollama docs: Claude Code (ollama launch claude, manual variables, limits), Ollama docs: context length (64k context, VRAM defaults), Ollama releases (v0.40.17, November 19, 2026) (all checked 2026-11-20). We have no affiliate link with any of them.
FAQ
Is Claude Code free?
No. Claude's pricing page (checked 2026-11-20) marks Claude Code as not included in the Free plan. It comes with Pro at $17 a month billed yearly ($200 up front) or $20 monthly, Max at $100 a month and Ultra at $200 a month. Anthropic's setup docs say Claude Code needs a Pro, Max, Ultra, Team, Enterprise or Console account, or a third-party API provider.
Can I run Claude Code with a local LLM?
Ollama's docs say yes: Ollama exposes an Anthropic-compatible API, and the command ollama launch claude sets Claude Code up against a local or Ollama cloud model. The manual route sets ANTHROPIC_BASE_URL=http://localhost:11434, ANTHROPIC_AUTH_TOKEN=ollama and an empty ANTHROPIC_API_KEY, then runs claude --model with a local model name. Ollama says basic chat and file edits work with compatible models, while hosted web search and advanced tool controls aren't fully supported. We haven't tested it. Claude Code itself stays closed source.
Is OpenCode really free?
The code is MIT-licensed and the app costs nothing. OpenCode's home page (checked 2026-11-20) says you can start with its free models and no account. Those free models are limited-time offers. You pay only if you connect a paid provider or choose OpenCode Go, an optional plan for hosted coding models from $10 a month.
Do OpenCode's free models keep my code private?
It depends on the model. OpenCode's free-models notes (checked 2026-11-20) list some providers with zero retention and no training, one that keeps data for 30 days for safety and at least one that retains your data and may use it for training. For private code, use a local model or your own provider key, and set OPENCODE_DISABLE_FREE_MODELS=1 to hide the free models.
What hardware do I need for a local coding model?
More than a chat model needs. Ollama's docs say coding tools want a context window of at least 64,000 tokens, but Ollama defaults to 4k on GPUs under 24 GB of VRAM and 32k on 24 to 48 GB cards. A bigger context uses more memory, so check what fits on your GPU or Mac before you download a model.
Does OpenCode work on Windows?
Yes. There's a Windows desktop app (x64 and ARM64) and standalone CLI binaries. The OpenCode 2 docs say Windows package managers aren't supported, so download the binary or use npm.
Can OpenCode just look at my code without changing it?
Yes. Press Tab to switch to its plan agent, which is read-only: it denies file edits by default and asks before running shell commands. The default build agent has full access.