Skip to content

[feature]: Add OpenCode Zen provider support #106

@Sarctiann

Description

@Sarctiann

Pre-flight checks

  • I searched existing issues and did not find a duplicate request.
  • I reviewed current behavior on the production released OpenCode version.

OpenCode version reviewed

1.15.11

Problem statement

OpenCode Zen is a popular pay-as-you-go provider that offers curated models from OpenAI, Anthropic, Google and others. Currently, opencode-quota does not support it, so users cannot see their Zen balance or usage within the plugin UI surfaces (sidebar, toast, compact status).

The OpenCode team has an open feature request for a Zen balance API endpoint (opencode#10448). Until that is available, opencode-quota could show local token usage and cost data for the opencode provider.

Proposed change

Add a new provider adapter for "opencode" (Zen) that:

  1. Reads local session token usage from opencode.db
  2. Applies Zen published pricing from models.dev to calculate cost
  3. Displays estimated remaining balance in sidebar, toast, and compact status
  4. Supports configuration for Zen reset periods

If/when OpenCode releases a public Zen balance API, migrate to use that endpoint for accurate real-time balance data.

Alternatives considered

No response

Acceptance criteria

  • OpenCode Zen appears as a detected provider in /quota_status
  • Zen usage/cost is shown in the sidebar Quota panel
  • Zen data appears in toasts when enabled
  • Zen usage is visible in /quota output
  • Configuration options for Zen-specific settings exist
  • Documentation updated with Zen setup instructions

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions