@angelyeye/dsh-cost-tracker 1.10.0 → 1.11.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/CHANGELOG.md +153 -0
- package/README.en.md +7 -3
- package/README.md +8 -4
- package/client.js +66 -21
- package/config.js +20 -2
- package/docs/provider-pricing.json +326 -21
- package/fast-tier.js +145 -0
- package/import.js +3 -2
- package/index.js +122 -24
- package/package.json +4 -2
- package/pricing.js +63 -8
- package/store.js +15 -4
- package/sync.js +35 -12
- package/token-format.js +61 -0
- package/vendor-catalog.js +191 -17
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generatedAt": "2026-
|
|
3
|
-
"note": "USD per 1M tokens.
|
|
2
|
+
"generatedAt": "2026-11-13",
|
|
3
|
+
"note": "USD per 1M tokens. official first, cross-checked second; fast-tier prices under serviceTiers.fast.",
|
|
4
4
|
"providers": {
|
|
5
5
|
"openai": {
|
|
6
6
|
"models": {
|
|
@@ -11,7 +11,33 @@
|
|
|
11
11
|
"billingMode": "flat",
|
|
12
12
|
"sourceUrl": "https://opencode.ai/v2/docs/console/models/",
|
|
13
13
|
"checkedAt": "2026-10-25",
|
|
14
|
-
"notes": "2026-10 降价(原 $5/$30);≤272K 档;超过 272K 按 $8/$30 计;缓存写入 $5"
|
|
14
|
+
"notes": "2026-10 降价(原 $5/$30);≤272K 档;超过 272K 按 $8/$30 计;缓存写入 $5",
|
|
15
|
+
"cacheWriteInput": 5,
|
|
16
|
+
"longContext": {
|
|
17
|
+
"inputTokensAbove": 272000,
|
|
18
|
+
"input": 8,
|
|
19
|
+
"cachedInput": 0.8,
|
|
20
|
+
"cacheWriteInput": 10,
|
|
21
|
+
"output": 30
|
|
22
|
+
},
|
|
23
|
+
"serviceTiers": {
|
|
24
|
+
"fast": {
|
|
25
|
+
"input": 8,
|
|
26
|
+
"cachedInput": 0.8,
|
|
27
|
+
"cacheWriteInput": 10,
|
|
28
|
+
"output": 40,
|
|
29
|
+
"longContext": {
|
|
30
|
+
"inputTokensAbove": 272000,
|
|
31
|
+
"input": 16,
|
|
32
|
+
"cachedInput": 1.6,
|
|
33
|
+
"cacheWriteInput": 20,
|
|
34
|
+
"output": 60
|
|
35
|
+
},
|
|
36
|
+
"confidence": "official"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"sourceUrlFast": "https://openai.com/api-fast-mode/",
|
|
40
|
+
"checkedAtFast": "2026-11-13"
|
|
15
41
|
},
|
|
16
42
|
"gpt-5.6-terra": {
|
|
17
43
|
"input": 2,
|
|
@@ -20,7 +46,8 @@
|
|
|
20
46
|
"billingMode": "flat",
|
|
21
47
|
"sourceUrl": "https://opencode.ai/docs/zen",
|
|
22
48
|
"checkedAt": "2026-08-17",
|
|
23
|
-
"notes": "≤272K 档;超过 272K 按 $4/$18 计;缓存写入 $2.
|
|
49
|
+
"notes": "≤272K 档;超过 272K 按 $4/$18 计;缓存写入 $2.5",
|
|
50
|
+
"cacheWriteInput": 2.5
|
|
24
51
|
},
|
|
25
52
|
"gpt-5.6-luna": {
|
|
26
53
|
"input": 0.2,
|
|
@@ -29,7 +56,8 @@
|
|
|
29
56
|
"billingMode": "flat",
|
|
30
57
|
"sourceUrl": "https://opencode.ai/docs/zen",
|
|
31
58
|
"checkedAt": "2026-08-17",
|
|
32
|
-
"notes": "≤272K 档;超过 272K 按 $0.40/$1.80 计;缓存写入 $0.25"
|
|
59
|
+
"notes": "≤272K 档;超过 272K 按 $0.40/$1.80 计;缓存写入 $0.25",
|
|
60
|
+
"cacheWriteInput": 0.25
|
|
33
61
|
},
|
|
34
62
|
"gpt-5.5": {
|
|
35
63
|
"input": 5,
|
|
@@ -198,7 +226,33 @@
|
|
|
198
226
|
"billingMode": "flat",
|
|
199
227
|
"sourceUrl": "https://opencode.ai/v2/docs/console/models/",
|
|
200
228
|
"checkedAt": "2026-10-25",
|
|
201
|
-
"notes": "≤272K 档;超过 272K 按 $20/$75 计;缓存写入 $12.
|
|
229
|
+
"notes": "≤272K 档;超过 272K 按 $20/$75 计;缓存写入 $12.5(>272K $25);OpenRouter 端点交叉核对一致",
|
|
230
|
+
"cacheWriteInput": 12.5,
|
|
231
|
+
"longContext": {
|
|
232
|
+
"inputTokensAbove": 272000,
|
|
233
|
+
"input": 20,
|
|
234
|
+
"cachedInput": 2,
|
|
235
|
+
"cacheWriteInput": 25,
|
|
236
|
+
"output": 75
|
|
237
|
+
},
|
|
238
|
+
"serviceTiers": {
|
|
239
|
+
"fast": {
|
|
240
|
+
"input": 20,
|
|
241
|
+
"cachedInput": 2,
|
|
242
|
+
"cacheWriteInput": 25,
|
|
243
|
+
"output": 100,
|
|
244
|
+
"longContext": {
|
|
245
|
+
"inputTokensAbove": 272000,
|
|
246
|
+
"input": 40,
|
|
247
|
+
"cachedInput": 4,
|
|
248
|
+
"cacheWriteInput": 50,
|
|
249
|
+
"output": 150
|
|
250
|
+
},
|
|
251
|
+
"confidence": "official"
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
"sourceUrlFast": "https://openai.com/api-fast-mode/",
|
|
255
|
+
"checkedAtFast": "2026-11-13"
|
|
202
256
|
},
|
|
203
257
|
"gpt-6-sol": {
|
|
204
258
|
"input": 2,
|
|
@@ -207,7 +261,33 @@
|
|
|
207
261
|
"billingMode": "flat",
|
|
208
262
|
"sourceUrl": "https://opencode.ai/v2/docs/console/models/",
|
|
209
263
|
"checkedAt": "2026-10-25",
|
|
210
|
-
"notes": "≤272K 档;超过 272K 按 $4/$15 计;缓存写入 $2.
|
|
264
|
+
"notes": "≤272K 档;超过 272K 按 $4/$15 计;缓存写入 $2.5",
|
|
265
|
+
"cacheWriteInput": 2.5,
|
|
266
|
+
"longContext": {
|
|
267
|
+
"inputTokensAbove": 272000,
|
|
268
|
+
"input": 4,
|
|
269
|
+
"cachedInput": 0.4,
|
|
270
|
+
"cacheWriteInput": 5,
|
|
271
|
+
"output": 15
|
|
272
|
+
},
|
|
273
|
+
"serviceTiers": {
|
|
274
|
+
"fast": {
|
|
275
|
+
"input": 4,
|
|
276
|
+
"cachedInput": 0.4,
|
|
277
|
+
"cacheWriteInput": 5,
|
|
278
|
+
"output": 20,
|
|
279
|
+
"longContext": {
|
|
280
|
+
"inputTokensAbove": 272000,
|
|
281
|
+
"input": 8,
|
|
282
|
+
"cachedInput": 0.8,
|
|
283
|
+
"cacheWriteInput": 10,
|
|
284
|
+
"output": 30
|
|
285
|
+
},
|
|
286
|
+
"confidence": "official"
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
"sourceUrlFast": "https://openai.com/api-fast-mode/",
|
|
290
|
+
"checkedAtFast": "2026-11-13"
|
|
211
291
|
},
|
|
212
292
|
"gpt-6.1-sol": {
|
|
213
293
|
"input": 2,
|
|
@@ -216,7 +296,33 @@
|
|
|
216
296
|
"billingMode": "flat",
|
|
217
297
|
"sourceUrl": "https://opencode.ai/v2/docs/console/models/",
|
|
218
298
|
"checkedAt": "2026-10-25",
|
|
219
|
-
"notes": "≤272K 档;超过 272K 按 $4/$15 计;缓存写入 $2.
|
|
299
|
+
"notes": "≤272K 档;超过 272K 按 $4/$15 计;缓存写入 $2.5",
|
|
300
|
+
"cacheWriteInput": 2.5,
|
|
301
|
+
"longContext": {
|
|
302
|
+
"inputTokensAbove": 272000,
|
|
303
|
+
"input": 4,
|
|
304
|
+
"cachedInput": 0.2,
|
|
305
|
+
"cacheWriteInput": 5,
|
|
306
|
+
"output": 15
|
|
307
|
+
},
|
|
308
|
+
"serviceTiers": {
|
|
309
|
+
"fast": {
|
|
310
|
+
"input": 4,
|
|
311
|
+
"cachedInput": 0.2,
|
|
312
|
+
"cacheWriteInput": 5,
|
|
313
|
+
"output": 20,
|
|
314
|
+
"longContext": {
|
|
315
|
+
"inputTokensAbove": 272000,
|
|
316
|
+
"input": 8,
|
|
317
|
+
"cachedInput": 0.4,
|
|
318
|
+
"cacheWriteInput": 10,
|
|
319
|
+
"output": 30
|
|
320
|
+
},
|
|
321
|
+
"confidence": "official"
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
"sourceUrlFast": "https://openai.com/api-fast-mode/",
|
|
325
|
+
"checkedAtFast": "2026-11-13"
|
|
220
326
|
},
|
|
221
327
|
"gpt-6-luna": {
|
|
222
328
|
"input": 0.1,
|
|
@@ -225,7 +331,149 @@
|
|
|
225
331
|
"billingMode": "flat",
|
|
226
332
|
"sourceUrl": "https://opencode.ai/v2/docs/console/models/",
|
|
227
333
|
"checkedAt": "2026-10-25",
|
|
228
|
-
"notes": "≤272K 档;超过 272K 按 $0.20/$0.75 计;缓存写入 $0.125"
|
|
334
|
+
"notes": "≤272K 档;超过 272K 按 $0.20/$0.75 计;缓存写入 $0.125",
|
|
335
|
+
"cacheWriteInput": 0.125,
|
|
336
|
+
"longContext": {
|
|
337
|
+
"inputTokensAbove": 272000,
|
|
338
|
+
"input": 0.2,
|
|
339
|
+
"cachedInput": 0.02,
|
|
340
|
+
"cacheWriteInput": 0.25,
|
|
341
|
+
"output": 0.75
|
|
342
|
+
},
|
|
343
|
+
"serviceTiers": {
|
|
344
|
+
"fast": {
|
|
345
|
+
"input": 0.2,
|
|
346
|
+
"cachedInput": 0.02,
|
|
347
|
+
"cacheWriteInput": 0.25,
|
|
348
|
+
"output": 1,
|
|
349
|
+
"longContext": {
|
|
350
|
+
"inputTokensAbove": 272000,
|
|
351
|
+
"input": 0.4,
|
|
352
|
+
"cachedInput": 0.04,
|
|
353
|
+
"cacheWriteInput": 0.5,
|
|
354
|
+
"output": 1.5
|
|
355
|
+
},
|
|
356
|
+
"confidence": "cross-checked"
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
"sourceUrlFast": "https://models.litellm.ai/models/gpt-6-luna",
|
|
360
|
+
"checkedAtFast": "2026-11-13"
|
|
361
|
+
},
|
|
362
|
+
"gpt-6.1-terra": {
|
|
363
|
+
"input": 1,
|
|
364
|
+
"cachedInput": 0.05,
|
|
365
|
+
"cacheWriteInput": 1.25,
|
|
366
|
+
"output": 5,
|
|
367
|
+
"billingMode": "flat",
|
|
368
|
+
"sourceUrl": "https://developers.openai.com/api/docs/pricing",
|
|
369
|
+
"checkedAt": "2026-11-13",
|
|
370
|
+
"notes": "v1.11.0 新增;≤272K 档;超过 272K 按 $2/$7.5 计;缓存写入 $1.25;官方 Fast 档 $2/$0.10/$10(长上下文 $4/$0.20/$15)",
|
|
371
|
+
"longContext": {
|
|
372
|
+
"inputTokensAbove": 272000,
|
|
373
|
+
"input": 2,
|
|
374
|
+
"cachedInput": 0.1,
|
|
375
|
+
"cacheWriteInput": 2.5,
|
|
376
|
+
"output": 7.5
|
|
377
|
+
},
|
|
378
|
+
"serviceTiers": {
|
|
379
|
+
"fast": {
|
|
380
|
+
"input": 2,
|
|
381
|
+
"cachedInput": 0.1,
|
|
382
|
+
"cacheWriteInput": 2.5,
|
|
383
|
+
"output": 10,
|
|
384
|
+
"longContext": {
|
|
385
|
+
"inputTokensAbove": 272000,
|
|
386
|
+
"input": 4,
|
|
387
|
+
"cachedInput": 0.2,
|
|
388
|
+
"cacheWriteInput": 5,
|
|
389
|
+
"output": 15
|
|
390
|
+
},
|
|
391
|
+
"confidence": "official"
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
"sourceUrlFast": "https://openai.com/api-fast-mode/",
|
|
395
|
+
"checkedAtFast": "2026-11-13"
|
|
396
|
+
},
|
|
397
|
+
"gpt-6-rosalind": {
|
|
398
|
+
"input": 15,
|
|
399
|
+
"cachedInput": 1.5,
|
|
400
|
+
"cacheWriteInput": 18.75,
|
|
401
|
+
"output": 75,
|
|
402
|
+
"billingMode": "flat",
|
|
403
|
+
"sourceUrl": "https://developers.openai.com/api/docs/pricing",
|
|
404
|
+
"checkedAt": "2026-11-13",
|
|
405
|
+
"notes": "v1.11.0 新增;Research 受限模型;价格来自交叉核对,官方 Fast 档未见单独报价",
|
|
406
|
+
"longContext": {
|
|
407
|
+
"inputTokensAbove": 272000,
|
|
408
|
+
"input": 30,
|
|
409
|
+
"cachedInput": 3,
|
|
410
|
+
"cacheWriteInput": 37.5,
|
|
411
|
+
"output": 112.5
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
"gpt-6-cyber": {
|
|
415
|
+
"input": 20,
|
|
416
|
+
"cachedInput": 2,
|
|
417
|
+
"cacheWriteInput": 25,
|
|
418
|
+
"output": 100,
|
|
419
|
+
"billingMode": "flat",
|
|
420
|
+
"sourceUrl": "https://developers.openai.com/api/docs/pricing",
|
|
421
|
+
"checkedAt": "2026-11-13",
|
|
422
|
+
"notes": "v1.11.0 新增;Daybreak Red 受限模型;不支持 Fast 档",
|
|
423
|
+
"longContext": {
|
|
424
|
+
"inputTokensAbove": 272000,
|
|
425
|
+
"input": 40,
|
|
426
|
+
"cachedInput": 4,
|
|
427
|
+
"cacheWriteInput": 50,
|
|
428
|
+
"output": 150
|
|
429
|
+
}
|
|
430
|
+
},
|
|
431
|
+
"gpt-5.6-cyber": {
|
|
432
|
+
"input": 12.5,
|
|
433
|
+
"cachedInput": 1.25,
|
|
434
|
+
"cacheWriteInput": 15.625,
|
|
435
|
+
"output": 75,
|
|
436
|
+
"billingMode": "flat",
|
|
437
|
+
"sourceUrl": "https://developers.openai.com/api/docs/pricing",
|
|
438
|
+
"checkedAt": "2026-11-13",
|
|
439
|
+
"notes": "v1.11.0 新增;受限模型;无独立 Fast 报价",
|
|
440
|
+
"longContext": {
|
|
441
|
+
"inputTokensAbove": 272000,
|
|
442
|
+
"input": 25,
|
|
443
|
+
"cachedInput": 2.5,
|
|
444
|
+
"cacheWriteInput": 31.25,
|
|
445
|
+
"output": 112.5
|
|
446
|
+
}
|
|
447
|
+
},
|
|
448
|
+
"gpt-5.5-cyber": {
|
|
449
|
+
"input": 12.5,
|
|
450
|
+
"cachedInput": 1.25,
|
|
451
|
+
"cacheWriteInput": 15.625,
|
|
452
|
+
"output": 75,
|
|
453
|
+
"billingMode": "flat",
|
|
454
|
+
"sourceUrl": "https://developers.openai.com/api/docs/pricing",
|
|
455
|
+
"checkedAt": "2026-11-13",
|
|
456
|
+
"notes": "v1.11.0 新增;受限模型;无独立 Fast 报价"
|
|
457
|
+
},
|
|
458
|
+
"gpt-5.5-cyber-preview": {
|
|
459
|
+
"input": 12.5,
|
|
460
|
+
"cachedInput": 1.25,
|
|
461
|
+
"cacheWriteInput": 15.625,
|
|
462
|
+
"output": 75,
|
|
463
|
+
"billingMode": "flat",
|
|
464
|
+
"sourceUrl": "https://developers.openai.com/api/docs/pricing",
|
|
465
|
+
"checkedAt": "2026-11-13",
|
|
466
|
+
"notes": "v1.11.0 新增;预览版,2027-02-01 下线"
|
|
467
|
+
},
|
|
468
|
+
"gpt-6-astra-law": {
|
|
469
|
+
"input": 10,
|
|
470
|
+
"cachedInput": 1,
|
|
471
|
+
"cacheWriteInput": 12.5,
|
|
472
|
+
"output": 50,
|
|
473
|
+
"billingMode": "flat",
|
|
474
|
+
"sourceUrl": "https://developers.openai.com/api/docs/pricing",
|
|
475
|
+
"checkedAt": "2026-11-13",
|
|
476
|
+
"notes": "v1.11.0 新增;促销价至少延续到 2026-12-31;官方 API 仍为受限开放"
|
|
229
477
|
}
|
|
230
478
|
}
|
|
231
479
|
},
|
|
@@ -336,8 +584,9 @@
|
|
|
336
584
|
"output": 20,
|
|
337
585
|
"billingMode": "flat",
|
|
338
586
|
"sourceUrl": "https://www.anthropic.com/claude/opus",
|
|
339
|
-
"checkedAt": "2026-
|
|
340
|
-
"notes": "
|
|
587
|
+
"checkedAt": "2026-11-13",
|
|
588
|
+
"notes": "v1.11.0 校正;缓存读 = 输入 0.05x($0.20);5 分钟缓存写 $5、1 小时 $8;Fast 档 $8/$40",
|
|
589
|
+
"cacheWriteInput": 5
|
|
341
590
|
},
|
|
342
591
|
"claude-sonnet-5-5": {
|
|
343
592
|
"input": 2,
|
|
@@ -356,6 +605,26 @@
|
|
|
356
605
|
"sourceUrl": "https://www.anthropic.com/claude/haiku",
|
|
357
606
|
"checkedAt": "2026-10-25",
|
|
358
607
|
"notes": "≤100K 档;超过 100K 按 $0.50/$2.50 计;缓存写入 $0.125"
|
|
608
|
+
},
|
|
609
|
+
"claude-fable-5-2": {
|
|
610
|
+
"input": 8,
|
|
611
|
+
"cachedInput": 0.2,
|
|
612
|
+
"cacheWriteInput": 10,
|
|
613
|
+
"output": 40,
|
|
614
|
+
"billingMode": "flat",
|
|
615
|
+
"sourceUrl": "https://www.anthropic.com/claude/fable",
|
|
616
|
+
"checkedAt": "2026-11-13",
|
|
617
|
+
"notes": "v1.11.0 新增(2026-11-09);缓存读为输入的 0.025x;5 分钟缓存写 $10、1 小时 $16;Batch $4/$20;Fast 档 $16/$0.40/$80"
|
|
618
|
+
},
|
|
619
|
+
"claude-mythos-5-2": {
|
|
620
|
+
"input": 8,
|
|
621
|
+
"cachedInput": 0.2,
|
|
622
|
+
"cacheWriteInput": 10,
|
|
623
|
+
"output": 40,
|
|
624
|
+
"billingMode": "flat",
|
|
625
|
+
"sourceUrl": "https://www.anthropic.com/claude/mythos",
|
|
626
|
+
"checkedAt": "2026-11-13",
|
|
627
|
+
"notes": "v1.11.0 新增(2026-11-09);受限访问(需 Verification Program);缓存读 0.025x;1 小时缓存写 $16"
|
|
359
628
|
}
|
|
360
629
|
}
|
|
361
630
|
},
|
|
@@ -452,6 +721,24 @@
|
|
|
452
721
|
"sourceUrl": "https://opencode.ai/v2/docs/console/models/",
|
|
453
722
|
"checkedAt": "2026-10-25",
|
|
454
723
|
"notes": "网关列 $1.50/$7.50;OpenRouter 端点标 5 折现价 $0.75/$3.75;两源口径不一致,未核实"
|
|
724
|
+
},
|
|
725
|
+
"gemini-4-carbon": {
|
|
726
|
+
"input": 2,
|
|
727
|
+
"cachedInput": 0.1,
|
|
728
|
+
"output": 10,
|
|
729
|
+
"billingMode": "flat",
|
|
730
|
+
"sourceUrl": "https://ai.google.dev/gemini-api/docs/pricing",
|
|
731
|
+
"checkedAt": "2026-11-13",
|
|
732
|
+
"notes": "v1.11.0 新增;仅隐式缓存;2026-11-30 前促销价,$12-01 起为 $4/$0.20/$20;Priority $3.60/$18;Batch/Flex 半价"
|
|
733
|
+
},
|
|
734
|
+
"gemini-4-hydrogen": {
|
|
735
|
+
"input": 1.5,
|
|
736
|
+
"cachedInput": 0.075,
|
|
737
|
+
"output": 7.5,
|
|
738
|
+
"billingMode": "flat",
|
|
739
|
+
"sourceUrl": "https://ai.google.dev/gemini-api/docs/pricing",
|
|
740
|
+
"checkedAt": "2026-11-13",
|
|
741
|
+
"notes": "v1.11.0 新增(2026-11-12);1M 统一上下文;Priority $2.70/$13.50;Batch/Flex 半价"
|
|
455
742
|
}
|
|
456
743
|
}
|
|
457
744
|
},
|
|
@@ -566,8 +853,8 @@
|
|
|
566
853
|
"output": 1.25,
|
|
567
854
|
"billingMode": "flat",
|
|
568
855
|
"sourceUrl": "https://docs.z.ai/guides/overview/pricing",
|
|
569
|
-
"checkedAt": "2026-
|
|
570
|
-
"notes": "
|
|
856
|
+
"checkedAt": "2026-11-13",
|
|
857
|
+
"notes": "v1.11.0 新增;glm-5.3-flashx-legal 同价"
|
|
571
858
|
}
|
|
572
859
|
}
|
|
573
860
|
},
|
|
@@ -615,8 +902,8 @@
|
|
|
615
902
|
"output": 6,
|
|
616
903
|
"billingMode": "flat",
|
|
617
904
|
"sourceUrl": "https://docs.x.ai/developers/pricing",
|
|
618
|
-
"checkedAt": "2026-
|
|
619
|
-
"notes": "
|
|
905
|
+
"checkedAt": "2026-11-13",
|
|
906
|
+
"notes": "v1.11.0 校正;≥200K 输入整请求 $4/$1/$12;Fast 档仅在 Cursor/Grok Build 内计费,公网 API 无"
|
|
620
907
|
},
|
|
621
908
|
"grok-4.20-0309-reasoning": {
|
|
622
909
|
"input": 1.25,
|
|
@@ -710,6 +997,15 @@
|
|
|
710
997
|
"sourceUrl": "https://www.alibabacloud.com/help/en/model-studio/model-pricing",
|
|
711
998
|
"checkedAt": "2026-10-25",
|
|
712
999
|
"notes": "2026-10 新增;缓存命中按输入价 10%;网关注明 cachedWrite $0.20"
|
|
1000
|
+
},
|
|
1001
|
+
"qwen4-max-preview": {
|
|
1002
|
+
"input": 0,
|
|
1003
|
+
"cachedInput": 0,
|
|
1004
|
+
"output": 0,
|
|
1005
|
+
"billingMode": "unpriced",
|
|
1006
|
+
"sourceUrl": "https://docs.qwencloud.com/developer-guides/getting-started/latest-model",
|
|
1007
|
+
"checkedAt": "2026-11-13",
|
|
1008
|
+
"notes": "v1.11.0 新增;仅 Token Plan(Credits)订阅可用,无按 token 公开价;预览期 2026-11-11 至 11-25,之后退役"
|
|
713
1009
|
}
|
|
714
1010
|
}
|
|
715
1011
|
},
|
|
@@ -780,6 +1076,15 @@
|
|
|
780
1076
|
"sourceUrl": "https://cloud.tencent.com/document/product/1823/130055",
|
|
781
1077
|
"checkedAt": "2026-10-25",
|
|
782
1078
|
"notes": "官方 TokenHub:¥6.00/¥0.30/¥18.00,按 7.2 折算;新一代生产力模型"
|
|
1079
|
+
},
|
|
1080
|
+
"hy4": {
|
|
1081
|
+
"input": 0.417,
|
|
1082
|
+
"cachedInput": 0.021,
|
|
1083
|
+
"output": 1.2505,
|
|
1084
|
+
"billingMode": "flat",
|
|
1085
|
+
"sourceUrl": "https://www.tencentcloud.com/document/product/1300/78937",
|
|
1086
|
+
"checkedAt": "2026-11-13",
|
|
1087
|
+
"notes": "v1.11.0 新增(2026-11-04 GA);当前 5 折促销价,目录价 $0.834/$0.042/$2.501,2026-12-31 后恢复;hy4-preview 同价"
|
|
783
1088
|
}
|
|
784
1089
|
}
|
|
785
1090
|
},
|
|
@@ -918,13 +1223,13 @@
|
|
|
918
1223
|
"notes": "GA;官方 API 名已改为 mistral-small-2603;官方未列缓存价,缓存值未核实"
|
|
919
1224
|
},
|
|
920
1225
|
"mistral-large-4": {
|
|
921
|
-
"input":
|
|
922
|
-
"cachedInput": 0.
|
|
923
|
-
"output":
|
|
1226
|
+
"input": 0.7,
|
|
1227
|
+
"cachedInput": 0.07,
|
|
1228
|
+
"output": 2.1,
|
|
924
1229
|
"billingMode": "flat",
|
|
925
|
-
"sourceUrl": "https://docs.mistral.ai/
|
|
926
|
-
"checkedAt": "2026-
|
|
927
|
-
"notes": "
|
|
1230
|
+
"sourceUrl": "https://docs.mistral.ai/models/mistral-large-4-0",
|
|
1231
|
+
"checkedAt": "2026-11-13",
|
|
1232
|
+
"notes": "v1.11.0 校正(2026-11-05 起官方价);旧值 1.36/4.18 来自第三方 host,非官方牌价"
|
|
928
1233
|
},
|
|
929
1234
|
"mistral-small-2603": {
|
|
930
1235
|
"input": 0.15,
|
package/fast-tier.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// DSH 花费统计插件 —— GPT 服务档位(Fast / priority)识别
|
|
3
|
+
//
|
|
4
|
+
// 背景:OpenAI 自 2026-07-30 起把 Priority processing 更名为 Fast mode,
|
|
5
|
+
// 请求可用 `service_tier: "fast"` 或 `"priority"`。同一模型的 Fast 档价格
|
|
6
|
+
// 与标准价不同(多数是 2x,个别模型更高),因此记账必须知道这一笔走的哪档。
|
|
7
|
+
//
|
|
8
|
+
// 宿主当前不给插件层提供档位(GenerateOptions / TokenUsage / stream 事件都没有
|
|
9
|
+
// serviceTier 字段),实际把档位写到线上的插件 `dsh-fast-tier` 会把**会话级选择**
|
|
10
|
+
// 追加进会话日志(`steered` 事件,source.kind = 'fast-tier',tier 为
|
|
11
|
+
// default / priority / ultrafast)。本模块只做两件事:
|
|
12
|
+
//
|
|
13
|
+
// 1. `tierOfSteeredEvent` / `tierFromEvents`:纯函数,从日志事件折叠出档位;
|
|
14
|
+
// 2. `createTierResolver`:把 ctx 的可选服务包装成「给 sessionId 返回档位」的函数,
|
|
15
|
+
// 任一环节缺失或抛错都返回 'standard',绝不影响记账主流程。
|
|
16
|
+
//
|
|
17
|
+
// 判定优先级:请求参数(未来宿主)> 会话选择 > 标准档。
|
|
18
|
+
// ============================================================
|
|
19
|
+
|
|
20
|
+
/** dsh-fast-tier 的 steered 事件 source.kind */
|
|
21
|
+
export const FAST_TIER_SOURCE_KIND = 'fast-tier'
|
|
22
|
+
/** dsh-fast-tier 注册的投影键(Host 侧状态即 { tier, seq }) */
|
|
23
|
+
export const FAST_TIER_PROJECTION_KEY = 'fastTier'
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* UI 档位 → 计费档位。
|
|
27
|
+
* default → standard(不发 service_tier)
|
|
28
|
+
* priority → fast(Fast mode 线上取值之一)
|
|
29
|
+
* ultrafast→ fast(有独立倍率,但本插件按 Fast 价计并标注偏低)
|
|
30
|
+
* fast → fast(线上别名,dsh-fast-tier 也接受)
|
|
31
|
+
* @param {string} tier - 日志里的档位 id
|
|
32
|
+
* @returns {'standard'|'fast'|''} 未知档位返回 ''
|
|
33
|
+
*/
|
|
34
|
+
export function billableTierOf(tier) {
|
|
35
|
+
switch (String(tier || '').toLowerCase()) {
|
|
36
|
+
case 'default':
|
|
37
|
+
case 'auto':
|
|
38
|
+
case 'standard':
|
|
39
|
+
return 'standard'
|
|
40
|
+
case 'priority':
|
|
41
|
+
case 'fast':
|
|
42
|
+
case 'ultrafast':
|
|
43
|
+
return 'fast'
|
|
44
|
+
default:
|
|
45
|
+
return ''
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 判断一个日志事件是否为 dsh-fast-tier 的档位选择,是则返回其 tier。
|
|
51
|
+
* @param {object} event - 会话事件
|
|
52
|
+
* @returns {string} tier 或 ''(不是档位事件)
|
|
53
|
+
*/
|
|
54
|
+
export function tierOfSteeredEvent(event) {
|
|
55
|
+
if (!event || event.type !== 'steered') return ''
|
|
56
|
+
const source = event.data && event.data.source
|
|
57
|
+
if (!source || typeof source !== 'object' || source.kind !== FAST_TIER_SOURCE_KIND) return ''
|
|
58
|
+
const tier = source.tier
|
|
59
|
+
return typeof tier === 'string' ? tier : ''
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 从会话事件序列折叠出最后一次档位选择(dsh-fast-tier 的语义:后写覆盖)。
|
|
64
|
+
* @param {Iterable<object>} events - 会话事件(按 seq 升序)
|
|
65
|
+
* @returns {string} tier 或 ''(从未选择)
|
|
66
|
+
*/
|
|
67
|
+
export function tierFromEvents(events) {
|
|
68
|
+
let chosen = ''
|
|
69
|
+
try {
|
|
70
|
+
for (const ev of events) {
|
|
71
|
+
const tier = tierOfSteeredEvent(ev)
|
|
72
|
+
if (tier) chosen = tier
|
|
73
|
+
}
|
|
74
|
+
} catch {
|
|
75
|
+
return chosen
|
|
76
|
+
}
|
|
77
|
+
return chosen
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* 从投影状态({ tier, seq })取档位。
|
|
82
|
+
* @param {unknown} state
|
|
83
|
+
* @returns {string}
|
|
84
|
+
*/
|
|
85
|
+
export function tierOfProjectionState(state) {
|
|
86
|
+
const t = state && typeof state === 'object' ? state.tier : null
|
|
87
|
+
return typeof t === 'string' ? t : ''
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 创建「sessionId → 计费档位」解析器。
|
|
92
|
+
*
|
|
93
|
+
* 只读:读会话对象、读 dsh-fast-tier 已注册的投影,不注册新投影、不写会话日志。
|
|
94
|
+
* 任何异常都降级为 { tier:'standard', source:'none' },记账流程不会因此中断。
|
|
95
|
+
*
|
|
96
|
+
* @param {{sessions?:{get?:Function}, sessionProjections?:{stateOf?:Function}}} ctx - Cordis 上下文
|
|
97
|
+
* @returns {(sessionId:string) => {tier:'standard'|'fast', source:string, raw?:string}}
|
|
98
|
+
*/
|
|
99
|
+
export function createTierResolver(ctx) {
|
|
100
|
+
const none = { tier: 'standard', source: 'none' }
|
|
101
|
+
const sessions = ctx && ctx.sessions
|
|
102
|
+
const projections = ctx && ctx.sessionProjections
|
|
103
|
+
return (sessionId) => {
|
|
104
|
+
const sid = String(sessionId || '')
|
|
105
|
+
if (!sid) return none
|
|
106
|
+
try {
|
|
107
|
+
const get = sessions && typeof sessions.get === 'function' ? sessions.get.bind(sessions) : null
|
|
108
|
+
if (!get) return none
|
|
109
|
+
const session = get(sid)
|
|
110
|
+
if (!session) return none
|
|
111
|
+
// ① 优先读 dsh-fast-tier 的投影(宿主缓存,O(1))
|
|
112
|
+
const stateOf = projections && typeof projections.stateOf === 'function' ? projections.stateOf.bind(projections) : null
|
|
113
|
+
if (stateOf) {
|
|
114
|
+
const raw = tierOfProjectionState(stateOf(session, FAST_TIER_PROJECTION_KEY))
|
|
115
|
+
const tier = billableTierOf(raw)
|
|
116
|
+
if (tier) return { tier, source: 'projection', raw }
|
|
117
|
+
}
|
|
118
|
+
// ② 兜底折叠会话日志(投影未注册 / 插件刚装上时)
|
|
119
|
+
const events = typeof session.events === 'function' ? session.events() : session.events
|
|
120
|
+
if (events && typeof events[Symbol.iterator] === 'function') {
|
|
121
|
+
const raw = tierFromEvents(events)
|
|
122
|
+
const tier = billableTierOf(raw)
|
|
123
|
+
if (tier) return { tier, source: 'log', raw }
|
|
124
|
+
}
|
|
125
|
+
return none
|
|
126
|
+
} catch {
|
|
127
|
+
return none
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* 解析一次调用的计费档位:请求参数优先,其次会话选择,最后标准档。
|
|
134
|
+
* @param {{serviceTier?:string}} options - llm 调用参数
|
|
135
|
+
* @param {(sessionId:string)=>{tier:string,source:string,raw?:string}} resolve - 会话解析器
|
|
136
|
+
* @param {string} sessionId
|
|
137
|
+
* @returns {{tier:'standard'|'fast', source:string, raw?:string, ultrafast?:boolean}}
|
|
138
|
+
*/
|
|
139
|
+
export function resolveTier(options, resolve, sessionId) {
|
|
140
|
+
const fromRequest = billableTierOf(options && options.serviceTier)
|
|
141
|
+
if (fromRequest) return { tier: fromRequest, source: 'request' }
|
|
142
|
+
const hit = typeof resolve === 'function' ? resolve(sessionId) : null
|
|
143
|
+
if (!hit || !hit.tier) return { tier: 'standard', source: 'none' }
|
|
144
|
+
return { ...hit, ultrafast: String(hit.raw || '').toLowerCase() === 'ultrafast' }
|
|
145
|
+
}
|
package/import.js
CHANGED
|
@@ -331,7 +331,7 @@ export function importKeyOf(sessionId, call) {
|
|
|
331
331
|
* @param {{path:string}[]} logs - listSessionLogs 的输出
|
|
332
332
|
* @param {object} manifest - 清单(loadManifest 的输出,会被就地更新引用)
|
|
333
333
|
* @param {{priceFn:Function, normProvider:Function, now?:number}} hooks
|
|
334
|
-
* priceFn(np, model, ts, tokens) → {cost, estimated, subscription, period, model}
|
|
334
|
+
* priceFn(np, model, ts, tokens, sessionId) → {cost, estimated, subscription, period, model}
|
|
335
335
|
* @returns {Promise<Array>} 每个文件的结果 {path, sessionId, status, calls, imported, skipped, reason}
|
|
336
336
|
*/
|
|
337
337
|
export async function planAndBuildImports(allRecords, rollups, logs, manifest, hooks) {
|
|
@@ -369,7 +369,8 @@ export async function planAndBuildImports(allRecords, rollups, logs, manifest, h
|
|
|
369
369
|
if (importedKeys.has(importKeyOf(sid, call))) continue // 之前已导入过
|
|
370
370
|
const np = hooks.normProvider(call.provider)
|
|
371
371
|
if (!np && !call.model) continue
|
|
372
|
-
|
|
372
|
+
// v1.11.0:多传 sessionId,供计价层识别该会话的 GPT Fast 档选择
|
|
373
|
+
const price = hooks.priceFn(np, call.model, call.ts, call.tokens, sid)
|
|
373
374
|
picked.push({
|
|
374
375
|
ts: call.ts,
|
|
375
376
|
provider: call.provider,
|