@pydantic/genai-prices 0.0.64 → 0.0.66

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
@@ -2,10 +2,10 @@
2
2
  import he from "yargs";
3
3
  import { format as ke } from "util";
4
4
  import { resolve as oe, normalize as Qe } from "path";
5
- import { readFileSync as ge, writeFile as Pe, statSync as Se } from "fs";
5
+ import { readFileSync as ge, writeFile as Pe, statSync as Ge } from "fs";
6
6
  import "assert";
7
7
  import { fileURLToPath as Te } from "url";
8
- function Ge() {
8
+ function Se() {
9
9
  return Ce() ? 0 : 1;
10
10
  }
11
11
  function Ce() {
@@ -15,7 +15,7 @@ function ze() {
15
15
  return !!process.versions.electron;
16
16
  }
17
17
  function Re(i) {
18
- return i.slice(Ge() + 1);
18
+ return i.slice(Se() + 1);
19
19
  }
20
20
  /**
21
21
  * @license
@@ -124,7 +124,7 @@ class De {
124
124
  "strip-aliased": !1,
125
125
  "strip-dashed": !1,
126
126
  "unknown-options-as-args": !1
127
- }, s.configuration), q = Object.assign(/* @__PURE__ */ Object.create(null), s.default), S = s.configObjects || [], B = s.envPrefix, P = k["populate--"], y = P ? "--" : "_", T = /* @__PURE__ */ Object.create(null), N = /* @__PURE__ */ Object.create(null), M = s.__ || C.format, m = {
127
+ }, s.configuration), q = Object.assign(/* @__PURE__ */ Object.create(null), s.default), G = s.configObjects || [], B = s.envPrefix, P = k["populate--"], M = P ? "--" : "_", T = /* @__PURE__ */ Object.create(null), N = /* @__PURE__ */ Object.create(null), I = s.__ || C.format, m = {
128
128
  aliases: /* @__PURE__ */ Object.create(null),
129
129
  arrays: /* @__PURE__ */ Object.create(null),
130
130
  bools: /* @__PURE__ */ Object.create(null),
@@ -136,7 +136,7 @@ class De {
136
136
  nargs: /* @__PURE__ */ Object.create(null),
137
137
  coercions: /* @__PURE__ */ Object.create(null),
138
138
  keys: []
139
- }, I = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/, U = new RegExp("^--" + k["negation-prefix"] + "(.+)");
139
+ }, y = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/, U = new RegExp("^--" + k["negation-prefix"] + "(.+)");
140
140
  [].concat(s.array || []).filter(Boolean).forEach(function(e) {
141
141
  const a = typeof e == "object" ? e.key : e, c = Object.keys(e).map(function(n) {
142
142
  return {
@@ -182,39 +182,39 @@ class De {
182
182
  Y(a);
183
183
  continue;
184
184
  } else if (a.match(/^--.+=/) || !k["short-option-groups"] && a.match(/^-.+=/))
185
- p = a.match(/^--?([^=]+)=([\s\S]*)$/), p !== null && Array.isArray(p) && p.length >= 3 && (g(p[1], m.arrays) ? e = K(e, p[1], r, p[2]) : g(p[1], m.nargs) !== !1 ? e = j(e, p[1], r, p[2]) : w(p[1], p[2], !0));
185
+ p = a.match(/^--?([^=]+)=([\s\S]*)$/), p !== null && Array.isArray(p) && p.length >= 3 && (g(p[1], m.arrays) ? e = K(e, p[1], r, p[2]) : g(p[1], m.nargs) !== !1 ? e = j(e, p[1], r, p[2]) : f(p[1], p[2], !0));
186
186
  else if (a.match(U) && k["boolean-negation"])
187
- p = a.match(U), p !== null && Array.isArray(p) && p.length >= 2 && (t = p[1], w(t, g(t, m.arrays) ? [!1] : !1));
187
+ p = a.match(U), p !== null && Array.isArray(p) && p.length >= 2 && (t = p[1], f(t, g(t, m.arrays) ? [!1] : !1));
188
188
  else if (a.match(/^--.+/) || !k["short-option-groups"] && a.match(/^-[^-]+/))
189
- p = a.match(/^--?(.+)/), p !== null && Array.isArray(p) && p.length >= 2 && (t = p[1], g(t, m.arrays) ? e = K(e, t, r) : g(t, m.nargs) !== !1 ? e = j(e, t, r) : (d = r[e + 1], d !== void 0 && (!d.match(/^-/) || d.match(I)) && !g(t, m.bools) && !g(t, m.counts) || /^(true|false)$/.test(d) ? (w(t, d), e++) : w(t, R(t))));
189
+ p = a.match(/^--?(.+)/), p !== null && Array.isArray(p) && p.length >= 2 && (t = p[1], g(t, m.arrays) ? e = K(e, t, r) : g(t, m.nargs) !== !1 ? e = j(e, t, r) : (d = r[e + 1], d !== void 0 && (!d.match(/^-/) || d.match(y)) && !g(t, m.bools) && !g(t, m.counts) || /^(true|false)$/.test(d) ? (f(t, d), e++) : f(t, R(t))));
190
190
  else if (a.match(/^-.\..+=/))
191
- p = a.match(/^-([^=]+)=([\s\S]*)$/), p !== null && Array.isArray(p) && p.length >= 3 && w(p[1], p[2]);
192
- else if (a.match(/^-.\..+/) && !a.match(I))
193
- d = r[e + 1], p = a.match(/^-(.\..+)/), p !== null && Array.isArray(p) && p.length >= 2 && (t = p[1], d !== void 0 && !d.match(/^-/) && !g(t, m.bools) && !g(t, m.counts) ? (w(t, d), e++) : w(t, R(t)));
194
- else if (a.match(/^-[^-]+/) && !a.match(I)) {
191
+ p = a.match(/^-([^=]+)=([\s\S]*)$/), p !== null && Array.isArray(p) && p.length >= 3 && f(p[1], p[2]);
192
+ else if (a.match(/^-.\..+/) && !a.match(y))
193
+ d = r[e + 1], p = a.match(/^-(.\..+)/), p !== null && Array.isArray(p) && p.length >= 2 && (t = p[1], d !== void 0 && !d.match(/^-/) && !g(t, m.bools) && !g(t, m.counts) ? (f(t, d), e++) : f(t, R(t)));
194
+ else if (a.match(/^-[^-]+/) && !a.match(y)) {
195
195
  l = a.slice(1, -1).split(""), n = !1;
196
196
  for (let x = 0; x < l.length; x++) {
197
197
  if (d = a.slice(x + 2), l[x + 1] && l[x + 1] === "=") {
198
- v = a.slice(x + 3), t = l[x], g(t, m.arrays) ? e = K(e, t, r, v) : g(t, m.nargs) !== !1 ? e = j(e, t, r, v) : w(t, v), n = !0;
198
+ v = a.slice(x + 3), t = l[x], g(t, m.arrays) ? e = K(e, t, r, v) : g(t, m.nargs) !== !1 ? e = j(e, t, r, v) : f(t, v), n = !0;
199
199
  break;
200
200
  }
201
201
  if (d === "-") {
202
- w(l[x], d);
202
+ f(l[x], d);
203
203
  continue;
204
204
  }
205
205
  if (/[A-Za-z]/.test(l[x]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(d) && g(d, m.bools) === !1) {
206
- w(l[x], d), n = !0;
206
+ f(l[x], d), n = !0;
207
207
  break;
208
208
  }
209
209
  if (l[x + 1] && l[x + 1].match(/\W/)) {
210
- w(l[x], d), n = !0;
210
+ f(l[x], d), n = !0;
211
211
  break;
212
212
  } else
213
- w(l[x], R(l[x]));
213
+ f(l[x], R(l[x]));
214
214
  }
215
- t = a.slice(-1)[0], !n && t !== "-" && (g(t, m.arrays) ? e = K(e, t, r) : g(t, m.nargs) !== !1 ? e = j(e, t, r) : (d = r[e + 1], d !== void 0 && (!/^(-|--)[^-]/.test(d) || d.match(I)) && !g(t, m.bools) && !g(t, m.counts) || /^(true|false)$/.test(d) ? (w(t, d), e++) : w(t, R(t))));
216
- } else if (a.match(/^-[0-9]$/) && a.match(I) && g(a.slice(1), m.bools))
217
- t = a.slice(1), w(t, R(t));
215
+ t = a.slice(-1)[0], !n && t !== "-" && (g(t, m.arrays) ? e = K(e, t, r) : g(t, m.nargs) !== !1 ? e = j(e, t, r) : (d = r[e + 1], d !== void 0 && (!/^(-|--)[^-]/.test(d) || d.match(y)) && !g(t, m.bools) && !g(t, m.counts) || /^(true|false)$/.test(d) ? (f(t, d), e++) : f(t, R(t))));
216
+ } else if (a.match(/^-[0-9]$/) && a.match(y) && g(a.slice(1), m.bools))
217
+ t = a.slice(1), f(t, R(t));
218
218
  else if (a === "--") {
219
219
  V = r.slice(e + 1);
220
220
  break;
@@ -224,10 +224,10 @@ class De {
224
224
  } else
225
225
  Y(a);
226
226
  }
227
- me(b, !0), me(b, !1), fe(b), we(), ue(b, m.aliases, q, !0), be(b), k["set-placeholder-key"] && ve(b), Object.keys(m.counts).forEach(function(e) {
228
- O(b, e.split(".")) || w(e, 0);
229
- }), P && V.length && (b[y] = []), V.forEach(function(e) {
230
- b[y].push(e);
227
+ me(b, !0), me(b, !1), we(b), fe(), ue(b, m.aliases, q, !0), be(b), k["set-placeholder-key"] && ve(b), Object.keys(m.counts).forEach(function(e) {
228
+ O(b, e.split(".")) || f(e, 0);
229
+ }), P && V.length && (b[M] = []), V.forEach(function(e) {
230
+ b[M].push(e);
231
231
  }), k["camel-case-expansion"] && k["strip-dashed"] && Object.keys(b).filter((e) => e !== "--" && e.includes("-")).forEach((e) => {
232
232
  delete b[e];
233
233
  }), k["strip-aliased"] && [].concat(...Object.keys(_).map((e) => _[e])).forEach((e) => {
@@ -240,18 +240,18 @@ class De {
240
240
  function j(e, a, c, n) {
241
241
  let t, l = g(a, m.nargs);
242
242
  if (l = typeof l != "number" || isNaN(l) ? 1 : l, l === 0)
243
- return G(n) || (L = Error(M("Argument unexpected for: %s", a))), w(a, R(a)), e;
244
- let p = G(n) ? 0 : 1;
243
+ return S(n) || (L = Error(I("Argument unexpected for: %s", a))), f(a, R(a)), e;
244
+ let p = S(n) ? 0 : 1;
245
245
  if (k["nargs-eats-options"])
246
- c.length - (e + 1) + p < l && (L = Error(M("Not enough arguments following: %s", a))), p = l;
246
+ c.length - (e + 1) + p < l && (L = Error(I("Not enough arguments following: %s", a))), p = l;
247
247
  else {
248
- for (t = e + 1; t < c.length && (!c[t].match(/^-[^0-9]/) || c[t].match(I) || $(c[t])); t++)
248
+ for (t = e + 1; t < c.length && (!c[t].match(/^-[^0-9]/) || c[t].match(y) || $(c[t])); t++)
249
249
  p++;
250
- p < l && (L = Error(M("Not enough arguments following: %s", a)));
250
+ p < l && (L = Error(I("Not enough arguments following: %s", a)));
251
251
  }
252
252
  let d = Math.min(p, l);
253
- for (!G(n) && d > 0 && (w(a, n), d--), t = e + 1; t < d + e + 1; t++)
254
- w(a, c[t]);
253
+ for (!S(n) && d > 0 && (f(a, n), d--), t = e + 1; t < d + e + 1; t++)
254
+ f(a, c[t]);
255
255
  return e + d;
256
256
  }
257
257
  function K(e, a, c, n) {
@@ -259,26 +259,26 @@ class De {
259
259
  const p = g(a, m.nargs);
260
260
  if (g(a, m.bools) && !/^(true|false)$/.test(l))
261
261
  t.push(!0);
262
- else if (G(l) || G(n) && /^-/.test(l) && !I.test(l) && !$(l)) {
262
+ else if (S(l) || S(n) && /^-/.test(l) && !y.test(l) && !$(l)) {
263
263
  if (q[a] !== void 0) {
264
264
  const d = q[a];
265
265
  t = Array.isArray(d) ? d : [d];
266
266
  }
267
267
  } else {
268
- G(n) || t.push(J(a, n, !0));
269
- for (let d = e + 1; d < c.length && !(!k["greedy-arrays"] && t.length > 0 || p && typeof p == "number" && t.length >= p || (l = c[d], /^-/.test(l) && !I.test(l) && !$(l))); d++)
270
- e = d, t.push(J(a, l, h));
268
+ S(n) || t.push(Z(a, n, !0));
269
+ for (let d = e + 1; d < c.length && !(!k["greedy-arrays"] && t.length > 0 || p && typeof p == "number" && t.length >= p || (l = c[d], /^-/.test(l) && !y.test(l) && !$(l))); d++)
270
+ e = d, t.push(Z(a, l, h));
271
271
  }
272
- return typeof p == "number" && (p && t.length < p || isNaN(p) && t.length === 0) && (L = Error(M("Not enough arguments following: %s", a))), w(a, t), e;
272
+ return typeof p == "number" && (p && t.length < p || isNaN(p) && t.length === 0) && (L = Error(I("Not enough arguments following: %s", a))), f(a, t), e;
273
273
  }
274
- function w(e, a, c = h) {
274
+ function f(e, a, c = h) {
275
275
  if (/-/.test(e) && k["camel-case-expansion"]) {
276
276
  const l = e.split(".").map(function(p) {
277
277
  return W(p);
278
278
  }).join(".");
279
279
  re(e, l);
280
280
  }
281
- const n = J(e, a, c), t = e.split(".");
281
+ const n = Z(e, a, c), t = e.split(".");
282
282
  E(b, t, n), m.aliases[e] && m.aliases[e].forEach(function(l) {
283
283
  const p = l.split(".");
284
284
  E(b, p, n);
@@ -301,17 +301,17 @@ class De {
301
301
  function re(e, a) {
302
302
  m.aliases[e] && m.aliases[e].length || (m.aliases[e] = [a], T[a] = !0), m.aliases[a] && m.aliases[a].length || re(a, e);
303
303
  }
304
- function J(e, a, c) {
304
+ function Z(e, a, c) {
305
305
  c && (a = Ve(a)), (g(e, m.bools) || g(e, m.counts)) && typeof a == "string" && (a = a === "true");
306
306
  let n = Array.isArray(a) ? a.map(function(t) {
307
307
  return H(e, t);
308
308
  }) : H(e, a);
309
- return g(e, m.counts) && (G(n) || typeof n == "boolean") && (n = X()), g(e, m.normalize) && g(e, m.arrays) && (Array.isArray(a) ? n = a.map((t) => C.normalize(t)) : n = C.normalize(a)), n;
309
+ return g(e, m.counts) && (S(n) || typeof n == "boolean") && (n = X()), g(e, m.normalize) && g(e, m.arrays) && (Array.isArray(a) ? n = a.map((t) => C.normalize(t)) : n = C.normalize(a)), n;
310
310
  }
311
311
  function H(e, a) {
312
- return !k["parse-positional-numbers"] && e === "_" || !g(e, m.strings) && !g(e, m.bools) && !Array.isArray(a) && (Oe(a) && k["parse-numbers"] && Number.isSafeInteger(Math.floor(parseFloat(`${a}`))) || !G(a) && g(e, m.numbers)) && (a = Number(a)), a;
312
+ return !k["parse-positional-numbers"] && e === "_" || !g(e, m.strings) && !g(e, m.bools) && !Array.isArray(a) && (Oe(a) && k["parse-numbers"] && Number.isSafeInteger(Math.floor(parseFloat(`${a}`))) || !S(a) && g(e, m.numbers)) && (a = Number(a)), a;
313
313
  }
314
- function fe(e) {
314
+ function we(e) {
315
315
  const a = /* @__PURE__ */ Object.create(null);
316
316
  ue(a, m.aliases, q), Object.keys(m.configs).forEach(function(c) {
317
317
  const n = e[c] || a[c];
@@ -331,21 +331,21 @@ class De {
331
331
  }
332
332
  } else
333
333
  t = C.require(l);
334
- Z(t);
334
+ J(t);
335
335
  } catch (t) {
336
- t.name === "PermissionDenied" ? L = t : e[c] && (L = Error(M("Invalid JSON config file: %s", n)));
336
+ t.name === "PermissionDenied" ? L = t : e[c] && (L = Error(I("Invalid JSON config file: %s", n)));
337
337
  }
338
338
  });
339
339
  }
340
- function Z(e, a) {
340
+ function J(e, a) {
341
341
  Object.keys(e).forEach(function(c) {
342
342
  const n = e[c], t = a ? a + "." + c : c;
343
- typeof n == "object" && n !== null && !Array.isArray(n) && k["dot-notation"] ? Z(n, t) : (!O(b, t.split(".")) || g(t, m.arrays) && k["combine-arrays"]) && w(t, n);
343
+ typeof n == "object" && n !== null && !Array.isArray(n) && k["dot-notation"] ? J(n, t) : (!O(b, t.split(".")) || g(t, m.arrays) && k["combine-arrays"]) && f(t, n);
344
344
  });
345
345
  }
346
- function we() {
347
- typeof S < "u" && S.forEach(function(e) {
348
- Z(e);
346
+ function fe() {
347
+ typeof G < "u" && G.forEach(function(e) {
348
+ J(e);
349
349
  });
350
350
  }
351
351
  function me(e, a) {
@@ -357,7 +357,7 @@ class De {
357
357
  const l = t.split("__").map(function(p, d) {
358
358
  return d === 0 && (p = p.substring(c.length)), W(p);
359
359
  });
360
- (a && m.configs[l.join(".")] || !a) && !O(e, l) && w(l.join("."), n[t]);
360
+ (a && m.configs[l.join(".")] || !a) && !O(e, l) && f(l.join("."), n[t]);
361
361
  }
362
362
  });
363
363
  }
@@ -403,7 +403,7 @@ class De {
403
403
  });
404
404
  const t = pe(a[a.length - 1]), l = g(a.join("."), m.arrays), p = Array.isArray(c);
405
405
  let d = k["duplicate-arguments-array"];
406
- !d && g(t, m.nargs) && (d = !0, (!G(n[t]) && m.nargs[t] === 1 || Array.isArray(n[t]) && n[t].length === m.nargs[t]) && (n[t] = void 0)), c === X() ? n[t] = X(n[t]) : Array.isArray(n[t]) ? d && l && p ? n[t] = k["flatten-duplicate-arrays"] ? n[t].concat(c) : (Array.isArray(n[t][0]) ? n[t] : [n[t]]).concat([c]) : !d && !!l == !!p ? n[t] = c : n[t] = n[t].concat([c]) : n[t] === void 0 && l ? n[t] = p ? c : [c] : d && !(n[t] === void 0 || g(t, m.counts) || g(t, m.bools)) ? n[t] = [n[t], c] : n[t] = c;
406
+ !d && g(t, m.nargs) && (d = !0, (!S(n[t]) && m.nargs[t] === 1 || Array.isArray(n[t]) && n[t].length === m.nargs[t]) && (n[t] = void 0)), c === X() ? n[t] = X(n[t]) : Array.isArray(n[t]) ? d && l && p ? n[t] = k["flatten-duplicate-arrays"] ? n[t].concat(c) : (Array.isArray(n[t][0]) ? n[t] : [n[t]]).concat([c]) : !d && !!l == !!p ? n[t] = c : n[t] = n[t].concat([c]) : n[t] === void 0 && l ? n[t] = p ? c : [c] : d && !(n[t] === void 0 || g(t, m.counts) || g(t, m.bools)) ? n[t] = [n[t], c] : n[t] = c;
407
407
  }
408
408
  function xe(...e) {
409
409
  e.forEach(function(a) {
@@ -442,8 +442,8 @@ class De {
442
442
  return t && ce(t[1]);
443
443
  });
444
444
  }
445
- function ye(e) {
446
- if (e.match(I) || !e.match(/^-[^-]+/))
445
+ function Me(e) {
446
+ if (e.match(y) || !e.match(/^-[^-]+/))
447
447
  return !1;
448
448
  let a = !0, c;
449
449
  const n = e.slice(1).split("");
@@ -458,15 +458,15 @@ class De {
458
458
  return a;
459
459
  }
460
460
  function $(e) {
461
- return k["unknown-options-as-args"] && Ie(e);
461
+ return k["unknown-options-as-args"] && ye(e);
462
462
  }
463
- function Ie(e) {
464
- return e = e.replace(/^-{3,}/, "--"), e.match(I) || ye(e) ? !1 : !Be(e, /^-+([^=]+?)=[\s\S]*$/, U, /^-+([^=]+?)$/, /^-+([^=]+?)-$/, /^-+([^=]+?\d+)$/, /^-+([^=]+?)\W+.*$/);
463
+ function ye(e) {
464
+ return e = e.replace(/^-{3,}/, "--"), e.match(y) || Me(e) ? !1 : !Be(e, /^-+([^=]+?)=[\s\S]*$/, U, /^-+([^=]+?)$/, /^-+([^=]+?)-$/, /^-+([^=]+?\d+)$/, /^-+([^=]+?)\W+.*$/);
465
465
  }
466
466
  function R(e) {
467
- return !g(e, m.bools) && !g(e, m.counts) && `${e}` in q ? q[e] : Me(Le(e));
467
+ return !g(e, m.bools) && !g(e, m.counts) && `${e}` in q ? q[e] : Ie(Le(e));
468
468
  }
469
- function Me(e) {
469
+ function Ie(e) {
470
470
  return {
471
471
  [Q.BOOLEAN]: !0,
472
472
  [Q.STRING]: "",
@@ -478,11 +478,11 @@ class De {
478
478
  let a = Q.BOOLEAN;
479
479
  return g(e, m.strings) ? a = Q.STRING : g(e, m.numbers) ? a = Q.NUMBER : g(e, m.bools) ? a = Q.BOOLEAN : g(e, m.arrays) && (a = Q.ARRAY), a;
480
480
  }
481
- function G(e) {
481
+ function S(e) {
482
482
  return e === void 0;
483
483
  }
484
484
  function Ae() {
485
- Object.keys(m.counts).find((e) => g(e, m.arrays) ? (L = Error(M("Invalid configuration: %s, opts.count excludes opts.array.", e)), !0) : g(e, m.nargs) ? (L = Error(M("Invalid configuration: %s, opts.count excludes opts.narg.", e)), !0) : !1);
485
+ Object.keys(m.counts).find((e) => g(e, m.arrays) ? (L = Error(I("Invalid configuration: %s, opts.count excludes opts.array.", e)), !0) : g(e, m.nargs) ? (L = Error(I("Invalid configuration: %s, opts.count excludes opts.narg.", e)), !0) : !1);
486
486
  }
487
487
  return {
488
488
  aliases: Object.assign({}, m.aliases),
@@ -565,7 +565,7 @@ const Ke = {
565
565
  resolve: oe,
566
566
  exists: (i) => {
567
567
  try {
568
- return Se(i).isFile();
568
+ return Ge(i).isFile();
569
569
  } catch {
570
570
  return !1;
571
571
  }
@@ -894,6 +894,22 @@ const ne = [
894
894
  output_mtok: 15
895
895
  }
896
896
  },
897
+ {
898
+ id: "claude-fable-5",
899
+ name: "Claude Fable 5",
900
+ description: "Anthropic's most capable widely released model for demanding reasoning and long-horizon agentic work",
901
+ match: {
902
+ starts_with: "claude-fable-5"
903
+ },
904
+ context_window: 1e6,
905
+ price_comments: "Flat pricing across full 1M context window (no tiered pricing). Ref: https://platform.claude.com/docs/en/about-claude/pricing#long-context-pricing",
906
+ prices: {
907
+ input_mtok: 10,
908
+ cache_write_mtok: 12.5,
909
+ cache_read_mtok: 1,
910
+ output_mtok: 50
911
+ }
912
+ },
897
913
  {
898
914
  id: "claude-haiku-4-5",
899
915
  name: "Claude Haiku 4.5",
@@ -1529,6 +1545,18 @@ const ne = [
1529
1545
  output_mtok: 5.4
1530
1546
  }
1531
1547
  },
1548
+ {
1549
+ id: "global.anthropic.claude-fable-5-v1:0",
1550
+ match: {
1551
+ contains: "global.anthropic.claude-fable-5"
1552
+ },
1553
+ prices: {
1554
+ input_mtok: 10,
1555
+ cache_write_mtok: 12.5,
1556
+ cache_read_mtok: 1,
1557
+ output_mtok: 50
1558
+ }
1559
+ },
1532
1560
  {
1533
1561
  id: "global.anthropic.claude-haiku-4-5-20251001-v1:0",
1534
1562
  match: {
@@ -2165,6 +2193,37 @@ const ne = [
2165
2193
  output_mtok: 15
2166
2194
  }
2167
2195
  },
2196
+ {
2197
+ id: "regional.anthropic.claude-fable-5-v1:0",
2198
+ match: {
2199
+ or: [
2200
+ {
2201
+ starts_with: "anthropic.claude-fable-5"
2202
+ },
2203
+ {
2204
+ starts_with: "claude-fable-5"
2205
+ },
2206
+ {
2207
+ contains: "us.anthropic.claude-fable-5"
2208
+ },
2209
+ {
2210
+ contains: "au.anthropic.claude-fable-5"
2211
+ },
2212
+ {
2213
+ contains: "eu.anthropic.claude-fable-5"
2214
+ },
2215
+ {
2216
+ contains: "jp.anthropic.claude-fable-5"
2217
+ }
2218
+ ]
2219
+ },
2220
+ prices: {
2221
+ input_mtok: 11,
2222
+ cache_write_mtok: 13.75,
2223
+ cache_read_mtok: 1.1,
2224
+ output_mtok: 55
2225
+ }
2226
+ },
2168
2227
  {
2169
2228
  id: "regional.anthropic.claude-haiku-4-5-20251001-v1:0",
2170
2229
  match: {
@@ -4192,6 +4251,20 @@ Compared to other leading proprietary and open-weights models Command A delivers
4192
4251
  output_mtok: 15
4193
4252
  }
4194
4253
  },
4254
+ {
4255
+ id: "claude-fable-5",
4256
+ match: {
4257
+ contains: "claude-fable-5"
4258
+ },
4259
+ context_window: 1e6,
4260
+ price_comments: "Flat pricing across full 1M context window. Ref: https://cloud.google.com/vertex-ai/generative-ai/pricing#claude-models",
4261
+ prices: {
4262
+ input_mtok: 10,
4263
+ cache_write_mtok: 12.5,
4264
+ cache_read_mtok: 1,
4265
+ output_mtok: 50
4266
+ }
4267
+ },
4195
4268
  {
4196
4269
  id: "claude-opus-4-6",
4197
4270
  match: {
@@ -9236,6 +9309,197 @@ Compared to other leading proprietary and open-weights models Command A delivers
9236
9309
  }
9237
9310
  ]
9238
9311
  },
9312
+ {
9313
+ id: "minimax",
9314
+ name: "MiniMax",
9315
+ pricing_urls: ["https://platform.minimax.io/docs/guides/pricing-paygo"],
9316
+ api_pattern: "https://api\\.minimax(i)?\\.(?:com|io)",
9317
+ price_comments: "Prices sourced from MiniMax international platform USD pricing (platform.minimax.io, May 2026). M2.1, M2.1-highspeed, and M2 are legacy models; prices inferred from CNY pricing at the equivalent 7.00 CNY/USD rate used by the international platform for current models.",
9318
+ model_match: {
9319
+ or: [
9320
+ {
9321
+ starts_with: "MiniMax-M"
9322
+ },
9323
+ {
9324
+ starts_with: "minimax-m"
9325
+ },
9326
+ {
9327
+ equals: "M2-her"
9328
+ },
9329
+ {
9330
+ equals: "m2-her"
9331
+ }
9332
+ ]
9333
+ },
9334
+ extractors: [
9335
+ {
9336
+ api_flavor: "chat",
9337
+ root: "usage",
9338
+ model_path: "model",
9339
+ mappings: [
9340
+ {
9341
+ path: "prompt_tokens",
9342
+ dest: "input_tokens",
9343
+ required: !0
9344
+ },
9345
+ {
9346
+ path: ["prompt_tokens_details", "cached_tokens"],
9347
+ dest: "cache_read_tokens",
9348
+ required: !1
9349
+ },
9350
+ {
9351
+ path: "completion_tokens",
9352
+ dest: "output_tokens",
9353
+ required: !0
9354
+ }
9355
+ ]
9356
+ }
9357
+ ],
9358
+ models: [
9359
+ {
9360
+ id: "M2-her",
9361
+ name: "MiniMax M2-her",
9362
+ description: "MiniMax M2-her, a text dialogue model optimized for role-playing and multi-turn conversations. 64,000 token context window. No cache support.",
9363
+ match: {
9364
+ or: [
9365
+ {
9366
+ equals: "M2-her"
9367
+ },
9368
+ {
9369
+ equals: "m2-her"
9370
+ }
9371
+ ]
9372
+ },
9373
+ context_window: 64e3,
9374
+ prices: {
9375
+ input_mtok: 0.3,
9376
+ output_mtok: 1.2
9377
+ }
9378
+ },
9379
+ {
9380
+ id: "MiniMax-M2",
9381
+ name: "MiniMax M2",
9382
+ description: "MiniMax M2 (legacy), a multimodal language model with 204,800 token context window. Supports agentic capabilities and advanced reasoning.",
9383
+ match: {
9384
+ or: [
9385
+ {
9386
+ equals: "MiniMax-M2"
9387
+ },
9388
+ {
9389
+ equals: "minimax-m2"
9390
+ },
9391
+ {
9392
+ equals: "MiniMax-M2.1"
9393
+ },
9394
+ {
9395
+ equals: "minimax-m2.1"
9396
+ },
9397
+ {
9398
+ equals: "MiniMax-M2.5"
9399
+ },
9400
+ {
9401
+ equals: "minimax-m2.5"
9402
+ }
9403
+ ]
9404
+ },
9405
+ context_window: 204800,
9406
+ prices: {
9407
+ input_mtok: 0.3,
9408
+ cache_write_mtok: 0.375,
9409
+ cache_read_mtok: 0.03,
9410
+ output_mtok: 1.2
9411
+ }
9412
+ },
9413
+ {
9414
+ id: "MiniMax-M2.1-highspeed",
9415
+ name: "MiniMax M2.1 Highspeed",
9416
+ description: "MiniMax M2.1 highspeed variant (legacy) with higher throughput.",
9417
+ match: {
9418
+ or: [
9419
+ {
9420
+ contains: "M2.1-highspeed"
9421
+ },
9422
+ {
9423
+ contains: "m2.1-highspeed"
9424
+ }
9425
+ ]
9426
+ },
9427
+ context_window: 204800,
9428
+ prices: {
9429
+ input_mtok: 0.6,
9430
+ cache_write_mtok: 0.375,
9431
+ cache_read_mtok: 0.03,
9432
+ output_mtok: 2.4
9433
+ }
9434
+ },
9435
+ {
9436
+ id: "MiniMax-M2.5-highspeed",
9437
+ name: "MiniMax M2.5 Highspeed",
9438
+ description: "MiniMax M2.5 highspeed variant with higher throughput.",
9439
+ match: {
9440
+ or: [
9441
+ {
9442
+ contains: "M2.5-highspeed"
9443
+ },
9444
+ {
9445
+ contains: "m2.5-highspeed"
9446
+ }
9447
+ ]
9448
+ },
9449
+ context_window: 204800,
9450
+ prices: {
9451
+ input_mtok: 0.6,
9452
+ cache_write_mtok: 0.375,
9453
+ cache_read_mtok: 0.03,
9454
+ output_mtok: 2.4
9455
+ }
9456
+ },
9457
+ {
9458
+ id: "MiniMax-M2.7",
9459
+ name: "MiniMax M2.7",
9460
+ description: "MiniMax M2.7, a multimodal language model with 204,800 token context window. Achieves top performance in real-world engineering, office productivity, and character-rich interaction.",
9461
+ match: {
9462
+ or: [
9463
+ {
9464
+ equals: "MiniMax-M2.7"
9465
+ },
9466
+ {
9467
+ equals: "minimax-m2.7"
9468
+ }
9469
+ ]
9470
+ },
9471
+ context_window: 204800,
9472
+ prices: {
9473
+ input_mtok: 0.3,
9474
+ cache_write_mtok: 0.375,
9475
+ cache_read_mtok: 0.06,
9476
+ output_mtok: 1.2
9477
+ }
9478
+ },
9479
+ {
9480
+ id: "MiniMax-M2.7-highspeed",
9481
+ name: "MiniMax M2.7 Highspeed",
9482
+ description: "MiniMax M2.7 highspeed variant with higher throughput.",
9483
+ match: {
9484
+ or: [
9485
+ {
9486
+ contains: "M2.7-highspeed"
9487
+ },
9488
+ {
9489
+ contains: "m2.7-highspeed"
9490
+ }
9491
+ ]
9492
+ },
9493
+ context_window: 204800,
9494
+ prices: {
9495
+ input_mtok: 0.6,
9496
+ cache_write_mtok: 0.375,
9497
+ cache_read_mtok: 0.06,
9498
+ output_mtok: 2.4
9499
+ }
9500
+ }
9501
+ ]
9502
+ },
9239
9503
  {
9240
9504
  id: "mistral",
9241
9505
  name: "Mistral",
@@ -9718,6 +9982,20 @@ Compared to other leading proprietary and open-weights models Command A delivers
9718
9982
  output_mtok: 3
9719
9983
  }
9720
9984
  },
9985
+ {
9986
+ id: "kimi-k2.6",
9987
+ name: "Kimi K2.6",
9988
+ description: "Kimi's most capable model with enhanced long-context coding stability, improved instruction compliance and self-correction capabilities. Native multimodal architecture supporting text, image, and video input, thinking and non-thinking modes, and agent tasks. Supports automatic context caching, ToolCalls, JSON Mode, Partial Mode, and internet search.",
9989
+ match: {
9990
+ starts_with: "kimi-k2.6"
9991
+ },
9992
+ context_window: 262144,
9993
+ prices: {
9994
+ input_mtok: 0.95,
9995
+ cache_read_mtok: 0.16,
9996
+ output_mtok: 4
9997
+ }
9998
+ },
9721
9999
  {
9722
10000
  id: "moonshot-v1-128k",
9723
10001
  name: "Moonshot V1 128K",
@@ -12118,6 +12396,27 @@ Compared to other leading proprietary and open-weights models Command A delivers
12118
12396
  output_mtok: 15
12119
12397
  }
12120
12398
  },
12399
+ {
12400
+ id: "anthropic/claude-fable-5",
12401
+ match: {
12402
+ or: [
12403
+ {
12404
+ equals: "anthropic/claude-fable-5"
12405
+ },
12406
+ {
12407
+ equals: "anthropic/claude-fable-5:beta"
12408
+ }
12409
+ ]
12410
+ },
12411
+ context_window: 1e6,
12412
+ price_comments: "Flat pricing across full 1M context window (no tiered pricing). Ref: https://platform.claude.com/docs/en/about-claude/pricing#long-context-pricing",
12413
+ prices: {
12414
+ input_mtok: 10,
12415
+ cache_write_mtok: 12.5,
12416
+ cache_read_mtok: 1,
12417
+ output_mtok: 50
12418
+ }
12419
+ },
12121
12420
  {
12122
12421
  id: "anthropic/claude-haiku-4.5",
12123
12422
  match: {
@@ -19830,6 +20129,299 @@ Compared to other leading proprietary and open-weights models Command A delivers
19830
20129
  }
19831
20130
  }
19832
20131
  ]
20132
+ },
20133
+ {
20134
+ id: "zhipuai",
20135
+ name: "Zhipu AI",
20136
+ pricing_urls: ["https://open.bigmodel.cn/pricing", "https://docs.bigmodel.cn/cn/guide/start/model-overview"],
20137
+ api_pattern: "https://open\\.bigmodel\\.cn",
20138
+ price_comments: "Prices sourced from Zhipu AI open platform pricing (CNY, open.bigmodel.cn/pricing), converted to USD at 1 USD = 7.25 CNY (May 2026). Zhipu AI does not publish USD prices; CNY is the only billing currency. Flagship models (GLM-4.5-Air, GLM-4.7, GLM-5 series) have tiered pricing by input/output length; prices shown are for the cheapest tier ([0, 32k) input / [0, 0.2k) output where applicable). GLM-4 standard inference models (GLM-4-Air, GLM-4-Plus, etc.) bill input and output tokens at the same per-token rate per their pricing page. Cache write is temporarily free for flagship models (limited-time promotion, not included).",
20139
+ model_match: {
20140
+ or: [
20141
+ {
20142
+ starts_with: "GLM-"
20143
+ },
20144
+ {
20145
+ starts_with: "glm-"
20146
+ }
20147
+ ]
20148
+ },
20149
+ extractors: [
20150
+ {
20151
+ api_flavor: "chat",
20152
+ root: "usage",
20153
+ model_path: "model",
20154
+ mappings: [
20155
+ {
20156
+ path: "prompt_tokens",
20157
+ dest: "input_tokens",
20158
+ required: !0
20159
+ },
20160
+ {
20161
+ path: ["prompt_tokens_details", "cached_tokens"],
20162
+ dest: "cache_read_tokens",
20163
+ required: !1
20164
+ },
20165
+ {
20166
+ path: "completion_tokens",
20167
+ dest: "output_tokens",
20168
+ required: !0
20169
+ }
20170
+ ]
20171
+ }
20172
+ ],
20173
+ models: [
20174
+ {
20175
+ id: "GLM-4-Air",
20176
+ name: "GLM-4-Air",
20177
+ description: "High-performance GLM-4 model with context caching. 128,000 token context window. Input and output billed at the same per-token rate.",
20178
+ match: {
20179
+ or: [
20180
+ {
20181
+ equals: "GLM-4-Air"
20182
+ },
20183
+ {
20184
+ equals: "glm-4-air"
20185
+ }
20186
+ ]
20187
+ },
20188
+ context_window: 128e3,
20189
+ prices: {
20190
+ input_mtok: 0.069,
20191
+ cache_read_mtok: 0.034,
20192
+ output_mtok: 0.069
20193
+ }
20194
+ },
20195
+ {
20196
+ id: "GLM-4-AirX",
20197
+ name: "GLM-4-AirX",
20198
+ description: "Fastest GLM-4 model. 8,000 token context window. Does not support context caching. Input and output billed at the same per-token rate.",
20199
+ match: {
20200
+ or: [
20201
+ {
20202
+ equals: "GLM-4-AirX"
20203
+ },
20204
+ {
20205
+ equals: "glm-4-airx"
20206
+ }
20207
+ ]
20208
+ },
20209
+ context_window: 8e3,
20210
+ prices: {
20211
+ input_mtok: 1.379,
20212
+ output_mtok: 1.379
20213
+ }
20214
+ },
20215
+ {
20216
+ id: "GLM-4-Assistant",
20217
+ name: "GLM-4-Assistant",
20218
+ description: "GLM-4 agent/assistant model. 128,000 token context window. Does not support context caching. Input and output billed at the same per-token rate.",
20219
+ match: {
20220
+ or: [
20221
+ {
20222
+ equals: "GLM-4-Assistant"
20223
+ },
20224
+ {
20225
+ equals: "glm-4-assistant"
20226
+ }
20227
+ ]
20228
+ },
20229
+ context_window: 128e3,
20230
+ prices: {
20231
+ input_mtok: 0.69,
20232
+ output_mtok: 0.69
20233
+ }
20234
+ },
20235
+ {
20236
+ id: "GLM-4-FlashX-250414",
20237
+ name: "GLM-4-FlashX-250414",
20238
+ description: "Fast and cheap GLM-4 model with context caching. 128,000 token context window. Input and output billed at the same per-token rate.",
20239
+ match: {
20240
+ or: [
20241
+ {
20242
+ equals: "GLM-4-FlashX-250414"
20243
+ },
20244
+ {
20245
+ equals: "glm-4-flashx-250414"
20246
+ }
20247
+ ]
20248
+ },
20249
+ context_window: 128e3,
20250
+ prices: {
20251
+ input_mtok: 0.014,
20252
+ cache_read_mtok: 7e-3,
20253
+ output_mtok: 0.014
20254
+ }
20255
+ },
20256
+ {
20257
+ id: "GLM-4-Long",
20258
+ name: "GLM-4-Long",
20259
+ description: "GLM-4 model optimized for long inputs with context caching. 1,000,000 token context window. Input and output billed at the same per-token rate.",
20260
+ match: {
20261
+ or: [
20262
+ {
20263
+ equals: "GLM-4-Long"
20264
+ },
20265
+ {
20266
+ equals: "glm-4-long"
20267
+ }
20268
+ ]
20269
+ },
20270
+ context_window: 1e6,
20271
+ prices: {
20272
+ input_mtok: 0.138,
20273
+ cache_read_mtok: 0.069,
20274
+ output_mtok: 0.138
20275
+ }
20276
+ },
20277
+ {
20278
+ id: "GLM-4-Plus",
20279
+ name: "GLM-4-Plus",
20280
+ description: "Flagship GLM-4 model with context caching. 128,000 token context window. Input and output billed at the same per-token rate.",
20281
+ match: {
20282
+ or: [
20283
+ {
20284
+ equals: "GLM-4-Plus"
20285
+ },
20286
+ {
20287
+ equals: "glm-4-plus"
20288
+ }
20289
+ ]
20290
+ },
20291
+ context_window: 128e3,
20292
+ prices: {
20293
+ input_mtok: 0.69,
20294
+ cache_read_mtok: 0.345,
20295
+ output_mtok: 0.69
20296
+ }
20297
+ },
20298
+ {
20299
+ id: "GLM-4.5-Air",
20300
+ name: "GLM-4.5-Air",
20301
+ description: "Zhipu AI's GLM-4.5-Air flagship model with context caching. 128,000 token context window. Tiered pricing; prices shown for [0, 32k) input / [0, 0.2k) output tier.",
20302
+ match: {
20303
+ or: [
20304
+ {
20305
+ equals: "GLM-4.5-Air"
20306
+ },
20307
+ {
20308
+ equals: "glm-4.5-air"
20309
+ }
20310
+ ]
20311
+ },
20312
+ context_window: 128e3,
20313
+ prices: {
20314
+ input_mtok: 0.11,
20315
+ cache_read_mtok: 0.022,
20316
+ output_mtok: 0.276
20317
+ }
20318
+ },
20319
+ {
20320
+ id: "GLM-4.7",
20321
+ name: "GLM-4.7",
20322
+ description: "Zhipu AI's GLM-4.7 flagship model with context caching. 200,000 token context window. Tiered pricing; prices shown for [0, 32k) input / [0, 0.2k) output tier.",
20323
+ match: {
20324
+ or: [
20325
+ {
20326
+ equals: "GLM-4.7"
20327
+ },
20328
+ {
20329
+ equals: "glm-4.7"
20330
+ }
20331
+ ]
20332
+ },
20333
+ context_window: 2e5,
20334
+ prices: {
20335
+ input_mtok: 0.276,
20336
+ cache_read_mtok: 0.055,
20337
+ output_mtok: 1.103
20338
+ }
20339
+ },
20340
+ {
20341
+ id: "GLM-4.7-FlashX",
20342
+ name: "GLM-4.7-FlashX",
20343
+ description: "Fast and affordable GLM-4.7 model with context caching. 200,000 token context window.",
20344
+ match: {
20345
+ or: [
20346
+ {
20347
+ equals: "GLM-4.7-FlashX"
20348
+ },
20349
+ {
20350
+ equals: "glm-4.7-flashx"
20351
+ }
20352
+ ]
20353
+ },
20354
+ context_window: 2e5,
20355
+ prices: {
20356
+ input_mtok: 0.069,
20357
+ cache_read_mtok: 0.014,
20358
+ output_mtok: 0.414
20359
+ }
20360
+ },
20361
+ {
20362
+ id: "GLM-5",
20363
+ name: "GLM-5",
20364
+ description: "Zhipu AI GLM-5 model with context caching. 200,000 token context window. Tiered pricing; prices shown for [0, 32k) input tier.",
20365
+ match: {
20366
+ or: [
20367
+ {
20368
+ equals: "GLM-5"
20369
+ },
20370
+ {
20371
+ equals: "glm-5"
20372
+ }
20373
+ ]
20374
+ },
20375
+ context_window: 2e5,
20376
+ prices: {
20377
+ input_mtok: 0.552,
20378
+ cache_read_mtok: 0.138,
20379
+ output_mtok: 2.483
20380
+ }
20381
+ },
20382
+ {
20383
+ id: "GLM-5-Turbo",
20384
+ name: "GLM-5-Turbo",
20385
+ description: "Zhipu AI GLM-5 Turbo model with context caching. 200,000 token context window. Tiered pricing; prices shown for [0, 32k) input tier.",
20386
+ match: {
20387
+ or: [
20388
+ {
20389
+ equals: "GLM-5-Turbo"
20390
+ },
20391
+ {
20392
+ equals: "glm-5-turbo"
20393
+ }
20394
+ ]
20395
+ },
20396
+ context_window: 2e5,
20397
+ prices: {
20398
+ input_mtok: 0.69,
20399
+ cache_read_mtok: 0.166,
20400
+ output_mtok: 3.034
20401
+ }
20402
+ },
20403
+ {
20404
+ id: "GLM-5.1",
20405
+ name: "GLM-5.1",
20406
+ description: "Zhipu AI's latest flagship model supporting long-horizon tasks, structured output, function calling, and context caching. 200,000 token context window. Tiered pricing; prices shown for [0, 32k) input tier.",
20407
+ match: {
20408
+ or: [
20409
+ {
20410
+ equals: "GLM-5.1"
20411
+ },
20412
+ {
20413
+ equals: "glm-5.1"
20414
+ }
20415
+ ]
20416
+ },
20417
+ context_window: 2e5,
20418
+ prices: {
20419
+ input_mtok: 0.828,
20420
+ cache_read_mtok: 0.179,
20421
+ output_mtok: 3.31
20422
+ }
20423
+ }
20424
+ ]
19833
20425
  }
19834
20426
  ];
19835
20427
  function Ye(i, o, u) {
@@ -19842,32 +20434,32 @@ function Ye(i, o, u) {
19842
20434
  function z(i, o, u, s) {
19843
20435
  return i === void 0 || o === void 0 ? 0 : typeof i == "number" ? i * o / 1e6 : Ye(i, o, s);
19844
20436
  }
19845
- function Je(i, o) {
20437
+ function Ze(i, o) {
19846
20438
  let u = 0, s = 0;
19847
- const r = i.input_tokens ?? 0, h = i.cache_read_tokens ?? 0, _ = i.cache_write_tokens ?? 0, k = i.cache_audio_read_tokens ?? 0, q = i.input_audio_tokens ?? 0, S = i.output_audio_tokens ?? 0, B = o.cache_audio_read_mtok === void 0 ? 0 : k, P = o.cache_audio_read_mtok === void 0 && o.cache_read_mtok !== void 0 ? k : 0;
19848
- let y = 0;
19849
- if (o.input_audio_mtok !== void 0 && (y = q - B - P), y < 0)
20439
+ const r = i.input_tokens ?? 0, h = i.cache_read_tokens ?? 0, _ = i.cache_write_tokens ?? 0, k = i.cache_audio_read_tokens ?? 0, q = i.input_audio_tokens ?? 0, G = i.output_audio_tokens ?? 0, B = o.cache_audio_read_mtok === void 0 ? 0 : k, P = o.cache_audio_read_mtok === void 0 && o.cache_read_mtok !== void 0 ? k : 0;
20440
+ let M = 0;
20441
+ if (o.input_audio_mtok !== void 0 && (M = q - B - P), M < 0)
19850
20442
  throw new Error("cache_audio_read_tokens cannot be greater than input_audio_tokens");
19851
20443
  let T = 0;
19852
20444
  if (o.cache_read_mtok !== void 0 && (T = h - B), T < 0)
19853
20445
  throw new Error("cache_audio_read_tokens cannot be greater than cache_read_tokens");
19854
20446
  const N = o.cache_write_mtok === void 0 ? 0 : _;
19855
- let M = 0;
19856
- if (o.input_mtok !== void 0 && (M = r - T - N - y - B), M < 0)
20447
+ let I = 0;
20448
+ if (o.input_mtok !== void 0 && (I = r - T - N - M - B), I < 0)
19857
20449
  throw new Error("Uncached text input tokens cannot be negative");
19858
- u += z(o.input_mtok, M, "input_mtok", r), u += z(o.cache_read_mtok, T, "cache_read_mtok", r), u += z(o.cache_write_mtok, N, "cache_write_mtok", r), u += z(o.input_audio_mtok, y, "input_audio_mtok", r), u += z(o.cache_audio_read_mtok, B, "cache_audio_read_mtok", r);
20450
+ u += z(o.input_mtok, I, "input_mtok", r), u += z(o.cache_read_mtok, T, "cache_read_mtok", r), u += z(o.cache_write_mtok, N, "cache_write_mtok", r), u += z(o.input_audio_mtok, M, "input_audio_mtok", r), u += z(o.cache_audio_read_mtok, B, "cache_audio_read_mtok", r);
19859
20451
  let m = 0;
19860
- if (o.output_mtok !== void 0 && (m = (i.output_tokens ?? 0) - (o.output_audio_mtok === void 0 ? 0 : S)), m < 0)
20452
+ if (o.output_mtok !== void 0 && (m = (i.output_tokens ?? 0) - (o.output_audio_mtok === void 0 ? 0 : G)), m < 0)
19861
20453
  throw new Error("output_audio_tokens cannot be greater than output_tokens");
19862
20454
  s += z(o.output_mtok, m, "output_mtok", r), s += z(o.output_audio_mtok, i.output_audio_tokens, "output_audio_mtok", r);
19863
- let I = u + s;
19864
- return o.requests_kcount !== void 0 && (I += o.requests_kcount / 1e3), {
20455
+ let y = u + s;
20456
+ return o.requests_kcount !== void 0 && (y += o.requests_kcount / 1e3), {
19865
20457
  input_price: u,
19866
20458
  output_price: s,
19867
- total_price: I
20459
+ total_price: y
19868
20460
  };
19869
20461
  }
19870
- function Ze(i, o) {
20462
+ function Je(i, o) {
19871
20463
  if (!Array.isArray(i.prices))
19872
20464
  return i.prices;
19873
20465
  for (let u = i.prices.length - 1; u >= 0; u--) {
@@ -19889,7 +20481,7 @@ function Ze(i, o) {
19889
20481
  return i.prices[0].prices;
19890
20482
  }
19891
20483
  function F(i, o) {
19892
- return "or" in i ? i.or.some((u) => F(u, o)) : "and" in i ? i.and.every((u) => F(u, o)) : "equals" in i ? o === i.equals : "starts_with" in i ? o.startsWith(i.starts_with) : "ends_with" in i ? o.endsWith(i.ends_with) : "contains" in i ? o.includes(i.contains) : "regex" in i ? new RegExp(i.regex).test(o) : !1;
20484
+ return "or" in i ? i.or.some((u) => F(u, o)) : "and" in i ? i.and.every((u) => F(u, o)) : "equals" in i ? o.toLowerCase() === i.equals.toLowerCase() : "starts_with" in i ? o.toLowerCase().startsWith(i.starts_with.toLowerCase()) : "ends_with" in i ? o.toLowerCase().endsWith(i.ends_with.toLowerCase()) : "contains" in i ? o.toLowerCase().includes(i.contains.toLowerCase()) : "regex" in i ? new RegExp(i.regex).test(o) : !1;
19893
20485
  }
19894
20486
  function Xe(i, o) {
19895
20487
  const u = o.toLowerCase().trim(), s = i.find((r) => r.id === u);
@@ -19926,23 +20518,23 @@ Promise.resolve(ne);
19926
20518
  function tt(i, o, u) {
19927
20519
  let s = o.toLowerCase().trim(), r = u?.providerId;
19928
20520
  if (r && r.toLowerCase() === "litellm" && s.includes("/")) {
19929
- const B = s.indexOf("/"), P = s.slice(0, B), y = s.slice(B + 1);
19930
- P && y && _e(ie, { providerId: P }) && (r = P, s = y);
20521
+ const B = s.indexOf("/"), P = s.slice(0, B), M = s.slice(B + 1);
20522
+ P && M && _e(ie, { providerId: P }) && (r = P, s = M);
19931
20523
  }
19932
20524
  const h = u?.provider ?? _e(ie, { modelId: s, providerApiUrl: u?.providerApiUrl, providerId: r });
19933
20525
  if (!h) return null;
19934
20526
  const _ = qe(h, s, ie);
19935
20527
  if (!_) return null;
19936
- const k = u?.timestamp ?? /* @__PURE__ */ new Date(), q = Ze(_, k), S = Je(i, q);
20528
+ const k = u?.timestamp ?? /* @__PURE__ */ new Date(), q = Je(_, k), G = Ze(i, q);
19937
20529
  return {
19938
20530
  auto_update_timestamp: void 0,
19939
20531
  model: _,
19940
20532
  model_price: q,
19941
20533
  provider: h,
19942
- ...S
20534
+ ...G
19943
20535
  };
19944
20536
  }
19945
- const f = he(Re(process.argv)).scriptName("genai-prices").command(
20537
+ const w = he(Re(process.argv)).scriptName("genai-prices").command(
19946
20538
  "list [provider]",
19947
20539
  "List providers and models",
19948
20540
  (i) => i.positional("provider", { describe: "Provider ID to filter", type: "string" })
@@ -19952,11 +20544,11 @@ const f = he(Re(process.argv)).scriptName("genai-prices").command(
19952
20544
  (i) => i.positional("model", { array: !0, describe: "Model(s) (optionally provider:model)", type: "string" }).option("input-tokens", { type: "number" }).option("cache-write-tokens", { type: "number" }).option("cache-read-tokens", { type: "number" }).option("output-tokens", { type: "number" }).option("input-audio-tokens", { type: "number" }).option("cache-audio-read-tokens", { type: "number" }).option("output-audio-tokens", { type: "number" }).option("requests", { type: "number" }).option("provider", { type: "string" }).option("auto-update", { default: !1, type: "boolean" }).option("timestamp", { describe: "RFC3339 timestamp", type: "string" })
19953
20545
  ).option("auto-update", { describe: "Enable auto-update from GitHub", type: "boolean" }).option("input-tokens", { type: "number" }).option("cache-write-tokens", { type: "number" }).option("cache-read-tokens", { type: "number" }).option("output-tokens", { type: "number" }).option("input-audio-tokens", { type: "number" }).option("cache-audio-read-tokens", { type: "number" }).option("output-audio-tokens", { type: "number" }).option("requests", { type: "number" }).option("provider", { type: "string" }).option("timestamp", { describe: "RFC3339 timestamp", type: "string" }).version("0.1.0").help().parseSync();
19954
20546
  function at() {
19955
- if (f._[0] === "list") {
20547
+ if (w._[0] === "list") {
19956
20548
  const u = ne;
19957
- if (f.provider) {
19958
- const s = u.find((r) => r.id === f.provider);
19959
- s || (console.error(`Provider ${f.provider} not found.`), process.exit(1)), console.log(`${s.name}: (${s.models.length} models)`);
20549
+ if (w.provider) {
20550
+ const s = u.find((r) => r.id === w.provider);
20551
+ s || (console.error(`Provider ${w.provider} not found.`), process.exit(1)), console.log(`${s.name}: (${s.models.length} models)`);
19960
20552
  for (const r of s.models)
19961
20553
  console.log(` ${s.id}:${r.id}${r.name ? ": " + r.name : ""}`);
19962
20554
  } else
@@ -19967,18 +20559,18 @@ function at() {
19967
20559
  }
19968
20560
  process.exit(0);
19969
20561
  }
19970
- const o = f._[0] === "calc" ? Array.isArray(f.model) ? f.model : [f.model] : f._.filter((u) => typeof u == "string");
20562
+ const o = w._[0] === "calc" ? Array.isArray(w.model) ? w.model : [w.model] : w._.filter((u) => typeof u == "string");
19971
20563
  if (o.length > 0) {
19972
20564
  const u = {
19973
- cache_audio_read_tokens: f["cache-audio-read-tokens"] !== void 0 ? Number(f["cache-audio-read-tokens"]) : void 0,
19974
- cache_read_tokens: f["cache-read-tokens"] !== void 0 ? Number(f["cache-read-tokens"]) : void 0,
19975
- cache_write_tokens: f["cache-write-tokens"] !== void 0 ? Number(f["cache-write-tokens"]) : void 0,
19976
- input_audio_tokens: f["input-audio-tokens"] !== void 0 ? Number(f["input-audio-tokens"]) : void 0,
19977
- input_tokens: f["input-tokens"] !== void 0 ? Number(f["input-tokens"]) : void 0,
19978
- output_audio_tokens: f["output-audio-tokens"] !== void 0 ? Number(f["output-audio-tokens"]) : void 0,
19979
- output_tokens: f["output-tokens"] !== void 0 ? Number(f["output-tokens"]) : void 0,
19980
- requests: f.requests !== void 0 ? Number(f.requests) : void 0
19981
- }, s = f.timestamp ? new Date(String(f.timestamp)) : void 0;
20565
+ cache_audio_read_tokens: w["cache-audio-read-tokens"] !== void 0 ? Number(w["cache-audio-read-tokens"]) : void 0,
20566
+ cache_read_tokens: w["cache-read-tokens"] !== void 0 ? Number(w["cache-read-tokens"]) : void 0,
20567
+ cache_write_tokens: w["cache-write-tokens"] !== void 0 ? Number(w["cache-write-tokens"]) : void 0,
20568
+ input_audio_tokens: w["input-audio-tokens"] !== void 0 ? Number(w["input-audio-tokens"]) : void 0,
20569
+ input_tokens: w["input-tokens"] !== void 0 ? Number(w["input-tokens"]) : void 0,
20570
+ output_audio_tokens: w["output-audio-tokens"] !== void 0 ? Number(w["output-audio-tokens"]) : void 0,
20571
+ output_tokens: w["output-tokens"] !== void 0 ? Number(w["output-tokens"]) : void 0,
20572
+ requests: w.requests !== void 0 ? Number(w.requests) : void 0
20573
+ }, s = w.timestamp ? new Date(String(w.timestamp)) : void 0;
19982
20574
  let r = !1;
19983
20575
  for (const h of o) {
19984
20576
  let _, k = h;
@@ -19989,17 +20581,17 @@ function at() {
19989
20581
  r = !0, console.error(`No price found for model ${h}`);
19990
20582
  continue;
19991
20583
  }
19992
- const S = q.model.context_window, B = [
20584
+ const G = q.model.context_window, B = [
19993
20585
  ["Provider", q.provider.name],
19994
20586
  ["Model", q.model.name ?? q.model.id],
19995
20587
  ["Model Prices", JSON.stringify(q.model_price)],
19996
- ["Context Window", S !== void 0 ? S.toLocaleString() : void 0],
20588
+ ["Context Window", G !== void 0 ? G.toLocaleString() : void 0],
19997
20589
  ["Total Price", `$${q.total_price}`],
19998
20590
  ["Input Price", `$${q.input_price}`],
19999
20591
  ["Output Price", `$${q.output_price}`]
20000
20592
  ];
20001
- for (const [P, y] of B)
20002
- y !== void 0 && console.log(`${P.padStart(14)}: ${y}`);
20593
+ for (const [P, M] of B)
20594
+ M !== void 0 && console.log(`${P.padStart(14)}: ${M}`);
20003
20595
  console.log("");
20004
20596
  } catch (q) {
20005
20597
  r = !0, q instanceof Error && console.error(`Error for model ${h}:`, q.message);