OpenCode Install Guide 2026: Setup in 5 Minutes on Windows, Mac and Linux

๐Ÿ“˜ Tutorials 2026-08-01 2 min read

OpenCode is the hottest open-source coding agent, but install docs assume you know the ecosystem. Here is the exact setup.

💡 What You Will Learn

OpenCode is the hottest open-source coding agent, but install docs assume you know the ecosystem. Here is the exact setup.

📜 Table of Contents

OpenCode Install Guide 2026: Setup in 5 Minutes on Windows, Mac and Linux

OpenCode is an open-source AI coding agent for the terminal (191,500 GitHub stars). This guide walks through installation on all three platforms and connecting your first model.

Prerequisite: Node.js 20+

node --version

OpenCode is distributed via npm. Install Node.js LTS if missing.

Install

npm install -g opencode

That is the whole install. Verify:

opencode --version

Connect a Model

On first run, OpenCode asks which provider to use. Three fastest paths:

Path A - Anthropic (best quality):

opencode auth login
# follow the browser prompt to authorize

Path B - OpenRouter (one key, many models):

export OPENROUTER_API_KEY=sk-or-...
opencode --model openrouter/anthropic/claude-sonnet-4

Path C - Free local model via Ollama:

ollama pull qwen2.5-coder:7b
opencode --model ollama/qwen2.5-coder:7b

First Session

cd /path/to/your/project
opencode

Type a task: "explain the architecture of this repo and add a test for the auth module". OpenCode reads the repo, proposes changes, and asks for approval before editing.

Useful Flags

Flag Purpose
opencode --model Choose model per session
opencode --help All options
opencode sessions List previous sessions
opencode --print Non-interactive output (scripting)

FAQ

Does OpenCode work on Windows? Yes, native Windows via Node. Some MCP servers prefer WSL2, but core features work fine.

How much does it cost? The tool is free; you pay model API usage (a few cents per session with small models).

Can I use it with VS Code? Yes, there is a VS Code extension that embeds OpenCode.

❓ FAQ

Does OpenCode work on Windows?

Yes, native Windows via Node. Some MCP servers prefer WSL2, but core features work fine.

How much does it cost?

The tool is free; you pay model API usage (a few cents per session with small models).

Can I use it with VS Code?

Yes, there is a VS Code extension that embeds OpenCode.

Related Articles
2026-07-17
AI Agent Performance Benchmark 2026
2026-07-27
LoRA vs QLoRA Fine-Tuning 2026: Which Method Should You Use?
2026-08-14
Real-Time AI Voice Changer Local 2026: Free Setup for Discord and Games

Written by our editorial team; tools listed here are tested or verified against public sources. Links point to official sites or GitHub repos for reference only โ€” no paid placements.

๐Ÿ’ฌ Comments (0)

No comments yet. Be the first!

Login to comment