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 — [FEATURE]: Add Go plan usage/balance API endpoint (rolling/weekly/monthly windows) · Issue #16017 · anomalyco/opencode

[FEATURE]: Add Go plan usage/balance API endpoint (rolling/weekly/monthly windows) #16017

New issue
Copy link
New issue
Copy link
Closed
#16513
Closed
[FEATURE]: Add Go plan usage/balance API endpoint (rolling/weekly/monthly windows)#16017
#16513
Copy link
Assignees
rekram1-node

Description

@StephanMeijer
StephanMeijer
opened on Mar 4, 2026
Issue body actions

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Summary

Expose the Go plan subscription usage data via a public API endpoint. The dashboard already shows this information — rolling, weekly, and monthly usage percentages with reset timers — but there is no way to query it programmatically.

Use Case

  • Status bar widgets (waybar, polybar, macOS menu bar) showing current usage
  • Alerts when approaching plan limits before getting throttled
  • Monitoring dashboards aggregating usage across providers and plans
  • CI/CD pipelines checking remaining quota before kicking off expensive runs

Current Behavior

The only way to see Go plan usage is the web dashboard, which displays:

  • Rolling usage: x% (resets in N minutes)
  • Weekly usage: y% (resets in N minutes)
  • Monthly usage: z% (resets in N minutes)

No API endpoint exists to retrieve this data.

Proposed API

GET /api/v1/usage/plan
Authorization: Bearer <api-key>

Response:
{
  "plan": "go",
  "windows": {
    "rolling": {
      "usage_percent": 65,
      "resets_in_seconds": 2520
    },
    "weekly": {
      "usage_percent": 30,
      "resets_in_seconds": 259200
    },
    "monthly": {
      "usage_percent": 12,
      "resets_in_seconds": 1728000
    }
  }
}

