ai/courses

Vibe coding/Tool comparison

Claude Code Alternatives: 7 AI Coding Agents Compared

What each tool actually is, whether it's open source, which models it runs, how you pay for it, and when it beats Claude Code. Plus a dedicated Claude Code vs OpenCode breakdown.

Updated
Reading time
10 min
Checked against
18 sources
A lineup of five terminal windows, one highlighted

TL;DR

The Short Answer

There's no single best Claude Code alternative. It depends on why you're leaving:

  • You want open source and any model: OpenCode. The closest thing to Claude Code in feel: a terminal agent with plan and build modes, MIT-licensed, 75+ model providers.
  • You already pay for ChatGPT: OpenAI Codex CLI. Open-source CLI, included in ChatGPT plans.
  • You'd rather stay in an editor than a terminal: Cursor for an AI-first editor, or Cline if you want to keep VS Code and bring your own API key.
  • Your team lives on GitHub: GitHub Copilot. Agent mode in the editor, a CLI, and a cloud agent that opens pull requests.
  • You want something minimal and git-centric: Aider.
  • You're on Google: Gemini CLI now targets enterprise Code Assist customers. Individuals were moved to Antigravity CLI in June 2026.

Every fact below was checked on each tool's official site, docs, or GitHub repo on November 5, 2026. Prices change often, so treat the numbers as a snapshot and follow the pricing links.

InterfaceOpen sourceModelsBest for
Claude CodeTerminal, desktop app, VS Code and JetBrains, webNoClaude onlyAutonomous, repo-wide work if you already pay for Claude
OpenAI CodexCLI, IDE extension, desktop app, cloudCLI: yes (Apache-2.0)OpenAIChatGPT subscribers who want a terminal agent
CursorDesktop editor, CLI, cloud agentsNoAnthropic, OpenAI, Google, Grok, Cursor's ownPeople who want an AI-first editor
GitHub CopilotEditor extensions, CLI, cloud agent on GitHubNoClaude, GPT, GeminiTeams that live on GitHub
OpenCodeTerminal, desktop app, webYes (MIT)75+ providers, including localAn open-source, any-model terminal agent
ClineVS Code, JetBrains, CLI, desktop app, SDKYes (Apache-2.0)Any provider, including localBring-your-own-key agent with approval at every step
AiderTerminalYes (Apache-2.0)Almost any LLM, including localGit-first pair programming with your own API key
Gemini CLITerminalYes (Apache-2.0)GeminiCompanies on Gemini Code Assist (individuals: see Antigravity CLI)

What You're Replacing: Claude Code in One Paragraph

