codebuddy-stats 1.2.0 → 1.2.2
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/dist/index.js +8 -1
- package/dist/lib/pricing.js +71 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -839,13 +839,20 @@ async function main() {
|
|
|
839
839
|
statusBar.setContent(' {yellow-fg}Reloading...{/yellow-fg}');
|
|
840
840
|
screen.render();
|
|
841
841
|
try {
|
|
842
|
+
const prevDetailDate = dailyDetailDate;
|
|
842
843
|
data = await loadUsageData({ days: options.days, source: currentSource });
|
|
843
844
|
modelScrollOffset = 0;
|
|
844
845
|
projectScrollOffset = 0;
|
|
845
846
|
dailyScrollOffset = 0;
|
|
846
847
|
dailySelectedIndex = 0;
|
|
847
|
-
dailyDetailDate = null;
|
|
848
848
|
dailyDetailScrollOffset = 0;
|
|
849
|
+
// 如果之前在详情视图且该日期仍存在,保持在详情视图
|
|
850
|
+
if (prevDetailDate && data.dailySummary[prevDetailDate]) {
|
|
851
|
+
dailyDetailDate = prevDetailDate;
|
|
852
|
+
}
|
|
853
|
+
else {
|
|
854
|
+
dailyDetailDate = null;
|
|
855
|
+
}
|
|
849
856
|
contentBox.scrollTo(0);
|
|
850
857
|
updateTabBar();
|
|
851
858
|
updateContent();
|
package/dist/lib/pricing.js
CHANGED
|
@@ -2,25 +2,37 @@
|
|
|
2
2
|
function createPricing(inputPrice, cachedInputPrice, outputPrice, cacheWritePrice) {
|
|
3
3
|
return {
|
|
4
4
|
prompt: [{ limit: Number.POSITIVE_INFINITY, pricePerMTok: inputPrice }],
|
|
5
|
-
completion: [
|
|
6
|
-
|
|
5
|
+
completion: [
|
|
6
|
+
{ limit: Number.POSITIVE_INFINITY, pricePerMTok: outputPrice },
|
|
7
|
+
],
|
|
8
|
+
cacheRead: [
|
|
9
|
+
{ limit: Number.POSITIVE_INFINITY, pricePerMTok: cachedInputPrice },
|
|
10
|
+
],
|
|
7
11
|
cacheWrite: [
|
|
8
|
-
{
|
|
12
|
+
{
|
|
13
|
+
limit: Number.POSITIVE_INFINITY,
|
|
14
|
+
pricePerMTok: cacheWritePrice ?? inputPrice,
|
|
15
|
+
},
|
|
9
16
|
],
|
|
10
17
|
};
|
|
11
18
|
}
|
|
12
19
|
export const MODEL_PRICING = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
// GPT 系列
|
|
21
|
+
"gpt-5.2": createPricing(1.75, 0.175, 14.0),
|
|
22
|
+
"gpt-5.1": createPricing(1.25, 0.125, 10.0),
|
|
23
|
+
"gpt-5": createPricing(1.25, 0.125, 10.0),
|
|
24
|
+
"gpt-5-mini": createPricing(0.25, 0.025, 2.0),
|
|
25
|
+
"gpt-5-nano": createPricing(0.05, 0.005, 0.4),
|
|
26
|
+
"gpt-5.1-chat-latest": createPricing(1.25, 0.125, 10.0),
|
|
27
|
+
"gpt-5-chat-latest": createPricing(1.25, 0.125, 10.0),
|
|
28
|
+
"gpt-5.1-codex": createPricing(1.25, 0.125, 10.0),
|
|
29
|
+
"gpt-5.1-codex-max": createPricing(1.25, 0.125, 10.0),
|
|
30
|
+
"gpt-5.1-codex-mini": createPricing(0.25, 0.025, 2.0),
|
|
31
|
+
"gpt-5-codex": createPricing(1.25, 0.125, 10.0),
|
|
32
|
+
// Claude 系列
|
|
33
|
+
"claude-opus-4.5": createPricing(5.0, 0.5, 25.0, 10.0),
|
|
34
|
+
"claude-haiku-4.5": createPricing(1.0, 0.1, 5.0, 1.25),
|
|
35
|
+
"claude-4.5": {
|
|
24
36
|
prompt: [
|
|
25
37
|
{ limit: 200_000, pricePerMTok: 3.0 },
|
|
26
38
|
{ limit: Number.POSITIVE_INFINITY, pricePerMTok: 6.0 },
|
|
@@ -38,7 +50,8 @@ export const MODEL_PRICING = {
|
|
|
38
50
|
{ limit: Number.POSITIVE_INFINITY, pricePerMTok: 12.0 },
|
|
39
51
|
],
|
|
40
52
|
},
|
|
41
|
-
|
|
53
|
+
// Gemini 系列
|
|
54
|
+
"gemini-3.0-pro": {
|
|
42
55
|
prompt: [
|
|
43
56
|
{ limit: 200_000, pricePerMTok: 2.0 },
|
|
44
57
|
{ limit: Number.POSITIVE_INFINITY, pricePerMTok: 4.0 },
|
|
@@ -56,7 +69,8 @@ export const MODEL_PRICING = {
|
|
|
56
69
|
{ limit: Number.POSITIVE_INFINITY, pricePerMTok: 0.4 },
|
|
57
70
|
],
|
|
58
71
|
},
|
|
59
|
-
|
|
72
|
+
"gemini-3.0-flash": createPricing(0.5, 0.05, 3.0),
|
|
73
|
+
"gemini-2.5-pro": {
|
|
60
74
|
prompt: [
|
|
61
75
|
{ limit: 200_000, pricePerMTok: 1.25 },
|
|
62
76
|
{ limit: Number.POSITIVE_INFINITY, pricePerMTok: 2.5 },
|
|
@@ -74,8 +88,48 @@ export const MODEL_PRICING = {
|
|
|
74
88
|
{ limit: Number.POSITIVE_INFINITY, pricePerMTok: 0.25 },
|
|
75
89
|
],
|
|
76
90
|
},
|
|
91
|
+
// GLM 系列 (价格从人民币转换: 1 USD = 7 CNY)
|
|
92
|
+
// 按上下文长度分段定价:[0,32K), [32K,200K)
|
|
93
|
+
"glm-4.7": {
|
|
94
|
+
prompt: [
|
|
95
|
+
{ limit: 32_000, pricePerMTok: 0.286 }, // 2元/M tokens
|
|
96
|
+
{ limit: Number.POSITIVE_INFINITY, pricePerMTok: 0.571 }, // 4元/M tokens
|
|
97
|
+
],
|
|
98
|
+
completion: [
|
|
99
|
+
{ limit: 32_000, pricePerMTok: 1.143 }, // 8元/M tokens
|
|
100
|
+
{ limit: Number.POSITIVE_INFINITY, pricePerMTok: 2.286 }, // 16元/M tokens
|
|
101
|
+
],
|
|
102
|
+
cacheRead: [
|
|
103
|
+
{ limit: 32_000, pricePerMTok: 0.057 }, // 0.4元/M tokens
|
|
104
|
+
{ limit: Number.POSITIVE_INFINITY, pricePerMTok: 0.114 }, // 0.8元/M tokens
|
|
105
|
+
],
|
|
106
|
+
cacheWrite: [
|
|
107
|
+
{ limit: 32_000, pricePerMTok: 0.286 }, // 2元/M tokens
|
|
108
|
+
{ limit: Number.POSITIVE_INFINITY, pricePerMTok: 0.571 }, // 4元/M tokens
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
"glm-4.6": {
|
|
112
|
+
prompt: [
|
|
113
|
+
{ limit: 32_000, pricePerMTok: 0.286 }, // 2元/M tokens
|
|
114
|
+
{ limit: Number.POSITIVE_INFINITY, pricePerMTok: 0.571 }, // 4元/M tokens
|
|
115
|
+
],
|
|
116
|
+
completion: [
|
|
117
|
+
{ limit: 32_000, pricePerMTok: 1.143 }, // 8元/M tokens
|
|
118
|
+
{ limit: Number.POSITIVE_INFINITY, pricePerMTok: 2.286 }, // 16元/M tokens
|
|
119
|
+
],
|
|
120
|
+
cacheRead: [
|
|
121
|
+
{ limit: 32_000, pricePerMTok: 0.057 }, // 0.4元/M tokens
|
|
122
|
+
{ limit: Number.POSITIVE_INFINITY, pricePerMTok: 0.114 }, // 0.8元/M tokens
|
|
123
|
+
],
|
|
124
|
+
cacheWrite: [
|
|
125
|
+
{ limit: 32_000, pricePerMTok: 0.286 }, // 2元/M tokens
|
|
126
|
+
{ limit: Number.POSITIVE_INFINITY, pricePerMTok: 0.571 }, // 4元/M tokens
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
// DeepSeek 系列
|
|
130
|
+
"deepseek-v3.1": createPricing(0.56, 0.056, 1.68),
|
|
77
131
|
};
|
|
78
|
-
export const DEFAULT_MODEL_ID =
|
|
132
|
+
export const DEFAULT_MODEL_ID = "gpt-5.1";
|
|
79
133
|
export function selectTierPrice(tokens, tiers) {
|
|
80
134
|
if (tokens <= 0)
|
|
81
135
|
return tiers[0]?.pricePerMTok ?? 0;
|