Related Issues

  • Feature Request: Add Zen balance API endpoint #10448 — Zen balance API endpoint (pay-as-you-go USD balance; different data model)
  • [FEATURE] Add unified usage tracking via /usage (#9545) #9281 — Unified /usage tracking in TUI (provider-level: Codex/Copilot/Claude)
  • Github Copilot: Tracking Premium Requests #768 — Copilot premium request tracking
  • Request: View token and zen usage with command #3119 — Early request for token/zen usage via command

Additional Context

The Go plan's rolling/weekly/monthly usage windows are a distinct data model from the Zen credit balance (#10448) and provider-level quotas (#9281). The server already computes this data for the dashboard, so exposing it via API should be a relatively small addition.

Reacted by Arif Rahman (Bolt), EremesNG, Ryan, Ata Yıkılmaz, Oleksandr, Jiyeol Lee, Josh Klar, Filipe, Almendio, Withee Poositasai and 128 more

Activity

Next
  1. github-actions
    assigned
    thdxr
    on Mar 4, 2026
  2. github-actions
    added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 4, 2026
  3. github-actions commented on Mar 4, 2026

    @github-actions
    github-actionsBot
    on Mar 4, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • Feature request titles must start with [FEATURE]: (current title: "Feature Request: Add Go plan usage/balance API endpoint...")
    • The feature request template includes a verification checkbox confirming you've searched for existing issues — please ensure this is included

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


    This issue might be a duplicate of existing issues. Please check:

    • Feature Request: Add Zen balance API endpoint #10448: Also requests a programmatic API endpoint for account balance/usage data (Zen balance endpoint — different data model but closely related functionality)

    If you believe this was flagged incorrectly, please let a maintainer know.

  4. github-actions
    added
    needs:complianceThis means the issue will auto-close after 2 hours.
    on Mar 4, 2026
  5. StephanMeijer
    changed the title [-]Feature Request: Add Go plan usage/balance API endpoint (rolling/weekly/monthly windows)[/-] [+][FEATURE]: Add Go plan usage/balance API endpoint (rolling/weekly/monthly windows)[/+] on Mar 4, 2026
  6. github-actions
    removed
    needs:complianceThis means the issue will auto-close after 2 hours.
    on Mar 4, 2026
  7. github-actions commented on Mar 4, 2026

    @github-actions
    github-actionsBot
    on Mar 4, 2026 – with GitHub Actions
    Contributor
    More actions

    Thanks for updating the issue! It now meets our contributing guidelines — the title has been corrected to start with [FEATURE]: and the verification checkbox is checked. We appreciate you taking the time to fix it.

  8. github-actions commented on Mar 4, 2026

    @github-actions
    github-actionsBot
    on Mar 4, 2026 – with GitHub Actions
    Contributor
    More actions

    Thanks for updating the issue! It now meets our contributing guidelines — the title has been corrected, the verification checkbox is checked, and the description clearly explains the use case and need. Much appreciated!

  9. peculiarnewbie commented on Mar 7, 2026

    @peculiarnewbie
    peculiarnewbie
    on Mar 7, 2026
    Contributor
    More actions

    submitted a pr #16513. but i don't think can test this locally, so it's not meeting compliance @thdxr

  10. StephanMeijer commented on Mar 8, 2026

    @StephanMeijer
    StephanMeijer
    on Mar 8, 2026
    Author
    More actions

    Thanks!

  11. thdxr
    assigned
    rekram1-node
    and unassigned
    thdxr
    on Apr 26, 2026
  12. alansong63 commented on Apr 28, 2026

    @alansong63
    alansong63
    on Apr 28, 2026
    More actions

    +1. Would love to see this implemented. My use case: integrating Go plan usage tracking into an AI agent CLI as a quick command. Having rolling/weekly/monthly usage data accessible via API (e.g. GET /zen/go/v1/usage) would enable real-time monitoring without the web dashboard.

    Reacted by perzarys, dkellam44, Hicham el Allouchi, Luis Herrera, gui-bo and Taylor Rackley
  13. LuisHerreraG commented on May 2, 2026

    @LuisHerreraG
    LuisHerreraG
    on May 2, 2026
    More actions

    +1, I would like it too to programmatically check it in a helper script or even inside of OpenCode itself!

  14. slkiser commented on May 2, 2026

    @slkiser
    slkiser
    on May 2, 2026
    More actions

    If you need a workaround is possible with OpenCode Quota: for OpenCode Go you just have to provide a workspace ID and auth cookie.

    Reacted by jiziol, gui-bo and orzogc
  15. 21 remaining items

  16. OCPdev25 commented on Jul 9, 2026

    @OCPdev25
    OCPdev25
    on Jul 9, 2026
    More actions

    Adding one concrete downstream use case in support of this issue and PR #16513.

    quota-axi is a small read-only quota reporter used by agents before they decide whether to start expensive work. For OpenCode Go, the useful integration point is exactly a machine-readable endpoint keyed by the existing Go API key, not a dashboard scrape or browser cookie flow.

    The ideal response for agent routing would include the same three windows the dashboard already computes:

    • rolling or 5 hour usage percent plus reset time
    • weekly usage percent plus reset time
    • monthly usage percent plus reset time
    • optional spent and limit values in USD, if available from the same server-side counters

    Two constraints matter for agent tooling:

    • read-only: checking quota should not create model usage or mutate provider state
    • cookie-free: API key auth lets CLIs, status bars, and automation avoid browser-cookie import

    The proposed /zen/go/v1/usage shape in #16513 looks like the right direction because it reads LiteTable usage counters and uses the same Subscription.analyze*Usage logic as the workspace dashboard.

    Reacted by Zachary Cutlip, Arif Rahman (Bolt) and Dan Wright
  17. kevincojean commented on Jul 14, 2026

    @kevincojean
    kevincojean
    on Jul 14, 2026
    More actions

    Up

  18. markbus-ai commented on Aug 1, 2026

    @markbus-ai
    markbus-ai
    on Aug 1, 2026
    More actions

    +1 from the Omarchy side (a Linux desktop distro): our bar widget already renders Claude Code and Codex usage with rolling/weekly/monthly meters (usagePercent, reset countdown, alarm at 90%). OpenCode's local opencode.db gives us token totals, but not the plan windows — so the widget can't show what actually stops the next prompt.

    A single REST endpoint like /go/usage returning { rollingUsage: { usagePercent, resetInSec, limit }, weeklyUsage: {...}, monthlyUsage: {...} } would unblock us (and dashboards/CLI tools) with zero browser login — same auth as /zen/v1/models.

    @thdxr is this on the roadmap? Happy to help spec it or test an early version — 37signals' DHH pointed at this exact need when we upstreamed an OpenCode provider, so there's real consumer demand.

    Reacted by Lorenzo Strambi, Raul Abreu, Arif Rahman (Bolt), Sami Rautiainen and BZ
  19. candu commented on Aug 2, 2026

    @candu
    candu
    on Aug 2, 2026
    More actions

    +1: I often keep the OpenCode Go page open and refresh every so often, but would much prefer to have e.g. a plugin in opencode that shows me usage against limits right where I'm working.

    I'd imagine the visibility would also be interesting to orgs that track AI usage / spend internally.

    Reacted by BZ
  20. slkiser commented on Aug 2, 2026

    @slkiser
    slkiser
    on Aug 2, 2026
    More actions

    @candu #16017 (comment)

    If you need a workaround is possible with OpenCode Quota: for OpenCode Go you just have to provide a workspace ID and auth cookie.

  21. PowerfulShell commented on Aug 4, 2026

    @PowerfulShell
    PowerfulShell
    on Aug 4, 2026
    More actions

    been waiting too long since March...

  22. PowerfulShell commented on Aug 4, 2026

    @PowerfulShell
    PowerfulShell
    on Aug 4, 2026
    More actions

    when will this be done? server side issue....
    just make this endpoint..

  23. bertrell commented on Aug 5, 2026

    @bertrell
    bertrell
    on Aug 5, 2026
    More actions

    +1 — running opencode serve as a persistent backend for multiple clients (browser, phone, SSH) sharing one Go API key. Heavy parallel use burns the 5h cap fast with zero visibility from the TUI. Currently forced to keep a browser tab on the workspace page or switch to the free tier when limits hit. Would especially love a TUI slash command (e.g. /usage) that shows the three windows with reset timers.

  24. 0pilatos0 commented on Aug 5, 2026

    @0pilatos0
    0pilatos0
    on Aug 5, 2026
    More actions

    +1 exactly what I need for monitoring my Go subscription usage

  25. PowerfulShell commented on Aug 6, 2026

    @PowerfulShell
    PowerfulShell
    on Aug 6, 2026
    More actions

    why not now? been 5 months.

  26. artile commented on Aug 7, 2026

    @artile
    artile
    on Aug 7, 2026
    More actions

    +1, with a gateway use case that the ones above do not cover.

    We run a self-hosted multi-provider gateway (CLIProxyAPI) in front of several coding agents. A Go key is one credential in a pool the router picks from. The router reads per-request token counts from the usage object in the chat/completions response, but it has no way to know how much of the plan is left, so it cannot steer traffic away from Go before the cap is reached. It only finds out at the 429, mid-request, and the whole pool stalls.

    There is no in-band signal to fall back on either. Checked from outside today: GET /zen/go/v1/usage, /zen/v1/usage and /zen/go/v1/balance all return the SPA 404 HTML, and normal responses carry no X-RateLimit-* headers.

    Recomputing the meter on the client side is not a substitute. We can multiply token counts by the published per-model rates, but that number drifts from what the dashboard reports, as shown in #40280 ($12.42 tracked against $19.20 displayed). Only the server knows its own accounting.

    What would be enough for us is the shape already proposed here: the three windows with usage_percent (or remaining USD) and a reset timestamp, authenticated with the plain API key. The workspace-ID plus session-cookie route that opencode-quota uses works for a desktop, but it is not something a headless server can hold. Rate-limit headers on ordinary responses would cover most of the need as well, and would be cheaper to ship.

    Reacted by victor, Arif Rahman (Bolt), MiningInMySleep, blablup and Jeroen van Meerendonk
  27. vimtor
    closed this as completedin #16513on Aug 11, 2026
  28. PowerfulShell commented on Aug 12, 2026

    @PowerfulShell
    PowerfulShell
    on Aug 12, 2026
    More actions

    when will it be possible....
    its so simple, why take 5 months.... when please when..

  29. and7ey commented on Sep 15, 2026

    @and7ey
    and7ey
    on Sep 15, 2026
    More actions

    I've made small TUI plugin to display the stats - https://github.com/and7ey/opencode-go-usage

  30. ywallis
    added a commit that references this issue on Sep 21, 2026

    feat(aiquotas): add opencode provider for OpenCode Go subscription qu…

    ab0856d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    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.