Getting Started with OpenCode: The Open-Source Alternative to Claude Code
A complete guide to installing and using OpenCode — the open-source, terminal-native AI coding assistant that supports 75+ LLM providers as a powerful alternative to Claude Code.
April 6, 2026
·
6 min read
If you have been using Claude Code and love the terminal-based AI coding experience but wish you had more flexibility — different models, open-source transparency, and no vendor lock-in — OpenCode is worth your attention.
Built by the SST team, OpenCode is an open-source, terminal-native AI coding assistant that supports 75+ LLM providers including Anthropic, OpenAI, Google, and local models via Ollama. This guide walks you through installation, configuration, and daily usage.
Once inside the TUI, you interact with OpenCode conversationally:
> Fix the TypeScript error in src/utils/auth.ts
> Write unit tests for the UserService class
> Refactor the database queries to use connection pooling
> Explain what this function does and suggest improvements
OpenCode can read, write, and edit files directly:
> Read the file src/app/page.tsx and explain the routing logic
> Create a new API endpoint at src/app/api/users/route.ts
that handles GET and POST requests
> Update the README.md with installation instructions
OpenCode can execute terminal commands on your behalf:
> Run the test suite and fix any failures
> Install the zod package and add schema validation
to the API routes
> Start the dev server and check for compilation errors
OpenCode uses per-agent glob patterns for MCP, meaning you can control which tools are available to which conversations — giving you more granular control than Claude Code's approach.
# Complex architecture decisions — use the strongest modelopencode --model claude-4-5-sonnet-20260101
# Quick fixes and simple tasks — use a faster/cheaper modelopencode --model claude-4-5-haiku-20260101
# Privacy-sensitive code — use a local modelopencode --provider ollama --model qwen2.5-coder:32b
Tailor OpenCode's behavior per project by adding instructions to your config:
{"instructions":"This is a Next.js 16 project using TypeScript, Tailwind CSS, and Payload CMS. Always use server components by default. Follow the existing code style."}
OpenCode's client/server architecture means sessions can persist even when you close the terminal. The SST team is building toward Workspaces that survive across sessions — a feature Claude Code's simpler CLI cannot support.
OpenCode brings the power of agentic AI coding to your terminal without locking you into a single provider. Its open-source nature, 75+ model support, and client/server architecture make it a compelling choice for developers who value flexibility and control.
Install it, point it at your preferred LLM provider, and start coding. The learning curve is minimal if you have used Claude Code before — the core experience is familiar, just with more options.