feat(console): add go usage endpoint - #16513
Merged
Merged
Conversation
1 task
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
2 tasks
|
Hey, any news on merging this? |
Contributor
Author
|
no clue |
|
+++ |
|
I would like to see this implemented |
|
+1 for implementing this. In the meantime I'm using this hacky solution https://pi.dev/packages/pi-go-bars |
|
I would like to see this implemented |
|
Official support would be nice. If you need usage and quota tracking in opencode, https://github.com/slkiser/opencode-quota |
|
up |
|
I'd employ this feature. |
|
+1 |
|
+1 |
|
Did they truly forget about this? |
|
Would really love this for OpenUsage. A lot of users keep asking, and the local SQL is unreliable. |
|
+1 |
|
+1 pls merge this |
This was referenced May 23, 2026
|
3 tasks
This was referenced Aug 12, 2026
7 tasks
ltmoerdani
pushed a commit
to ltmoerdani/opencode-copilot-chat
that referenced
this pull request
Aug 12, 2026
Pure, unit-testable module for the official OpenCode Go usage endpoint (upstream anomalyco/opencode#16513, verified live in production): - fetchGoUsage(): GET /zen/go/v1/usage with the existing opencode-go key as a Bearer token; classifies failures (unauthorized / no-subscription / not-found / network / invalid) so callers can fall back to local estimates. The key is never logged or persisted. - mergeServerUsage(): overlays the server-accurate rolling/weekly/monthly percent + resetsAt onto a locally-computed UsageSummary. The endpoint does not return raw spend, so spent is derived as limit x percent / 100 to keep the status bar and tooltip consistent; today/yesterday and per-session spend stay local. - GO_LIMITS stays the source of the display limits (they match the server's ZEN_LIMITS).
3 tasks
1 task
1 task
duh17
added a commit
to duh17/oppi
that referenced
this pull request
Aug 15, 2026
OpenCode shipped a usage API (GET /zen/go/v1/usage, PR anomalyco/opencode#16513) that reports percent-of-limit for the Go plan's rolling 5h, weekly, and monthly windows. Wire it into GET /server/provider-quotas so Model Providers on Apple clients shows OpenCode Go usage alongside Codex and xAI. The adapter maps rolling/weekly/monthly to the shared five_hour/weekly/monthly window DTOs (percent-only payload; dollar limits live server-side), reads the stored opencode-go API key directly, and surfaces structured errors for missing keys, inactive subscriptions (upstream 401), and invalid payloads. Shared the ISO-to-epoch helper with xai via shared.ts. Apple UI needs no changes: the client joins quotas by providerId and renders windows generically; the opencode-go icon/color/name mappings already exist for the model picker. Agent-Model: opencode-go/glm-5.3 Agent-Reasoning: high
thinh0704hcm
added a commit
to thinh0704hcm/OmniRoute
that referenced
this pull request
Aug 16, 2026
…ndpoint The upstream OpenCode Go usage endpoint shipped in anomalyco/opencode#16513 (merged 2026-08-11): GET /zen/go/v1/usage returns { useBalance, rollingUsage, weeklyUsage, monthlyUsage }, each { status, resetInSec, usagePercent } (0-100, resets in seconds). Replace the placeholder /quota URL and parser with the real shape (legacy shape kept as a defensive fallback). opencode-go finally gets working 5h/weekly/monthly quota data for reset-window routing.
Adam-Dalloul
added a commit
to Adam-Dalloul/codeg
that referenced
this pull request
Aug 22, 2026
Shipped 2026-08-11 in anomalyco/opencode#16513. percent is used 0-100 across rolling/weekly/monthly. No invented numbers.
JaminYe
pushed a commit
to JaminYe/pane
that referenced
this pull request
Aug 24, 2026
anomalyco/opencode#16513 shipped GET /zen/go/v1/usage (2026-08-11) — the endpoint the code comment said to swap to when it existed. The card now shows Session/Weekly/Monthly percentages and resets counted on OpenCode servers (same numbers as the Zen dashboard, other devices and shared-subscription participants included), authenticated with the Go key Pane already reads from auth.json. The live wire shape differs from the merged PR draft — verified against the deployed endpoint with a real key and pinned in a test: usage.{rolling,weekly,monthly}.{status,percent,resetsAt}. The old local-window computation stays as the fallback when the API is unreachable; dollar spend remains local. README + providers.md drop the "no public usage API yet" story. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue for this PR
Closes #16017
Type of change
What does this PR do?
this PR adds an API endpoint at
/zen/go/v1/usagethat will provide the same opencode go usage data as in the zen workspace dashboard.If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!
How did you verify your code works?
unfortunately i don't think this is a change i can verify as an outside contributor. i did try running
bun dev:remotebut met with cloudflare api key error.I did copy the pattern in
/zen/v1/modelsand copied the logic from/workspace/[id]/billing/lite-section.tsxScreenshots / recordings
not a ui change
Checklist
i guess running dev server and building counts as testing? but yea i don't think i can test this feature locally
If you do not follow this template your PR will be automatically rejected.