GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(opencode): add CLI command to view Go usage limits by Nigmat-future · Pull Request #32913 · anomalyco/opencode

Conversation

@Nigmat-future

@Nigmat-future Nigmat-future commented Jun 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Issue for this PR

Closes #9281

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Go subscribers currently only see their usage limits when they hit a 429 GoUsageLimitError — there's no way to check proactively. This adds an opencode usage CLI command so users can see how much of their 5-hour, weekly, and monthly quota is used at any time.

Server side — new GET /zen/go/v1/usage endpoint (packages/console/app/src/routes/zen/go/v1/usage.ts). It authenticates via the same Authorization: Bearer <key> header used by the chat completions endpoint, queries LiteTable / SubscriptionTable / BillingTable, and runs the existing Subscription.analyzeRollingUsage / analyzeWeeklyUsage / analyzeMonthlyUsage functions to compute usage percent and reset time for each window. Returns JSON with plan, windows[] (name, status, usagePercent, resetInSec, used, limit), and useBalance. Handles lite (Go), black, and free tiers.

CLI side — new opencode usage command (packages/opencode/src/cli/cmd/usage.ts). It resolves the opencode provider's API key and base URL from the loaded provider config, calls the usage endpoint, and prints a formatted summary with progress bars and reset countdowns. Registered in packages/opencode/src/index.ts alongside stats.

How did you verify your code works?

  • Verified the endpoint follows the same auth pattern (KeyTable join) and reuses the same Subscription.analyze* functions as the existing billing validation in handler.ts.
  • Confirmed the CLI command resolves the provider key and API URL the same way models.ts does via Provider.Service.
  • Checked that UI.Style constants (TEXT_DIM, TEXT_WARNING, TEXT_SUCCESS, etc.) used in the output formatter exist in packages/opencode/src/cli/ui.ts.
  • Verified the branch name (usage-cli), commit format (feat(opencode): …), and target branch (dev) conform to AGENTS.md.

Screenshots / recordings

Example output:

┌──────────────────────────────────────────────────────────┐
│                      GO USAGE                            │
├──────────────────────────────────────────────────────────┤
│  Plan                    Go (Lite)                       │
│  Use Balance             Off                             │
├──────────────────────────────────────────────────────────┤
│  ● 5-hour limit  $8.42 / $12.00  70%  ███████░░░         │
│  Resets in               2h 15m                          │
├──────────────────────────────────────────────────────────┤
│  ● Weekly limit  $18.30 / $30.00  61%  ██████░░░░        │
│  Resets in               3d 4h                           │
├──────────────────────────────────────────────────────────┤
│  ● Monthly limit  $22.10 / $60.00  37%  ███░░░░░░░       │
│  Resets in               12d                             │
└──────────────────────────────────────────────────────────┘

  Manage your plan at https://opencode.ai/go

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

csanthiago, heyyouhere, and mvallebr reacted with thumbs up emoji
All reactions
  • 👍 3 reactions
@Nigmat-future
feat(opencode): add CLI command to view Go usage limits
fe406e5
Add a new `opencode usage` command that lets users proactively check
their OpenCode Go subscription usage (5-hour, weekly, and monthly
limits) without having to hit a rate limit first.

Server-side: new GET /zen/go/v1/usage endpoint that authenticates
via the API key and returns current usage data with percentages and
reset times for each limit window.

CLI-side: new `opencode usage` command that calls the endpoint and
displays a formatted usage summary with progress bars.
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Jun 18, 2026
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Aug 11, 2026
feat(usage): support OpenCode Go quota query farion1231/cc-switch#6350
Closed
feat(usage): support OpenCode Go quotas farion1231/cc-switch#6351
Closed
@Desure85 Desure85 mentioned this pull request Aug 18, 2026
[FEATURE] Optional quota multipliers (x2 / x4 / x8 / x16) for Go subscription with volume discount #43194
Closed
4 tasks
@Fishforgithub Fishforgithub mentioned this pull request Oct 4, 2026
[FEATURE]: Return OpenCode Go usage with each response and keep it on the message #53044
Open
1 task done
@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
Member

This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thdxr thdxr closed this Oct 10, 2026
@razzeee razzeee mentioned this pull request Nov 23, 2026
feat: show Codex subscription limits in /usage #65754
Closed
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add unified usage tracking via /usage (#9545)

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Nigmat-future @thdxr
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.