@specode/pi-subscription-usage 0.2.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/package.json +1 -1
- package/src/providers/grok.ts +9 -0
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Supported providers:
|
|
|
8
8
|
|
|
9
9
|
- **OpenAI Codex** — 5-hour and weekly quota, model-specific quota, and confirmed reset-credit redemption.
|
|
10
10
|
- **OpenCode Go** — 5-hour, weekly, and monthly windows.
|
|
11
|
-
- **Grok** — weekly and/or monthly quota using only Pi's `xai` / `xai-auth` OAuth credentials, with account identity verification. Unified SuperGrok billing is
|
|
11
|
+
- **Grok** — weekly and/or monthly quota using only Pi's `xai` / `xai-auth` OAuth credentials, with account identity verification. A weekly `currentPeriod` with an omitted `creditUsagePercent` is treated as 0% used (proto3 omits zero after reset). Unified SuperGrok billing is still probed from the default monthly endpoint, but that probe is no longer required when the weekly window is already displayable. Windows use the same `5h / 1w / 1m` status format as other providers.
|
|
12
12
|
- **Kimi Coding** — 5-hour and weekly windows, plus the membership plan reported by the usage API.
|
|
13
13
|
|
|
14
14
|
The extension does not implement or modify Codex Fast mode and never rewrites model requests.
|
package/README.zh-CN.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
- **OpenAI Codex**:5 小时与每周额度、模型专属额度,以及需要确认的重置次数兑换。
|
|
10
10
|
- **OpenCode Go**:5 小时、每周和每月窗口。
|
|
11
|
-
- **Grok**:每周和/或每月额度;只使用 Pi 的 `xai` / `xai-auth` OAuth
|
|
11
|
+
- **Grok**:每周和/或每月额度;只使用 Pi 的 `xai` / `xai-auth` OAuth 凭据,并先验证账户身份。若 weekly `currentPeriod` 存在但省略了 `creditUsagePercent`,按已用 0% 处理(proto3 在周期重置后会省略 0)。统一账单账户仍会探测默认月度接口,但 weekly 窗口已经可展示时,月度探测失败不再让整次查询失败。窗口与其他提供商一样使用 `5h / 1w / 1m` 状态格式。
|
|
12
12
|
- **Kimi Coding**:5 小时和每周窗口,以及额度接口返回的会员套餐。
|
|
13
13
|
|
|
14
14
|
本扩展不实现或修改 Codex Fast 模式,也不会改写模型请求。
|
package/package.json
CHANGED
package/src/providers/grok.ts
CHANGED
|
@@ -141,6 +141,15 @@ function parseCreditsWindow(
|
|
|
141
141
|
const limitCents = boundedCents(config.monthlyLimit);
|
|
142
142
|
if (usedCents !== undefined && limitCents !== undefined && limitCents > 0) {
|
|
143
143
|
used = Math.min(100, (usedCents / limitCents) * 100);
|
|
144
|
+
} else if (
|
|
145
|
+
config.creditUsagePercent === undefined &&
|
|
146
|
+
config.used === undefined &&
|
|
147
|
+
config.monthlyLimit === undefined
|
|
148
|
+
) {
|
|
149
|
+
// Proto3 JSON omits creditUsagePercent when it is 0, which happens
|
|
150
|
+
// at weekly reset. Official Grok CLI still treats that as 0% used.
|
|
151
|
+
// Only do this when the fields are absent, not present-but-invalid.
|
|
152
|
+
used = 0;
|
|
144
153
|
}
|
|
145
154
|
}
|
|
146
155
|
if (used === undefined) return undefined;
|