OpenCode vs Pi Agent: Which Terminal Coding Agent Should You Use?
A hands-on comparison of OpenCode and Pi terminal coding agents. Covers installation, model support, extensions, workflow differences, pricing, and which one fits your style of work.
I have been running OpenCode and Pi side by side for the past few weeks. Both are open-source terminal coding agents, both connect to cheap models, and both run on a $6/month VPS. But they work differently enough that picking one over the other actually matters.
OpenCode gives you everything upfront. You install it, connect a model, and you have plan mode, image support, MCP servers, undo/redo, and a rich TUI. Pi gives you four tools and a TypeScript extension system. You add memory, planning, MCP support, and sub-agents through extensions you pick yourself.
I ended up using both for different things. Here is what I found.
What this covers
- How the two agents differ in philosophy and default behavior
- Installation and model configuration side by side
- Workflow differences: plan mode, extensions, memory, sessions
- Pricing with cheap models through OpenRouter and OpenCode Go
- When to pick one over the other (or both)
For full setup instructions, see the OpenCode setup guide and the Pi coding agent setup guide. If you want to compare these agents to Claude Code too, both guides include comparison tables.
Philosophy: batteries-included vs build-your-own
This is the core difference and everything else flows from it.
OpenCode is batteries-included. You get a polished TUI with plan mode, build mode, image drag-and-drop, MCP server support, undo/redo, conversation sharing, and a /init command that bootstraps your project. The moment you finish installing, you have a fully functional coding agent. You pick a model and start working.
Pi starts with four tools: read, write, edit, and bash. No plan mode. No MCP. No memory. No sub-agents. You add what you need through TypeScript extensions. That sounds like a disadvantage until you realize you can build exactly the agent you want, with no feature you will not use sitting in the way.
Neither approach is better. It depends on how you work. If you want to sit down and start coding immediately, OpenCode gets you there faster. If you want to craft a specific workflow and are willing to spend an hour setting up extensions, Pi gives you more control over what the agent can do.
Installation
Both install in under a minute on any Linux VPS with Node.js 18+.
OpenCode
curl -fsSL https://opencode.ai/install | bash
Also available through npm (npm install -g opencode-ai), Bun, Homebrew, and Docker.
Pi
npm install -g @mariozechner/pi-coding-agent
Run it with pi in any project directory.
OpenCode has its own install script and a binary distribution. Pi is a standard npm package. For Docker, both work fine:
# OpenCode
docker run -it --rm ghcr.io/anomalyco/opencode
# Pi
docker run -it --rm -v $(pwd):/workspace -w /workspace node:22 \
npx @mariozechner/pi-coding-agent
Model support
Both agents connect to the same cheap models. The difference is how you configure them.
OpenCode
OpenCode has 75+ built-in providers. You set environment variables or use the /connect command in the TUI. OpenRouter, Anthropic, OpenAI, Google, MiniMax, DeepSeek, ZAI (GLM), Xiaomi MiMo, Moonshot (Kimi), and dozens more are ready to go.
Pi
Pi has 20+ built-in providers with the same env variable approach. For anything not built-in, you create ~/.pi/agent/models.json to add custom providers, Ollama, or any OpenAI-compatible API. The models.json file reloads when you open /model, so you can edit it mid-session.
Both support OpenRouter, which is the easiest way to access all the cheap models with one key:
export OPENROUTER_API_KEY=sk-or-...
Both also support OpenCode Go as a built-in provider. At $10/month, it bundles 12 models including MiniMax M2.7, Qwen 3.6 Plus, GLM 5.1, DeepSeek V4 Pro, and Kimi K2.6. For a breakdown of these models and their benchmarks, see the best cheap models guide. For a detailed look at OpenCode Go with limits and real-world usage, see the OpenCode Go guide.
Models I use with both agents
| Task | Model | Cost |
|---|---|---|
| Everyday edits | MiniMax M2.7 | $0.30/M input |
| Frontend / UI work | Qwen 3.6 Plus | $0.33/M input |
| Multi-file refactoring | GLM 5.1 | $1.05/M input |
| Big repos, long context | DeepSeek V4 Pro | $0.435/M input |
Workflow comparison
Plan mode
OpenCode has plan mode built in. Press Tab to switch between plan mode (read-only, the agent describes what it would do) and build mode (the agent makes changes). This is the workflow pattern I keep coming back to in OpenCode.
Pi has plan mode through the pi-plan extension. You install it, and Pi gets the same read-only planning with approval-based execution. It works the same way conceptually, but you have to install it first.
MCP support
OpenCode supports MCP servers out of the box. Configure them in the OpenCode config and they are available immediately.
Pi needs the pi-mcp-adapter extension. Once installed, it connects to any MCP-compatible tool server — GitHub, Playwright, Brave Search, Postgres, Notion, Slack. If you already have MCP servers configured for other agents like Hermes Agent, you can reuse them.
Memory
OpenCode does not have persistent memory. Each session starts fresh.
Pi gets memory through the pi-memory-md extension. The agent stores what it learns about your project in Markdown files and loads them on the next session. This is the first extension I install when setting up Pi. After a few sessions, the agent already knows your project structure, conventions, and quirks.
Sub-agents
OpenCode does not support sub-agents.
Pi has pi-subagents. When a task has independent parts, sub-agents tackle them in parallel. This matters for complex refactors or multi-file changes where different parts of the work do not depend on each other.
Image support
OpenCode supports drag-and-drop images in terminals that support it (WezTerm, Ghostty, Kitty, Alacritty). Over SSH with tmux, you can paste images instead.
Pi supports both paste and drag. The experience is similar across SSH.
Project initialization
OpenCode has /init. It reads your codebase and creates an AGENTS.md file with project conventions, structure, and coding patterns. You can edit it manually.
Pi does not have a built-in init command. You create AGENTS.md yourself. Pi loads it from ~/.pi/agent/AGENTS.md (global) and from your project root. With the pi-config community repository, you can copy curated extension and skill configs to get started faster.
Sessions
Both agents save sessions automatically.
OpenCode: /undo, /redo, /share, and conversation history.
Pi: /resume, /new, /tree, /fork, /clone. Pi also supports non-interactive mode with pi -p "prompt" for one-shot commands in scripts or CI. The --mode json and --mode rpc flags give you structured output for process integration.
Extensions and customization
This is where the two agents diverge the most.
OpenCode
OpenCode is configured through files and environment variables. You set model providers in .env, configure MCP servers in the config, and use AGENTS.md for project instructions. There is no plugin system or extension API. What you see is what you get.
Pi
Pi has a full TypeScript extension system. Extensions are .ts files you drop into ~/.pi/agent/extensions/. They can:
- Register custom tools the LLM can call
- Intercept tool calls before execution (to block dangerous commands, for example)
- Add slash commands
- Modify the system prompt
- Build custom TUI components
- Hot-reload with
/reloadwithout restarting
The community around this extension system is growing. LazyPi bundles 60+ skills, 76 themes, MCP support, sub-agents, memory, and planning mode into one command. The pi-config repository has curated extensions for web search, bash guards, Reddit, PDF reading, and more.
If you want to build a specific workflow, the extension system gives you control that OpenCode does not offer. But it takes time to set up, and you need to be comfortable writing or at least configuring TypeScript.
Pricing
Both agents are free and open source. You pay for LLM API usage.
| Scenario | Cost |
|---|---|
| MiniMax M2.7 via OpenRouter | $3-10/month typical coding use |
| Qwen 3.6 Plus via OpenRouter | $5-15/month |
| OpenCode Go subscription | $10/month |
| Claude Sonnet via Anthropic | $15-50/month depending on use |
OpenCode Go works with both agents. Subscribe once and use the key in OpenCode and Pi. The usage limits are shared: $12 per 5 hours, $30 per week, $60 per month.
For the full pricing breakdown, see the best cheap models for Hermes Agent guide.
Side-by-side summary
| Feature | OpenCode | Pi |
|---|---|---|
| Install | Binary/npm/Homebrew/Docker | npm package |
| Default tools | Full set (read, write, edit, bash, grep, find, ls) | 4 (read, write, edit, bash) |
| Plan mode | Built-in (Tab key) | Via extension |
| MCP support | Built-in | Via extension |
| Memory | No | Via extension |
| Sub-agents | No | Via extension |
| Image support | Drag and drop + paste | Paste + drag |
| Model providers | 75+ built-in | 20+ built-in + models.json for custom |
| /init project setup | Yes | No (manual AGENTS.md) |
| Extension system | None | TypeScript extensions |
| Themes | Built-in | 2 built-in + 76 community |
| Session features | Undo, redo, share | Tree, fork, clone, non-interactive mode |
| Pricing | Free (pay API) | Free (pay API) |
| OpenCode Go support | Yes | Yes |
When to pick OpenCode
- You want a working agent immediately after install, no configuration needed
- Plan mode and build mode are central to your workflow
- You want 75+ model providers without touching config files
- Image drag-and-drop matters (mockups, screenshots, UI feedback)
- You want
/initto bootstrap project conventions - You like a polished TUI with keyboard shortcuts
When to pick Pi
- You want to build a custom agent workflow from parts
- Persistent memory across sessions matters to you
- You need sub-agents for parallel work on complex tasks
- You want to write TypeScript extensions for custom tools
- You care about 76 terminal themes
- You want non-interactive mode (
pi -p) for CI or scripting - You want LazyPi to set up 60+ skills in one command
When to use both
This is what I do. OpenCode for quick coding sessions where I know what I want and just need to get it done. Pi for longer projects where memory, sub-agents, and a tailored workflow pay off over time. Both agents connect to the same OpenRouter key, so the cost is the same either way.
Run them on the same VPS if you want. They do not conflict. Use tmux or mosh to connect from your laptop.
Can I use the same API key for both?
Yes. Both agents read OPENROUTER_API_KEY from environment variables. If you use OpenCode Go, set OPENCODE_API_KEY and both agents can access the same subscription. Usage limits are shared.
Can I run both on the same VPS?
Yes. They are separate binaries that work in separate directories. No port conflicts, no shared state. Use different tmux sessions: tmux new -s opencode and tmux new -s pi.
Which one is better for Ollama / local models?
Both support Ollama. OpenCode uses environment variables (OPENAI_BASE_URL). Pi uses models.json with compatibility flags for models that do not support the developer role. Pi’s approach gives you more control over compatibility settings for reasoning models. See our Ollama Docker guide for setup.
Do either support Claude Code or ChatGPT subscriptions?
Pi supports subscription login for Claude Pro/Max, ChatGPT Plus/Pro, GitHub Copilot, and Google Gemini CLI through the /login command. OpenCode relies on API keys. Warning: using subscription OAuth tokens with automated agents can get your account banned. Use API keys instead.
Which has better community extensions?
Pi, by a wide margin. The TypeScript extension system, LazyPi (60+ skills), pi-config (curated community extensions), and 76 themes give Pi a much larger ecosystem of add-ons. OpenCode has no extension system.
For more agent guides, see the Hermes Agent setup guide, the GitHub Copilot alternatives article, and the Qwen 3.6 for AI coding agents guide.