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 Request: Add Zen balance API endpoint · Issue #10448 · anomalyco/opencode

Feature Request: Add Zen balance API endpoint #10448

New issue
Copy link
New issue
Copy link
Open
Open
Feature Request: Add Zen balance API endpoint#10448
Copy link
Assignees
fwang

Description

@uwagz
uwagz
opened on Jan 24, 2026
Issue body actions

Summary

Add a public API endpoint to query the current Zen account balance programmatically.

Use Case

I'd like to display my Zen balance in my system status bar (waybar on Linux). Currently, the only way to check balance is through the web dashboard, which makes automation impossible.

A simple endpoint like GET /zen/v1/balance (authenticated with the existing API key) would enable:

  • Status bar widgets showing remaining credits
  • Alerts when balance drops below a threshold
  • Integration with budgeting/monitoring tools
  • CI pipelines that check balance before expensive runs

Proposed API

GET https://opencode.ai/zen/v1/balance
Authorization: Bearer <api-key>

Response:
{
  "balance": 42.50,
  "currency": "USD",
  "auto_reload": {
    "enabled": true,
    "threshold": 5.00,
    "amount": 20.00
  }
}

Workaround

Currently using opencode stats to track local spending, but this doesn't reflect the actual account balance.

Additional Context

The auto-reload feature suggests the infrastructure to query balance already exists server-side. Exposing it via API would be a small addition with high utility for power users.

Thanks for building such a great tool! 🙏

Reacted by Emmanuel Oh, Ivan Delgado, Matheus Richard, Samuel François, hyperpuncher, Gene Hand, Arif Rahman (Bolt), Alejandro Estornell, Stephan Meijer, Josh Klar and 28 more
Reacted by Sebastian Atlántico, Iván Hernández Cazorla, emil, zxcslo, Fabio Mazarotto, Luis Alejandro Martínez and libfridge

