OpenCode: download, install and use with free and paid models
| Introduction | |
| Free vs paid models | |
| Download and install | |
| Connect a model | |
| Use OpenCode daily | |
| Troubleshooting |
Introduction
OpenCode is a free open-source AI coding agent. It lives in your
terminal (plus a desktop app and IDE extensions), reads and edits your
files, runs shell commands, and works through tasks step by step.
The pricing model is simple: OpenCode itself costs nothing. You pay only
for the model tokens you burn — and you can also burn zero, with free
models. OpenCode talks to 75+ providers, so you are never locked to one
vendor.
Free vs paid models
Two free paths, no credit card:
- Zen free models. OpenCode Zen is the team curated gateway of tested models. A rotating set is free for a limited time (feedback collection). No billing details needed for the free tier.
- Local Ollama. Run a model on your own machine — fully private, works offline. See Qwen: download, install, fine-tune and use.
Free models on Zen right now (limited-time offers, list changes):
- big-pickle
- space-bunny-free
- longcat-2.5-preview-free
- exo-free
- fledge-alpha-free
- mimo-v2.6-flash-free
- mimo-v2.5-free
- ling-3.1-flash-free
- ling-3.0-flash-fin-free
- nemotron-3-ultra-free
- nemotron-3.5-lightning-free
- muse-spark-1.3-contributor-free
- jev-1.13-free
Free-period privacy: most free models follow zero-retention, but some providers may use free-tier prompts to improve their models. Never send secrets or customer data to a free endpoint — check the Zen privacy notes first.
Paid paths, when you need maximum quality:
- Zen pay-as-you-go. Per-request billing, credits on your account, monthly limits and auto-reload available. Example prices per 1M tokens (October 2026 — verify in the docs, they move):
| Model | Input / 1M | Output / 1M |
|---|---|---|
| GPT 5 Nano | $0.05 | $0.40 |
| DeepSeek V4 Flash | $0.14 | $0.28 |
| Kimi K2.5 | $0.60 | $3.00 |
| GPT 5.4 Mini | $0.75 | $4.50 |
| Claude Sonnet 4.5 | $3.00 | $15.00 |
| GPT 5.5 | $5.00 | $30.00 |
- Your own provider keys. Paste an Anthropic, OpenAI, Google, or any other provider key — tokens are then billed by that provider, not by Zen. The practical way to hold many models under one key is OpenRouter: a single key for 300+ models through an OpenAI-compatible API, connected the same way via /connect.
Download and install
Recommended: the install script (Linux / macOS / WSL2)
curl -fsSL https://opencode.ai/install | bash
With npm (any OS with Node.js)
npm install -g opencode-ai
With Homebrew (macOS and Linux)
brew install anomalyco/tap/opencode
On Windows: Chocolatey
choco install opencode
On Windows: Scoop
scoop install opencode
With Docker (no install at all)
docker run -it --rm ghcr.io/anomalyco/opencode
On Arch Linux
sudo pacman -S opencode
Check it works:
opencode --version
Connect a model
Start OpenCode anywhere and run /connect:
opencode
Then inside the TUI:
- Type /connect, pick a provider.
- For Zen: sign in at opencode.ai/auth (add billing details only for paid models), copy the API key, paste it into the TUI.
- For a free Zen model: same flow, no billing details — just connect.
- For Ollama: make sure ollama serve runs locally, then connect the Ollama provider.
List the models available to you:
/models (typed inside the TUI)
Pin a default model in opencode.json so every session starts with it. Minimal example (Zen model id format is opencode/<model-id>):
{ "model": "opencode/gpt-5.5" }
Use OpenCode daily
Go to your project and start:
cd /path/to/project
opencode
Let OpenCode learn the project (creates AGENTS.md — commit it):
/init (typed inside the TUI)
Core workflow:
- Ask about code. Press @ to fuzzy-find files, e.g. ask how authentication works in a specific module.
- Plan first. Hit Tab for Plan mode (no edits, only a proposal), describe the feature like to a junior developer, iterate, then Tab back to Build mode.
- Undo freely. /undo reverts the last change (repeatable), /redo brings it back.
- Share. /share creates a link to the session for your team. Nothing is shared by default.
Troubleshooting
- Command not found after install: restart the terminal (PATH update) or rerun the install script; with npm check that the global bin dir is on PATH.
- No models listed: you skipped /connect — run it and paste a key. For Ollama, confirm ollama serve and ollama list show your model.
- Free model gone: free Zen models rotate — run /models and pick another -free id, or fall back to local Ollama.
- Unexpected charges: set a monthly limit in Zen billing and review per-request usage; session-title generation uses cheap models and shows up in history.
- Weak answers: switch to a stronger paid model for hard tasks, keep a free/flash model for questions and drafts.
Official sources:
- opencode.ai
- opencode.ai/docs
- opencode.ai/docs/zen
- github.com/anomalyco/opencode
- openrouter.ai
Article author: Andrei Olegovich
| AI | |
| OpenCode: download, install and use with free and paid models | |
| OpenRouter: one API key for 300+ AI models (account, API, OpenCode, VSCode) |