@juliantanx/aiusage 1.0.2 → 1.0.4

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.
Files changed (52) hide show
  1. package/dist/{chunk-C6IKRE2P.js → chunk-2DX56FB6.js} +79 -15
  2. package/dist/{dist-XHYTXDVT.js → dist-4I33E46P.js} +1 -1
  3. package/dist/index.js +284 -58
  4. package/dist/web/_app/immutable/assets/0.DDbFsqNI.css +1 -0
  5. package/dist/web/_app/immutable/assets/2.fho1OPpm.css +1 -0
  6. package/dist/web/_app/immutable/assets/8.9sovMx-u.css +1 -0
  7. package/dist/web/_app/immutable/assets/9.Doxq00gF.css +1 -0
  8. package/dist/web/_app/immutable/assets/_layout.RgD-pTKj.css +1 -0
  9. package/dist/web/_app/immutable/assets/_page.9sovMx-u.css +1 -0
  10. package/dist/web/_app/immutable/assets/_page.DTuZozBR.css +1 -0
  11. package/dist/web/_app/immutable/assets/_page.Doxq00gF.css +1 -0
  12. package/dist/web/_app/immutable/chunks/ToolSelector.DIzQsA4_.js +2 -0
  13. package/dist/web/_app/immutable/chunks/api.D-M_rVlI.js +1 -0
  14. package/dist/web/_app/immutable/chunks/entry.-i5eOrF8.js +3 -0
  15. package/dist/web/_app/immutable/chunks/{index.Dm-3G3np.js → index.BjVwNvJa.js} +1 -1
  16. package/dist/web/_app/immutable/chunks/{index.CzqoKkoo.js → index.CUfK07C5.js} +1 -1
  17. package/dist/web/_app/immutable/chunks/scheduler.DukoKnjQ.js +1 -0
  18. package/dist/web/_app/immutable/chunks/{stores.BSVKBbO8.js → stores.BJHWQcKv.js} +1 -1
  19. package/dist/web/_app/immutable/entry/app.Pb7AfjR8.js +2 -0
  20. package/dist/web/_app/immutable/entry/start.DyuR4tFJ.js +1 -0
  21. package/dist/web/_app/immutable/nodes/0.BhkxfbMC.js +1 -0
  22. package/dist/web/_app/immutable/nodes/{1.xdMqApFe.js → 1.CNO4bJXv.js} +1 -1
  23. package/dist/web/_app/immutable/nodes/{8.BSeUhVCa.js → 10.1LgqVOtM.js} +1 -1
  24. package/dist/web/_app/immutable/nodes/{9.DJXBgSiY.js → 11.BOfGogcw.js} +1 -1
  25. package/dist/web/_app/immutable/nodes/2.C_8jrQsV.js +3 -0
  26. package/dist/web/_app/immutable/nodes/{3.Bqg88zQg.js → 3.Lz_pbSpS.js} +1 -1
  27. package/dist/web/_app/immutable/nodes/{4.B3zrG0ip.js → 4.BCB36ta_.js} +1 -1
  28. package/dist/web/_app/immutable/nodes/{2.CJyBxUXd.js → 5.CykeLKzi.js} +1 -1
  29. package/dist/web/_app/immutable/nodes/{5.C3h9wXyF.js → 6.De73932o.js} +1 -1
  30. package/dist/web/_app/immutable/nodes/{6.C8xhym7b.js → 7.6OEKXCWR.js} +1 -1
  31. package/dist/web/_app/immutable/nodes/8.niqPZkB9.js +1 -0
  32. package/dist/web/_app/immutable/nodes/9.DRZSbXAV.js +1 -0
  33. package/dist/web/_app/version.json +1 -1
  34. package/dist/web/index.html +9 -9
  35. package/package.json +4 -2
  36. package/dist/web/_app/immutable/assets/0.BTUc0PXb.css +0 -1
  37. package/dist/web/_app/immutable/assets/7.8R_5Laqi.css +0 -1
  38. package/dist/web/_app/immutable/assets/_layout.DLyrrG29.css +0 -1
  39. package/dist/web/_app/immutable/assets/_page.8R_5Laqi.css +0 -1
  40. package/dist/web/_app/immutable/chunks/ToolSelector.kb97TteP.js +0 -2
  41. package/dist/web/_app/immutable/chunks/api.DyoIo4nG.js +0 -1
  42. package/dist/web/_app/immutable/chunks/entry.DbT6jbyV.js +0 -3
  43. package/dist/web/_app/immutable/chunks/scheduler.Dx1bs0RQ.js +0 -1
  44. package/dist/web/_app/immutable/entry/app.BjD-8RWO.js +0 -2
  45. package/dist/web/_app/immutable/entry/start.Dg2jUJRH.js +0 -1
  46. package/dist/web/_app/immutable/nodes/0.DiQJRuoG.js +0 -1
  47. package/dist/web/_app/immutable/nodes/7.C950CTxa.js +0 -1
  48. /package/dist/web/_app/immutable/assets/{8.BcbNCOTS.css → 10.BcbNCOTS.css} +0 -0
  49. /package/dist/web/_app/immutable/assets/{9.QhlpTtkf.css → 11.QhlpTtkf.css} +0 -0
  50. /package/dist/web/_app/immutable/assets/{2.I4bgY8QS.css → 5.I4bgY8QS.css} +0 -0
  51. /package/dist/web/_app/immutable/assets/{5.BeDwa7mS.css → 6.BeDwa7mS.css} +0 -0
  52. /package/dist/web/_app/immutable/assets/{6.BYQidWiw.css → 7.BYQidWiw.css} +0 -0
