Module 3 · Page 7 of 7 · 10 minutes

Appendix: OpenCode

Claude Code is this course's tool of choice, but it isn't the only agent that runs in a terminal. OpenCode is a free, open-source alternative worth knowing about. This page is optional — read it if you're curious how another tool compares, or skip ahead to Module 4.

What you'll be able to do

Install OpenCode, launch it from VS Code's integrated terminal, connect it to a model provider, and know how it differs from Claude Code.

OpenCode vs Claude Code

OpenCode and Claude Code solve the same basic problem — an AI agent that reads and edits files from a terminal — but they're built with different priorities. OpenCode is provider-agnostic: it can connect to Anthropic's models, but also OpenAI's, Google's, or a dozen others, which makes it a low-cost way to try several providers before committing to one. Claude Code is built by Anthropic specifically for Claude, and trades that flexibility for deeper project features — Skills, sub-agents, and hooks among them.

Aspect OpenCode Claude Code
Model support Many providers — Anthropic, OpenAI, Google, and others Anthropic's models only, tightly integrated
Getting started Pick a provider and go One account, one login, more built-in structure
Cost Free by default (OpenCode Zen); paid providers optional Requires at least a Claude Pro subscription, or a metered API key
Project features File, command, and web access Adds Skills, sub-agents, hooks, and other collaboration tools

Step 1: Install OpenCode

You already have Node.js installed from earlier in this module, so either command below will work regardless of OS. Mac users can also use Homebrew.

macOS (Homebrew):

brew install anomalyco/tap/opencode

macOS or Windows (npm):

npm install -g opencode-ai

Verify:

opencode --version

Step 2: Launch it from a terminal

Open a terminal (such as your computer's default terminal or the VS Code one), then run:

opencode

The interface will look like this:

OpenCode's terminal interface just after launching: the OpenCode logo, an 'Ask anything...' input box, and a status line reading 'Build · Big Pickle · OpenCode Zen'.
OpenCode right after launch — the default provider is OpenCode Zen, free to start. Run /connect to add another one.

(Optional) Step 3: Connect a model provider

Unlike Claude Code, OpenCode doesn't come wired to one company. You can choose which provider to talk to:

/connect
OpenCode's 'Connect a provider' picker: a searchable list under a Popular heading with OpenCode Zen (Recommended), OpenCode Go, OpenAI, GitHub Copilot, and Anthropic (API key).
The provider picker that opens after running /connect — Anthropic is one option among several.

You can also choose to work in the default option without connecting to a provider. This approach does not require logins or an API key.

Step 4: Try a prompt

Try starting a conversation by asking it something — for example:

what is the weather in Madison
OpenCode answering 'what is the weather in Madison': it thinks briefly, runs a parallel web search for 'current weather Madison Wisconsin,' then reports temperature, conditions, wind, humidity, UV index, and a two-day forecast.
A weather prompt in action — OpenCode searches the web and returns a forecast.

Useful commands

Type / in the input box to see the full list with autocomplete. The ones you'll reach for most:

Command What it does
/connect Add or switch a model provider
/models View and switch which model you're talking to
/new Start a fresh conversation, no prior context
/compact Compress a long conversation once it's eating too many tokens
/sessions Browse past conversations
/undo / /redo Revert or restore file changes (needs Git)
/init Generate a project instructions file, similar to Claude Code's CLAUDE.md
/help Show the full command list
/exit Quit OpenCode
Next · Module 4
The vibecoding workflow