codex-usage.html
9.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<!doctype html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Codex 用量图表</title>
<style>:root {
color-scheme: light;
--bg: #f7f8fb;
--panel: #ffffff;
--text: #1f2937;
--muted: #667085;
--border: #d8dee9;
}
* { box-sizing: border-box; }
body {
margin: 0;
background: var(--bg);
color: var(--text);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.page {
width: min(1120px, calc(100vw - 32px));
margin: 0 auto;
padding: 32px 0 48px;
}
.hero {
padding: 8px 0 18px;
}
h1 {
margin: 0;
font-size: 34px;
line-height: 1.18;
letter-spacing: 0;
}
.hero p {
margin: 8px 0 18px;
color: var(--muted);
}
.meta-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 10px;
}
.meta-grid div,
.card,
.panel {
background: var(--panel);
border: 1px solid var(--border);
border-radius: 8px;
}
.meta-grid div {
padding: 12px;
overflow-wrap: anywhere;
font-size: 13px;
}
.meta-grid span,
.card span {
display: block;
color: var(--muted);
font-size: 12px;
margin-bottom: 5px;
}
.panel {
padding: 18px;
margin-top: 18px;
}
h2 {
margin: 0 0 14px;
font-size: 18px;
letter-spacing: 0;
}
.cards {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 10px;
}
.card {
padding: 14px;
}
.card strong {
display: block;
font-size: 24px;
line-height: 1.15;
overflow-wrap: anywhere;
}
.chart {
width: 100%;
height: auto;
display: block;
}
.legend {
display: flex;
flex-wrap: wrap;
gap: 12px;
margin-top: 10px;
color: var(--muted);
font-size: 13px;
}
.legend i {
display: inline-block;
width: 10px;
height: 10px;
border-radius: 2px;
margin-right: 6px;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 14px;
}
th, td {
padding: 10px 8px;
border-bottom: 1px solid var(--border);
text-align: right;
}
th:first-child, td:first-child,
th:nth-child(2), td:nth-child(2) {
text-align: left;
}
td:first-child {
overflow-wrap: anywhere;
}
.empty,
.notes {
color: var(--muted);
margin: 0;
}
.notes li {
margin: 6px 0;
}
@media (max-width: 760px) {
.page { width: min(100vw - 20px, 1120px); padding-top: 18px; }
.meta-grid,
.cards { grid-template-columns: 1fr; }
h1 { font-size: 28px; }
.card strong { font-size: 22px; }
}</style>
</head>
<body>
<main class="page">
<header class="hero">
<h1>Codex 用量图表</h1>
<p>基于本地 token_count 日志生成</p>
<div class="meta-grid">
<div><span>时间窗口</span>2026-05-20T00:00:00+08:00 -> 2026-05-20T10:02:06.956313+08:00</div>
<div><span>数据来源</span>/Users/yuehu/.codex</div>
<div><span>生成时间</span>2026-05-20T10:02:07+08:00</div>
</div>
</header>
<section class="panel"><h2>总览</h2><div class="cards"><div class="card"><span>Total</span><strong>4,778,002</strong></div><div class="card"><span>Input</span><strong>4,755,924</strong></div><div class="card"><span>Cached Input</span><strong>4,641,280</strong></div><div class="card"><span>Non-cached Input</span><strong>114,644</strong></div><div class="card"><span>Output</span><strong>22,078</strong></div><div class="card"><span>Reasoning</span><strong>2,308</strong></div><div class="card"><span>Sessions</span><strong>1</strong></div><div class="card"><span>事件数</span><strong>103</strong></div></div></section>
<section class="panel"><h2>Token 构成</h2><svg class="chart" viewBox="0 0 900 116" role="img" aria-label="Token 构成">
<rect x="28" y="34" width="844" height="34" fill="#eef2f7" rx="6" />
<rect x="28.00" y="34" width="819.85" height="34" fill="#2563eb" />
<rect x="847.85" y="34" width="20.25" height="34" fill="#0f766e" />
<rect x="868.10" y="34" width="3.90" height="34" fill="#f59e0b" />
<text x="28" y="24" fill="#667085" font-size="13">Total: 4,778,002</text>
</svg>
<div class="legend"><span><i style="background:#2563eb"></i>Cached Input: 4,641,280 (97.1%)</span><span><i style="background:#0f766e"></i>Non-cached Input: 114,644 (2.4%)</span><span><i style="background:#f59e0b"></i>Output: 22,078 (0.5%)</span></div></section>
<section class="panel"><h2>随时间变化</h2><svg class="chart" viewBox="0 0 960 330" role="img" aria-label="随时间变化">
<line x1="78" y1="246.00" x2="920" y2="246.00" stroke="#d8dee9" />
<text x="68" y="250.00" fill="#667085" font-size="12" text-anchor="end">0</text>
<line x1="78" y1="191.00" x2="920" y2="191.00" stroke="#d8dee9" />
<text x="68" y="195.00" fill="#667085" font-size="12" text-anchor="end">1.2M</text>
<line x1="78" y1="136.00" x2="920" y2="136.00" stroke="#d8dee9" />
<text x="68" y="140.00" fill="#667085" font-size="12" text-anchor="end">2.4M</text>
<line x1="78" y1="81.00" x2="920" y2="81.00" stroke="#d8dee9" />
<text x="68" y="85.00" fill="#667085" font-size="12" text-anchor="end">3.6M</text>
<line x1="78" y1="26.00" x2="920" y2="26.00" stroke="#d8dee9" />
<text x="68" y="30.00" fill="#667085" font-size="12" text-anchor="end">4.8M</text>
<rect x="788.18" y="32.30" width="34.00" height="213.70" fill="#2563eb" />
<rect x="788.18" y="27.02" width="34.00" height="5.28" fill="#0f766e" />
<rect x="788.18" y="26.00" width="34.00" height="1.02" fill="#f59e0b" />
<line x1="78" y1="246" x2="920" y2="246" stroke="#667085" />
<text x="116.27" y="270.00" fill="#667085" font-size="12" text-anchor="middle">00:00</text>
<text x="192.82" y="270.00" fill="#667085" font-size="12" text-anchor="middle">01:00</text>
<text x="269.36" y="270.00" fill="#667085" font-size="12" text-anchor="middle">02:00</text>
<text x="345.91" y="270.00" fill="#667085" font-size="12" text-anchor="middle">03:00</text>
<text x="422.45" y="270.00" fill="#667085" font-size="12" text-anchor="middle">04:00</text>
<text x="499.00" y="270.00" fill="#667085" font-size="12" text-anchor="middle">05:00</text>
<text x="575.55" y="270.00" fill="#667085" font-size="12" text-anchor="middle">06:00</text>
<text x="652.09" y="270.00" fill="#667085" font-size="12" text-anchor="middle">07:00</text>
<text x="728.64" y="270.00" fill="#667085" font-size="12" text-anchor="middle">08:00</text>
<text x="805.18" y="270.00" fill="#667085" font-size="12" text-anchor="middle">09:00</text>
<text x="881.73" y="270.00" fill="#667085" font-size="12" text-anchor="middle">10:00</text>
</svg>
<div class="legend"><span><i style="background:#2563eb"></i>Cached Input</span><span><i style="background:#0f766e"></i>Non-cached Input</span><span><i style="background:#f59e0b"></i>Output</span></div></section>
<section class="panel"><h2>限额变化</h2><svg class="chart" viewBox="0 0 960 290" role="img" aria-label="限额变化">
<line x1="78" y1="216.00" x2="920" y2="216.00" stroke="#d8dee9" />
<text x="68" y="220.00" fill="#667085" font-size="12" text-anchor="end">0%</text>
<line x1="78" y1="168.50" x2="920" y2="168.50" stroke="#d8dee9" />
<text x="68" y="172.50" fill="#667085" font-size="12" text-anchor="end">25%</text>
<line x1="78" y1="121.00" x2="920" y2="121.00" stroke="#d8dee9" />
<text x="68" y="125.00" fill="#667085" font-size="12" text-anchor="end">50%</text>
<line x1="78" y1="73.50" x2="920" y2="73.50" stroke="#d8dee9" />
<text x="68" y="77.50" fill="#667085" font-size="12" text-anchor="end">75%</text>
<line x1="78" y1="26.00" x2="920" y2="26.00" stroke="#d8dee9" />
<text x="68" y="30.00" fill="#667085" font-size="12" text-anchor="end">100%</text>
<circle cx="835.80" cy="174.20" r="4" fill="#dc2626"><title>primary 已用 22%</title></circle>
<circle cx="835.80" cy="210.30" r="4" fill="#4f46e5"><title>secondary 已用 3%</title></circle>
<line x1="78" y1="216" x2="920" y2="216" stroke="#667085" />
<text x="78.00" y="240.00" fill="#667085" font-size="12" text-anchor="middle">00:00</text>
<text x="162.20" y="240.00" fill="#667085" font-size="12" text-anchor="middle">01:00</text>
<text x="246.40" y="240.00" fill="#667085" font-size="12" text-anchor="middle">02:00</text>
<text x="330.60" y="240.00" fill="#667085" font-size="12" text-anchor="middle">03:00</text>
<text x="414.80" y="240.00" fill="#667085" font-size="12" text-anchor="middle">04:00</text>
<text x="499.00" y="240.00" fill="#667085" font-size="12" text-anchor="middle">05:00</text>
<text x="583.20" y="240.00" fill="#667085" font-size="12" text-anchor="middle">06:00</text>
<text x="667.40" y="240.00" fill="#667085" font-size="12" text-anchor="middle">07:00</text>
<text x="751.60" y="240.00" fill="#667085" font-size="12" text-anchor="middle">08:00</text>
<text x="835.80" y="240.00" fill="#667085" font-size="12" text-anchor="middle">09:00</text>
<text x="920.00" y="240.00" fill="#667085" font-size="12" text-anchor="middle">10:00</text>
</svg>
<div class="legend"><span><i style="background:#dc2626"></i>primary 已用</span><span><i style="background:#4f46e5"></i>secondary 已用</span></div></section>
<section class="panel"><h2>Session 排行</h2><table>
<thead><tr><th>Session</th><th>最后事件</th><th>Total</th><th>Output</th><th>Reasoning</th></tr></thead>
<tbody>
<tr><td>rollout-2026-05-20T09-37-23-019e4307-c5c3-7791-8b85-73f4f49d3c31.jsonl</td><td>2026-05-20T09:58:07.634000+08:00</td><td>4,778,002</td><td>22,078</td><td>2,308</td></tr>
</tbody>
</table></section>
<section class="panel"><h2>说明</h2><ul class="notes">
<li>数值来自本机 Codex session 日志里的 token_count 事件。</li>
<li>Cached Input 是 Input 的子集。</li>
<li>Reasoning 单独展示,不会在 Token 构成里重复相加。</li>
</ul></section>
</main>
</body>
</html>