Skip to main content
Get OpenCode running on your first project in under 5 minutes.

Install OpenCode

1

Install via script

The fastest way to install OpenCode:
curl -fsSL https://opencode.ai/install | bash
Or use your preferred package manager:
npm install -g opencode-ai
2

Verify installation

Check that OpenCode is installed:
opencode --version
For Windows users, we recommend using WSL for the best experience.

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:
cd ~/my-project
opencode
2

Connect to a provider

In the OpenCode interface, run:
/connect
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.
┌ API key
│ [paste your key]
└ enter
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:
/init
This command:
  • Analyzes your project structure
  • Identifies coding patterns
  • Creates an AGENTS.md file with project context
Commit the generated AGENTS.md file to version control so your team benefits from the same context.

Start Coding

You’re ready! Here are some things you can try:

Ask Questions

Ask OpenCode about your codebase:
How does authentication work in this project?
Use @ to reference specific files:
Explain the logic in @src/auth/login.ts

Make Changes

Request code modifications:
Add error handling to the login function
Switch to Plan mode (press Tab) to review changes before applying them.

Run Commands

Execute bash commands with !:
!npm test
Or use slash commands:
/undo    # Revert the last change
/redo    # Reapply a reverted change
/share   # Share the current conversation

Keyboard Shortcuts

ShortcutAction
TabSwitch between Build and Plan agents
@Reference a file
!Run a bash command
/Execute a slash command
Ctrl+CCancel current operation
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

Check the installation with opencode --version. If it’s not found, ensure the installation directory is in your PATH.See Troubleshooting for common issues.
Verify your API key is valid and you have credits available. Run /connect again to reconfigure.Check Providers for provider-specific setup.
Use /undo to revert changes. Switch to Plan mode (Tab) to review suggestions before applying them.Learn more about Modes and Permissions.
Need more help? Join our Discord community or check the FAQ.