@aaroncarry/pi-usage 0.2.0 → 0.2.1

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
@@ -30,19 +30,76 @@ Codex 5h 13% used · weekly 2% used · session 10.0k tok $0.020 · 7d ▁▁▁
30
30
  gpt-5.6-terra █████░░░░░░░░░░░░░░░ 21% 10k
31
31
  ```
32
32
 
33
- The dashboard opens on the **Charts** view (braille time series); `v` cycles Charts → Heatmap → Insights → Table. **Insights** is a tmustier-style cost analysis: where the spend went (top model share, cache leverage, reasoning share) and worth-attention alarms (likely cache misses with their cost, daily burn vs the prior 4 weeks, single-session concentration).
33
+ The dashboard opens on the **Charts** view; `v` cycles Charts → Heatmap → Insights → Table. Four views, one example each:
34
+
35
+ ## Trends dashboard
36
+
37
+ Keyboard: `v` cycle views · `←→` period (7d / 30d / 90d / all) · `m` tokens ↔ cost · `g` group by provider / project (table) · `↑↓` + `enter` expand a provider row (table) · `esc` close.
38
+
39
+ **Charts** — braille time series grouped by model, plus the model distribution. Same model ids served by different providers stay separate (`model (provider)`):
40
+
41
+ ```
42
+ Usage trends [Charts] Heatmap Insights Table 7d [30d] 90d all
43
+ Total 66k tok · Cost $0.04 · Peak 39k (9/13) · Streak 2d
44
+ 39k ┤ ⢸⡄
45
+ │ ⣿⠘⡄
46
+ │ ⡇⡇⢸
47
+ │ ⢸⠇⢣⡎
48
+ 17k ┤ ⢸ ⢸⠃
49
+ │ ⡏ ⢸⡆
50
+ │ ⡇⢀⡇⢇
51
+ 0 └⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣸⣔⣱⠑⢼
52
+ 08-14 08-29 09-13
53
+ ● Total ● gpt-5.6-luna ● gpt-5.6-terra ● deepseek-flash
54
+ Models · 30d
55
+ gpt-5.6-luna (openai-codex) █████████████████░░░ 52% 34k
56
+ gpt-5.6-terra (lingsuan) █████░░░░░░░░░░░░░░░ 24% 16k
57
+ deepseek-flash ██░░░░░░░░░░░░░░░░░░ 7% 4.5k
58
+ m metric · ←→ period · v view · g group · esc close
59
+ ```
60
+
61
+ **Heatmap** — 12-week activity calendar with streaks:
62
+
63
+ ```
64
+ Activity · 12 weeks Streak 2d
65
+ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
66
+ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
67
+ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
68
+ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
69
+ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ █ ░
70
+ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ █
71
+ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
72
+ ░ none ▒ light ▓ mid █ heavy
73
+ Peak 39k tokens on 9/13 · Total 66k
74
+ ```
75
+
76
+ **Table** — provider→model line items; `enter` expands a provider into its models:
34
77
 
35
78
  ```
36
- Usage trends [Charts] Heatmap Table
37
- Total 66k tok · $0.04 · peak 39k (9/13)
38
- 39k ┤ ⢸⡄
39
- │ ⣿⠘⡄
40
- 0 └⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣸⣔⣱⠑⢼
41
- 08-28 09-13
42
- GLM ████░░░░ 70%
43
79
  Provider / Model Sessions Msgs Cost Tokens ↑In ↓Out Cache
44
- ▾ openai-codex - 16 $0.04 44k 39k 5.3k 150k
80
+ ▾ openai-codex 2 16 $0.04 44k 39k 5.3k 150k
81
+ gpt-5.6-terra 1 2 $0.02 10k 10k 53 9.7k
45
82
  gpt-5.6-luna 1 14 $0.01 34k 29k 5.2k 140k
83
+ ▸ deepseek 1 8 $0.003 4.5k 3.2k 1.2k 16k
84
+ ▸ lingsuan 1 4 - 17k 16k 1.1k 12k
85
+ ─────────────────────────────────────────────────────────────────────
86
+ Total 4 28 $0.04 66k 58k 7.6k 177k
87
+ Tokens = Input + Output + CacheWrite · ↑In = Input + CacheWrite
88
+ ```
89
+
90
+ **Insights** — where the spend went, and waste patterns worth attention:
91
+
92
+ ```
93
+ What's contributing to your cost? 30d
94
+ Where it went
95
+ $0.02 gpt-5.6-terra (openai-codex) drives 57% of your spend
96
+ ~ routing some traffic to a cheaper model is the biggest cost lever
97
+ 73% of processed tokens came from cache reads
98
+ 48% of output is reasoning (thinking) tokens
99
+ ~ lowering the thinking level on routine tasks cuts this hidden spend
100
+ Worth attention
101
+ $0.50 2 likely cache misses re-read the prompt at full price
102
+ ~ pauses over 5 minutes and mid-session model switches invalidate the prompt cache
46
103
  ```
47
104
 
48
105
  Trends are aggregated from pi's session files (`<agentDir>/sessions/**/*.jsonl`) with an incremental disk cache; forked session copies are deduplicated. Token metric = input + output + cache write.
package/README.zh-CN.md CHANGED
@@ -32,22 +32,79 @@ Codex 5h 13% used · weekly 2% used · session 10.0k tok $0.020 · 7d ▁▁▁
32
32
  gpt-5.6-terra █████░░░░░░░░░░░░░░░ 21% 10k
33
33
  ```
34
34
 
