@pydantic/genai-prices 0.0.34 → 0.0.36
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 +209 -96
- package/dist/index.cjs +3 -3
- package/dist/index.js +211 -95
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6,12 +6,12 @@ import { readFileSync as ke, writeFile as Le, statSync as Pe } from "fs";
|
|
|
6
6
|
import "assert";
|
|
7
7
|
import { fileURLToPath as Te } from "url";
|
|
8
8
|
function Ae() {
|
|
9
|
-
return
|
|
10
|
-
}
|
|
11
|
-
function Se() {
|
|
12
|
-
return Ge() && !process.defaultApp;
|
|
9
|
+
return Ge() ? 0 : 1;
|
|
13
10
|
}
|
|
14
11
|
function Ge() {
|
|
12
|
+
return Se() && !process.defaultApp;
|
|
13
|
+
}
|
|
14
|
+
function Se() {
|
|
15
15
|
return !!process.versions.electron;
|
|
16
16
|
}
|
|
17
17
|
function Ce(i) {
|
|
@@ -73,19 +73,19 @@ function Ne(i) {
|
|
|
73
73
|
* Copyright (c) 2016, Contributors
|
|
74
74
|
* SPDX-License-Identifier: ISC
|
|
75
75
|
*/
|
|
76
|
-
var
|
|
76
|
+
var I;
|
|
77
77
|
(function(i) {
|
|
78
78
|
i.BOOLEAN = "boolean", i.STRING = "string", i.NUMBER = "number", i.ARRAY = "array";
|
|
79
|
-
})(
|
|
79
|
+
})(I || (I = {}));
|
|
80
80
|
/**
|
|
81
81
|
* @license
|
|
82
82
|
* Copyright (c) 2016, Contributors
|
|
83
83
|
* SPDX-License-Identifier: ISC
|
|
84
84
|
*/
|
|
85
|
-
let
|
|
85
|
+
let A;
|
|
86
86
|
class Ee {
|
|
87
87
|
constructor(n) {
|
|
88
|
-
|
|
88
|
+
A = n;
|
|
89
89
|
}
|
|
90
90
|
parse(n, m) {
|
|
91
91
|
const s = Object.assign({
|
|
@@ -124,7 +124,7 @@ class Ee {
|
|
|
124
124
|
"strip-aliased": !1,
|
|
125
125
|
"strip-dashed": !1,
|
|
126
126
|
"unknown-options-as-args": !1
|
|
127
|
-
}, s.configuration), f = Object.assign(/* @__PURE__ */ Object.create(null), s.default),
|
|
127
|
+
}, s.configuration), f = Object.assign(/* @__PURE__ */ Object.create(null), s.default), y = s.configObjects || [], P = s.envPrefix, G = h["populate--"], S = G ? "--" : "_", Q = /* @__PURE__ */ Object.create(null), oe = /* @__PURE__ */ Object.create(null), C = s.__ || A.format, r = {
|
|
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 Ee {
|
|
|
136
136
|
nargs: /* @__PURE__ */ Object.create(null),
|
|
137
137
|
coercions: /* @__PURE__ */ Object.create(null),
|
|
138
138
|
keys: []
|
|
139
|
-
},
|
|
139
|
+
}, L = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/, U = new RegExp("^--" + h["negation-prefix"] + "(.+)");
|
|
140
140
|
[].concat(s.array || []).filter(Boolean).forEach(function(e) {
|
|
141
141
|
const a = typeof e == "object" ? e.key : e, l = Object.keys(e).map(function(o) {
|
|
142
142
|
return {
|
|
@@ -169,7 +169,7 @@ class Ee {
|
|
|
169
169
|
f[a] = f[e];
|
|
170
170
|
});
|
|
171
171
|
});
|
|
172
|
-
let
|
|
172
|
+
let B = null;
|
|
173
173
|
Me();
|
|
174
174
|
let F = [];
|
|
175
175
|
const w = Object.assign(/* @__PURE__ */ Object.create(null), { _: [] }), ne = {};
|
|
@@ -186,12 +186,12 @@ class Ee {
|
|
|
186
186
|
else if (a.match(U) && h["boolean-negation"])
|
|
187
187
|
c = a.match(U), c !== null && Array.isArray(c) && c.length >= 2 && (t = c[1], q(t, g(t, r.arrays) ? [!1] : !1));
|
|
188
188
|
else if (a.match(/^--.+/) || !h["short-option-groups"] && a.match(/^-[^-]+/))
|
|
189
|
-
c = a.match(/^--?(.+)/), c !== null && Array.isArray(c) && c.length >= 2 && (t = c[1], g(t, r.arrays) ? e = V(e, t, u) : g(t, r.nargs) !== !1 ? e = D(e, t, u) : (d = u[e + 1], d !== void 0 && (!d.match(/^-/) || d.match(
|
|
189
|
+
c = a.match(/^--?(.+)/), c !== null && Array.isArray(c) && c.length >= 2 && (t = c[1], g(t, r.arrays) ? e = V(e, t, u) : g(t, r.nargs) !== !1 ? e = D(e, t, u) : (d = u[e + 1], d !== void 0 && (!d.match(/^-/) || d.match(L)) && !g(t, r.bools) && !g(t, r.counts) || /^(true|false)$/.test(d) ? (q(t, d), e++) : q(t, R(t))));
|
|
190
190
|
else if (a.match(/^-.\..+=/))
|
|
191
191
|
c = a.match(/^-([^=]+)=([\s\S]*)$/), c !== null && Array.isArray(c) && c.length >= 3 && q(c[1], c[2]);
|
|
192
|
-
else if (a.match(/^-.\..+/) && !a.match(
|
|
193
|
-
d = u[e + 1], c = a.match(/^-(.\..+)/), c !== null && Array.isArray(c) && c.length >= 2 && (t = c[1], d !== void 0 && !d.match(/^-/) && !g(t, r.bools) && !g(t, r.counts) ? (q(t, d), e++) : q(t,
|
|
194
|
-
else if (a.match(/^-[^-]+/) && !a.match(
|
|
192
|
+
else if (a.match(/^-.\..+/) && !a.match(L))
|
|
193
|
+
d = u[e + 1], c = a.match(/^-(.\..+)/), c !== null && Array.isArray(c) && c.length >= 2 && (t = c[1], d !== void 0 && !d.match(/^-/) && !g(t, r.bools) && !g(t, r.counts) ? (q(t, d), e++) : q(t, R(t)));
|
|
194
|
+
else if (a.match(/^-[^-]+/) && !a.match(L)) {
|
|
195
195
|
p = a.slice(1, -1).split(""), o = !1;
|
|
196
196
|
for (let x = 0; x < p.length; x++) {
|
|
197
197
|
if (d = a.slice(x + 2), p[x + 1] && p[x + 1] === "=") {
|
|
@@ -210,11 +210,11 @@ class Ee {
|
|
|
210
210
|
q(p[x], d), o = !0;
|
|
211
211
|
break;
|
|
212
212
|
} else
|
|
213
|
-
q(p[x],
|
|
213
|
+
q(p[x], R(p[x]));
|
|
214
214
|
}
|
|
215
|
-
t = a.slice(-1)[0], !o && t !== "-" && (g(t, r.arrays) ? e = V(e, t, u) : g(t, r.nargs) !== !1 ? e = D(e, t, u) : (d = u[e + 1], d !== void 0 && (!/^(-|--)[^-]/.test(d) || d.match(
|
|
216
|
-
} else if (a.match(/^-[0-9]$/) && a.match(
|
|
217
|
-
t = a.slice(1), q(t,
|
|
215
|
+
t = a.slice(-1)[0], !o && t !== "-" && (g(t, r.arrays) ? e = V(e, t, u) : g(t, r.nargs) !== !1 ? e = D(e, t, u) : (d = u[e + 1], d !== void 0 && (!/^(-|--)[^-]/.test(d) || d.match(L)) && !g(t, r.bools) && !g(t, r.counts) || /^(true|false)$/.test(d) ? (q(t, d), e++) : q(t, R(t))));
|
|
216
|
+
} else if (a.match(/^-[0-9]$/) && a.match(L) && g(a.slice(1), r.bools))
|
|
217
|
+
t = a.slice(1), q(t, R(t));
|
|
218
218
|
else if (a === "--") {
|
|
219
219
|
F = u.slice(e + 1);
|
|
220
220
|
break;
|
|
@@ -225,9 +225,9 @@ class Ee {
|
|
|
225
225
|
K(a);
|
|
226
226
|
}
|
|
227
227
|
re(w, !0), re(w, !1), _e(w), ge(), me(w, r.aliases, f, !0), fe(w), h["set-placeholder-key"] && be(w), Object.keys(r.counts).forEach(function(e) {
|
|
228
|
-
|
|
229
|
-
}),
|
|
230
|
-
w[
|
|
228
|
+
N(w, e.split(".")) || q(e, 0);
|
|
229
|
+
}), G && F.length && (w[S] = []), F.forEach(function(e) {
|
|
230
|
+
w[S].push(e);
|
|
231
231
|
}), h["camel-case-expansion"] && h["strip-dashed"] && Object.keys(w).filter((e) => e !== "--" && e.includes("-")).forEach((e) => {
|
|
232
232
|
delete w[e];
|
|
233
233
|
}), h["strip-aliased"] && [].concat(...Object.keys(k).map((e) => k[e])).forEach((e) => {
|
|
@@ -240,17 +240,17 @@ class Ee {
|
|
|
240
240
|
function D(e, a, l, o) {
|
|
241
241
|
let t, p = g(a, r.nargs);
|
|
242
242
|
if (p = typeof p != "number" || isNaN(p) ? 1 : p, p === 0)
|
|
243
|
-
return
|
|
244
|
-
let c =
|
|
243
|
+
return T(o) || (B = Error(C("Argument unexpected for: %s", a))), q(a, R(a)), e;
|
|
244
|
+
let c = T(o) ? 0 : 1;
|
|
245
245
|
if (h["nargs-eats-options"])
|
|
246
|
-
l.length - (e + 1) + c < p && (
|
|
246
|
+
l.length - (e + 1) + c < p && (B = Error(C("Not enough arguments following: %s", a))), c = p;
|
|
247
247
|
else {
|
|
248
|
-
for (t = e + 1; t < l.length && (!l[t].match(/^-[^0-9]/) || l[t].match(
|
|
248
|
+
for (t = e + 1; t < l.length && (!l[t].match(/^-[^0-9]/) || l[t].match(L) || H(l[t])); t++)
|
|
249
249
|
c++;
|
|
250
|
-
c < p && (
|
|
250
|
+
c < p && (B = Error(C("Not enough arguments following: %s", a)));
|
|
251
251
|
}
|
|
252
252
|
let d = Math.min(c, p);
|
|
253
|
-
for (!
|
|
253
|
+
for (!T(o) && d > 0 && (q(a, o), d--), t = e + 1; t < d + e + 1; t++)
|
|
254
254
|
q(a, l[t]);
|
|
255
255
|
return e + d;
|
|
256
256
|
}
|
|
@@ -259,17 +259,17 @@ class Ee {
|
|
|
259
259
|
const c = g(a, r.nargs);
|
|
260
260
|
if (g(a, r.bools) && !/^(true|false)$/.test(p))
|
|
261
261
|
t.push(!0);
|
|
262
|
-
else if (
|
|
262
|
+
else if (T(p) || T(o) && /^-/.test(p) && !L.test(p) && !H(p)) {
|
|
263
263
|
if (f[a] !== void 0) {
|
|
264
264
|
const d = f[a];
|
|
265
265
|
t = Array.isArray(d) ? d : [d];
|
|
266
266
|
}
|
|
267
267
|
} else {
|
|
268
|
-
|
|
269
|
-
for (let d = e + 1; d < l.length && !(!h["greedy-arrays"] && t.length > 0 || c && typeof c == "number" && t.length >= c || (p = l[d], /^-/.test(p) && !
|
|
268
|
+
T(o) || t.push(Y(a, o, !0));
|
|
269
|
+
for (let d = e + 1; d < l.length && !(!h["greedy-arrays"] && t.length > 0 || c && typeof c == "number" && t.length >= c || (p = l[d], /^-/.test(p) && !L.test(p) && !H(p))); d++)
|
|
270
270
|
e = d, t.push(Y(a, p, _));
|
|
271
271
|
}
|
|
272
|
-
return typeof c == "number" && (c && t.length < c || isNaN(c) && t.length === 0) && (
|
|
272
|
+
return typeof c == "number" && (c && t.length < c || isNaN(c) && t.length === 0) && (B = Error(C("Not enough arguments following: %s", a))), q(a, t), e;
|
|
273
273
|
}
|
|
274
274
|
function q(e, a, l = _) {
|
|
275
275
|
if (/-/.test(e) && h["camel-case-expansion"]) {
|
|
@@ -279,13 +279,13 @@ class Ee {
|
|
|
279
279
|
se(e, p);
|
|
280
280
|
}
|
|
281
281
|
const o = Y(e, a, l), t = e.split(".");
|
|
282
|
-
|
|
282
|
+
E(w, t, o), r.aliases[e] && r.aliases[e].forEach(function(p) {
|
|
283
283
|
const c = p.split(".");
|
|
284
|
-
|
|
284
|
+
E(w, c, o);
|
|
285
285
|
}), t.length > 1 && h["dot-notation"] && (r.aliases[t[0]] || []).forEach(function(p) {
|
|
286
286
|
let c = p.split(".");
|
|
287
287
|
const d = [].concat(t);
|
|
288
|
-
d.shift(), c = c.concat(d), (r.aliases[e] || []).includes(c.join(".")) ||
|
|
288
|
+
d.shift(), c = c.concat(d), (r.aliases[e] || []).includes(c.join(".")) || E(w, c, o);
|
|
289
289
|
}), g(e, r.normalize) && !g(e, r.arrays) && [e].concat(r.aliases[e] || []).forEach(function(c) {
|
|
290
290
|
Object.defineProperty(ne, c, {
|
|
291
291
|
enumerable: !0,
|
|
@@ -293,7 +293,7 @@ class Ee {
|
|
|
293
293
|
return a;
|
|
294
294
|
},
|
|
295
295
|
set(d) {
|
|
296
|
-
a = typeof d == "string" ?
|
|
296
|
+
a = typeof d == "string" ? A.normalize(d) : d;
|
|
297
297
|
}
|
|
298
298
|
});
|
|
299
299
|
});
|
|
@@ -306,10 +306,10 @@ class Ee {
|
|
|
306
306
|
let o = Array.isArray(a) ? a.map(function(t) {
|
|
307
307
|
return $(e, t);
|
|
308
308
|
}) : $(e, a);
|
|
309
|
-
return g(e, r.counts) && (
|
|
309
|
+
return g(e, r.counts) && (T(o) || typeof o == "boolean") && (o = Z()), g(e, r.normalize) && g(e, r.arrays) && (Array.isArray(a) ? o = a.map((t) => A.normalize(t)) : o = A.normalize(a)), o;
|
|
310
310
|
}
|
|
311
311
|
function $(e, a) {
|
|
312
|
-
return !h["parse-positional-numbers"] && e === "_" || !g(e, r.strings) && !g(e, r.bools) && !Array.isArray(a) && (Re(a) && h["parse-numbers"] && Number.isSafeInteger(Math.floor(parseFloat(`${a}`))) || !
|
|
312
|
+
return !h["parse-positional-numbers"] && e === "_" || !g(e, r.strings) && !g(e, r.bools) && !Array.isArray(a) && (Re(a) && h["parse-numbers"] && Number.isSafeInteger(Math.floor(parseFloat(`${a}`))) || !T(a) && g(e, r.numbers)) && (a = Number(a)), a;
|
|
313
313
|
}
|
|
314
314
|
function _e(e) {
|
|
315
315
|
const a = /* @__PURE__ */ Object.create(null);
|
|
@@ -318,7 +318,7 @@ class Ee {
|
|
|
318
318
|
if (o)
|
|
319
319
|
try {
|
|
320
320
|
let t = null;
|
|
321
|
-
const p =
|
|
321
|
+
const p = A.resolve(A.cwd(), o), c = r.configs[l];
|
|
322
322
|
if (typeof c == "function") {
|
|
323
323
|
try {
|
|
324
324
|
t = c(p);
|
|
@@ -326,38 +326,38 @@ class Ee {
|
|
|
326
326
|
t = d;
|
|
327
327
|
}
|
|
328
328
|
if (t instanceof Error) {
|
|
329
|
-
|
|
329
|
+
B = t;
|
|
330
330
|
return;
|
|
331
331
|
}
|
|
332
332
|
} else
|
|
333
|
-
t =
|
|
333
|
+
t = A.require(p);
|
|
334
334
|
J(t);
|
|
335
335
|
} catch (t) {
|
|
336
|
-
t.name === "PermissionDenied" ?
|
|
336
|
+
t.name === "PermissionDenied" ? B = t : e[l] && (B = Error(C("Invalid JSON config file: %s", o)));
|
|
337
337
|
}
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
340
|
function J(e, a) {
|
|
341
341
|
Object.keys(e).forEach(function(l) {
|
|
342
342
|
const o = e[l], t = a ? a + "." + l : l;
|
|
343
|
-
typeof o == "object" && o !== null && !Array.isArray(o) && h["dot-notation"] ? J(o, t) : (!
|
|
343
|
+
typeof o == "object" && o !== null && !Array.isArray(o) && h["dot-notation"] ? J(o, t) : (!N(w, t.split(".")) || g(t, r.arrays) && h["combine-arrays"]) && q(t, o);
|
|
344
344
|
});
|
|
345
345
|
}
|
|
346
346
|
function ge() {
|
|
347
|
-
typeof
|
|
347
|
+
typeof y < "u" && y.forEach(function(e) {
|
|
348
348
|
J(e);
|
|
349
349
|
});
|
|
350
350
|
}
|
|
351
351
|
function re(e, a) {
|
|
352
|
-
if (typeof
|
|
352
|
+
if (typeof P > "u")
|
|
353
353
|
return;
|
|
354
|
-
const l = typeof
|
|
354
|
+
const l = typeof P == "string" ? P : "", o = A.env();
|
|
355
355
|
Object.keys(o).forEach(function(t) {
|
|
356
356
|
if (l === "" || t.lastIndexOf(l, 0) === 0) {
|
|
357
357
|
const p = t.split("__").map(function(c, d) {
|
|
358
358
|
return d === 0 && (c = c.substring(l.length)), W(c);
|
|
359
359
|
});
|
|
360
|
-
(a && r.configs[p.join(".")] || !a) && !
|
|
360
|
+
(a && r.configs[p.join(".")] || !a) && !N(e, p) && q(p.join("."), o[t]);
|
|
361
361
|
}
|
|
362
362
|
});
|
|
363
363
|
}
|
|
@@ -372,7 +372,7 @@ class Ee {
|
|
|
372
372
|
l.add(p), e[p] = t;
|
|
373
373
|
});
|
|
374
374
|
} catch (t) {
|
|
375
|
-
|
|
375
|
+
B = t;
|
|
376
376
|
}
|
|
377
377
|
});
|
|
378
378
|
}
|
|
@@ -383,12 +383,12 @@ class Ee {
|
|
|
383
383
|
}
|
|
384
384
|
function me(e, a, l, o = !1) {
|
|
385
385
|
Object.keys(l).forEach(function(t) {
|
|
386
|
-
|
|
387
|
-
|
|
386
|
+
N(e, t.split(".")) || (E(e, t.split("."), l[t]), o && (oe[t] = !0), (a[t] || []).forEach(function(p) {
|
|
387
|
+
N(e, p.split(".")) || E(e, p.split("."), l[t]);
|
|
388
388
|
}));
|
|
389
389
|
});
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function N(e, a) {
|
|
392
392
|
let l = e;
|
|
393
393
|
h["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(t) {
|
|
394
394
|
l = l[t] || {};
|
|
@@ -396,14 +396,14 @@ class Ee {
|
|
|
396
396
|
const o = a[a.length - 1];
|
|
397
397
|
return typeof l != "object" ? !1 : o in l;
|
|
398
398
|
}
|
|
399
|
-
function
|
|
399
|
+
function E(e, a, l) {
|
|
400
400
|
let o = e;
|
|
401
401
|
h["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(v) {
|
|
402
402
|
v = le(v), typeof o == "object" && o[v] === void 0 && (o[v] = {}), typeof o[v] != "object" || Array.isArray(o[v]) ? (Array.isArray(o[v]) ? o[v].push({}) : o[v] = [o[v], {}], o = o[v][o[v].length - 1]) : o = o[v];
|
|
403
403
|
});
|
|
404
404
|
const t = le(a[a.length - 1]), p = g(a.join("."), r.arrays), c = Array.isArray(l);
|
|
405
405
|
let d = h["duplicate-arguments-array"];
|
|
406
|
-
!d && g(t, r.nargs) && (d = !0, (!
|
|
406
|
+
!d && g(t, r.nargs) && (d = !0, (!T(o[t]) && r.nargs[t] === 1 || Array.isArray(o[t]) && o[t].length === r.nargs[t]) && (o[t] = void 0)), l === Z() ? o[t] = Z(o[t]) : Array.isArray(o[t]) ? d && p && c ? o[t] = h["flatten-duplicate-arrays"] ? o[t].concat(l) : (Array.isArray(o[t][0]) ? o[t] : [o[t]]).concat([l]) : !d && !!p == !!c ? o[t] = l : o[t] = o[t].concat([l]) : o[t] === void 0 && p ? o[t] = c ? l : [l] : d && !(o[t] === void 0 || g(t, r.counts) || g(t, r.bools)) ? o[t] = [o[t], l] : o[t] = l;
|
|
407
407
|
}
|
|
408
408
|
function qe(...e) {
|
|
409
409
|
e.forEach(function(a) {
|
|
@@ -443,7 +443,7 @@ class Ee {
|
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
445
|
function ve(e) {
|
|
446
|
-
if (e.match(
|
|
446
|
+
if (e.match(L) || !e.match(/^-[^-]+/))
|
|
447
447
|
return !1;
|
|
448
448
|
let a = !0, l;
|
|
449
449
|
const o = e.slice(1).split("");
|
|
@@ -461,35 +461,35 @@ class Ee {
|
|
|
461
461
|
return h["unknown-options-as-args"] && xe(e);
|
|
462
462
|
}
|
|
463
463
|
function xe(e) {
|
|
464
|
-
return e = e.replace(/^-{3,}/, "--"), e.match(
|
|
464
|
+
return e = e.replace(/^-{3,}/, "--"), e.match(L) || ve(e) ? !1 : !we(e, /^-+([^=]+?)=[\s\S]*$/, U, /^-+([^=]+?)$/, /^-+([^=]+?)-$/, /^-+([^=]+?\d+)$/, /^-+([^=]+?)\W+.*$/);
|
|
465
465
|
}
|
|
466
|
-
function
|
|
466
|
+
function R(e) {
|
|
467
467
|
return !g(e, r.bools) && !g(e, r.counts) && `${e}` in f ? f[e] : ye(Be(e));
|
|
468
468
|
}
|
|
469
469
|
function ye(e) {
|
|
470
470
|
return {
|
|
471
|
-
[
|
|
472
|
-
[
|
|
473
|
-
[
|
|
474
|
-
[
|
|
471
|
+
[I.BOOLEAN]: !0,
|
|
472
|
+
[I.STRING]: "",
|
|
473
|
+
[I.NUMBER]: void 0,
|
|
474
|
+
[I.ARRAY]: []
|
|
475
475
|
}[e];
|
|
476
476
|
}
|
|
477
477
|
function Be(e) {
|
|
478
|
-
let a =
|
|
479
|
-
return g(e, r.strings) ? a =
|
|
478
|
+
let a = I.BOOLEAN;
|
|
479
|
+
return g(e, r.strings) ? a = I.STRING : g(e, r.numbers) ? a = I.NUMBER : g(e, r.bools) ? a = I.BOOLEAN : g(e, r.arrays) && (a = I.ARRAY), a;
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function T(e) {
|
|
482
482
|
return e === void 0;
|
|
483
483
|
}
|
|
484
484
|
function Me() {
|
|
485
|
-
Object.keys(r.counts).find((e) => g(e, r.arrays) ? (
|
|
485
|
+
Object.keys(r.counts).find((e) => g(e, r.arrays) ? (B = Error(C("Invalid configuration: %s, opts.count excludes opts.array.", e)), !0) : g(e, r.nargs) ? (B = Error(C("Invalid configuration: %s, opts.count excludes opts.narg.", e)), !0) : !1);
|
|
486
486
|
}
|
|
487
487
|
return {
|
|
488
488
|
aliases: Object.assign({}, r.aliases),
|
|
489
489
|
argv: Object.assign(ne, w),
|
|
490
490
|
configuration: h,
|
|
491
491
|
defaulted: Object.assign({}, oe),
|
|
492
|
-
error:
|
|
492
|
+
error: B,
|
|
493
493
|
newAliases: Object.assign({}, Q)
|
|
494
494
|
};
|
|
495
495
|
}
|
|
@@ -571,7 +571,7 @@ const Fe = {
|
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
};
|
|
574
|
-
let
|
|
574
|
+
let M;
|
|
575
575
|
class De {
|
|
576
576
|
constructor(n) {
|
|
577
577
|
n = n || {}, this.directory = n.directory || "./locales", this.updateFiles = typeof n.updateFiles == "boolean" ? n.updateFiles : !0, this.locale = n.locale || "en", this.fallbackToLanguage = typeof n.fallbackToLanguage == "boolean" ? n.fallbackToLanguage : !0, this.cache = /* @__PURE__ */ Object.create(null), this.writeQueue = [];
|
|
@@ -587,7 +587,7 @@ class De {
|
|
|
587
587
|
directory: this.directory,
|
|
588
588
|
locale: this.locale,
|
|
589
589
|
cb: s
|
|
590
|
-
})) : s(),
|
|
590
|
+
})) : s(), M.format.apply(M.format, [this.cache[this.locale][m] || m].concat(n));
|
|
591
591
|
}
|
|
592
592
|
__n() {
|
|
593
593
|
const n = Array.prototype.slice.call(arguments), m = n.shift(), s = n.shift(), u = n.shift();
|
|
@@ -604,7 +604,7 @@ class De {
|
|
|
604
604
|
cb: _
|
|
605
605
|
})) : _();
|
|
606
606
|
const h = [k];
|
|
607
|
-
return ~k.indexOf("%d") && h.push(u),
|
|
607
|
+
return ~k.indexOf("%d") && h.push(u), M.format.apply(M.format, h.concat(n));
|
|
608
608
|
}
|
|
609
609
|
setLocale(n) {
|
|
610
610
|
this.locale = n;
|
|
@@ -629,7 +629,7 @@ class De {
|
|
|
629
629
|
}
|
|
630
630
|
_processWriteQueue() {
|
|
631
631
|
const n = this, m = this.writeQueue[0], s = m.directory, u = m.locale, _ = m.cb, k = this._resolveLocaleFile(s, u), h = JSON.stringify(this.cache[u], null, 2);
|
|
632
|
-
|
|
632
|
+
M.fs.writeFile(k, h, "utf-8", function(f) {
|
|
633
633
|
n.writeQueue.shift(), n.writeQueue.length > 0 && n._processWriteQueue(), _(f);
|
|
634
634
|
});
|
|
635
635
|
}
|
|
@@ -637,7 +637,7 @@ class De {
|
|
|
637
637
|
let n = {};
|
|
638
638
|
const m = this._resolveLocaleFile(this.directory, this.locale);
|
|
639
639
|
try {
|
|
640
|
-
|
|
640
|
+
M.fs.readFileSync && (n = JSON.parse(M.fs.readFileSync(m, "utf-8")));
|
|
641
641
|
} catch (s) {
|
|
642
642
|
if (s instanceof SyntaxError && (s.message = "syntax error in " + m), s.code === "ENOENT")
|
|
643
643
|
n = {};
|
|
@@ -647,19 +647,19 @@ class De {
|
|
|
647
647
|
this.cache[this.locale] = n;
|
|
648
648
|
}
|
|
649
649
|
_resolveLocaleFile(n, m) {
|
|
650
|
-
let s =
|
|
650
|
+
let s = M.resolve(n, "./", m + ".json");
|
|
651
651
|
if (this.fallbackToLanguage && !this._fileExistsSync(s) && ~m.lastIndexOf("_")) {
|
|
652
|
-
const u =
|
|
652
|
+
const u = M.resolve(n, "./", m.split("_")[0] + ".json");
|
|
653
653
|
this._fileExistsSync(u) && (s = u);
|
|
654
654
|
}
|
|
655
655
|
return s;
|
|
656
656
|
}
|
|
657
657
|
_fileExistsSync(n) {
|
|
658
|
-
return
|
|
658
|
+
return M.exists(n);
|
|
659
659
|
}
|
|
660
660
|
}
|
|
661
661
|
function Ve(i, n) {
|
|
662
|
-
|
|
662
|
+
M = n;
|
|
663
663
|
const m = new De(i);
|
|
664
664
|
return {
|
|
665
665
|
__: m.__.bind(m),
|
|
@@ -671,15 +671,15 @@ function Ve(i, n) {
|
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
673
|
const $e = (i) => Ve(i, Fe);
|
|
674
|
-
let
|
|
674
|
+
let z;
|
|
675
675
|
try {
|
|
676
|
-
|
|
676
|
+
z = Te(import.meta.url);
|
|
677
677
|
} catch {
|
|
678
|
-
|
|
678
|
+
z = process.cwd();
|
|
679
679
|
}
|
|
680
|
-
const He =
|
|
680
|
+
const He = z.substring(0, z.lastIndexOf("node_modules"));
|
|
681
681
|
He || process.cwd(), process.cwd, process.exit, process.nextTick, typeof process.stdout.columns < "u" && process.stdout.columns, $e({
|
|
682
|
-
directory: ae(
|
|
682
|
+
directory: ae(z, "../../../locales"),
|
|
683
683
|
updateFiles: !1
|
|
684
684
|
});
|
|
685
685
|
const ie = [
|
|
@@ -2385,6 +2385,43 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
2385
2385
|
required: !1
|
|
2386
2386
|
}
|
|
2387
2387
|
]
|
|
2388
|
+
},
|
|
2389
|
+
{
|
|
2390
|
+
api_flavor: "anthropic",
|
|
2391
|
+
root: "usage",
|
|
2392
|
+
model_path: "model",
|
|
2393
|
+
mappings: [
|
|
2394
|
+
{
|
|
2395
|
+
path: "input_tokens",
|
|
2396
|
+
dest: "input_tokens",
|
|
2397
|
+
required: !0
|
|
2398
|
+
},
|
|
2399
|
+
{
|
|
2400
|
+
path: "cache_creation_input_tokens",
|
|
2401
|
+
dest: "input_tokens",
|
|
2402
|
+
required: !1
|
|
2403
|
+
},
|
|
2404
|
+
{
|
|
2405
|
+
path: "cache_read_input_tokens",
|
|
2406
|
+
dest: "input_tokens",
|
|
2407
|
+
required: !1
|
|
2408
|
+
},
|
|
2409
|
+
{
|
|
2410
|
+
path: "cache_creation_input_tokens",
|
|
2411
|
+
dest: "cache_write_tokens",
|
|
2412
|
+
required: !1
|
|
2413
|
+
},
|
|
2414
|
+
{
|
|
2415
|
+
path: "cache_read_input_tokens",
|
|
2416
|
+
dest: "cache_read_tokens",
|
|
2417
|
+
required: !1
|
|
2418
|
+
},
|
|
2419
|
+
{
|
|
2420
|
+
path: "output_tokens",
|
|
2421
|
+
dest: "output_tokens",
|
|
2422
|
+
required: !0
|
|
2423
|
+
}
|
|
2424
|
+
]
|
|
2388
2425
|
}
|
|
2389
2426
|
],
|
|
2390
2427
|
models: [
|
|
@@ -6150,7 +6187,14 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
6150
6187
|
id: "gemini-2.5-flash",
|
|
6151
6188
|
name: "Gemini 2.5 Flash",
|
|
6152
6189
|
match: {
|
|
6153
|
-
|
|
6190
|
+
or: [
|
|
6191
|
+
{
|
|
6192
|
+
equals: "gemini-2.5-flash"
|
|
6193
|
+
},
|
|
6194
|
+
{
|
|
6195
|
+
equals: "google/gemini-2.5-flash"
|
|
6196
|
+
}
|
|
6197
|
+
]
|
|
6154
6198
|
},
|
|
6155
6199
|
prices: {
|
|
6156
6200
|
input_mtok: 0.3,
|
|
@@ -6489,6 +6533,48 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
6489
6533
|
},
|
|
6490
6534
|
prices: {}
|
|
6491
6535
|
},
|
|
6536
|
+
{
|
|
6537
|
+
id: "google/gemini-2.5-flash-image",
|
|
6538
|
+
name: "Gemini 2.5 Flash Image (Nano Banana)",
|
|
6539
|
+
match: {
|
|
6540
|
+
or: [
|
|
6541
|
+
{
|
|
6542
|
+
equals: "google/gemini-2.5-flash-image"
|
|
6543
|
+
},
|
|
6544
|
+
{
|
|
6545
|
+
equals: "google/gemini-2.5-flash-image-preview"
|
|
6546
|
+
}
|
|
6547
|
+
]
|
|
6548
|
+
},
|
|
6549
|
+
prices: {
|
|
6550
|
+
input_mtok: 0.3,
|
|
6551
|
+
output_mtok: 2.5
|
|
6552
|
+
}
|
|
6553
|
+
},
|
|
6554
|
+
{
|
|
6555
|
+
id: "google/gemini-2.5-flash-lite",
|
|
6556
|
+
name: "Gemini 2.5 Flash Lite",
|
|
6557
|
+
match: {
|
|
6558
|
+
equals: "google/gemini-2.5-flash-lite"
|
|
6559
|
+
},
|
|
6560
|
+
prices: {
|
|
6561
|
+
input_mtok: 0.1,
|
|
6562
|
+
cache_write_mtok: 0.183,
|
|
6563
|
+
cache_read_mtok: 0.025,
|
|
6564
|
+
output_mtok: 0.4
|
|
6565
|
+
}
|
|
6566
|
+
},
|
|
6567
|
+
{
|
|
6568
|
+
id: "google/gemini-2.5-flash-lite-preview-09-2025",
|
|
6569
|
+
name: "Gemini 2.5 Flash Lite Preview 09-2025",
|
|
6570
|
+
match: {
|
|
6571
|
+
equals: "google/gemini-2.5-flash-lite-preview-09-2025"
|
|
6572
|
+
},
|
|
6573
|
+
prices: {
|
|
6574
|
+
input_mtok: 0.1,
|
|
6575
|
+
output_mtok: 0.4
|
|
6576
|
+
}
|
|
6577
|
+
},
|
|
6492
6578
|
{
|
|
6493
6579
|
id: "google/gemini-2.5-flash-preview",
|
|
6494
6580
|
match: {
|
|
@@ -6499,6 +6585,19 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
6499
6585
|
output_mtok: 0.6
|
|
6500
6586
|
}
|
|
6501
6587
|
},
|
|
6588
|
+
{
|
|
6589
|
+
id: "google/gemini-2.5-flash-preview-09-2025",
|
|
6590
|
+
name: "Gemini 2.5 Flash Preview 09-2025",
|
|
6591
|
+
match: {
|
|
6592
|
+
equals: "google/gemini-2.5-flash-preview-09-2025"
|
|
6593
|
+
},
|
|
6594
|
+
prices: {
|
|
6595
|
+
input_mtok: 0.3,
|
|
6596
|
+
cache_write_mtok: 0.383,
|
|
6597
|
+
cache_read_mtok: 0.075,
|
|
6598
|
+
output_mtok: 2.5
|
|
6599
|
+
}
|
|
6600
|
+
},
|
|
6502
6601
|
{
|
|
6503
6602
|
id: "google/gemini-2.5-flash-preview:thinking",
|
|
6504
6603
|
match: {
|
|
@@ -11723,22 +11822,36 @@ function We(i, n) {
|
|
|
11723
11822
|
const s = [...i.tiers].sort((k, h) => k.start - h.start), u = s[0]?.start ?? n, _ = Math.min(n, u);
|
|
11724
11823
|
m += _ * i.base / 1e6;
|
|
11725
11824
|
for (let k = 0; k < s.length; k++) {
|
|
11726
|
-
const h = s[k], f = s[k + 1]?.start ?? 1 / 0,
|
|
11727
|
-
|
|
11825
|
+
const h = s[k], f = s[k + 1]?.start ?? 1 / 0, y = Math.max(0, Math.min(n, f) - h.start);
|
|
11826
|
+
y > 0 && (m += y * h.price / 1e6);
|
|
11728
11827
|
}
|
|
11729
11828
|
return m;
|
|
11730
11829
|
}
|
|
11731
|
-
function
|
|
11830
|
+
function O(i, n, m) {
|
|
11732
11831
|
return i === void 0 || n === void 0 ? 0 : typeof i == "number" ? i * n / 1e6 : We(i, n);
|
|
11733
11832
|
}
|
|
11734
11833
|
function Ue(i, n) {
|
|
11735
11834
|
let m = 0, s = 0;
|
|
11736
|
-
|
|
11737
|
-
|
|
11738
|
-
|
|
11835
|
+
const u = i.cache_read_tokens ?? 0, _ = i.cache_write_tokens ?? 0, k = i.cache_audio_read_tokens ?? 0, h = i.output_audio_tokens ?? 0;
|
|
11836
|
+
let f = i.input_audio_tokens ?? 0;
|
|
11837
|
+
if (f -= k, f < 0)
|
|
11838
|
+
throw new Error("cache_audio_read_tokens cannot be greater than input_audio_tokens");
|
|
11839
|
+
let y = i.input_tokens ?? 0;
|
|
11840
|
+
if (y -= u, y -= _, y -= f, y < 0)
|
|
11841
|
+
throw new Error("Uncached text input tokens cannot be negative");
|
|
11842
|
+
let P = u;
|
|
11843
|
+
if (P -= k, P < 0)
|
|
11844
|
+
throw new Error("cache_audio_read_tokens cannot be greater than cache_read_tokens");
|
|
11845
|
+
m += O(n.input_mtok, y), m += O(n.cache_read_mtok, P), m += O(n.cache_write_mtok, _), m += O(n.input_audio_mtok, f), m += O(n.cache_audio_read_mtok, k);
|
|
11846
|
+
let G = i.output_tokens ?? 0;
|
|
11847
|
+
if (G -= h, G < 0)
|
|
11848
|
+
throw new Error("output_audio_tokens cannot be greater than output_tokens");
|
|
11849
|
+
s += O(n.output_mtok, G), s += O(n.output_audio_mtok, i.output_audio_tokens);
|
|
11850
|
+
let S = m + s;
|
|
11851
|
+
return n.requests_kcount !== void 0 && (S += n.requests_kcount / 1e3), {
|
|
11739
11852
|
input_price: m,
|
|
11740
11853
|
output_price: s,
|
|
11741
|
-
total_price:
|
|
11854
|
+
total_price: S
|
|
11742
11855
|
};
|
|
11743
11856
|
}
|
|
11744
11857
|
function Ke(i, n) {
|
|
@@ -11762,12 +11875,12 @@ function Ke(i, n) {
|
|
|
11762
11875
|
}
|
|
11763
11876
|
return i.prices[0].prices;
|
|
11764
11877
|
}
|
|
11765
|
-
function
|
|
11766
|
-
return "or" in i ? i.or.some((m) =>
|
|
11878
|
+
function j(i, n) {
|
|
11879
|
+
return "or" in i ? i.or.some((m) => j(m, n)) : "and" in i ? i.and.every((m) => j(m, n)) : "equals" in i ? n === i.equals : "starts_with" in i ? n.startsWith(i.starts_with) : "ends_with" in i ? n.endsWith(i.ends_with) : "contains" in i ? n.includes(i.contains) : "regex" in i ? new RegExp(i.regex).test(n) : !1;
|
|
11767
11880
|
}
|
|
11768
11881
|
function Ye(i, n) {
|
|
11769
11882
|
const m = n.toLowerCase().trim(), s = i.find((u) => u.id === m);
|
|
11770
|
-
return s || i.find((u) => u.provider_match &&
|
|
11883
|
+
return s || i.find((u) => u.provider_match && j(u.provider_match, m));
|
|
11771
11884
|
}
|
|
11772
11885
|
function Je(i, { modelId: n, providerApiUrl: m, providerId: s }) {
|
|
11773
11886
|
if (s)
|
|
@@ -11775,10 +11888,10 @@ function Je(i, { modelId: n, providerApiUrl: m, providerId: s }) {
|
|
|
11775
11888
|
if (m)
|
|
11776
11889
|
return i.find((u) => new RegExp(u.api_pattern).test(m));
|
|
11777
11890
|
if (n)
|
|
11778
|
-
return i.find((u) => u.model_match &&
|
|
11891
|
+
return i.find((u) => u.model_match && j(u.model_match, n));
|
|
11779
11892
|
}
|
|
11780
11893
|
function Ze(i, n) {
|
|
11781
|
-
return i.find((m) =>
|
|
11894
|
+
return i.find((m) => j(m.match, n));
|
|
11782
11895
|
}
|
|
11783
11896
|
let Xe = ie;
|
|
11784
11897
|
Promise.resolve(ie);
|
|
@@ -11843,17 +11956,17 @@ function tt() {
|
|
|
11843
11956
|
u = !0, console.error(`No price found for model ${_}`);
|
|
11844
11957
|
continue;
|
|
11845
11958
|
}
|
|
11846
|
-
const
|
|
11959
|
+
const y = f.model.context_window, P = [
|
|
11847
11960
|
["Provider", f.provider.name],
|
|
11848
11961
|
["Model", f.model.name ?? f.model.id],
|
|
11849
11962
|
["Model Prices", JSON.stringify(f.model_price)],
|
|
11850
|
-
["Context Window",
|
|
11963
|
+
["Context Window", y !== void 0 ? y.toLocaleString() : void 0],
|
|
11851
11964
|
["Total Price", `$${f.total_price}`],
|
|
11852
11965
|
["Input Price", `$${f.input_price}`],
|
|
11853
11966
|
["Output Price", `$${f.output_price}`]
|
|
11854
11967
|
];
|
|
11855
|
-
for (const [
|
|
11856
|
-
|
|
11968
|
+
for (const [G, S] of P)
|
|
11969
|
+
S !== void 0 && console.log(`${G.padStart(14)}: ${S}`);
|
|
11857
11970
|
console.log("");
|
|
11858
11971
|
} catch (f) {
|
|
11859
11972
|
u = !0, f instanceof Error && console.error(`Error for model ${_}:`, f.message);
|