@pydantic/genai-prices 0.0.63 → 0.0.64
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 +326 -79
- package/dist/index.cjs +2 -2
- package/dist/index.js +255 -8
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import he from "yargs";
|
|
3
3
|
import { format as ke } from "util";
|
|
4
|
-
import { resolve as oe, normalize as
|
|
5
|
-
import { readFileSync as ge, writeFile as
|
|
4
|
+
import { resolve as oe, normalize as Qe } from "path";
|
|
5
|
+
import { readFileSync as ge, writeFile as Pe, statSync as Se } from "fs";
|
|
6
6
|
import "assert";
|
|
7
|
-
import { fileURLToPath as
|
|
7
|
+
import { fileURLToPath as Te } from "url";
|
|
8
8
|
function Ge() {
|
|
9
9
|
return Ce() ? 0 : 1;
|
|
10
10
|
}
|
|
@@ -35,7 +35,7 @@ function W(i) {
|
|
|
35
35
|
return u;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function Ne(i, o) {
|
|
39
39
|
const u = i.toLowerCase();
|
|
40
40
|
o = o || "-";
|
|
41
41
|
let s = "";
|
|
@@ -45,7 +45,7 @@ function Oe(i, o) {
|
|
|
45
45
|
}
|
|
46
46
|
return s;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function Oe(i) {
|
|
49
49
|
return i == null ? !1 : typeof i == "number" || /^0x[0-9a-f]+$/i.test(i) ? !0 : /^0[^.]/.test(i) ? !1 : /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i);
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
@@ -73,10 +73,10 @@ function Ee(i) {
|
|
|
73
73
|
* Copyright (c) 2016, Contributors
|
|
74
74
|
* SPDX-License-Identifier: ISC
|
|
75
75
|
*/
|
|
76
|
-
var
|
|
76
|
+
var Q;
|
|
77
77
|
(function(i) {
|
|
78
78
|
i.BOOLEAN = "boolean", i.STRING = "string", i.NUMBER = "number", i.ARRAY = "array";
|
|
79
|
-
})(
|
|
79
|
+
})(Q || (Q = {}));
|
|
80
80
|
/**
|
|
81
81
|
* @license
|
|
82
82
|
* Copyright (c) 2016, Contributors
|
|
@@ -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),
|
|
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 = {
|
|
128
128
|
aliases: /* @__PURE__ */ Object.create(null),
|
|
129
129
|
arrays: /* @__PURE__ */ Object.create(null),
|
|
130
130
|
bools: /* @__PURE__ */ Object.create(null),
|
|
@@ -172,7 +172,7 @@ class De {
|
|
|
172
172
|
let L = null;
|
|
173
173
|
Ae();
|
|
174
174
|
let V = [];
|
|
175
|
-
const
|
|
175
|
+
const b = Object.assign(/* @__PURE__ */ Object.create(null), { _: [] }), se = {};
|
|
176
176
|
for (let e = 0; e < r.length; e++) {
|
|
177
177
|
const a = r[e], c = a.replace(/^-{3,}/, "---");
|
|
178
178
|
let n, t, l, p, d, v;
|
|
@@ -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]) :
|
|
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));
|
|
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],
|
|
187
|
+
p = a.match(U), p !== null && Array.isArray(p) && p.length >= 2 && (t = p[1], w(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) ? (
|
|
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))));
|
|
190
190
|
else if (a.match(/^-.\..+=/))
|
|
191
|
-
p = a.match(/^-([^=]+)=([\s\S]*)$/), p !== null && Array.isArray(p) && p.length >= 3 &&
|
|
191
|
+
p = a.match(/^-([^=]+)=([\s\S]*)$/), p !== null && Array.isArray(p) && p.length >= 3 && w(p[1], p[2]);
|
|
192
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) ? (
|
|
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
194
|
else if (a.match(/^-[^-]+/) && !a.match(I)) {
|
|
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) :
|
|
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;
|
|
199
199
|
break;
|
|
200
200
|
}
|
|
201
201
|
if (d === "-") {
|
|
202
|
-
|
|
202
|
+
w(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
|
-
|
|
206
|
+
w(l[x], d), n = !0;
|
|
207
207
|
break;
|
|
208
208
|
}
|
|
209
209
|
if (l[x + 1] && l[x + 1].match(/\W/)) {
|
|
210
|
-
|
|
210
|
+
w(l[x], d), n = !0;
|
|
211
211
|
break;
|
|
212
212
|
} else
|
|
213
|
-
|
|
213
|
+
w(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) ? (
|
|
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
216
|
} else if (a.match(/^-[0-9]$/) && a.match(I) && g(a.slice(1), m.bools))
|
|
217
|
-
t = a.slice(1),
|
|
217
|
+
t = a.slice(1), w(t, R(t));
|
|
218
218
|
else if (a === "--") {
|
|
219
219
|
V = r.slice(e + 1);
|
|
220
220
|
break;
|
|
@@ -224,23 +224,23 @@ class De {
|
|
|
224
224
|
} else
|
|
225
225
|
Y(a);
|
|
226
226
|
}
|
|
227
|
-
me(
|
|
228
|
-
|
|
229
|
-
}),
|
|
230
|
-
|
|
231
|
-
}), k["camel-case-expansion"] && k["strip-dashed"] && Object.keys(
|
|
232
|
-
delete
|
|
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);
|
|
231
|
+
}), k["camel-case-expansion"] && k["strip-dashed"] && Object.keys(b).filter((e) => e !== "--" && e.includes("-")).forEach((e) => {
|
|
232
|
+
delete b[e];
|
|
233
233
|
}), k["strip-aliased"] && [].concat(...Object.keys(_).map((e) => _[e])).forEach((e) => {
|
|
234
|
-
k["camel-case-expansion"] && e.includes("-") && delete
|
|
234
|
+
k["camel-case-expansion"] && e.includes("-") && delete b[e.split(".").map((a) => W(a)).join(".")], delete b[e];
|
|
235
235
|
});
|
|
236
236
|
function Y(e) {
|
|
237
237
|
const a = H("_", e);
|
|
238
|
-
(typeof a == "string" || typeof a == "number") &&
|
|
238
|
+
(typeof a == "string" || typeof a == "number") && b._.push(a);
|
|
239
239
|
}
|
|
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))),
|
|
243
|
+
return G(n) || (L = Error(M("Argument unexpected for: %s", a))), w(a, R(a)), e;
|
|
244
244
|
let p = G(n) ? 0 : 1;
|
|
245
245
|
if (k["nargs-eats-options"])
|
|
246
246
|
c.length - (e + 1) + p < l && (L = Error(M("Not enough arguments following: %s", a))), p = l;
|
|
@@ -250,8 +250,8 @@ class De {
|
|
|
250
250
|
p < l && (L = Error(M("Not enough arguments following: %s", a)));
|
|
251
251
|
}
|
|
252
252
|
let d = Math.min(p, l);
|
|
253
|
-
for (!G(n) && d > 0 && (
|
|
254
|
-
|
|
253
|
+
for (!G(n) && d > 0 && (w(a, n), d--), t = e + 1; t < d + e + 1; t++)
|
|
254
|
+
w(a, c[t]);
|
|
255
255
|
return e + d;
|
|
256
256
|
}
|
|
257
257
|
function K(e, a, c, n) {
|
|
@@ -269,9 +269,9 @@ class De {
|
|
|
269
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
270
|
e = d, t.push(J(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))),
|
|
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;
|
|
273
273
|
}
|
|
274
|
-
function
|
|
274
|
+
function w(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);
|
|
@@ -279,13 +279,13 @@ class De {
|
|
|
279
279
|
re(e, l);
|
|
280
280
|
}
|
|
281
281
|
const n = J(e, a, c), t = e.split(".");
|
|
282
|
-
E(
|
|
282
|
+
E(b, t, n), m.aliases[e] && m.aliases[e].forEach(function(l) {
|
|
283
283
|
const p = l.split(".");
|
|
284
|
-
E(
|
|
284
|
+
E(b, p, n);
|
|
285
285
|
}), t.length > 1 && k["dot-notation"] && (m.aliases[t[0]] || []).forEach(function(l) {
|
|
286
286
|
let p = l.split(".");
|
|
287
287
|
const d = [].concat(t);
|
|
288
|
-
d.shift(), p = p.concat(d), (m.aliases[e] || []).includes(p.join(".")) || E(
|
|
288
|
+
d.shift(), p = p.concat(d), (m.aliases[e] || []).includes(p.join(".")) || E(b, p, n);
|
|
289
289
|
}), g(e, m.normalize) && !g(e, m.arrays) && [e].concat(m.aliases[e] || []).forEach(function(p) {
|
|
290
290
|
Object.defineProperty(se, p, {
|
|
291
291
|
enumerable: !0,
|
|
@@ -299,7 +299,7 @@ class De {
|
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
301
|
function re(e, a) {
|
|
302
|
-
m.aliases[e] && m.aliases[e].length || (m.aliases[e] = [a],
|
|
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
304
|
function J(e, a, c) {
|
|
305
305
|
c && (a = Ve(a)), (g(e, m.bools) || g(e, m.counts)) && typeof a == "string" && (a = a === "true");
|
|
@@ -309,7 +309,7 @@ class De {
|
|
|
309
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;
|
|
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) && (
|
|
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;
|
|
313
313
|
}
|
|
314
314
|
function fe(e) {
|
|
315
315
|
const a = /* @__PURE__ */ Object.create(null);
|
|
@@ -340,11 +340,11 @@ class De {
|
|
|
340
340
|
function Z(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) : (!
|
|
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);
|
|
344
344
|
});
|
|
345
345
|
}
|
|
346
|
-
function
|
|
347
|
-
typeof
|
|
346
|
+
function we() {
|
|
347
|
+
typeof S < "u" && S.forEach(function(e) {
|
|
348
348
|
Z(e);
|
|
349
349
|
});
|
|
350
350
|
}
|
|
@@ -357,11 +357,11 @@ 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) && !
|
|
360
|
+
(a && m.configs[l.join(".")] || !a) && !O(e, l) && w(l.join("."), n[t]);
|
|
361
361
|
}
|
|
362
362
|
});
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function be(e) {
|
|
365
365
|
let a;
|
|
366
366
|
const c = /* @__PURE__ */ new Set();
|
|
367
367
|
Object.keys(e).forEach(function(n) {
|
|
@@ -383,12 +383,12 @@ class De {
|
|
|
383
383
|
}
|
|
384
384
|
function ue(e, a, c, n = !1) {
|
|
385
385
|
Object.keys(c).forEach(function(t) {
|
|
386
|
-
|
|
387
|
-
|
|
386
|
+
O(e, t.split(".")) || (E(e, t.split("."), c[t]), n && (N[t] = !0), (a[t] || []).forEach(function(l) {
|
|
387
|
+
O(e, l.split(".")) || E(e, l.split("."), c[t]);
|
|
388
388
|
}));
|
|
389
389
|
});
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function O(e, a) {
|
|
392
392
|
let c = e;
|
|
393
393
|
k["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(t) {
|
|
394
394
|
c = c[t] || {};
|
|
@@ -411,12 +411,12 @@ class De {
|
|
|
411
411
|
m.aliases[c] || (m.aliases[c] = [].concat(_[c] || []), m.aliases[c].concat(c).forEach(function(n) {
|
|
412
412
|
if (/-/.test(n) && k["camel-case-expansion"]) {
|
|
413
413
|
const t = W(n);
|
|
414
|
-
t !== c && m.aliases[c].indexOf(t) === -1 && (m.aliases[c].push(t),
|
|
414
|
+
t !== c && m.aliases[c].indexOf(t) === -1 && (m.aliases[c].push(t), T[t] = !0);
|
|
415
415
|
}
|
|
416
416
|
}), m.aliases[c].concat(c).forEach(function(n) {
|
|
417
417
|
if (n.length > 1 && /[A-Z]/.test(n) && k["camel-case-expansion"]) {
|
|
418
|
-
const t =
|
|
419
|
-
t !== c && m.aliases[c].indexOf(t) === -1 && (m.aliases[c].push(t),
|
|
418
|
+
const t = Ne(n, "-");
|
|
419
|
+
t !== c && m.aliases[c].indexOf(t) === -1 && (m.aliases[c].push(t), T[t] = !0);
|
|
420
420
|
}
|
|
421
421
|
}), m.aliases[c].forEach(function(n) {
|
|
422
422
|
m.aliases[n] = [c].concat(m.aliases[c].filter(function(t) {
|
|
@@ -468,15 +468,15 @@ class De {
|
|
|
468
468
|
}
|
|
469
469
|
function Me(e) {
|
|
470
470
|
return {
|
|
471
|
-
[
|
|
472
|
-
[
|
|
473
|
-
[
|
|
474
|
-
[
|
|
471
|
+
[Q.BOOLEAN]: !0,
|
|
472
|
+
[Q.STRING]: "",
|
|
473
|
+
[Q.NUMBER]: void 0,
|
|
474
|
+
[Q.ARRAY]: []
|
|
475
475
|
}[e];
|
|
476
476
|
}
|
|
477
477
|
function Le(e) {
|
|
478
|
-
let a =
|
|
479
|
-
return g(e, m.strings) ? a =
|
|
478
|
+
let a = Q.BOOLEAN;
|
|
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
481
|
function G(e) {
|
|
482
482
|
return e === void 0;
|
|
@@ -486,11 +486,11 @@ class De {
|
|
|
486
486
|
}
|
|
487
487
|
return {
|
|
488
488
|
aliases: Object.assign({}, m.aliases),
|
|
489
|
-
argv: Object.assign(se,
|
|
489
|
+
argv: Object.assign(se, b),
|
|
490
490
|
configuration: k,
|
|
491
|
-
defaulted: Object.assign({},
|
|
491
|
+
defaulted: Object.assign({}, N),
|
|
492
492
|
error: L,
|
|
493
|
-
newAliases: Object.assign({},
|
|
493
|
+
newAliases: Object.assign({}, T)
|
|
494
494
|
};
|
|
495
495
|
}
|
|
496
496
|
}
|
|
@@ -544,7 +544,7 @@ new De({
|
|
|
544
544
|
cwd: process.cwd,
|
|
545
545
|
env: () => je,
|
|
546
546
|
format: ke,
|
|
547
|
-
normalize:
|
|
547
|
+
normalize: Qe,
|
|
548
548
|
resolve: oe,
|
|
549
549
|
// TODO: figure out a way to combine ESM and CJS coverage, such that
|
|
550
550
|
// we can exercise all the lines below:
|
|
@@ -559,13 +559,13 @@ new De({
|
|
|
559
559
|
const Ke = {
|
|
560
560
|
fs: {
|
|
561
561
|
readFileSync: ge,
|
|
562
|
-
writeFile:
|
|
562
|
+
writeFile: Pe
|
|
563
563
|
},
|
|
564
564
|
format: ke,
|
|
565
565
|
resolve: oe,
|
|
566
566
|
exists: (i) => {
|
|
567
567
|
try {
|
|
568
|
-
return
|
|
568
|
+
return Se(i).isFile();
|
|
569
569
|
} catch {
|
|
570
570
|
return !1;
|
|
571
571
|
}
|
|
@@ -673,7 +673,7 @@ function $e(i, o) {
|
|
|
673
673
|
const We = (i) => $e(i, Ke);
|
|
674
674
|
let D;
|
|
675
675
|
try {
|
|
676
|
-
D =
|
|
676
|
+
D = Te(import.meta.url);
|
|
677
677
|
} catch {
|
|
678
678
|
D = process.cwd();
|
|
679
679
|
}
|
|
@@ -3445,6 +3445,253 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3445
3445
|
}
|
|
3446
3446
|
]
|
|
3447
3447
|
},
|
|
3448
|
+
{
|
|
3449
|
+
id: "doubleword",
|
|
3450
|
+
name: "Doubleword",
|
|
3451
|
+
pricing_urls: ["https://docs.doubleword.ai/inference-api/models"],
|
|
3452
|
+
api_pattern: "https://api\\.doubleword\\.ai",
|
|
3453
|
+
price_comments: "Doubleword publishes Realtime, Async, and Batch prices. This provider currently encodes only Realtime pricing.",
|
|
3454
|
+
extractors: [
|
|
3455
|
+
{
|
|
3456
|
+
api_flavor: "chat",
|
|
3457
|
+
root: "usage",
|
|
3458
|
+
model_path: "model",
|
|
3459
|
+
mappings: [
|
|
3460
|
+
{
|
|
3461
|
+
path: "prompt_tokens",
|
|
3462
|
+
dest: "input_tokens",
|
|
3463
|
+
required: !0
|
|
3464
|
+
},
|
|
3465
|
+
{
|
|
3466
|
+
path: ["prompt_tokens_details", "cached_tokens"],
|
|
3467
|
+
dest: "cache_read_tokens",
|
|
3468
|
+
required: !1
|
|
3469
|
+
},
|
|
3470
|
+
{
|
|
3471
|
+
path: ["prompt_tokens_details", "cache_write_tokens"],
|
|
3472
|
+
dest: "cache_write_tokens",
|
|
3473
|
+
required: !1
|
|
3474
|
+
},
|
|
3475
|
+
{
|
|
3476
|
+
path: "completion_tokens",
|
|
3477
|
+
dest: "output_tokens",
|
|
3478
|
+
required: !0
|
|
3479
|
+
}
|
|
3480
|
+
]
|
|
3481
|
+
},
|
|
3482
|
+
{
|
|
3483
|
+
api_flavor: "responses",
|
|
3484
|
+
root: "usage",
|
|
3485
|
+
model_path: "model",
|
|
3486
|
+
mappings: [
|
|
3487
|
+
{
|
|
3488
|
+
path: "input_tokens",
|
|
3489
|
+
dest: "input_tokens",
|
|
3490
|
+
required: !0
|
|
3491
|
+
},
|
|
3492
|
+
{
|
|
3493
|
+
path: ["input_tokens_details", "cached_tokens"],
|
|
3494
|
+
dest: "cache_read_tokens",
|
|
3495
|
+
required: !1
|
|
3496
|
+
},
|
|
3497
|
+
{
|
|
3498
|
+
path: "output_tokens",
|
|
3499
|
+
dest: "output_tokens",
|
|
3500
|
+
required: !0
|
|
3501
|
+
}
|
|
3502
|
+
]
|
|
3503
|
+
},
|
|
3504
|
+
{
|
|
3505
|
+
api_flavor: "embeddings",
|
|
3506
|
+
root: "usage",
|
|
3507
|
+
model_path: "model",
|
|
3508
|
+
mappings: [
|
|
3509
|
+
{
|
|
3510
|
+
path: "prompt_tokens",
|
|
3511
|
+
dest: "input_tokens",
|
|
3512
|
+
required: !0
|
|
3513
|
+
}
|
|
3514
|
+
]
|
|
3515
|
+
}
|
|
3516
|
+
],
|
|
3517
|
+
models: [
|
|
3518
|
+
{
|
|
3519
|
+
id: "Qwen/Qwen3-14B-FP8",
|
|
3520
|
+
name: "Qwen3 14B",
|
|
3521
|
+
match: {
|
|
3522
|
+
equals: "Qwen/Qwen3-14B-FP8"
|
|
3523
|
+
},
|
|
3524
|
+
prices: {
|
|
3525
|
+
input_mtok: 0.05,
|
|
3526
|
+
output_mtok: 0.6
|
|
3527
|
+
}
|
|
3528
|
+
},
|
|
3529
|
+
{
|
|
3530
|
+
id: "Qwen/Qwen3-Embedding-8B",
|
|
3531
|
+
name: "Qwen3 Embedding 8B",
|
|
3532
|
+
match: {
|
|
3533
|
+
equals: "Qwen/Qwen3-Embedding-8B"
|
|
3534
|
+
},
|
|
3535
|
+
prices: {
|
|
3536
|
+
input_mtok: 0.04
|
|
3537
|
+
}
|
|
3538
|
+
},
|
|
3539
|
+
{
|
|
3540
|
+
id: "Qwen/Qwen3-VL-235B-A22B-Instruct-FP8",
|
|
3541
|
+
name: "Qwen3 VL 235B A22B Instruct",
|
|
3542
|
+
match: {
|
|
3543
|
+
equals: "Qwen/Qwen3-VL-235B-A22B-Instruct-FP8"
|
|
3544
|
+
},
|
|
3545
|
+
prices: {
|
|
3546
|
+
input_mtok: 0.6,
|
|
3547
|
+
output_mtok: 1.2
|
|
3548
|
+
}
|
|
3549
|
+
},
|
|
3550
|
+
{
|
|
3551
|
+
id: "Qwen/Qwen3-VL-30B-A3B-Instruct-FP8",
|
|
3552
|
+
name: "Qwen3 VL 30B A3B Instruct",
|
|
3553
|
+
match: {
|
|
3554
|
+
equals: "Qwen/Qwen3-VL-30B-A3B-Instruct-FP8"
|
|
3555
|
+
},
|
|
3556
|
+
prices: {
|
|
3557
|
+
input_mtok: 0.16,
|
|
3558
|
+
output_mtok: 0.8
|
|
3559
|
+
}
|
|
3560
|
+
},
|
|
3561
|
+
{
|
|
3562
|
+
id: "Qwen/Qwen3.5-35B-A3B-FP8",
|
|
3563
|
+
name: "Qwen3.5 35B A3B",
|
|
3564
|
+
match: {
|
|
3565
|
+
equals: "Qwen/Qwen3.5-35B-A3B-FP8"
|
|
3566
|
+
},
|
|
3567
|
+
prices: {
|
|
3568
|
+
input_mtok: 0.25,
|
|
3569
|
+
output_mtok: 2
|
|
3570
|
+
}
|
|
3571
|
+
},
|
|
3572
|
+
{
|
|
3573
|
+
id: "Qwen/Qwen3.5-397B-A17B",
|
|
3574
|
+
name: "Qwen3.5 397B A17B",
|
|
3575
|
+
match: {
|
|
3576
|
+
equals: "Qwen/Qwen3.5-397B-A17B"
|
|
3577
|
+
},
|
|
3578
|
+
prices: {
|
|
3579
|
+
input_mtok: 0.6,
|
|
3580
|
+
output_mtok: 3.6
|
|
3581
|
+
}
|
|
3582
|
+
},
|
|
3583
|
+
{
|
|
3584
|
+
id: "Qwen/Qwen3.5-9B",
|
|
3585
|
+
name: "Qwen3.5 9B",
|
|
3586
|
+
match: {
|
|
3587
|
+
equals: "Qwen/Qwen3.5-9B"
|
|
3588
|
+
},
|
|
3589
|
+
prices: {
|
|
3590
|
+
input_mtok: 0.08,
|
|
3591
|
+
output_mtok: 0.7
|
|
3592
|
+
}
|
|
3593
|
+
},
|
|
3594
|
+
{
|
|
3595
|
+
id: "Qwen/Qwen3.6-35B-A3B-FP8",
|
|
3596
|
+
name: "Qwen3.6 35B A3B",
|
|
3597
|
+
match: {
|
|
3598
|
+
equals: "Qwen/Qwen3.6-35B-A3B-FP8"
|
|
3599
|
+
},
|
|
3600
|
+
prices: {
|
|
3601
|
+
input_mtok: 0.25,
|
|
3602
|
+
output_mtok: 2
|
|
3603
|
+
}
|
|
3604
|
+
},
|
|
3605
|
+
{
|
|
3606
|
+
id: "deepseek-ai/DeepSeek-V4-Flash",
|
|
3607
|
+
name: "DeepSeek V4 Flash",
|
|
3608
|
+
match: {
|
|
3609
|
+
equals: "deepseek-ai/DeepSeek-V4-Flash"
|
|
3610
|
+
},
|
|
3611
|
+
prices: {
|
|
3612
|
+
input_mtok: 0.14,
|
|
3613
|
+
output_mtok: 0.28
|
|
3614
|
+
}
|
|
3615
|
+
},
|
|
3616
|
+
{
|
|
3617
|
+
id: "deepseek-ai/DeepSeek-V4-Pro",
|
|
3618
|
+
name: "DeepSeek V4 Pro",
|
|
3619
|
+
match: {
|
|
3620
|
+
equals: "deepseek-ai/DeepSeek-V4-Pro"
|
|
3621
|
+
},
|
|
3622
|
+
prices: {
|
|
3623
|
+
input_mtok: 1.74,
|
|
3624
|
+
output_mtok: 3.48
|
|
3625
|
+
}
|
|
3626
|
+
},
|
|
3627
|
+
{
|
|
3628
|
+
id: "google/gemma-4-31B-it",
|
|
3629
|
+
name: "Gemma 4 31B IT",
|
|
3630
|
+
match: {
|
|
3631
|
+
equals: "google/gemma-4-31B-it"
|
|
3632
|
+
},
|
|
3633
|
+
prices: {
|
|
3634
|
+
input_mtok: 0.14,
|
|
3635
|
+
output_mtok: 0.4
|
|
3636
|
+
}
|
|
3637
|
+
},
|
|
3638
|
+
{
|
|
3639
|
+
id: "mistralai/Devstral-2-123B-Instruct-2512",
|
|
3640
|
+
name: "Devstral 2 123B Instruct 2512",
|
|
3641
|
+
match: {
|
|
3642
|
+
equals: "mistralai/Devstral-2-123B-Instruct-2512"
|
|
3643
|
+
},
|
|
3644
|
+
prices: {
|
|
3645
|
+
input_mtok: 0.4,
|
|
3646
|
+
output_mtok: 2
|
|
3647
|
+
}
|
|
3648
|
+
},
|
|
3649
|
+
{
|
|
3650
|
+
id: "moonshotai/Kimi-K2.6",
|
|
3651
|
+
name: "Kimi K2.6",
|
|
3652
|
+
match: {
|
|
3653
|
+
equals: "moonshotai/Kimi-K2.6"
|
|
3654
|
+
},
|
|
3655
|
+
prices: {
|
|
3656
|
+
input_mtok: 0.95,
|
|
3657
|
+
output_mtok: 4
|
|
3658
|
+
}
|
|
3659
|
+
},
|
|
3660
|
+
{
|
|
3661
|
+
id: "nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-NVFP4",
|
|
3662
|
+
name: "Nemotron 3 Super 120B A12B",
|
|
3663
|
+
match: {
|
|
3664
|
+
equals: "nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-NVFP4"
|
|
3665
|
+
},
|
|
3666
|
+
prices: {
|
|
3667
|
+
input_mtok: 0.3,
|
|
3668
|
+
output_mtok: 0.75
|
|
3669
|
+
}
|
|
3670
|
+
},
|
|
3671
|
+
{
|
|
3672
|
+
id: "openai/gpt-oss-20b",
|
|
3673
|
+
name: "GPT OSS 20B",
|
|
3674
|
+
match: {
|
|
3675
|
+
equals: "openai/gpt-oss-20b"
|
|
3676
|
+
},
|
|
3677
|
+
prices: {
|
|
3678
|
+
input_mtok: 0.04,
|
|
3679
|
+
output_mtok: 0.3
|
|
3680
|
+
}
|
|
3681
|
+
},
|
|
3682
|
+
{
|
|
3683
|
+
id: "zai-org/GLM-5.1-FP8",
|
|
3684
|
+
name: "GLM 5.1",
|
|
3685
|
+
match: {
|
|
3686
|
+
equals: "zai-org/GLM-5.1-FP8"
|
|
3687
|
+
},
|
|
3688
|
+
prices: {
|
|
3689
|
+
input_mtok: 1.4,
|
|
3690
|
+
output_mtok: 4.4
|
|
3691
|
+
}
|
|
3692
|
+
}
|
|
3693
|
+
]
|
|
3694
|
+
},
|
|
3448
3695
|
{
|
|
3449
3696
|
id: "fireworks",
|
|
3450
3697
|
name: "Fireworks",
|
|
@@ -19597,20 +19844,20 @@ function z(i, o, u, s) {
|
|
|
19597
19844
|
}
|
|
19598
19845
|
function Je(i, o) {
|
|
19599
19846
|
let u = 0, s = 0;
|
|
19600
|
-
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,
|
|
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;
|
|
19601
19848
|
let y = 0;
|
|
19602
|
-
if (o.input_audio_mtok !== void 0 && (y = q - B -
|
|
19849
|
+
if (o.input_audio_mtok !== void 0 && (y = q - B - P), y < 0)
|
|
19603
19850
|
throw new Error("cache_audio_read_tokens cannot be greater than input_audio_tokens");
|
|
19604
|
-
let
|
|
19605
|
-
if (o.cache_read_mtok !== void 0 && (
|
|
19851
|
+
let T = 0;
|
|
19852
|
+
if (o.cache_read_mtok !== void 0 && (T = h - B), T < 0)
|
|
19606
19853
|
throw new Error("cache_audio_read_tokens cannot be greater than cache_read_tokens");
|
|
19607
|
-
const
|
|
19854
|
+
const N = o.cache_write_mtok === void 0 ? 0 : _;
|
|
19608
19855
|
let M = 0;
|
|
19609
|
-
if (o.input_mtok !== void 0 && (M = r -
|
|
19856
|
+
if (o.input_mtok !== void 0 && (M = r - T - N - y - B), M < 0)
|
|
19610
19857
|
throw new Error("Uncached text input tokens cannot be negative");
|
|
19611
|
-
u += z(o.input_mtok, M, "input_mtok", r), u += z(o.cache_read_mtok,
|
|
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);
|
|
19612
19859
|
let m = 0;
|
|
19613
|
-
if (o.output_mtok !== void 0 && (m = (i.output_tokens ?? 0) - (o.output_audio_mtok === void 0 ? 0 :
|
|
19860
|
+
if (o.output_mtok !== void 0 && (m = (i.output_tokens ?? 0) - (o.output_audio_mtok === void 0 ? 0 : S)), m < 0)
|
|
19614
19861
|
throw new Error("output_audio_tokens cannot be greater than output_tokens");
|
|
19615
19862
|
s += z(o.output_mtok, m, "output_mtok", r), s += z(o.output_audio_mtok, i.output_audio_tokens, "output_audio_mtok", r);
|
|
19616
19863
|
let I = u + s;
|
|
@@ -19679,20 +19926,20 @@ Promise.resolve(ne);
|
|
|
19679
19926
|
function tt(i, o, u) {
|
|
19680
19927
|
let s = o.toLowerCase().trim(), r = u?.providerId;
|
|
19681
19928
|
if (r && r.toLowerCase() === "litellm" && s.includes("/")) {
|
|
19682
|
-
const B = s.indexOf("/"),
|
|
19683
|
-
|
|
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);
|
|
19684
19931
|
}
|
|
19685
19932
|
const h = u?.provider ?? _e(ie, { modelId: s, providerApiUrl: u?.providerApiUrl, providerId: r });
|
|
19686
19933
|
if (!h) return null;
|
|
19687
19934
|
const _ = qe(h, s, ie);
|
|
19688
19935
|
if (!_) return null;
|
|
19689
|
-
const k = u?.timestamp ?? /* @__PURE__ */ new Date(), q = Ze(_, k),
|
|
19936
|
+
const k = u?.timestamp ?? /* @__PURE__ */ new Date(), q = Ze(_, k), S = Je(i, q);
|
|
19690
19937
|
return {
|
|
19691
19938
|
auto_update_timestamp: void 0,
|
|
19692
19939
|
model: _,
|
|
19693
19940
|
model_price: q,
|
|
19694
19941
|
provider: h,
|
|
19695
|
-
...
|
|
19942
|
+
...S
|
|
19696
19943
|
};
|
|
19697
19944
|
}
|
|
19698
19945
|
const f = he(Re(process.argv)).scriptName("genai-prices").command(
|
|
@@ -19742,17 +19989,17 @@ function at() {
|
|
|
19742
19989
|
r = !0, console.error(`No price found for model ${h}`);
|
|
19743
19990
|
continue;
|
|
19744
19991
|
}
|
|
19745
|
-
const
|
|
19992
|
+
const S = q.model.context_window, B = [
|
|
19746
19993
|
["Provider", q.provider.name],
|
|
19747
19994
|
["Model", q.model.name ?? q.model.id],
|
|
19748
19995
|
["Model Prices", JSON.stringify(q.model_price)],
|
|
19749
|
-
["Context Window",
|
|
19996
|
+
["Context Window", S !== void 0 ? S.toLocaleString() : void 0],
|
|
19750
19997
|
["Total Price", `$${q.total_price}`],
|
|
19751
19998
|
["Input Price", `$${q.input_price}`],
|
|
19752
19999
|
["Output Price", `$${q.output_price}`]
|
|
19753
20000
|
];
|
|
19754
|
-
for (const [
|
|
19755
|
-
y !== void 0 && console.log(`${
|
|
20001
|
+
for (const [P, y] of B)
|
|
20002
|
+
y !== void 0 && console.log(`${P.padStart(14)}: ${y}`);
|
|
19756
20003
|
console.log("");
|
|
19757
20004
|
} catch (q) {
|
|
19758
20005
|
r = !0, q instanceof Error && console.error(`Error for model ${h}:`, q.message);
|