Claude Code is Anthropic's agentic coding tool. It reads your codebase, edits files, and runs commands, in a terminal, desktop app, IDE extension, or browser. It's not open source (the GitHub repo holds docs and issues under Anthropic's commercial terms), it runs only Claude models (through Anthropic or Amazon Bedrock, Google Cloud, and Microsoft Foundry), and it needs a paid Claude plan (Pro, Max, Ultra, Team, Enterprise) or API credits.

People usually switch for one of four reasons: other models, open source, an editor instead of a terminal, or an AI subscription they already pay for.

OpenAI Codex CLI

What it is: OpenAI's coding agent. The Codex CLI runs locally in your terminal. The same agent is available as an IDE extension (VS Code, Cursor, Windsurf), in the ChatGPT desktop app, and as Codex Cloud for tasks that run in the background at chatgpt.com/codex.

Open source: Yes for the CLI, Apache-2.0 (openai/codex).

Pricing: Codex is included in ChatGPT plans, from Free and Go up through Plus, Pro, Business, Edu, and Enterprise. Usage limits depend on the plan, and you can also pay per use with an API key. See Codex pricing.

Next to Claude Code: very similar. /init writes an AGENTS.md instructions file, /model sets model and reasoning effort, /permissions controls what runs without asking, codex exec runs non-interactively in scripts, and codex mcp manages MCP servers.

Pick it when: you already have ChatGPT Plus or Pro and want one subscription, or you prefer OpenAI's models for coding.

codex.sh
# macOS / Linux
curl -fsSL https://chatgpt.com/codex/install.sh | sh

# or with a package manager
npm install -g @openai/codex
brew install --cask codex

# Start in your project and choose "Sign in with ChatGPT"
cd /path/to/your/project
codex

Cursor

What it is: an AI-first code editor (Cursor Desktop) from Anysphere, plus a terminal agent (the Cursor CLI, started with the agent command) and cloud agents that work in the background. The CLI has Agent, Plan, and Ask modes, the same as the editor, and Shift+Tab toggles plan mode, much like Claude Code.

Open source: No.

Models: many providers in one place. The model list includes Anthropic, OpenAI, and Google models, Grok, and Cursor's own Composer models.

Pricing: Cursor's plans now come bundled with Grok and X features. There's a Free plan. The cheapest paid plan ($8/month) only includes Grok models. Claude, GPT, and Gemini ("third-party models") start on Premium ($30/month) and are billed separately at API list price. Check Cursor pricing before you commit.

Pick it when: you want to see and steer every diff in a full editor and switch models per task. Read the pricing page closely, because using Claude through Cursor is billed on top of the plan.

GitHub Copilot: Agent Mode, CLI, and Cloud Agent

What it is: GitHub's AI assistant, now in three agentic forms:

  • Agent mode in your editor, which edits across files and runs commands.
  • Copilot CLI, a terminal agent built on the same harness as the cloud agent. It ships with GitHub's MCP server and asks before every action.
  • Copilot cloud agent, which researches a repo, plans, and implements changes in a GitHub Actions runner or cloud sandbox, then opens a pull request (one branch and one PR per task).

Open source: No.

Models: Claude, GPT, and Gemini models are all listed on every plan.

Pricing: Free ($0) includes 2,000 completions a month and limited agent and CLI use, but no cloud agent. Pro is $10 per user/month and adds the cloud agent and code review, with Pro+ and Max tiers above it. Usage is metered in "GitHub AI Credits". See Copilot plans.

Pick it when: your code, issues, and reviews are already on GitHub, and you want agents that hand back pull requests.

copilot-cli.sh
# macOS / Linux
curl -fsSL https://gh.io/copilot-install | bash

# or
brew install copilot-cli
npm install -g @github/copilot
winget install GitHub.Copilot   # Windows

# Needs an active Copilot plan (Free works with limited usage)
copilot

OpenCode

What it is: "the open source AI coding agent", available as a terminal app (TUI, short for text user interface), a desktop app (beta), and a web interface you pair with opencode pair. It has two built-in agents you switch between with Tab: build (full access, the default) and plan (read-only: denies edits and asks before running shell commands). A general subagent handles multi-step searches; mention it with @general.

Open source: Yes, MIT (anomalyco/opencode, formerly sst/opencode).

Models: 75+ providers through Models.dev, including local models. You connect them inside the app with /connect and pick one with /models. You can sign in with a ChatGPT Plus or Pro plan or a GitHub Copilot subscription instead of an API key.

Pricing: the tool is free. It includes some free models, and there's an optional OpenCode Go subscription ($10/month) for coding models the team has tested. Otherwise you pay your model provider.

Pick it when: you like how Claude Code works but want the freedom to change models, to use a subscription you already have, or to read and modify the source.

Claude Code vs OpenCode

The two are close in workflow, so the differences matter:

  • Source code. OpenCode is MIT-licensed, so you can read it, fork it, and self-host it. Claude Code is proprietary.
  • Models. Claude Code runs Claude only, and Anthropic tunes the agent for its own models. OpenCode runs anything, including Claude.
  • Using a Claude subscription. Anthropic's terms say Claude.ai subscription login is for Claude Code and Anthropic's own apps, and third-party tools may not offer it. To use Claude models in OpenCode, you connect an Anthropic API key (pay per token) or go through another provider such as OpenRouter or Copilot. If your main model is Claude and you're on a Pro or Max plan, Claude Code is usually the cheaper way to use it.
  • Plan mode. Both have one. Claude Code's plan mode ends with an approval step and can hand off to auto mode. OpenCode's is a separate read-only plan agent you Tab into.
  • Permissions. Claude Code has permission modes (including a classifier-reviewed auto mode) plus allow, ask, and deny rules. OpenCode uses an ordered list of allow, ask, and deny rules in opencode.json, where the last matching rule wins and anything unmatched asks.
  • Instructions and skills. OpenCode reads AGENTS.md. Version 2 does not fall back to CLAUDE.md. It does pick up skills from .claude/skills and ~/.claude/skills, so your Claude Code skills carry over.
  • Extras. Claude Code has more built-in automation: hooks, subagent files, /goal, /loop, cloud sessions, and GitHub Actions. OpenCode has plugins, MCP, and a desktop and web client.

Verdict: if you're happy paying for Claude and want the most polished agent for Claude models, stay with Claude Code. If model choice, open source, or reusing a ChatGPT or Copilot subscription matters more, OpenCode is the closest switch you can make.

opencode.sh
# Install
curl -fsSL https://opencode.ai/v2/install | bash
# or: npm install -g @opencode/cli
# or: brew install anomalyco/tap/opencode-v2

# Start in your project
cd /path/to/your/project
opencode

# Inside the app:
#   /connect   pick a provider and enter credentials
#   /models    choose a model
#   Tab        switch between the build and plan agents

Cline

What it is: an open-source coding agent that started as a VS Code extension and now also ships as a JetBrains plugin, a CLI (npm i -g cline), a desktop app for macOS and Windows, and an SDK. Its signature is Plan and Act: plan with Cline first, then switch to Act to execute. Every file edit and terminal command needs your approval unless you turn on auto-approve, and in the editor each edit shows up as a diff you can review or revert. Rules live in .clinerules files, and MCP servers are supported.

Open source: Yes, Apache-2.0. The JetBrains plugin is the exception: Cline says it isn't open-sourcing that one.

Models: any of them: Anthropic, OpenAI, Google, OpenRouter, AWS Bedrock, Azure, Vertex, Ollama and LM Studio for local models, or any OpenAI-compatible API.

Pricing: the open-source extension is free for individuals. You bring your own API keys and pay your provider. Enterprise (SSO, admin controls) is custom-priced. See Cline pricing.

Pick it when: you want a Claude Code-style agent inside VS Code, you want to approve each step, and you're fine paying per token.

Aider

What it is: "AI pair programming in your terminal". Aider builds a map of your whole codebase, edits files, and commits every change to git automatically with a sensible message, so undoing an AI change is just a git operation. It can lint and test after each change and fix what breaks. It also works from inside your editor: you write comments in your code and Aider picks them up.

Open source: Yes, Apache-2.0 (Aider-AI/aider).

Models: almost any LLM, cloud or local. You pass a model and API key when you start it.

Pricing: free. You pay your model provider.

An honest caveat: releases have slowed down. The latest version on PyPI is 0.86.2 (February 2026), and the README still recommends models from 2025. It still works well, but it isn't keeping pace with the agents above.

Pick it when: you want a lightweight, predictable, git-first tool and you're comfortable managing API keys.

aider.sh
python -m pip install aider-install
aider-install

cd /path/to/your/project
aider --model sonnet --api-key anthropic=<your-key>

Gemini CLI (and Antigravity CLI)

What it is: Google's open-source terminal agent (Apache-2.0). It can query and edit large codebases, connect MCP servers, and run non-interactively in scripts.

The big change in 2026: on June 18, 2026, free individual access and Google AI Pro and Ultra subscribers moved from Gemini CLI to Antigravity CLI (agy), Google's newer terminal agent with subagents, skills, hooks, and plugins. Gemini CLI is now maintained for organizations with Gemini Code Assist Standard or Enterprise licenses (plus legacy paid API and Vertex keys). Its README also says it isn't tuned for the Gemini 4 models.

Pricing: for Gemini CLI, a Code Assist license or a paid Gemini API key. For Antigravity CLI, Google's announcement doesn't spell out pricing, so check antigravity.google.

Pick it when: your company already has Gemini Code Assist. As an individual who wants Google's models, try Antigravity CLI, or use Gemini through OpenCode or Cline.

What Happened to Windsurf?

If you're looking for Windsurf: windsurf.com now redirects to Devin Desktop from Cognition, a desktop app that runs agents locally or in the cloud and supports many models. It's a different product pitch now (an agent "command center" more than an editor), so we've left it out of the comparison. If you're curious, start at devin.ai/pricing.

How to Choose the Best AI for Coding

"Best AI for coding" depends on who you are more than on benchmarks:

  • Non-developer building your first app: Claude Code's desktop app or Cursor. Both show what changed and let you undo it. Spend your first hour on prompting habits, not tool shopping.
  • Developer who lives in the terminal: Claude Code, Codex CLI, or OpenCode. Pick the one that matches the AI subscription you already pay for.
  • Team on GitHub: Copilot, because its agents work through issues and pull requests your team already reviews.
  • Privacy-sensitive or offline: OpenCode, Cline, or Aider with a local model through Ollama or LM Studio.
  • Budget-conscious: a tool included in a subscription you already have (Codex with ChatGPT, Copilot Free or Pro) usually beats paying per token.

Whatever you choose, keep your project instructions portable. Codex and OpenCode both read AGENTS.md, and Claude Code reads it too when there's no CLAUDE.md, so one file can serve every agent. And if you try something else and come back, Claude Code's /import command brings over instruction files, MCP servers, commands, subagents, and skills from Codex, Gemini CLI, or Cursor.

portable-instructions.sh
# One instruction file for every agent:
# Codex and OpenCode read AGENTS.md, and Claude Code (v2.1.277+)
# reads it when the repo has no CLAUDE.md
git mv CLAUDE.md AGENTS.md
git commit -m "Use AGENTS.md for agent instructions"

# Coming back to Claude Code? Inside a session, run:
#   /import codex      (or: /import gemini, /import cursor)
#   add --dry-run to preview first

Learn the Concepts, Not Just the Tools

Every tool on this page is built from the same parts: a model in a loop, tools, instructions and memory, and permission checks. Understand those and switching tools takes an afternoon. To build an agent like this yourself, our free AI Agents with PydanticAI course covers tools, memory, testing, and production deployment. For guided learning on the tools themselves, see the best vibe coding courses and the best Claude Code courses.

FAQ

What is the best free alternative to Claude Code?
OpenCode is the closest free, open-source alternative: a terminal agent with plan and build modes that works with 75+ model providers and includes some free models. Cline and Aider are also free and open source, but you pay your model provider. Codex CLI and GitHub Copilot have free tiers with limited usage.
Is OpenCode better than Claude Code?
Not overall, it is a different trade-off. OpenCode is open source and runs almost any model. Claude Code is tuned for Claude models, has more built-in automation like hooks, goals, and cloud sessions, and lets you use a Claude subscription. If Claude is your main model and you pay for Pro or Max, Claude Code is usually the better value.
Can I use my Claude Pro or Max subscription in OpenCode or Cline?
No. Anthropic's terms reserve Claude.ai subscription login for Claude Code and Anthropic's own apps, and third-party tools may not offer it. In OpenCode or Cline you use Claude models through an Anthropic API key or another provider, billed separately.
Is Gemini CLI still free?
Not for individuals. On June 18, 2026, free individual access and Google AI Pro and Ultra subscribers moved to Antigravity CLI. Gemini CLI remains available for Gemini Code Assist Standard and Enterprise customers and with paid API keys.
Cursor or Claude Code: which should a beginner use?
If you are new to the terminal, Cursor's editor shows every change visually, which makes it easier to follow along. Claude Code also has a desktop app and VS Code extension. Check pricing: on Cursor, Claude models are billed at API rates on top of the plan, while Claude Code is included in Claude subscriptions.
Can I move my CLAUDE.md to another tool?
Rename it to AGENTS.md. Codex and OpenCode read AGENTS.md, and Claude Code reads it when there is no CLAUDE.md. OpenCode also loads skills from .claude/skills, so Claude Code skills carry over.

Read next

  1. 01Claude Code vs OpenCode: Which AI Coding Agent Should You Use?Two terminal coding agents with a similar workflow and very different trade-offs. Models, pricing, licensing, config files, MCP, subagents, and permissions, side by side, checked against the official docs.Comparison
  2. 02Claude Code Tutorial: Build Your First App, Step by StepInstall Claude Code, learn how a session works on a real codebase, then build a small tested web app from an empty folder. Every prompt you type is in this guide, and every command was checked against Anthropic's docs.Guide
  3. 03Claude Code Cheat Sheet: Commands, Shortcuts, and PromptsEvery command, flag, and shortcut checked against Anthropic's docs, copy-paste templates for CLAUDE.md, subagents, skills, and hooks, and the prompting habits that actually make a difference.Guide
  4. 04The Best Claude Code Courses in 2026 (Free and Paid)Anthropic's own courses are free and better than most paid ones. Here's which Claude Code course to take first, where to get a certificate, and a 7-day plan with practice projects.Best courses
  5. 05AI Agent Frameworks: Which One Should You Use in 2026?Eight frameworks that matter, checked against their official docs: language, abstraction level, license, and a "pick this if" rule for each. Plus hello-world code so you can feel the API before you commit.Guide

Sources: Claude Code overview, Claude Code memory and AGENTS.md, Claude Code legal and compliance (credential use), OpenAI Codex CLI on GitHub, Codex CLI docs, Codex pricing, Cursor CLI docs, Cursor pricing, GitHub Copilot plans, About Copilot cloud agent, GitHub Copilot CLI on GitHub, OpenCode on GitHub, OpenCode docs: providers, instructions, skills, permissions, Cline on GitHub, Cline pricing, Aider on GitHub, Gemini CLI on GitHub, Google: transitioning Gemini CLI to Antigravity CLI.