Last updated · Santosh Kumar Radha

Claude Code alternatives (2026): how to choose

Open-source, free, local-model and Gemini alternatives to Claude Code in 2026: CodeAF, OpenCode, Codex CLI, Aider, Cline, OpenHands and more.

The right Claude Code alternative depends on why you are leaving: CodeAF is an open-source terminal coding agent by AgentField that runs any model and many tasks at once, each on its own branch, and the other main options are OpenCode, Codex CLI, Aider, Cline, OpenHands, Kilo Code, mini-swe-agent and Google's Gemini CLI or its successor, Antigravity CLI. Most people searching want one of four things: open source, free, local models, or a model other than Claude.

We make CodeAF, so this page does not rank. It gives the facts for each tool from its own pages, checked 2026-11-21, a "choose X when" line for every option, and the places where Claude Code is still the stronger pick.

At a glance

ToolLicenceWhere it runsModelsLocal models
Claude CodeProprietary (LICENSE.md)CLI, desktop, IDEs, webClaude only (LLM gateway)Not supported for non-Claude models
CodeAFApache 2.0 (repo)Terminal, one Go binaryOpenRouter, DeepSeek, GLM, Kimi, MiniMax, Qwen, Codex plan, any OpenAI-compatible endpoint (FAQ)Ollama with no key, llama.cpp, LM Studio
OpenCodeMIT (repo)Terminal, desktop app (beta)models.dev catalog, OpenRouter (providers)Discovers Ollama, LM Studio, vLLM
Codex CLIApache 2.0 (repo)Terminal, IDE, desktopOpenAI, custom providers (config)--oss with Ollama or LM Studio
AiderApache 2.0 (repo)TerminalMany providers, Gemini included (models)Ollama, OpenAI-compatible
ClineApache 2.0 (repo)VS Code, JetBrains, CLIAnthropic, OpenAI, Gemini, OpenRouter, OpenAI-compatibleOllama, LM Studio
OpenHandsMIT (repo)Web UI, CLI, SDK"Use with any LLM"Not checked
Kilo CodeMIT (repo)VS Code, JetBrains, CLIBYOK, "500+ models" (kilo.ai)"Local models supported"
mini-swe-agentMIT (repo)CLI, Pythonlitellm, OpenRouter, PortkeyThrough litellm
Gemini CLIApache 2.0 (repo)TerminalGemini; "Enterprise Code Assist only"Not documented

What is the best open-source alternative to Claude Code?

CodeAF, OpenCode, Codex CLI, Aider, Cline, OpenHands, Kilo Code and mini-swe-agent are all open source, under Apache 2.0 or MIT, while Claude Code's own licence reads "All rights reserved". Which one fits depends on how you want to work, not on the licence.

  • OpenCode is "the open source AI coding agent": one session with a build agent and a read-only plan agent, the widest provider catalog, and a desktop app. Side by side: CodeAF vs OpenCode.
  • Codex CLI is OpenAI's open-source agent, which "runs locally on your computer" and signs in with a ChatGPT plan or an API key.
  • Aider is "AI pair programming in your terminal": you steer each edit and every change lands as a git commit.
  • CodeAF is organised around many tasks at once. Work you hand off becomes a task in its own copy of your folder, on its own branch, with a crew of three seats (worker, planner, checker), each of which can be a different model (README). It is an early preview.

Is there a free alternative to Claude Code?

Every open-source option on this page is free software, so the bill is whatever your model provider charges, and a local model costs nothing. Claude Code needs a paid Claude plan or a Console account (setup).

Free in practice means one of three things. First, a local model through Ollama or LM Studio: CodeAF, OpenCode, Codex CLI, Aider and Cline all document one. Second, free hosted models: Aider's docs note that "OpenRouter offers free access to many models", with daily limits. Third, a plan you already pay for: Codex CLI uses your ChatGPT plan, and CodeAF can seat that same plan with codeaf connect codex (attach a plan). Cline also sells its own usage billing and a $9.99 a month ClinePass beside bring-your-own-key (Cline docs), and Kilo Code says you "pay the model provider's rate with zero markup".

CodeAF prices every call before it runs and holds each task to $5 and each day to a $500 backstop unless you change them (budgets).

Which Claude Code alternative works with local LLMs?

CodeAF, OpenCode, Codex CLI, Aider and Cline all document local models through Ollama or an OpenAI-compatible server; Claude Code is built for Claude and Anthropic says it does not support non-Claude models through any gateway. Hardware sets the ceiling: a coding agent needs a model with a long context window and reliable tool calls.

CodeAF connects Ollama with no key and reaches llama.cpp or LM Studio as OpenAI-compatible endpoints (FAQ). Its senior-dev refuses a model known to hold 32,768 tokens or fewer before the first call (senior-dev). OpenCode probes http://127.0.0.1:11434 and discovers Ollama models, with built-in discovery for LM Studio and vLLM (providers). Codex CLI runs local models with --oss, Aider with Ollama, and Cline lists "Ollama / LM Studio" for local models. If you want to keep Claude Code and point it at a local model anyway, our guide to running Claude Code with Ollama, DeepSeek or OpenRouter shows the documented routes and their limits.

Is there a Claude Code alternative for Gemini?

Google's own terminal agent changed on June 18, 2026: Gemini CLI's README now says "Enterprise Code Assist only" and "No free tier or Google AI plans", and free and Google AI Pro or Ultra users moved to Antigravity CLI (agy). Gemini CLI is still Apache 2.0 for Code Assist Standard and Enterprise customers and paid API keys.

