tokentracker-cli 1.5.16 → 1.5.18
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/dashboard/dist/assets/{AchievementBadge-CnnJGct8.js → AchievementBadge-DE1v2d68.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-CFkUJVxy.js → AchievementsPage-B_8ON-kk.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-CoLQX04M.js → AchievementsSection-DScfDUBu.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-s8rObEHY.js → BadgeDetailModal-Dto1Fw6b.js} +1 -1
- package/dashboard/dist/assets/{BotAnimated-BmBnL-i8.js → BotAnimated-D85msagA.js} +1 -1
- package/dashboard/dist/assets/{Card-BIqie5mN.js → Card-BY22bIUZ.js} +1 -1
- package/dashboard/dist/assets/{CloudCheckoutPage-B_c8Q58A.js → CloudCheckoutPage-BAdtoWBp.js} +1 -1
- package/dashboard/dist/assets/{CloudPage-CfW_pDf2.js → CloudPage-Bf-IHk6T.js} +2 -2
- package/dashboard/dist/assets/{CommandPalette-BRryGPVJ.js → CommandPalette-CGfkEV0N.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-Cyh1Q9Fw.js → CommunityStatsModal-DMSi6_nf.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-DWBYqpLJ.js → ConfirmModal-Z-WmnkDu.js} +1 -1
- package/dashboard/dist/assets/{Controls-CPSiCzVW.js → Controls-TVKhEDXR.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-JcS1xwUm.js → DashboardPage-D0bpXi9x.js} +1 -1
- package/dashboard/dist/assets/{DateRangePopover-DjuS6888.js → DateRangePopover-Bjmg11sQ.js} +1 -1
- package/dashboard/dist/assets/{DevicePage-DZ3qiDbT.js → DevicePage-qbDI5e82.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-CfORRnoT.js → DialogClose-Bdoz1fn-.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-BahSe9KF.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-DZO6-sTI.js → DialogTitle-AFjJHlYC.js} +1 -1
- package/dashboard/dist/assets/{ElectricLogo-BzR7mRin.js → ElectricLogo-ClLSjxoP.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-BxHaUvz_.js → FadeIn-BFU8MJF8.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-KGzKAmuQ.js → HeaderGithubStar-YVASNIKr.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-C6pASVDN.js → HoverTooltip-CmmQ-YbL.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-BJ8TROZC.js → IpCheckPage-Cfx0N7pC.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-B15GRFpI.js → LandingPage-1nwzYTWH.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardPage-C3hJ2Gh3.js → LeaderboardPage-mabCyyx8.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProBadge-CRfBTxpt.js → LeaderboardProBadge-CpuiWnd7.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardProfileModal-DTGmcjWF.js → LeaderboardProfileModal-CHKqw-_G.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-BD04D7ML.js → LeaderboardProfilePage-DOTGyQ2d.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-LsDCIUKd.js → LimitsPage-CG58C7jU.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-B3XQKD8k.js → LocalOnlyNotice-DlYoWPFa.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-DF1XcskU.js → LoginCard-DCeeAwlk.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-DuyVT0Tt.js → LoginModal-EiPXjhfX.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-kge4kJKa.js → LoginPage-CvBueMXL.js} +1 -1
- package/dashboard/dist/assets/{PetPage-DuYtsKza.js → PetPage-G6OT7E9R.js} +2 -2
- package/dashboard/dist/assets/{PopoverPopup-BkNNS3VG.js → PopoverPopup-YVaxWIuz.js} +1 -1
- package/dashboard/dist/assets/{ProviderIcon-z2TKXPlS.js → ProviderIcon-BdLkrup9.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-CXM9E6d1.js → ResetPasswordPage-CB46SfND.js} +1 -1
- package/dashboard/dist/assets/{Select-CeoAayzi.js → Select-b_sgds1U.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-CRxvAgUV.js → SelectItemText-DPzAvIN5.js} +1 -1
- package/dashboard/dist/assets/{SelfHostPage-Cavstn-d.js → SelfHostPage-ab1vM_Ap.js} +1 -1
- package/dashboard/dist/assets/{ServiceStatusPage-CdIeM_DX.js → ServiceStatusPage-DWdqmWFE.js} +1 -1
- package/dashboard/dist/assets/{SessionsPage-DPihAS26.js → SessionsPage-D1lZMRLn.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-zxOsLeE5.js → SettingsPage-DJ5SHzfe.js} +3 -3
- package/dashboard/dist/assets/{SkillsPage-BRGonzsC.js → SkillsPage-D1jKoc4w.js} +1 -1
- package/dashboard/dist/assets/{TokenGalaxy-D9-huQJ_.js → TokenGalaxy-D9FnMzuQ.js} +1 -1
- package/dashboard/dist/assets/{TooltipPopup-BS99Tf44.js → TooltipPopup-CXImEU-U.js} +1 -1
- package/dashboard/dist/assets/{TrendMonitor-DlNT4ObY.js → TrendMonitor-D-QL4bKY.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-DTFnmTwq.js → WidgetsPage-DBxo2Fax.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-DwMdnusQ.js → WrappedPage-CkQc1EjF.js} +1 -1
- package/dashboard/dist/assets/{__vite-browser-external-DR_a-OTS.js → __vite-browser-external-999JOlud.js} +2 -2
- package/dashboard/dist/assets/{agent-logos-D6kTooyz.js → agent-logos-C8Zq5jVJ.js} +1 -1
- package/dashboard/dist/assets/{arrow-left-jpuJhYL4.js → arrow-left-Cc0vGlDY.js} +1 -1
- package/dashboard/dist/assets/{arrow-right-n1hLkwiK.js → arrow-right-C2qOVlDC.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-fZmEfh7R.js → arrow-up-right-wIUnZTy-.js} +1 -1
- package/dashboard/dist/assets/{calendar-days-B0LdECvD.js → calendar-days-ZVqo5KcO.js} +1 -1
- package/dashboard/dist/assets/{check-CcnNd8bi.js → check-VK1_HpZD.js} +1 -1
- package/dashboard/dist/assets/{chevron-down-DhbHBjVC.js → chevron-down-DzN4aEbK.js} +1 -1
- package/dashboard/dist/assets/{cloud-checkout-9XOoux-p.js → cloud-checkout-DY_OGdcU.js} +1 -1
- package/dashboard/dist/assets/{composite-DIDAkYhy.js → composite-CQdQrYyw.js} +1 -1
- package/dashboard/dist/assets/{copy-BNDBunFG.js → copy-1CiGdscm.js} +1 -1
- package/dashboard/dist/assets/{download-wlqdqJmq.js → download-DnOkvUz6.js} +1 -1
- package/dashboard/dist/assets/{external-link-BvssZ_45.js → external-link-Bb6RxSJQ.js} +1 -1
- package/dashboard/dist/assets/{flame-DP8IUT3E.js → flame-BzdRbf5R.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-DMsx_fWk.js → format-tokens-CJDFj6UL.js} +1 -1
- package/dashboard/dist/assets/{gift-zF4D6O4a.js → gift-BD3tOkCz.js} +1 -1
- package/dashboard/dist/assets/{icons-Batw5aOg.js → icons-CuIU9GgV.js} +1 -1
- package/dashboard/dist/assets/{index-Dc8PQ8ZR.js → index-3uw-etEr.js} +1 -1
- package/dashboard/dist/assets/{index-Cqla2Zq5.js → index-CrBT_rtN.js} +1 -1
- package/dashboard/dist/assets/{index-3qKpTOzz.js → index-DIc6eZMw.js} +1 -1
- package/dashboard/dist/assets/{index-dCfimErX.js → index-DJ8zVWHq.js} +1 -1
- package/dashboard/dist/assets/{info-DcUyOPKG.js → info-B_S49Oq7.js} +1 -1
- package/dashboard/dist/assets/{link-2-CS-cWLmx.js → link-2-CcDQ8fqJ.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-DKc-gwgL.js → loader-circle-Q4LB_Etc.js} +1 -1
- package/dashboard/dist/assets/{local-usage-transfer-bHATORmq.js → local-usage-transfer-XT9tg8yv.js} +1 -1
- package/dashboard/dist/assets/{modifiers.esm-B4QifJzx.js → modifiers.esm-C8foqc3F.js} +1 -1
- package/dashboard/dist/assets/{monitor-smartphone-D8vpN9Jv.js → monitor-smartphone-CA5Qp4Zj.js} +1 -1
- package/dashboard/dist/assets/{play-D70P7DVT.js → play-C96stHVA.js} +1 -1
- package/dashboard/dist/assets/{plus-YomnSdqY.js → plus-BeyajWsi.js} +1 -1
- package/dashboard/dist/assets/{provider-display-VXu7Hzwq.js → provider-display-C6hZ4Gv0.js} +1 -1
- package/dashboard/dist/assets/{react-CUO9Gs2G.js → react-ByeQdtM4.js} +1 -1
- package/dashboard/dist/assets/{safePolygon-CbVKM3Lv.js → safePolygon-XH8gG2Un.js} +1 -1
- package/dashboard/dist/assets/{search-BUi1hAmV.js → search-BnUBcQPT.js} +1 -1
- package/dashboard/dist/assets/{server-B-agbJYI.js → server-BJt2-SYZ.js} +1 -1
- package/dashboard/dist/assets/{shield-check-yHx3fQDo.js → shield-check-BXqFTLdE.js} +1 -1
- package/dashboard/dist/assets/{skills-api-DojEO2dS.js → skills-api-D2zAFF2H.js} +1 -1
- package/dashboard/dist/assets/{sortable.esm-r4Lz4ugj.js → sortable.esm-BdezpKNF.js} +1 -1
- package/dashboard/dist/assets/{store-GzQbKyT-.js → store-BCgczKmA.js} +1 -1
- package/dashboard/dist/assets/{terminal-BLCZgZTm.js → terminal-IBpppziO.js} +1 -1
- package/dashboard/dist/assets/{trash-BFGtCBJS.js → trash-DzLx8Iw6.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-DGdLAa8L.js → use-community-stats-DPq4t1Vg.js} +1 -1
- package/dashboard/dist/assets/{use-latest-request-guard-l39bM4s0.js → use-latest-request-guard-aZwiQ-a0.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-JcWgMNA0.js → use-limits-display-prefs-B6-VcF_L.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-0sXFw6mq.js → use-native-settings-DjZ-dUXo.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-mRdyZ18r.js → use-ordered-list-diTHYtBP.js} +1 -1
- package/dashboard/dist/assets/use-reduced-motion-BDkV3tNz.js +1 -0
- package/dashboard/dist/assets/{use-transform-CbJqMa_Y.js → use-transform-BoD4Vv44.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-qQKS4sHR.js → use-usage-limits-IajzoyyH.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-BJyZCVtd.js → useCurrency-CUURuFSP.js} +1 -1
- package/dashboard/dist/assets/{usePositioner-zsiJqVGU.js → usePositioner-BJtm9eLD.js} +1 -1
- package/dashboard/dist/assets/{useTokenFormat-DxEKSp5H.js → useTokenFormat-Bqv8Ygf_.js} +1 -1
- package/dashboard/dist/assets/{zap-D40-8VPk.js → zap-BYL3i1NW.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/ip-check.html +1 -1
- package/dashboard/dist/leaderboard.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/commands/status.js +2 -0
- package/src/lib/dsh-session.js +81 -0
- package/src/lib/pricing/curated-overrides.json +66 -1
- package/src/lib/pricing/matcher.js +30 -4
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/rollout.js +1 -0
- package/src/lib/session-analytics.js +4 -1
- package/src/lib/session-performance.js +15 -0
- package/dashboard/dist/assets/DialogDescription-ChihKLnm.js +0 -1
- package/dashboard/dist/assets/use-reduced-motion-D2g3iGbi.js +0 -1
package/src/lib/dsh-session.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
const fs = require("node:fs");
|
|
9
9
|
const path = require("node:path");
|
|
10
10
|
const crypto = require("node:crypto");
|
|
11
|
+
const { createDshPerformanceCollector, normalizePerformance } = require("./session-performance");
|
|
11
12
|
const {
|
|
12
13
|
isDshSessionLogName,
|
|
13
14
|
parseDshVersion,
|
|
@@ -101,6 +102,48 @@ function eventTimestampMs(entry) {
|
|
|
101
102
|
return Number.isFinite(time) && time >= MIN_DSH_TIMESTAMP_MS ? time : null;
|
|
102
103
|
}
|
|
103
104
|
|
|
105
|
+
function firstStreamTokenTime(stream) {
|
|
106
|
+
// DSH v4 stores raw chunks and packed delta runs together. Only non-empty
|
|
107
|
+
// deltas (or a name-bearing tool delta) mark a token; block-start does not.
|
|
108
|
+
for (const record of stream) {
|
|
109
|
+
if (record?.type === "chunk") {
|
|
110
|
+
const chunk = record.chunk;
|
|
111
|
+
const token = ["text-delta", "reasoning-delta"].includes(chunk?.type)
|
|
112
|
+
? typeof chunk.text === "string" && chunk.text.length > 0
|
|
113
|
+
: chunk?.type === "tool-call-delta" && (
|
|
114
|
+
(typeof chunk.argumentsDelta === "string" && chunk.argumentsDelta.length > 0)
|
|
115
|
+
|| (typeof chunk.name === "string" && chunk.name.length > 0));
|
|
116
|
+
const time = eventTimestampMs(record);
|
|
117
|
+
if (token && time !== null) return time;
|
|
118
|
+
} else if (["text-chunks", "reasoning-chunks", "tool-call-chunks"].includes(record?.type)) {
|
|
119
|
+
const tool = record.type === "tool-call-chunks";
|
|
120
|
+
const fragments = tool ? record.args : record.texts;
|
|
121
|
+
let time = eventTimestampMs({ time: record.time0 });
|
|
122
|
+
if (time === null || !Array.isArray(fragments)) continue;
|
|
123
|
+
for (let index = 0; index < fragments.length; index += 1) {
|
|
124
|
+
if (index > 0) {
|
|
125
|
+
const gap = record.dt?.[index - 1];
|
|
126
|
+
if (typeof gap !== "number" || !Number.isFinite(gap)) break;
|
|
127
|
+
time += gap;
|
|
128
|
+
}
|
|
129
|
+
if ((typeof fragments[index] === "string" && fragments[index].length > 0)
|
|
130
|
+
|| (tool && typeof record.name === "string" && record.name.length > 0)) return time;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function messageTiming(data, step, end) {
|
|
138
|
+
if (!step || step.failed || data?.interrupted || step.turn !== data?.turn || step.step !== data?.step) return null;
|
|
139
|
+
const stream = Array.isArray(data?.stream) ? data.stream : null;
|
|
140
|
+
if (stream) {
|
|
141
|
+
const finish = stream.findLast((record) => record?.type === "chunk" && record.chunk?.type === "finish");
|
|
142
|
+
if (!finish || !finish.chunk.reason?.kind || ["error", "aborted"].includes(finish.chunk.reason.kind)) return null;
|
|
143
|
+
}
|
|
144
|
+
return { start: step.ts, end, firstToken: stream ? firstStreamTokenTime(stream) : null };
|
|
145
|
+
}
|
|
146
|
+
|
|
104
147
|
function directoryEntryIs(entry, fullPath, kind) {
|
|
105
148
|
const check = kind === "dir" ? entry.isDirectory() : entry.isFile();
|
|
106
149
|
if (check) return true;
|
|
@@ -279,6 +322,7 @@ async function parseDshTranscript(filePath) {
|
|
|
279
322
|
events: [],
|
|
280
323
|
};
|
|
281
324
|
const lines = text.split("\n");
|
|
325
|
+
let openStep = null;
|
|
282
326
|
for (let index = 0; index < lines.length; index += 1) {
|
|
283
327
|
const line = lines[index];
|
|
284
328
|
if (!line) continue;
|
|
@@ -292,6 +336,33 @@ async function parseDshTranscript(filePath) {
|
|
|
292
336
|
const data = entry.data && typeof entry.data === "object" ? entry.data : null;
|
|
293
337
|
const seq = Number.isFinite(entry.seq) ? entry.seq : index;
|
|
294
338
|
switch (entry.type) {
|
|
339
|
+
case "step/start": {
|
|
340
|
+
openStep = Number.isInteger(data?.turn) && Number.isInteger(data?.step)
|
|
341
|
+
? { turn: data.turn, step: data.step, ts: eventTimestampMs(entry), failed: false } : null;
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
case "assistant/attempt":
|
|
345
|
+
case "assistant/chunk": {
|
|
346
|
+
// A retry's step time includes failed work/backoff, so it cannot be a
|
|
347
|
+
// clean request sample even if the eventual message reports usage.
|
|
348
|
+
// v4 records the failed try as assistant/attempt. v1 has no attempt
|
|
349
|
+
// event: the failed try ends as a top-level assistant/chunk whose
|
|
350
|
+
// chunk is a finish with an error or aborted reason.
|
|
351
|
+
const chunk = data?.chunk;
|
|
352
|
+
const failedFinish = entry.type === "assistant/chunk"
|
|
353
|
+
&& chunk?.type === "finish"
|
|
354
|
+
&& ["error", "aborted"].includes(chunk.reason?.kind);
|
|
355
|
+
if ((entry.type === "assistant/attempt" || failedFinish)
|
|
356
|
+
&& openStep && openStep.turn === data?.turn && openStep.step === data?.step) {
|
|
357
|
+
openStep.failed = true;
|
|
358
|
+
}
|
|
359
|
+
break;
|
|
360
|
+
}
|
|
361
|
+
case "step/end":
|
|
362
|
+
case "turn/start":
|
|
363
|
+
case "turn/end":
|
|
364
|
+
openStep = null;
|
|
365
|
+
break;
|
|
295
366
|
case "session": {
|
|
296
367
|
transcript.header = entry;
|
|
297
368
|
break;
|
|
@@ -329,6 +400,8 @@ async function parseDshTranscript(filePath) {
|
|
|
329
400
|
const ts = eventTimestampMs(entry);
|
|
330
401
|
const model = modelName(message?.source?.model) || transcript.fallbackModel || "unknown";
|
|
331
402
|
const delta = dshUsageDelta(data?.usage);
|
|
403
|
+
const timing = messageTiming(data, openStep, ts);
|
|
404
|
+
openStep = null;
|
|
332
405
|
if (delta) {
|
|
333
406
|
transcript.events.push({
|
|
334
407
|
kind: "usage",
|
|
@@ -336,6 +409,7 @@ async function parseDshTranscript(filePath) {
|
|
|
336
409
|
ts,
|
|
337
410
|
model,
|
|
338
411
|
delta,
|
|
412
|
+
timing,
|
|
339
413
|
});
|
|
340
414
|
}
|
|
341
415
|
break;
|
|
@@ -405,6 +479,7 @@ function buildRow(transcript, owners) {
|
|
|
405
479
|
const times = new Set();
|
|
406
480
|
const agentTypes = new Map();
|
|
407
481
|
const modelsForEdits = new Map();
|
|
482
|
+
const performanceCollector = createDshPerformanceCollector();
|
|
408
483
|
let turns = 0;
|
|
409
484
|
let edits = 0;
|
|
410
485
|
let retries = 0;
|
|
@@ -451,6 +526,9 @@ function buildRow(transcript, owners) {
|
|
|
451
526
|
addUsage(modelRow, delta);
|
|
452
527
|
modelRow.usage_events += 1;
|
|
453
528
|
modelUsage.set(model, modelRow);
|
|
529
|
+
if (event.timing) performanceCollector.consumeUsage({
|
|
530
|
+
model, outputTokens: delta.output_tokens + delta.reasoning_output_tokens, ...event.timing,
|
|
531
|
+
});
|
|
454
532
|
if (event.ts != null) {
|
|
455
533
|
const bucketTime = new Date(Math.floor(event.ts / 60000) * 60000).toISOString();
|
|
456
534
|
const key = `${model}\u0000${bucketTime}`;
|
|
@@ -478,9 +556,11 @@ function buildRow(transcript, owners) {
|
|
|
478
556
|
const gap = orderedTimes[index] - orderedTimes[index - 1];
|
|
479
557
|
if (gap > 0 && gap <= DSH_ACTIVE_GAP_MS) activeMs += gap;
|
|
480
558
|
}
|
|
559
|
+
const performance = performanceCollector.finish();
|
|
481
560
|
const models = [...modelUsage.values()].map((row) => ({
|
|
482
561
|
...row,
|
|
483
562
|
edit_turns: modelsForEdits.get(row.model) || 0,
|
|
563
|
+
performance: performance.byModel.get(row.model) || normalizePerformance(),
|
|
484
564
|
}));
|
|
485
565
|
// A session that only handshook (no user turn, no usage) has nothing to say.
|
|
486
566
|
if (!tokens.total_tokens && !turns) return null;
|
|
@@ -507,6 +587,7 @@ function buildRow(transcript, owners) {
|
|
|
507
587
|
started_at: orderedTimes.length ? new Date(orderedTimes[0]).toISOString() : null,
|
|
508
588
|
ended_at: orderedTimes.length ? new Date(orderedTimes.at(-1)).toISOString() : null,
|
|
509
589
|
active_ms: activeMs,
|
|
590
|
+
performance: performance.performance,
|
|
510
591
|
provenance: {
|
|
511
592
|
source: "local-session-log",
|
|
512
593
|
confidence: "observed",
|
|
@@ -47,12 +47,61 @@
|
|
|
47
47
|
"cache_write": 0,
|
|
48
48
|
"note": "Cline's own gateway namespaces (`cline-free/*` free tier, `cline-pass/*` flat-rate Cline Pass). Cline's shipped model catalog declares pricing 0 for every id in both namespaces, so a turn there has no marginal per-token cost — same convention as PI_SUBSCRIPTION_SOURCES. The fuzzy entries at the top of `fuzzy` route both prefixes here BEFORE the model names can match a public rate (`cline-pass/glm-5.3` must not bill GLM-5.3 list price, `cline-free/deepseek-v4.1-flash` must not bill DeepSeek). Verified against Cline 0.0.32 (/Applications/Cline.app model catalog + `usageDelta` cost, which stays 0 for both namespaces). A Cline turn that DOES report a positive per-call cost is honoured first because `cline` is listed in SOURCES_WITH_AUTHORITATIVE_COST in pricing/index.js. Remove or re-point these entries when Cline publishes per-token pricing for either namespace."
|
|
49
49
|
},
|
|
50
|
+
"claude-fable-5-2": {
|
|
51
|
+
"input": 8,
|
|
52
|
+
"output": 40,
|
|
53
|
+
"cache_read": 0.2,
|
|
54
|
+
"cache_write": 10,
|
|
55
|
+
"note": "Claude Fable 5.2 standard tier, verified 2026-11-10: https://platform.claude.com/docs/en/about-claude/pricing and https://platform.claude.com/docs/en/models/fable-5-2/overview. $8 / $40 per MTok input/output. cache_read is the published cache-hit rate ($0.20 / MTok, 0.025x base input \u2014 not the usual 0.1x). cache_write is the published 5-minute cache-write rate ($10 / MTok, 1.25x); the 1-hour write is $16 / MTok and cannot fit this single field. Channel prefixes (anthropic/, bedrock/, vertex_ai/, azure_ai/, openrouter/, github_copilot/, \u2026) do not change the rate. Fast mode is a separate SKU at $16/$80 \u2014 see claude-fable-5-2-fast. Floating -latest aliases are NOT pinned here."
|
|
56
|
+
},
|
|
57
|
+
"claude-fable-5.2": {
|
|
58
|
+
"input": 8,
|
|
59
|
+
"output": 40,
|
|
60
|
+
"cache_read": 0.2,
|
|
61
|
+
"cache_write": 10,
|
|
62
|
+
"note": "Dotted spelling of claude-fable-5-2 (OpenRouter anthropic/claude-fable-5.2, github_copilot/claude-fable-5.2). Same standard-tier rates, verified 2026-11-10: https://platform.claude.com/docs/en/about-claude/pricing. Its own exact key because normalizeClaudeModel only hyphenates sonnet/opus/haiku, so a dotted fable id never reaches claude-fable-5-2."
|
|
63
|
+
},
|
|
64
|
+
"anthropic/claude-fable-5.2": {
|
|
65
|
+
"input": 8,
|
|
66
|
+
"output": 40,
|
|
67
|
+
"cache_read": 0.2,
|
|
68
|
+
"cache_write": 10,
|
|
69
|
+
"note": "OpenRouter id for Claude Fable 5.2 (https://openrouter.ai/anthropic/claude-fable-5.2). Same standard-tier rates as claude-fable-5-2, verified 2026-11-10. Kept exact so a lookup without the claude source normalizer (which is what strips provider prefixes) still hits."
|
|
70
|
+
},
|
|
71
|
+
"anthropic/claude-fable-5.2-20261109": {
|
|
72
|
+
"input": 8,
|
|
73
|
+
"output": 40,
|
|
74
|
+
"cache_read": 0.2,
|
|
75
|
+
"cache_write": 10,
|
|
76
|
+
"note": "OpenRouter dated snapshot of anthropic/claude-fable-5.2 (canonical_slug anthropic/claude-fable-5.2-20261109, released 2026-11-09). Same standard-tier rates, verified 2026-11-10: https://platform.claude.com/docs/en/about-claude/pricing. The Anthropic model page itself publishes no dated snapshot id."
|
|
77
|
+
},
|
|
78
|
+
"anthropic/claude-fable-5-2": {
|
|
79
|
+
"input": 8,
|
|
80
|
+
"output": 40,
|
|
81
|
+
"cache_read": 0.2,
|
|
82
|
+
"cache_write": 10,
|
|
83
|
+
"note": "Hyphenated provider-qualified id for Claude Fable 5.2 (models.dev anthropic/claude-fable-5-2). Same standard-tier rates, verified 2026-11-10. Channel prefix does not change billing."
|
|
84
|
+
},
|
|
85
|
+
"claude-fable-5-2-fast": {
|
|
86
|
+
"input": 16,
|
|
87
|
+
"output": 80,
|
|
88
|
+
"cache_read": 0.4,
|
|
89
|
+
"cache_write": 20,
|
|
90
|
+
"note": "Claude Fable 5.2 fast mode, a separate SKU (Foundry deployment id claude-fable-5-2-fast; also speed=fast on the Claude API). Input/output are the published fast rates, 2x standard: $16 / $80 per MTok, verified 2026-11-10 at https://platform.claude.com/docs/en/about-claude/pricing and https://platform.claude.com/docs/en/build-with-claude/fast-mode. Those pages publish no fast-mode cache dollar amounts; they say prompt-caching multipliers apply on top of fast-mode pricing, so cache_read/cache_write use the same Fable 5.2 multipliers as the standard tier (0.025x \u2192 $0.40, 5-minute 1.25x \u2192 $20) rather than a published fast cache price. The 1-hour fast write (2x \u2192 $32) cannot fit this single field. Do not bill this id at the $8/$40 standard rate."
|
|
91
|
+
},
|
|
92
|
+
"claude-fable-5.2-fast": {
|
|
93
|
+
"input": 16,
|
|
94
|
+
"output": 80,
|
|
95
|
+
"cache_read": 0.4,
|
|
96
|
+
"cache_write": 20,
|
|
97
|
+
"note": "Dotted spelling of claude-fable-5-2-fast (vercel/anthropic/claude-fable-5.2-fast, anthropic/claude-fable-5.2-fast). Same fast-mode rates as claude-fable-5-2-fast, verified 2026-11-10. Its own exact key because the dotted form is not rewritten to the hyphenated one."
|
|
98
|
+
},
|
|
50
99
|
"claude-fable-5": {
|
|
51
100
|
"input": 10,
|
|
52
101
|
"output": 50,
|
|
53
102
|
"cache_read": 1,
|
|
54
103
|
"cache_write": 12.5,
|
|
55
|
-
"note": "Fable 5 \u2014 Anthropic's top tier above Opus. Not yet in LiteLLM. $10/$50 per MTok; cache_read 0.1x, cache_write 1.25x. Remove once LiteLLM carries it."
|
|
104
|
+
"note": "Fable 5 \u2014 Anthropic's top tier above Opus. Not yet in LiteLLM. $10/$50 per MTok; cache_read 0.1x, cache_write 1.25x. Remove once LiteLLM carries it. Fable 5.2 is a cheaper separate SKU \u2014 see claude-fable-5-2."
|
|
56
105
|
},
|
|
57
106
|
"claude-opus-5": {
|
|
58
107
|
"input": 5,
|
|
@@ -935,6 +984,22 @@
|
|
|
935
984
|
"match": "haiku-5.5",
|
|
936
985
|
"ref": "claude-haiku-5.5"
|
|
937
986
|
},
|
|
987
|
+
{
|
|
988
|
+
"match": "fable-5-2-fast",
|
|
989
|
+
"ref": "claude-fable-5-2-fast"
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
"match": "fable-5.2-fast",
|
|
993
|
+
"ref": "claude-fable-5.2-fast"
|
|
994
|
+
},
|
|
995
|
+
{
|
|
996
|
+
"match": "fable-5-2",
|
|
997
|
+
"ref": "claude-fable-5-2"
|
|
998
|
+
},
|
|
999
|
+
{
|
|
1000
|
+
"match": "fable-5.2",
|
|
1001
|
+
"ref": "claude-fable-5.2"
|
|
1002
|
+
},
|
|
938
1003
|
{
|
|
939
1004
|
"match": "claude-opus-5-fast",
|
|
940
1005
|
"ref": "claude-opus-5-fast"
|
|
@@ -104,8 +104,8 @@ function normalizeClaudeModel(model) {
|
|
|
104
104
|
.replace(/^-+|-+$/g, "")
|
|
105
105
|
.replace(/-{2,}/g, "-");
|
|
106
106
|
|
|
107
|
-
if (/^claude-(sonnet|opus|haiku)-\d+\.\d+/.test(m)) {
|
|
108
|
-
return m.replace(/^(claude-(?:sonnet|opus|haiku)-\d+)\.(\d+)/, "$1-$2");
|
|
107
|
+
if (/^claude-(sonnet|opus|haiku|fable)-\d+\.\d+/.test(m)) {
|
|
108
|
+
return m.replace(/^(claude-(?:sonnet|opus|haiku|fable)-\d+)\.(\d+)/, "$1-$2");
|
|
109
109
|
}
|
|
110
110
|
if (/^(sonnet|opus|haiku)-\d+[.-]\d+/.test(m)) {
|
|
111
111
|
return m
|
|
@@ -345,6 +345,17 @@ function lookupPricing(model, { curated, litellm, source } = {}) {
|
|
|
345
345
|
};
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
+
// Floating Fable aliases (`claude-fable-latest` and every provider's
|
|
349
|
+
// `…/claude-fable-latest`) retarget on each release. Checked 2026-11-10: the
|
|
350
|
+
// Anthropic model overview and the Fable 5.2 pages do not document the alias,
|
|
351
|
+
// so nothing pins it to 5.2. Stop here, after exact lookups, so the
|
|
352
|
+
// fable-5.2 fuzzy needles and the broad fable matcher cannot price it, but
|
|
353
|
+
// an explicit exact entry added later still wins. Re-check on the next
|
|
354
|
+
// Fable release before pointing it anywhere.
|
|
355
|
+
if (/(?:^|\/)claude-fable-latest(?:$|[^a-z0-9])/.test(lower)) {
|
|
356
|
+
return { hit: false, source: "miss", value: null };
|
|
357
|
+
}
|
|
358
|
+
|
|
348
359
|
// Kimi Code K2.8 Preview aliases must not inherit fuzzy `kimi` → kimi-k2.5 rates (#766).
|
|
349
360
|
// Parser stores bare `k2.8`; raw `kimicoding` / `kimi-k2.8` / `kimicoding/k2.8` may still
|
|
350
361
|
// appear in lookups. `kimi-for-coding` keeps its curated exact entry (resolved above).
|
|
@@ -382,10 +393,25 @@ function lookupPricing(model, { curated, litellm, source } = {}) {
|
|
|
382
393
|
if (!match || !ref) continue;
|
|
383
394
|
const needle = match.toLowerCase();
|
|
384
395
|
if (!curated.exact[ref]) continue;
|
|
385
|
-
|
|
396
|
+
// The Fable 5.2 needles are version-bounded. A plain substring lets the
|
|
397
|
+
// dot-restored form of a dated Fable 5 id through: claude-fable-5-20250901
|
|
398
|
+
// becomes claude-fable-5.20250901, which contains "fable-5.2". fable-5-20
|
|
399
|
+
// contains "fable-5-2" the same way. The minor must end the id or be
|
|
400
|
+
// followed by a non-digit, so -20261109 and -20 stay off the 5.2 rate.
|
|
401
|
+
const bounded = /^fable-5[.-]2(?:-fast)?$/.test(needle)
|
|
402
|
+
? new RegExp(`${needle.replace(".", "\\.")}(?:$|[^0-9])`)
|
|
403
|
+
: null;
|
|
404
|
+
const matches = (value) => (bounded ? bounded.test(value) : value.includes(needle));
|
|
405
|
+
if (matches(lower)) {
|
|
406
|
+
return { hit: true, source: "curated:fuzzy", value: curated.exact[ref] };
|
|
407
|
+
}
|
|
408
|
+
if (dotForm && matches(dotForm)) {
|
|
386
409
|
return { hit: true, source: "curated:fuzzy", value: curated.exact[ref] };
|
|
387
410
|
}
|
|
388
|
-
|
|
411
|
+
// Display names ("Claude Fable 5.2", "Fable 5.2 Fast") only reach this
|
|
412
|
+
// scan when no source normalizer ran. Fold spaces for the pinned 5.2
|
|
413
|
+
// needles only — a general fold would price unrelated display names.
|
|
414
|
+
if (bounded && bounded.test(lower.replace(/[^a-z0-9.]+/g, "-"))) {
|
|
389
415
|
return { hit: true, source: "curated:fuzzy", value: curated.exact[ref] };
|
|
390
416
|
}
|
|
391
417
|
}
|