@pydantic/genai-prices 0.0.49 → 0.0.51
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/README.md +38 -0
- package/dist/cli.js +668 -924
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +328 -576
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import { format as
|
|
4
|
-
import { resolve as
|
|
5
|
-
import { readFileSync as
|
|
2
|
+
import he from "yargs";
|
|
3
|
+
import { format as _e } from "util";
|
|
4
|
+
import { resolve as ae, normalize as Qe } from "path";
|
|
5
|
+
import { readFileSync as ke, writeFile as Ae, statSync as Pe } from "fs";
|
|
6
6
|
import "assert";
|
|
7
|
-
import { fileURLToPath as
|
|
8
|
-
function
|
|
9
|
-
return
|
|
7
|
+
import { fileURLToPath as Te } from "url";
|
|
8
|
+
function Se() {
|
|
9
|
+
return Ge() ? 0 : 1;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
return
|
|
11
|
+
function Ge() {
|
|
12
|
+
return Ce() && !process.defaultApp;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function Ce() {
|
|
15
15
|
return !!process.versions.electron;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return i.slice(
|
|
17
|
+
function Re(i) {
|
|
18
|
+
return i.slice(Se() + 1);
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* @license
|
|
22
22
|
* Copyright (c) 2016, Contributors
|
|
23
23
|
* SPDX-License-Identifier: ISC
|
|
24
24
|
*/
|
|
25
|
-
function
|
|
25
|
+
function $(i) {
|
|
26
26
|
if (i !== i.toLowerCase() && i !== i.toUpperCase() || (i = i.toLowerCase()), i.indexOf("-") === -1 && i.indexOf("_") === -1)
|
|
27
27
|
return i;
|
|
28
28
|
{
|
|
29
|
-
let
|
|
30
|
-
const
|
|
31
|
-
for (let
|
|
32
|
-
let
|
|
33
|
-
s && (s = !1,
|
|
29
|
+
let u = "", s = !1;
|
|
30
|
+
const r = i.match(/^-+/);
|
|
31
|
+
for (let _ = r ? r[0].length : 0; _ < i.length; _++) {
|
|
32
|
+
let k = i.charAt(_);
|
|
33
|
+
s && (s = !1, k = k.toUpperCase()), _ !== 0 && (k === "-" || k === "_") ? s = !0 : k !== "-" && k !== "_" && (u += k);
|
|
34
34
|
}
|
|
35
|
-
return
|
|
35
|
+
return u;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
const
|
|
40
|
-
|
|
38
|
+
function ze(i, o) {
|
|
39
|
+
const u = i.toLowerCase();
|
|
40
|
+
o = o || "-";
|
|
41
41
|
let s = "";
|
|
42
|
-
for (let
|
|
43
|
-
const
|
|
44
|
-
|
|
42
|
+
for (let r = 0; r < i.length; r++) {
|
|
43
|
+
const _ = u.charAt(r), k = i.charAt(r);
|
|
44
|
+
_ !== k && r > 0 ? s += `${o}${u.charAt(r)}` : s += k;
|
|
45
45
|
}
|
|
46
46
|
return s;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function Ne(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
|
/**
|
|
@@ -53,20 +53,20 @@ function Rt(i) {
|
|
|
53
53
|
* Copyright (c) 2016, Contributors
|
|
54
54
|
* SPDX-License-Identifier: ISC
|
|
55
55
|
*/
|
|
56
|
-
function
|
|
56
|
+
function Oe(i) {
|
|
57
57
|
if (Array.isArray(i))
|
|
58
|
-
return i.map((
|
|
58
|
+
return i.map((k) => typeof k != "string" ? k + "" : k);
|
|
59
59
|
i = i.trim();
|
|
60
|
-
let
|
|
61
|
-
const
|
|
62
|
-
for (let
|
|
63
|
-
if (
|
|
64
|
-
|
|
60
|
+
let o = 0, u = null, s = null, r = null;
|
|
61
|
+
const _ = [];
|
|
62
|
+
for (let k = 0; k < i.length; k++) {
|
|
63
|
+
if (u = s, s = i.charAt(k), s === " " && !r) {
|
|
64
|
+
u !== " " && o++;
|
|
65
65
|
continue;
|
|
66
66
|
}
|
|
67
|
-
s ===
|
|
67
|
+
s === r ? r = null : (s === "'" || s === '"') && !r && (r = s), _[o] || (_[o] = ""), _[o] += s;
|
|
68
68
|
}
|
|
69
|
-
return
|
|
69
|
+
return _;
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -83,11 +83,11 @@ var L;
|
|
|
83
83
|
* SPDX-License-Identifier: ISC
|
|
84
84
|
*/
|
|
85
85
|
let T;
|
|
86
|
-
class
|
|
87
|
-
constructor(
|
|
88
|
-
T =
|
|
86
|
+
class De {
|
|
87
|
+
constructor(o) {
|
|
88
|
+
T = o;
|
|
89
89
|
}
|
|
90
|
-
parse(
|
|
90
|
+
parse(o, u) {
|
|
91
91
|
const s = Object.assign({
|
|
92
92
|
alias: void 0,
|
|
93
93
|
array: void 0,
|
|
@@ -105,7 +105,7 @@ class Nt {
|
|
|
105
105
|
number: void 0,
|
|
106
106
|
__: void 0,
|
|
107
107
|
key: void 0
|
|
108
|
-
},
|
|
108
|
+
}, u), r = Oe(o), _ = typeof o == "string", k = Ee(Object.assign(/* @__PURE__ */ Object.create(null), s.alias)), h = Object.assign({
|
|
109
109
|
"boolean-negation": !0,
|
|
110
110
|
"camel-case-expansion": !0,
|
|
111
111
|
"combine-arrays": !1,
|
|
@@ -124,7 +124,7 @@ class Nt {
|
|
|
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), M = s.configObjects || [], B = s.envPrefix, S = h["populate--"], A = S ? "--" : "_", G = /* @__PURE__ */ Object.create(null), oe = /* @__PURE__ */ Object.create(null), C = s.__ || T.format, m = {
|
|
128
128
|
aliases: /* @__PURE__ */ Object.create(null),
|
|
129
129
|
arrays: /* @__PURE__ */ Object.create(null),
|
|
130
130
|
bools: /* @__PURE__ */ Object.create(null),
|
|
@@ -136,158 +136,158 @@ class Nt {
|
|
|
136
136
|
nargs: /* @__PURE__ */ Object.create(null),
|
|
137
137
|
coercions: /* @__PURE__ */ Object.create(null),
|
|
138
138
|
keys: []
|
|
139
|
-
},
|
|
140
|
-
[].concat(s.array || []).filter(Boolean).forEach(function(
|
|
141
|
-
const a = typeof
|
|
139
|
+
}, Q = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/, W = new RegExp("^--" + h["negation-prefix"] + "(.+)");
|
|
140
|
+
[].concat(s.array || []).filter(Boolean).forEach(function(e) {
|
|
141
|
+
const a = typeof e == "object" ? e.key : e, c = Object.keys(e).map(function(n) {
|
|
142
142
|
return {
|
|
143
143
|
boolean: "bools",
|
|
144
144
|
string: "strings",
|
|
145
145
|
number: "numbers"
|
|
146
|
-
}[
|
|
146
|
+
}[n];
|
|
147
147
|
}).filter(Boolean).pop();
|
|
148
|
-
c && (
|
|
149
|
-
}), [].concat(s.boolean || []).filter(Boolean).forEach(function(
|
|
150
|
-
|
|
151
|
-
}), [].concat(s.string || []).filter(Boolean).forEach(function(
|
|
152
|
-
|
|
153
|
-
}), [].concat(s.number || []).filter(Boolean).forEach(function(
|
|
154
|
-
|
|
155
|
-
}), [].concat(s.count || []).filter(Boolean).forEach(function(
|
|
156
|
-
|
|
157
|
-
}), [].concat(s.normalize || []).filter(Boolean).forEach(function(
|
|
158
|
-
|
|
159
|
-
}), typeof s.narg == "object" && Object.entries(s.narg).forEach(([
|
|
160
|
-
typeof a == "number" && (
|
|
161
|
-
}), typeof s.coerce == "object" && Object.entries(s.coerce).forEach(([
|
|
162
|
-
typeof a == "function" && (
|
|
163
|
-
}), typeof s.config < "u" && (Array.isArray(s.config) || typeof s.config == "string" ? [].concat(s.config).filter(Boolean).forEach(function(
|
|
164
|
-
|
|
165
|
-
}) : typeof s.config == "object" && Object.entries(s.config).forEach(([
|
|
166
|
-
(typeof a == "boolean" || typeof a == "function") && (
|
|
167
|
-
})),
|
|
168
|
-
(
|
|
169
|
-
q[a] = q[
|
|
148
|
+
c && (m[c][a] = !0), m.arrays[a] = !0, m.keys.push(a);
|
|
149
|
+
}), [].concat(s.boolean || []).filter(Boolean).forEach(function(e) {
|
|
150
|
+
m.bools[e] = !0, m.keys.push(e);
|
|
151
|
+
}), [].concat(s.string || []).filter(Boolean).forEach(function(e) {
|
|
152
|
+
m.strings[e] = !0, m.keys.push(e);
|
|
153
|
+
}), [].concat(s.number || []).filter(Boolean).forEach(function(e) {
|
|
154
|
+
m.numbers[e] = !0, m.keys.push(e);
|
|
155
|
+
}), [].concat(s.count || []).filter(Boolean).forEach(function(e) {
|
|
156
|
+
m.counts[e] = !0, m.keys.push(e);
|
|
157
|
+
}), [].concat(s.normalize || []).filter(Boolean).forEach(function(e) {
|
|
158
|
+
m.normalize[e] = !0, m.keys.push(e);
|
|
159
|
+
}), typeof s.narg == "object" && Object.entries(s.narg).forEach(([e, a]) => {
|
|
160
|
+
typeof a == "number" && (m.nargs[e] = a, m.keys.push(e));
|
|
161
|
+
}), typeof s.coerce == "object" && Object.entries(s.coerce).forEach(([e, a]) => {
|
|
162
|
+
typeof a == "function" && (m.coercions[e] = a, m.keys.push(e));
|
|
163
|
+
}), typeof s.config < "u" && (Array.isArray(s.config) || typeof s.config == "string" ? [].concat(s.config).filter(Boolean).forEach(function(e) {
|
|
164
|
+
m.configs[e] = !0;
|
|
165
|
+
}) : typeof s.config == "object" && Object.entries(s.config).forEach(([e, a]) => {
|
|
166
|
+
(typeof a == "boolean" || typeof a == "function") && (m.configs[e] = a);
|
|
167
|
+
})), ve(s.key, k, s.default, m.arrays), Object.keys(q).forEach(function(e) {
|
|
168
|
+
(m.aliases[e] || []).forEach(function(a) {
|
|
169
|
+
q[a] = q[e];
|
|
170
170
|
});
|
|
171
171
|
});
|
|
172
|
-
let
|
|
173
|
-
|
|
172
|
+
let y = null;
|
|
173
|
+
Me();
|
|
174
174
|
let j = [];
|
|
175
|
-
const w = Object.assign(/* @__PURE__ */ Object.create(null), { _: [] }),
|
|
176
|
-
for (let
|
|
177
|
-
const a =
|
|
178
|
-
let
|
|
179
|
-
if (a !== "--" && /^-/.test(a) &&
|
|
175
|
+
const w = Object.assign(/* @__PURE__ */ Object.create(null), { _: [] }), ne = {};
|
|
176
|
+
for (let e = 0; e < r.length; e++) {
|
|
177
|
+
const a = r[e], c = a.replace(/^-{3,}/, "---");
|
|
178
|
+
let n, t, l, p, d, v;
|
|
179
|
+
if (a !== "--" && /^-/.test(a) && K(a))
|
|
180
180
|
U(a);
|
|
181
181
|
else if (c.match(/^---+(=|$)/)) {
|
|
182
182
|
U(a);
|
|
183
183
|
continue;
|
|
184
|
-
} else if (a.match(/^--.+=/) || !
|
|
185
|
-
p = a.match(/^--?([^=]+)=([\s\S]*)$/), p !== null && Array.isArray(p) && p.length >= 3 && (g(p[1],
|
|
186
|
-
else if (a.match(W) &&
|
|
187
|
-
p = a.match(W), p !== null && Array.isArray(p) && p.length >= 2 && (
|
|
188
|
-
else if (a.match(/^--.+/) || !
|
|
189
|
-
p = a.match(/^--?(.+)/), p !== null && Array.isArray(p) && p.length >= 2 && (
|
|
184
|
+
} else if (a.match(/^--.+=/) || !h["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 = F(e, p[1], r, p[2]) : g(p[1], m.nargs) !== !1 ? e = V(e, p[1], r, p[2]) : b(p[1], p[2], !0));
|
|
186
|
+
else if (a.match(W) && h["boolean-negation"])
|
|
187
|
+
p = a.match(W), p !== null && Array.isArray(p) && p.length >= 2 && (t = p[1], b(t, g(t, m.arrays) ? [!1] : !1));
|
|
188
|
+
else if (a.match(/^--.+/) || !h["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 = F(e, t, r) : g(t, m.nargs) !== !1 ? e = V(e, t, r) : (d = r[e + 1], d !== void 0 && (!d.match(/^-/) || d.match(Q)) && !g(t, m.bools) && !g(t, m.counts) || /^(true|false)$/.test(d) ? (b(t, d), e++) : b(t, z(t))));
|
|
190
190
|
else if (a.match(/^-.\..+=/))
|
|
191
191
|
p = a.match(/^-([^=]+)=([\s\S]*)$/), p !== null && Array.isArray(p) && p.length >= 3 && b(p[1], p[2]);
|
|
192
|
-
else if (a.match(/^-.\..+/) && !a.match(
|
|
193
|
-
d =
|
|
194
|
-
else if (a.match(/^-[^-]+/) && !a.match(
|
|
195
|
-
l = a.slice(1, -1).split(""),
|
|
192
|
+
else if (a.match(/^-.\..+/) && !a.match(Q))
|
|
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) ? (b(t, d), e++) : b(t, z(t)));
|
|
194
|
+
else if (a.match(/^-[^-]+/) && !a.match(Q)) {
|
|
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),
|
|
198
|
+
v = a.slice(x + 3), t = l[x], g(t, m.arrays) ? e = F(e, t, r, v) : g(t, m.nargs) !== !1 ? e = V(e, t, r, v) : b(t, v), n = !0;
|
|
199
199
|
break;
|
|
200
200
|
}
|
|
201
201
|
if (d === "-") {
|
|
202
202
|
b(l[x], d);
|
|
203
203
|
continue;
|
|
204
204
|
}
|
|
205
|
-
if (/[A-Za-z]/.test(l[x]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(d) && g(d,
|
|
206
|
-
b(l[x], d),
|
|
205
|
+
if (/[A-Za-z]/.test(l[x]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(d) && g(d, m.bools) === !1) {
|
|
206
|
+
b(l[x], d), n = !0;
|
|
207
207
|
break;
|
|
208
208
|
}
|
|
209
209
|
if (l[x + 1] && l[x + 1].match(/\W/)) {
|
|
210
|
-
b(l[x], d),
|
|
210
|
+
b(l[x], d), n = !0;
|
|
211
211
|
break;
|
|
212
212
|
} else
|
|
213
|
-
b(l[x],
|
|
213
|
+
b(l[x], z(l[x]));
|
|
214
214
|
}
|
|
215
|
-
|
|
216
|
-
} else if (a.match(/^-[0-9]$/) && a.match(
|
|
217
|
-
|
|
215
|
+
t = a.slice(-1)[0], !n && t !== "-" && (g(t, m.arrays) ? e = F(e, t, r) : g(t, m.nargs) !== !1 ? e = V(e, t, r) : (d = r[e + 1], d !== void 0 && (!/^(-|--)[^-]/.test(d) || d.match(Q)) && !g(t, m.bools) && !g(t, m.counts) || /^(true|false)$/.test(d) ? (b(t, d), e++) : b(t, z(t))));
|
|
216
|
+
} else if (a.match(/^-[0-9]$/) && a.match(Q) && g(a.slice(1), m.bools))
|
|
217
|
+
t = a.slice(1), b(t, z(t));
|
|
218
218
|
else if (a === "--") {
|
|
219
|
-
j =
|
|
219
|
+
j = r.slice(e + 1);
|
|
220
220
|
break;
|
|
221
|
-
} else if (
|
|
222
|
-
j =
|
|
221
|
+
} else if (h["halt-at-non-option"]) {
|
|
222
|
+
j = r.slice(e);
|
|
223
223
|
break;
|
|
224
224
|
} else
|
|
225
225
|
U(a);
|
|
226
226
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}),
|
|
230
|
-
w[
|
|
231
|
-
}),
|
|
232
|
-
delete w[
|
|
233
|
-
}),
|
|
234
|
-
|
|
227
|
+
re(w, !0), re(w, !1), qe(w), fe(), me(w, m.aliases, q, !0), be(w), h["set-placeholder-key"] && we(w), Object.keys(m.counts).forEach(function(e) {
|
|
228
|
+
N(w, e.split(".")) || b(e, 0);
|
|
229
|
+
}), S && j.length && (w[A] = []), j.forEach(function(e) {
|
|
230
|
+
w[A].push(e);
|
|
231
|
+
}), h["camel-case-expansion"] && h["strip-dashed"] && Object.keys(w).filter((e) => e !== "--" && e.includes("-")).forEach((e) => {
|
|
232
|
+
delete w[e];
|
|
233
|
+
}), h["strip-aliased"] && [].concat(...Object.keys(k).map((e) => k[e])).forEach((e) => {
|
|
234
|
+
h["camel-case-expansion"] && e.includes("-") && delete w[e.split(".").map((a) => $(a)).join(".")], delete w[e];
|
|
235
235
|
});
|
|
236
|
-
function U(
|
|
237
|
-
const a = H("_",
|
|
236
|
+
function U(e) {
|
|
237
|
+
const a = H("_", e);
|
|
238
238
|
(typeof a == "string" || typeof a == "number") && w._.push(a);
|
|
239
239
|
}
|
|
240
|
-
function V(
|
|
241
|
-
let
|
|
240
|
+
function V(e, a, c, n) {
|
|
241
|
+
let t, l = g(a, m.nargs);
|
|
242
242
|
if (l = typeof l != "number" || isNaN(l) ? 1 : l, l === 0)
|
|
243
|
-
return
|
|
244
|
-
let p =
|
|
245
|
-
if (
|
|
246
|
-
c.length - (
|
|
243
|
+
return P(n) || (y = Error(C("Argument unexpected for: %s", a))), b(a, z(a)), e;
|
|
244
|
+
let p = P(n) ? 0 : 1;
|
|
245
|
+
if (h["nargs-eats-options"])
|
|
246
|
+
c.length - (e + 1) + p < l && (y = Error(C("Not enough arguments following: %s", a))), p = l;
|
|
247
247
|
else {
|
|
248
|
-
for (
|
|
248
|
+
for (t = e + 1; t < c.length && (!c[t].match(/^-[^0-9]/) || c[t].match(Q) || K(c[t])); t++)
|
|
249
249
|
p++;
|
|
250
|
-
p < l && (
|
|
250
|
+
p < l && (y = Error(C("Not enough arguments following: %s", a)));
|
|
251
251
|
}
|
|
252
252
|
let d = Math.min(p, l);
|
|
253
|
-
for (!
|
|
254
|
-
b(a, c[
|
|
255
|
-
return
|
|
253
|
+
for (!P(n) && d > 0 && (b(a, n), d--), t = e + 1; t < d + e + 1; t++)
|
|
254
|
+
b(a, c[t]);
|
|
255
|
+
return e + d;
|
|
256
256
|
}
|
|
257
|
-
function F(
|
|
258
|
-
let
|
|
259
|
-
const p = g(a,
|
|
260
|
-
if (g(a,
|
|
261
|
-
|
|
262
|
-
else if (
|
|
257
|
+
function F(e, a, c, n) {
|
|
258
|
+
let t = [], l = n || c[e + 1];
|
|
259
|
+
const p = g(a, m.nargs);
|
|
260
|
+
if (g(a, m.bools) && !/^(true|false)$/.test(l))
|
|
261
|
+
t.push(!0);
|
|
262
|
+
else if (P(l) || P(n) && /^-/.test(l) && !Q.test(l) && !K(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
|
-
|
|
269
|
-
for (let d =
|
|
270
|
-
|
|
268
|
+
P(n) || t.push(Y(a, n, !0));
|
|
269
|
+
for (let d = e + 1; d < c.length && !(!h["greedy-arrays"] && t.length > 0 || p && typeof p == "number" && t.length >= p || (l = c[d], /^-/.test(l) && !Q.test(l) && !K(l))); d++)
|
|
270
|
+
e = d, t.push(Y(a, l, _));
|
|
271
271
|
}
|
|
272
|
-
return typeof p == "number" && (p &&
|
|
272
|
+
return typeof p == "number" && (p && t.length < p || isNaN(p) && t.length === 0) && (y = Error(C("Not enough arguments following: %s", a))), b(a, t), e;
|
|
273
273
|
}
|
|
274
|
-
function b(
|
|
275
|
-
if (/-/.test(
|
|
276
|
-
const l =
|
|
277
|
-
return
|
|
274
|
+
function b(e, a, c = _) {
|
|
275
|
+
if (/-/.test(e) && h["camel-case-expansion"]) {
|
|
276
|
+
const l = e.split(".").map(function(p) {
|
|
277
|
+
return $(p);
|
|
278
278
|
}).join(".");
|
|
279
|
-
|
|
279
|
+
se(e, l);
|
|
280
280
|
}
|
|
281
|
-
const
|
|
282
|
-
|
|
281
|
+
const n = Y(e, a, c), t = e.split(".");
|
|
282
|
+
O(w, t, n), m.aliases[e] && m.aliases[e].forEach(function(l) {
|
|
283
283
|
const p = l.split(".");
|
|
284
|
-
|
|
285
|
-
}),
|
|
284
|
+
O(w, p, n);
|
|
285
|
+
}), t.length > 1 && h["dot-notation"] && (m.aliases[t[0]] || []).forEach(function(l) {
|
|
286
286
|
let p = l.split(".");
|
|
287
|
-
const d = [].concat(
|
|
288
|
-
d.shift(), p = p.concat(d), (
|
|
289
|
-
}), g(
|
|
290
|
-
Object.defineProperty(
|
|
287
|
+
const d = [].concat(t);
|
|
288
|
+
d.shift(), p = p.concat(d), (m.aliases[e] || []).includes(p.join(".")) || O(w, p, n);
|
|
289
|
+
}), g(e, m.normalize) && !g(e, m.arrays) && [e].concat(m.aliases[e] || []).forEach(function(p) {
|
|
290
|
+
Object.defineProperty(ne, p, {
|
|
291
291
|
enumerable: !0,
|
|
292
292
|
get() {
|
|
293
293
|
return a;
|
|
@@ -298,233 +298,233 @@ class Nt {
|
|
|
298
298
|
});
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
|
-
function
|
|
302
|
-
|
|
301
|
+
function se(e, a) {
|
|
302
|
+
m.aliases[e] && m.aliases[e].length || (m.aliases[e] = [a], G[a] = !0), m.aliases[a] && m.aliases[a].length || se(a, e);
|
|
303
303
|
}
|
|
304
|
-
function Y(
|
|
305
|
-
c && (a =
|
|
306
|
-
let
|
|
307
|
-
return H(
|
|
308
|
-
}) : H(
|
|
309
|
-
return g(
|
|
304
|
+
function Y(e, a, c) {
|
|
305
|
+
c && (a = je(a)), (g(e, m.bools) || g(e, m.counts)) && typeof a == "string" && (a = a === "true");
|
|
306
|
+
let n = Array.isArray(a) ? a.map(function(t) {
|
|
307
|
+
return H(e, t);
|
|
308
|
+
}) : H(e, a);
|
|
309
|
+
return g(e, m.counts) && (P(n) || typeof n == "boolean") && (n = Z()), g(e, m.normalize) && g(e, m.arrays) && (Array.isArray(a) ? n = a.map((t) => T.normalize(t)) : n = T.normalize(a)), n;
|
|
310
310
|
}
|
|
311
|
-
function H(
|
|
312
|
-
return !
|
|
311
|
+
function H(e, a) {
|
|
312
|
+
return !h["parse-positional-numbers"] && e === "_" || !g(e, m.strings) && !g(e, m.bools) && !Array.isArray(a) && (Ne(a) && h["parse-numbers"] && Number.isSafeInteger(Math.floor(parseFloat(`${a}`))) || !P(a) && g(e, m.numbers)) && (a = Number(a)), a;
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function qe(e) {
|
|
315
315
|
const a = /* @__PURE__ */ Object.create(null);
|
|
316
|
-
|
|
317
|
-
const
|
|
318
|
-
if (
|
|
316
|
+
me(a, m.aliases, q), Object.keys(m.configs).forEach(function(c) {
|
|
317
|
+
const n = e[c] || a[c];
|
|
318
|
+
if (n)
|
|
319
319
|
try {
|
|
320
|
-
let
|
|
321
|
-
const l = T.resolve(T.cwd(),
|
|
320
|
+
let t = null;
|
|
321
|
+
const l = T.resolve(T.cwd(), n), p = m.configs[c];
|
|
322
322
|
if (typeof p == "function") {
|
|
323
323
|
try {
|
|
324
|
-
|
|
324
|
+
t = p(l);
|
|
325
325
|
} catch (d) {
|
|
326
|
-
|
|
326
|
+
t = d;
|
|
327
327
|
}
|
|
328
|
-
if (
|
|
329
|
-
|
|
328
|
+
if (t instanceof Error) {
|
|
329
|
+
y = t;
|
|
330
330
|
return;
|
|
331
331
|
}
|
|
332
332
|
} else
|
|
333
|
-
|
|
334
|
-
J(
|
|
335
|
-
} catch (
|
|
336
|
-
|
|
333
|
+
t = T.require(l);
|
|
334
|
+
J(t);
|
|
335
|
+
} catch (t) {
|
|
336
|
+
t.name === "PermissionDenied" ? y = t : e[c] && (y = Error(C("Invalid JSON config file: %s", n)));
|
|
337
337
|
}
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
|
-
function J(
|
|
341
|
-
Object.keys(
|
|
342
|
-
const
|
|
343
|
-
typeof
|
|
340
|
+
function J(e, a) {
|
|
341
|
+
Object.keys(e).forEach(function(c) {
|
|
342
|
+
const n = e[c], t = a ? a + "." + c : c;
|
|
343
|
+
typeof n == "object" && n !== null && !Array.isArray(n) && h["dot-notation"] ? J(n, t) : (!N(w, t.split(".")) || g(t, m.arrays) && h["combine-arrays"]) && b(t, n);
|
|
344
344
|
});
|
|
345
345
|
}
|
|
346
|
-
function
|
|
347
|
-
typeof
|
|
348
|
-
J(
|
|
346
|
+
function fe() {
|
|
347
|
+
typeof M < "u" && M.forEach(function(e) {
|
|
348
|
+
J(e);
|
|
349
349
|
});
|
|
350
350
|
}
|
|
351
|
-
function
|
|
352
|
-
if (typeof
|
|
351
|
+
function re(e, a) {
|
|
352
|
+
if (typeof B > "u")
|
|
353
353
|
return;
|
|
354
|
-
const c = typeof
|
|
355
|
-
Object.keys(
|
|
356
|
-
if (c === "" ||
|
|
357
|
-
const l =
|
|
358
|
-
return d === 0 && (p = p.substring(c.length)),
|
|
354
|
+
const c = typeof B == "string" ? B : "", n = T.env();
|
|
355
|
+
Object.keys(n).forEach(function(t) {
|
|
356
|
+
if (c === "" || t.lastIndexOf(c, 0) === 0) {
|
|
357
|
+
const l = t.split("__").map(function(p, d) {
|
|
358
|
+
return d === 0 && (p = p.substring(c.length)), $(p);
|
|
359
359
|
});
|
|
360
|
-
(a &&
|
|
360
|
+
(a && m.configs[l.join(".")] || !a) && !N(e, l) && b(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
|
-
Object.keys(
|
|
368
|
-
if (!c.has(
|
|
367
|
+
Object.keys(e).forEach(function(n) {
|
|
368
|
+
if (!c.has(n) && (a = g(n, m.coercions), typeof a == "function"))
|
|
369
369
|
try {
|
|
370
|
-
const
|
|
371
|
-
[].concat(
|
|
372
|
-
c.add(l),
|
|
370
|
+
const t = H(n, a(e[n]));
|
|
371
|
+
[].concat(m.aliases[n] || [], n).forEach((l) => {
|
|
372
|
+
c.add(l), e[l] = t;
|
|
373
373
|
});
|
|
374
|
-
} catch (
|
|
375
|
-
|
|
374
|
+
} catch (t) {
|
|
375
|
+
y = t;
|
|
376
376
|
}
|
|
377
377
|
});
|
|
378
378
|
}
|
|
379
|
-
function
|
|
380
|
-
return
|
|
381
|
-
~a.indexOf(".") || typeof
|
|
382
|
-
}),
|
|
379
|
+
function we(e) {
|
|
380
|
+
return m.keys.forEach((a) => {
|
|
381
|
+
~a.indexOf(".") || typeof e[a] > "u" && (e[a] = void 0);
|
|
382
|
+
}), e;
|
|
383
383
|
}
|
|
384
|
-
function
|
|
385
|
-
Object.keys(c).forEach(function(
|
|
386
|
-
|
|
387
|
-
|
|
384
|
+
function me(e, a, c, n = !1) {
|
|
385
|
+
Object.keys(c).forEach(function(t) {
|
|
386
|
+
N(e, t.split(".")) || (O(e, t.split("."), c[t]), n && (oe[t] = !0), (a[t] || []).forEach(function(l) {
|
|
387
|
+
N(e, l.split(".")) || O(e, l.split("."), c[t]);
|
|
388
388
|
}));
|
|
389
389
|
});
|
|
390
390
|
}
|
|
391
|
-
function
|
|
392
|
-
let c =
|
|
393
|
-
|
|
394
|
-
c = c[
|
|
391
|
+
function N(e, a) {
|
|
392
|
+
let c = e;
|
|
393
|
+
h["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(t) {
|
|
394
|
+
c = c[t] || {};
|
|
395
395
|
});
|
|
396
|
-
const
|
|
397
|
-
return typeof c != "object" ? !1 :
|
|
396
|
+
const n = a[a.length - 1];
|
|
397
|
+
return typeof c != "object" ? !1 : n in c;
|
|
398
398
|
}
|
|
399
|
-
function
|
|
400
|
-
let
|
|
401
|
-
|
|
402
|
-
v =
|
|
399
|
+
function O(e, a, c) {
|
|
400
|
+
let n = e;
|
|
401
|
+
h["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(v) {
|
|
402
|
+
v = ce(v), typeof n == "object" && n[v] === void 0 && (n[v] = {}), typeof n[v] != "object" || Array.isArray(n[v]) ? (Array.isArray(n[v]) ? n[v].push({}) : n[v] = [n[v], {}], n = n[v][n[v].length - 1]) : n = n[v];
|
|
403
403
|
});
|
|
404
|
-
const
|
|
405
|
-
let d =
|
|
406
|
-
!d && g(
|
|
404
|
+
const t = ce(a[a.length - 1]), l = g(a.join("."), m.arrays), p = Array.isArray(c);
|
|
405
|
+
let d = h["duplicate-arguments-array"];
|
|
406
|
+
!d && g(t, m.nargs) && (d = !0, (!P(n[t]) && m.nargs[t] === 1 || Array.isArray(n[t]) && n[t].length === m.nargs[t]) && (n[t] = void 0)), c === Z() ? n[t] = Z(n[t]) : Array.isArray(n[t]) ? d && l && p ? n[t] = h["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
|
-
function
|
|
409
|
-
|
|
408
|
+
function ve(...e) {
|
|
409
|
+
e.forEach(function(a) {
|
|
410
410
|
Object.keys(a || {}).forEach(function(c) {
|
|
411
|
-
|
|
412
|
-
if (/-/.test(
|
|
413
|
-
const
|
|
414
|
-
|
|
415
|
-
}
|
|
416
|
-
}),
|
|
417
|
-
if (
|
|
418
|
-
const
|
|
419
|
-
|
|
420
|
-
}
|
|
421
|
-
}),
|
|
422
|
-
|
|
423
|
-
return
|
|
411
|
+
m.aliases[c] || (m.aliases[c] = [].concat(k[c] || []), m.aliases[c].concat(c).forEach(function(n) {
|
|
412
|
+
if (/-/.test(n) && h["camel-case-expansion"]) {
|
|
413
|
+
const t = $(n);
|
|
414
|
+
t !== c && m.aliases[c].indexOf(t) === -1 && (m.aliases[c].push(t), G[t] = !0);
|
|
415
|
+
}
|
|
416
|
+
}), m.aliases[c].concat(c).forEach(function(n) {
|
|
417
|
+
if (n.length > 1 && /[A-Z]/.test(n) && h["camel-case-expansion"]) {
|
|
418
|
+
const t = ze(n, "-");
|
|
419
|
+
t !== c && m.aliases[c].indexOf(t) === -1 && (m.aliases[c].push(t), G[t] = !0);
|
|
420
|
+
}
|
|
421
|
+
}), m.aliases[c].forEach(function(n) {
|
|
422
|
+
m.aliases[n] = [c].concat(m.aliases[c].filter(function(t) {
|
|
423
|
+
return n !== t;
|
|
424
424
|
}));
|
|
425
425
|
}));
|
|
426
426
|
});
|
|
427
427
|
});
|
|
428
428
|
}
|
|
429
|
-
function g(
|
|
430
|
-
const c = [].concat(
|
|
431
|
-
return
|
|
429
|
+
function g(e, a) {
|
|
430
|
+
const c = [].concat(m.aliases[e] || [], e), n = Object.keys(a), t = c.find((l) => n.includes(l));
|
|
431
|
+
return t ? a[t] : !1;
|
|
432
432
|
}
|
|
433
|
-
function
|
|
434
|
-
const a = Object.keys(
|
|
435
|
-
return [].concat(a.map((
|
|
436
|
-
return Array.isArray(
|
|
433
|
+
function ue(e) {
|
|
434
|
+
const a = Object.keys(m);
|
|
435
|
+
return [].concat(a.map((n) => m[n])).some(function(n) {
|
|
436
|
+
return Array.isArray(n) ? n.includes(e) : n[e];
|
|
437
437
|
});
|
|
438
438
|
}
|
|
439
|
-
function
|
|
440
|
-
return [].concat(...a).some(function(
|
|
441
|
-
const
|
|
442
|
-
return
|
|
439
|
+
function xe(e, ...a) {
|
|
440
|
+
return [].concat(...a).some(function(n) {
|
|
441
|
+
const t = e.match(n);
|
|
442
|
+
return t && ue(t[1]);
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
|
-
function
|
|
446
|
-
if (
|
|
445
|
+
function Be(e) {
|
|
446
|
+
if (e.match(Q) || !e.match(/^-[^-]+/))
|
|
447
447
|
return !1;
|
|
448
448
|
let a = !0, c;
|
|
449
|
-
const
|
|
450
|
-
for (let
|
|
451
|
-
if (c =
|
|
449
|
+
const n = e.slice(1).split("");
|
|
450
|
+
for (let t = 0; t < n.length; t++) {
|
|
451
|
+
if (c = e.slice(t + 2), !ue(n[t])) {
|
|
452
452
|
a = !1;
|
|
453
453
|
break;
|
|
454
454
|
}
|
|
455
|
-
if (
|
|
455
|
+
if (n[t + 1] && n[t + 1] === "=" || c === "-" || /[A-Za-z]/.test(n[t]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(c) || n[t + 1] && n[t + 1].match(/\W/))
|
|
456
456
|
break;
|
|
457
457
|
}
|
|
458
458
|
return a;
|
|
459
459
|
}
|
|
460
|
-
function
|
|
461
|
-
return
|
|
460
|
+
function K(e) {
|
|
461
|
+
return h["unknown-options-as-args"] && ye(e);
|
|
462
462
|
}
|
|
463
|
-
function
|
|
464
|
-
return
|
|
463
|
+
function ye(e) {
|
|
464
|
+
return e = e.replace(/^-{3,}/, "--"), e.match(Q) || Be(e) ? !1 : !xe(e, /^-+([^=]+?)=[\s\S]*$/, W, /^-+([^=]+?)$/, /^-+([^=]+?)-$/, /^-+([^=]+?\d+)$/, /^-+([^=]+?)\W+.*$/);
|
|
465
465
|
}
|
|
466
|
-
function
|
|
467
|
-
return !g(
|
|
466
|
+
function z(e) {
|
|
467
|
+
return !g(e, m.bools) && !g(e, m.counts) && `${e}` in q ? q[e] : Ie(Le(e));
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function Ie(e) {
|
|
470
470
|
return {
|
|
471
471
|
[L.BOOLEAN]: !0,
|
|
472
472
|
[L.STRING]: "",
|
|
473
473
|
[L.NUMBER]: void 0,
|
|
474
474
|
[L.ARRAY]: []
|
|
475
|
-
}[
|
|
475
|
+
}[e];
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function Le(e) {
|
|
478
478
|
let a = L.BOOLEAN;
|
|
479
|
-
return g(
|
|
479
|
+
return g(e, m.strings) ? a = L.STRING : g(e, m.numbers) ? a = L.NUMBER : g(e, m.bools) ? a = L.BOOLEAN : g(e, m.arrays) && (a = L.ARRAY), a;
|
|
480
480
|
}
|
|
481
|
-
function
|
|
482
|
-
return
|
|
481
|
+
function P(e) {
|
|
482
|
+
return e === void 0;
|
|
483
483
|
}
|
|
484
|
-
function
|
|
485
|
-
Object.keys(
|
|
484
|
+
function Me() {
|
|
485
|
+
Object.keys(m.counts).find((e) => g(e, m.arrays) ? (y = Error(C("Invalid configuration: %s, opts.count excludes opts.array.", e)), !0) : g(e, m.nargs) ? (y = Error(C("Invalid configuration: %s, opts.count excludes opts.narg.", e)), !0) : !1);
|
|
486
486
|
}
|
|
487
487
|
return {
|
|
488
|
-
aliases: Object.assign({},
|
|
489
|
-
argv: Object.assign(
|
|
490
|
-
configuration:
|
|
491
|
-
defaulted: Object.assign({},
|
|
492
|
-
error:
|
|
493
|
-
newAliases: Object.assign({},
|
|
488
|
+
aliases: Object.assign({}, m.aliases),
|
|
489
|
+
argv: Object.assign(ne, w),
|
|
490
|
+
configuration: h,
|
|
491
|
+
defaulted: Object.assign({}, oe),
|
|
492
|
+
error: y,
|
|
493
|
+
newAliases: Object.assign({}, G)
|
|
494
494
|
};
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
function
|
|
498
|
-
const
|
|
497
|
+
function Ee(i) {
|
|
498
|
+
const o = [], u = /* @__PURE__ */ Object.create(null);
|
|
499
499
|
let s = !0;
|
|
500
|
-
for (Object.keys(i).forEach(function(
|
|
501
|
-
|
|
500
|
+
for (Object.keys(i).forEach(function(r) {
|
|
501
|
+
o.push([].concat(i[r], r));
|
|
502
502
|
}); s; ) {
|
|
503
503
|
s = !1;
|
|
504
|
-
for (let
|
|
505
|
-
for (let
|
|
506
|
-
if (
|
|
507
|
-
return
|
|
504
|
+
for (let r = 0; r < o.length; r++)
|
|
505
|
+
for (let _ = r + 1; _ < o.length; _++)
|
|
506
|
+
if (o[r].filter(function(h) {
|
|
507
|
+
return o[_].indexOf(h) !== -1;
|
|
508
508
|
}).length) {
|
|
509
|
-
|
|
509
|
+
o[r] = o[r].concat(o[_]), o.splice(_, 1), s = !0;
|
|
510
510
|
break;
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
|
-
return
|
|
514
|
-
|
|
515
|
-
return q.indexOf(
|
|
513
|
+
return o.forEach(function(r) {
|
|
514
|
+
r = r.filter(function(k, h, q) {
|
|
515
|
+
return q.indexOf(k) === h;
|
|
516
516
|
});
|
|
517
|
-
const
|
|
518
|
-
|
|
519
|
-
}),
|
|
517
|
+
const _ = r.pop();
|
|
518
|
+
_ !== void 0 && typeof _ == "string" && (u[_] = r);
|
|
519
|
+
}), u;
|
|
520
520
|
}
|
|
521
521
|
function Z(i) {
|
|
522
522
|
return i !== void 0 ? i + 1 : 1;
|
|
523
523
|
}
|
|
524
|
-
function
|
|
524
|
+
function ce(i) {
|
|
525
525
|
return i === "__proto__" ? "___proto___" : i;
|
|
526
526
|
}
|
|
527
|
-
function
|
|
527
|
+
function je(i) {
|
|
528
528
|
return typeof i == "string" && (i[0] === "'" || i[0] === '"') && i[i.length - 1] === i[0] ? i.substring(1, i.length - 1) : i;
|
|
529
529
|
}
|
|
530
530
|
/**
|
|
@@ -535,154 +535,154 @@ function Et(i) {
|
|
|
535
535
|
* Copyright (c) 2016, Contributors
|
|
536
536
|
* SPDX-License-Identifier: ISC
|
|
537
537
|
*/
|
|
538
|
-
var X,
|
|
539
|
-
const
|
|
540
|
-
if (
|
|
541
|
-
throw Error(`yargs parser supports a minimum Node.js version of ${
|
|
542
|
-
const
|
|
543
|
-
new
|
|
538
|
+
var X, ee, te;
|
|
539
|
+
const pe = process && process.env && process.env.YARGS_MIN_NODE_VERSION ? Number(process.env.YARGS_MIN_NODE_VERSION) : 12, le = (ee = (X = process == null ? void 0 : process.versions) === null || X === void 0 ? void 0 : X.node) !== null && ee !== void 0 ? ee : (te = process == null ? void 0 : process.version) === null || te === void 0 ? void 0 : te.slice(1);
|
|
540
|
+
if (le && Number(le.match(/^([^.]+)/)[1]) < pe)
|
|
541
|
+
throw Error(`yargs parser supports a minimum Node.js version of ${pe}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
|
|
542
|
+
const Ve = process ? process.env : {};
|
|
543
|
+
new De({
|
|
544
544
|
cwd: process.cwd,
|
|
545
|
-
env: () =>
|
|
546
|
-
format:
|
|
547
|
-
normalize:
|
|
548
|
-
resolve:
|
|
545
|
+
env: () => Ve,
|
|
546
|
+
format: _e,
|
|
547
|
+
normalize: Qe,
|
|
548
|
+
resolve: ae,
|
|
549
549
|
// TODO: figure out a way to combine ESM and CJS coverage, such that
|
|
550
550
|
// we can exercise all the lines below:
|
|
551
551
|
require: (i) => {
|
|
552
552
|
if (typeof require < "u")
|
|
553
553
|
return require(i);
|
|
554
554
|
if (i.match(/\.json$/))
|
|
555
|
-
return JSON.parse(
|
|
555
|
+
return JSON.parse(ke(i, "utf8"));
|
|
556
556
|
throw Error("only .json config files are supported in ESM");
|
|
557
557
|
}
|
|
558
558
|
});
|
|
559
|
-
const
|
|
559
|
+
const Fe = {
|
|
560
560
|
fs: {
|
|
561
|
-
readFileSync:
|
|
562
|
-
writeFile:
|
|
561
|
+
readFileSync: ke,
|
|
562
|
+
writeFile: Ae
|
|
563
563
|
},
|
|
564
|
-
format:
|
|
565
|
-
resolve:
|
|
564
|
+
format: _e,
|
|
565
|
+
resolve: ae,
|
|
566
566
|
exists: (i) => {
|
|
567
567
|
try {
|
|
568
|
-
return
|
|
568
|
+
return Pe(i).isFile();
|
|
569
569
|
} catch {
|
|
570
570
|
return !1;
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
};
|
|
574
|
-
let
|
|
575
|
-
class
|
|
576
|
-
constructor(
|
|
577
|
-
|
|
574
|
+
let I;
|
|
575
|
+
class He {
|
|
576
|
+
constructor(o) {
|
|
577
|
+
o = o || {}, this.directory = o.directory || "./locales", this.updateFiles = typeof o.updateFiles == "boolean" ? o.updateFiles : !0, this.locale = o.locale || "en", this.fallbackToLanguage = typeof o.fallbackToLanguage == "boolean" ? o.fallbackToLanguage : !0, this.cache = /* @__PURE__ */ Object.create(null), this.writeQueue = [];
|
|
578
578
|
}
|
|
579
|
-
__(...
|
|
579
|
+
__(...o) {
|
|
580
580
|
if (typeof arguments[0] != "string")
|
|
581
581
|
return this._taggedLiteral(arguments[0], ...arguments);
|
|
582
|
-
const
|
|
582
|
+
const u = o.shift();
|
|
583
583
|
let s = function() {
|
|
584
584
|
};
|
|
585
|
-
return typeof
|
|
586
|
-
}, this.cache[this.locale] || this._readLocaleFile(), !this.cache[this.locale][
|
|
585
|
+
return typeof o[o.length - 1] == "function" && (s = o.pop()), s = s || function() {
|
|
586
|
+
}, this.cache[this.locale] || this._readLocaleFile(), !this.cache[this.locale][u] && this.updateFiles ? (this.cache[this.locale][u] = u, this._enqueueWrite({
|
|
587
587
|
directory: this.directory,
|
|
588
588
|
locale: this.locale,
|
|
589
589
|
cb: s
|
|
590
|
-
})) : s(),
|
|
590
|
+
})) : s(), I.format.apply(I.format, [this.cache[this.locale][u] || u].concat(o));
|
|
591
591
|
}
|
|
592
592
|
__n() {
|
|
593
|
-
const
|
|
594
|
-
let
|
|
593
|
+
const o = Array.prototype.slice.call(arguments), u = o.shift(), s = o.shift(), r = o.shift();
|
|
594
|
+
let _ = function() {
|
|
595
595
|
};
|
|
596
|
-
typeof
|
|
597
|
-
let
|
|
598
|
-
this.cache[this.locale][
|
|
599
|
-
one:
|
|
596
|
+
typeof o[o.length - 1] == "function" && (_ = o.pop()), this.cache[this.locale] || this._readLocaleFile();
|
|
597
|
+
let k = r === 1 ? u : s;
|
|
598
|
+
this.cache[this.locale][u] && (k = this.cache[this.locale][u][r === 1 ? "one" : "other"]), !this.cache[this.locale][u] && this.updateFiles ? (this.cache[this.locale][u] = {
|
|
599
|
+
one: u,
|
|
600
600
|
other: s
|
|
601
601
|
}, this._enqueueWrite({
|
|
602
602
|
directory: this.directory,
|
|
603
603
|
locale: this.locale,
|
|
604
|
-
cb:
|
|
605
|
-
})) :
|
|
606
|
-
const
|
|
607
|
-
return ~
|
|
604
|
+
cb: _
|
|
605
|
+
})) : _();
|
|
606
|
+
const h = [k];
|
|
607
|
+
return ~k.indexOf("%d") && h.push(r), I.format.apply(I.format, h.concat(o));
|
|
608
608
|
}
|
|
609
|
-
setLocale(
|
|
610
|
-
this.locale =
|
|
609
|
+
setLocale(o) {
|
|
610
|
+
this.locale = o;
|
|
611
611
|
}
|
|
612
612
|
getLocale() {
|
|
613
613
|
return this.locale;
|
|
614
614
|
}
|
|
615
|
-
updateLocale(
|
|
615
|
+
updateLocale(o) {
|
|
616
616
|
this.cache[this.locale] || this._readLocaleFile();
|
|
617
|
-
for (const
|
|
618
|
-
Object.prototype.hasOwnProperty.call(
|
|
617
|
+
for (const u in o)
|
|
618
|
+
Object.prototype.hasOwnProperty.call(o, u) && (this.cache[this.locale][u] = o[u]);
|
|
619
619
|
}
|
|
620
|
-
_taggedLiteral(
|
|
620
|
+
_taggedLiteral(o, ...u) {
|
|
621
621
|
let s = "";
|
|
622
|
-
return
|
|
623
|
-
const
|
|
624
|
-
s +=
|
|
625
|
-
}), this.__.apply(this, [s].concat([].slice.call(
|
|
622
|
+
return o.forEach(function(r, _) {
|
|
623
|
+
const k = u[_ + 1];
|
|
624
|
+
s += r, typeof k < "u" && (s += "%s");
|
|
625
|
+
}), this.__.apply(this, [s].concat([].slice.call(u, 1)));
|
|
626
626
|
}
|
|
627
|
-
_enqueueWrite(
|
|
628
|
-
this.writeQueue.push(
|
|
627
|
+
_enqueueWrite(o) {
|
|
628
|
+
this.writeQueue.push(o), this.writeQueue.length === 1 && this._processWriteQueue();
|
|
629
629
|
}
|
|
630
630
|
_processWriteQueue() {
|
|
631
|
-
const
|
|
632
|
-
|
|
633
|
-
|
|
631
|
+
const o = this, u = this.writeQueue[0], s = u.directory, r = u.locale, _ = u.cb, k = this._resolveLocaleFile(s, r), h = JSON.stringify(this.cache[r], null, 2);
|
|
632
|
+
I.fs.writeFile(k, h, "utf-8", function(q) {
|
|
633
|
+
o.writeQueue.shift(), o.writeQueue.length > 0 && o._processWriteQueue(), _(q);
|
|
634
634
|
});
|
|
635
635
|
}
|
|
636
636
|
_readLocaleFile() {
|
|
637
|
-
let
|
|
638
|
-
const
|
|
637
|
+
let o = {};
|
|
638
|
+
const u = this._resolveLocaleFile(this.directory, this.locale);
|
|
639
639
|
try {
|
|
640
|
-
|
|
640
|
+
I.fs.readFileSync && (o = JSON.parse(I.fs.readFileSync(u, "utf-8")));
|
|
641
641
|
} catch (s) {
|
|
642
|
-
if (s instanceof SyntaxError && (s.message = "syntax error in " +
|
|
643
|
-
|
|
642
|
+
if (s instanceof SyntaxError && (s.message = "syntax error in " + u), s.code === "ENOENT")
|
|
643
|
+
o = {};
|
|
644
644
|
else
|
|
645
645
|
throw s;
|
|
646
646
|
}
|
|
647
|
-
this.cache[this.locale] =
|
|
647
|
+
this.cache[this.locale] = o;
|
|
648
648
|
}
|
|
649
|
-
_resolveLocaleFile(
|
|
650
|
-
let s =
|
|
651
|
-
if (this.fallbackToLanguage && !this._fileExistsSync(s) && ~
|
|
652
|
-
const
|
|
653
|
-
this._fileExistsSync(
|
|
649
|
+
_resolveLocaleFile(o, u) {
|
|
650
|
+
let s = I.resolve(o, "./", u + ".json");
|
|
651
|
+
if (this.fallbackToLanguage && !this._fileExistsSync(s) && ~u.lastIndexOf("_")) {
|
|
652
|
+
const r = I.resolve(o, "./", u.split("_")[0] + ".json");
|
|
653
|
+
this._fileExistsSync(r) && (s = r);
|
|
654
654
|
}
|
|
655
655
|
return s;
|
|
656
656
|
}
|
|
657
|
-
_fileExistsSync(
|
|
658
|
-
return
|
|
657
|
+
_fileExistsSync(o) {
|
|
658
|
+
return I.exists(o);
|
|
659
659
|
}
|
|
660
660
|
}
|
|
661
|
-
function
|
|
662
|
-
|
|
663
|
-
const
|
|
661
|
+
function Ke(i, o) {
|
|
662
|
+
I = o;
|
|
663
|
+
const u = new He(i);
|
|
664
664
|
return {
|
|
665
|
-
__:
|
|
666
|
-
__n:
|
|
667
|
-
setLocale:
|
|
668
|
-
getLocale:
|
|
669
|
-
updateLocale:
|
|
670
|
-
locale:
|
|
665
|
+
__: u.__.bind(u),
|
|
666
|
+
__n: u.__n.bind(u),
|
|
667
|
+
setLocale: u.setLocale.bind(u),
|
|
668
|
+
getLocale: u.getLocale.bind(u),
|
|
669
|
+
updateLocale: u.updateLocale.bind(u),
|
|
670
|
+
locale: u.locale
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
|
-
const
|
|
674
|
-
let
|
|
673
|
+
const $e = (i) => Ke(i, Fe);
|
|
674
|
+
let D;
|
|
675
675
|
try {
|
|
676
|
-
|
|
676
|
+
D = Te(import.meta.url);
|
|
677
677
|
} catch {
|
|
678
|
-
|
|
678
|
+
D = process.cwd();
|
|
679
679
|
}
|
|
680
|
-
const
|
|
681
|
-
|
|
682
|
-
directory:
|
|
680
|
+
const We = D.substring(0, D.lastIndexOf("node_modules"));
|
|
681
|
+
We || process.cwd(), process.cwd, process.exit, process.nextTick, typeof process.stdout.columns < "u" && process.stdout.columns, $e({
|
|
682
|
+
directory: ae(D, "../../../locales"),
|
|
683
683
|
updateFiles: !1
|
|
684
684
|
});
|
|
685
|
-
const
|
|
685
|
+
const ie = [
|
|
686
686
|
{
|
|
687
687
|
id: "anthropic",
|
|
688
688
|
name: "Anthropic",
|
|
@@ -2088,6 +2088,7 @@ const it = [
|
|
|
2088
2088
|
]
|
|
2089
2089
|
}
|
|
2090
2090
|
],
|
|
2091
|
+
fallback_model_providers: ["openai", "anthropic"],
|
|
2091
2092
|
models: [
|
|
2092
2093
|
{
|
|
2093
2094
|
id: "ada",
|
|
@@ -2168,464 +2169,6 @@ const it = [
|
|
|
2168
2169
|
input_mtok: 2
|
|
2169
2170
|
}
|
|
2170
2171
|
},
|
|
2171
|
-
{
|
|
2172
|
-
id: "gpt-3.5-turbo",
|
|
2173
|
-
match: {
|
|
2174
|
-
or: [
|
|
2175
|
-
{
|
|
2176
|
-
equals: "gpt-3.5-turbo"
|
|
2177
|
-
},
|
|
2178
|
-
{
|
|
2179
|
-
equals: "gpt-3.5-turbo-0301"
|
|
2180
|
-
},
|
|
2181
|
-
{
|
|
2182
|
-
equals: "gpt-3.5-turbo-0613"
|
|
2183
|
-
},
|
|
2184
|
-
{
|
|
2185
|
-
equals: "gpt-3.5-turbo-instruct"
|
|
2186
|
-
},
|
|
2187
|
-
{
|
|
2188
|
-
equals: "gpt-3.5-turbo-instruct-0914"
|
|
2189
|
-
}
|
|
2190
|
-
]
|
|
2191
|
-
},
|
|
2192
|
-
prices: {
|
|
2193
|
-
input_mtok: 1.5,
|
|
2194
|
-
output_mtok: 2
|
|
2195
|
-
}
|
|
2196
|
-
},
|
|
2197
|
-
{
|
|
2198
|
-
id: "gpt-3.5-turbo-0125",
|
|
2199
|
-
match: {
|
|
2200
|
-
equals: "gpt-3.5-turbo-0125"
|
|
2201
|
-
},
|
|
2202
|
-
prices: {
|
|
2203
|
-
input_mtok: 0.5,
|
|
2204
|
-
output_mtok: 1.5
|
|
2205
|
-
}
|
|
2206
|
-
},
|
|
2207
|
-
{
|
|
2208
|
-
id: "gpt-3.5-turbo-1106",
|
|
2209
|
-
match: {
|
|
2210
|
-
equals: "gpt-3.5-turbo-1106"
|
|
2211
|
-
},
|
|
2212
|
-
prices: {
|
|
2213
|
-
input_mtok: 1,
|
|
2214
|
-
output_mtok: 2
|
|
2215
|
-
}
|
|
2216
|
-
},
|
|
2217
|
-
{
|
|
2218
|
-
id: "gpt-3.5-turbo-16k-0613",
|
|
2219
|
-
match: {
|
|
2220
|
-
equals: "gpt-3.5-turbo-16k-0613"
|
|
2221
|
-
},
|
|
2222
|
-
prices: {
|
|
2223
|
-
input_mtok: 3,
|
|
2224
|
-
output_mtok: 4
|
|
2225
|
-
}
|
|
2226
|
-
},
|
|
2227
|
-
{
|
|
2228
|
-
id: "gpt-35-16k",
|
|
2229
|
-
match: {
|
|
2230
|
-
equals: "gpt-35-16k"
|
|
2231
|
-
},
|
|
2232
|
-
prices: {
|
|
2233
|
-
input_mtok: 3,
|
|
2234
|
-
output_mtok: 4
|
|
2235
|
-
}
|
|
2236
|
-
},
|
|
2237
|
-
{
|
|
2238
|
-
id: "gpt-35-turbo",
|
|
2239
|
-
match: {
|
|
2240
|
-
or: [
|
|
2241
|
-
{
|
|
2242
|
-
equals: "gpt-35-turbo"
|
|
2243
|
-
},
|
|
2244
|
-
{
|
|
2245
|
-
equals: "gpt-35-turbo-0613"
|
|
2246
|
-
},
|
|
2247
|
-
{
|
|
2248
|
-
equals: "gpt-35-turbo-1106"
|
|
2249
|
-
}
|
|
2250
|
-
]
|
|
2251
|
-
},
|
|
2252
|
-
prices: {
|
|
2253
|
-
input_mtok: 1.5,
|
|
2254
|
-
output_mtok: 2
|
|
2255
|
-
}
|
|
2256
|
-
},
|
|
2257
|
-
{
|
|
2258
|
-
id: "gpt-35-turbo-16k",
|
|
2259
|
-
match: {
|
|
2260
|
-
or: [
|
|
2261
|
-
{
|
|
2262
|
-
equals: "gpt-35-turbo-16k"
|
|
2263
|
-
},
|
|
2264
|
-
{
|
|
2265
|
-
equals: "gpt-35-turbo-16k-0613"
|
|
2266
|
-
}
|
|
2267
|
-
]
|
|
2268
|
-
},
|
|
2269
|
-
prices: {
|
|
2270
|
-
input_mtok: 3,
|
|
2271
|
-
output_mtok: 4
|
|
2272
|
-
}
|
|
2273
|
-
},
|
|
2274
|
-
{
|
|
2275
|
-
id: "gpt-4",
|
|
2276
|
-
match: {
|
|
2277
|
-
or: [
|
|
2278
|
-
{
|
|
2279
|
-
equals: "gpt-4"
|
|
2280
|
-
},
|
|
2281
|
-
{
|
|
2282
|
-
equals: "gpt-4-0314"
|
|
2283
|
-
},
|
|
2284
|
-
{
|
|
2285
|
-
equals: "gpt-4-0613"
|
|
2286
|
-
}
|
|
2287
|
-
]
|
|
2288
|
-
},
|
|
2289
|
-
prices: {
|
|
2290
|
-
input_mtok: 30,
|
|
2291
|
-
output_mtok: 60
|
|
2292
|
-
}
|
|
2293
|
-
},
|
|
2294
|
-
{
|
|
2295
|
-
id: "gpt-4-0125-preview",
|
|
2296
|
-
match: {
|
|
2297
|
-
equals: "gpt-4-0125-preview"
|
|
2298
|
-
},
|
|
2299
|
-
prices: {
|
|
2300
|
-
input_mtok: 10,
|
|
2301
|
-
output_mtok: 30
|
|
2302
|
-
}
|
|
2303
|
-
},
|
|
2304
|
-
{
|
|
2305
|
-
id: "gpt-4-1106-preview",
|
|
2306
|
-
match: {
|
|
2307
|
-
equals: "gpt-4-1106-preview"
|
|
2308
|
-
},
|
|
2309
|
-
prices: {
|
|
2310
|
-
input_mtok: 10,
|
|
2311
|
-
output_mtok: 30
|
|
2312
|
-
}
|
|
2313
|
-
},
|
|
2314
|
-
{
|
|
2315
|
-
id: "gpt-4-1106-vision-preview",
|
|
2316
|
-
match: {
|
|
2317
|
-
equals: "gpt-4-1106-vision-preview"
|
|
2318
|
-
},
|
|
2319
|
-
prices: {
|
|
2320
|
-
input_mtok: 10,
|
|
2321
|
-
output_mtok: 30
|
|
2322
|
-
}
|
|
2323
|
-
},
|
|
2324
|
-
{
|
|
2325
|
-
id: "gpt-4-32k",
|
|
2326
|
-
match: {
|
|
2327
|
-
or: [
|
|
2328
|
-
{
|
|
2329
|
-
equals: "gpt-4-32k"
|
|
2330
|
-
},
|
|
2331
|
-
{
|
|
2332
|
-
equals: "gpt-4-32k-0314"
|
|
2333
|
-
},
|
|
2334
|
-
{
|
|
2335
|
-
equals: "gpt-4-32k-0613"
|
|
2336
|
-
}
|
|
2337
|
-
]
|
|
2338
|
-
},
|
|
2339
|
-
prices: {
|
|
2340
|
-
input_mtok: 60,
|
|
2341
|
-
output_mtok: 120
|
|
2342
|
-
}
|
|
2343
|
-
},
|
|
2344
|
-
{
|
|
2345
|
-
id: "gpt-4-preview-1106",
|
|
2346
|
-
match: {
|
|
2347
|
-
equals: "gpt-4-preview-1106"
|
|
2348
|
-
},
|
|
2349
|
-
prices: {
|
|
2350
|
-
input_mtok: 10,
|
|
2351
|
-
output_mtok: 30
|
|
2352
|
-
}
|
|
2353
|
-
},
|
|
2354
|
-
{
|
|
2355
|
-
id: "gpt-4-turbo",
|
|
2356
|
-
match: {
|
|
2357
|
-
or: [
|
|
2358
|
-
{
|
|
2359
|
-
equals: "gpt-4-turbo"
|
|
2360
|
-
},
|
|
2361
|
-
{
|
|
2362
|
-
equals: "gpt-4-turbo-0125-preview"
|
|
2363
|
-
},
|
|
2364
|
-
{
|
|
2365
|
-
equals: "gpt-4-turbo-2024-04-09"
|
|
2366
|
-
},
|
|
2367
|
-
{
|
|
2368
|
-
equals: "gpt-4-turbo-preview"
|
|
2369
|
-
}
|
|
2370
|
-
]
|
|
2371
|
-
},
|
|
2372
|
-
prices: {
|
|
2373
|
-
input_mtok: 10,
|
|
2374
|
-
output_mtok: 30
|
|
2375
|
-
}
|
|
2376
|
-
},
|
|
2377
|
-
{
|
|
2378
|
-
id: "gpt-4-vision",
|
|
2379
|
-
match: {
|
|
2380
|
-
or: [
|
|
2381
|
-
{
|
|
2382
|
-
equals: "gpt-4-vision"
|
|
2383
|
-
},
|
|
2384
|
-
{
|
|
2385
|
-
equals: "gpt-4-vision-preview"
|
|
2386
|
-
}
|
|
2387
|
-
]
|
|
2388
|
-
},
|
|
2389
|
-
prices: {
|
|
2390
|
-
input_mtok: 10,
|
|
2391
|
-
output_mtok: 30
|
|
2392
|
-
}
|
|
2393
|
-
},
|
|
2394
|
-
{
|
|
2395
|
-
id: "gpt-4.1",
|
|
2396
|
-
match: {
|
|
2397
|
-
or: [
|
|
2398
|
-
{
|
|
2399
|
-
equals: "gpt-4.1"
|
|
2400
|
-
},
|
|
2401
|
-
{
|
|
2402
|
-
equals: "gpt-4.1-2025-04-14"
|
|
2403
|
-
}
|
|
2404
|
-
]
|
|
2405
|
-
},
|
|
2406
|
-
prices: {
|
|
2407
|
-
input_mtok: 2,
|
|
2408
|
-
cache_read_mtok: 0.5,
|
|
2409
|
-
output_mtok: 8
|
|
2410
|
-
}
|
|
2411
|
-
},
|
|
2412
|
-
{
|
|
2413
|
-
id: "gpt-4.1-mini",
|
|
2414
|
-
match: {
|
|
2415
|
-
or: [
|
|
2416
|
-
{
|
|
2417
|
-
equals: "gpt-4.1-mini"
|
|
2418
|
-
},
|
|
2419
|
-
{
|
|
2420
|
-
equals: "gpt-4.1-mini-2025-04-14"
|
|
2421
|
-
}
|
|
2422
|
-
]
|
|
2423
|
-
},
|
|
2424
|
-
prices: {
|
|
2425
|
-
input_mtok: 0.4,
|
|
2426
|
-
cache_read_mtok: 0.1,
|
|
2427
|
-
output_mtok: 1.6
|
|
2428
|
-
}
|
|
2429
|
-
},
|
|
2430
|
-
{
|
|
2431
|
-
id: "gpt-4.1-nano",
|
|
2432
|
-
match: {
|
|
2433
|
-
or: [
|
|
2434
|
-
{
|
|
2435
|
-
equals: "gpt-4.1-nano"
|
|
2436
|
-
},
|
|
2437
|
-
{
|
|
2438
|
-
equals: "gpt-4.1-nano-2025-04-14"
|
|
2439
|
-
}
|
|
2440
|
-
]
|
|
2441
|
-
},
|
|
2442
|
-
prices: {
|
|
2443
|
-
input_mtok: 0.1,
|
|
2444
|
-
cache_read_mtok: 0.03,
|
|
2445
|
-
output_mtok: 0.4
|
|
2446
|
-
}
|
|
2447
|
-
},
|
|
2448
|
-
{
|
|
2449
|
-
id: "gpt-4o-2024-0513",
|
|
2450
|
-
match: {
|
|
2451
|
-
or: [
|
|
2452
|
-
{
|
|
2453
|
-
equals: "gpt-4o-2024-05-13"
|
|
2454
|
-
},
|
|
2455
|
-
{
|
|
2456
|
-
equals: "gpt-4o-2024-0513"
|
|
2457
|
-
}
|
|
2458
|
-
]
|
|
2459
|
-
},
|
|
2460
|
-
prices: {
|
|
2461
|
-
input_mtok: 5,
|
|
2462
|
-
output_mtok: 15
|
|
2463
|
-
}
|
|
2464
|
-
},
|
|
2465
|
-
{
|
|
2466
|
-
id: "gpt-4o-2024-08-06",
|
|
2467
|
-
match: {
|
|
2468
|
-
equals: "gpt-4o-2024-08-06"
|
|
2469
|
-
},
|
|
2470
|
-
prices: {
|
|
2471
|
-
input_mtok: 2.5,
|
|
2472
|
-
cache_read_mtok: 1.25,
|
|
2473
|
-
output_mtok: 10
|
|
2474
|
-
}
|
|
2475
|
-
},
|
|
2476
|
-
{
|
|
2477
|
-
id: "gpt-4o-2024-1120",
|
|
2478
|
-
match: {
|
|
2479
|
-
or: [
|
|
2480
|
-
{
|
|
2481
|
-
equals: "gpt-4o-2024-1120"
|
|
2482
|
-
},
|
|
2483
|
-
{
|
|
2484
|
-
equals: "gpt-4o-2024-11-20"
|
|
2485
|
-
}
|
|
2486
|
-
]
|
|
2487
|
-
},
|
|
2488
|
-
prices: {
|
|
2489
|
-
input_mtok: 2.5,
|
|
2490
|
-
cache_read_mtok: 1.25,
|
|
2491
|
-
output_mtok: 10
|
|
2492
|
-
}
|
|
2493
|
-
},
|
|
2494
|
-
{
|
|
2495
|
-
id: "gpt-4o-mini",
|
|
2496
|
-
match: {
|
|
2497
|
-
or: [
|
|
2498
|
-
{
|
|
2499
|
-
equals: "gpt-4o-mini"
|
|
2500
|
-
},
|
|
2501
|
-
{
|
|
2502
|
-
equals: "gpt-4o-mini-0718"
|
|
2503
|
-
},
|
|
2504
|
-
{
|
|
2505
|
-
starts_with: "gpt-4o-mini-audio"
|
|
2506
|
-
}
|
|
2507
|
-
]
|
|
2508
|
-
},
|
|
2509
|
-
context_window: 128e3,
|
|
2510
|
-
prices: {
|
|
2511
|
-
input_mtok: 0.15,
|
|
2512
|
-
cache_read_mtok: 0.075,
|
|
2513
|
-
output_mtok: 0.6,
|
|
2514
|
-
input_audio_mtok: 10,
|
|
2515
|
-
output_audio_mtok: 20
|
|
2516
|
-
}
|
|
2517
|
-
},
|
|
2518
|
-
{
|
|
2519
|
-
id: "gpt-4o-mini-realtime",
|
|
2520
|
-
match: {
|
|
2521
|
-
starts_with: "gpt-4o-mini-realtime"
|
|
2522
|
-
},
|
|
2523
|
-
prices: {
|
|
2524
|
-
input_mtok: 0.6,
|
|
2525
|
-
cache_read_mtok: 0.3,
|
|
2526
|
-
output_mtok: 2.4,
|
|
2527
|
-
input_audio_mtok: 10,
|
|
2528
|
-
cache_audio_read_mtok: 0.3,
|
|
2529
|
-
output_audio_mtok: 20
|
|
2530
|
-
}
|
|
2531
|
-
},
|
|
2532
|
-
{
|
|
2533
|
-
id: "gpt-4o-realtime",
|
|
2534
|
-
match: {
|
|
2535
|
-
starts_with: "gpt-4o-realtime"
|
|
2536
|
-
},
|
|
2537
|
-
prices: {
|
|
2538
|
-
input_mtok: 5,
|
|
2539
|
-
cache_read_mtok: 2.5,
|
|
2540
|
-
output_mtok: 20,
|
|
2541
|
-
input_audio_mtok: 40,
|
|
2542
|
-
cache_audio_read_mtok: 2.5,
|
|
2543
|
-
output_audio_mtok: 80
|
|
2544
|
-
}
|
|
2545
|
-
},
|
|
2546
|
-
{
|
|
2547
|
-
id: "gpt-5",
|
|
2548
|
-
name: "GPT-5",
|
|
2549
|
-
description: "GPT-5 is OpenAI's flagship model for coding, reasoning, and agentic tasks across domains.",
|
|
2550
|
-
match: {
|
|
2551
|
-
or: [
|
|
2552
|
-
{
|
|
2553
|
-
equals: "gpt-5"
|
|
2554
|
-
},
|
|
2555
|
-
{
|
|
2556
|
-
equals: "gpt-5-2025-08-07"
|
|
2557
|
-
}
|
|
2558
|
-
]
|
|
2559
|
-
},
|
|
2560
|
-
context_window: 4e5,
|
|
2561
|
-
prices: {
|
|
2562
|
-
input_mtok: 1.25,
|
|
2563
|
-
cache_read_mtok: 0.125,
|
|
2564
|
-
output_mtok: 10
|
|
2565
|
-
}
|
|
2566
|
-
},
|
|
2567
|
-
{
|
|
2568
|
-
id: "gpt-5-mini",
|
|
2569
|
-
name: "GPT-5 mini",
|
|
2570
|
-
description: "GPT-5 mini is a faster, more cost-efficient version of GPT-5. It's great for well-defined tasks and precise prompts.",
|
|
2571
|
-
match: {
|
|
2572
|
-
or: [
|
|
2573
|
-
{
|
|
2574
|
-
equals: "gpt-5-mini"
|
|
2575
|
-
},
|
|
2576
|
-
{
|
|
2577
|
-
equals: "gpt-5-mini-2025-08-07"
|
|
2578
|
-
}
|
|
2579
|
-
]
|
|
2580
|
-
},
|
|
2581
|
-
context_window: 4e5,
|
|
2582
|
-
prices: {
|
|
2583
|
-
input_mtok: 0.25,
|
|
2584
|
-
cache_read_mtok: 0.025,
|
|
2585
|
-
output_mtok: 2
|
|
2586
|
-
}
|
|
2587
|
-
},
|
|
2588
|
-
{
|
|
2589
|
-
id: "gpt-5-nano",
|
|
2590
|
-
name: "GPT-5 nano",
|
|
2591
|
-
description: "GPT-5 Nano is OpenAI's fastest, cheapest version of GPT-5. It's great for summarization and classification tasks.",
|
|
2592
|
-
match: {
|
|
2593
|
-
or: [
|
|
2594
|
-
{
|
|
2595
|
-
equals: "gpt-5-nano"
|
|
2596
|
-
},
|
|
2597
|
-
{
|
|
2598
|
-
equals: "gpt-5-nano-2025-04-14"
|
|
2599
|
-
}
|
|
2600
|
-
]
|
|
2601
|
-
},
|
|
2602
|
-
context_window: 4e5,
|
|
2603
|
-
prices: {
|
|
2604
|
-
input_mtok: 0.05,
|
|
2605
|
-
cache_read_mtok: 5e-3,
|
|
2606
|
-
output_mtok: 0.4
|
|
2607
|
-
}
|
|
2608
|
-
},
|
|
2609
|
-
{
|
|
2610
|
-
id: "gpt35",
|
|
2611
|
-
match: {
|
|
2612
|
-
equals: "gpt35"
|
|
2613
|
-
},
|
|
2614
|
-
prices: {
|
|
2615
|
-
input_mtok: 1.5,
|
|
2616
|
-
output_mtok: 2
|
|
2617
|
-
}
|
|
2618
|
-
},
|
|
2619
|
-
{
|
|
2620
|
-
id: "gpt4-turbo-preview",
|
|
2621
|
-
match: {
|
|
2622
|
-
equals: "gpt4-turbo-preview"
|
|
2623
|
-
},
|
|
2624
|
-
prices: {
|
|
2625
|
-
input_mtok: 10,
|
|
2626
|
-
output_mtok: 30
|
|
2627
|
-
}
|
|
2628
|
-
},
|
|
2629
2172
|
{
|
|
2630
2173
|
id: "mai-ds-r1:free",
|
|
2631
2174
|
name: "MAI DS R1 (free)",
|
|
@@ -3551,6 +3094,7 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3551
3094
|
]
|
|
3552
3095
|
}
|
|
3553
3096
|
],
|
|
3097
|
+
fallback_model_providers: ["anthropic"],
|
|
3554
3098
|
models: [
|
|
3555
3099
|
{
|
|
3556
3100
|
id: "claude-3-5-haiku",
|
|
@@ -3744,16 +3288,19 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3744
3288
|
match: {
|
|
3745
3289
|
or: [
|
|
3746
3290
|
{
|
|
3747
|
-
|
|
3291
|
+
ends_with: "gemini-2.0-flash"
|
|
3292
|
+
},
|
|
3293
|
+
{
|
|
3294
|
+
contains: "gemini-2.0-flash-0"
|
|
3748
3295
|
},
|
|
3749
3296
|
{
|
|
3750
|
-
|
|
3297
|
+
contains: "gemini-2.0-flash-exp"
|
|
3751
3298
|
},
|
|
3752
3299
|
{
|
|
3753
|
-
|
|
3300
|
+
contains: "gemini-2.0-flash-thinking"
|
|
3754
3301
|
},
|
|
3755
3302
|
{
|
|
3756
|
-
|
|
3303
|
+
contains: "gemini-2.0-flash-latest"
|
|
3757
3304
|
}
|
|
3758
3305
|
]
|
|
3759
3306
|
},
|
|
@@ -3922,6 +3469,51 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3922
3469
|
}
|
|
3923
3470
|
}
|
|
3924
3471
|
},
|
|
3472
|
+
{
|
|
3473
|
+
id: "gemini-3-flash-preview",
|
|
3474
|
+
name: "Gemini 3 Flash Preview",
|
|
3475
|
+
description: "Google's ultra-fast frontier model optimized for speed and efficiency. Delivers state-of-the-art performance while maintaining low latency and cost, with improved reasoning and coding capabilities.",
|
|
3476
|
+
match: {
|
|
3477
|
+
or: [
|
|
3478
|
+
{
|
|
3479
|
+
equals: "gemini-3-flash-preview"
|
|
3480
|
+
},
|
|
3481
|
+
{
|
|
3482
|
+
starts_with: "gemini-3-flash-preview-"
|
|
3483
|
+
}
|
|
3484
|
+
]
|
|
3485
|
+
},
|
|
3486
|
+
context_window: 1e6,
|
|
3487
|
+
price_comments: "See https://ai.google.dev/gemini-api/docs/pricing. Standard pricing shown; Batch API offers 50% discount on input/output.",
|
|
3488
|
+
prices: {
|
|
3489
|
+
input_mtok: 0.5,
|
|
3490
|
+
cache_read_mtok: 0.05,
|
|
3491
|
+
output_mtok: 3,
|
|
3492
|
+
input_audio_mtok: 1,
|
|
3493
|
+
cache_audio_read_mtok: 0.1
|
|
3494
|
+
}
|
|
3495
|
+
},
|
|
3496
|
+
{
|
|
3497
|
+
id: "gemini-3-pro-image-preview",
|
|
3498
|
+
name: "Gemini 3 Pro Image Preview",
|
|
3499
|
+
description: "Google's image generation model optimized for high-quality image generation. Supports 1K/2K and 4K resolution outputs with flexible pricing based on image dimensions.",
|
|
3500
|
+
match: {
|
|
3501
|
+
or: [
|
|
3502
|
+
{
|
|
3503
|
+
starts_with: "gemini-3-pro-image-preview"
|
|
3504
|
+
},
|
|
3505
|
+
{
|
|
3506
|
+
equals: "gemini-3-pro-image-preview"
|
|
3507
|
+
}
|
|
3508
|
+
]
|
|
3509
|
+
},
|
|
3510
|
+
context_window: 1e6,
|
|
3511
|
+
price_comments: "See https://ai.google.dev/gemini-api/docs/pricing#gemini-3-pro-image. Image output is priced at $120 per 1M tokens, with each 1K/2K image = 1120 tokens = $0.134/image and each 4K image = 2000 tokens = $0.24/image.",
|
|
3512
|
+
prices: {
|
|
3513
|
+
input_mtok: 2,
|
|
3514
|
+
output_mtok: 120
|
|
3515
|
+
}
|
|
3516
|
+
},
|
|
3925
3517
|
{
|
|
3926
3518
|
id: "gemini-3-pro-preview",
|
|
3927
3519
|
name: "Gemini 3 Pro Preview",
|
|
@@ -3932,7 +3524,7 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3932
3524
|
starts_with: "gemini-3-pro-preview"
|
|
3933
3525
|
},
|
|
3934
3526
|
{
|
|
3935
|
-
|
|
3527
|
+
equals: "gemini-3-pro-text-preview"
|
|
3936
3528
|
}
|
|
3937
3529
|
]
|
|
3938
3530
|
},
|
|
@@ -8775,18 +8367,6 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
8775
8367
|
output_mtok: 0.6
|
|
8776
8368
|
}
|
|
8777
8369
|
},
|
|
8778
|
-
{
|
|
8779
|
-
id: "mistral-small",
|
|
8780
|
-
name: "Mistral Small",
|
|
8781
|
-
description: "With 22 billion parameters, Mistral Small v24.09 offers a convenient mid-point between (Mistral NeMo 12B)[/mistralai/mistral-nemo] and (Mistral Large 2)[/mistralai/mistral-large], providing a cost-effective solution that can be deployed across various platforms and environments. It has better reasoning, exhibits more capabilities, can produce and reason about code, and is multiligual, supporting English, French, German, Italian, and Spanish.",
|
|
8782
|
-
match: {
|
|
8783
|
-
starts_with: "mistral-small"
|
|
8784
|
-
},
|
|
8785
|
-
prices: {
|
|
8786
|
-
input_mtok: 0.2,
|
|
8787
|
-
output_mtok: 0.6
|
|
8788
|
-
}
|
|
8789
|
-
},
|
|
8790
8370
|
{
|
|
8791
8371
|
id: "mistral-small-24b-instruct-2501",
|
|
8792
8372
|
name: "Mistral Small 3",
|
|
@@ -10184,9 +9764,6 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
10184
9764
|
{
|
|
10185
9765
|
equals: "gpt-5.2-pro-2025-12-11"
|
|
10186
9766
|
},
|
|
10187
|
-
{
|
|
10188
|
-
equals: "gpt-5-2"
|
|
10189
|
-
},
|
|
10190
9767
|
{
|
|
10191
9768
|
equals: "gpt-5-2-pro-2025-12-11"
|
|
10192
9769
|
}
|
|
@@ -10903,6 +10480,96 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
10903
10480
|
output_mtok: 15
|
|
10904
10481
|
}
|
|
10905
10482
|
},
|
|
10483
|
+
{
|
|
10484
|
+
id: "anthropic/claude-haiku-4.5",
|
|
10485
|
+
match: {
|
|
10486
|
+
or: [
|
|
10487
|
+
{
|
|
10488
|
+
equals: "anthropic/claude-haiku-4.5"
|
|
10489
|
+
},
|
|
10490
|
+
{
|
|
10491
|
+
equals: "anthropic/claude-haiku-4.5:beta"
|
|
10492
|
+
}
|
|
10493
|
+
]
|
|
10494
|
+
},
|
|
10495
|
+
prices: {
|
|
10496
|
+
input_mtok: 1,
|
|
10497
|
+
cache_write_mtok: 1.25,
|
|
10498
|
+
cache_read_mtok: 0.1,
|
|
10499
|
+
output_mtok: 5
|
|
10500
|
+
}
|
|
10501
|
+
},
|
|
10502
|
+
{
|
|
10503
|
+
id: "anthropic/claude-opus-4.5",
|
|
10504
|
+
match: {
|
|
10505
|
+
or: [
|
|
10506
|
+
{
|
|
10507
|
+
equals: "anthropic/claude-opus-4.5"
|
|
10508
|
+
},
|
|
10509
|
+
{
|
|
10510
|
+
equals: "anthropic/claude-opus-4.5:beta"
|
|
10511
|
+
}
|
|
10512
|
+
]
|
|
10513
|
+
},
|
|
10514
|
+
prices: {
|
|
10515
|
+
input_mtok: 5,
|
|
10516
|
+
cache_write_mtok: 6.25,
|
|
10517
|
+
cache_read_mtok: 0.5,
|
|
10518
|
+
output_mtok: 25
|
|
10519
|
+
}
|
|
10520
|
+
},
|
|
10521
|
+
{
|
|
10522
|
+
id: "anthropic/claude-sonnet-4.5",
|
|
10523
|
+
match: {
|
|
10524
|
+
or: [
|
|
10525
|
+
{
|
|
10526
|
+
equals: "anthropic/claude-sonnet-4.5"
|
|
10527
|
+
},
|
|
10528
|
+
{
|
|
10529
|
+
equals: "anthropic/claude-sonnet-4.5:beta"
|
|
10530
|
+
}
|
|
10531
|
+
]
|
|
10532
|
+
},
|
|
10533
|
+
context_window: 1e6,
|
|
10534
|
+
prices: {
|
|
10535
|
+
input_mtok: {
|
|
10536
|
+
base: 3,
|
|
10537
|
+
tiers: [
|
|
10538
|
+
{
|
|
10539
|
+
start: 2e5,
|
|
10540
|
+
price: 6
|
|
10541
|
+
}
|
|
10542
|
+
]
|
|
10543
|
+
},
|
|
10544
|
+
cache_write_mtok: {
|
|
10545
|
+
base: 3.75,
|
|
10546
|
+
tiers: [
|
|
10547
|
+
{
|
|
10548
|
+
start: 2e5,
|
|
10549
|
+
price: 7.5
|
|
10550
|
+
}
|
|
10551
|
+
]
|
|
10552
|
+
},
|
|
10553
|
+
cache_read_mtok: {
|
|
10554
|
+
base: 0.3,
|
|
10555
|
+
tiers: [
|
|
10556
|
+
{
|
|
10557
|
+
start: 2e5,
|
|
10558
|
+
price: 0.6
|
|
10559
|
+
}
|
|
10560
|
+
]
|
|
10561
|
+
},
|
|
10562
|
+
output_mtok: {
|
|
10563
|
+
base: 15,
|
|
10564
|
+
tiers: [
|
|
10565
|
+
{
|
|
10566
|
+
start: 2e5,
|
|
10567
|
+
price: 22.5
|
|
10568
|
+
}
|
|
10569
|
+
]
|
|
10570
|
+
}
|
|
10571
|
+
}
|
|
10572
|
+
},
|
|
10906
10573
|
{
|
|
10907
10574
|
id: "anubis-pro-105b-v1",
|
|
10908
10575
|
name: "Anubis Pro 105B V1",
|
|
@@ -18221,104 +17888,181 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
18221
17888
|
cache_read_mtok: 0.75,
|
|
18222
17889
|
output_mtok: 15
|
|
18223
17890
|
}
|
|
17891
|
+
},
|
|
17892
|
+
{
|
|
17893
|
+
id: "grok-4-1-fast-non-reasoning",
|
|
17894
|
+
name: "Grok 4.1 Fast Non-Reasoning",
|
|
17895
|
+
description: "A frontier multimodal model optimized specifically for high-performance agentic tool calling.",
|
|
17896
|
+
match: {
|
|
17897
|
+
or: [
|
|
17898
|
+
{
|
|
17899
|
+
equals: "grok-4-1-fast-non-reasoning"
|
|
17900
|
+
},
|
|
17901
|
+
{
|
|
17902
|
+
equals: "grok-4-1-fast-non-reasoning-latest"
|
|
17903
|
+
}
|
|
17904
|
+
]
|
|
17905
|
+
},
|
|
17906
|
+
context_window: 2e6,
|
|
17907
|
+
prices: {
|
|
17908
|
+
input_mtok: 0.2,
|
|
17909
|
+
cache_read_mtok: 0.05,
|
|
17910
|
+
output_mtok: 0.5
|
|
17911
|
+
}
|
|
17912
|
+
},
|
|
17913
|
+
{
|
|
17914
|
+
id: "grok-4-1-fast-reasoning",
|
|
17915
|
+
name: "Grok 4.1 Fast Reasoning",
|
|
17916
|
+
description: "A frontier multimodal model optimized specifically for high-performance agentic tool calling.",
|
|
17917
|
+
match: {
|
|
17918
|
+
or: [
|
|
17919
|
+
{
|
|
17920
|
+
equals: "grok-4-1-fast"
|
|
17921
|
+
},
|
|
17922
|
+
{
|
|
17923
|
+
equals: "grok-4-1-fast-reasoning"
|
|
17924
|
+
},
|
|
17925
|
+
{
|
|
17926
|
+
equals: "grok-4-1-fast-reasoning-latest"
|
|
17927
|
+
}
|
|
17928
|
+
]
|
|
17929
|
+
},
|
|
17930
|
+
context_window: 2e6,
|
|
17931
|
+
prices: {
|
|
17932
|
+
input_mtok: 0.2,
|
|
17933
|
+
cache_read_mtok: 0.05,
|
|
17934
|
+
output_mtok: 0.5
|
|
17935
|
+
}
|
|
17936
|
+
},
|
|
17937
|
+
{
|
|
17938
|
+
id: "grok-code-fast-1",
|
|
17939
|
+
name: "Grok Code Fast 1",
|
|
17940
|
+
description: "A speedy and economical reasoning model that excels at agentic coding.",
|
|
17941
|
+
match: {
|
|
17942
|
+
or: [
|
|
17943
|
+
{
|
|
17944
|
+
equals: "grok-code-fast"
|
|
17945
|
+
},
|
|
17946
|
+
{
|
|
17947
|
+
equals: "grok-code-fast-1"
|
|
17948
|
+
},
|
|
17949
|
+
{
|
|
17950
|
+
equals: "grok-code-fast-1-0825"
|
|
17951
|
+
}
|
|
17952
|
+
]
|
|
17953
|
+
},
|
|
17954
|
+
context_window: 256e3,
|
|
17955
|
+
prices: {
|
|
17956
|
+
input_mtok: 0.2,
|
|
17957
|
+
cache_read_mtok: 0.02,
|
|
17958
|
+
output_mtok: 1.5
|
|
17959
|
+
}
|
|
18224
17960
|
}
|
|
18225
17961
|
]
|
|
18226
17962
|
}
|
|
18227
17963
|
];
|
|
18228
|
-
function
|
|
18229
|
-
if (
|
|
18230
|
-
let
|
|
18231
|
-
const
|
|
18232
|
-
|
|
18233
|
-
|
|
18234
|
-
const _ = s[h], q = s[h + 1]?.start ?? 1 / 0, B = Math.max(0, Math.min(n, q) - _.start);
|
|
18235
|
-
B > 0 && (m += B * _.price / 1e6);
|
|
18236
|
-
}
|
|
18237
|
-
return m;
|
|
17964
|
+
function Ue(i, o, u) {
|
|
17965
|
+
if (o <= 0) return 0;
|
|
17966
|
+
let s = i.base;
|
|
17967
|
+
for (const r of i.tiers)
|
|
17968
|
+
u > r.start && (s = r.price);
|
|
17969
|
+
return s * o / 1e6;
|
|
18238
17970
|
}
|
|
18239
|
-
function
|
|
18240
|
-
return i === void 0 ||
|
|
17971
|
+
function R(i, o, u, s) {
|
|
17972
|
+
return i === void 0 || o === void 0 ? 0 : typeof i == "number" ? i * o / 1e6 : Ue(i, o, s);
|
|
18241
17973
|
}
|
|
18242
|
-
function
|
|
18243
|
-
let
|
|
18244
|
-
const
|
|
18245
|
-
let
|
|
18246
|
-
if (
|
|
17974
|
+
function Ye(i, o) {
|
|
17975
|
+
let u = 0, s = 0;
|
|
17976
|
+
const r = i.input_tokens ?? 0, _ = i.cache_read_tokens ?? 0, k = i.cache_write_tokens ?? 0, h = i.cache_audio_read_tokens ?? 0, q = i.output_audio_tokens ?? 0;
|
|
17977
|
+
let M = i.input_audio_tokens ?? 0;
|
|
17978
|
+
if (M -= h, M < 0)
|
|
18247
17979
|
throw new Error("cache_audio_read_tokens cannot be greater than input_audio_tokens");
|
|
18248
17980
|
let B = i.input_tokens ?? 0;
|
|
18249
|
-
if (B -=
|
|
17981
|
+
if (B -= _, B -= k, B -= M, B < 0)
|
|
18250
17982
|
throw new Error("Uncached text input tokens cannot be negative");
|
|
18251
|
-
let
|
|
18252
|
-
if (
|
|
17983
|
+
let S = _;
|
|
17984
|
+
if (S -= h, S < 0)
|
|
18253
17985
|
throw new Error("cache_audio_read_tokens cannot be greater than cache_read_tokens");
|
|
18254
|
-
|
|
18255
|
-
let
|
|
18256
|
-
if (
|
|
17986
|
+
u += R(o.input_mtok, B, "input_mtok", r), u += R(o.cache_read_mtok, S, "cache_read_mtok", r), u += R(o.cache_write_mtok, k, "cache_write_mtok", r), u += R(o.input_audio_mtok, M, "input_audio_mtok", r), u += R(o.cache_audio_read_mtok, h, "cache_audio_read_mtok", r);
|
|
17987
|
+
let A = i.output_tokens ?? 0;
|
|
17988
|
+
if (A -= q, A < 0)
|
|
18257
17989
|
throw new Error("output_audio_tokens cannot be greater than output_tokens");
|
|
18258
|
-
s +=
|
|
18259
|
-
let
|
|
18260
|
-
return
|
|
18261
|
-
input_price:
|
|
17990
|
+
s += R(o.output_mtok, A, "output_mtok", r), s += R(o.output_audio_mtok, i.output_audio_tokens, "output_audio_mtok", r);
|
|
17991
|
+
let G = u + s;
|
|
17992
|
+
return o.requests_kcount !== void 0 && (G += o.requests_kcount / 1e3), {
|
|
17993
|
+
input_price: u,
|
|
18262
17994
|
output_price: s,
|
|
18263
|
-
total_price:
|
|
17995
|
+
total_price: G
|
|
18264
17996
|
};
|
|
18265
17997
|
}
|
|
18266
|
-
function
|
|
17998
|
+
function Je(i, o) {
|
|
18267
17999
|
if (!Array.isArray(i.prices))
|
|
18268
18000
|
return i.prices;
|
|
18269
|
-
for (let
|
|
18270
|
-
const s = i.prices[
|
|
18271
|
-
if (
|
|
18001
|
+
for (let u = i.prices.length - 1; u >= 0; u--) {
|
|
18002
|
+
const s = i.prices[u], r = s.constraint;
|
|
18003
|
+
if (r === void 0)
|
|
18272
18004
|
return s.prices;
|
|
18273
|
-
if (
|
|
18274
|
-
if (
|
|
18005
|
+
if (r.type === "start_date") {
|
|
18006
|
+
if (o >= new Date(r.start_date))
|
|
18275
18007
|
return s.prices;
|
|
18276
18008
|
} else {
|
|
18277
|
-
const
|
|
18278
|
-
if (
|
|
18279
|
-
if (
|
|
18009
|
+
const _ = o.toISOString().slice(11, 19), k = r.start_time, h = r.end_time;
|
|
18010
|
+
if (h < k) {
|
|
18011
|
+
if (_ >= k || _ < h)
|
|
18280
18012
|
return s.prices;
|
|
18281
|
-
} else if (
|
|
18013
|
+
} else if (_ >= k && _ < h)
|
|
18282
18014
|
return s.prices;
|
|
18283
18015
|
}
|
|
18284
18016
|
}
|
|
18285
18017
|
return i.prices[0].prices;
|
|
18286
18018
|
}
|
|
18287
|
-
function E(i,
|
|
18288
|
-
return "or" in i ? i.or.some((
|
|
18019
|
+
function E(i, o) {
|
|
18020
|
+
return "or" in i ? i.or.some((u) => E(u, o)) : "and" in i ? i.and.every((u) => E(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;
|
|
18289
18021
|
}
|
|
18290
|
-
function
|
|
18291
|
-
const
|
|
18292
|
-
return s || i.find((
|
|
18022
|
+
function Ze(i, o) {
|
|
18023
|
+
const u = o.toLowerCase().trim(), s = i.find((r) => r.id === u);
|
|
18024
|
+
return s || i.find((r) => r.provider_match && E(r.provider_match, u));
|
|
18293
18025
|
}
|
|
18294
|
-
function
|
|
18026
|
+
function Xe(i, { modelId: o, providerApiUrl: u, providerId: s }) {
|
|
18295
18027
|
if (s)
|
|
18296
|
-
return
|
|
18297
|
-
if (
|
|
18298
|
-
return i.find((
|
|
18299
|
-
if (
|
|
18300
|
-
return i.find((
|
|
18028
|
+
return Ze(i, s);
|
|
18029
|
+
if (u)
|
|
18030
|
+
return i.find((r) => new RegExp(r.api_pattern).test(u));
|
|
18031
|
+
if (o)
|
|
18032
|
+
return i.find((r) => r.model_match && E(r.model_match, o));
|
|
18033
|
+
}
|
|
18034
|
+
function et(i, o) {
|
|
18035
|
+
return i.find((u) => E(u.match, o));
|
|
18301
18036
|
}
|
|
18302
|
-
function
|
|
18303
|
-
|
|
18037
|
+
function ge(i, o, u) {
|
|
18038
|
+
const s = et(i.models, o);
|
|
18039
|
+
if (s) return s;
|
|
18040
|
+
if (i.fallback_model_providers && u)
|
|
18041
|
+
for (const r of i.fallback_model_providers) {
|
|
18042
|
+
const _ = u.find((k) => k.id === r);
|
|
18043
|
+
if (_) {
|
|
18044
|
+
const k = ge(_, o);
|
|
18045
|
+
if (k) return k;
|
|
18046
|
+
}
|
|
18047
|
+
}
|
|
18304
18048
|
}
|
|
18305
|
-
let
|
|
18306
|
-
Promise.resolve(
|
|
18307
|
-
function
|
|
18308
|
-
const s =
|
|
18309
|
-
if (!
|
|
18310
|
-
const
|
|
18311
|
-
if (!
|
|
18312
|
-
const
|
|
18049
|
+
let de = ie;
|
|
18050
|
+
Promise.resolve(ie);
|
|
18051
|
+
function tt(i, o, u) {
|
|
18052
|
+
const s = o.toLowerCase().trim(), r = u?.provider ?? Xe(de, { modelId: s, providerApiUrl: u?.providerApiUrl, providerId: u?.providerId });
|
|
18053
|
+
if (!r) return null;
|
|
18054
|
+
const _ = ge(r, s, de);
|
|
18055
|
+
if (!_) return null;
|
|
18056
|
+
const k = u?.timestamp ?? /* @__PURE__ */ new Date(), h = Je(_, k), q = Ye(i, h);
|
|
18313
18057
|
return {
|
|
18314
18058
|
auto_update_timestamp: void 0,
|
|
18315
|
-
model:
|
|
18316
|
-
model_price:
|
|
18317
|
-
provider:
|
|
18059
|
+
model: _,
|
|
18060
|
+
model_price: h,
|
|
18061
|
+
provider: r,
|
|
18318
18062
|
...q
|
|
18319
18063
|
};
|
|
18320
18064
|
}
|
|
18321
|
-
const f =
|
|
18065
|
+
const f = he(Re(process.argv)).scriptName("genai-prices").command(
|
|
18322
18066
|
"list [provider]",
|
|
18323
18067
|
"List providers and models",
|
|
18324
18068
|
(i) => i.positional("provider", { describe: "Provider ID to filter", type: "string" })
|
|
@@ -18327,25 +18071,25 @@ const f = dt(Gt(process.argv)).scriptName("genai-prices").command(
|
|
|
18327
18071
|
"Calculate price",
|
|
18328
18072
|
(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" })
|
|
18329
18073
|
).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();
|
|
18330
|
-
function
|
|
18074
|
+
function at() {
|
|
18331
18075
|
if (f._[0] === "list") {
|
|
18332
|
-
const
|
|
18076
|
+
const u = ie;
|
|
18333
18077
|
if (f.provider) {
|
|
18334
|
-
const s =
|
|
18078
|
+
const s = u.find((r) => r.id === f.provider);
|
|
18335
18079
|
s || (console.error(`Provider ${f.provider} not found.`), process.exit(1)), console.log(`${s.name}: (${s.models.length} models)`);
|
|
18336
|
-
for (const
|
|
18337
|
-
console.log(` ${s.id}:${
|
|
18080
|
+
for (const r of s.models)
|
|
18081
|
+
console.log(` ${s.id}:${r.id}${r.name ? ": " + r.name : ""}`);
|
|
18338
18082
|
} else
|
|
18339
|
-
for (const s of
|
|
18083
|
+
for (const s of u) {
|
|
18340
18084
|
console.log(`${s.name}: (${s.models.length} models)`);
|
|
18341
|
-
for (const
|
|
18342
|
-
console.log(` ${s.id}:${
|
|
18085
|
+
for (const r of s.models)
|
|
18086
|
+
console.log(` ${s.id}:${r.id}${r.name ? ": " + r.name : ""}`);
|
|
18343
18087
|
}
|
|
18344
18088
|
process.exit(0);
|
|
18345
18089
|
}
|
|
18346
|
-
const
|
|
18347
|
-
if (
|
|
18348
|
-
const
|
|
18090
|
+
const o = f._[0] === "calc" ? Array.isArray(f.model) ? f.model : [f.model] : f._.filter((u) => typeof u == "string");
|
|
18091
|
+
if (o.length > 0) {
|
|
18092
|
+
const u = {
|
|
18349
18093
|
cache_audio_read_tokens: f["cache-audio-read-tokens"] !== void 0 ? Number(f["cache-audio-read-tokens"]) : void 0,
|
|
18350
18094
|
cache_read_tokens: f["cache-read-tokens"] !== void 0 ? Number(f["cache-read-tokens"]) : void 0,
|
|
18351
18095
|
cache_write_tokens: f["cache-write-tokens"] !== void 0 ? Number(f["cache-write-tokens"]) : void 0,
|
|
@@ -18355,34 +18099,34 @@ function ee() {
|
|
|
18355
18099
|
output_tokens: f["output-tokens"] !== void 0 ? Number(f["output-tokens"]) : void 0,
|
|
18356
18100
|
requests: f.requests !== void 0 ? Number(f.requests) : void 0
|
|
18357
18101
|
}, s = f.timestamp ? new Date(String(f.timestamp)) : void 0;
|
|
18358
|
-
let
|
|
18359
|
-
for (const
|
|
18360
|
-
let
|
|
18361
|
-
|
|
18102
|
+
let r = !1;
|
|
18103
|
+
for (const _ of o) {
|
|
18104
|
+
let k, h = _;
|
|
18105
|
+
h.includes(":") && ([k, h] = h.split(":", 2));
|
|
18362
18106
|
try {
|
|
18363
|
-
const q =
|
|
18107
|
+
const q = tt(u, h, { providerId: k, timestamp: s });
|
|
18364
18108
|
if (!q) {
|
|
18365
|
-
|
|
18109
|
+
r = !0, console.error(`No price found for model ${_}`);
|
|
18366
18110
|
continue;
|
|
18367
18111
|
}
|
|
18368
|
-
const
|
|
18112
|
+
const M = q.model.context_window, B = [
|
|
18369
18113
|
["Provider", q.provider.name],
|
|
18370
18114
|
["Model", q.model.name ?? q.model.id],
|
|
18371
18115
|
["Model Prices", JSON.stringify(q.model_price)],
|
|
18372
|
-
["Context Window",
|
|
18116
|
+
["Context Window", M !== void 0 ? M.toLocaleString() : void 0],
|
|
18373
18117
|
["Total Price", `$${q.total_price}`],
|
|
18374
18118
|
["Input Price", `$${q.input_price}`],
|
|
18375
18119
|
["Output Price", `$${q.output_price}`]
|
|
18376
18120
|
];
|
|
18377
|
-
for (const [
|
|
18378
|
-
|
|
18121
|
+
for (const [S, A] of B)
|
|
18122
|
+
A !== void 0 && console.log(`${S.padStart(14)}: ${A}`);
|
|
18379
18123
|
console.log("");
|
|
18380
18124
|
} catch (q) {
|
|
18381
|
-
|
|
18125
|
+
r = !0, q instanceof Error && console.error(`Error for model ${_}:`, q.message);
|
|
18382
18126
|
}
|
|
18383
18127
|
}
|
|
18384
|
-
process.exit(
|
|
18128
|
+
process.exit(r ? 1 : 0);
|
|
18385
18129
|
}
|
|
18386
|
-
|
|
18130
|
+
he().showHelp(), process.exit(1);
|
|
18387
18131
|
}
|
|
18388
|
-
|
|
18132
|
+
at();
|