feat: Z.AI usage bars in Models settings - #797
Merged
Merged
Conversation
Poll the undocumented monitor quota endpoint with the saved API key (and region host) so operators can see 5-hour and weekly usage under connected Z.AI rows, matching Kimi/ChatGPT subscription usage.
pridemusvaire
requested review from
brunobergher,
daniel-lxs and
mrubens
as code owners
July 26, 2026 11:46
Contributor
pridemusvaire
marked this pull request as draft
July 26, 2026 11:48
pridemusvaire
marked this pull request as ready for review
July 26, 2026 12:02
Add 401 soft-fail and Settings UI regression tests, share the API-key subscription usage allowlist, align the 5h window label, and add a changeset for the release notes.
Accept business-error envelopes on HTTP 200, and map TIME_LIMIT currentValue/usage fields so monthly tools windows render correctly.
mrubens
approved these changes
Jul 26, 2026
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/api/monitor/usage/quota/limit) for connected Z.AI and Z.AI Coding Plan providersapi.z.ai, China →open.bigmodel.cnImplementation
packages/typeszai/zai-coding-planonSubscriptionUsageProviderId; host + path constantspackages/dbparseZaiQuotaUsage,fetchZaiUsage,fetchZaiCodingPlanUsage; included ingetSubscriptionProviderUsageapps/webConnectedProviderRowfor both Z.AI providersUpstream payload (undocumented, same as Coding Plan tools / pi-glm-usage):
{ "code": 200, "data": { "level": "lite", "limits": [ { "type": "TOKENS_LIMIT", "unit": 3, "percentage": 16, "nextResetTime": 1777819631597 }, { "type": "TOKENS_LIMIT", "unit": 6, "percentage": 4, "nextResetTime": 1778262784969 } ] } }Missing credentials or unparseable responses still soft-fail (no bar), matching existing providers.
Test plan
parseZaiQuotaUsageand both fetchers (global + china hosts, coding-plan key)open.bigmodel.cn