Skip to main content

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.

  1. Sign in with your account (or create one using email, GitHub, or Google)
  2. Navigate to the API Keys section
  3. Generate a new API key
  4. 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.

tip

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​

AspectOpenCode ZenDirect Provider
SetupOne keyMultiple accounts, keys, billing setups
BillingSingle invoiceSeparate invoices per provider
Model selectionCurated, tested lineupFull catalog (including experimental/unstable)
ReliabilityVerified by opencode teamVaries by provider
Rate limitsTransparent, consistentVary by provider and plan
Data handlingPer opencode.ai policyPer provider policy
Model updatesTested before availabilityImmediate on provider release

What's Next​