You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Zen API: expose credit balance in GET /zen/go/v1/usage (or /zen/v1/balance) #44189
The Zen API does not expose the workspace's credit wallet balance. GET /zen/go/v1/usage returns only Go-subscription usage windows (rolling/weekly/monthly), while the credit balance — shown on the console billing page and backed by BillingTable.balance — is only retrievable from the web console through a SolidStart server function (billing.get → Billing.get()), which requires an authenticated browser session. API-key callers have no way to read it.
Today the only key-authenticated balance signal is the error thrown at $0:
Insufficient balance. Manage your billing here: https://opencode.ai/workspace/<id>/billing
i.e. binary, no number, and only after the money is gone.
Request
Add the credit balance to the existing usage endpoint:
GET /zen/go/v1/usage (same Authorization: Bearer key auth)
A dedicated GET /zen/v1/balance returning the same balance object would also work. Returning it as part of the current usage endpoint keeps one polling endpoint for everything a monitor needs.
Use cases
Programmatic monitoring (status-bar widgets, dashboards, budget alerts) without scraping the console in a logged-in browser.
Early warnings before requests start failing with Insufficient balance — e.g. notify at $5 remaining.
Workspaces that enable "Use balance" as a Go fallback: knowing the remaining balance tells you how much headroom the fallback actually has.
Notes
Keys are workspace-scoped and the balance is the same workspace's balance, so this adds no new exposure surface.
The console already shows this exact value to the same user at opencode.ai/workspace/<id>/billing (formatBalance = balance / 1e8, see packages/console/app/src/routes/workspace/common.tsx).
This issue might be a duplicate of existing issues. Please check:
Feature Request: Add Zen balance API endpoint #10448: Feature request to add a GET /zen/v1/balance endpoint for programmatic credit balance access — same use cases (status bar widgets, monitoring, budget alerts) and same proposed API shape.
Activity
github-actions commentedon Aug 22, 2026
This issue might be a duplicate of existing issues. Please check:
GET /zen/v1/balanceendpoint for programmatic credit balance access — same use cases (status bar widgets, monitoring, budget alerts) and same proposed API shape.Statusline: surface Zen window health beside go; forward-compat balance
vemsomwork commentedon Sep 16, 2026
+1 — waiting for this to show Zen balance in ai-usagebar.
feat(spend): local consumption meter as groundwork; measure the provi…
neriousy commentedon Oct 20, 2026
Thanks for the report. We're tracking this same request in #10448, so I'm closing this as a duplicate. Please follow that issue for updates.
feat(balance): read remaining balance from three unrelated account su…