feat(zai): add weekly usage tracking#255
Conversation
Add support for Z.ai's weekly usage limit (unit: 6) to track token usage on a 7-day rolling period. Changes: - Add WEEK_MS constant for 7-day period - Update findLimit() to accept optional unit parameter - Add Weekly progress line for TOKENS_LIMIT with unit: 6 - Update plugin.json with Weekly line definition - Add tests for Weekly line rendering - Update documentation Closes robinebers#242 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds weekly quota support to the Z.ai provider to reflect the API’s new weekly tokens limit, and surfaces it in the UI/docs.
Changes:
- Parse
TOKENS_LIMITwithunit: 6and render a new Weekly progress line (percent + reset time + 7-day period). - Expose Weekly in the Z.ai plugin manifest overview lines.
- Update docs/README and add Vitest coverage for the new Weekly line.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/zai/plugin.js | Adds weekly period constant, extends limit selection helper, and emits a new “Weekly” progress line. |
| plugins/zai/plugin.json | Adds “Weekly” to the plugin’s overview line manifest. |
| plugins/zai/plugin.test.js | Adds fixtures and tests validating Weekly line rendering/reset metadata. |
| docs/providers/zai.md | Documents the new weekly quota line and updated API details. |
| README.md | Updates provider capability summary to include weekly for Z.ai. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3dba7a9f10
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Reorder lines in plugin.json to match runtime output order (Session -> Weekly -> Web Searches) - Make findLimit unit-aware for Session to correctly bind to unit 3, with fallback to first entry without unit - Add Number.isFinite check for weeklyTokenLimit.percentage - Add test case for weekly appearing before session in API response Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@cubic-dev-ai review |
@robinebers I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="docs/providers/zai.md">
<violation number="1" location="docs/providers/zai.md:16">
P2: Conflicting web-search reset semantics in the same provider doc (renewal-date-based vs 1st-of-month).</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
thank you for your feedback!! |
|
@validatedev @robinebers @davidarny |
|
@musashi3814 sure no problem |
Description
Z.ai (BigModel / Zhipu AI) operates on a weekly reset cycle for many of its usage quotas. The API now returns a TOKENS_LIMIT entry with unit: 6 representing the 7-day weekly limit. This implementation adds support for parsing and displaying this weekly quota.
Related Issue
#242
Type of Change
Testing
bun run buildand it succeededbun run testand all tests passbun tauri devScreenshots
Checklist
mainbranchAdditional Context
Please refer to Z.ai url.
https://z.ai/manage-apikey/subscription
Summary by cubic
Adds weekly usage tracking for Z.ai token quotas on a 7-day cycle, with a new Weekly progress line. Makes limit parsing unit-aware, aligns line order with runtime output, and updates docs/tests.
New Features
Bug Fixes
Written for commit 28bc9c1. Summary will update on new commits.