The landscape of software development is evolving rapidly, and OpenCode is leading the charge for terminal-based automation. Designed to go far beyond simple autocomplete, OpenCode is an open-source AI coding agent built directly for your terminal.Originally, a Go-based version existed but was archived in September 2025. Today's active project—built by Anomaly (formerly SST) on TypeScript and Bun—boasts around 189,000 GitHub stars and operates under the MIT license. It can navigate your repository, draft execution plans, edit files, and respond to compiler errors autonomously. Better yet, it is strictly model-agnostic, meaning you aren't locked into a single AI provider.This comprehensive blueprint will show you exactly how to install OpenCode, run it completely for free, and master its robust feature set.How to Access OpenCode for FreeWhile the OpenCode software itself is open-source and free, AI model usage typically incurs a cost. However, there are three proven methods to power your OpenCode agent without spending a dime:Method 1: OpenCode Zen. The official OpenCode Zen portal (opencode.ai/zh/zen) allows you to log in via GitHub or Google to instantly generate a free API key. Once connected inside the terminal, simply type /models and select any model with the "Free" suffix.Method 2: Google Gemini Free Tier. You can acquire a free API key from Google AI Studio. By connecting this key, you can utilize models like Gemini 3 Flash Preview, which provides an excellent balance of speed and capability for daily coding.Method 3: 100% Local via Ollama. For complete privacy and offline capabilities, install Ollama (ollama.com) and pull a free local model like ollama pull gemma4:27b. OpenCode seamlessly integrates with local endpoints, ensuring your codebase never leaves your machine.Step-by-Step Installation GuideInstalling OpenCode is designed to be as frictionless as possible. Follow these steps to get your agent running:Run the Install Script: Open your terminal (or command prompt on Windows) and execute the following command: curl -fsSL https://opencode.ai/install | bashAlternatively, you can download a one-click desktop installer for Windows, macOS, or Linux directly from the official website.Launch OpenCode: Navigate to any project directory in your terminal and type opencode. You will be greeted by the Text User Interface (TUI).Authenticate Your API Key: In the terminal prompt, type /connect. Select your chosen provider (e.g., Google or OpenCode Zen) using the arrow keys and paste your API key when prompted.Select Your Model: Type /models to browse and switch between the available AI models.Mastering OpenCode: The Core FeaturesTo truly code like a pro using OpenCode, you need to understand how it interacts with your system. Here are the core mechanics that set it apart:1. Plan Mode vs. Build ModeOpenCode protects your project by separating tasks into two distinct permissions, which you can toggle between using the Tab key.Build Mode: This is the default state. The AI has full autonomy to read files, write code, and execute bash commands.Plan Mode: In this safe state, the AI will draft an execution strategy and ask for your explicit approval before modifying any files or running commands.2. Advanced Context SteeringYou can dynamically inject context into the AI's prompt using intuitive syntax shortcuts:File Referencing (@): Use the @ symbol to feed a file directly to the agent (e.g., @dice.py or @src/utils/auth.ts). You can even target specific lines using @File#L37-42.Shell Output (!): Prefix your prompt with an exclamation mark to run a shell command. The output will automatically become part of the agent's conversational context.3. Project Initialization and AGENTS.mdBy typing /init, OpenCode will initialize your current directory and create an AGENTS.md file. This plain-text file acts as a permanent rulebook where you can specify project-wide guidelines, favored tech stacks, and custom instructions the AI must follow on every interaction.4. Time Travel with Git SnapshotsDon't worry about the AI breaking your app. OpenCode stores conversation sessions locally and creates Git-based file snapshots. If a change goes wrong, simply use the /undo or /redo commands to safely revert your codebase.Advanced Setup: IDEs and Mobile AccessSeamless IDE IntegrationOpenCode doesn't force you into a standalone terminal. It integrates beautifully into VS Code, Cursor, Windsurf, and VSCodium. By running opencode in your integrated terminal, the extension installs automatically. Use quick shortcuts like Cmd+Esc (Mac) or Ctrl+Esc (Windows/Linux) to launch OpenCode in a split terminal view instantly.OpenCode MobileIf you self-host OpenCode, you can use the OpenCode Mobile companion app on your phone. It securely connects to your server via local Wi-Fi, Tailscale, or Cloudflare Tunnels, allowing you to monitor long-running AI coding jobs, approve tool calls, and view file diffs on the go, safely secured behind biometric unlock.Pro Tips for Best ResultsStart with Bite-Sized Automation: Don't overwhelm the AI by asking for a full application right away. Start with simple scripts—like batch-renaming files or extracting audio from video—and iteratively build complexity.Be Ultra-Specific: Context is everything. When giving instructions, thoroughly explain exactly how you want a file processed rather than issuing generic commands like "fix this".Compact Your History: As your session grows, token usage increases. Use the /compact command to summarize your conversation, freeing up context windows and improving the AI's focus.Final Thought: OpenCode bridges the gap between basic autocomplete extensions and fully autonomous AI developers. By utilizing free model tiers and mastering context commands, you can instantly 10x your development speed.