-
Notifications
You must be signed in to change notification settings - Fork 1.8k
OpenCode Go: support the public usage API with an API key #3065
Copy link
Copy link
Closed
Labels
P2Normal priority bug or improvement with limited blast radius.Normal priority bug or improvement with limited blast radius.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerThis issue is about auth, provider routing, model choice, or SecretRef resolution.This issue is about auth, provider routing, model choice, or SecretRef resolution.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.Issue quality rating does not apply to this item.
Description
Metadata
Metadata
Assignees
Labels
P2Normal priority bug or improvement with limited blast radius.Normal priority bug or improvement with limited blast radius.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerThis issue is about auth, provider routing, model choice, or SecretRef resolution.This issue is about auth, provider routing, model choice, or SecretRef resolution.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.Issue quality rating does not apply to this item.
Summary
Use OpenCode Go's public authenticated usage endpoint (
GET https://opencode.ai/zen/go/v1/usage) when anOPENCODE_API_KEYis configured, while retaining the existing local-history and cookie-backed paths as fallbacks.Current behavior
Current
mainhas local and web strategies for OpenCode Go, but no API-key strategy and no reference to the public endpoint. Users with an API key therefore cannot obtain authoritative rolling, weekly, and monthly usage windows through the supported API.This is distinct from #2982:
Expected behavior
OPENCODE_API_KEYfrom provider configuration or the environment.Proposed implementation and proof
PR #2879 contains a provider-scoped implementation, deterministic request-contract and fallback tests, documentation, and prior green cross-platform CI. Before merge it should be rebased onto current
mainand accompanied by redacted authenticated runtime proof from a real OpenCode Go account.No credentials or personal usage data are included here.