Module 2: Installing & First Run¶
What you'll learn:
- OpenCode Zen free models vs. OpenCode Go premium
- API key setup and /connect
- The OpenCode TUI and keyboard shortcuts
- The /init command and AGENTS.md
- Your first real task: fix a typo
What is an LLM Provider?¶
A service that hosts language models and gives you access to them via an API key.
OpenCode uses OpenCode Zen as its built-in model gateway.
Two tiers: 1. OpenCode Zen — Free models, no credit card required 2. OpenCode Go — Premium models via subscription
Option 1: OpenCode Zen (Free)¶
What: Free models hosted by OpenCode
Access: Free account at opencode.ai/auth
Cost: $0
Best for: Learning. All labs through Module 8.
Models: Big Pickle, GPT 5 Nano, MiniMax M2.5 Free, and more.
Option 2: OpenCode Go (Premium)¶
What: Premium open-source models via subscription
Access: Same Zen API key, Go models appear automatically
Cost: $5 first month, then $10/month
Best for: Advanced modules, production work, faster responses.
Models: Kimi K2.6, GLM-5.1, DeepSeek V4 Pro, and more.
Sign up: opencode.ai/go
Free vs. Premium¶
| Aspect | Zen Free | OpenCode Go |
|---|---|---|
| Cost | $0 | $5 first month, then $10/mo |
| Setup | Free account at opencode.ai/auth |
Subscribe at opencode.ai/go |
| Best for | Learning all modules | Advanced work (Module 7+) |
| For this course | Use Zen free API key | Optional upgrade later |
Why Zen? Built-in gateway, no provider setup, works immediately with OpenCode.
The OpenCode TUI¶
What: Terminal interface for conversation + file editing + commands
Layout:
- Top: Message history
- Bottom: Input box
- Right: Mode switcher [plan | build]
Key shortcuts:
- Enter — Send prompt
- Tab — Switch modes
- Ctrl+C — Interrupt
- Ctrl+L — Clear screen
The Two Modes¶
Plan Mode¶
- Read-only
- Can investigate, ask questions
- No approval prompts
- Safe to explore
Build Mode¶
- Full access (read, edit, run bash)
- Will ask approval for dangerous ops
- Use after planning
- For making changes
Workflow: Plan first → Build second
The /init Command¶
What: Analyzes your project and generates AGENTS.md
What AGENTS.md contains: - Project type (Node.js? Python? Rust?) - Key directories (src/, tests/, docs/) - Code style conventions (Prettier? ESLint?) - What NOT to do (boundaries)
Why: Agent knows your project without you describing it every time
How to use it: Type /init in OpenCode input, press Enter
What AGENTS.md Looks Like¶
# Project Conventions for [Project Name]
## Context
This is a Node.js application for [purpose].
## Key Directories
- `src/` — Source code
- `tests/` — Test files (Jest)
## Conventions
- Code style: ESLint + Prettier
- Testing: Jest (npm test)
## Out of Bounds
- Do not modify package.json
- Do not run npm install without asking
After /init runs: Read it aloud. Did the agent understand your project?
Your First Task¶
Scenario: Fix a typo in src/index.js
- Wrong: consoel.log()
- Right: console.log()
Steps:
1. Install OpenCode
2. Get free API key at opencode.ai/auth
3. Run /connect → select OpenCode Zen → paste key
4. Run opencode
5. Ask agent to find the typo (plan mode)
6. Ask agent to fix it (build mode)
7. Verify: grep console.log src/index.js
Cost & Budget¶
For this hands-on course: - Modules 1–3: ~$2–3 - Modules 4–6: ~$5–10 - Modules 7–10: ~$10–20 - Total: ~$20–30
Model choice matters:
- opencode/big-pickle (Zen Free): Good default, capable
- opencode/gpt-5-nano (Zen Free): Lightweight, fast
- opencode-go/kimi-k2.6 (Go Premium): Powerful, thoughtful
Pro tip: You can swap models mid-course with /model.
Common Questions¶
Q: Can I use OpenCode without an API key? A: No — both Zen and Go require an API key. Zen is free to sign up.
Q: Do I pay for every keystroke? A: No. Only when you press Enter and send a prompt.
Q: What if I'm offline? A: You'd need a local provider like Ollama. This is advanced — most learners use Zen online models.
Q: Can I switch models later?
A: Yes. Run /models to see options, then /model <name> to switch.
Module 2 Labs¶
Lab 1: Install OpenCode + provider key. Fix a typo end-to-end.
Lab 2: Run /init on a real open-source project. Read AGENTS.md aloud.
Reflection: When did the agent get it wrong? Why?
Next Module: Plan vs. Build¶
In Module 3, you'll learn to use plan mode deeply: - How to explore codebases safely - When to stay in plan mode (code review, audits) - How to write better prompts for exploration
For now: Install. Get a key. Run your first task.