@@ -58,7 +58,75 @@ var DEFAULT_PRICE_TABLE = {
58
58
  "gemini-2.0-flash": { input: 0.1, output: 0.4 },
59
59
  // DeepSeek — https://api-docs.deepseek.com/quick_start/pricing
60
60
  "deepseek-v4-pro": { input: 1.74, output: 3.48, cacheRead: 0.0145 },
61
- "deepseek-v4-flash": { input: 0.14, output: 0.28, cacheRead: 28e-4 }
61
+ "deepseek-v4-flash": { input: 0.14, output: 0.28, cacheRead: 28e-4 },
62
+ // Kimi (Moonshot AI) — https://platform.kimi.ai/docs/pricing/chat
63
+ "kimi-k2.6": { input: 0.95, output: 4, cacheRead: 0.16 },
64
+ "kimi-k2.5": { input: 0.6, output: 3, cacheRead: 0.1 },
65
+ "kimi-k2-turbo": { input: 1.15, output: 8, cacheRead: 0.15 },
66
+ "kimi-k2": { input: 0.6, output: 2.5, cacheRead: 0.15 },
67
+ "moonshot-v1-128k": { input: 2, output: 5 },
68
+ "moonshot-v1-32k": { input: 1, output: 3 },
69
+ "moonshot-v1-8k": { input: 0.2, output: 2 },
70
+ // GLM (Z.ai / Zhipu AI) — https://docs.z.ai/guides/overview/pricing
71
+ "glm-5.1": { input: 1.4, output: 4.4 },
72
+ "glm-5p1": { input: 1.4, output: 4.4 },
73
+ // Fireworks alias (accounts/fireworks/models/glm-5p1)
74
+ "glm-5-turbo": { input: 1.2, output: 4 },
75
+ "glm-5": { input: 1, output: 3.2 },
76
+ "glm-4.7-flashx": { input: 0.07, output: 0.4 },
77
+ "glm-4.7": { input: 0.6, output: 2.2 },
78
+ "glm-4.6": { input: 0.6, output: 2.2 },
79
+ "glm-4.5-x": { input: 2.2, output: 8.9 },
80
+ "glm-4.5-airx": { input: 1.1, output: 4.5 },
81
+ "glm-4.5-air": { input: 0.2, output: 1.1 },
82
+ "glm-4.5": { input: 0.6, output: 2.2 },
83
+ // Qwen (Alibaba Cloud) — https://www.alibabacloud.com/help/en/model-studio/model-pricing
84
+ "qwen3.6-plus": { input: 0.28, output: 1.66 },
85
+ "qwen3-235b": { input: 0.7, output: 2.8 },
86
+ "qwen3-32b": { input: 0.16, output: 0.64 },
87
+ "qwen3-30b": { input: 0.2, output: 0.8 },
88
+ "qwen-max": { input: 1.6, output: 6.4 },
89
+ "qwen-plus": { input: 0.4, output: 1.2 },
90
+ "qwen-turbo": { input: 0.05, output: 0.2 },
91
+ "qwen-long": { input: 0.072, output: 0.287 },
92
+ "qwen2.5-72b": { input: 1.4, output: 5.6 },
93
+ "qwen2.5-7b": { input: 0.175, output: 0.7 },
94
+ // MiniMax — https://platform.minimaxi.com/docs/guides/pricing-paygo
95
+ "minimax-m2.7": { input: 0.29, output: 1.16, cacheRead: 0.058, cacheWrite: 0.362 },
96
+ "minimax-m2.5": { input: 0.29, output: 1.16, cacheRead: 0.029, cacheWrite: 0.362 },
97
+ // Mistral AI — https://mistral.ai/pricing
98
+ "mistral-large": { input: 0.5, output: 1.5 },
99
+ "mistral-medium": { input: 0.4, output: 2 },
100
+ "mistral-small": { input: 0.1, output: 0.3 },
101
+ "codestral": { input: 0.3, output: 0.9 },
102
+ "open-mistral-nemo": { input: 0.02, output: 0.03 },
103
+ "open-mixtral-8x22b": { input: 1.2, output: 1.2 },
104
+ "ministral-8b": { input: 0.1, output: 0.1 },
105
+ "ministral-3b": { input: 0.04, output: 0.04 },
106
+ "pixtral-12b": { input: 0.1, output: 0.1 },
107
+ // xAI Grok — https://docs.x.ai/developers/models
108
+ "grok-4-1-fast": { input: 0.2, output: 0.5 },
109
+ "grok-4": { input: 1.25, output: 2.5 },
110
+ // Cohere — https://cohere.com/pricing
111
+ "command-r-plus": { input: 2.5, output: 10 },
112
+ "command-r": { input: 0.15, output: 0.6 },
113
+ // Doubao (ByteDance) — https://www.volcengine.com/docs/82379/1544106
114
+ "doubao-seed-2.0-pro": { input: 0.514, output: 2.57 },
115
+ "doubao-seed-2.0-code": { input: 0.467, output: 2.34 },
116
+ "doubao-seed-2.0-lite": { input: 0.088, output: 0.526 },
117
+ "doubao-seed-2.0-mini": { input: 0.029, output: 0.292 },
118
+ "doubao-seed-1.6-flash": { input: 0.022, output: 0.219 },
119
+ "doubao-seed-1.6-lite": { input: 0.044, output: 0.35 },
120
+ "doubao-seed-1.6": { input: 0.117, output: 1.168 },
121
+ "doubao-1.5-pro": { input: 0.117, output: 0.292 },
122
+ "doubao-1.5-lite": { input: 0.044, output: 0.088 },
123
+ // Hunyuan (Tencent) — https://cloud.tencent.com/document/product/1729
124
+ "hunyuan-t1": { input: 0.066, output: 0.26, cacheRead: 0.029 },
125
+ "hunyuan-a13b": { input: 0.14, output: 0.57 },
126
+ // ERNIE (Baidu) — https://cloud.baidu.com/doc/WENXINWORKSHOP/s/Blfmc9dlf
127
+ "ernie-4.5-300b": { input: 0.28, output: 0.9 },
128
+ "ernie-4.5-21b": { input: 0.07, output: 0.28 },
129
+ "ernie-x1": { input: 0.28, output: 1.1 }
62
130
  };
