slash-tokens 1.5.1 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -45,8 +45,8 @@ var CALIBRATION = {
45
45
  "claude-opus-4.7": 2.05,
46
46
  "claude-sonnet": 2.05,
47
47
  "claude-haiku": 1.45,
48
- "gemini-3.1-pro": 1.4,
49
- "gemini-2.5-flash": 1.4,
48
+ "gemini-3.1-pro": 1.45,
49
+ "gemini-2.5-flash": 1.45,
50
50
  "grok-4.20": 1.15,
51
51
  "grok-4-1-fast": 1.15,
52
52
  "gpt-5.4": 1.15,
package/dist/slash.js CHANGED
@@ -36,20 +36,24 @@ const WASM_INPUT_OFFSET = 4096;
36
36
  * claude-haiku (routed to claude-haiku-4.5): 1.45 (was 1.40) — drifts
37
37
  * less than the two above but still worsened under the
38
38
  * bigger corpus (min ratio 0.744, was 0.762)
39
- * gemini-3.1-pro / gemini-2.5-flash: 1.40 — measured 2026-08-23 against
40
- * Google's free countTokens endpoint via the gemini-pro-latest
41
- * / gemini-flash-latest aliases (min ratio 0.768, identical
42
- * for both — pro/flash share one tokenizer this generation).
39
+ * gemini-3.1-pro / gemini-2.5-flash: 1.45 (was 1.40) — re-verified
40
+ * 2026-08-23 against the 29-sample corpus via Google's free
41
+ * countTokens endpoint (gemini-pro-latest / gemini-flash-latest
42
+ * aliases; identical ratios for both — pro/flash share one
43
+ * tokenizer this generation). Worst case shifted from the
44
+ * original 9-sample corpus: now graphql-response JSON (ratio
45
+ * 0.749, needs >=1.335), not the prose sample that mattered
46
+ * before. 1.40 was technically still safe here (unlike
47
+ * Claude's factor, which actually failed) but at the thinnest
48
+ * margin of any provider (4.9%) — bumped to match the ~6-8%
49
+ * band used everywhere else rather than leave the one factor
50
+ * most likely to fail next time this corpus grows again.
43
51
  * Note: 'gemini-3.1-pro' as a literal model ID does not exist
44
52
  * on the live API (404) — same stale-hardcoded-ID class of bug
45
53
  * as the retired Claude snapshots, caught the same day. See
46
54
  * intercept.ts MODEL_API_NAMES: the wire name is now the
47
55
  * '-latest' alias, which sidesteps this whole bug class going
48
56
  * forward since Google repoints it, not us.
49
- * ⚠ NOT YET RE-VERIFIED against the 29-sample corpus — measured
50
- * only against the original 9. Given Claude's factor needed a
51
- * ~11% bump once Spanish/SQL/bash samples were added, treat
52
- * this number as provisional until re-run.
53
57
  * gpt-5.4 / gpt-5.4-mini / gpt-5.4-nano: 1.15 — measured 2026-08-23
54
58
  * against js-tiktoken's o200k_base (free, local, exact — same
55
59
  * encoding for the whole GPT-5.4 family per OpenAI's own
@@ -61,31 +65,28 @@ const WASM_INPUT_OFFSET = 4096;
61
65
  * DEFAULT_UNKNOWN_MODEL_FACTOR (1.85), a ~60% larger correction
62
66
  * than it needed. Still safe either way (1.85 > required
63
67
  * minimum), just needlessly inflated for real GPT users.
64
- * grok-4.20 / grok-4-1-fast: 1.15 — measured 2026-08-23 (min ratio 0.928,
65
- * the least drift of any provider tested — Grok's tokenizer
66
- * runs fewer tokens per content than the others, so raw WASM
67
- * already over-reports on most samples). xAI has no free
68
- * count-tokens endpoint; this used real chat completions
69
- * (max_tokens: 1) with a per-model baseline subtracted to
70
- * remove xAI's fixed system-preamble overhead (~185-193
71
- * tokens, mostly cached) from the content-only count.
68
+ * grok-4.20 / grok-4-1-fast: 1.15 — re-verified 2026-08-23 against the
69
+ * 29-sample corpus (20 new samples: more languages, Spanish/
70
+ * Japanese prose, more JSON shapes) and UNCHANGED — same
71
+ * worst case (technical-docs prose, ratio 0.928) as the
72
+ * original 9-sample measurement. The only one of the three
73
+ * non-GPT providers whose factor held without a bump; Claude
74
+ * and Gemini both needed one, on different content types each
75
+ * (Spanish prose, then JSON). xAI has no free count-tokens
76
+ * endpoint; this used real chat completions (max_tokens: 1)
77
+ * with a per-model baseline subtracted to remove xAI's fixed
78
+ * system-preamble overhead (~185-193 tokens, mostly cached)
79
+ * from the content-only count.
72
80
  * Both literal API IDs ('grok-4.20', 'grok-4-1-fast') are
73
81
  * fully retired — not just old snapshots, gone entirely —
74
82
  * remapped to grok-4.20-0309-non-reasoning / grok-4.3 in
75
83
  * intercept.ts MODEL_API_NAMES the same day this was found.
76
- * ⚠ NOT YET RE-VERIFIED against the 29-sample corpus — same
77
- * caveat as Gemini above. Costs real (small) money per run,
78
- * unlike Gemini/Anthropic, so re-verify deliberately, not
79
- * reflexively, but don't skip it — Grok has not been tested
80
- * against non-English content or SQL/bash at all yet, and
81
- * those are exactly what broke Claude's factor.
82
84
  *
83
- * Known limitation: Claude's factors are now verified against a 29-sample
84
- * corpus (expanded 2026-08-23 from the original 9, which was mostly
85
- * slash-tokens' own code/docs — not representative third-party content).
86
- * Gemini and Grok above are still only verified against the old 9-sample
87
- * set — re-run bench/calibrate-gemini.ts and bench/calibrate-grok.ts
88
- * before trusting those two numbers as final.
85
+ * All four providers (Claude, Gemini, Grok, GPT) are now verified against
86
+ * the same 29-sample corpus (expanded 2026-08-23 from the original 9,
87
+ * which was mostly slash-tokens' own code/docs — not representative
88
+ * third-party content). Re-verify again if the corpus grows further —
89
+ * Claude and Gemini both needed real bumps the first time it grew.
89
90
  *
90
91
  * Slash must NEVER under-report. Over-reporting is safe (go/no-go only).
91
92
  */
@@ -94,8 +95,8 @@ const CALIBRATION = {
94
95
  'claude-opus-4.7': 2.05,
95
96
  'claude-sonnet': 2.05,
96
97
  'claude-haiku': 1.45,
97
- 'gemini-3.1-pro': 1.40,
98
- 'gemini-2.5-flash': 1.40,
98
+ 'gemini-3.1-pro': 1.45,
99
+ 'gemini-2.5-flash': 1.45,
99
100
  'grok-4.20': 1.15,
100
101
  'grok-4-1-fast': 1.15,
101
102
  'gpt-5.4': 1.15,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slash-tokens",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "Token Optimization for Context Engineers. 4.8 KB WASM. Sub-millisecond. Zero dependencies.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",