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.

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:

TierExample ModelsBest For
FlagshipClaude Sonnet 4, GPT-4oComplex multi-step tasks, architecture, refactoring
FastClaude Haiku 3.5, Gemini 2.0 FlashQuick edits, code review, simple Q&A
Reasoningo3, Claude OpusComplex analysis, planning, debugging
SpecializedCode-specific modelsFocused coding tasks
ExperimentalLatest releasesTrying 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.

  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.

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

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

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:

  1. Verify your API key is correct:

    /connect

    Re-enter your key if needed.

  2. Check your internet connection:

    !curl -s https://api.opencode.ai/health
  3. Ensure your account is active at opencode.ai.

Model Unavailable

If a specific model shows as unavailable:

  1. Run /models to refresh the model list
  2. The model may be temporarily degraded -- try another model
  3. Check opencode.ai/status for service announcements

Unexpected Charges

If billing seems incorrect:

  1. Run opencode stats to see per-session usage
  2. Check the billing dashboard at opencode.ai
  3. Contact support through the dashboard

OpenCode Zen vs OpenCode Go vs Enterprise

PlanBest ForKey Feature
ZenIndividuals and teamsCurated models, consolidated billing
GoOn-the-go developersMobile companion, notifications
EnterpriseOrganizationsSelf-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