claude-stats 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/dist/index.js +35 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -43,11 +43,31 @@ var require_pricing = __commonJS({
|
|
|
43
43
|
exports2.calculateCost = calculateCost2;
|
|
44
44
|
exports2.formatModelName = formatModelName;
|
|
45
45
|
exports2.MODEL_PRICING = {
|
|
46
|
+
// Haiku 4.5
|
|
47
|
+
"claude-haiku-4-5-20251001": { input: 1, output: 5, cache_read: 0.1, cache_write: 1.25 },
|
|
48
|
+
"claude-haiku-4-5": { input: 1, output: 5, cache_read: 0.1, cache_write: 1.25 },
|
|
49
|
+
// Opus 4.5
|
|
46
50
|
"claude-opus-4-5-20251101": { input: 5, output: 25, cache_read: 0.5, cache_write: 6.25 },
|
|
51
|
+
"claude-opus-4-5": { input: 5, output: 25, cache_read: 0.5, cache_write: 6.25 },
|
|
47
52
|
"claude-opus-4-5-thinking": { input: 5, output: 25, cache_read: 0.5, cache_write: 6.25 },
|
|
53
|
+
// Sonnet 4.5 (standard tier - below 200K tokens)
|
|
48
54
|
"claude-sonnet-4-5-20250929": { input: 3, output: 15, cache_read: 0.3, cache_write: 3.75 },
|
|
55
|
+
"claude-sonnet-4-5": { input: 3, output: 15, cache_read: 0.3, cache_write: 3.75 },
|
|
49
56
|
"claude-sonnet-4-5-thinking": { input: 3, output: 15, cache_read: 0.3, cache_write: 3.75 },
|
|
50
|
-
|
|
57
|
+
// Opus 4 (original)
|
|
58
|
+
"claude-opus-4-20250514": { input: 15, output: 75, cache_read: 1.5, cache_write: 18.75 },
|
|
59
|
+
"claude-opus-4-1": { input: 15, output: 75, cache_read: 1.5, cache_write: 18.75 },
|
|
60
|
+
"claude-opus-4": { input: 15, output: 75, cache_read: 1.5, cache_write: 18.75 },
|
|
61
|
+
// Sonnet 4 (original)
|
|
62
|
+
"claude-sonnet-4-20250514": { input: 3, output: 15, cache_read: 0.3, cache_write: 3.75 },
|
|
63
|
+
"claude-sonnet-4": { input: 3, output: 15, cache_read: 0.3, cache_write: 3.75 },
|
|
64
|
+
// Legacy models
|
|
65
|
+
"claude-3-5-sonnet-20241022": { input: 3, output: 15, cache_read: 0.3, cache_write: 3.75 },
|
|
66
|
+
"claude-3-5-sonnet": { input: 3, output: 15, cache_read: 0.3, cache_write: 3.75 },
|
|
67
|
+
"claude-3-opus-20240229": { input: 15, output: 75, cache_read: 1.5, cache_write: 18.75 },
|
|
68
|
+
"claude-3-opus": { input: 15, output: 75, cache_read: 1.5, cache_write: 18.75 },
|
|
69
|
+
"claude-3-haiku-20240307": { input: 0.25, output: 1.25, cache_read: 0.03, cache_write: 0.3 },
|
|
70
|
+
"claude-3-haiku": { input: 0.25, output: 1.25, cache_read: 0.03, cache_write: 0.3 }
|
|
51
71
|
};
|
|
52
72
|
exports2.DEFAULT_PRICING = {
|
|
53
73
|
input: 3,
|
|
@@ -65,7 +85,7 @@ var require_pricing = __commonJS({
|
|
|
65
85
|
return Math.round(cost * 1e4) / 1e4;
|
|
66
86
|
}
|
|
67
87
|
function formatModelName(model) {
|
|
68
|
-
return model.replace("claude-", "").replace("-20251101", "").replace("-20250929", "").replace("-thinking", " (think)").replace("gemini-", "").replace("-high", "");
|
|
88
|
+
return model.replace("claude-", "").replace("-20251101", "").replace("-20251001", "").replace("-20250929", "").replace("-20250514", "").replace("-20241022", "").replace("-20240229", "").replace("-20240307", "").replace("-thinking", " (think)").replace("gemini-", "").replace("-high", "");
|
|
69
89
|
}
|
|
70
90
|
}
|
|
71
91
|
});
|
|
@@ -763,9 +783,16 @@ function getOpenFiles() {
|
|
|
763
783
|
}
|
|
764
784
|
return openFiles;
|
|
765
785
|
}
|
|
786
|
+
function getLocalDateString(date) {
|
|
787
|
+
const year = date.getFullYear();
|
|
788
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
789
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
790
|
+
return `${year}-${month}-${day}`;
|
|
791
|
+
}
|
|
766
792
|
function getTodayUsageFromSessions() {
|
|
767
|
-
const
|
|
768
|
-
const
|
|
793
|
+
const now = /* @__PURE__ */ new Date();
|
|
794
|
+
const today = getLocalDateString(now);
|
|
795
|
+
const todayStart = new Date(now);
|
|
769
796
|
todayStart.setHours(0, 0, 0, 0);
|
|
770
797
|
const todayStartTs = todayStart.getTime();
|
|
771
798
|
const modelTokens = {};
|
|
@@ -798,7 +825,10 @@ function getTodayUsageFromSessions() {
|
|
|
798
825
|
try {
|
|
799
826
|
const msg = JSON.parse(line);
|
|
800
827
|
const ts = msg.timestamp || "";
|
|
801
|
-
if (!ts
|
|
828
|
+
if (!ts) continue;
|
|
829
|
+
const msgDate = new Date(ts);
|
|
830
|
+
const msgLocalDate = getLocalDateString(msgDate);
|
|
831
|
+
if (msgLocalDate !== today) continue;
|
|
802
832
|
if (msg.type === "assistant") {
|
|
803
833
|
messages++;
|
|
804
834
|
const usage = msg.message?.usage || {};
|