Activity

  1. github-actions
    assigned
    fwang
    on Jan 24, 2026
  2. github-actions
    added
    zenRelates to Zen
    on Jan 24, 2026
  3. github-actions commented on Jan 24, 2026

    @github-actions
    github-actionsBot
    on Jan 24, 2026 – with GitHub Actions
    Contributor
    More actions

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

    • Feature Request: Add Zen balance API endpoint #10447: Feature Request: Add Zen balance API endpoint

    Feel free to ignore if this doesn't address your specific case.

  4. emmaneugene commented on Feb 14, 2026

    @emmaneugene
    emmaneugene
    on Feb 14, 2026
    More actions

    +1, I'm also trying to build a centralized monitoring tool for model usage across different subscription/API providers, and this would be very helpful

  5. aaesalamanca commented on Mar 4, 2026

    @aaesalamanca
    aaesalamanca
    on Mar 4, 2026
    More actions

    Same need here. I'm trying to build a macOS menu bar app to display the current balance so I don't have to navigate to the web dashboard.

    Reacted by Richard Glen Domingo and Abhishek Divekar
  6. thdxr
    removed
    zenRelates to Zen
    on May 3, 2026
  7. millaguie
    added a commit that references this issue on May 16, 2026

    feat(opencode-go): add dashboard-scrape usage provider

    4251a7d
  8. mderazon commented on May 22, 2026

    @mderazon
    mderazon
    on May 22, 2026
    More actions

    Also could unlock usage monitoring for OpenChamber: openchamber/openchamber#1357

  9. takumi3488
    added a commit that references this issue on May 29, 2026

    Fix opencode-go limit judgment: tunable thresholds + zen credit detec…

    0146e93
  10. millaguie
    added a commit that references this issue on May 29, 2026

    feat(opencode_go_usage): new plugin for OpenCode Go subscription quota

    6ac2030
  11. adivekar-utexas commented on Jun 14, 2026

    @adivekar-utexas
    adivekar-utexas
    on Jun 14, 2026
    More actions

    Cross-linking a downstream integration affected by the missing Zen/Go quota API: OmniRoute issue cheaper-inference/OmniRoute#3844 and diagnostic PR cheaper-inference/OmniRoute#3838 . We verified that a real OpenCode Go key works for chat completions, but quota-style endpoints return either 404 or non-JSON fallback responses. OmniRoute can only show diagnostics until OpenCode exposes a supported public endpoint.

  12. rossigee commented on Jul 12, 2026

    @rossigee
    rossigee
    on Jul 12, 2026
    More actions

    Is there a better place to report this upstream? Seems to be quite a common and obvious requirement, needed by a lot of people, but it would need to be implemented server-side by the Anomaly team, not here in this repo.

  13. donrami
    marked [FEATURE]: Expose balance and monetary usage data via the official usage API #41981 as a duplicate of this issue on Aug 12, 2026
  14. vmvarela commented on Aug 12, 2026

    @vmvarela
    vmvarela
    on Aug 12, 2026
    More actions

    Extending this request: monthly window + last top-up anchor

    #41981 (closed as dup of this) asked for balance + monthly usage/limit + reset timestamps on the usage API. Folding that scope in here:

    The existing GET /zen/go/v1/usage (#16513) returns plan-window percentages only — no monetary amounts. For Zen balance-billing workspaces, quota tools (opencode-quota, etc.) still scrape the billing page HTML. Proposal: sibling endpoint GET /zen/v1/workspace/usage returning:

    {
      "generatedAt": "...",
      "currency": "USD",
      "balance": {
        "amount": 12.34,
        "updatedAt": "...",
        "percentOfLastTopUp": 61.7,
        "lastTopUp": { "amount": 20.00, "at": "..." }
      },
      "usage": {
        "monthly": {
          "status": "ok",
          "used": 42.10,
          "limit": 100.00,
          "remaining": 57.90,
          "percent": 42.1,
          "resetsAt": "..."
        }
      }
    }

    Key points:

    • percentOfLastTopUp = balance / lastTopUp.amount * 100 — "of what I last paid, X% remains"; server-computed, null when no anchor
    • Monthly window mirrors the go endpoint's shape but with absolute USD values (server owns the math, kills the 100M-units conversion clients hardcode)
    • status server-derived: ok / near_limit / rate_limited / blocked
    Reacted by Shawn Kiser and Stefan Schwarzer
  15. GorlikItsMe
    added a commit that references this issue on Aug 22, 2026

    feat(opencode-zen): pay-as-you-go balance via billing-page scrape

    178ae20
  16. ziouf
    added a commit that references this issue on Aug 23, 2026

    docs: TODO for zen balance display pending upstream API

    992bb0d
  17. JaminYe
    added a commit that references this issue on Aug 24, 2026

    Docs: align privacy network-call list and roadmap with 0.4.34

    3a23f9c
  18. asdshuaishuai
    added a commit that references this issue on Aug 27, 2026

    feat(desktop): 模型池端点化改造 + 端点额度监听

    bccb1a9
  19. nesquena-hermes
    added a commit that references this issue on Sep 20, 2026

    feat(opencode-usage): OpenCode Go plan windows + local Zen usage panel

    62898d7
  20. joeskeen commented on Sep 20, 2026

    @joeskeen
    joeskeen
    on Sep 20, 2026
    More actions

    Use case: at-a-glance usage in a status bar

    +1 from a waybar integration. I'm hitting the same problem as several people above — I want a small status-bar widget that shows me my rolling / weekly / monthly usage percentages and my Zen balance, so I know whether I'm on track for the month without opening the dashboard.

    A GET /zen/v1/workspace/usage (or equivalent Bearer-friendly endpoint) that returns the workspace's balance in USD plus the existing plan-window percentages would unblock this and the other status-bar / menu-bar / monitoring-tool integrations people have mentioned (OmniRoute, OpenChamber, etc.).

    Concrete fields that would cover the common case:

    {
      "currency": "USD",
      "balance": { "amount": 12.34, "updatedAt": "..." },
      "usage": {
        "rolling": { "used": 0.43,  "limit": 12.00, "percent": 4,  "resetsAt": "..." },
        "weekly":  { "used": 6.74,  "limit": 30.00, "percent": 22, "resetsAt": "..." },
        "monthly": { "used": 11.24, "limit": 60.00, "percent": 19, "resetsAt": "..." }
      }
    }

    I've already wrapped /console/api/go/status (it works for a service-account key) and it returns the three windows in roughly this shape. The blocker on my side is just the balance — /console/api/billing/status returns 403 for service-account Bearer tokens, so the balance is only reachable via browser session cookies, which doesn't fit a long-running status-bar poll. If billing returned the same shape as the proposed endpoint above but rejected service-account keys by design, that's fine to know — I can fall back to omitting balance from the widget until a non-cookie path exists.

    This isn't a complaint, just a data point: every status-bar / monitoring / dashboard integration I've seen wants the same small surface, and consolidating it into a single Bearer-friendly endpoint would save us all from scraping /console HTML.

    Reacted by biddster
  21. neriousy
    marked Zen API: expose credit balance in GET /zen/go/v1/usage (or /zen/v1/balance) #44189 as a duplicate of this issue on Oct 20, 2026
  22. opencodejr commented on Oct 29, 2026

    @opencodejr
    opencodejrBot
    on Oct 29, 2026
    Contributor
    More actions

    Thanks for the clear write-up, @uwagz!

    To restate the request: you'd like a public API endpoint, authenticated with your existing Zen API key (e.g. GET /zen/v1/balance), that returns your current Zen balance and auto-reload settings. That way you could show the balance in a status bar like waybar, get low-balance alerts, or check it from CI before expensive runs.

    Right now the balance is only available in the web console. This needs a new endpoint on the Zen service, so it can't be added with an OpenCode plugin. The maintainers will consider it. If anyone else would find this useful, a 👍 on the issue helps show demand.

    Reacted by Ryan, infinitecontext.com, Roger Senna, inknofs, libfridge, 開源 lib < and Loránd Biró
  23. s8z7yymynr-sudo commented on Nov 22, 2026

    @s8z7yymynr-sudo
    s8z7yymynr-sudo
    on Nov 22, 2026
    More actions

    Balance of an OpenCode Console workspace is not readable outside the web UI

    Context: OpenCode Desktop 2.3.2 on macOS, with a local GUI plugin that shows provider usage in a status bar. ChatGPT/Codex windows, OpenRouter credit and Synthetic quotas all work. The OpenCode prepaid balance does not.

    What I observe:

    • GET /api/experimental/usage/limits returns the workspace and its budgets, but no balance. Budgets are empty on this account.
    • The balance is only visible in the Console UI, through GET /console/api/billing/status with an x-org-id header and a console session cookie.
    • The plugin process cannot reach that browser session: it enumerates two windows and none is the Console page.
    • Calling billing/status with the opencode credential stored in opencode.db returns 403 as a Bearer token, and 403 again when sent as a __Host-console_session or auth cookie.

    Request: please document a supported way to read the prepaid workspace balance without a browser session, authenticated by an API key or the console credential stored by opencode auth login. Returning it from the local API, or adding it to GET /zen/go/v1/usage, would both work for a monitor. If a console session cookie is the only supported mechanism, saying so explicitly would also help, so plugins can report the limitation instead of retrying.

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

Metadata

Metadata

Assignees

  • @fwang
    fwang

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.