OpenCode Go - Usage: status not updating
How often is the usage stats card supposed to be updating because it doesn't seem to be. Most obvious because the monthly reset shows 27d left where it should be about 19d according to opencode.ai's stats (I happened to start my subscription on 6/1).
Compared to the opencode website, the following are the 3 discrepancies: Weekly Usage % is incorrect (9% too low) Monthly Usage % and time are incorrect (15% too low, and should be 19d left)
I have updated VS Code & rebooted a couple times in the last week.
This computes based on local extension only... There's no public API on opencode for that.
May need a way to you manually sync with you current stats on opencode.ai; After that the tracker is very precise....
But if you use the opencode with other app/computer will be out of sync again. The only way to avoid that is logging directly on opencode.ai with your credentials, because the API token cant collect this information.
Thanks for the detailed report @rh71el2 — and great follow-up @Wallacy, you are spot on. 🙏
Let me explain what is happening and what we can do about it.
🔍 Why the numbers are off
The Go Usage Tracker is 100% client-side — it counts tokens from requests made through this extension only and multiplies by per-model pricing. I researched this thoroughly (see docs/issues/14-20260605-go-usage-status-bar-not-updating.md) and confirmed:
OpenCode has no public API for usage/billing. I probed
/usage,/billing,/subscription,/quota,/balance, and ~10 other endpoints — all return 404. Billing is server-side only, behind browser OAuth on opencode.ai.
This means the tracker cannot know about:
- ⚠️ Usage from the OpenCode CLI/TUI
- ⚠️ Usage from other devices or other VS Code windows
- ⚠️ Usage from before the extension was installed
So if you use OpenCode anywhere else, the extension numbers will be lower than reality — which matches exactly what you are seeing.
🐛 The "27d left" vs "19d left" monthly reset bug
This is a real bug beyond the sync issue, and thank you for catching it.
Root cause: The monthly window uses an "anchor date" — the date of your first tracked request in the extension. If your OpenCode subscription started June 1, but the extension first tracked a request on, say, May 20, the anchor becomes the 20th instead of the 1st. That shifts the entire monthly cycle.
Why weekly is also off (9% too low): Same reason — the tracker only sees a subset of your actual usage, so the percentage is computed against incomplete data.
🛤️ Options I am considering
Since there is no API to sync from, here are the realistic paths forward:
Option A: Manual sync from opencode.ai (realistic, partial fix)
Add a command like OpenCode Go: Sync Usage from Website that lets you input your current usage numbers from opencode.ai dashboard. The tracker then uses that as a baseline and adds new extension-tracked usage on top. Caveat: you would need to re-sync if you use OpenCode elsewhere.
Option B: Make the tracker explicitly "this device only" (clarity fix)
Rename the status bar label and add a tooltip/disclaimer so it is clear the numbers represent extension-tracked usage only, not total subscription usage. This will not fix the numbers but stops the confusion.
Option C: Fix the monthly anchor bug (accuracy fix)
Let the user configure their subscription start date manually (e.g., a setting opencodego.goSubscriptionStartDate). The monthly window then calculates from that date instead of guessing from the first tracked request.
Option D: OAuth-based sync (ideal, but hard)
Attempt browser-based OAuth to opencode.ai to read real usage. This would solve everything but requires reverse-engineering their auth flow — fragile and could break anytime.
My lean: Option B + C together — fix the anchor bug with a configurable start date, and make the "device-only" nature explicit in the UI. Option A (manual sync) is also straightforward if people want it.
💬 Over to you
@rh71el2 @Wallacy — would B+C address your pain? Would a manual sync (Option A) be worth the effort, or is it too much friction?
Also open to completely different approaches if anyone has ideas. 🚀
I was thinking about that some time ago, i made "A" for myself but never PR because is not a real solution (but better than nothing); I think the only realist options is sync with opencode.ai via oAuth;
But A+C is good tradeoff... we can start with that then put D on another time, or maybe ask to opencode to make a API route that can be used with the API Key to gather this.
Meanwhile it would be nice to have the Option A at least for now. Thanks for the awesome extension btw.
Implemented in PR #50
How it works:
- Run the command "OpenCode Go: Set Usage Targets..." (or click the link in the status bar tooltip)
- Five input boxes appear, each pre-filled with the current value — press Enter to keep or type a new value, Escape to cancel
- The last two inputs are the monthly reset day (1–31) and hour (0–23 UTC) — these control when the monthly "resets in" timer updates to
Additionally, the cost fallback table now queries the live models.dev metadata cache instead of using a static snapshot, so new models are priced correctly without code changes.
@ltmoerdani this just landed https://github.com/anomalyco/opencode/pull/16513
Nice, thanks for the heads up @mderazon. This changes things a bit.
Back in June the honest answer was that OpenCode had no public API for Go usage, so the tracker had to stay client-side. That's why #50 (manual targets) and #59/#60 (SQLite reader) landed as partial fixes, and it's also why @rh71el2 was seeing "27d left" where opencode.ai said "19d left".
Now that an official /zen/go/v1/usage endpoint actually merged upstream, the main reason we had to estimate is gone. I checked the PR: it uses the same opencode-go key we already keep in SecretStorage, same base URL as our models fetch, and returns rolling/weekly/monthly percent plus reset time computed server-side. That maps almost 1:1 to our status bar, and it fixes the monthly reset date plus cross-device usage, the two things that started this thread.
One thing to watch: it just merged into dev, so I want to confirm it's live in production before building on it. I'll open a tracking issue for the integration and keep you posted here.
Appreciate the heads up, and thanks to everyone who kept pushing for this upstream. It's been a long time coming.