@trazum/core 1.81.0 → 1.83.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.
Files changed (84) hide show
  1. package/README.md +34 -18
  2. package/dist/advisories.d.ts +33 -1
  3. package/dist/advisories.d.ts.map +1 -1
  4. package/dist/advisories.js +130 -20
  5. package/dist/advisories.js.map +1 -1
  6. package/dist/band.d.ts +131 -0
  7. package/dist/band.d.ts.map +1 -0
  8. package/dist/band.js +210 -0
  9. package/dist/band.js.map +1 -0
  10. package/dist/conform.d.ts +1 -1
  11. package/dist/conform.d.ts.map +1 -1
  12. package/dist/conform.js +84 -1
  13. package/dist/conform.js.map +1 -1
  14. package/dist/helicone.d.ts +92 -0
  15. package/dist/helicone.d.ts.map +1 -0
  16. package/dist/helicone.js +194 -0
  17. package/dist/helicone.js.map +1 -0
  18. package/dist/i18n/en.d.ts.map +1 -1
  19. package/dist/i18n/en.js +16 -3
  20. package/dist/i18n/en.js.map +1 -1
  21. package/dist/i18n/es.d.ts.map +1 -1
  22. package/dist/i18n/es.js +17 -3
  23. package/dist/i18n/es.js.map +1 -1
  24. package/dist/i18n/types.d.ts +60 -1
  25. package/dist/i18n/types.d.ts.map +1 -1
  26. package/dist/index.d.ts +16 -3
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +9 -3
  29. package/dist/index.js.map +1 -1
  30. package/dist/langsmith.d.ts +104 -0
  31. package/dist/langsmith.d.ts.map +1 -0
  32. package/dist/langsmith.js +270 -0
  33. package/dist/langsmith.js.map +1 -0
  34. package/dist/levers.d.ts +1 -1
  35. package/dist/levers.js +2 -2
  36. package/dist/levers.js.map +1 -1
  37. package/dist/litellm.d.ts +98 -0
  38. package/dist/litellm.d.ts.map +1 -0
  39. package/dist/litellm.js +207 -0
  40. package/dist/litellm.js.map +1 -0
  41. package/dist/measured-profile.d.ts +4 -0
  42. package/dist/measured-profile.d.ts.map +1 -1
  43. package/dist/measured-profile.js +22 -1
  44. package/dist/measured-profile.js.map +1 -1
  45. package/dist/pricing.d.ts +98 -3
  46. package/dist/pricing.d.ts.map +1 -1
  47. package/dist/pricing.js +393 -35
  48. package/dist/pricing.js.map +1 -1
  49. package/dist/receipt.d.ts +253 -0
  50. package/dist/receipt.d.ts.map +1 -0
  51. package/dist/receipt.js +111 -0
  52. package/dist/receipt.js.map +1 -0
  53. package/dist/schemas.d.ts.map +1 -1
  54. package/dist/schemas.js +36 -0
  55. package/dist/schemas.js.map +1 -1
  56. package/dist/tokenizer.d.ts +45 -49
  57. package/dist/tokenizer.d.ts.map +1 -1
  58. package/dist/tokenizer.js +100 -51
  59. package/dist/tokenizer.js.map +1 -1
  60. package/dist/types.d.ts +108 -1
  61. package/dist/types.d.ts.map +1 -1
  62. package/dist/verdict-bridge.d.ts +113 -0
  63. package/dist/verdict-bridge.d.ts.map +1 -0
  64. package/dist/verdict-bridge.js +127 -0
  65. package/dist/verdict-bridge.js.map +1 -0
  66. package/package.json +1 -1
  67. package/src/advisories.ts +166 -19
  68. package/src/band.ts +213 -0
  69. package/src/conform.ts +100 -1
  70. package/src/helicone.ts +227 -0
  71. package/src/i18n/en.ts +19 -3
  72. package/src/i18n/es.ts +20 -3
  73. package/src/i18n/types.ts +63 -1
  74. package/src/index.ts +31 -2
  75. package/src/langsmith.ts +315 -0
  76. package/src/levers.ts +3 -3
  77. package/src/litellm.ts +243 -0
  78. package/src/measured-profile.ts +26 -2
  79. package/src/pricing.ts +430 -30
  80. package/src/receipt.ts +351 -0
  81. package/src/schemas.ts +36 -0
  82. package/src/tokenizer.ts +101 -51
  83. package/src/types.ts +104 -0
  84. package/src/verdict-bridge.ts +200 -0
