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.
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.
Model aliases always point to the latest tested version — no config updates needed when new versions release.
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.
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 |
What's Next
- Key Features -- Full capabilities overview
- CLI Usage -- Non-interactive usage with Zen
- Subscription -- Compare Zen, Go, and Enterprise