Feature Request: Add Zen balance API endpoint #7483

Open
opened 2026-02-16 18:07:19 -05:00 by yindo · 2 comments
Owner

Originally created by @uwagz on GitHub (Jan 24, 2026).

Originally assigned to: @fwang on GitHub.

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! 🙏

Originally created by @uwagz on GitHub (Jan 24, 2026). Originally assigned to: @fwang on GitHub. ## 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! 🙏
yindo added the zen label 2026-02-16 18:07:19 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 24, 2026):

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

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

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

@github-actions[bot] commented on GitHub (Jan 24, 2026): This issue might be a duplicate of existing issues. Please check: - #10447: Feature Request: Add Zen balance API endpoint Feel free to ignore if this doesn't address your specific case.
Author
Owner

@emmaneugene commented on GitHub (Feb 14, 2026):

+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

@emmaneugene commented on GitHub (Feb 14, 2026): +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
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7483