5 Hidden Features of OpenCode: The 178k Star Terminal AI Agent
- Authors

- Name
- Nino
- Occupation
- Senior Tech Editor
The landscape of AI-assisted development is shifting from the IDE to the terminal. While Cursor and Claude Code have dominated the conversation, a powerhouse has emerged from the open-source community: OpenCode. With over 178,000 Stars on GitHub and a massive presence on Hacker News, OpenCode is not just another wrapper around an LLM. It is a highly extensible, provider-agnostic agentic framework built for developers who demand control over their environment.
In this tutorial, we will explore five hidden use cases of OpenCode that elevate it from a simple chat interface to a sophisticated automation engine. To get the most out of these features, especially when switching between models like DeepSeek-V3 and Claude 3.5 Sonnet, using a reliable API aggregator like n1n.ai is essential for maintaining high uptime and low latency.
1. Multi-Provider Failover and Hot-Switching
Most developers use a single API key—usually Anthropic or OpenAI—and stop there. However, OpenCode’s architecture is built on a provider abstraction layer that supports over 30 providers natively. This includes everything from Google Gemini and DeepSeek to self-hosted models via Ollama.
The true power lies in the ability to switch models mid-session without losing context. For instance, you might use Claude 3.5 Sonnet for complex architectural planning but switch to a faster, cheaper model like DeepSeek-V3 for routine code generation. By routing your requests through n1n.ai, you can access all these models through a single endpoint, simplifying your configuration significantly.
How to Configure Local and Cloud Providers
You can point OpenCode to a local Ollama instance or a high-performance aggregator like n1n.ai with simple CLI commands:
# Configure OpenCode to connect to a custom OpenAI-compatible provider
opencode config set providers.custom.baseUrl "https://api.n1n.ai/v1"
opencode config set providers.custom.apiKey "YOUR_N1N_API_KEY"
opencode config set providers.custom.models '[{"id":"deepseek-v3","name":"DeepSeek V3"}]'
# Switch models during a live session
# Input: /model custom/deepseek-v3
# Or: /model anthropic/claude-3-5-sonnet
Pro Tip: Use n1n.ai as your primary provider to ensure that if one model provider (like Anthropic) hits a rate limit, you can instantly pivot to an alternative without changing your codebase or environment variables.
2. The NPM-Based Plugin Ecosystem
OpenCode is unique because it treats its agentic capabilities as modular plugins. You aren't stuck with the default logic; you can load custom agents, commands, and tools from npm or local directories. This is particularly useful for teams that have specific coding standards or internal APIs.
Implementing a Custom Review Agent
Imagine you want an agent that specifically checks for security vulnerabilities in your TypeScript code. You can create a plugin that registers a new slash command:
// Example of a plugin structure (packages/core/src/plugin/)
export class SecurityAuditPlugin implements OpenCodePlugin {
id = 'security-audit'
async load(context: PluginContext) {
context.registerSlashCommand('/audit', async (args) => {
const prompt = 'Analyze the current file for OWASP Top 10 vulnerabilities.'
return context.agent.run(prompt)
})
}
}
You can then install these plugins directly via the CLI:
opencode plugin install @your-org/opencode-security-plugin
opencode --plugin ./path/to/local/plugin/
This extensibility allows OpenCode to function as a bespoke tool tailored to your specific tech stack, rather than a generic "one-size-fits-all" AI.
3. Native MCP OAuth for External Service Integration
The Model Context Protocol (MCP) is the new standard for giving AI tools access to external data. OpenCode v1.17.10 introduced a critical feature: OAuth binding for MCP servers. This means you can securely connect your terminal agent to GitHub, Slack, or Jira without manually pasting static (and insecure) API tokens into config files.
When you add a server like GitHub via MCP, OpenCode handles the browser-based OAuth flow. It starts a local loopback server (bound to 127.0.0.1 for security) to capture the callback and manage token refreshes automatically.
# Add a GitHub MCP server with OAuth support
opencode mcp add github --url https://api.github.com/mcp
Once authenticated, you can perform high-level actions through natural language:
- "Create a PR from the current branch to main with the title 'Fix: memory leak'"
- "Summarize the last 5 issues assigned to me in the 'backend-api' repo"
4. Dual-Agent Architecture: Plan vs. Build
A common pitfall of AI agents is "hallucination-driven editing"—where the agent modifies files before fully understanding the architecture. OpenCode solves this with a dual-agent system: plan and build.
- Plan Mode (Read-Only): This agent has access to your codebase but cannot modify files. It is perfect for exploring unfamiliar repositories or performing architectural analysis.
- Build Mode (Full Access): This is the default mode that can write code, run tests, and execute terminal commands.
You can toggle between these modes using the Tab key. Furthermore, OpenCode supports background sub-agents. You can dispatch a @general agent to perform a long-running research task (like searching documentation) while you continue to code in the main build session.
| Feature | Plan Mode | Build Mode |
|---|---|---|
| File Access | Read-Only | Read/Write |
| Command Execution | Restricted | Full |
| Best For | Discovery & Planning | Implementation |
| Safety | High | Medium (Requires Oversight) |
5. Version-Controlled Skill Templates
If you find yourself repeating the same complex instructions (e.g., "Write a unit test using Jest, ensure 100% coverage, and use Mockito for database calls"), you should use the Skills System. Skills are Markdown files stored in .opencode/skills/ that act as reusable prompt templates.
By committing these skills to your Git repository, your entire team can share standardized AI workflows.
Creating a Custom Skill
Create a file at .opencode/skills/refactor-ui.md:
---
name: refactor-ui
description: 'Convert Tailwind components to Styled Components'
tools: [read, write]
---
Refactor the selected UI component:
1. Extract inline Tailwind classes.
2. Create a separate Styled Component definition.
3. Ensure the component remains accessible (ARIA labels).
Invoke it in your terminal with /refactor-ui. This ensures consistency across the team and reduces the cognitive load of prompt engineering.
Conclusion
OpenCode is more than a tool; it is a platform for the next generation of agentic development. By mastering its multi-provider support, plugin ecosystem, and secure MCP integrations, you can build a workflow that is faster, safer, and more flexible than proprietary alternatives.
Whether you are running local models or scaling with enterprise-grade LLMs through n1n.ai, OpenCode provides the foundation you need for the AI-native future of software engineering.
Get a free API key at n1n.ai