minimax-status 1.2.1 → 1.2.3

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 CHANGED
@@ -11,12 +11,13 @@ MiniMax Token-Plan 使用状态监控工具,支持 CLI 命令和 Claude Code
11
11
 
12
12
  | 插件 | 版本 | 安装方式 |
13
13
  |------|------|----------|
14
- | **CLI** | 1.2.0 | `npm install -g minimax-status` |
15
- | **VSCode** | 1.3.2 | [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=JochenYang.minimax-status-vscode) 或 [下载 VSIX](https://github.com/JochenYang/minimax-status/releases) |
14
+ | **CLI** | 1.2.2 | `npm install -g minimax-status` |
15
+ | **VSCode** | 1.4.0 | [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=JochenYang.minimax-status-vscode) 或 [下载 VSIX](https://github.com/JochenYang/minimax-status/releases) |
16
16
 
17
17
  ## 特性
18
18
 
19
19
  - ✅ **实时状态监控**: 显示 MiniMax Token-Plan 使用额度、剩余次数、重置时间
20
+ - ✅ **套餐卡 Tooltip**(VSCode 1.4.0+): 5h 限额 / 周限额 / 视频赠送 / Hailuo / music / image / speech 各自独立卡片,跟官网一致
20
21
  - ✅ **上下文窗口跟踪**: 智能解析转录文件,准确显示当前会话的上下文使用量
21
22
  - ✅ **多种显示模式**: 详细模式、紧凑模式、持续状态栏
22
23
  - ✅ **Claude Code 集成**: 可在 Claude Code 底部状态栏显示
@@ -25,6 +26,8 @@ MiniMax Token-Plan 使用状态监控工具,支持 CLI 命令和 Claude Code
25
26
  - ✅ **简洁命令**: `minimax status` 查看状态
26
27
  - ✅ **安全存储**: 凭据存储在独立的配置文件中
27
28
 
29
+ > **注意**: 1.4.0 起,MiniMax 官方更新了用量接口(`/v1/token_plan/remains` → `/v1/api/openplatform/coding_plan/remains`)。本工具同步切换。海外端(`minimax.io`)也同步切换。
30
+
28
31
  ## 快速开始
29
32
 
30
33
  ### 1. 安装
@@ -47,6 +50,8 @@ minimax auth <token>
47
50
 
48
51
  配置信息将保存在 `~/.minimax-config.json` 文件中。
49
52
 
53
+ > 自 1.2.6 起,CLI 不再需要 GroupId 配置 — 用量接口从 token JWT 自动解析 group_id。
54
+
50
55
  获取令牌:
51
56
 
52
57
  1. 访问 [MiniMax 开放平台](https://platform.minimaxi.com/user-center/payment/coding-plan)
@@ -64,6 +69,9 @@ minimax status --compact
64
69
 
65
70
  # 持续监控模式
66
71
  minimax status --watch
72
+
73
+ # 所有模型
74
+ minimax list
67
75
  ```
68
76
 
69
77
  ## VSCode 扩展
@@ -133,10 +141,24 @@ npm run package
133
141
  集成成功后,底部状态栏将显示:
134
142
 
135
143
  ```
136
- cli ❯  main *MiniMax-M* 205K ❯ 0% (4500/4500) · W ∞ ❯ 4h59m ❯ 336
144
+ cli main * MiniMax-M3[1M][1m] 25% · 249.5k 5h 41% · W 6% 2h59m 291
137
145
  ```
138
146
 
139
- 显示格式:`目录 ❯ 分支 ❯ 模型 ❯ 上下文百分比(已用/总量) · 周限额 ❯ 倒计时 ❯ 到期天数`
147
+ 显示格式:`目录 ❯ 分支 ❯ 模型 ❯ 上下文窗口% · token 5h限额% · 周限额%5h倒计时 ❯ 到期天数`
148
+
149
+ **字段说明**:
150
+
151
+ | 字段 | 示例 | 含义 |
152
+ |------|------|------|
153
+ | 目录 | `cli` | 当前工作目录(短名) |
154
+ | 分支 | `main *` | Git 分支 + 未提交状态(`*`) |
155
+ | 模型 | `MiniMax-M3[1M][1m]` | 实时模型名(从 stdin 读) |
156
+ | 上下文 | `25% · 249.5k` | 上下文窗口使用 % + token 用量 |
157
+ | 5h 限额 | `5h 41% · W 6%` | 5h 限额百分比 + 周限额百分比 |
158
+ | 倒计时 | `2h59m` | 5h 限额下次重置倒计时 |
159
+ | 到期 | `剩291天` | 套餐到期剩余天数 |
160
+
161
+ > 自 1.2.2 起,5h 限额 block **总是显示**(即使 `total=0`),并加 `5h` 前缀区分上下文窗口。`total=0` 时不显示 `(X/Y)` 段。
140
162
 
141
163
  **颜色说明**:
142
164
 
@@ -171,11 +193,13 @@ my-app │ main * │ ...
171
193
 
172
194
  状态栏会智能显示当前会话的上下文窗口使用情况:
173
195
 
174
- - **有转录数据时**: 显示 `⚡ 百分比·已用 tokens`
175
- - 例如: `⚡ 85%·150.0k tokens` 表示已使用 150K tokens,占容量的 85%
196
+ - **有转录数据时**: 显示 `百分比 · 已用 tokens`(蓝色块)
197
+ - 例如: `25% · 249.5k` 表示已使用 249.5K tokens,占上下文窗口的 25%
176
198
 
177
199
  - **无转录数据时**: 仅显示上下文窗口总容量
178
- - 例如: `200K` 表示当前模型的上下文窗口大小
200
+ - 例如: `205K` 表示当前模型的上下文窗口大小
201
+
202
+ > 自 1.2.2 起,5h 限额独立显示在 `5h 41%` block(带 `5h` 前缀区分上下文窗口百分比)。
179
203
 
180
204
  **智能特性**:
181
205
 
@@ -218,10 +242,10 @@ my-app │ main * │ ...
218
242
  集成成功后,底部状态栏将显示:
219
243
 
220
244
  ```
221
- cli ❯  main *MiniMax-M* 205K ❯ 0% (4500/4500) · W ∞ ❯ 4h59m ❯ 336
245
+ cli main * MiniMax-M3[1M][1m] 25% · 249.5k 5h 41% · W 6% 2h59m 291
222
246
  ```
223
247
 
224
- 显示格式:`目录 ❯ 分支 ❯ 模型 ❯ 上下文百分比(已用/总量) · 周限额 ❯ 倒计时 ❯ 到期天数`
248
+ 显示格式:`目录 ❯ 分支 ❯ 模型 ❯ 上下文窗口% · token 5h限额% · 周限额%5h倒计时 ❯ 到期天数`
225
249
 
226
250
  **颜色说明**:
227
251
 
@@ -236,44 +260,46 @@ cli ❯  main * ❯ MiniMax-M* ❯ 205K ❯ 0% (4500/4500) · W ∞ ❯ 4h59m
236
260
  ┌──────────────────────────────────────────────────────┐
237
261
  │ MiniMax Claude Code 使用状态 │
238
262
  │ │
239
- 当前模型: MiniMax-M*
240
- │ 时间窗口: 05:00-10:00(UTC+8) │
241
- │ 剩余时间: 6 分钟后重置 │
263
+ 剩余时间: 3 小时 17 分钟后重置
242
264
  │ │
243
- │ 已用额度: █░░░░░░░░░░░░░░░░░░░░░░░░░░ 7% │
244
- │ 剩余: 4172/4500 次调用 │
265
+ │ 已用额度: █████████░░░░░░░░░░░░░░░░░░ 33% │
245
266
  │ │
246
- │ 周限额: 不受限制
247
- 套餐到期: 03/19/2027 (还剩 336 天)
267
+ │ 周限额: ░░░░░░░░░░░░░░░ 5%
268
+ 重置: 6 12 小时后重置
269
+ │ 套餐到期: 03/19/2027 (还剩 291 天) │
248
270
  │ │
249
- 📊 Token 消耗统计
250
- │ 昨日消耗: 5380.6万 │
251
- │ 近7天消耗: 4.8亿
252
- │ 当月消耗: 15亿
271
+ │ Token 消耗统计
272
+ │ 昨日消耗: 766.3万 │
273
+ │ 近7天消耗: 1039.9万
274
+ │ 当月消耗: 0
253
275
  │ │
254
- 📋 所有模型额度
255
- MiniMax-M* 7% 328/4500 ✓
256
- speech-hd 0% 0/19000 ✓
257
- │ Hailuo 0% 0/3 ✓ │
276
+ │ 所有模型额度
277
+ general 33% — OK
278
+ video 0% 0/3 OK
258
279
  │ ... │
259
280
  │ │
260
- │ 状态: 正常使用
281
+ │ 状态: 正常使用
261
282
  └──────────────────────────────────────────────────────┘
262
283
  ```
263
284
 
285
+ > 自 1.2.2 起:移除"当前模型"和"时间窗口"行(冗余信息),去除 emoji(`📊` `📋` `✓` `⚡` `⛔`),`total=0` 时不显示 `(X/Y)` 段。
286
+
264
287
  ### 紧凑模式
265
288
 
266
289
  ```
267
- MiniMax-M* 0% (4498/4500) 4 小时 59 分钟后重置 • ✓ 正常使用 • 剩余: 336
290
+ general 33% 3h17m W 5% 剩291
291
+ ```
292
+
293
+ > 紧凑模式直接调用 `minimax status --compact`。字段顺序:`已用% 倒计时 周限额% 剩N天`。
268
294
  ```
269
295
 
270
296
  ### 持续状态栏模式
271
297
 
272
298
  ```
273
- MiniMax 状态栏已启动
299
+ OK MiniMax 状态栏已启动
274
300
  按 Ctrl+C 退出
275
301
 
276
- [ MiniMax-M2 27% 3307/4500 • 1h26m ⚡
302
+ [general 27% 1h26m W 5%
277
303
  ```
278
304
 
279
305
  ## 截图演示
@@ -290,8 +316,10 @@ cli ❯  main * ❯ MiniMax-M* ❯ 205K ❯ 0% (4500/4500) · W ∞ ❯ 4h59m
290
316
 
291
317
  | 命令 | 描述 | 示例 |
292
318
  | --------------------- | ------------------------------------------- | ----------------------------- |
293
- | `minimax auth` | 设置认证凭据 | `minimax auth <token>` |
319
+ | `minimax auth` | 设置认证凭据(只需要 token,不需要 groupId) | `minimax auth <token>` |
294
320
  | `minimax status` | 显示当前使用状态(支持 --compact、--watch) | `minimax status` |
321
+ | `minimax list` | 列出所有模型用量 | `minimax list` |
322
+ | `minimax health` | 检查配置和连接状态 | `minimax health` |
295
323
  | `minimax bar` | 终端底部持续状态栏 | `minimax bar` |
296
324
  | `minimax statusline` | Claude Code 状态栏集成 | 用于 Claude Code 配置 |
297
325
  | `minimax droid-statusline` | Droid 状态栏集成 | 用于 Droid 配置 |
@@ -304,17 +332,20 @@ cli ❯  main * ❯ MiniMax-M* ❯ 205K ❯ 0% (4500/4500) · W ∞ ❯ 4h59m
304
332
  | ------ | ---------------------------------- |
305
333
  | 目录 | 当前工作目录 |
306
334
  | 分支 | Git 分支名称(含未提交状态) |
307
- | 模型 | MiniMax 模型名称 |
308
- | 上下文 | 上下文窗口使用 tokens |
309
- | Usage | 使用量百分比(已用/总量) |
335
+ | 模型 | MiniMax 模型名称(实时) |
336
+ | 上下文 | 上下文窗口使用 % + tokens |
337
+ | 5h 限额 | 5h 限额使用 %(即使 total=0 也显示)|
310
338
  | 周限额 | 周配额使用情况,∞ 表示无限制 |
311
- | | 额度重置倒计时 |
339
+ | 倒计时 | 5h 限额重置倒计时 |
312
340
  | 到期 | 订阅到期时间(颜色动态变化) |
313
341
 
314
342
  ### 颜色规则
315
343
 
316
344
  | 场景 | 颜色 | 说明 |
317
345
  | ------------- | ---- | -------- |
346
+ | 5h 限额 ≥85% | 红色 | 危险状态 |
347
+ | 5h 限额 60-85% | 黄色 | 注意使用 |
348
+ | 5h 限额 <60% | 绿色 | 正常使用 |
318
349
  | 上下文 ≥85% | 红色 | 危险状态 |
319
350
  | 上下文 60-85% | 黄色 | 注意使用 |
320
351
  | 上下文 <60% | 绿色 | 正常使用 |
@@ -322,6 +353,60 @@ cli ❯  main * ❯ MiniMax-M* ❯ 205K ❯ 0% (4500/4500) · W ∞ ❯ 4h59m
322
353
  | 到期 ≤ 7天 | 黄色 | 即将到期 |
323
354
  | 到期 > 7天 | 绿色 | 订阅正常 |
324
355
 
356
+ ## VSCode 扩展说明
357
+
358
+ 自 1.4.0 起,VSCode 扩展 Tooltip 改用**套餐卡**布局(跟官网 platform.minimaxi.com/console/usage 一致),不再用统一表格。
359
+
360
+ ### 套餐卡布局
361
+
362
+ 每张套餐独立卡片:
363
+
364
+ ```
365
+ MINIMAX · 配额面板 周期: 2026-06-01 — 2026-06-07
366
+ ─────────────────────────────────────────
367
+
368
+ ▍ 5h 限额 · 4h 12m 后重置
369
+ ▰▰▰░░░░░░░░░░░░░ 18%
370
+
371
+ ▍ 周限额 · 6天 12h 后重置
372
+ ▰░░░░░░░░░░░░░░░ 3%
373
+
374
+ ▍ 视频赠送 · 13h 18m 后重置
375
+ ░░░░░░░░░░░░░░░░ 0% 0/3
376
+
377
+ ─────────────────────────────────────────
378
+ Token 消耗
379
+ 昨日消耗 近 7 天 当月消耗
380
+ 766.3万 1039.9万 0
381
+ ─────────────────────────────────────────
382
+ 到期 291天 · 更新于 11:09:40 · 点击刷新
383
+ ```
384
+
385
+ > **进度条字符** `▰` `▱` (U+25B0 / U+25B1):在中文 fallback 字体(Microsoft YaHei)下渲染为斜方块纹理。在 Cascadia Code / Consolas 等宽字体下渲染为实心方块。
386
+
387
+ ### 套餐卡字段
388
+
389
+ | 套餐 | 数据来源 | 示例 |
390
+ |------|----------|------|
391
+ | 5h 限额 | `general` 模型 `current_interval_*` | `▰▰▰░░░ 18%` |
392
+ | 周限额 | `general` 模型 `current_weekly_*` | `▰░░░░░ 3%` |
393
+ | 视频赠送 | `video` 模型 `current_interval_*` | `░░░░░░ 0% 0/3` |
394
+ | Hailuo | `Hailuo-*` 模型 | `▰▰░░░░░ 33% 1/3` |
395
+ | music | `music-*` 模型 | `░░░░░░ 0% 0/10` |
396
+ | image | `image-*` 模型 | `░░░░░░ 0% 0/20` |
397
+ | speech | `speech-*` 模型 | `░░░░░░ 0% 0/100` |
398
+
399
+ > **多模型数据过滤规则**:保留有 `remaining_percent` 数据的模型(即使 `total=0`)。`status != 1` 的模型视为废弃,不显示。
400
+
401
+ ### 已知限制:积分余额不在 VSCode 中显示
402
+
403
+ MiniMax 官方积分余额接口(`/backend/account/token_plan_credit`)**仅支持 Cookie 鉴权**:
404
+
405
+ - ✅ 浏览器(带 Cookie):能调通
406
+ - ❌ VSCode 扩展(纯后端 Bearer sk-cp-...):401 not login
407
+
408
+ 如需查看积分余额,请前往 [platform.minimaxi.com/console/usage](https://platform.minimaxi.com/console/usage)。本工具**未实现**积分余额的本地展示,**因为**让用户在 VSCode 设置里手动粘贴 Cookie 字符串得不偿失。
409
+
325
410
  ## 配置文件
326
411
 
327
412
  ### 默认位置
package/cli/api.js CHANGED
@@ -81,10 +81,11 @@ class MinimaxAPI {
81
81
 
82
82
  try {
83
83
  const response = await axios.get(
84
- `https://www.minimaxi.com/v1/token_plan/remains`,
84
+ `https://www.minimaxi.com/v1/api/openplatform/coding_plan/remains`,
85
85
  {
86
86
  headers: {
87
87
  Authorization: `Bearer ${this.token}`,
88
+ referer: "https://platform.minimaxi.com/",
88
89
  Accept: "application/json",
89
90
  },
90
91
  timeout: 10000, // 10秒超时
@@ -296,24 +297,33 @@ class MinimaxAPI {
296
297
  const endTime = new Date(modelData.end_time);
297
298
 
298
299
  // Calculate counts
299
- // 新接口 usage_count 是已使用次数(正确值)
300
- const usedCount = modelData.current_interval_usage_count;
301
- const remainingCount = modelData.current_interval_total_count - usedCount;
302
-
303
- // Calculate percentage - 基于已使用次数的百分比
304
- const usedPercentage = Math.round(
305
- (usedCount / modelData.current_interval_total_count) * 100
306
- );
300
+ // 新接口 usage_count 在 video 上语义不一致(usage=3/total=3 但 remaining_percent=100
301
+ // 表示 0% 已用),用 usedPercentage 反算 used(用户视角 = 基于官网显示的已用%)。
302
+ // 这让 video: total=3, usedPercentage=0 used=0, remaining=3("3/3 剩余"),跟官网一致。
303
+ const totalCount = modelData.current_interval_total_count;
304
+ const remainingPct = modelData.current_interval_remaining_percent;
305
+ const usedPercentage = remainingPct !== undefined && remainingPct !== null
306
+ ? Math.round(100 - remainingPct)
307
+ : (totalCount > 0 ? Math.round((modelData.current_interval_usage_count / totalCount) * 100) : 0);
308
+ const usedCount = totalCount > 0 ? Math.round((totalCount * usedPercentage) / 100) : 0;
309
+ const remainingCount = totalCount - usedCount;
307
310
 
308
311
  // Calculate remaining time in human-readable format
309
312
  const remainingMs = modelData.remains_time;
310
313
  const hours = Math.floor(remainingMs / (1000 * 60 * 60));
311
314
  const minutes = Math.floor((remainingMs % (1000 * 60 * 60)) / (1000 * 60));
312
315
 
313
- // Calculate weekly usage data
316
+ // Calculate weekly usage data — 同样基于 remaining_percent 反转
314
317
  const weeklyUsed = modelData.current_weekly_usage_count;
315
318
  const weeklyTotal = modelData.current_weekly_total_count;
316
- const weeklyPercentage = weeklyTotal > 0 ? Math.floor((weeklyUsed / weeklyTotal) * 100) : 0;
319
+ const weeklyRemainingPct = modelData.current_weekly_remaining_percent;
320
+ const weeklyPercentage = weeklyRemainingPct !== undefined && weeklyRemainingPct !== null
321
+ ? Math.round(100 - weeklyRemainingPct)
322
+ : (weeklyTotal > 0 ? Math.floor((weeklyUsed / weeklyTotal) * 100) : 0);
323
+ // ⚠ Bug fix: 旧逻辑 weeklyTotal === 0 判 unlimited,但主人账号的 `general`
324
+ // 模型 weekly_total=0、weekly_remaining_percent=97(3% 已用,有数据)。
325
+ // 真正的"无限"应当是 total=0 **且** remaining_percent 也没返回。
326
+ const weeklyUnlimited = weeklyTotal === 0 && (modelData.current_weekly_remaining_percent == null);
317
327
  const weeklyRemainingMs = modelData.weekly_remains_time;
318
328
  const weeklyDays = Math.floor(weeklyRemainingMs / (1000 * 60 * 60 * 24));
319
329
  const weeklyHours = Math.floor((weeklyRemainingMs % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
@@ -395,7 +405,7 @@ class MinimaxAPI {
395
405
  percentage: weeklyPercentage,
396
406
  days: weeklyDays,
397
407
  hours: weeklyHours,
398
- unlimited: weeklyTotal === 0,
408
+ unlimited: weeklyUnlimited,
399
409
  text: weeklyDays > 0
400
410
  ? `${weeklyDays} 天 ${weeklyHours} 小时后重置`
401
411
  : `${weeklyHours} 小时后重置`,
@@ -417,16 +427,25 @@ class MinimaxAPI {
417
427
 
418
428
  return apiData.model_remains.map(modelData => {
419
429
  const totalCount = modelData.current_interval_total_count;
420
- // 新接口 usage_count 是已使用次数(正确值)
421
- const usedCount = modelData.current_interval_usage_count;
430
+ // 新接口 usage_count 在 video 上语义不一致;用 usedPercentage 反算 used
431
+ // 跟官网一致:video total=3, used%=0 → used=0, remaining=3("3/3 剩余")
432
+ const remainingPct = modelData.current_interval_remaining_percent;
433
+ const usedPercentage = remainingPct !== undefined && remainingPct !== null
434
+ ? Math.round(100 - remainingPct)
435
+ : (totalCount > 0 ? Math.round((modelData.current_interval_usage_count / totalCount) * 100) : 0);
436
+ const usedCount = totalCount > 0 ? Math.round((totalCount * usedPercentage) / 100) : 0;
422
437
  const remainingCount = totalCount - usedCount;
423
- const usedPercentage = totalCount > 0 ? Math.round((usedCount / totalCount) * 100) : 0;
424
438
 
425
- // Weekly data
439
+ // Weekly data — 同样基于 remaining_percent 反转
426
440
  const weeklyTotal = modelData.current_weekly_total_count || 0;
427
441
  const weeklyUsed = modelData.current_weekly_usage_count || 0;
428
442
  const weeklyRemainingCount = weeklyTotal - weeklyUsed;
429
- const weeklyPercentage = weeklyTotal > 0 ? Math.floor((weeklyUsed / weeklyTotal) * 100) : 0;
443
+ const weeklyRemainingPct = modelData.current_weekly_remaining_percent;
444
+ const weeklyPercentage = weeklyRemainingPct !== undefined && weeklyRemainingPct !== null
445
+ ? Math.round(100 - weeklyRemainingPct)
446
+ : (weeklyTotal > 0 ? Math.floor((weeklyUsed / weeklyTotal) * 100) : 0);
447
+ // Bug fix: 同 parseUsageData — 真正"无限"是 total=0 且 remaining_percent 也没
448
+ const weeklyUnlimited = weeklyTotal === 0 && (modelData.current_weekly_remaining_percent == null);
430
449
 
431
450
  return {
432
451
  name: modelData.model_name,
@@ -434,7 +453,7 @@ class MinimaxAPI {
434
453
  remaining: remainingCount,
435
454
  total: totalCount,
436
455
  percentage: usedPercentage,
437
- unlimited: weeklyTotal === 0,
456
+ unlimited: weeklyUnlimited,
438
457
  weeklyPercentage,
439
458
  weeklyTotal,
440
459
  weeklyRemainingCount,
package/cli/index.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  // Force color output even in non-TTY environments (e.g., Claude Code statusline)
4
4
  process.env.FORCE_COLOR = "1";
@@ -244,6 +244,10 @@ program
244
244
  if (stdinData) {
245
245
  if (stdinData.model && stdinData.model.display_name) {
246
246
  displayModel = stdinData.model.display_name;
247
+ // ⚠ 去掉尾部的 [1m](lowercase m)后缀 — Claude Code 给 reasoning model
248
+ // 自动加这个标识(区别于 [1M] 大写 = 1M context window),statusline 渲染
249
+ // 看起来重复,去掉后模型名更清爽。
250
+ displayModel = displayModel.replace(/\[1m\]$/, '');
247
251
  modelId = stdinData.model.id;
248
252
  } else if (stdinData.model && stdinData.model.id) {
249
253
  displayModel = stdinData.model.id;
package/cli/renderer.js CHANGED
@@ -100,13 +100,17 @@ class Renderer {
100
100
  }
101
101
  }
102
102
 
103
- if (usage && usage.total > 0) {
103
+ // 5h 限额 block 总是显示(即使 total=0 也要显示百分比 + 5h 前缀)
104
+ // ⚠ 不再用 usage.total > 0 过滤(5h 限额数据对 general 模型 total=0 也要显示)
105
+ if (usage && usage.percentage !== undefined && usage.percentage !== null) {
104
106
  let bg = '#065F46'; // safe (Emerald 800 - dark enough for white text)
105
107
  if (usagePercentage >= 95) bg = '#991B1B'; // danger (Red 800)
106
108
  else if (usagePercentage >= 75) bg = '#9A3412'; // warn (Orange 800)
107
109
 
108
- let usageText = ` ${usagePercentage}% (${usage.remaining}/${usage.total}) `;
109
-
110
+ // total=0 时不显示 (X/Y)
111
+ const usedTotalSuffix = usage.total > 0 ? ` (${usage.remaining}/${usage.total})` : '';
112
+ let usageText = ` 5h ${usagePercentage}%${usedTotalSuffix} `;
113
+
110
114
  if (weekly) {
111
115
  if (weekly.unlimited) {
112
116
  usageText += `· W ∞ `;
package/cli/status.js CHANGED
@@ -35,7 +35,7 @@ class StatusBar {
35
35
 
36
36
  const lines = [];
37
37
  lines.push('');
38
- lines.push(chalk.bold('📊 Token 消耗统计'));
38
+ lines.push(chalk.bold('Token 消耗统计'));
39
39
 
40
40
  // 计算表格宽度
41
41
  const leftWidth = 12; // "昨日消耗: "
@@ -63,7 +63,7 @@ class StatusBar {
63
63
 
64
64
  const lines = [];
65
65
  lines.push('');
66
- lines.push(chalk.bold('📋 所有模型额度'));
66
+ lines.push(chalk.bold('所有模型额度'));
67
67
 
68
68
  // 简化模型名称映射
69
69
  const shortName = (name) => {
@@ -86,9 +86,9 @@ class StatusBar {
86
86
 
87
87
  // 显示状态
88
88
  const getStatusText = (percentage) => {
89
- if (percentage >= 85) return '';
90
- if (percentage >= 60) return '';
91
- return '';
89
+ if (percentage >= 85) return 'X';
90
+ if (percentage >= 60) return '!';
91
+ return 'OK';
92
92
  };
93
93
 
94
94
  // 每行显示一个模型
@@ -97,7 +97,8 @@ class StatusBar {
97
97
  const color = getStatusColor(model.percentage);
98
98
  const status = getStatusText(model.percentage);
99
99
  const pct = `${model.percentage}%`;
100
- const usedTotal = `${model.used}/${model.total}`;
100
+ // total=0 时不显示 X/Y(避免 0/0 这种无数据展示)
101
+ const usedTotal = model.total > 0 ? `${model.used}/${model.total}` : '—';
101
102
 
102
103
  lines.push(` ${color(short.padEnd(15))} ${color(pct.padEnd(5))} ${color(usedTotal.padEnd(12))} ${color(status)}`);
103
104
  }
@@ -143,13 +144,6 @@ class StatusBar {
143
144
 
144
145
  contentLines.push('');
145
146
 
146
- // 模型名称
147
- contentLines.push(`${chalk.cyan('当前模型:')} ${modelName}`);
148
-
149
- // 时间窗口
150
- const timeWindowText = `${timeWindow.start}-${timeWindow.end}(${timeWindow.timezone})`;
151
- contentLines.push(`${chalk.cyan('时间窗口:')} ${timeWindowText}`);
152
-
153
147
  // 剩余时间
154
148
  contentLines.push(`${chalk.cyan('剩余时间:')} ${remaining.text}`);
155
149
 
@@ -158,8 +152,10 @@ class StatusBar {
158
152
  // 使用百分比与进度条
159
153
  contentLines.push(`${chalk.cyan('已用额度:')} ${progressBar} ${usage.percentage}%`);
160
154
 
161
- // 剩余次数
162
- contentLines.push(`${chalk.dim(' 剩余:')} ${usage.remaining}/${usage.total} 次调用`);
155
+ // 剩余次数(total=0 时不显示)
156
+ if (usage.total > 0) {
157
+ contentLines.push(`${chalk.dim(' 剩余:')} ${usage.remaining}/${usage.total} 次调用`);
158
+ }
163
159
 
164
160
  // 周用量(如果有数据)
165
161
  if (weekly) {
@@ -176,7 +172,9 @@ class StatusBar {
176
172
  15 - Math.floor((weeklyPercent / 100) * 15),
177
173
  weeklyPercent
178
174
  );
179
- contentLines.push(`${chalk.cyan('周限额:')} ${weeklyColor(weeklyProgress)} ${weeklyColor(weekly.percentage + '%')} (${weekly.used}/${weekly.total})`);
175
+ // total=0 时不显示 (X/Y)
176
+ const weeklyUsedTotal = weekly.total > 0 ? ` (${weekly.used}/${weekly.total})` : '';
177
+ contentLines.push(`${chalk.cyan('周限额:')} ${weeklyColor(weeklyProgress)} ${weeklyColor(weekly.percentage + '%')}${weeklyUsedTotal}`);
180
178
  contentLines.push(`${chalk.dim(' 重置:')} ${weekly.text}`);
181
179
  }
182
180
  }
@@ -249,13 +247,13 @@ class StatusBar {
249
247
  }
250
248
 
251
249
  getStatus(percentage) {
252
- // 基于已使用百分比
250
+ // 基于已使用百分比(去 emoji 跟 vscode 1.0.7 风格一致)
253
251
  if (percentage >= 85) {
254
- return '即将用完';
252
+ return '即将用完';
255
253
  } else if (percentage >= 60) {
256
- return '注意使用';
254
+ return '注意使用';
257
255
  } else {
258
- return '正常使用';
256
+ return '正常使用';
259
257
  }
260
258
  }
261
259
 
@@ -287,7 +285,7 @@ class StatusBar {
287
285
 
288
286
  const lines = [];
289
287
  lines.push('');
290
- lines.push(chalk.bold('📋 所有模型额度'));
288
+ lines.push(chalk.bold('所有模型额度'));
291
289
 
292
290
  // 表头
293
291
  lines.push(chalk.gray('─'.repeat(55)));
package/cli/statusbar.js CHANGED
@@ -10,7 +10,7 @@ class StatusBar {
10
10
  }
11
11
 
12
12
  render() {
13
- const { usage, remaining, modelName, weekly } = this.data;
13
+ const { usage, remaining, weekly, expiry } = this.data;
14
14
  const percentage = usage.percentage;
15
15
 
16
16
  // 基于已使用百分比:使用越多越危险
@@ -21,22 +21,29 @@ class StatusBar {
21
21
  color = chalk.yellow;
22
22
  }
23
23
 
24
- const statusIcon = percentage >= 85 ? '⚠' : percentage >= 60 ? '⚡' : '✓';
25
24
  const remainingText = remaining.hours > 0
26
25
  ? `${remaining.hours}h${remaining.minutes}m`
27
26
  : `${remaining.minutes}m`;
28
27
 
28
+ // total=0 时不显示 X/Y(避免 0/0 这种无数据展示,保留百分比)
29
+ const usedTotalSuffix = usage.total > 0 ? ` (${usage.used}/${usage.total})` : '';
30
+
29
31
  let weeklyStr = '';
30
32
  if (weekly) {
31
33
  if (weekly.unlimited) {
32
- weeklyStr = ` ${chalk.blue('W')} ♾️`;
34
+ weeklyStr = ` ${chalk.blue('W')} ∞`;
33
35
  } else {
34
36
  const weeklyColor = weekly.percentage >= 85 ? chalk.red : weekly.percentage >= 60 ? chalk.yellow : chalk.green;
35
- weeklyStr = ` ${chalk.blue('W')} ${weeklyColor(weekly.percentage + '%')}`;
37
+ // total=0 时不显示 (X/Y)
38
+ const weeklySuffix = weekly.total > 0 ? ` (${weekly.used}/${weekly.total})` : '';
39
+ weeklyStr = ` ${chalk.blue('W')} ${weeklyColor(weekly.percentage + '%')}${weeklySuffix}`;
36
40
  }
37
41
  }
38
42
 
39
- return `${color('●')} ${modelName} ${color(percentage + '%')} (${usage.used}/${usage.total}) ${remainingText}${weeklyStr} ${statusIcon}`;
43
+ // 到期信息(剩 N 天)— claude-code statusline 对齐
44
+ const expiryStr = expiry ? ` 剩${expiry.daysRemaining}天` : '';
45
+
46
+ return `${color(percentage + '%')}${usedTotalSuffix} ${remainingText}${weeklyStr}${expiryStr}`;
40
47
  }
41
48
  }
42
49
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minimax-status",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "MiniMax Claude Code 使用状态监控工具",
5
5
  "bin": {
6
6
  "minimax-status": "cli/index.js",