Best AI CLI Tools 2026: Codex CLI Tops Terminal-Bench at 83.4%, OpenCode Wins Free at 172K Stars

We ranked 9 AI CLI coding tools on Terminal-Bench 2.1 scores, exact pricing, free tiers, and install commands. Codex CLI leads at 83.4%, Claude Code at 78.9%. Gemini CLI gives 1,000 free requests/day. Full data, updated June 2026.

June 9, 2026 · 1 min read
Best AI CLI Tools 2026: Codex CLI Tops Terminal-Bench at 83.4%, OpenCode Wins Free at 172K Stars

AI coding agents now live in the terminal. They read your repo, edit files, run commands, and commit, all from a shell prompt that pipes into git, grep, docker, and CI the way any unix tool does. They run headless in SSH sessions, CI pipelines, and cloud VMs where no GUI exists, and every action is a shell command you can inspect, replay, or script.

Picking one is the hard part, because prices, free tiers, and benchmark scores moved again last month. This ranking uses one neutral benchmark for capability (Terminal-Bench 2.1, run by tbench.ai), the published pricing pages for cost, and GitHub star counts for adoption. Every number below has a source and an as-of date of June 9, 2026.

83.4%
Codex CLI + GPT-5.5 on Terminal-Bench 2.1 (#1)
78.9%
Claude Code + Opus 4.8 on Terminal-Bench 2.1 (#2)
172,198
OpenCode GitHub stars (most-starred OSS agent)
1,000/day
Gemini CLI free requests (no card required)
Scope

This ranking covers CLI-first tools: agents whose primary interface is the terminal. Tools that lead with an IDE extension (Cursor, Kiro, Google Antigravity) appear only where they ship a real CLI surface. Where a tool runs many models, scores reflect the strongest model the agent supports.

Quick Comparison: 9 AI CLI Tools (June 2026)

AI CLI Tools Compared
ToolTerminal-Bench 2.1GitHub stars / licensePrice (from)Free tier
Codex CLI83.4% (GPT-5.5, #1)89,991 / Apache-2.0$20/mo (ChatGPT Plus)No CLI sign-in free tier
Claude Code78.9% (Opus 4.8, #2)131,380 / proprietary$17/mo annual ($20 monthly)No (free Claude.ai excluded)
Gemini CLI70.7% (Gemini 3.1 Pro)105,104 / Apache-2.0API or $19.99/mo AI Pro1,000 req/day
OpenCodeModel-dependent (75+)172,198 / MITFree (BYOK)Tool free, pay provider
ClineModel-dependent62,996 / Apache-2.0Free (BYOK)Tool free, pay provider
GooseModel-dependent48,542 / Apache-2.0Free (BYOK)Tool free, pay provider
Copilot CLIModel-dependentCopilot ecosystem$10/mo ProFree (limited)
AiderModel-dependent45,945 / Apache-2.0Free (BYOK)Tool free, pay provider
Kilo CodeModel-dependent (500+)19,968 / MITFree (BYOK)Free gateway, no markup

Terminal-Bench 2.1 scores from tbench.ai (as of 2026-06-09). BYOK = bring your own key: the tool is free, you pay the model provider per token. Star counts and licenses from each project's GitHub repo.

Best AI CLI Tools With a Generous Free Tier

If "free" means "no API bill," one tool stands apart. Gemini CLI gives 60 requests per minute and 1,000 requests per day on a personal Google account through OAuth login, served with a Gemini 3 model mix, no credit card required. That covers a full day of heavy coding before you hit a wall.

The open-source CLIs (OpenCode, Cline, Goose, Aider, Kilo Code) are free to install but bring-your-own-key, so the model still costs money per token unless you run a local model via Ollama or LM Studio. Two ways to make those effectively free or near-free: point them at a local model on your own hardware, or route them to a low-cost hosted open-source model. See running open-source models cheaply below for the rates.

Free-Tier Reality (June 2026)
ToolWhat's actually freeCatch
Gemini CLI1,000 requests/day, 60/minPersonal Google account; Gemini 3 model mix
Copilot CLICopilot Free: limited chat and agent usagePaid Pro ($10/mo) for real volume
OpenCode / Cline / Goose / AiderTool is free and open sourceBYOK: pay the model provider per token
Kilo CodeFree extension + gateway at exact provider ratesNo markup, but provider still bills you
Local models (Ollama / LM Studio)Zero per-token cost on your hardwareCline guidance: 16-32GB RAM small, 64GB+ large

1. Codex CLI: Terminal-Bench 2.1 Leader at 83.4%

83.4%
Terminal-Bench 2.1 with GPT-5.5 (#1)
89,991
GitHub stars (Apache-2.0)
$20/mo
ChatGPT Plus to sign in

OpenAI's Codex CLI tops Terminal-Bench 2.1 at 83.4% (±2.2) running GPT-5.5. It is open source under Apache-2.0 with 89,991 GitHub stars, and it spans more than the terminal: CLI, an IDE extension for VS Code, Cursor, and Windsurf, a cloud agent at chatgpt.com/codex, a desktop app (codex app), and iOS. Cloud integrations include automatic code review and Slack.

Install it, then run codex and choose "Sign in with ChatGPT." Sign-in requires ChatGPT Plus, Pro, Business, Edu, or Enterprise; Plus and Pro share one combined 5-hour usage window across local and cloud work. You can also auth with an OpenAI API key and pay per-token API rates, but API-key mode drops the cloud features.

Install
  • Mac/Linux: curl -fsSL https://chatgpt.com/codex/install.sh | sh
  • npm: npm install -g @openai/codex
  • Homebrew: brew install --cask codex
  • Model switching: /model (GPT-5.4, GPT-5.3-Codex, adjustable reasoning)
Usage limits per 5-hour window
  • ChatGPT Plus ($20/mo): 15-80 local messages, 5 cloud tasks, 5 code reviews
  • Pro 5x (from $100/mo): 80-400 local messages
  • Pro 20x: 300-1,600 local messages
  • API rates: GPT-5.5 is $5/M input, $30/M output (≤272K context)

Best for: Fire-and-forget cloud execution and the highest published Terminal-Bench score. Write a spec, launch a cloud task, work on something else while it runs. See Codex vs Claude Code.

2. Claude Code: 78.9% on Terminal-Bench, Best Model Quality

78.9%
Terminal-Bench 2.1 with Opus 4.8 (#2)
69.2%
Opus 4.8 on SWE-bench Pro (beats GPT-5.5)
$17/mo
Claude Pro, billed annually ($20 monthly)

Claude Code is Anthropic's terminal agent. It scores 78.9% (±2.5) on Terminal-Bench 2.1 with Opus 4.8, second only to Codex CLI. The model carries the result: Opus 4.8 scores 69.2% on SWE-bench Pro (up 4.9 points from Opus 4.7's 64.3%, ahead of GPT-5.5 and Gemini 3.1 Pro on that benchmark) and leads the self-reported SWE-bench Verified leaderboard at 88.6%. Anthropic reports Opus 4.8 is around four times less likely than its predecessor to let flaws in its own code pass unremarked.

The repo has 131,380 GitHub stars but no open-source license; Claude Code is proprietary, and the repo is for issues and docs. It needs a paid Claude account. The free Claude.ai plan does not include Claude Code access. It also runs through Amazon Bedrock, Google Vertex AI, and Microsoft Foundry.

Install
  • Native (recommended): curl -fsSL https://claude.ai/install.sh | bash
  • Windows: irm https://claude.ai/install.ps1 | iex
  • Homebrew: brew install --cask claude-code
  • npm: npm install -g @anthropic-ai/claude-code (Node 18+)
  • MCP: claude mcp add --transport http <name> <url>
Pricing and usage caps
  • Pro: $17/mo billed annually ($200 up front) or $20/mo monthly; includes Claude Code
  • Max: from $100/mo
  • Windows: a 5-hour rolling session window plus a weekly limit across all models, shared across claude.ai, Desktop, and Claude Code
  • Reported weekly caps: Pro ~40-80 Sonnet hours; Max 5x ($100) ~140-280; Max 20x ($200) ~240-480 or up to ~40 Opus hours

Best for: Developers who want the strongest model quality and the safest self-checking code, and who already pay for Claude Pro or Max. Requires macOS 13.0+, Windows 10 1809+, or Ubuntu 20.04+ with 4GB+ RAM. Claude Code install guide.

3. Gemini CLI: Best Free Tier, 1,000 Requests/Day

1,000/day
free requests, 60/min (Google account)
70.7%
Terminal-Bench 2.1 with Gemini 3.1 Pro
105,104
GitHub stars (Apache-2.0)

Gemini CLI is Google's open-source terminal agent (Apache-2.0, 105,104 stars). The reason to start here is the free tier: 60 requests per minute and 1,000 requests per day on a personal Google account through OAuth login, served with a Gemini 3 model mix, no credit card. With an API key you can pin a specific model (for example gemini-2.5-flash) instead of the managed mix.

On Terminal-Bench 2.1 it scores 70.7% (±2.9) with Gemini 3.1 Pro, behind Codex CLI (83.4%) and Claude Code (78.9%) but ahead of most open-source options when you account for the free quota. It supports MCP servers configured in ~/.gemini/settings.json.

Install
  • npx: npx @google/gemini-cli
  • npm: npm install -g @google/gemini-cli
  • Homebrew: brew install gemini-cli

Best for: The most generous no-card free tier and developers who want to try agentic coding without a subscription. Google AI Pro is $19.99/mo for higher rate limits on the agent model. See Gemini CLI vs Claude Code.

4. OpenCode: Most-Starred Open-Source Agent, 75+ Providers

172,198
GitHub stars (MIT, most of any OSS agent)
75+
LLM providers via the AI SDK
Free
open source, BYOK or local models

OpenCode (repo anomalyco/opencode, MIT) is the most-starred open-source coding agent at 172,198 stars, ahead of Gemini CLI (105,104) and OpenAI Codex (89,991). It connects to 75+ LLM providers through the AI SDK and the Models.dev catalog, runs local models via Ollama, LM Studio, and llama.cpp, and accepts any OpenAI-compatible endpoint through JSON config. OpenCode Zen is the team's curated, tested model list for agentic coding.

One caveat the docs call out: Anthropic explicitly prohibits using Claude Pro or Max subscriptions with third-party tools like OpenCode. ChatGPT Plus, GitHub Copilot, and GitLab Duo subscriptions are usable as model backends.

Install
  • Script: curl -fsSL https://opencode.ai/install | bash
  • npm: npm install -g opencode-ai
  • Homebrew: brew install anomalyco/tap/opencode

Best for: Maximum model flexibility and a Claude Code-style experience without single-provider lock-in. The best pick if you want to point one CLI at a low-cost hosted open-source model. What is OpenCode, or OpenCode vs Claude Code.

5. Cline CLI: Open Source, Any Model, Local-Friendly

62,996
GitHub stars (Apache-2.0)
Every model
Claude, GPT, Gemini, OpenAI-compatible, local
npm i -g cline
CLI for macOS, Windows, Linux

Cline is Apache-2.0 open source (62,996 stars) and free. It started in VS Code but ships a CLI installed with npm i -g cline for macOS, Windows, and Linux, and also runs in JetBrains (Early Access), Cursor, and Windsurf. It is model-agnostic: Claude, GPT, Gemini, any OpenAI-compatible endpoint, BYOK, or local via Ollama and LM Studio, plus MCP servers and custom tools.

For local inference, Cline's docs suggest 16-32GB RAM for small or quantized models, 32-64GB for mid-size coding models, and 64GB+ for larger models, and recommend enabling the "Use Compact Prompt" setting when running locally. An enterprise tier exists at cline.bot/enterprise.

Best for: Teams that want open-source transparency, model freedom, and a path to fully local inference for compliance. See Cline vs Claude Code.

6. Goose: MCP-Native, 70+ Extensions, Now Linux Foundation

48,542
GitHub stars (Apache-2.0, Rust)
70+
extensions via MCP
15+
model providers

Goose moved from Block to the Agentic AI Foundation (AAIF) at the Linux Foundation (repo aaif-goose/goose, 48,542 stars, Apache-2.0, built in Rust). It ships a desktop app, a CLI, and an API. It works with 15+ providers (Anthropic, OpenAI, Google, Ollama, OpenRouter, Azure, Bedrock, and more), can reuse existing Claude, ChatGPT, or Gemini subscriptions via ACP, and connects to 70+ extensions through MCP.

Goose is general-purpose, not code-only: the project positions it for research, writing, automation, and data analysis as well as code. Governance is public under AAIF with a GOVERNANCE.md and custom-distribution support.

Install
  • CLI: curl -fsSL https://github.com/aaif-goose/goose/releases/download/stable/download_cli.sh | bash

Best for: MCP-first DevOps and infrastructure work where the agent must reach databases, ticketing, and cloud APIs through a standard protocol. See Goose vs Claude Code.

7. GitHub Copilot CLI: Usage-Based Credits, Multi-Model

$10/mo
Copilot Pro (1,500 credits)
$0.01
per AI credit (usage-based since June 1, 2026)
/model
switch models in the CLI

GitHub Copilot CLI runs in the terminal and supports MCP servers and a /model command. On June 1, 2026, Copilot switched to usage-based billing with AI credits: 1 credit = $0.01, consumed on token usage at published per-model rates. Pro ($10/mo) includes 1,000 base + 500 flex = 1,500 credits ($15 value); Pro+ ($39/mo) includes 7,000 credits ($70); a new Max plan ($100/mo) includes 20,000 credits ($200). Basic code completions never consume credits and stay unlimited on paid plans.

The model menu spans Claude (Opus 4.5-4.8 at $5/M in, $25/M out; Sonnet at $3/$15; Fable 5 at $10/$50, currently suspended, see note), GPT-5.5 ($5/$30), Gemini 3.1 Pro ($2/$12), and more. One caveat as of June 2026: new sign-ups for Copilot Student, Pro, Pro+, and Max are paused while the new billing rolls out.

Install
  • npm: npm install -g @github/copilot (Node 22+)
  • Homebrew: brew install copilot-cli
  • Script: curl -fsSL https://gh.io/copilot-install | bash

Best for: Developers in the GitHub ecosystem who want one credit pool across Chat, CLI, cloud agents, and code review, with a wide model menu including Claude Fable 5 (currently suspended, see note) and GPT-5.5. See Copilot vs Claude Code.

8. Aider: Git-Native, Multi-Model, BYOK

45,945
GitHub stars (Apache-2.0)
Auto-commit
every change staged with a message
Free
open source, pay provider per token

Aider is the original AI CLI coding tool and still the gold standard for git-native terminal editing: every change is staged automatically with a descriptive commit message. It connects per-run via flags, for example aider --model sonnet --api-key anthropic=<key> or aider --model deepseek --api-key deepseek=<key>, and works with local models via Ollama or any OpenAI-compatible API.

One honest note: Aider's cadence has slowed. The last repo push was 2026-05-22, while OpenCode and Cline push daily, and its in-docs model guidance still recommends 2025-era frontier models rather than the current ones. The tool works; the project moves slower than the leaders.

Install
  • Script: curl -LsSf https://aider.chat/install.sh | sh
  • pip: python -m pip install aider-install && aider-install
  • uv: uv tool install --force --python python3.12 --with pip aider-chat@latest

Best for: Developers who want git-integrated editing and full control over model selection and spend. See Aider vs Claude Code.

9. Kilo Code: Free Gateway at Exact Provider Rates

19,968
GitHub stars (MIT)
No markup
Kilo Gateway at exact provider rates
$19+
Kilo Pass subscriptions (bonus credits)

Kilo Code (repo Kilo-Org/kilocode, MIT, 19,968 stars) is free and open source, now at kilo.ai. Kilo Gateway is $0/mo plus usage at exact provider rates with no markup. Kilo Pass subscriptions run $19, $49, and $199/mo with up to 50% bonus credits. Teams is $15/user/mo. You can also BYOK with Anthropic, OpenAI, Google, Azure, or Bedrock keys and skip a Kilo plan entirely.

Best for: Developers who want a pass-through gateway with no margin on tokens, plus optional credit packs. See Kilo Code vs Claude Code.

Pricing Comparison

Full Pricing Breakdown (June 2026)
ToolFree tierPaid (from)Cost model
Codex CLINo CLI sign-in free tier$20/mo (ChatGPT Plus)Subscription, 5-hour message windows
Claude CodeNo (free Claude.ai excluded)$17/mo annual ($20 monthly)Subscription, 5-hour + weekly caps
Gemini CLI1,000 req/day$19.99/mo (Google AI Pro)Free quota or subscription/API
OpenCodeTool is freeBYOK or existing subUse ChatGPT/Copilot sub or BYOK
ClineTool is freeBYOKPay provider per token, or local
GooseTool is freeBYOKPay provider per token
Copilot CLIFree (limited)$10/mo Pro = 1,500 creditsUsage-based credits at $0.01 each
AiderTool is freeBYOKPay provider per token
Kilo CodeFree gateway, no markupKilo Pass $19/$49/$199Provider rates + optional credits

The split is clear. Codex CLI and Claude Code charge a subscription with usage windows. Gemini CLI gives the only no-card free quota that lasts a full day. Copilot CLI moved to usage-based credits at $0.01 each. The open-source tools (OpenCode, Cline, Goose, Aider, Kilo Code) are free to install but pass model cost straight through. For predictable heavy use, a $17-20/mo subscription wins; for light or local use, open-source plus BYOK is cheapest.

Running Open-Source Models in Your CLI, Cheaply

Every bring-your-own-key CLI (OpenCode, Cline, Goose, Aider, Kilo Code) is only as cheap as the endpoint behind it. Point one of them at a hosted open-source model and you keep the agent free while paying a fraction of frontier API rates. The catch is fidelity: most serverless providers quantize activations to fp8 to cut cost, which degrades output quality.

Morph Open Source Models serve DeepSeek with 16-bit (bf16) activations, no fp8 or int8 quantization, so responses match the reference weights. That makes Morph the place to run DeepSeek when output fidelity matters. For coding specifically, Morph runs codegen-tuned speculative decoding plus custom low-level inference kernels, which makes it the fastest and highest-quality option for coding agents rather than a general-purpose menu.

Hosted Open-Source Model for BYOK CLIs
OptionPrice (per 1M tokens)Quality note
Morph morph-dsv4flash (DeepSeek V4 Flash)$0.139 input / $0.278 output16-bit activations, no fp8 quantization
Local model (Ollama / LM Studio)$0 per token (your hardware)Cline: 64GB+ RAM for larger models

Set the OpenAI-compatible base URL in your CLI of choice and pass the Morph model id. See Morph pricing for the full rate card.

How to Choose: Decision Framework

Pick Based on Your Priority
Your priorityBest choiceRunner-up
Highest Terminal-Bench scoreCodex CLI (83.4%, GPT-5.5)Claude Code (78.9%, Opus 4.8)
Best model quality / self-checking codeClaude Code (Opus 4.8, 88.6% SWE-bench Verified)Codex CLI (GPT-5.5)
Most generous free tierGemini CLI (1,000 req/day)Local model via Cline or OpenCode
Open source, any modelOpenCode (75+ providers, MIT)Cline (Apache-2.0)
Git-native auto-commitAiderCline
MCP / DevOps tool integrationGoose (70+ extensions)Claude Code (MCP support)
Use existing subscriptionOpenCode (ChatGPT, Copilot, GitLab Duo)Goose (Claude/ChatGPT/Gemini via ACP)
No markup on tokensKilo Code (exact provider rates)Cline (BYOK)
Cheap, high-fidelity open-source backendMorph morph-dsv4flash ($0.139/$0.278)Local model on your hardware

Most developers run two CLIs: one subscription tool (Codex CLI or Claude Code) for heavy agentic work, plus one open-source tool (OpenCode, Cline, or Gemini CLI) for quick tasks and model flexibility. MCP and model-agnostic backends make them increasingly interchangeable.

Making Every CLI Agent Faster

Every CLI agent spends tokens on the same bottleneck: searching your codebase to build context before writing code. Cognition measured that coding agents spend 60% of their time on search. Anthropic found multi-agent architectures improve performance by 90% when each sub-agent gets dedicated context.

WarpGrep runs as an MCP server inside Codex CLI, Claude Code, Gemini CLI, or any MCP-compatible agent. It executes 8 parallel searches per turn across 4 turns in under 6 seconds, and it is free for the first 100,000 requests, then $1 per 1M requests on Pro.

Fast Apply handles the other bottleneck: merging code changes into your codebase at roughly 10,500 tokens per second. Every agent generates diffs; Fast Apply merges them faster than any agent can write them.

$0 / 100k
WarpGrep free requests, then $1/1M Pro
10,500
tok/sec Fast Apply merge speed
6 sec
8 parallel searches per turn, 4 turns

Better Search = Better Context = Better Code

WarpGrep works as an MCP server inside Codex CLI, Claude Code, Gemini CLI, and any MCP-compatible agent. 8 parallel tool calls per turn, 4 turns, sub-6 seconds. Free for the first 100,000 requests.

Frequently Asked Questions

What is the best AI CLI tool for coding in 2026?

On Terminal-Bench 2.1, Codex CLI with GPT-5.5 leads at 83.4%, Claude Code with Opus 4.8 follows at 78.9%, and Gemini CLI with Gemini 3.1 Pro scores 70.7%. Codex CLI sign-in needs ChatGPT Plus ($20/mo) or higher; Claude Code needs a Claude Pro plan ($17/mo billed annually, $20/mo monthly) and the free Claude.ai plan does not include it. For a real free tier, Gemini CLI gives 1,000 requests per day. The most-starred open-source option is OpenCode at 172,198 stars.

Which AI CLI tool has the most generous free tier?

Gemini CLI: 60 requests per minute and 1,000 requests per day on a free personal Google account via OAuth, served with a Gemini 3 model mix. OpenCode, Cline, Goose, Aider, and Kilo Code are free to install but bring-your-own-key, so the model still costs money unless you run it locally via Ollama or LM Studio.

What are the best AI CLI tools for infrastructure-as-code and DevOps?

Any CLI agent here edits Terraform, Dockerfiles, and Kubernetes manifests like any other file, because it operates through shell commands. For tool-heavy DevOps that reaches databases, ticketing, and cloud APIs, Goose is MCP-native with 70+ extensions. Claude Code, Codex CLI, Gemini CLI, and Copilot CLI also support MCP servers, so you can wire in your own infrastructure tools. All run headless in CI, SSH, and cloud VMs.

Are AI CLI coding tools free and open source?

Several are: OpenCode (172,198 stars, MIT), Cline (62,996, Apache-2.0), Goose (48,542, Apache-2.0), Aider (45,945, Apache-2.0), Gemini CLI (105,104, Apache-2.0), and OpenAI Codex CLI (89,991, Apache-2.0). Claude Code is proprietary (131,380 stars, no open-source license). Open-source tools are free to install but most are BYOK.

How do AI CLI tools compare on benchmarks?

Terminal-Bench 2.1 (tbench.ai): Codex CLI + GPT-5.5 = 83.4%, Claude Code + Opus 4.8 = 78.9%, Terminus 2 + GPT-5.5 = 78.2%, Gemini CLI + Gemini 3.1 Pro = 70.7%, Claude Code + Opus 4.7 = 69.7%. On the models themselves, Opus 4.8 scores 69.2% on SWE-bench Pro and 88.6% on the self-reported SWE-bench Verified leaderboard; GPT-5.5 scores 58.6% on SWE-bench Pro.

Can I use AI CLI tools in CI/CD pipelines?

Yes. Codex offers a cloud agent plus automatic code review and Slack integration. Copilot CLI and cloud agents run in GitHub workflows. Cline ships a CLI for macOS, Windows, and Linux that scripts into pipelines. Aider and OpenCode run non-interactively. Gemini CLI works anywhere with a Google auth token or API key. Headless operation is the core advantage of CLI agents over IDE extensions.