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

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.

## 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+ ```bash node --version ``` OpenCode is distributed via npm. Install Node.js LTS if missing. ## Install ```bash npm install -g opencode ``` That is the whole install. Verify: ```bash opencode --version ``` ## Connect a Model On first run, OpenCode asks which provider to use. Three fastest paths: **Path A - Anthropic (best quality):** ```bash opencode auth login # follow the browser prompt to authorize ``` **Path B - OpenRouter (one key, many models):** ```bash export OPENROUTER_API_KEY=sk-or-... opencode --model openrouter/anthropic/claude-sonnet-4 ``` **Path C - Free local model via Ollama:** ```bash ollama pull qwen2.5-coder:7b opencode --model ollama/qwen2.5-coder:7b ``` ## First Session ```bash 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.
Related Articles
2026-06-29
The Mainline Dragon Strategy โ€” Chasing the Leader Without Paying for Data
2026-06-29
The AI Hiding in Your Laptop
2026-07-14
Free AI Coding Assistant Setup 2026: 5-Min VS Code Guide (Continue, Copilot, Windsurf)

๐Ÿ’ฌ Comments (0)

No comments yet. Be the first!

Login to comment