Polarison

Open-source Claude Code alternatives

The most-starred open-source alternatives to Claude Code are OpenCode (216k GitHub stars), Codex CLI (130k) and Pi (116k). They are free to install; instead of a subscription you pay your model provider per token. Regular use, about 1,500 agent steps a month, costs roughly $74 on Claude Sonnet 5.5 or $9.25 on DeepSeek V4.1 Flash, against $20 to $200 a month for Claude Code.

GitHub data updated October 18, 2026. Model prices from official pricing pages.

10 open-source alternatives compared

ProjectRuns inModelsLicenseGitHub starsLast commit
OpenCode
Anomaly
Terminal, Desktop app (beta), IDEAny provider
Local models
MIT216kOctober 18, 2026
Codex CLI
OpenAI
TerminalOpenAI modelsApache-2.0130kOctober 18, 2026
Pi
Earendil Works
Terminal, SDKAny providerMIT116kOctober 18, 2026
Gemini CLI
Google
TerminalGemini models onlyApache-2.0107kOctober 18, 2026
OpenHands
OpenHands
Self-hosted web app, DockerAny provider
Local models
MIT91.2kOctober 18, 2026
Cline
Cline
VS Code, JetBrains, Terminal, SDKAny provider
Local models
Apache-2.070.5kOctober 18, 2026
Goose
Agentic AI Foundation (Linux Foundation)
Desktop app, Terminal, APIAny provider
Local models
Apache-2.055.4kOctober 18, 2026
Aider
Aider AI
TerminalAny provider
Local models
Apache-2.049.6kMay 22, 2026
Qwen Code
Qwen (Alibaba)
TerminalAny provider
Local models
Apache-2.028.6kOctober 18, 2026
Kilo Code
Kilo Code
VS Code, JetBrains, TerminalAny providerMIT27.7kOctober 18, 2026

What it costs to run them on your own API key

Open-source agents are free; you pay the model provider for every token the agent reads and writes. Estimated monthly API fees:

Model on your API keyLight
300 steps/mo
Regular
1,500 steps/mo
Heavy
6,000 steps/mo
Claude Opus 5.5$28$140$562
Claude Sonnet 5.5$15$74$298
GPT-6.1 Sol$14$70$281
Gemini 3.8 Flash$5.58$28$112
DeepSeek V4.1 Flash$1.85$9.25$37
Claude Haiku 5.5$0.74$3.72$15

For comparison, Claude Code: Claude Pro $20/mo ($17/mo billed yearly); Claude Max 5x $100/mo; Claude Max 20x $200/mo.

Each agent step is assumed to send about 40,000 input tokens (70% read from the prompt cache) and return about 2,000 output tokens, as in our cost calculator’s coding-agent scenario. Light is about one short task a day, regular is several tasks every working day, heavy is agents running most of the day. Real usage varies with the size of your codebase and how each tool manages context, so treat these as orders of magnitude. A local model costs nothing per token but needs hardware that can run it.

Want a precise break-even for your own usage? Use the subscription vs API calculator.

The alternatives one by one

OpenCode

Anomaly · MIT · 216k stars

An open-source coding agent for the terminal, with a desktop app in beta. It ships a full-access build agent and a read-only plan agent that you switch between with the Tab key.

Models: Dozens of providers, including Anthropic, OpenAI, Google, xAI, OpenRouter and Amazon Bedrock, plus local models through Ollama, LM Studio or llama.cpp.

Runs in: Terminal, Desktop app (beta), IDE.

GitHub ↗Docs ↗OpenCode vs Claude Code

Codex CLI

OpenAI · Apache-2.0 · 130k stars

OpenAI’s open-source terminal coding agent. Sign in with ChatGPT to use it within your plan’s limits, or run it on an OpenAI API key.

Models: OpenAI models, through a ChatGPT plan or an OpenAI API key.

Runs in: Terminal.

The same agent is included in ChatGPT plans as OpenAI Codex.

GitHub ↗Docs ↗

Pi

Earendil Works · MIT · 116k stars

A minimal, extensible agent harness. It leaves out built-in sub-agents and plan mode in favour of extensions, skills and prompt templates you add yourself, and can be scripted over JSON or RPC.

Models: OpenAI, Anthropic, Google and other providers through one API, signed in with a subscription or an API key.

Runs in: Terminal, SDK.

GitHub ↗Docs ↗

Gemini CLI

Google · Apache-2.0 · 107k stars