35
- 仪表盘默认打开 **Charts** 视图(盲文时间序列);`v` 循环切换 Charts → Heatmap → **Insights** → Table。Insights 是成本洞察:Where it went(top 模型占比、缓存覆盖率、思考 token 占比)+ Worth attention(疑似缓存未命中及代价、日消耗相对前 4 周的增速、单会话消费集中度)。
35
+ 仪表盘默认打开 **Charts** 视图(盲文时间序列);`v` 循环 Charts → Heatmap → Insights → Table。四个视图各举一例:
36
+
37
+ ## 趋势仪表盘
38
+
39
+ 按键:`v` 切视图 · `←→` 切周期(7d / 30d / 90d / all)· `m` 切 tokens ↔ cost · `g` 切换按厂商 / 按项目分组(明细表)· `↑↓` + `enter` 展开厂商行(明细表)· `esc` 关闭。
40
+
41
+ **Charts** —— 按模型分组的盲文时间序列 + 模型分布。同一模型 id 由不同厂商提供时保持独立并标注 `(厂商)`:
42
+
43
+ ```
44
+ Usage trends [Charts] Heatmap Insights Table 7d [30d] 90d all
45
+ Total 66k tok · Cost $0.04 · Peak 39k (9/13) · Streak 2d
46
+ 39k ┤ ⢸⡄
47
+ │ ⣿⠘⡄
48
+ │ ⡇⡇⢸
49
+ │ ⢸⠇⢣⡎
50
+ 17k ┤ ⢸ ⢸⠃
51
+ │ ⡏ ⢸⡆
52
+ │ ⡇⢀⡇⢇
53
+ 0 └⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣸⣔⣱⠑⢼
54
+ 08-14 08-29 09-13
55
+ ● Total ● gpt-5.6-luna ● gpt-5.6-terra ● deepseek-flash
56
+ Models · 30d
57
+ gpt-5.6-luna (openai-codex) █████████████████░░░ 52% 34k
58
+ gpt-5.6-terra (lingsuan) █████░░░░░░░░░░░░░░░ 24% 16k
59
+ deepseek-flash ██░░░░░░░░░░░░░░░░░░ 7% 4.5k
60
+ m metric · ←→ period · v view · g group · esc close
61
+ ```
62
+
63
+ **Heatmap** —— 12 周活动日历 + 连续天数:
64
+
65
+ ```
66
+ Activity · 12 weeks Streak 2d
67
+ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
68
+ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
69
+ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
70
+ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
71
+ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ █ ░
72
+ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ▒ █
73
+ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
74
+ ░ none ▒ light ▓ mid █ heavy
75
+ Peak 39k tokens on 9/13 · Total 66k
76
+ ```
77
+
78
+ **Table** —— 厂商→模型明细条目;`enter` 展开某厂商的模型明细:
36
79
 
37
80
  ```
38
- Usage trends [Charts] Heatmap Table
39
- Total 66k tok · $0.04 · peak 39k (9/13)
40
- 39k ┤ ⢸⡄
41
- │ ⣿⠘⡄
42
- 0 └⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣸⣔⣱⠑⢼
43
- 08-28 09-13
44
81
  Provider / Model Sessions Msgs Cost Tokens ↑In ↓Out Cache
45
- ▾ openai-codex - 16 $0.04 44k 39k 5.3k 150k
82
+ ▾ openai-codex 2 16 $0.04 44k 39k 5.3k 150k
83
+ gpt-5.6-terra 1 2 $0.02 10k 10k 53 9.7k
46
84
  gpt-5.6-luna 1 14 $0.01 34k 29k 5.2k 140k
85
+ ▸ deepseek 1 8 $0.003 4.5k 3.2k 1.2k 16k
86
+ ▸ lingsuan 1 4 - 17k 16k 1.1k 12k
87
+ ─────────────────────────────────────────────────────────────────────
88
+ Total 4 28 $0.04 66k 58k 7.6k 177k
89
+ Tokens = Input + Output + CacheWrite · ↑In = Input + CacheWrite
47
90
  ```
48
91
 
49
- 趋势数据聚合自 pi 的会话文件(`<agentDir>/sessions/**/*.jsonl`),带增量磁盘缓存;分叉会话副本自动去重。Token 口径 = input + output + cache 写入。
92
+ **Insights** —— 花费去向 + 值得注意的浪费模式:
50
93
 
94
+ ```
95
+ What's contributing to your cost? 30d
96
+ Where it went
97
+ $0.02 gpt-5.6-terra (openai-codex) drives 57% of your spend
98
+ ~ routing some traffic to a cheaper model is the biggest cost lever
99
+ 73% of processed tokens came from cache reads
100
+ 48% of output is reasoning (thinking) tokens
101
+ ~ lowering the thinking level on routine tasks cuts this hidden spend
102
+ Worth attention
103
+ $0.50 2 likely cache misses re-read the prompt at full price
104
+ ~ pauses over 5 minutes and mid-session model switches invalidate the prompt cache
105
+ ```
106
+
107
+ 趋势数据聚合自 pi 的会话文件(`<agentDir>/sessions/**/*.jsonl`),带增量磁盘缓存;分叉会话副本自动去重。Token 口径 = input + output + cache 写入。
51
108
  ## 命令
52
109
 
53
110
  | 命令 | 作用 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aaroncarry/pi-usage",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Usage and balance viewer for pi: subscription quota windows, prepaid balances, and session consumption in a footer status line and a /usage card",
5
5
  "type": "module",
6
6
  "license": "MIT",