OpenCode: download, install and use with free and paid models

Contents
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:

Free models on Zen right now (limited-time offers, list changes):

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:

ModelInput / 1MOutput / 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

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:

  1. Type /connect, pick a provider.
  2. For Zen: sign in at opencode.ai/auth (add billing details only for paid models), copy the API key, paste it into the TUI.
  3. For a free Zen model: same flow, no billing details — just connect.
  4. 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:

Troubleshooting

Official sources:

Article author: Andrei Olegovich

Related articles
AI
OpenCode: download, install and use with free and paid models
OpenRouter: one API key for 300+ AI models (account, API, OpenCode, VSCode)

Search this site

Channel @aofeed Chat @aofeedchat

Contacts and cooperation:
I recommend our hosting beget.ru
Write to info@urn.su if you:
1. Want to write an article for our site or translate an article into your native language.
2. Want to place thematically relevant ads on the site.
3. Ads on my site pass maximum censorship. If you see an ad block unsuitable for school-age children, shocking or misleading - please contact us by e-mail
4. Found a mistake, inaccuracy, bug, etc. on the site. ... .......
5. Articles can be shared on social media by clicking a network icon: