opencode
TLDR
Launch the interactive TUI
SYNOPSIS
opencode [command] [options] [project]
DESCRIPTION
OpenCode is an open-source AI coding agent that runs in your terminal, desktop, or IDE. It provides Claude-Code-level capabilities without locking you to a single model or platform, supporting over 75 AI models including Claude, GPT, Gemini, and local models.
The default TUI mode offers an interactive chat interface with two built-in agents: build (full access for development) and plan (read-only for analysis). Switch between them with the Tab key. OpenCode integrates with Language Server Protocol for code intelligence and connects to your GitHub workflow for CI/CD automation.
Unlike cloud-based assistants, OpenCode gives you control over your data. You choose the model provider and what gets shared. Running a local model keeps your entire workflow private.
PARAMETERS
--model, -m PROVIDER/MODEL
Specify the AI model to use (e.g., anthropic/claude-sonnet-4, openai/gpt-4o)--continue, -c
Resume the last session--session, -s ID
Continue a specific session by ID--prompt TEXT
Provide an initial prompt when launching--agent NAME
Select a specific agent (build, plan, or custom)--port NUMBER
Server port for web or serve commands--help, -h
Display help information--version, -v
Show version number
COMMANDS
run
Execute a prompt non-interactively and exitserve
Start a headless server for API accessweb
Launch the web interface with HTTP serverattach
Connect TUI to a remote OpenCode serverauth login
Configure API keys for providersmodels
Display all available models across configured providerssession list
Show all saved sessionsstats
View token usage and cost analyticsmcp add
Register an MCP (Model Context Protocol) server
CAVEATS
Requires API keys for cloud model providers (configured via opencode auth login). Token usage can be significant for large codebases. The tool defaults to launching a TUI which requires a compatible terminal emulator.
HISTORY
OpenCode was created by Jay V, Frank Wang, Dax Raad, and Adam Elmore from the team behind SST (Serverless Stack). It launched on June 19, 2024 in response to the rise of proprietary AI coding assistants. The project grew to 650,000 monthly users within five months and has over 70,000 GitHub stars. It is released under the MIT license.


