Short version: OpenCode gets closest to Claude Code as an open-source terminal agent, and it can use Claude models through your own API key or local models through Ollama. Codex CLI and Gemini CLI are open-source clients from OpenAI and Google. Remember that the model decides most of the quality; switching clients while keeping the same model changes less than people expect.

The alternatives
**OpenCode** (about 208,000 stars): an open-source terminal coding agent that works with many providers, including Anthropic via your own key and local models.
**Codex CLI** (about 125,000, Apache-2.0): OpenAI's open-source agent with local sandboxing, able to use a ChatGPT plan you already pay for.
**Gemini CLI** (about 107,000, Apache-2.0): Google's open-source agent. For unpaid and Google One users, Google now points to Antigravity CLI instead.
**Goose** (about 54,000, Apache-2.0): an extensible local agent built around MCP.
**Aider** (about 49,000): git-centric pair programming in the terminal; slower-moving, with its last push in May 2026.
**OpenHands** (about 88,000, MIT): for handing off whole tasks to run in a sandbox.

Where Claude Code still leads
- One engine across terminal, desktop, web and IDE.
- Hooks that run your own scripts during a session.
- Plugins, and MCP scopes that make team setups easy.
Choosing
- Want Claude models, open client: OpenCode or Goose with your Anthropic key.
- Already pay for ChatGPT: Codex CLI.
- Fully local and private: OpenCode, Goose or Aider with Ollama.
- Keep it portable: skills in SKILL.md and MCP config in the repo.
For the paid side of the comparison, see Claude Code vs Codex.