OpenCode Zen
OpenCode Zen is opencode's curated model service -- a carefully selected and tested collection of LLMs optimized for software engineering tasks. It provides consolidated billing, verified reliability, and simplified setup.
What is OpenCode Zen?
OpenCode Zen eliminates the friction of managing multiple provider accounts. Instead of signing up for Anthropic, OpenAI, Google, and others separately -- each with its own billing, rate limits, and API quirks -- you get access to a curated lineup of models through a single account and a single API key.
Benefits
- Pre-verified models: Every model in OpenCode Zen is tested by the opencode team for compatibility, reliability, and performance on coding tasks
- Single API key: One key gives you access to multiple model families
- Consolidated billing: All usage appears on one invoice at opencode.ai
- Optimized defaults: Models are configured with recommended parameters for coding workflows
- No rate limit surprises: Predictable, transparent rate limits
- Automatic updates: New models are added as they're tested and verified
- No hidden costs: The price you see is the price you pay -- no surprise overages
Available Models
OpenCode Zen includes models across multiple capability tiers. Run /models after connecting to see the current lineup:
| Tier | Example Models | Best For |
|---|---|---|
| Flagship | Claude Sonnet 4, GPT-4o | Complex multi-step tasks, architecture, refactoring |
| Fast | Claude Haiku 3.5, Gemini 2.0 Flash | Quick edits, code review, simple Q&A |
| Reasoning | o3, Claude Opus | Complex analysis, planning, debugging |
| Specialized | Code-specific models | Focused coding tasks |
| Experimental | Latest releases | Trying new models before general availability |
The exact model list evolves as new models are released and tested.
Setup
Step 1: Connect to OpenCode Zen
In the opencode TUI, run:
/connect
Select OpenCode Zen from the provider list.
Step 2: Sign In and Get Your API Key
A URL will be displayed, typically https://opencode.ai/auth. Open this URL in your browser.
- Sign in with your account (or create one using email, GitHub, or Google)
- Navigate to the API Keys section
- Generate a new API key
- Copy the key
Step 3: Enter the API Key
Back in the opencode TUI, paste the API key when prompted. The connection is established immediately.
Step 4: Verify the Connection
Run /models to see the available OpenCode Zen models:
/models
You should see a list of models with their tier, estimated context window, and pricing information.
Using OpenCode Zen
Selecting a Model
Switch between models in the TUI:
/models
Or in non-interactive mode:
opencode run "Refactor this module" --model claude-sonnet-4-20250514
Set as Default
Make OpenCode Zen your default provider in the config:
{
"provider": {
"name": "zen",
"model": "claude-sonnet-4-20250514"
}
}
Model Aliases
OpenCode Zen models may use friendly aliases. For example:
zen/claude-sonnet
zen/gpt-4o
zen/gemini-flash
These aliases automatically point to the latest tested version of each model, so you don't need to update your config when new versions are released.
Billing
How Billing Works
OpenCode Zen charges per-token, with rates varying by model tier. You are billed for:
- Input tokens: The prompt and context sent to the model
- Output tokens: The response generated by the model
- Tool call tokens: Structured tool invocations
Pricing is transparent and displayed when you select a model in /models.
Managing Usage
Monitor your usage and costs:
opencode stats
This shows token counts and estimated costs per session and overall.
Billing Dashboard
Visit opencode.ai to:
- View detailed usage breakdowns
- Set spending limits
- Download invoices
- Update payment methods
- View usage history
Prepaid vs Postpaid
OpenCode Zen supports both prepaid (credit-based) and postpaid (invoice-based) billing depending on your account type.
When to Use OpenCode Zen
Good Fit
- New users: Simplest setup -- no need to evaluate multiple providers
- Teams: Consolidated billing and simplified management
- Multi-model workflows: Easy switching between model families
- Production pipelines: Verified reliability for automated workflows
- Users who prefer convenience: One account, one key, one bill
Less Suitable
- Existing provider commitments: If you already have credits or contracts with specific providers
- Exclusive model access: If you need a model not yet available in OpenCode Zen
- Custom fine-tuned models: OpenCode Zen offers base models, not fine-tuning
- Strict data locality: If you require models to run in a specific geographic region or on-premises
OpenCode Zen is completely optional and interoperable -- you can use it alongside other providers and switch between them freely.
Comparison: OpenCode Zen vs Direct Providers
| Aspect | OpenCode Zen | Direct Provider |
|---|---|---|
| Setup | One key | Multiple accounts, keys, billing setups |
| Billing | Single invoice | Separate invoices per provider |
| Model selection | Curated, tested lineup | Full catalog (including experimental/unstable) |
| Reliability | Verified by opencode team | Varies by provider |
| Rate limits | Transparent, consistent | Vary by provider and plan |
| Data handling | Per opencode.ai policy | Per provider policy |
| Model updates | Tested before availability | Immediate on provider release |
OpenCode Zen Security
Data Handling
- Prompts and responses are processed to fulfill your requests
- Session data is stored per opencode's privacy policy
- You can delete session data at any time from your account dashboard
- API keys are encrypted at rest
API Key Security
- Treat your Zen API key like a password
- Use environment variables rather than hardcoding:
export OPENCODE_API_KEY=your-zen-key
- Rotate keys periodically from the account dashboard
- Use different keys for development and production
Troubleshooting
Connection Failed
If opencode cannot connect to OpenCode Zen:
-
Verify your API key is correct:
/connectRe-enter your key if needed.
-
Check your internet connection:
!curl -s https://api.opencode.ai/health -
Ensure your account is active at opencode.ai.
Model Unavailable
If a specific model shows as unavailable:
- Run
/modelsto refresh the model list - The model may be temporarily degraded -- try another model
- Check opencode.ai/status for service announcements
Unexpected Charges
If billing seems incorrect:
- Run
opencode statsto see per-session usage - Check the billing dashboard at opencode.ai
- Contact support through the dashboard
OpenCode Zen vs OpenCode Go vs Enterprise
| Plan | Best For | Key Feature |
|---|---|---|
| Zen | Individuals and teams | Curated models, consolidated billing |
| Go | On-the-go developers | Mobile companion, notifications |
| Enterprise | Organizations | Self-hosted, SSO, audit logs |
You can use OpenCode Zen alongside the free version of opencode -- it simply serves as an additional provider option. All core opencode features (TUI, agents, tools, sessions) work identically regardless of which provider you use.
What's Next
- Key Features -- Full capabilities overview
- CLI Usage -- Non-interactive usage with Zen
- Subscription -- Compare Zen, Go, and Enterprise