mirror of
https://github.com/tiennm99/claude-code-usage-bubble.git
synced 2026-10-14 04:16:02 +00:00
2.5 KiB
2.5 KiB
Research: OpenCode Go Contracts
Date: 2026-06-02 Status: blocked
Summary
OpenCode Go provider/model identity is verified, and the official console computes the exact quota fields we want. Implementation should not proceed yet because the verified quota source is an authenticated console server query, not a documented CLI command or public endpoint this desktop app can call safely.
Verified Facts
- Provider/model ID format: OpenCode Go models use
opencode-go/<model-id>, for exampleopencode-go/kimi-k2.6. - Official limits: Go has a rolling 5-hour window, a weekly window, and a monthly window. The requested UI only needs weekly and monthly sections.
- Limits are cost based, not request-count based: weekly
$30, monthly$60, and rolling 5-hour$12. - CLI auth docs say credentials are stored at
~/.local/share/opencode/auth.json; locally,opencode providersis an alias for auth management. - Local
opencode statsonly aggregates local sessions from the OpenCode database and reports cost/token totals. It does not report Go quota percentages or reset times. - Console source has the desired shape:
weeklyUsage: { status, resetInSec, usagePercent }monthlyUsage: { status, resetInSec, usagePercent }
- Console source derives those from
LiteTable.weeklyUsage,LiteTable.monthlyUsage,LiteTable.timeWeeklyUpdated,LiteTable.timeMonthlyUpdated,LiteTable.timeCreated, andLiteData.getLimits().
Sources
- OpenCode Go docs: https://dev.opencode.ai/docs/go/
- OpenCode CLI docs: https://opencode.ai/docs/cli/
- OpenCode source:
packages/opencode/src/cli/cmd/stats.ts - OpenCode source:
packages/console/app/src/routes/workspace/[id]/go/lite-section.tsx - OpenCode source:
packages/console/core/src/subscription.ts - Local command:
opencode stats --help
Decision
Do not implement OpenCode Go four-bar usage yet. The app cannot honestly render weekly/monthly usage percent and remaining time until one of these is chosen:
- Use an official/detected console endpoint with user-approved authentication.
- Ship only provider/auth detection now and hide/disable Go usage bars until quota data is available.
- Ask OpenCode upstream for a documented quota API or CLI output.
Unresolved Questions
- Should this app integrate with the authenticated OpenCode console, or should Go support be limited to detection until OpenCode exposes a stable quota API?
- Do we still want to continue Phase 2/4 now for the provider terminology rename, while deferring Phase 3?