Key Features
This guide provides a comprehensive overview of everything opencode offers. Use it as a reference to understand the full scope of the platform.
Multi-Provider LLM Support
opencode connects to over 75 LLM providers through a unified abstraction layer. This means you can switch between models without changing your workflow.
Supported Provider Categories
| Category | Examples |
|---|---|
| Major cloud | Anthropic, OpenAI, Google Gemini, AWS Bedrock, Azure OpenAI, GCP Vertex AI |
| Inference platforms | Groq, Together AI, OpenRouter, Fireworks AI, Replicate |
| Code-specialized | GitHub Models, GitLab Duo, CodeGemma |
| Open-source hosts | Ollama, llama.cpp, vLLM, LocalAI, Text Generation Inference |
| Custom endpoints | Any OpenAI-compatible API |
Switching Providers
Switch providers on the fly in the TUI:
/models
Or set a default provider in your config:
{
"provider": {
"name": "anthropic",
"model": "claude-sonnet-4-20250514"
}
}
Local Models
Run opencode entirely offline with local models via Ollama or llama.cpp:
{
"provider": {
"name": "ollama",
"model": "codellama:34b",
"baseUrl": "http://localhost:11434"
}
}
Rich Terminal UI
The TUI is opencode's primary interface, designed for productivity and extensibility.
Themes
Choose from built-in themes or create your own:
/themes
Themes are defined as JSON and control colors, syntax highlighting, and UI element styling. See Customization for the full theme reference.
Keybindings
All keybinds are configurable. Default keybinds include:
| Binding | Action |
|---|---|
| Ctrl+P | Command palette |
| Ctrl+X C | Compact session |
| Ctrl+X E | Open in editor |
| Ctrl+X Q | Exit |
| Ctrl+X X | Export session |
| Ctrl+X M | List models |
| Ctrl+X N | New session |
| Ctrl+X R | Redo |
| Ctrl+X U | Undo |
| Ctrl+X L | List sessions |
| Ctrl+X T | Theme selector |
| Tab | Switch between Build / Plan agents |
Customize keybinds in tui.json:
{
"keybinds": [
{
"key": "ctrl+shift+p",
"command": "commandPalette"
},
{
"key": "alt+1",
"command": "switchAgent",
"args": { "agent": "build" }
}
]
}
Mouse Support
The TUI supports mouse interactions:
- Click to select files from
@results - Scroll to navigate long outputs
- Click links and URLs
- Resize panels by dragging dividers
Enable or disable in tui.json:
{
"mouse": true
}
Command Palette
Press Ctrl+P to open the command palette. This is a fuzzy-search interface over all available commands, slash commands, and actions. Type to filter and press Enter to execute.
File References with @
Type @ followed by a filename to trigger fuzzy file search. Select a file to reference it in your current message. The referenced file content is included in the LLM context.
Slash Commands
| Command | Action |
|---|---|
/connect | Manage provider connections |
/compact | Compress session history |
/details | Show session details |
/editor | Edit the current prompt in $EDITOR |
/exit | Exit opencode |
/export | Export session to file |
/help | Show help |
/init | Initialize project context |
/models | List and switch models |
/new | Start new session |
/redo | Redo undone changes |
/sessions | List all sessions |
/share | Share session |
/unshare | Unshare session |
/themes | Browse themes |
/thinking | Toggle thinking mode |
/undo | Undo last changes |
Agent System
opencode's multi-agent architecture enables autonomous execution of complex software engineering tasks.
Primary Agents
Build Agent
The Build agent executes tasks by taking direct action: reading files, writing code, running shell commands, and applying patches. It operates iteratively -- plan, act, observe, repeat -- until the task is complete.
Plan Agent
The Plan agent takes a more deliberative approach. It analyzes requirements, researches the codebase, and produces a detailed step-by-step plan before any code is written. Switch to Plan mode with the Tab key.
Subagents
Subagents handle specialized tasks and can be invoked by primary agents:
| Subagent | Role |
|---|---|
| General | General Q&A, research, and exploration |
| Explore | Navigate and inspect codebases |
| Scout | Lightweight lookups and context gathering |
Custom Agents
Define your own agents in the config:
{
"agents": {
"reviewer": {
"systemPrompt": "You are a senior code reviewer. Focus on security, performance, and maintainability. Always suggest specific improvements.",
"provider": "anthropic",
"model": "claude-sonnet-4-20250514",
"tools": ["read", "grep", "glob", "bash"]
},
"documenter": {
"systemPrompt": "You are a technical writer. Generate clear, comprehensive documentation with examples.",
"provider": "openai",
"model": "gpt-4o",
"tools": ["read", "grep", "write"]
}
}
}
Tool Ecosystem
Agents use tools to interact with the environment. Each tool has a specific purpose and safety model.
Built-in Tools
| Tool | Description | Safety |
|---|---|---|
bash | Execute arbitrary shell commands | Configurable allow/block lists |
edit | Apply targeted string replacements to files | Auto-snapshotted |
write | Create new files | Auto-snapshotted |
read | Read file contents | Read-only |
grep | Search file contents with regular expressions | Read-only |
glob | Match file paths using glob patterns | Read-only |
lsp | Query language server for diagnostics, definitions, references | Read-only |
apply_patch | Apply unified diff patches to files | Auto-snapshotted |
skill | Load specialized skill instructions | Read-only |
todowrite | Track progress on multi-step tasks | Internal |
webfetch | Fetch and return web page content | Network |
websearch | Search the web for information | Network |
question | Ask the user for clarification | Interactive |
Custom Tools
Define your own tools using the same interface:
{
"tools": {
"deploy": {
"command": "bash",
"args": ["scripts/deploy.sh"],
"description": "Deploy the application to staging",
"permission": "ask"
},
"lint-check": {
"command": "bash",
"args": ["npm run lint"],
"description": "Run the linter on the current project",
"permission": "allow"
}
}
}
MCP Server Integration
Connect to the Model Context Protocol ecosystem:
opencode mcp add my-server --command "npx @myorg/mcp-server"
Configure MCP servers:
{
"mcpServers": {
"database": {
"command": "npx",
"args": ["@myorg/db-mcp"],
"env": {
"DB_URL": "${DATABASE_URL}"
}
}
}
}
Multi-Platform
opencode is designed to work wherever you write code.
Terminal TUI
The primary interface. Launch with:
opencode
opencode /path/to/project
Desktop App
Native desktop builds for macOS, Windows, and Linux. Download from opencode.ai.
IDE Extension
Available for VS Code via the marketplace. Deeper integration planned for JetBrains, Neovim, and others.
Web Interface
Browser-based access:
opencode web
Headless CLI
For scripting and automation:
opencode run "Review this PR for security issues"
CI/CD GitHub Action
Run opencode in your pipeline:
- uses: anomalyco/opencode-action@v1
with:
prompt: "Review changes in this PR"
api-key: ${{ secrets.OPENCODE_API_KEY }}
Session Management
Undo / Redo with Git Snapshots
opencode creates automatic git snapshots before each modification. Every edit, write, or patch operation snapshots the state of affected files.
# In TUI
/undo # Revert last change
/redo # Reapply reverted change
Snapshots are lightweight and stored locally. They do not interfere with your project's git history.
Sessions List
View all sessions:
/sessions
Each session shows its ID, project path, model used, creation time, and a preview of the first message.
Continue / Restore
Resume any previous session by selecting it from the sessions list. The full conversation history and file state are restored.
Branching Conversations
From any session, sending a new message creates a child session. This lets you explore multiple approaches without losing context.
Parent Session
├── Child Session (approach A)
├── Child Session (approach B)
└── Child Session (approach C)
Sharing
Manual Sharing (Default)
Share the current session:
/share
opencode uploads the session and returns a URL you can send to teammates.
Auto Sharing
Enable automatic sharing in config:
{
"share": {
"mode": "auto"
}
}
Every session is automatically shared when created.
Disabled
Turn off sharing entirely:
{
"share": {
"mode": "disabled"
}
}
Configuration System
opencode uses JSON or JSONC configuration files. Configuration is merged from multiple locations with increasing priority:
opencode.jsonor.opencode.jsonin the project root~/.config/opencode/opencode.json(user-level)/etc/opencode.json(system-level)- CLI flags (highest priority)
Config Structure
{
"provider": {
"name": "anthropic",
"model": "claude-sonnet-4-20250514"
},
"share": {
"mode": "manual"
},
"upgrade": {
"check": true
},
"theme": "catppuccin-mocha",
"tools": {
"bash": {
"allow": ["npm", "git", "node", "python", "cargo", "go"],
"block": ["rm -rf /", "sudo"]
}
}
}
TUI Config Editor
Open the configuration editor in the TUI via the command palette (Ctrl+P) and selecting Edit Config or by running /config.
Integration Ecosystem
GitHub Copilot
Use GitHub Models as a provider by connecting through the GitHub API.
GitLab Duo
Connect via the GitLab AI Gateway for GitLab-native code assistance.
Language Server Protocol (LSP)
opencode uses LSP for code intelligence:
- Go to definition
- Find references
- Diagnostics
- Hover information
- Code completion
Configure LSP servers:
{
"lsp": {
"typescript": {
"command": "typescript-language-server",
"args": ["--stdio"]
},
"rust": {
"command": "rust-analyzer"
}
}
}
Model Context Protocol (MCP)
Connect to any MCP-compatible server for additional tools and data sources. See the Integrations guide for details.
Agent Communication Protocol (ACP)
Enable multi-agent coordination through ACP. This allows agents to delegate tasks, share context, and work in parallel.
Subscription Options
OpenCode Zen
A curated model service that provides access to tested, verified models with consolidated billing:
- No separate provider accounts needed
- Optimized model selection for coding tasks
- Single bill at opencode.ai
- Covers model API usage costs
OpenCode Go
A mobile companion app that lets you:
- Monitor sessions remotely
- Receive notifications
- Review session history
Enterprise
For teams and organizations:
- Self-hosted deployment
- Single Sign-On (SSO)
- Audit logging
- Dedicated support
- Usage analytics
- Custom model deployment
What's Next
- CLI Usage -- Full CLI reference
- Terminal UI -- TUI commands and keybinds
- Configuration -- Config file reference
- Agents -- Advanced agent customization
- Integrations -- MCP, LSP, GitHub, GitLab