opencode-usage-insights 0.1.3 → 0.3.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/docs/demo.md ADDED
@@ -0,0 +1,212 @@
1
+ # Demo output
2
+
3
+ Generated with `bun run demo 100` against a seeded throwaway database (times
4
+ render in the local timezone). `bun run docs:images` captures the screenshots
5
+ from the same database, through the same components the TUI renders.
6
+
7
+ ## The line
8
+
9
+ ![The telemetry line after a turn](images/line.png)
10
+
11
+ ## The sidebar
12
+
13
+ ![The session sidebar: the session totals and its last turns](images/sidebar.png)
14
+
15
+ ## The panel
16
+
17
+ ![The /usage-insights overview view](images/panel-overview.png)
18
+
19
+ ![The /usage-insights providers view](images/panel-providers.png)
20
+
21
+ ![The /usage-insights cache view](images/panel-cache.png)
22
+
23
+ ## Full output
24
+
25
+ ```text
26
+ turn · prompt cache survived (the provider and model that ran the turn)
27
+ ────────────────────────────────────────────────────────────────────────────────────────────────────
28
+ 09:29:00 · Δ 24m00s · opencode/deepseek-v4.1-flash-free · in 9.4k (1.62M), cached 1.61M, out 1.25k, cost $0.0600 · sess in 107.1k (3M), cached 2.89M, out 7k, cost $0.2700
29
+
30
+ turn · prompt cache expired after an idle gap
31
+ ────────────────────────────────────────────────────────────────────────────────────────────────────
32
+ 15:09:00 · Δ 1d0h · opencode/glm-5.3-flash · in 63.7k (76.1k), cached 12.4k, out 4.8k, cost $0.4400 · sess in 121.7k (754.1k), cached 632.4k, out 9.9k, cost $0.7600 · ⚠ cache expired (−607.6k)
33
+
34
+ turn · provider changed (opencode → anthropic)
35
+ ────────────────────────────────────────────────────────────────────────────────────────────────────
36
+ 09:52:00 · Δ 17m00s · anthropic/claude-opus-4.6 · changed · in 12.8k (108.8k), cached 96k, out 3.3k, cost $1.42 · sess in 130.3k (3.37M), cached 3.24M, out 8.25k, cost $1.69
37
+
38
+ turn · tool-call loop, latest view (the prompt size the turn ended with)
39
+ ────────────────────────────────────────────────────────────────────────────────────────────────────
40
+ 21:27:00 · opencode/deepseek-v4.1-flash-free · 3 steps · in 1.02k (292.6k), cached 291.6k, out 1.49k, cost $0.0900 · sess in 107.1k (3M), cached 2.89M, out 7k, cost $0.2700
41
+
42
+ turn · tool-call loop, sum view (turnTotals: "sum" — every step of the turn)
43
+ ────────────────────────────────────────────────────────────────────────────────────────────────────
44
+ 21:27:00 · opencode/deepseek-v4.1-flash-free · 3 steps · in 2.67k (875.2k), cached 872.6k, out 2.23k, cost $0.0900 · sess in 107.1k (3M), cached 2.89M, out 7k, cost $0.2700
45
+
46
+ turn · response still streaming (no line until the response ends)
47
+ ────────────────────────────────────────────────────────────────────────────────────────────────────
48
+ (no line yet)
49
+
50
+ sidebar (the session's totals, then the turns — three lines each, plus the model at both ends of the block and on every change)
51
+ ────────────────────────────────────────────────────────────────────────────────────────────────────
52
+ session
53
+ 3 steps · in 130.3k
54
+ cached 3.24M · out 8.25k
55
+ hit 96.1% · 1618/s · $1.69
56
+
57
+ turns
58
+ 09:42 anthropic
59
+ claude-opus-4.6
60
+ in 23.8k (119.8k) · out 3.3k
61
+ hit 80.1% · 1179/s · $1.42
62
+ 09:24 opencode
63
+ deepseek-v4.1-flash-free
64
+ in 10.3k (1.62M) · out 1.25k
65
+ hit 99.4% · 2152/s · $0.2700
66
+
67
+ /usage-insights overview
68
+ ────────────────────────────────────────────────────────────────────────────────────────────────────
69
+ all time · 7 steps · 3 sessions · 6 prompts
70
+ steps 7 in 287.1k
71
+ prompt 4.87M cached 4.58M
72
+ hit 94.1% out 26.6k
73
+ write 45.6k reasoning 900
74
+ cost $2.70 tps 2709.2/s
75
+ first 12/10/2026, 09:01:00 last 15/10/2026, 07:20:31
76
+
77
+ activity █▁▁▁▁▁▁▁▁▁▃▁▁▁▁▁▁▁▃▁▁▁▁▁▆ 25 buckets
78
+
79
+ this session
80
+ steps 3 in 130.3k
81
+ prompt 3.37M cached 3.24M
82
+ hit 96.1% out 8.25k
83
+ write 23.9k reasoning 900
84
+ cost $1.69 tps 1617.6/s
85
+
86
+ data coverage
87
+ models 4 · unknown 0.0% providers 3
88
+ unsettled 0 · no tps 0.0%
89
+ window 12/10/2026, 09:01:00 → 15/10/2026, 07:20:00
90
+
91
+ /usage-insights models
92
+ ────────────────────────────────────────────────────────────────────────────────────────────────────
93
+ model steps prompt cached hit out cost providers
94
+ deepseek-v4.1-flash 1 410.6k 402k 97.9% 2.1k $0.0700 opencode-go
95
+ p50 hit 97.9% · 1 switch (1 provider)
96
+ claude-opus-4.6 1 119.8k 96k 80.1% 3.3k $1.42 anthropic
97
+ p50 hit 80.1% · 1 switch (1 provider)
98
+ glm-5.3-flash 2 754.1k 632.4k 83.9% 9.9k $0.7600 opencode
99
+ p50 hit 14.6%
100
+ deepseek-v4.1-flash-free 3 3.59M 3.45M 96.3% 11.3k $0.4500 opencode
101
+ p50 hit 94.1%
102
+
103
+ /usage-insights providers
104
+ ────────────────────────────────────────────────────────────────────────────────────────────────────
105
+ provider models steps share prompt cached hit tps p50 wall
106
+ anthropic 1 1 14% 119.8k 96k 80.1% 1178.6/s 1m14s
107
+ opencode-go 1 1 14% 410.6k 402k 97.9% 2625.0/s 31.0s
108
+ opencode 2 5 71% 4.34M 4.09M 94.1% 3000.0/s 58.0s
109
+
110
+ /usage-insights cache
111
+ ────────────────────────────────────────────────────────────────────────────────────────────────────
112
+ reuse losses 1 event · 607.6k tokens
113
+ expired 1 · 607.6k
114
+
115
+ reuse by model
116
+ model steps prompt cached write hit hit p50
117
+ deepseek-v4.1-flash-free 3 3.59M 3.45M 16.9k 96.3% 94.1%
118
+ glm-5.3-flash 2 754.1k 632.4k 17k 83.9% 14.6%
119
+ deepseek-v4.1-flash 1 410.6k 402k 700 97.9% 97.9%
120
+ claude-opus-4.6 1 119.8k 96k 11k 80.1% 80.1%
121
+
122
+ cache survival against idle time
123
+ gap pairs kept drops lost
124
+ 15–60m 1 100% 0 0
125
+ >6h 1 0% 1 607.6k
126
+
127
+ observed cache TTL bounds
128
+ model hits up to drops from samples
129
+ opencode/deepseek-v4.1-flash-free 22m – 1
130
+ opencode/glm-5.3-flash – 23.9h 1
131
+
132
+ recent losses
133
+ 15:00:00 opencode/glm-5.3-flash −607.6k 23.9h idle · expired
134
+
135
+ /usage-insights periods
136
+ ────────────────────────────────────────────────────────────────────────────────────────────────────
137
+ per day · 4 periods · 7 steps · hit 94.1%
138
+ steps █▃▃▆
139
+ cached █▂▁▃
140
+ cost █▂▃▂
141
+ period steps sess prompt cached hit out cost
142
+ 2026-10-15 2 1 747.1k 712k 95% 8.4k $0.2500
143
+ 2026-10-14 1 1 85.1k 12.4k 15% 4.8k $0.4400
144
+ 2026-10-13 1 1 669k 620k 93% 5.1k $0.3200
145
+ 2026-10-12 3 1 3.37M 3.24M 96% 8.25k $1.69
146
+
147
+ total 7 4 4.87M 4.58M 94% 26.6k $2.70
148
+
149
+ /usage-insights latency
150
+ ────────────────────────────────────────────────────────────────────────────────────────────────────
151
+ wall p50 58.0s p90 1m28s p99 1m28s n 7
152
+ stream p50 1.2s p90 2.8s p99 2.8s
153
+ throughput p50 2642.9/s p90 5250.0/s p99 5250.0/s
154
+
155
+ wall = request to completed · stream = request to last chunk · throughput = output+reasoning tokens…
156
+
157
+ by group
158
+ group n wall p50 wall p90 stream tps p50 tps p90 cost
159
+ claude-opus-4.6 1 1m14s 1m14s 2.8s 1178.6/s 1178.6/s $1.42
160
+ deepseek-v4.1-f… 1 31.0s 31.0s 800ms 2625.0/s 2625.0/s $0.0700
161
+ glm-5.3-flash 2 58.0s 1m01s 1.1s 3000.0/s 4636.4/s $0.7600
162
+ deepseek-v4.1-f… 3 52.0s 1m28s 1.2s 2642.9/s 5250.0/s $0.4500
163
+ n < 5 is dimmed: too few samples to compare
164
+
165
+ /usage-insights sessions
166
+ ────────────────────────────────────────────────────────────────────────────────────────────────────
167
+ title steps prompt cached hit out cost
168
+ Refactor the recorder 3 3.37M 3.24M 96% 8.25k $1.69
169
+ /code/opencode-usage-insights · 2 models
170
+ Fix the cache regression 2 754.1k 632.4k 84% 9.9k $0.7600
171
+ /code/opencode-usage-insights
172
+ Docs pass 2 747.1k 712k 95% 8.4k $0.2500
173
+ /code/opencode-usage-insights · 2 models
174
+
175
+ /usage-insights turns
176
+ ────────────────────────────────────────────────────────────────────────────────────────────────────
177
+ 6 turns · newest first
178
+ Refactor the reco… 09:24:20 · opencode/deepseek-v4.1-flash-free · 2 steps · in 10.3k (1.62M), cach…
179
+ Refactor the reco… 09:42:14 · Δ 40m00s · anthropic/claude-opus-4.6 · changed · in 23.8k (119.8k),…
180
+ Fix the cache reg… 15:03:01 · opencode/glm-5.3-flash · in 49k (669k), cached 620k, out 5.1k, cost…
181
+ Fix the cache reg… 15:00:58 · Δ 23h58m · opencode/glm-5.3-flash · in 72.7k (85.1k), cached 12.4k,…
182
+ Docs pass 07:01:28 · opencode/deepseek-v4.1-flash-free · in 26.5k (336.5k), cached 310k, out 6.3k,…
183
+ Docs pass 07:20:31 · Δ 20m00s · opencode-go/deepseek-v4.1-flash · changed · in 8.6k (410.6k), cach…
184
+
185
+ /usage-insights db
186
+ ────────────────────────────────────────────────────────────────────────────────────────────────────
187
+ /tmp/usage-insights-demo-mFDbHx/usage.db
188
+ 0.0 MB + 0.4 MB wal · schema v11
189
+
190
+ what it holds
191
+ sessions 3 rows
192
+ prompts 6 rows
193
+ events 0 rows
194
+ steps 7 rows
195
+ usage 0 rows
196
+ window 12/10/2026 → 15/10/2026
197
+
198
+ clean up
199
+ ↑↓ pick a retention · enter prunes from its cutoff · the wipe row deletes everything (asks first)…
200
+ list estimates every $0 step has a price
201
+ keep prunes older than
202
+ 30 days 0 steps 16/09/2026
203
+ 90 days 0 steps 18/07/2026
204
+ 365 days 0 steps 16/10/2025
205
+
206
+ wipe everything · 7 steps · 3 sessions · cannot be undone
207
+ ```
208
+
209
+ The `go` view is not part of this database demo: it is live OpenCode Go
210
+ allowance read by the TUI/Desktop client from the host, so it has no rows in
211
+ the demo database. Run `/usage-insights go` in the TUI or open the Desktop panel
212
+ to see it.
Binary file
Binary file
Binary file
Binary file
Binary file