How to Use OpenCode in 2026: Features, Pricing, Setup, and Best Practices
Learn how to use OpenCode, the open-source AI coding agent for terminal, desktop, and IDE workflows. This guide covers setup, models, OpenCode Zen pricing, agents, permissions, commands, MCP, advantages, and practical prompts.

quick answer
OpenCode is an open-source coding agent designed to work with your repository, terminal, tools, and preferred model provider. It is not a single chatbot subscription: the interface is open source, while model access and usage are configured separately.
The fastest path is to get one small project working before you customize the entire setup.
Install OpenCode
Use curl -fsSL https://opencode.ai/install | bash, or install the npm package globally with npm install -g opencode-ai. On Windows, the official docs recommend WSL for the best compatibility; Chocolatey, Scoop, npm, Docker, and prebuilt releases are also documented.
Open your project
Run cd /path/to/project, then launch opencode. Start from a Git branch or a clean working tree so every change is easy to review.
Connect a model provider
Run /connect in the TUI. You can choose OpenCode Zen or configure a provider such as Anthropic, OpenAI, Google, or another supported service with your own API key.
Initialize the repository
Run /init. OpenCode analyzes the project and creates an AGENTS.md file with repository-specific context. Review it and commit it when it reflects your real conventions.
Ask for a bounded first task
Try a small request such as explaining one module, adding a test for one function, or fixing one reproducible bug. Give the relevant file path, expected behavior, constraints, and the command that verifies success.
A reliable first prompt
Inspect @src/auth/session.ts. Explain how refresh tokens work, identify one security risk, and propose a minimal fix. Do not edit files yet; include the test command you would run.
Plan and Build modes
Plan mode lets the agent inspect the project and propose an implementation without changing files. Switch to Build mode when the approach is clear. This is especially useful for migrations, authentication, and cross-file refactors.
Multiple providers and models
OpenCode separates the coding interface from the model provider. You can compare models for reasoning, speed, cost, or long-context work instead of rebuilding your workflow each time.
Agents and subagents
Built-in and custom agents can specialize in building, planning, exploration, documentation, or code review. Subagents are useful for isolated research and repeatable roles.
Custom commands
Create commands such as /test, /review, or /release-notes in .opencode/commands/. A command can include a reusable prompt, arguments, an agent, and a model.
MCP, LSP, and tools
OpenCode can be extended with MCP servers, language-server features, web access, and project tools. Add only the tools a workflow actually needs and keep their permissions narrow.
Undo, redo, and share
Use /undo and /redo while iterating. /share creates a link to a conversation when you intentionally want to share it; conversations are not shared by default.
OpenCode itself is open source. Your bill depends on the model provider and the way you connect it. OpenCode Zen is optional and uses pay-as-you-go billing per one million tokens, not a single flat monthly subscription.
| Route | How it works | Best for |
|---|---|---|
| Bring your own key | Connect a provider directly and pay that provider's API rate. | Teams with existing cloud or model accounts and their own budgets. |
| OpenCode Zen | Use a tested and verified model catalog. Pricing is per 1M input/output tokens and varies by model. | People who want a simpler starting point and a curated provider experience. |
| Free Zen models | The Zen page currently lists several free models, marked as available for a limited time. | Learning, experiments, and low-risk prototypes; do not assume availability is permanent. |
Think of OpenCode as the open-source workbench. The model route is a separate choice: your own API key, OpenCode Zen, or a temporarily free model.
Section pricing screenshotThe strongest OpenCode workflow looks more like a careful engineering process than a one-line prompt.
Give the agent a clear outcome
Describe what should be true when the task is finished, not only the file you want edited.
Reference files with @
Point OpenCode at the relevant implementation, tests, types, and examples instead of making it search an entire monorepo blindly.
Plan risky work first
Use Plan mode for database changes, auth, payments, public APIs, large refactors, and unfamiliar code.
Require verification
Ask OpenCode to run the narrowest relevant test, typecheck, linter, or build and report failures instead of claiming success.
Set permissions intentionally
Use allow, ask, and deny rules for read, edit, bash, task, web access, and external directories. Keep destructive commands behind approval.
Keep AGENTS.md current
Treat project instructions as living documentation: architecture, commands, style, testing expectations, and things the agent must never do.
Great fit
Understanding unfamiliar code, implementing small-to-medium features, generating tests, debugging reproducible failures, refactoring, writing docs, reviewing diffs, and automating repeatable repository tasks.
Use extra review
Authentication, payments, migrations, security fixes, concurrency, infrastructure, and anything that changes user data. Let OpenCode accelerate the work, but make the final engineering decision yourself.
Poor fit
Vague product direction, unsupervised production changes, secrets pasted into prompts, or tasks where nobody can explain the expected behavior and verification criteria.
OpenCode is open source, but model usage may cost money. You can bring your own provider key, use OpenCode Zen pay-as-you-go, or try the free models listed by Zen while they are available.
Yes. The official documentation recommends WSL for the best Windows experience. Chocolatey, Scoop, npm, Docker, and prebuilt releases are also listed installation routes.
OpenCode Zen is an optional curated gateway with models tested and verified by the OpenCode team. It charges per request using token-based pricing.
Yes, when the relevant tools and permissions allow it. Configure permissions so reading, editing, shell commands, subagents, and external directories have the level of approval your project requires.
Open the project directory, run `opencode`, connect a provider with `/connect`, then run `/init`. After that, give OpenCode a bounded task with file references and a verification command.
Related Articles
AI Assistant Development Cost in 2026: RAG Chatbots, CRM Integrations, Guardrails, and Support
A practical buyer guide to AI assistant development cost in 2026: prototypes, RAG chatbots, knowledge-base assistants, CRM and website integrations, guardrails, evaluations, monitoring, and support.
AI-assisted attacks and prompt injection in 2026: the new attack surface for AI products
AI-assisted attacks and prompt injection in 2026: the new attack surface for AI products. A practical PAS7 Studio security guide with threat model, controls, rollout checklist, pitfalls, and sources.
AI for landing page development: where it speeds up launches and where it hurts conversion
A practical research piece on using AI for landing page development: v0, Webflow AI, Builder.io, Framer-like builders, UX generation, copy, SEO, personalization, A/B testing, template risk, accessibility, security and technical debt.
AI SEO / GEO in 2026: Your Next Customers Aren’t Humans — They’re Agents
Search is shifting from clicks to answers. Bots and AI agents crawl, cite, recommend, and increasingly buy. Learn what AI SEO / GEO means, why classic SEO is no longer enough, and how PAS7 Studio helps brands win visibility in the agentic web.
Professional development for your business
We create modern web solutions and bots for businesses. Learn how we can help you achieve your goals.