| marp | true |
|---|---|
| theme | tessl-cheatsheet |
| paginate | false |
| size | 1400px 1200px |
| style | section { columns: 4; } |
curl -fsSL https://opencode.ai/install | bash
opencodeAlso: brew install sst/tap/opencode or npm i -g opencode-ai. Built by SST. Update with opencode upgrade.
| Command | Description |
|---|---|
opencode |
Start interactive TUI |
opencode run "prompt" |
Non-interactive run |
opencode run --format json |
Machine-readable output |
opencode auth login |
Add a provider |
opencode models |
List available models |
opencode serve |
Headless API server |
opencode upgrade |
Update to latest |
run flags: -c continue, -s session, -m model, --agent, --share.
opencode agent create # Create custom agent
opencode agent list # List all agents
opencode mcp add # Add MCP server
opencode mcp list # List MCP serversCustom agents: markdown in .opencode/agents/ with frontmatter (description, mode, permission).
| Agent | Description |
|---|---|
| build | Primary dev agent (all tools) |
| plan | Read-only; edits/bash ask first |
| @explore | Read-only codebase search |
| @scout | Read-only dependency research |
| @general | Complex multi-step subagent |
Switch primary agents with Tab in TUI.
| Key | Action |
|---|---|
Tab |
Switch agent |
Enter |
Send message |
Ctrl+C |
Cancel/interrupt |
Esc |
Exit menu |
Ctrl+L |
Clear screen |
Global: ~/.config/opencode/opencode.json
Project: opencode.json in project root
Context file: AGENTS.md (run /init to generate)
{
"$schema": "https://opencode.ai/config.json",
"model": "anthropic/claude-sonnet-4-6"
}opencode auth login # interactive, OAuth or API key
opencode auth listIn-TUI: /connect. Anthropic & OpenAI support OAuth (Claude Pro/Max, ChatGPT). Env vars also work:
export ANTHROPIC_API_KEY="sk-ant-..."
export OPENAI_API_KEY="sk-..."Supports 75+ providers via Models.dev (Anthropic, OpenAI, Google, Bedrock, Azure, Groq, OpenRouter).
Select with /models in TUI or -m provider/model:
anthropic/claude-sonnet-4-6openai/gpt-5.1-codexgoogle/gemini-3-pro
opencode github install # scaffold workflow
opencode github run # run agent in CIFor automated PR reviews and issue triage.
/init generate AGENTS.md · /connect add provider · /models switch model · /share link · /undo · /redo
- Interactive terminal UI
- Multi-provider (75+ via Models.dev)
- Subagents (explore, scout, general)
- Headless
serve+ web modes - LSP integration · MCP support
- Use plan agent for exploration first
- Switch to build agent to implement
- Use
opencode run --format jsonfor scripting - Use
@explore/@scoutfor read-only research