Skip to main content

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

CategoryExamples
Major cloudAnthropic, OpenAI, Google Gemini, AWS Bedrock, Azure OpenAI, GCP Vertex AI
Inference platformsGroq, Together AI, OpenRouter, Fireworks AI, Replicate
Code-specializedGitHub Models, GitLab Duo, CodeGemma
Open-source hostsOllama, llama.cpp, vLLM, LocalAI, Text Generation Inference
Custom endpointsAny 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:

BindingAction
Ctrl+PCommand palette
Ctrl+X CCompact session
Ctrl+X EOpen in editor
Ctrl+X QExit
Ctrl+X XExport session
Ctrl+X MList models
Ctrl+X NNew session
Ctrl+X RRedo
Ctrl+X UUndo
Ctrl+X LList sessions
Ctrl+X TTheme selector
TabSwitch 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

CommandAction
/connectManage provider connections
/compactCompress session history
/detailsShow session details
/editorEdit the current prompt in $EDITOR
/exitExit opencode
/exportExport session to file
/helpShow help
/initInitialize project context
/modelsList and switch models
/newStart new session
/redoRedo undone changes
/sessionsList all sessions
/shareShare session
/unshareUnshare session
/themesBrowse themes
/thinkingToggle thinking mode
/undoUndo 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:

SubagentRole
GeneralGeneral Q&A, research, and exploration
ExploreNavigate and inspect codebases
ScoutLightweight 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

ToolDescriptionSafety
bashExecute arbitrary shell commandsConfigurable allow/block lists
editApply targeted string replacements to filesAuto-snapshotted
writeCreate new filesAuto-snapshotted
readRead file contentsRead-only
grepSearch file contents with regular expressionsRead-only
globMatch file paths using glob patternsRead-only
lspQuery language server for diagnostics, definitions, referencesRead-only
apply_patchApply unified diff patches to filesAuto-snapshotted
skillLoad specialized skill instructionsRead-only
todowriteTrack progress on multi-step tasksInternal
webfetchFetch and return web page contentNetwork
websearchSearch the web for informationNetwork
questionAsk the user for clarificationInteractive

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:

  1. opencode.json or .opencode.json in the project root
  2. ~/.config/opencode/opencode.json (user-level)
  3. /etc/opencode.json (system-level)
  4. 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