Necessary cookies and storage keep you signed in, remember the edition you are reading, and save progress on this device. They stay on. Analytics and advertising stay off until you allow them.

Skip to lesson

Chapter 1 of 6 · 20 min

Setup

You need one thing: OpenCode, the terminal app that runs an AI agent on your computer. It comes with free models, so there's no account, API key or card to set up first. The download takes a minute or two; reading each step and trying it takes longer, and that's normal.

This is the fiddliest part of the guide. If you already have OpenCode, skip to Step 2.

Step 1: Install OpenCode

OpenCode is an open-source AI coding agent that runs in your terminal. It's the interface between you and the model.

New to the terminal? It's a window where you type commands instead of clicking. This guide needs only a handful, and each one is spelled out.

These steps depend on your computer. Which one will you set up?

Install it with one command:

After installation, verify it works. Practise here first: type the command and press Enter.

practice terminal

$ opencode --version

Click here and type the command
Type it, then Enter · Tab fills it in

Your version number may differ; any version number means it worked.

For full installation docs and troubleshooting: https://opencode.ai/docs

Checkpoint

Step 2: Create Your Workspace

Create a folder for general AI sessions - quick questions, analysis, brainstorming - and step into it:

practice terminal

$ mkdir ~/ai-sessions

Click here and type the command
Type it, then Enter · Tab fills it in

This folder is for sessions that don't belong to a specific project. More on why this matters in the next chapter.

Checkpoint

Step 3: Say Hello

Launch OpenCode in your workspace and send it one message. Practise it here, then do it for real:

opencode · practice

$ opencode

Click and start typing: your prompt types itself
Type it, then Enter · Tab fills it in

It answered, and you didn't create an account, paste a key or add a card. OpenCode starts on a free model from OpenCode Zen, OpenCode's own service; yours may have a different name. The tip about /connect is for later.

Checkpoint

Step 4: Pick a Free Model That Keeps No Data

Most free models are free because their makers may use what you send to improve the model. That's fine for a hello, not for your files. A few come from providers that keep nothing and never train on it: today, Space Bunny Free and LongCat 2.5 Preview Free. Free models come and go, so if neither is listed, the privacy section at https://opencode.ai/docs/zen/#privacy names the ones that keep no data.

Type /models, search for the model, press Enter, then Enter again to keep its default settings:

opencode · practice

› /models

Click and start typing: your prompt types itself
Press any keys to type the prompt, then Enter

Your prompt line now names the model you picked, and OpenCode remembers it next time, in any folder. That's the model you'll learn with in the next chapter.

Checkpoint

Important: Your Terminal Directory is Your Context

OpenCode runs wherever you open it. Start opencode inside a project folder and it can read any file in that folder and the folders below it. Start it in an empty folder and there's nothing for it to read.

You don't paste files in or press "add to context" buttons: it lists, searches and reads files on its own as it works. You can still point it at one file by typing @ and the file name. Before it touches anything outside the folder you started it in, it asks.

Your IDE (VS Code, IntelliJ, whatever you already use) is still useful for browsing files and reviewing changes. But the AI interaction happens here, in the terminal.

You can also run the terminal inside your IDE if that's more convenient - doesn't matter at all. However, be careful: some IDEs have their own pre-installed "terminal" plugins which may behave differently from your system terminal. When in doubt, use your system terminal directly.

If Something Goes Wrong

If any step above fails - installation error, OpenCode won't start, no answer comes back - here's your first real AI workflow:

  1. Copy the exact error message
  2. If OpenCode is already running, paste it and ask: "How do I fix this?"
  3. If OpenCode isn't running yet, paste the error into an AI chat in your browser, such as https://claude.ai

This is the pattern you'll use for every error going forward: copy the error, paste it, get a fix. Install errors are common and well documented, so this usually works. If a suggested fix asks you to run a command you don't understand, ask what it does before you run it.

English

Language

Remembered on this device with a cookie.