package/README.md CHANGED
@@ -291,31 +291,47 @@ const refined = await refineWithLlm(result, openAiCompatible({
291
291
  ## Token counts
292
292
 
293
293
  The bundled estimator is a dependency-free heuristic, and it compares two versions
294
- of the same prompt well — which is what it is for. Its error band is **±10%**,
295
- exported as `ESTIMATE_ERROR_BAND_PCT` so you can print the same number the report
296
- prints rather than hard-coding it.
297
-
298
- That band is measured, against the official counting endpoint, over 21 samples in
299
- seven languages and six text types. **The worst error in the corpus is 6.4%** and
300
- the published band is 10 — the margin is deliberate, because 21 samples across six
301
- types cannot bound a seventh, and a band that becomes false the first time somebody
302
- measures something new is the fault this whole exercise was fixing.
303
-
304
- It was an unchecked design target for eight releases and it was false; the 1.9.0
305
- entry in the changelog says what was wrong.
294
+ of the same prompt well — which is what it is for. Its error band is **measured
295
+ per kind of text**, because one band for all text was a measurement of its own
296
+ calibration set rather than of the estimator:
297
+
298
+ | Kind of text | Band | Worst sample | Samples |
299
+ | --- | --- | --- | --- |
300
+ | CJK, all three scripts | ±4% | 3.2% | 6 |
301
+ | Latin prose and few-shot blocks | ±6% | 5.6% | 18 |
302
+ | Code, markup and quoting | ±26% | 25.1% | 16 |
303
+ | Digit-dominant tables and ledgers | ±33% | 32.5% | 7 |
304
+
305
+ Call `bandFor(text)` to get the band for a specific prompt. `ESTIMATE_ERROR_BAND_PCT`
306
+ is still exported and is the widest of the four, for callers that have to print one
307
+ figure without holding the text.
308
+
309
+ That band is measured, against the official counting endpoint, over 47 samples in
310
+ ten languages and 6 text types. The margin between each bucket and its own worst
311
+ sample is a point or less, and no bucket is allowed to overlap the next: a sample
312
+ sorted into a friendlier bucket gets a smaller band and fails the test.
313
+
314
+ The single band of 10% this replaced was an unchecked design target for eight
315
+ releases and it was false; the 1.9.0 entry in the changelog says what was wrong, and the 1.82.0
316
+ entry says what extending the corpus from 21 samples to 47 found.
306
317
 
307
318
  Three things follow from how it was measured, and they matter if you depend on the
308
319
  number:
309
320
 
310
- - **The band is a Claude number.** The estimator is tuned against Claude's
311
- tokenizer. Other families tokenize differently and nothing here bounds the error
312
- for them.
321
+ - **The band is a Claude number, and the others are far outside it.** The same 47
322
+ samples measured against DeepSeek's own counter came out **94.5% wrong** at
323
+ worst, and against Mistral's **103.1%** — Trazum prices 7 providers and the
324
+ band belongs to one. `foreignTokenizer` answers with the provider id whenever
325
+ the model is not Anthropic's, and the report says so on the line rather than
326
+ printing a figure that was measured somewhere else.
313
327
  - **It detects the language and divides accordingly**, because one divisor
314
328
  calibrated on English measured −37.3% on German. `detectTextLanguage` answers
315
329
  `null` when it cannot tell, which falls back to the English behaviour.
316
- - **Kana and han cost different amounts.** Charging one token per CJK character put
317
- Japanese at +11.2% and Chinese at −3.2% under the same rule; kana measure 0.75
318
- tokens per character and han 1.05, which takes both inside 1.5%.
330
+ - **Kana, han and hangul cost different amounts.** Charging one token per CJK
331
+ character put Japanese at +11.2% and Chinese at −3.2%; kana measure 0.75 tokens
332
+ per character, han 1.05 and hangul 1.35. Hangul had been carrying a placeholder
333
+ nothing measured until two Korean samples agreed in lockstep on 1.35, which took
334
+ the CJK bucket's worst error from 10.6% to 3.2%.
319
335
 
320
336
  For exact figures, pass a real counter — the counting endpoint is free:
321
337
 
@@ -1,13 +1,45 @@
1
1
  import type { Locale } from './i18n/types.js';
2
2
  import type { PricingCatalogue } from './pricing.js';
3
3
  import type { Advisory, ModelPricing, TokenCounter, UsageProfile } from './types.js';
4
+ /** What `recommendTierDetailed` saw, not only what it concluded. */
5
+ export interface TierRecommendation {
6
+ tier: ModelPricing['tier'];
7
+ complexSignals: number;
8
+ simpleSignals: number;
9
+ /**
10
+ * True when the prompt asks for depth and for brevity at once, and the
11
+ * heuristic has no business preferring either.
12
+ *
13
+ * The score subtracts one side from the other, so three complex signals
14
+ * against three simple ones cancels to zero and returns `sonnet` — the same
15
+ * answer as a prompt with **no signals at all**. Those are opposite
16
+ * situations reported identically: one is "nothing here suggests a tier", the
17
+ * other is "this prompt contradicts itself about which tier it needs", and
18
+ * only the second is worth telling somebody about.
19
+ *
20
+ * The threshold is a lead of one signal or fewer, and it comes from the
21
+ * weights above rather than from taste: each signal moves the score by 2,
22
+ * prompt size moves it by up to 2, so a one-signal lead is inside what
23
+ * length alone contributes. A lead of two or more is a majority the size
24
+ * term cannot manufacture.
25
+ */
26
+ conflicted: boolean;
27
+ }
4
28
  /**
5
- * Estimates the capability tier the prompt needs.
29
+ * Estimates the capability tier the prompt needs, and says what it saw.
6
30
  *
7
31
  * This is a keyword-and-size heuristic, not a judgement about answer quality.
8
32
  * Treat it as a hypothesis to validate with your own evaluations before
9
33
  * moving down a tier in production.
10
34
  */
35
+ export declare function recommendTierDetailed(prompt: string, tokens: number): TierRecommendation;
36
+ /**
37
+ * The tier alone, unchanged.
38
+ *
39
+ * Kept because it is public API and the 1.x line does not change shapes.
40
+ * Callers that need to know whether the answer is trustworthy reach for
41
+ * `recommendTierDetailed`.
42
+ */
11
43
  export declare function recommendTier(prompt: string, tokens: number): ModelPricing['tier'];
12
44
  export interface AdvisoryOptions {
13
45
  /** Reference date, used to decide whether a promotional price is live. */
@@ -1 +1 @@
1
- {"version":3,"file":"advisories.d.ts","sourceRoot":"","sources":["../src/advisories.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAG9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKrD,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAQrF;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAclF;AAsDD,MAAM,WAAW,eAAe;IAC9B,0EAA0E;IAC1E,EAAE,CAAC,EAAE,IAAI,CAAC;IACV,wEAAwE;IACxE,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED,gFAAgF;AAChF,wBAAgB,eAAe,CAC7B,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,YAAY,EACnB,OAAO,GAAE,eAAoB,GAC5B,QAAQ,EAAE,CA8bZ"}
1
+ {"version":3,"file":"advisories.d.ts","sourceRoot":"","sources":["../src/advisories.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAS9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAMrD,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAQrF,oEAAoE;AACpE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB;;;;;;;;;;;;;;;;OAgBG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,kBAAkB,CAoBxF;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAElF;AAuDD,MAAM,WAAW,eAAe;IAC9B,0EAA0E;IAC1E,EAAE,CAAC,EAAE,IAAI,CAAC;IACV,wEAAwE;IACxE,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED,gFAAgF;AAChF,wBAAgB,eAAe,CAC7B,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,YAAY,EACnB,OAAO,GAAE,eAAoB,GAC5B,QAAQ,EAAE,CA+hBZ"}
@@ -1,10 +1,11 @@
1
1
  import { analyzeCachePrefix } from './cache.js';
2
2
  import { getMessages } from './i18n/index.js';
3
3
  import { COMPLEX_SIGNALS, SIMPLE_SIGNALS } from './phrases.js';
4
- import { BUNDLED_CATALOGUE, effectivePricing, modelFrom, multipliersFor } from './pricing.js';
4
+ import { BUNDLED_CATALOGUE, effectivePricing, isOffered, modelFrom, multipliersFor, } from './pricing.js';
5
5
  import { formatUsd } from './savings.js';
6
6
  import { analyzeExamples, findContradictions, findMovableSchema, findRestatedFormat } from './structure.js';
7
- import { ESTIMATE_ERROR_BAND_PCT, bandGoverns, estimateTokens } from './tokenizer.js';
7
+ import { bandGoverns, estimateTokens } from './tokenizer.js';
8
+ import { bandFor } from './band.js';
8
9
  function countSignals(haystack, signals) {
9
10
  let count = 0;
10
11
  for (const signal of signals)
@@ -13,15 +14,17 @@ function countSignals(haystack, signals) {
13
14
  return count;
14
15
  }
15
16
  /**
16
- * Estimates the capability tier the prompt needs.
17
+ * Estimates the capability tier the prompt needs, and says what it saw.
17
18
  *
18
19
  * This is a keyword-and-size heuristic, not a judgement about answer quality.
19
20
  * Treat it as a hypothesis to validate with your own evaluations before
20
21
  * moving down a tier in production.
21
22
  */
22
- export function recommendTier(prompt, tokens) {
23
+ export function recommendTierDetailed(prompt, tokens) {
23
24
  const haystack = prompt.toLowerCase();
24
- let score = countSignals(haystack, COMPLEX_SIGNALS) * 2 - countSignals(haystack, SIMPLE_SIGNALS) * 2;
25
+ const complexSignals = countSignals(haystack, COMPLEX_SIGNALS);
26
+ const simpleSignals = countSignals(haystack, SIMPLE_SIGNALS);
27
+ let score = complexSignals * 2 - simpleSignals * 2;
25
28
  if (tokens > 4000)
26
29
  score += 2;
27
30
  else if (tokens > 1500)
@@ -30,11 +33,23 @@ export function recommendTier(prompt, tokens) {
30
33
  score -= 1;
31
34
  if (/```|~~~/.test(prompt))
32
35
  score += 1;
33
- if (score >= 3)
34
- return 'opus';
35
- if (score >= 0)
36
- return 'sonnet';
37
- return 'haiku';
36
+ const tier = score >= 3 ? 'opus' : score >= 0 ? 'sonnet' : 'haiku';
37
+ return {
38
+ tier,
39
+ complexSignals,
40
+ simpleSignals,
41
+ conflicted: complexSignals > 0 && simpleSignals > 0 && Math.abs(complexSignals - simpleSignals) <= 1,
42
+ };
43
+ }
44
+ /**
45
+ * The tier alone, unchanged.
46
+ *
47
+ * Kept because it is public API and the 1.x line does not change shapes.
48
+ * Callers that need to know whether the answer is trustworthy reach for
49
+ * `recommendTierDetailed`.
50
+ */
51
+ export function recommendTier(prompt, tokens) {
52
+ return recommendTierDetailed(prompt, tokens).tier;
38
53
  }
39
54
  const TIER_ORDER = {
40
55
  /**
@@ -70,9 +85,10 @@ const TIER_ORDER = {
70
85
  function cheapestInTier(tier, on, pricing, provider) {
71
86
  const candidates = pricing.models.filter((m) => m.tier === tier &&
72
87
  m.provider === provider &&
73
- // Not generally available: recommending a model the reader cannot call is
74
- // worse than recommending nothing.
75
- m.recommendable !== false);
88
+ // Not generally available, or refused outright by the provider:
89
+ // recommending a model the reader cannot call is worse than
90
+ // recommending nothing. Both halves live in `isOffered`.
91
+ isOffered(m));
76
92
  if (candidates.length === 0)
77
93
  return undefined;
78
94
  return candidates.reduce((best, m) => effectivePricing(m, on).inputPerMTok < effectivePricing(best, on).inputPerMTok ? m : best);
@@ -108,7 +124,18 @@ export function buildAdvisories(optimizedPrompt, tokensAfter, usage, options = {
108
124
  * outright rather than degrading, so there is no partial result to notice.
109
125
  */
110
126
  const estimated = count === estimateTokens;
111
- const band = ESTIMATE_ERROR_BAND_PCT / 100;
127
+ /**
128
+ * The band of **this prompt**, not one number for all text.
129
+ *
130
+ * These three hedges — the context window, the cache minimum both ways — are
131
+ * the places an estimate is compared against a hard threshold and the answer
132
+ * stated as fact, so the width of the hedge decides whether the statement is
133
+ * safe. A single 10% was measured on a corpus of thirteen prose files and one
134
+ * each of code, numeric and punctuation, and the estimator is 25% out on a
135
+ * SQL migration and 33% out on a CSV ledger. Hedging a code prompt by ten
136
+ * points was hedging by a third of what it needed.
137
+ */
138
+ const band = bandFor(optimizedPrompt) / 100;
112
139
  /**
113
140
  * Whether that band describes **this** model's tokenizer.
114
141
  *
@@ -214,16 +241,36 @@ export function buildAdvisories(optimizedPrompt, tokensAfter, usage, options = {
214
241
  * they have already done.
215
242
  */
216
243
  nearMinimum: count === estimateTokens &&
217
- cache.stablePrefixTokens * (1 - ESTIMATE_ERROR_BAND_PCT / 100) < minTokens,
244
+ cache.stablePrefixTokens * (1 - band) < minTokens,
218
245
  }),
219
246
  estimatedMonthlyUsd: saving,
220
247
  });
221
248
  }
222
249
  else {
250
+ /**
251
+ * The threshold is derived from this model's own multipliers, not
252
+ * quoted.
253
+ *
254
+ * Break-even is where a cached token costs exactly what an uncached one
255
+ * does: `h*read + (1-h)*write = 1`, so `h = (1 - write) / (read -
256
+ * write)`. At Anthropic's 1.25 and 0.1 that is 21.74%, and the sentence
257
+ * this replaces said 28% for every model in the catalogue.
258
+ *
259
+ * A write multiplier of 1 has no such threshold. Writing then costs
260
+ * exactly what not caching costs, so caching cannot lose money at any
261
+ * hit rate, and `(1 - 1) / (r - 1)` is 0 rather than a small number.
262
+ * Eight of the eighteen models are that shape, and the fixed sentence
263
+ * advised all eight to consider turning caching off.
264
+ */
265
+ const write = rates.cacheWrite5m;
223
266
  advisories.push({
224
267
  id: 'prompt-caching-not-worth-it',
225
268
  severity: 'info',
226
- ...t.advisories.promptCachingNotWorthIt(),
269
+ ...t.advisories.promptCachingNotWorthIt({
270
+ readPct: Math.round(rates.cacheRead * 100),
271
+ writePct: Math.round(write * 100),
272
+ breakEvenPct: write <= 1 ? null : Math.round(((1 - write) / (rates.cacheRead - write)) * 1000) / 10,
273
+ }),
227
274
  estimatedMonthlyUsd: null,
228
275
  });
229
276
  }
@@ -248,7 +295,7 @@ export function buildAdvisories(optimizedPrompt, tokensAfter, usage, options = {
248
295
  * is its own kind of dishonesty.
249
296
  */
250
297
  couldReachMinimum: count === estimateTokens &&
251
- cache.stablePrefixTokens * (1 + ESTIMATE_ERROR_BAND_PCT / 100) >= minTokens,
298
+ cache.stablePrefixTokens * (1 + band) >= minTokens,
252
299
  }),
253
300
  estimatedMonthlyUsd: null,
254
301
  });
@@ -329,7 +376,33 @@ export function buildAdvisories(optimizedPrompt, tokensAfter, usage, options = {
329
376
  });
330
377
  }
331
378
  // --- Recommended model ---
332
- const suggestedTier = recommendTier(optimizedPrompt, tokensAfter);
379
+ const recommendation = recommendTierDetailed(optimizedPrompt, tokensAfter);
380
+ const suggestedTier = recommendation.tier;
381
+ /**
382
+ * When the prompt argues with itself about which tier it needs, say so and
383
+ * recommend nothing.
384
+ *
385
+ * The score subtracts one side from the other, so a prompt demanding depth
386
+ * and brevity in equal measure cancels to zero and lands on `sonnet` — the
387
+ * identical answer to a prompt with no signals at all. Reporting two opposite
388
+ * situations with one number is the failure; the fix is not a better score,
389
+ * it is declining to pretend there is one.
390
+ *
391
+ * This returns before the downgrade block rather than alongside it, because a
392
+ * saving computed from a tier the heuristic cannot stand behind is a figure
393
+ * with a dollar sign on it and nothing underneath.
394
+ */
395
+ if (recommendation.conflicted) {
396
+ advisories.push({
397
+ id: 'tier-signals-conflict',
398
+ severity: 'info',
399
+ ...t.advisories.tierSignalsConflict({
400
+ complexSignals: recommendation.complexSignals,
401
+ simpleSignals: recommendation.simpleSignals,
402
+ }),
403
+ estimatedMonthlyUsd: null,
404
+ });
405
+ }
333
406
  /**
334
407
  * A model whose capability nobody recorded is never told it is overpowered.
335
408
  *
@@ -347,14 +420,29 @@ export function buildAdvisories(optimizedPrompt, tokensAfter, usage, options = {
347
420
  * and a condition that forgets it both have to happen before a model of
348
421
  * unrecorded capability is told it is overpowered.
349
422
  */
350
- if (model.tier !== 'unknown' && TIER_ORDER[suggestedTier] < TIER_ORDER[model.tier]) {
423
+ if (!recommendation.conflicted && model.tier !== 'unknown' && TIER_ORDER[suggestedTier] < TIER_ORDER[model.tier]) {
351
424
  const candidate = cheapestInTier(suggestedTier, on, pricing, model.provider);
352
425
  if (candidate) {
353
426
  const candidatePricing = effectivePricing(candidate, on);
427
+ /**
428
+ * The candidate's own batch multiplier, not a constant.
429
+ *
430
+ * This line read `usage.batchEligible ? 0.5 : 1`, while the current
431
+ * model's cost twenty lines above already used `rates.batch ?? 1` for
432
+ * exactly the reason stated there: a discount that is not per model is an
433
+ * invented saving rather than an imprecise one.
434
+ *
435
+ * Three models in the catalogue carry `batch: null` — kimi-k2,
436
+ * deepseek-v3 and grok-4 — which means no batch API at all. Halving their
437
+ * cost offered money that cannot be bought at any price, made the
438
+ * downgrade look twice as good as it is, and could turn a saving that was
439
+ * negative into one this advisory reports.
440
+ */
441
+ const candidateBatch = usage.batchEligible ? (multipliersFor(candidate).batch ?? 1) : 1;
354
442
  const candidateMonthly = ((tokensAfter / 1_000_000) * candidatePricing.inputPerMTok +
355
443
  (usage.avgOutputTokens / 1_000_000) * candidatePricing.outputPerMTok) *
356
444
  usage.callsPerMonth *
357
- (usage.batchEligible ? 0.5 : 1);
445
+ candidateBatch;
358
446
  const saving = monthlyInputUsd + monthlyOutputUsd - candidateMonthly;
359
447
  if (saving > 0) {
360
448
  advisories.push({
@@ -467,6 +555,28 @@ export function buildAdvisories(optimizedPrompt, tokensAfter, usage, options = {
467
555
  estimatedMonthlyUsd: saving > 0 ? saving : null,
468
556
  });
469
557
  }
558
+ if (model.retired) {
559
+ /**
560
+ * The most severe thing this function can say about a model, and it is
561
+ * placed before the promotional note deliberately: a price that is about to
562
+ * change matters less than a model that cannot be called at all.
563
+ *
564
+ * Not suppressed when the reader asked for this model by name. They asked
565
+ * because something in their world still says this id, and the whole value
566
+ * of the answer is that it no longer works.
567
+ */
568
+ advisories.push({
569
+ id: 'model-retired',
570
+ severity: 'warning',
571
+ ...t.advisories.modelRetired({
572
+ modelName: model.displayName,
573
+ modelId: model.id,
574
+ on: model.retired.on,
575
+ because: model.retired.because,
576
+ }),
577
+ estimatedMonthlyUsd: null,
578
+ });
579
+ }
470
580
  if (promoApplied && model.promo) {
471
581
  advisories.push({
472
582
  id: 'promo-pricing',
@@ -1 +1 @@
1
- {"version":3,"file":"advisories.js","sourceRoot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;IACpC,MAAM,cAAc,GAAyC;QAC3D,OAAO,EAAE,CAAC;QACV,WAAW,EAAE,CAAC;QACd,IAAI,EAAE,CAAC;KACR,CAAC;IAEF,OAAO,UAAU,CAAC,IAAI,CACpB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACP,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC;QACvD,CAAC,CAAC,CAAC,mBAAmB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,mBAAmB,IAAI,CAAC,CAAC,CAC9D,CAAC;AACJ,CAAC"}
package/dist/band.d.ts ADDED
@@ -0,0 +1,131 @@
1
+ /**
2
+ * The error band Trazum is entitled to print about a given piece of text.
3
+ *
4
+ * ## Why this exists
5
+ *
6
+ * For a long time every report said `±10%`, everywhere, about everything. That
7
+ * number came from a corpus of twenty-one samples that held **thirteen files of
8
+ * Latin prose and exactly one each of code, numeric and punctuation** — and
9
+ * those single files were the set the estimator's constants had been fitted to.
10
+ * So the published band was not a measurement of the estimator. It was a
11
+ * measurement of its own training set.
12
+ *
13
+ * Seven ordinary samples in the thin classes broke it. Measured against
14
+ * Anthropic's counting endpoint, the same estimator that is 4.6% out on prose
15
+ * is **24.9% out on a SQL migration** and **32.5% out on a CSV ledger**. Telling
16
+ * somebody `±10%` about their ledger was telling them a number that is wrong
17
+ * about their prompt specifically.
18
+ *
19
+ * ## Why it does not name a text type
20
+ *
21
+ * The obvious design is a classifier — prose, code, few-shot, punctuation — and
22
+ * a band per class. The corpus says it cannot be built. Measured by character
23
+ * mix, code and punctuation **overlap completely**: `code-sql` is 7.7% symbols
24
+ * and `code-heavy` 15.6%, while `punctuation-markup` is 17.5% and
25
+ * `punctuation-heavy` 29.7%. Two of the three few-shot samples are
26
+ * indistinguishable from prose. A classifier over those would be a guess
27
+ * wearing a measurement's name, and it would hand out the wrong band precisely
28
+ * where the band matters most.
29
+ *
30
+ * So this does not classify. It sorts text into the **buckets the evidence
31
+ * actually separates**, and where two classes overlap it gives the worse of
32
+ * their bands. An overstated uncertainty costs a reader some confidence; an
33
+ * understated one tells them a wrong number and lets them act on it.
34
+ *
35
+ * ## What holds it
36
+ *
37
+ * `token-band.test.js` runs every corpus sample through `bandFor` and requires
38
+ * the sample's own measured error to be inside the band it was given. That is
39
+ * the whole promise, and it cannot be satisfied by tuning the thresholds: a
40
+ * sample sorted into a friendlier bucket gets a smaller band and fails.
41
+ *
42
+ * The figures below are derived from the fixture by the same test, which fails
43
+ * when they drift. They are written here rather than imported because this file
44
+ * ships and the fixture does not.
45
+ */
46
+ /**
47
+ * The buckets, worst measured error first.
48
+ *
49
+ * Every number is `Math.ceil` of the worst sample in that bucket, from
50
+ * `test/fixtures/token-ground-truth.json` — Anthropic's, because that is the
51
+ * tokenizer this estimator was built for and the only one whose fixture governs
52
+ * a published claim. A DeepSeek or Mistral prompt is further out still, and
53
+ * `providerBandCaveat` is what says so.
54
+ */
55
+ export declare const BANDS: {
56
+ /** Digit-dominant: ledgers, tables, exports. The worst the estimator does. */
57
+ readonly numeric: 33;
58
+ /** Symbol-rich: code, markup, anything a merge table covers badly. */
59
+ readonly symbolic: 26;
60
+ /**
61
+ * CJK, all three scripts.
62
+ *
63
+ * Was 10 and is 4, and the difference is the second Korean sample rather than
64
+ * anything in this file. Hangul had been charged a placeholder that nothing
65
+ * measured; one sample moved it to within ten points and two moved it to
66
+ * within three. The class's worst went from 10.6% to 3.2% and its standard
67
+ * deviation from 4.0 to 1.0.
68
+ */
69
+ readonly cjk: 4;
70
+ /**
71
+ * Latin prose and few-shot blocks made of it. What most prompts are.
72
+ *
73
+ * Widened from 5 by `numeric-matrix`, a confusion matrix whose class labels
74
+ * make letters the dominant class: composition put it here, its error came
75
+ * out at 5.6%, and the band follows the measurement rather than the other way
76
+ * round. Eighteen samples, deviation 1.4 points.
77
+ */
78
+ readonly prose: 6;
79
+ };
80
+ export type BandBucket = keyof typeof BANDS;
81
+ /** The bucket a piece of text falls in, by the composition the corpus separates on. */
82
+ export declare function bucketFor(text: string): BandBucket;
83
+ /**
84
+ * The band, as a percentage, that may be printed about this text.
85
+ *
86
+ * Never a single number for all text again. A caller that wants one figure for
87
+ * a mixed report should take the widest band across the texts it covers, not an
88
+ * average: averaging two uncertainties produces a third that describes neither.
89
+ */
90
+ export declare function bandFor(text: string): number;
91
+ /**
92
+ * Whether the published band applies to a model at all.
93
+ *
94
+ * It does not, and this is the sentence that has been missing. The estimator is
95
+ * calibrated on Claude's tokenizer, and the same 47 samples measured against
96
+ * DeepSeek's own counter came out **94.5% wrong** at worst and against
97
+ * Mistral's **103.1%**. Trazum prices seven providers; the band is one
98
+ * provider's.
99
+ *
100
+ * Returns null when the model is one the band was measured on, and the provider
101
+ * id otherwise, so a caller can say which foreign tokenizer it is estimating
102
+ * against rather than printing a figure that belongs to a different one.
103
+ */
104
+ export declare function foreignTokenizer(provider: string | null): string | null;
105
+ /**
106
+ * The worst error measured against a provider's own tokenizer, where anybody
107
+ * has run it.
108
+ *
109
+ * Two entries, and the emptiness of the rest is the point. `foreignTokenizer`
110
+ * could always say *this is not Claude*; what it could not say is how far off.
111
+ * A hedge with no figure reads as a formality, and a reader discounts it — so
112
+ * where the corpus has been run against the family's own counter, the report
113
+ * says the number, and where it has not, it says nobody has measured rather
114
+ * than borrowing one of these.
115
+ *
116
+ * Every value is the worst of the 47 samples in
117
+ * `test/fixtures/token-ground-truth.<provider>.json`, and
118
+ * `token-band.test.js` recomputes both from the fixtures and fails on drift.
119
+ * Written here rather than imported because this file ships and the fixtures
120
+ * do not.
121
+ */
122
+ export declare const MEASURED_FOREIGN_ERROR_PCT: Readonly<Record<string, number>>;
123
+ /**
124
+ * How far out the estimator has been measured against this provider, or null.
125
+ *
126
+ * Null means unmeasured, never zero: a family nobody has run is an open
127
+ * question, and answering it with a number would be the exact fault this whole
128
+ * file exists to undo.
129
+ */
130
+ export declare function measuredForeignError(provider: string | null): number | null;
131
+ //# sourceMappingURL=band.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"band.d.ts","sourceRoot":"","sources":["../src/band.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,KAAK;IAChB,8EAA8E;aAC9E,OAAO,EAAE,EAAE;IACX,sEAAsE;aACtE,QAAQ,EAAE,EAAE;IACZ;;;;;;;;OAQG;aACH,GAAG,EAAE,CAAC;IACN;;;;;;;OAOG;aACH,KAAK,EAAE,CAAC;CACA,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,KAAK,CAAC;AAwC5C,uFAAuF;AACvF,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CA0BlD;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAEvE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKvE,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAG3E"}