Google’s open-source terminal agent for Gemini. Sign in with a Google account, or use a Gemini API key to pick the model and pay per token.

Models: Gemini models only, through a Google account or a Gemini API key.

Runs in: Terminal.

With a Gemini API key, Google’s free tier covers Flash models such as Gemini 3.8 Flash at lower rate limits; free-tier prompts may be used to improve Google’s products.

GitHub ↗Gemini CLI vs Claude Code

OpenHands

OpenHands · MIT · 91.2k stars

A self-hosted control center for coding agents and automations. Run agents on your machine, in Docker or on your own servers, and start tasks from its web interface.

Models: Any LLM you configure.

Runs in: Self-hosted web app, Docker.

GitHub ↗Docs ↗

Cline

Cline · Apache-2.0 · 70.5k stars

An autonomous coding agent that runs as a VS Code extension, a JetBrains plugin, a CLI or an SDK, and asks before it edits files or runs commands.

Models: Anthropic, OpenAI, Google, AWS Bedrock, OpenRouter, the Vercel AI Gateway, any OpenAI-compatible API, and local models through Ollama or LM Studio.

Runs in: VS Code, JetBrains, Terminal, SDK.

GitHub ↗Cline vs Claude Code

Goose

Agentic AI Foundation (Linux Foundation) · Apache-2.0 · 55.4k stars

A general-purpose AI agent for code and other work, with a desktop app, a CLI and an API, built in Rust. It is part of the Linux Foundation’s Agentic AI Foundation.

Models: 15+ providers, including Anthropic, OpenAI, Google, Ollama, OpenRouter, Azure and Bedrock.

Runs in: Desktop app, Terminal, API.

GitHub ↗Docs ↗

Aider

Aider AI · Apache-2.0 · 49.6k stars

AI pair programming in the terminal. Aider edits files in your git repository and commits each change with a descriptive message, so you can diff or undo it with normal git tools.

Models: Almost any LLM, including local models.

Runs in: Terminal.

No release since v0.86.0 in August 2025, so newer models and features may lag.

GitHub ↗Docs ↗Aider vs Claude Code

Qwen Code

Qwen (Alibaba) · Apache-2.0 · 28.6k stars

An open-source terminal coding agent from the Qwen team that can switch providers in the middle of a session.

Models: OpenAI, Anthropic, Gemini and Qwen APIs, any compatible provider, and local models through Ollama or vLLM.

Runs in: Terminal.

GitHub ↗

Kilo Code

Kilo Code · MIT · 27.7k stars

An open-source coding agent for VS Code, JetBrains IDEs and the terminal. Through a Kilo account you pick from 500+ models at the provider’s own rate with no markup, or you bring your own API keys.

Models: 500+ models through a Kilo account, or your own provider API keys.

Runs in: VS Code, JetBrains, Terminal.

GitHub ↗Docs ↗

Frequently asked questions

Is there a free alternative to Claude Code?
Yes. OpenCode, Codex CLI, Pi, Gemini CLI, OpenHands, Cline, Goose, Aider, Qwen Code and Kilo Code are free and open source. You still pay for the AI model per token, unless you run a local model or use a free tier (Gemini CLI). OpenCode, OpenHands, Cline, Goose, Aider and Qwen Code can run local models.
What is the most popular open-source alternative to Claude Code?
By GitHub stars, OpenCode (216,461 stars), followed by Codex CLI and Pi. Stars measure popularity, not quality, so try the two or three that fit how you work.
How much does it cost to run an open-source Claude Code alternative?
The tools are free; the model is not. At about 1,500 agent steps a month, API fees come to roughly $140 on Claude Opus 5.5, $74 on Claude Sonnet 5.5, $9.25 on DeepSeek V4.1 Flash and $3.72 on Claude Haiku 5.5. Claude Code costs $20 to $200 a month.
Can I use Claude or GPT models with these tools?
OpenCode, Pi, OpenHands, Cline, Goose, Aider, Qwen Code and Kilo Code work with several providers’ APIs, including Anthropic and OpenAI, so you can run Claude or GPT models on your own API key. Codex CLI runs OpenAI models; Gemini CLI runs Gemini models only.

Head to head: OpenCode vs Claude Code, Aider vs Claude Code, Cline vs Claude Code, Gemini CLI vs Claude Code.

Claude Code plans and prices: Claude Code pricing. More alternatives: Cursor, GitHub Copilot.