Antigravity CLI is "the terminal-first surface to interact with Antigravity agents" (product page). Its page states no licence or price, so we do not compare it here. If you want Gemini models in a model-agnostic agent instead, Cline lists the Google Gemini series, Aider documents Gemini models, Kilo Code lists Gemini, and CodeAF reaches Gemini through OpenRouter.

Is there a Claude Code alternative that works with any model through a proxy?

A model proxy such as LiteLLM or OpenRouter lets Claude Code send requests elsewhere, but Anthropic's docs say it "doesn't support routing Claude Code to non-Claude models through any gateway", and OpenRouter says Claude Code "is only guaranteed to work with the Anthropic first-party provider". An agent built for many models skips that layer.

CodeAF, OpenCode, Aider, Cline, Kilo Code and mini-swe-agent take a provider directly. mini-swe-agent "supports all models via litellm, openrouter, portkey, and more", and CodeAF takes any OpenAI-compatible endpoint. For the full setup on the CodeAF side, see a coding agent for any model.

How do they compare on the same model?

In AgentField's DeepSWE comparison, ten harnesses ran the full 113-task set on one model, deepseek/deepseek-v4-flash-0731 through OpenRouter, with the official verifiers and 3 hours per task. Claude Code and Codex CLI were driving DeepSeek V4 Flash there, not Claude or GPT, so these rows measure the harness on that model.

Harness (version tested)Solved of 113Cost per solved issue
CodeAF senior-dev (v0.5.0)62, 54.9%39.9 cents (1x)
mini-swe-agent (2.4.6)56, 49.6%1.9x
Codex CLI (0.154.0)51, 45.1%2.1x
OpenCode (1.18.30)30, 26.5%4.8x
Kilo Code (7.6.2)30, 26.5%4.6x
Claude Code (2.1.267)16, 14.2%3.4x

Aider, Cline, OpenHands and Gemini CLI were not in the comparison. Task by task, see head to head.

Where is Claude Code stronger?

Claude Code is the stronger choice if you want Claude models with a first-party tool and a Claude plan you already pay for. It is older and more mature than CodeAF (v2.1.330 was its latest release on 2026-11-21), and it reaches more places: a desktop app, VS Code and JetBrains, the web, mobile, Slack and Chrome (platforms).

Its extension surface is richer too, with MCP servers, hooks and plugins, and its permission modes and OS sandbox are documented in detail (permission modes). CodeAF has no IDE extension and no Claude plan sign-in. If your team reviews changes in an editor or enforces policy with hooks, Claude Code fits better today (CodeAF vs Claude Code).

How to choose

Choosing a Claude Code alternative starts with the reason you are leaving: licence, cost, local models, Gemini, or a model per task. Each option below fits one of those reasons best.

  • Choose CodeAF when you want an Apache 2.0 terminal agent that runs open-weight, local or hosted models, a different model per seat, spend limits per task and per day, and many handed-off tasks running on their own branches from one window.
  • Choose OpenCode when you want one open agent session with the widest provider catalog, automatic local-model discovery and a desktop app.
  • Choose Codex CLI when you already pay for ChatGPT and want OpenAI's open-source agent on that plan (CodeAF vs Codex CLI).
  • Choose Aider when you want to read and approve every edit, with each change as a git commit.
  • Choose Cline or Kilo Code when you want the agent inside VS Code or JetBrains, with bring-your-own-key and local models.
  • Choose OpenHands when you want a self-hosted "developer control center for coding agents and automations" with a web UI, a CLI and an SDK (CodeAF vs OpenHands).
  • Choose mini-swe-agent when you want a minimal agent, "some 100 lines of python" for the agent class, to read, script or research with.
  • Choose Antigravity CLI or Gemini CLI when you are on Google's plans: Antigravity CLI for free and Google AI plans, Gemini CLI for Code Assist Enterprise.
  • Stay on Claude Code when you want Claude, its IDE and app surfaces, and its hooks and plugins.

Questions people ask

What is the best open-source alternative to Claude Code?

There is no single best one; it depends on how you work. CodeAF is an Apache 2.0 terminal agent that runs any model and many tasks at once, OpenCode is a widely used MIT agent with the broadest provider list, Codex CLI is OpenAI's Apache 2.0 agent, and Aider is a terminal pair programmer. In AgentField's DeepSWE comparison on DeepSeek V4 Flash, CodeAF solved 62 of 113 tasks, the most of ten harnesses.

Is there a free Claude Code alternative?

Yes. CodeAF, OpenCode, Aider, Cline, Kilo Code and mini-swe-agent are free software: you pay your model provider, or nothing with a local model through Ollama. Codex CLI is also free software and uses a ChatGPT plan or an API key.

Can I use Claude Code with a local LLM?

Anthropic's docs say Claude Code does not support routing to non-Claude models through any gateway, although Ollama documents an ollama launch claude route. For a tool built for local models, CodeAF, OpenCode, Codex CLI, Aider and Cline all document Ollama support.

What replaced Gemini CLI for free users?

Antigravity CLI. Since June 18, 2026, Gemini CLI's README says it is "Enterprise Code Assist only", and free and Google AI Pro or Ultra access moved to Antigravity CLI, whose command is agy.

Is CodeAF better than Claude Code?

On DeepSeek V4 Flash, in AgentField's DeepSWE comparison, CodeAF solved 62 of 113 tasks and Claude Code 2.1.267 solved 16. Both ran DeepSeek V4 Flash, not Claude, so this measures the harness on that model. With Claude models and Anthropic's surfaces, Claude Code is the more mature product.

Sources

Last updated 2026-11-21.