Skip to content

feat(quota): resolve coding-plan usage windows via the monitor plane - #57

Merged
TriDefender merged 1 commit into
masterfrom
quota-display-fix
Sep 29, 2026
Merged

TriDefender merged 1 commit into
masterfrom
quota-display-fix

Conversation

@TriDefender

@TriDefender TriDefender commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Mirror the official desktop panel's two-plane split in the quota snapshot:

  • credits plane (existing): zcode-plan billing/balance + preview with the plan JWT — start-plan/trial credit buckets;
  • coding plane (new): GET {api.z.ai|open.bigmodel.cn}/api/monitor/usage/ quota/limit with the raw coding-plan API key in authorization (bundle wK/Z_ + md) — data.level + data.limits[] windowed usage rows, surfaced as a Coding group in the TUI card and in the quota CLI / GET /quota.

Behavior fixes from the PR #56 audit:

  • a credential without a plan JWT no longer kills the snapshot — credits plane degrades to a noted error while the coding plane still resolves (the card no longer tells logged-in users they are not logged in);
  • coding rows render remaining only: live data shows upstream number is not a comparable total (TIME_LIMIT remaining=3894 / number=1), and the official panel likewise never renders X/Y for these windows;
  • envelope success semantics mirror the bundle $_ (success !== false and code absent/0/200); monitor failures degrade to codingPlan=null the way the official fetchQuota().catch(() => null) does;
  • non-token unitType on balance rows is now visible instead of dropped;
  • empty-everything state reworded ("no quota entries reported by upstream").

see _reverse/NOTEPAD.md "coding-plan 用量平面"

Mirror the official desktop panel's two-plane split in the quota snapshot:

- credits plane (existing): zcode-plan billing/balance + preview with the
  plan JWT — start-plan/trial credit buckets;
- coding plane (new): GET {api.z.ai|open.bigmodel.cn}/api/monitor/usage/
  quota/limit with the raw coding-plan API key in `authorization` (bundle
  wK/Z_ + md) — data.level + data.limits[] windowed usage rows, surfaced
  as a Coding group in the TUI card and in the `quota` CLI / GET /quota.

Behavior fixes from the PR #56 audit:

- a credential without a plan JWT no longer kills the snapshot — credits
  plane degrades to a noted error while the coding plane still resolves
  (the card no longer tells logged-in users they are not logged in);
- coding rows render `remaining` only: live data shows upstream `number`
  is not a comparable total (TIME_LIMIT remaining=3894 / number=1), and
  the official panel likewise never renders X/Y for these windows;
- envelope success semantics mirror the bundle $_ (success !== false and
  code absent/0/200); monitor failures degrade to codingPlan=null the way
  the official fetchQuota().catch(() => null) does;
- non-token unitType on balance rows is now visible instead of dropped;
- empty-everything state reworded ("no quota entries reported by
  upstream").

@see _reverse/NOTEPAD.md "coding-plan 用量平面"
@TriDefender
TriDefender merged commit 670a959 into master Sep 29, 2026
1 check passed
@TriDefender
TriDefender deleted the quota-display-fix branch September 29, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant