## Global config
~/.config/opencode/opencode.json
or:
## Project-specific
./opencode.json
Set your API Key
export ANTHROPIC_API_KEY="your-key-here"
## or
export OPENAI_API_KEY="your-key-here"
Launch opencode: $ opencode
Create an AGENTS.md file:
## Project: My SaaS App
## Tech Stack
- Next.js 14 with App Router
- TypeScript
- Tailwind CSS
- PostgreSQL with Prisma
## Conventions
- Use functional components
- Prefer server components when possible
- Follow REST API naming conventions
- Write tests for all new features
## Structure
- /app - Next.js app router pages
- /components - Reusable UI components
- /lib - Utility functions and helpers
- /prisma - Database schema and migrations
"Explain the authentication flow in this project": OpenCode will analyze your files and provide a detailed explanation of how authentication works.
"Add a dark mode toggle to the settings page": OpenCode will:
"The login form is not submitting. Here's the error: [paste error]": OpenCode will trace the issue and suggest fixes.
"Refactor the UserService class to use dependency injection": OpenCode will modernize your code while maintaining functionality.
OpenCode can work directly in your GitHub workflow:
/opencode or /oc in an issue or PR commentExample comment:
/opencode Fix the bug described in this issue
OpenCode offers several free models:
These are great for trying OpenCode without any cost!
❌ "Make it better" ✅ "Refactor the handleSubmit function to use async/await and add error handling"
❌ "Fix the bug" ✅ "The login form throws 'undefined is not a function' when clicking submit. The error occurs in auth.ts line 45"
For complex features, ask OpenCode to create a plan before implementation.
Drag and drop screenshots or mockups into the terminal—OpenCode can understand images!
Different projects may need different settings. Use local opencode.json files.
| Feature | OpenCode | Claude Code | Cursor |
|---|---|---|---|
| Open Source | ✅ | ❌ | ❌ |
| Free Tier | ✅ | Limited | Limited |
| Terminal-first | ✅ | ✅ | ❌ |
| Provider Agnostic | ✅ | ❌ (Claude only) | ❌ |
| Local Models | ✅ | ❌ | ✅ |
| IDE Integration | ✅ | ✅ | Native |
OpenCode is a powerful, open-source AI coding assistant that brings intelligent help directly to your terminal. With its provider-agnostic design, free models, and deep IDE integration, it's an excellent choice for developers looking to boost their productivity.
Key Takeaways:
Last modified 06 April 2026