# Gemini CLI vs OpenCode

_Gemini CLI now serves Google's enterprise and paid API customers and runs Gemini models. OpenCode is free for anyone and runs almost any model, Gemini included._

Gemini CLI and OpenCode are open source terminal [coding agents](/learn/concepts/ai-engineering/coding-agents). Each reads your repository, edits files and runs commands until a task is done. Google builds Gemini CLI under Apache 2.0. OpenCode is an MIT-licensed agent from Anomaly that connects to almost any provider. Facts on this page were checked against each tool's own docs and repository as of December 4, 2026.

## What Changed With Gemini CLI

On June 18, 2026, Google moved free users and Google AI Pro and Ultra subscribers from Gemini CLI to Antigravity CLI, which runs as `agy`. Gemini CLI's repository now describes it as designed for Gemini Code Assist Standard and Enterprise licenses and Code Assist for GitHub. It also works with a paid Gemini API key or Vertex AI. The repository says Gemini CLI is not tuned for the Gemini 4 series.

If you used Gemini CLI on a personal Google account, compare OpenCode with Antigravity CLI instead. [Claude Code vs Gemini CLI and Antigravity CLI](./claude-code-vs-gemini-cli.mdx) covers the move in detail.

## Decision Table

| | Gemini CLI | OpenCode |
| --- | --- | --- |
| License | Apache 2.0 | MIT |
| Who can use it | Gemini Code Assist Standard or Enterprise, paid Gemini API keys, Vertex AI | Anyone. Free with your own provider |
| Models | Gemini models | Any provider in the models.dev catalog, plus local models |
| Default approvals | Asks before each tool call | Allows every action except reading `.env` files |
| OS sandbox | Optional, off unless you pass `--sandbox` | None |
| Best for | Teams with a Code Assist license | Anyone who switches models or runs local ones |

## At a Glance

| | Gemini CLI | OpenCode |
| --- | --- | --- |
| Sign-in | Google account with a Code Assist license, Gemini API key, or Vertex AI | API keys for any models.dev provider, or ChatGPT, GitHub Copilot and Claude plan sign-in |
| Subscriptions | Code Assist licenses | OpenCode Go $10, Go Plus $40 per month |
| Approval modes | `default`, `auto_edit`, `plan`, and `yolo` from the command line only | Ordered `allow`, `ask` and `deny` rules per action and resource |
| Sandbox methods | Seatbelt on macOS, Docker or Podman, a Windows sandbox, gVisor or LXC on Linux | None. Shell commands run with your user's access |
| Project instructions | `GEMINI.md` | `AGENTS.md`, falling back to `CLAUDE.md` |
| Extensions | Extensions and MCP servers in `settings.json` | Skills, plugins and MCP servers |
| Headless and CI | `gemini -p`, with `--output-format json` | `opencode run` |
| Local models | Not documented | Ollama, LM Studio, vLLM |

## Access and Models

Gemini CLI is now an enterprise tool. A Code Assist Standard or Enterprise license works through a Google account sign-in with `GOOGLE_CLOUD_PROJECT` set. A Gemini API key from AI Studio gives usage-based billing, and Vertex AI works through a Google Cloud project. The repository lists no free tier for individuals.

OpenCode charges nothing for the agent. It reads its provider list from models.dev, so you can run Gemini, Claude, GPT or open-weight models in the same tool. It signs in with a ChatGPT Plus or Pro plan, a GitHub Copilot account, or a Claude plan through a local Claude Code login. OpenCode Go is an optional $10 monthly subscription to a curated list of models tested for agentic coding.

## Approvals and Sandboxing

The defaults point in opposite directions. Gemini CLI's `default` mode asks before each tool call. `auto_edit` approves file edits and still asks about other tools. YOLO mode approves everything and can only be turned on from the command line, and the `security.disableYoloMode` setting turns it off. Gemini CLI's sandbox is off unless you pass `-s` or set `GEMINI_SANDBOX`. On macOS its Seatbelt profile confines writes to the project directory.

OpenCode's `build` agent allows every action, including access outside the project. Only reading `.env` files asks first. It has no OS sandbox, so narrow it with `deny` and `ask` rules or run it in a container or a [cloud sandbox](./sandbox-providers-for-coding-agents.mdx).

## When to Pick Which

- **Pick Gemini CLI** if your company has a Gemini Code Assist license, you want prompts before each tool call, or you want a choice of sandbox backends.
- **Pick OpenCode** if you have no Code Assist license, switch between providers, run local models, or want to reuse a ChatGPT, Copilot or Claude plan.
- **Pick Antigravity CLI** if you use Gemini on a personal Google account. Gemini CLI no longer serves those plans.

## Alternatives

- **Claude Code:** Anthropic's agent for Claude models. See [OpenCode vs Claude Code](./opencode-vs-claude-code.mdx).
- **Codex:** OpenAI's Apache 2.0 agent with a sandbox on by default. See [Codex vs OpenCode](./codex-vs-opencode.mdx).
- **Goose:** an Apache 2.0 agent with a desktop app first. See [OpenCode vs Goose](./opencode-vs-goose.mdx).

## Running Several Agents at Once

Running Gemini CLI and OpenCode on the same task needs one [git worktree](/learn/concepts/git/git-worktrees) per agent, so their edits never collide. In Treq, each agent runs in its own [workspace](/docs/concepts/workspaces), and you review the results side by side.

## Sources

Checked December 4, 2026:

- [Gemini CLI repository](https://github.com/google-gemini/gemini-cli), [Configuration](https://geminicli.com/docs/reference/configuration/), [Sandboxing](https://geminicli.com/docs/cli/sandbox/)
- [OpenCode repository](https://github.com/anomalyco/opencode), [OpenCode Go](https://opencode.ai/go), [Providers](https://opencode.ai/docs/providers/), [Permissions](https://opencode.ai/docs/permissions/), [Instructions](https://opencode.ai/docs/instructions/), [Skills](https://opencode.ai/docs/skills/), [CLI](https://opencode.ai/docs/cli/)

## Next Steps

- [Best Coding Agent CLIs](./best-coding-agent-clis.mdx): every current terminal agent in one table
- [Claude vs Gemini for Coding](./claude-vs-gemini-for-coding.mdx): how the models compare
- [Parallel Coding Agents](/learn/parallel-coding-agents): why agents need separate workspaces
