Area
Provider quota / account plans
Current status
This request is partially implemented.
Current dev already contains a Z.AI GLM Coding Plan quota probe in:
That implementation currently supports the api.z.ai Coding Plan route and projects GLM quota information into OpenCodex's existing normalized quota model.
The remaining work is to support the independently verified Zhipu BigModel Coding Plan contract at:
and to parse the actual data.limits[] response shape rather than assuming one fixed set of flattened fields.
Confirmed BigModel endpoint
Live validation against a Zhipu GLM Coding Plan V1 individual subscription succeeded with:
GET https://open.bigmodel.cn/api/monitor/usage/quota/limit
Authorization: <API_KEY>
Important:
contains the API key directly for this endpoint.
Do not prepend:
unless separately verified for the specific host.
The model-routing base associated with this account can be:
https://open.bigmodel.cn/api/coding/paas/v4
What prevents this today?
The current OpenCodex quota implementation recognizes:
https://api.z.ai
https://api.z.ai/api/coding/paas/v4
but not:
https://open.bigmodel.cn
https://open.bigmodel.cn/api/coding/paas/v4
The current Z.AI probe also assumes a response shape containing fields such as:
fiveHourPercent
fiveHourUsage
weeklyPercent
weeklyUsage
The verified BigModel response instead exposes quota windows through:
with explicit window metadata.
Therefore the current Z.AI probe should not be treated as complete support for the BigModel Coding Plan contract.
Verified response-driven parsing
The upstream response contains quota entries such as:
type = TOKENS_LIMIT
unit = 3
percentage = <used percentage>
nextResetTime = <reset timestamp>
Observed mapping:
unit = 3 -> rolling five-hour token window
unit = 6 -> weekly token window
The parser should use those explicit units instead of inferring window identity from reset ordering.
For example:
unit=3
percentage=72
nextResetTime=<timestamp>
should normalize to:
fiveHourPercent = 72
fiveHourResetAt = <timestamp>
And, when present:
unit=6
percentage=31
nextResetTime=<timestamp>
should normalize to:
weeklyPercent = 31
weeklyResetAt = <timestamp>
Plan-version behavior
Do not hard-code the presence of weekly or monthly limits based on the product name.
Live validation showed a V1 individual Coding Plan returning only:
5-hour used: 1%
5-hour remaining: 99%
weekly window: absent
That is a valid response.
Different Coding Plan generations may expose additional windows.
The contract should therefore be response-driven:
- parse only limits actually returned by the upstream;
unit=3 is the confirmed rolling five-hour window;
unit=6 is the confirmed weekly window when present;
- missing weekly/monthly windows are normal;
- unknown future unit values should not be guessed;
- if useful, unknown verified windows can be preserved as bounded custom windows until their meaning is established.
What OpenCodex should do
1. Recognize BigModel Coding Plan hosts
Extend the canonical host admission for the GLM Coding Plan quota probe to include the verified BigModel route.
At minimum:
https://open.bigmodel.cn/api/coding/paas/v4
The credential must never be sent to lookalike or arbitrary configured hosts.
2. Use the correct BigModel quota endpoint
For BigModel Coding Plan:
GET https://open.bigmodel.cn/api/monitor/usage/quota/limit
with the host-specific authentication contract.
Do not redirect credentials to another host.
3. Parse data.limits[]
Treat the returned limit rows as the source of truth.
Known mappings:
TOKENS_LIMIT + unit=3 -> five-hour window
TOKENS_LIMIT + unit=6 -> weekly window
Use:
for normalized usage/reset values.
4. Preserve current Z.AI behavior
Supporting BigModel must not regress the existing:
quota path.
If the two services expose materially different request/auth/response contracts, keep their parsing branches explicit rather than pretending they are identical because they belong to the same provider family.
5. Fail safely
Quota probing is observational only.
A failed, unsupported, malformed, or unavailable quota request must not affect:
- model routing;
- API-key use for inference;
- normal provider availability.
Do not expose API keys or raw upstream quota bodies through the normal management API or Dashboard.
Expected Dashboard behavior
For an account returning only the V1 five-hour limit:
GLM Coding Plan
5-hour
1% used · 99% remaining
Resets: <local reset time>
For a newer account returning both known windows:
GLM Coding Plan
5-hour
72% used · 28% remaining
Resets: <time>
Weekly
31% used · 69% remaining
Resets: <date/time>
Do not render a fake weekly row when the upstream did not return one.
Acceptance criteria
Checks
Area
Provider quota / account plans
Current status
This request is partially implemented.
Current
devalready contains a Z.AI GLM Coding Plan quota probe in:That implementation currently supports the
api.z.aiCoding Plan route and projects GLM quota information into OpenCodex's existing normalized quota model.The remaining work is to support the independently verified Zhipu BigModel Coding Plan contract at:
and to parse the actual
data.limits[]response shape rather than assuming one fixed set of flattened fields.Confirmed BigModel endpoint
Live validation against a Zhipu GLM Coding Plan V1 individual subscription succeeded with:
Important:
contains the API key directly for this endpoint.
Do not prepend:
unless separately verified for the specific host.
The model-routing base associated with this account can be:
What prevents this today?
The current OpenCodex quota implementation recognizes:
but not:
The current Z.AI probe also assumes a response shape containing fields such as:
The verified BigModel response instead exposes quota windows through:
with explicit window metadata.
Therefore the current Z.AI probe should not be treated as complete support for the BigModel Coding Plan contract.
Verified response-driven parsing
The upstream response contains quota entries such as:
Observed mapping:
The parser should use those explicit units instead of inferring window identity from reset ordering.
For example:
should normalize to:
And, when present:
should normalize to:
Plan-version behavior
Do not hard-code the presence of weekly or monthly limits based on the product name.
Live validation showed a V1 individual Coding Plan returning only:
That is a valid response.
Different Coding Plan generations may expose additional windows.
The contract should therefore be response-driven:
unit=3is the confirmed rolling five-hour window;unit=6is the confirmed weekly window when present;What OpenCodex should do
1. Recognize BigModel Coding Plan hosts
Extend the canonical host admission for the GLM Coding Plan quota probe to include the verified BigModel route.
At minimum:
The credential must never be sent to lookalike or arbitrary configured hosts.
2. Use the correct BigModel quota endpoint
For BigModel Coding Plan:
with the host-specific authentication contract.
Do not redirect credentials to another host.
3. Parse
data.limits[]Treat the returned limit rows as the source of truth.
Known mappings:
Use:
for normalized usage/reset values.
4. Preserve current Z.AI behavior
Supporting BigModel must not regress the existing:
quota path.
If the two services expose materially different request/auth/response contracts, keep their parsing branches explicit rather than pretending they are identical because they belong to the same provider family.
5. Fail safely
Quota probing is observational only.
A failed, unsupported, malformed, or unavailable quota request must not affect:
Do not expose API keys or raw upstream quota bodies through the normal management API or Dashboard.
Expected Dashboard behavior
For an account returning only the V1 five-hour limit:
For a newer account returning both known windows:
Do not render a fake weekly row when the upstream did not return one.
Acceptance criteria
open.bigmodel.cn/api/coding/paas/v4is recognized as an eligible Coding Plan configuration.data.limits[]is parsed response-first.unit=3maps to the rolling five-hour quota.unit=6maps to the weekly quota when present.nextResetTimeis normalized and displayed when supplied.api.z.aiquota behavior remains covered.Checks
devimplementation was re-audited.