Skip to content
OpenCode
Esc
navigateopen⌘Jpreview
On this page

Intro

Get started with OpenCode.

Install

You can also install it with the following package managers.

npm install -g @opencode-ai/cli@next
bun install -g --trust @opencode-ai/cli@next
pnpm add -g --allow-build=@opencode-ai/cli @opencode-ai/cli@next
yarn global add @opencode-ai/cli@next

The package uses a trusted postinstall script to select the native binary for your platform. The Bun and pnpm commands above explicitly allow that script to run.

Homebrew

Homebrew installation is not available in beta.

Arch Linux

Arch Linux installation is not available in beta.

Windows

Chocolatey installation is not available in beta.

Scoop installation is not available in beta.

Mise installation is not available in beta.

Docker installation is not available in beta.

Standalone binaries are not available in beta.


Prerequisites

To use OpenCode in your terminal, you’ll need:

  1. A modern terminal emulator like:
  2. API keys for the LLM providers you want to use.

Connect

With OpenCode you can use any LLM provider by configuring its API key.

Run /connect in the TUI and select your provider.

/connect

If you’d like easy access to all the best coding models you can try out OpenCode Console.

You can also try OpenCode Go a $10/month subscription plan that grants you access to the best open source models.

Use /models to browse the providers and models available to your project. See Providers for connection and configuration details.


Usage

You are now ready to use OpenCode in your project. Here are a few common workflows.

Ask questions

Ask OpenCode to explain your codebase.

How is authentication handled in @packages/functions/src/api/index.ts

Add features

Ask OpenCode to add a feature by describing the desired behavior and providing relevant context.

When a user deletes a note, flag it as deleted in the database.
Create a screen that shows recently deleted notes.
From this screen, the user can restore a note or permanently delete it.

Undo changes

Use /undo when a change isn’t what you wanted.

/undo

OpenCode stages a conversation revert and restores your original message so you can revise it. In a Git repository, it also restores file changes when snapshots were captured successfully. Run /undo multiple times to move the conversation boundary back, or use /redo to restore the staged conversation and files. See Undo for limitations and safety details.

/redo

Customize

Make OpenCode your own by picking a theme, customizing keybinds, configuring formatters, creating commands, or editing the OpenCode config.

Was this page helpful?