63
131
  var userOverrides = {};
64
132
  var PRICE_TABLE = { ...DEFAULT_PRICE_TABLE };
@@ -66,16 +134,13 @@ function getPriceTable() {
66
134
  return { ...DEFAULT_PRICE_TABLE, ...userOverrides };
67
135
  }
68
136
  function setPriceOverride(model, entry) {
69
- userOverrides[model] = entry;
70
- PRICE_TABLE[model] = entry;
137
+ userOverrides = { ...userOverrides, [model]: entry };
138
+ PRICE_TABLE = { ...DEFAULT_PRICE_TABLE, ...userOverrides };
71
139
  }
72
140
  function removePriceOverride(model) {
73
- delete userOverrides[model];
74
- if (DEFAULT_PRICE_TABLE[model]) {
75
- PRICE_TABLE[model] = DEFAULT_PRICE_TABLE[model];
76
- } else {
77
- delete PRICE_TABLE[model];
78
- }
141
+ const { [model]: _, ...rest } = userOverrides;
142
+ userOverrides = rest;
143
+ PRICE_TABLE = { ...DEFAULT_PRICE_TABLE, ...userOverrides };
79
144
  }
80
145
  function getUserOverrides() {
81
146
  return { ...userOverrides };
@@ -122,27 +187,26 @@ function calculateCost(model, tokens) {
122
187
  const outputCost = tokens.outputTokens / 1e6 * price.output;
123
188
  const cacheReadCost = tokens.cacheReadTokens / 1e6 * (price.cacheRead ?? 0);
124
189
  const cacheWriteCost = tokens.cacheWriteTokens / 1e6 * (price.cacheWrite ?? 0);
125
- const thinkingPrice = price.thinking ?? price.output;
126
- const thinkingCost = tokens.thinkingTokens / 1e6 * thinkingPrice;
190
+ const thinkingCost = tokens.thinkingTokens / 1e6 * price.output;
127
191
  return inputCost + outputCost + cacheReadCost + cacheWriteCost + thinkingCost;
128
192
  }
129
193
  function generateRecordId(deviceInstanceId, sourceFile, lineOffset) {
130
- const hash = createHash("sha256").update(deviceInstanceId + sourceFile + lineOffset).digest("hex");
194
+ const hash = createHash("sha256").update(deviceInstanceId + "\0" + sourceFile + "\0" + lineOffset).digest("hex");
131
195
  return hash.slice(0, 16);
132
196
  }
133
197
  function generateSyncRecordId(deviceInstanceId, sourceFile, lineOffset) {
134
198
  return generateRecordId(deviceInstanceId, sourceFile, lineOffset);
135
199
  }
136
200
  function generateToolCallId(recordId, name, ts, callIndex) {
137
- const hash = createHash("sha256").update(recordId + name + ts + callIndex).digest("hex");
201
+ const hash = createHash("sha256").update(recordId + "\0" + name + "\0" + ts + "\0" + callIndex).digest("hex");
138
202
  return hash.slice(0, 16);
139
203
  }
140
204
  function generateOrphanToolCallId(tool, name, ts, callIndex) {
141
- const hash = createHash("sha256").update(tool + ":" + name + ":" + ts + ":" + callIndex).digest("hex");
205
+ const hash = createHash("sha256").update(tool + "\0" + name + "\0" + ts + "\0" + callIndex).digest("hex");
142
206
  return hash.slice(0, 16);
143
207
  }
144
208
  function generateSessionKey(device, sessionId) {
145
- const hash = createHash("sha256").update(device + sessionId).digest("hex");
209
+ const hash = createHash("sha256").update(device + "\0" + sessionId).digest("hex");
146
210
  return hash.slice(0, 24);
147
211
  }
148
212
  var ClaudeCodeParser = class {
@@ -18,7 +18,7 @@ import {
18
18
  removePriceOverride,
19
19
  resolvePrice,
20
20
  setPriceOverride
21
- } from "./chunk-C6IKRE2P.js";
21
+ } from "./chunk-2DX56FB6.js";
22
22
  export {
23
23
  Aggregator,
24
24
  ClaudeCodeParser,