Skip to content

Latest commit

 

History

History
105 lines (77 loc) · 2.05 KB

File metadata and controls

105 lines (77 loc) · 2.05 KB
marp true
theme tessl-cheatsheet
paginate false
size 1400px 1200px

OpenCode Cheat Sheet

Installation

curl -fsSL https://opencode.ai/install | bash
opencode

Also: brew install opencode or npm i -g opencode-ai

CLI Commands

Command Description
opencode Start interactive TUI
opencode -p "prompt" Non-interactive mode
opencode -p "..." -q Quiet mode (scripting)
opencode auth Manage credentials
opencode models List available models
opencode update Update to latest

Agent Commands

opencode agent new    # Create custom agent
opencode agent list   # List all agents
opencode mcp add      # Add MCP server
opencode mcp list     # List MCP servers

Built-in Agents

Agent Description
build Full dev agent (read/write/exec)
plan Analysis & exploration (read-only)
@general Complex multi-step subagent

Switch agents with Tab in TUI.

Keyboard Shortcuts

Key Action
Tab Switch agent
Enter Send message
Ctrl+C Cancel/interrupt
Esc Exit menu
Ctrl+L Clear screen

Configuration

Config: ~/.opencode/config.json Project: .opencode/ folder or OPENCODE.md

Provider Setup

# Anthropic
export ANTHROPIC_API_KEY="sk-ant-..."

# OpenAI
export OPENAI_API_KEY="sk-..."

# Google
export GOOGLE_API_KEY="..."

Supports: OpenAI, Anthropic, Google, AWS Bedrock, Groq, Azure, OpenRouter

GitHub Actions

opencode github  # Run GitHub agent for CI

For automated PR reviews and issue triage.

Features

  • Interactive TUI (Bubble Tea)
  • Multi-provider support
  • Vim-like editor bindings
  • Session persistence (SQLite)
  • LSP integration
  • MCP server support

Tips

  • Use plan agent for exploration first
  • Switch to build agent to implement
  • Use -q flag for scripting
  • Use @general for complex searches
Tessl · OpenCode Cheat Sheet · __VERSION__