Install OpenCode
1
Install via script
The fastest way to install OpenCode:Or use your preferred package manager:
2
Verify installation
Check that OpenCode is installed:
Configure a Provider
OpenCode works with any LLM provider. We recommend starting with OpenCode Zen for a curated experience.1
Start OpenCode
Navigate to any directory and launch OpenCode:
2
Connect to a provider
In the OpenCode interface, run:Select opencode (Zen) from the provider list.
3
Get your API key
Visit opencode.ai/auth, sign in, and copy your API key.
4
Paste the API key
Return to OpenCode and paste your API key when prompted.
You can also configure other providers like Anthropic, OpenAI, or local models. See Providers for more options.
Initialize Your Project
Help OpenCode understand your codebase by initializing it:- Analyzes your project structure
- Identifies coding patterns
- Creates an
AGENTS.mdfile with project context
Start Coding
You’re ready! Here are some things you can try:Ask Questions
Ask OpenCode about your codebase:@ to reference specific files:
Make Changes
Request code modifications:Tab) to review changes before applying them.
Run Commands
Execute bash commands with!:
Keyboard Shortcuts
See Keybinds for the complete list.
Next Steps
Core Concepts
Learn about agents, modes, and tools
Configuration
Customize OpenCode for your workflow
CLI Reference
Explore all CLI commands
Integrations
Connect LSP servers, MCP, GitHub, and more
Getting Help
OpenCode won't start
OpenCode won't start
Check the installation with
opencode --version. If it’s not found, ensure the installation directory is in your PATH.See Troubleshooting for common issues.Can't connect to provider
Can't connect to provider
Verify your API key is valid and you have credits available. Run
/connect again to reconfigure.Check Providers for provider-specific setup.Changes aren't working as expected
Changes aren't working as expected
Use
/undo to revert changes. Switch to Plan mode (Tab) to review suggestions before applying them.Learn more about Modes and Permissions.