@pydantic/genai-prices 0.0.38 → 0.0.40
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 +611 -260
- package/dist/index.cjs +5 -5
- package/dist/index.js +399 -48
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import de from "yargs";
|
|
3
3
|
import { format as he } from "util";
|
|
4
|
-
import { resolve as
|
|
5
|
-
import { readFileSync as
|
|
4
|
+
import { resolve as ae, normalize as Ie } from "path";
|
|
5
|
+
import { readFileSync as _e, writeFile as Le, statSync as Pe } from "fs";
|
|
6
6
|
import "assert";
|
|
7
7
|
import { fileURLToPath as Te } from "url";
|
|
8
8
|
function Ae() {
|
|
@@ -14,59 +14,59 @@ function Se() {
|
|
|
14
14
|
function Ge() {
|
|
15
15
|
return !!process.versions.electron;
|
|
16
16
|
}
|
|
17
|
-
function Ce(
|
|
18
|
-
return
|
|
17
|
+
function Ce(i) {
|
|
18
|
+
return i.slice(Ae() + 1);
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* @license
|
|
22
22
|
* Copyright (c) 2016, Contributors
|
|
23
23
|
* SPDX-License-Identifier: ISC
|
|
24
24
|
*/
|
|
25
|
-
function W(
|
|
26
|
-
if (
|
|
27
|
-
return
|
|
25
|
+
function W(i) {
|
|
26
|
+
if (i !== i.toLowerCase() && i !== i.toUpperCase() || (i = i.toLowerCase()), i.indexOf("-") === -1 && i.indexOf("_") === -1)
|
|
27
|
+
return i;
|
|
28
28
|
{
|
|
29
29
|
let m = "", s = !1;
|
|
30
|
-
const u =
|
|
31
|
-
for (let
|
|
32
|
-
let
|
|
33
|
-
s && (s = !1,
|
|
30
|
+
const u = i.match(/^-+/);
|
|
31
|
+
for (let k = u ? u[0].length : 0; k < i.length; k++) {
|
|
32
|
+
let _ = i.charAt(k);
|
|
33
|
+
s && (s = !1, _ = _.toUpperCase()), k !== 0 && (_ === "-" || _ === "_") ? s = !0 : _ !== "-" && _ !== "_" && (m += _);
|
|
34
34
|
}
|
|
35
35
|
return m;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function Oe(
|
|
39
|
-
const m =
|
|
38
|
+
function Oe(i, n) {
|
|
39
|
+
const m = i.toLowerCase();
|
|
40
40
|
n = n || "-";
|
|
41
41
|
let s = "";
|
|
42
|
-
for (let u = 0; u <
|
|
43
|
-
const
|
|
44
|
-
|
|
42
|
+
for (let u = 0; u < i.length; u++) {
|
|
43
|
+
const k = m.charAt(u), _ = i.charAt(u);
|
|
44
|
+
k !== _ && u > 0 ? s += `${n}${m.charAt(u)}` : s += _;
|
|
45
45
|
}
|
|
46
46
|
return s;
|
|
47
47
|
}
|
|
48
|
-
function Re(
|
|
49
|
-
return
|
|
48
|
+
function Re(i) {
|
|
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
|
/**
|
|
52
52
|
* @license
|
|
53
53
|
* Copyright (c) 2016, Contributors
|
|
54
54
|
* SPDX-License-Identifier: ISC
|
|
55
55
|
*/
|
|
56
|
-
function Ee(
|
|
57
|
-
if (Array.isArray(
|
|
58
|
-
return
|
|
59
|
-
|
|
56
|
+
function Ee(i) {
|
|
57
|
+
if (Array.isArray(i))
|
|
58
|
+
return i.map((_) => typeof _ != "string" ? _ + "" : _);
|
|
59
|
+
i = i.trim();
|
|
60
60
|
let n = 0, m = null, s = null, u = null;
|
|
61
|
-
const
|
|
62
|
-
for (let
|
|
63
|
-
if (m = s, s =
|
|
61
|
+
const k = [];
|
|
62
|
+
for (let _ = 0; _ < i.length; _++) {
|
|
63
|
+
if (m = s, s = i.charAt(_), s === " " && !u) {
|
|
64
64
|
m !== " " && n++;
|
|
65
65
|
continue;
|
|
66
66
|
}
|
|
67
|
-
s === u ? u = null : (s === "'" || s === '"') && !u && (u = s),
|
|
67
|
+
s === u ? u = null : (s === "'" || s === '"') && !u && (u = s), k[n] || (k[n] = ""), k[n] += s;
|
|
68
68
|
}
|
|
69
|
-
return
|
|
69
|
+
return k;
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -74,8 +74,8 @@ function Ee(a) {
|
|
|
74
74
|
* SPDX-License-Identifier: ISC
|
|
75
75
|
*/
|
|
76
76
|
var I;
|
|
77
|
-
(function(
|
|
78
|
-
|
|
77
|
+
(function(i) {
|
|
78
|
+
i.BOOLEAN = "boolean", i.STRING = "string", i.NUMBER = "number", i.ARRAY = "array";
|
|
79
79
|
})(I || (I = {}));
|
|
80
80
|
/**
|
|
81
81
|
* @license
|
|
@@ -105,7 +105,7 @@ class Ne {
|
|
|
105
105
|
number: void 0,
|
|
106
106
|
__: void 0,
|
|
107
107
|
key: void 0
|
|
108
|
-
}, m), u = Ee(n),
|
|
108
|
+
}, m), u = Ee(n), k = typeof n == "string", _ = ze(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,
|
|
@@ -138,14 +138,14 @@ class Ne {
|
|
|
138
138
|
keys: []
|
|
139
139
|
}, L = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/, U = new RegExp("^--" + h["negation-prefix"] + "(.+)");
|
|
140
140
|
[].concat(s.array || []).filter(Boolean).forEach(function(e) {
|
|
141
|
-
const
|
|
141
|
+
const a = typeof e == "object" ? e.key : e, l = Object.keys(e).map(function(o) {
|
|
142
142
|
return {
|
|
143
143
|
boolean: "bools",
|
|
144
144
|
string: "strings",
|
|
145
145
|
number: "numbers"
|
|
146
146
|
}[o];
|
|
147
147
|
}).filter(Boolean).pop();
|
|
148
|
-
l && (r[l][
|
|
148
|
+
l && (r[l][a] = !0), r.arrays[a] = !0, r.keys.push(a);
|
|
149
149
|
}), [].concat(s.boolean || []).filter(Boolean).forEach(function(e) {
|
|
150
150
|
r.bools[e] = !0, r.keys.push(e);
|
|
151
151
|
}), [].concat(s.string || []).filter(Boolean).forEach(function(e) {
|
|
@@ -156,17 +156,17 @@ class Ne {
|
|
|
156
156
|
r.counts[e] = !0, r.keys.push(e);
|
|
157
157
|
}), [].concat(s.normalize || []).filter(Boolean).forEach(function(e) {
|
|
158
158
|
r.normalize[e] = !0, r.keys.push(e);
|
|
159
|
-
}), typeof s.narg == "object" && Object.entries(s.narg).forEach(([e,
|
|
160
|
-
typeof
|
|
161
|
-
}), typeof s.coerce == "object" && Object.entries(s.coerce).forEach(([e,
|
|
162
|
-
typeof
|
|
159
|
+
}), typeof s.narg == "object" && Object.entries(s.narg).forEach(([e, a]) => {
|
|
160
|
+
typeof a == "number" && (r.nargs[e] = a, r.keys.push(e));
|
|
161
|
+
}), typeof s.coerce == "object" && Object.entries(s.coerce).forEach(([e, a]) => {
|
|
162
|
+
typeof a == "function" && (r.coercions[e] = a, r.keys.push(e));
|
|
163
163
|
}), typeof s.config < "u" && (Array.isArray(s.config) || typeof s.config == "string" ? [].concat(s.config).filter(Boolean).forEach(function(e) {
|
|
164
164
|
r.configs[e] = !0;
|
|
165
|
-
}) : typeof s.config == "object" && Object.entries(s.config).forEach(([e,
|
|
166
|
-
(typeof
|
|
167
|
-
})), qe(s.key,
|
|
168
|
-
(r.aliases[e] || []).forEach(function(
|
|
169
|
-
f[
|
|
165
|
+
}) : typeof s.config == "object" && Object.entries(s.config).forEach(([e, a]) => {
|
|
166
|
+
(typeof a == "boolean" || typeof a == "function") && (r.configs[e] = a);
|
|
167
|
+
})), qe(s.key, _, s.default, r.arrays), Object.keys(f).forEach(function(e) {
|
|
168
|
+
(r.aliases[e] || []).forEach(function(a) {
|
|
169
|
+
f[a] = f[e];
|
|
170
170
|
});
|
|
171
171
|
});
|
|
172
172
|
let B = null;
|
|
@@ -174,28 +174,28 @@ class Ne {
|
|
|
174
174
|
let F = [];
|
|
175
175
|
const w = Object.assign(/* @__PURE__ */ Object.create(null), { _: [] }), ne = {};
|
|
176
176
|
for (let e = 0; e < u.length; e++) {
|
|
177
|
-
const
|
|
177
|
+
const a = u[e], l = a.replace(/^-{3,}/, "---");
|
|
178
178
|
let o, t, p, c, d, v;
|
|
179
|
-
if (
|
|
180
|
-
K(
|
|
179
|
+
if (a !== "--" && /^-/.test(a) && H(a))
|
|
180
|
+
K(a);
|
|
181
181
|
else if (l.match(/^---+(=|$)/)) {
|
|
182
|
-
K(
|
|
182
|
+
K(a);
|
|
183
183
|
continue;
|
|
184
|
-
} else if (
|
|
185
|
-
c =
|
|
186
|
-
else if (
|
|
187
|
-
c =
|
|
188
|
-
else if (
|
|
189
|
-
c =
|
|
190
|
-
else if (
|
|
191
|
-
c =
|
|
192
|
-
else if (
|
|
193
|
-
d = u[e + 1], c =
|
|
194
|
-
else if (
|
|
195
|
-
p =
|
|
184
|
+
} else if (a.match(/^--.+=/) || !h["short-option-groups"] && a.match(/^-.+=/))
|
|
185
|
+
c = a.match(/^--?([^=]+)=([\s\S]*)$/), c !== null && Array.isArray(c) && c.length >= 3 && (g(c[1], r.arrays) ? e = V(e, c[1], u, c[2]) : g(c[1], r.nargs) !== !1 ? e = D(e, c[1], u, c[2]) : q(c[1], c[2], !0));
|
|
186
|
+
else if (a.match(U) && h["boolean-negation"])
|
|
187
|
+
c = a.match(U), c !== null && Array.isArray(c) && c.length >= 2 && (t = c[1], q(t, g(t, r.arrays) ? [!1] : !1));
|
|
188
|
+
else if (a.match(/^--.+/) || !h["short-option-groups"] && a.match(/^-[^-]+/))
|
|
189
|
+
c = a.match(/^--?(.+)/), c !== null && Array.isArray(c) && c.length >= 2 && (t = c[1], g(t, r.arrays) ? e = V(e, t, u) : g(t, r.nargs) !== !1 ? e = D(e, t, u) : (d = u[e + 1], d !== void 0 && (!d.match(/^-/) || d.match(L)) && !g(t, r.bools) && !g(t, r.counts) || /^(true|false)$/.test(d) ? (q(t, d), e++) : q(t, R(t))));
|
|
190
|
+
else if (a.match(/^-.\..+=/))
|
|
191
|
+
c = a.match(/^-([^=]+)=([\s\S]*)$/), c !== null && Array.isArray(c) && c.length >= 3 && q(c[1], c[2]);
|
|
192
|
+
else if (a.match(/^-.\..+/) && !a.match(L))
|
|
193
|
+
d = u[e + 1], c = a.match(/^-(.\..+)/), c !== null && Array.isArray(c) && c.length >= 2 && (t = c[1], d !== void 0 && !d.match(/^-/) && !g(t, r.bools) && !g(t, r.counts) ? (q(t, d), e++) : q(t, R(t)));
|
|
194
|
+
else if (a.match(/^-[^-]+/) && !a.match(L)) {
|
|
195
|
+
p = a.slice(1, -1).split(""), o = !1;
|
|
196
196
|
for (let x = 0; x < p.length; x++) {
|
|
197
|
-
if (d =
|
|
198
|
-
v =
|
|
197
|
+
if (d = a.slice(x + 2), p[x + 1] && p[x + 1] === "=") {
|
|
198
|
+
v = a.slice(x + 3), t = p[x], g(t, r.arrays) ? e = V(e, t, u, v) : g(t, r.nargs) !== !1 ? e = D(e, t, u, v) : q(t, v), o = !0;
|
|
199
199
|
break;
|
|
200
200
|
}
|
|
201
201
|
if (d === "-") {
|
|
@@ -212,73 +212,73 @@ class Ne {
|
|
|
212
212
|
} else
|
|
213
213
|
q(p[x], R(p[x]));
|
|
214
214
|
}
|
|
215
|
-
t =
|
|
216
|
-
} else if (
|
|
217
|
-
t =
|
|
218
|
-
else if (
|
|
215
|
+
t = a.slice(-1)[0], !o && t !== "-" && (g(t, r.arrays) ? e = V(e, t, u) : g(t, r.nargs) !== !1 ? e = D(e, t, u) : (d = u[e + 1], d !== void 0 && (!/^(-|--)[^-]/.test(d) || d.match(L)) && !g(t, r.bools) && !g(t, r.counts) || /^(true|false)$/.test(d) ? (q(t, d), e++) : q(t, R(t))));
|
|
216
|
+
} else if (a.match(/^-[0-9]$/) && a.match(L) && g(a.slice(1), r.bools))
|
|
217
|
+
t = a.slice(1), q(t, R(t));
|
|
218
|
+
else if (a === "--") {
|
|
219
219
|
F = u.slice(e + 1);
|
|
220
220
|
break;
|
|
221
221
|
} else if (h["halt-at-non-option"]) {
|
|
222
222
|
F = u.slice(e);
|
|
223
223
|
break;
|
|
224
224
|
} else
|
|
225
|
-
K(
|
|
225
|
+
K(a);
|
|
226
226
|
}
|
|
227
|
-
re(w, !0), re(w, !1),
|
|
227
|
+
re(w, !0), re(w, !1), ke(w), ge(), me(w, r.aliases, f, !0), fe(w), h["set-placeholder-key"] && be(w), Object.keys(r.counts).forEach(function(e) {
|
|
228
228
|
E(w, e.split(".")) || q(e, 0);
|
|
229
229
|
}), S && F.length && (w[G] = []), F.forEach(function(e) {
|
|
230
230
|
w[G].push(e);
|
|
231
231
|
}), h["camel-case-expansion"] && h["strip-dashed"] && Object.keys(w).filter((e) => e !== "--" && e.includes("-")).forEach((e) => {
|
|
232
232
|
delete w[e];
|
|
233
|
-
}), h["strip-aliased"] && [].concat(...Object.keys(
|
|
234
|
-
h["camel-case-expansion"] && e.includes("-") && delete w[e.split(".").map((
|
|
233
|
+
}), h["strip-aliased"] && [].concat(...Object.keys(_).map((e) => _[e])).forEach((e) => {
|
|
234
|
+
h["camel-case-expansion"] && e.includes("-") && delete w[e.split(".").map((a) => W(a)).join(".")], delete w[e];
|
|
235
235
|
});
|
|
236
236
|
function K(e) {
|
|
237
|
-
const
|
|
238
|
-
(typeof
|
|
237
|
+
const a = $("_", e);
|
|
238
|
+
(typeof a == "string" || typeof a == "number") && w._.push(a);
|
|
239
239
|
}
|
|
240
|
-
function D(e,
|
|
241
|
-
let t, p = g(
|
|
240
|
+
function D(e, a, l, o) {
|
|
241
|
+
let t, p = g(a, r.nargs);
|
|
242
242
|
if (p = typeof p != "number" || isNaN(p) ? 1 : p, p === 0)
|
|
243
|
-
return T(o) || (B = Error(C("Argument unexpected for: %s",
|
|
243
|
+
return T(o) || (B = Error(C("Argument unexpected for: %s", a))), q(a, R(a)), e;
|
|
244
244
|
let c = T(o) ? 0 : 1;
|
|
245
245
|
if (h["nargs-eats-options"])
|
|
246
|
-
l.length - (e + 1) + c < p && (B = Error(C("Not enough arguments following: %s",
|
|
246
|
+
l.length - (e + 1) + c < p && (B = Error(C("Not enough arguments following: %s", a))), c = p;
|
|
247
247
|
else {
|
|
248
248
|
for (t = e + 1; t < l.length && (!l[t].match(/^-[^0-9]/) || l[t].match(L) || H(l[t])); t++)
|
|
249
249
|
c++;
|
|
250
|
-
c < p && (B = Error(C("Not enough arguments following: %s",
|
|
250
|
+
c < p && (B = Error(C("Not enough arguments following: %s", a)));
|
|
251
251
|
}
|
|
252
252
|
let d = Math.min(c, p);
|
|
253
|
-
for (!T(o) && d > 0 && (q(
|
|
254
|
-
q(
|
|
253
|
+
for (!T(o) && d > 0 && (q(a, o), d--), t = e + 1; t < d + e + 1; t++)
|
|
254
|
+
q(a, l[t]);
|
|
255
255
|
return e + d;
|
|
256
256
|
}
|
|
257
|
-
function V(e,
|
|
257
|
+
function V(e, a, l, o) {
|
|
258
258
|
let t = [], p = o || l[e + 1];
|
|
259
|
-
const c = g(
|
|
260
|
-
if (g(
|
|
259
|
+
const c = g(a, r.nargs);
|
|
260
|
+
if (g(a, r.bools) && !/^(true|false)$/.test(p))
|
|
261
261
|
t.push(!0);
|
|
262
262
|
else if (T(p) || T(o) && /^-/.test(p) && !L.test(p) && !H(p)) {
|
|
263
|
-
if (f[
|
|
264
|
-
const d = f[
|
|
263
|
+
if (f[a] !== void 0) {
|
|
264
|
+
const d = f[a];
|
|
265
265
|
t = Array.isArray(d) ? d : [d];
|
|
266
266
|
}
|
|
267
267
|
} else {
|
|
268
|
-
T(o) || t.push(Y(
|
|
268
|
+
T(o) || t.push(Y(a, o, !0));
|
|
269
269
|
for (let d = e + 1; d < l.length && !(!h["greedy-arrays"] && t.length > 0 || c && typeof c == "number" && t.length >= c || (p = l[d], /^-/.test(p) && !L.test(p) && !H(p))); d++)
|
|
270
|
-
e = d, t.push(Y(
|
|
270
|
+
e = d, t.push(Y(a, p, k));
|
|
271
271
|
}
|
|
272
|
-
return typeof c == "number" && (c && t.length < c || isNaN(c) && t.length === 0) && (B = Error(C("Not enough arguments following: %s",
|
|
272
|
+
return typeof c == "number" && (c && t.length < c || isNaN(c) && t.length === 0) && (B = Error(C("Not enough arguments following: %s", a))), q(a, t), e;
|
|
273
273
|
}
|
|
274
|
-
function q(e,
|
|
274
|
+
function q(e, a, l = k) {
|
|
275
275
|
if (/-/.test(e) && h["camel-case-expansion"]) {
|
|
276
276
|
const p = e.split(".").map(function(c) {
|
|
277
277
|
return W(c);
|
|
278
278
|
}).join(".");
|
|
279
279
|
se(e, p);
|
|
280
280
|
}
|
|
281
|
-
const o = Y(e,
|
|
281
|
+
const o = Y(e, a, l), t = e.split(".");
|
|
282
282
|
N(w, t, o), r.aliases[e] && r.aliases[e].forEach(function(p) {
|
|
283
283
|
const c = p.split(".");
|
|
284
284
|
N(w, c, o);
|
|
@@ -290,31 +290,31 @@ class Ne {
|
|
|
290
290
|
Object.defineProperty(ne, c, {
|
|
291
291
|
enumerable: !0,
|
|
292
292
|
get() {
|
|
293
|
-
return
|
|
293
|
+
return a;
|
|
294
294
|
},
|
|
295
295
|
set(d) {
|
|
296
|
-
|
|
296
|
+
a = typeof d == "string" ? A.normalize(d) : d;
|
|
297
297
|
}
|
|
298
298
|
});
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
|
-
function se(e,
|
|
302
|
-
r.aliases[e] && r.aliases[e].length || (r.aliases[e] = [
|
|
301
|
+
function se(e, a) {
|
|
302
|
+
r.aliases[e] && r.aliases[e].length || (r.aliases[e] = [a], Q[a] = !0), r.aliases[a] && r.aliases[a].length || se(a, e);
|
|
303
303
|
}
|
|
304
|
-
function Y(e,
|
|
305
|
-
l && (
|
|
306
|
-
let o = Array.isArray(
|
|
304
|
+
function Y(e, a, l) {
|
|
305
|
+
l && (a = je(a)), (g(e, r.bools) || g(e, r.counts)) && typeof a == "string" && (a = a === "true");
|
|
306
|
+
let o = Array.isArray(a) ? a.map(function(t) {
|
|
307
307
|
return $(e, t);
|
|
308
|
-
}) : $(e,
|
|
309
|
-
return g(e, r.counts) && (T(o) || typeof o == "boolean") && (o = Z()), g(e, r.normalize) && g(e, r.arrays) && (Array.isArray(
|
|
308
|
+
}) : $(e, a);
|
|
309
|
+
return g(e, r.counts) && (T(o) || typeof o == "boolean") && (o = Z()), g(e, r.normalize) && g(e, r.arrays) && (Array.isArray(a) ? o = a.map((t) => A.normalize(t)) : o = A.normalize(a)), o;
|
|
310
310
|
}
|
|
311
|
-
function $(e,
|
|
312
|
-
return !h["parse-positional-numbers"] && e === "_" || !g(e, r.strings) && !g(e, r.bools) && !Array.isArray(
|
|
311
|
+
function $(e, a) {
|
|
312
|
+
return !h["parse-positional-numbers"] && e === "_" || !g(e, r.strings) && !g(e, r.bools) && !Array.isArray(a) && (Re(a) && h["parse-numbers"] && Number.isSafeInteger(Math.floor(parseFloat(`${a}`))) || !T(a) && g(e, r.numbers)) && (a = Number(a)), a;
|
|
313
313
|
}
|
|
314
|
-
function
|
|
315
|
-
const
|
|
316
|
-
me(
|
|
317
|
-
const o = e[l] ||
|
|
314
|
+
function ke(e) {
|
|
315
|
+
const a = /* @__PURE__ */ Object.create(null);
|
|
316
|
+
me(a, r.aliases, f), Object.keys(r.configs).forEach(function(l) {
|
|
317
|
+
const o = e[l] || a[l];
|
|
318
318
|
if (o)
|
|
319
319
|
try {
|
|
320
320
|
let t = null;
|
|
@@ -337,9 +337,9 @@ class Ne {
|
|
|
337
337
|
}
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
|
-
function J(e,
|
|
340
|
+
function J(e, a) {
|
|
341
341
|
Object.keys(e).forEach(function(l) {
|
|
342
|
-
const o = e[l], t =
|
|
342
|
+
const o = e[l], t = a ? a + "." + l : l;
|
|
343
343
|
typeof o == "object" && o !== null && !Array.isArray(o) && h["dot-notation"] ? J(o, t) : (!E(w, t.split(".")) || g(t, r.arrays) && h["combine-arrays"]) && q(t, o);
|
|
344
344
|
});
|
|
345
345
|
}
|
|
@@ -348,7 +348,7 @@ class Ne {
|
|
|
348
348
|
J(e);
|
|
349
349
|
});
|
|
350
350
|
}
|
|
351
|
-
function re(e,
|
|
351
|
+
function re(e, a) {
|
|
352
352
|
if (typeof P > "u")
|
|
353
353
|
return;
|
|
354
354
|
const l = typeof P == "string" ? P : "", o = A.env();
|
|
@@ -357,17 +357,17 @@ class Ne {
|
|
|
357
357
|
const p = t.split("__").map(function(c, d) {
|
|
358
358
|
return d === 0 && (c = c.substring(l.length)), W(c);
|
|
359
359
|
});
|
|
360
|
-
(
|
|
360
|
+
(a && r.configs[p.join(".")] || !a) && !E(e, p) && q(p.join("."), o[t]);
|
|
361
361
|
}
|
|
362
362
|
});
|
|
363
363
|
}
|
|
364
364
|
function fe(e) {
|
|
365
|
-
let
|
|
365
|
+
let a;
|
|
366
366
|
const l = /* @__PURE__ */ new Set();
|
|
367
367
|
Object.keys(e).forEach(function(o) {
|
|
368
|
-
if (!l.has(o) && (
|
|
368
|
+
if (!l.has(o) && (a = g(o, r.coercions), typeof a == "function"))
|
|
369
369
|
try {
|
|
370
|
-
const t = $(o,
|
|
370
|
+
const t = $(o, a(e[o]));
|
|
371
371
|
[].concat(r.aliases[o] || [], o).forEach((p) => {
|
|
372
372
|
l.add(p), e[p] = t;
|
|
373
373
|
});
|
|
@@ -377,38 +377,38 @@ class Ne {
|
|
|
377
377
|
});
|
|
378
378
|
}
|
|
379
379
|
function be(e) {
|
|
380
|
-
return r.keys.forEach((
|
|
381
|
-
~
|
|
380
|
+
return r.keys.forEach((a) => {
|
|
381
|
+
~a.indexOf(".") || typeof e[a] > "u" && (e[a] = void 0);
|
|
382
382
|
}), e;
|
|
383
383
|
}
|
|
384
|
-
function me(e,
|
|
384
|
+
function me(e, a, l, o = !1) {
|
|
385
385
|
Object.keys(l).forEach(function(t) {
|
|
386
|
-
E(e, t.split(".")) || (N(e, t.split("."), l[t]), o && (oe[t] = !0), (
|
|
386
|
+
E(e, t.split(".")) || (N(e, t.split("."), l[t]), o && (oe[t] = !0), (a[t] || []).forEach(function(p) {
|
|
387
387
|
E(e, p.split(".")) || N(e, p.split("."), l[t]);
|
|
388
388
|
}));
|
|
389
389
|
});
|
|
390
390
|
}
|
|
391
|
-
function E(e,
|
|
391
|
+
function E(e, a) {
|
|
392
392
|
let l = e;
|
|
393
|
-
h["dot-notation"] || (
|
|
393
|
+
h["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(t) {
|
|
394
394
|
l = l[t] || {};
|
|
395
395
|
});
|
|
396
|
-
const o =
|
|
396
|
+
const o = a[a.length - 1];
|
|
397
397
|
return typeof l != "object" ? !1 : o in l;
|
|
398
398
|
}
|
|
399
|
-
function N(e,
|
|
399
|
+
function N(e, a, l) {
|
|
400
400
|
let o = e;
|
|
401
|
-
h["dot-notation"] || (
|
|
401
|
+
h["dot-notation"] || (a = [a.join(".")]), a.slice(0, -1).forEach(function(v) {
|
|
402
402
|
v = le(v), typeof o == "object" && o[v] === void 0 && (o[v] = {}), typeof o[v] != "object" || Array.isArray(o[v]) ? (Array.isArray(o[v]) ? o[v].push({}) : o[v] = [o[v], {}], o = o[v][o[v].length - 1]) : o = o[v];
|
|
403
403
|
});
|
|
404
|
-
const t = le(
|
|
404
|
+
const t = le(a[a.length - 1]), p = g(a.join("."), r.arrays), c = Array.isArray(l);
|
|
405
405
|
let d = h["duplicate-arguments-array"];
|
|
406
406
|
!d && g(t, r.nargs) && (d = !0, (!T(o[t]) && r.nargs[t] === 1 || Array.isArray(o[t]) && o[t].length === r.nargs[t]) && (o[t] = void 0)), l === Z() ? o[t] = Z(o[t]) : Array.isArray(o[t]) ? d && p && c ? o[t] = h["flatten-duplicate-arrays"] ? o[t].concat(l) : (Array.isArray(o[t][0]) ? o[t] : [o[t]]).concat([l]) : !d && !!p == !!c ? o[t] = l : o[t] = o[t].concat([l]) : o[t] === void 0 && p ? o[t] = c ? l : [l] : d && !(o[t] === void 0 || g(t, r.counts) || g(t, r.bools)) ? o[t] = [o[t], l] : o[t] = l;
|
|
407
407
|
}
|
|
408
408
|
function qe(...e) {
|
|
409
|
-
e.forEach(function(
|
|
410
|
-
Object.keys(
|
|
411
|
-
r.aliases[l] || (r.aliases[l] = [].concat(
|
|
409
|
+
e.forEach(function(a) {
|
|
410
|
+
Object.keys(a || {}).forEach(function(l) {
|
|
411
|
+
r.aliases[l] || (r.aliases[l] = [].concat(_[l] || []), r.aliases[l].concat(l).forEach(function(o) {
|
|
412
412
|
if (/-/.test(o) && h["camel-case-expansion"]) {
|
|
413
413
|
const t = W(o);
|
|
414
414
|
t !== l && r.aliases[l].indexOf(t) === -1 && (r.aliases[l].push(t), Q[t] = !0);
|
|
@@ -426,18 +426,18 @@ class Ne {
|
|
|
426
426
|
});
|
|
427
427
|
});
|
|
428
428
|
}
|
|
429
|
-
function g(e,
|
|
430
|
-
const l = [].concat(r.aliases[e] || [], e), o = Object.keys(
|
|
431
|
-
return t ?
|
|
429
|
+
function g(e, a) {
|
|
430
|
+
const l = [].concat(r.aliases[e] || [], e), o = Object.keys(a), t = l.find((p) => o.includes(p));
|
|
431
|
+
return t ? a[t] : !1;
|
|
432
432
|
}
|
|
433
433
|
function ue(e) {
|
|
434
|
-
const
|
|
435
|
-
return [].concat(
|
|
434
|
+
const a = Object.keys(r);
|
|
435
|
+
return [].concat(a.map((o) => r[o])).some(function(o) {
|
|
436
436
|
return Array.isArray(o) ? o.includes(e) : o[e];
|
|
437
437
|
});
|
|
438
438
|
}
|
|
439
|
-
function we(e, ...
|
|
440
|
-
return [].concat(...
|
|
439
|
+
function we(e, ...a) {
|
|
440
|
+
return [].concat(...a).some(function(o) {
|
|
441
441
|
const t = e.match(o);
|
|
442
442
|
return t && ue(t[1]);
|
|
443
443
|
});
|
|
@@ -445,17 +445,17 @@ class Ne {
|
|
|
445
445
|
function ve(e) {
|
|
446
446
|
if (e.match(L) || !e.match(/^-[^-]+/))
|
|
447
447
|
return !1;
|
|
448
|
-
let
|
|
448
|
+
let a = !0, l;
|
|
449
449
|
const o = e.slice(1).split("");
|
|
450
450
|
for (let t = 0; t < o.length; t++) {
|
|
451
451
|
if (l = e.slice(t + 2), !ue(o[t])) {
|
|
452
|
-
|
|
452
|
+
a = !1;
|
|
453
453
|
break;
|
|
454
454
|
}
|
|
455
455
|
if (o[t + 1] && o[t + 1] === "=" || l === "-" || /[A-Za-z]/.test(o[t]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(l) || o[t + 1] && o[t + 1].match(/\W/))
|
|
456
456
|
break;
|
|
457
457
|
}
|
|
458
|
-
return
|
|
458
|
+
return a;
|
|
459
459
|
}
|
|
460
460
|
function H(e) {
|
|
461
461
|
return h["unknown-options-as-args"] && xe(e);
|
|
@@ -475,8 +475,8 @@ class Ne {
|
|
|
475
475
|
}[e];
|
|
476
476
|
}
|
|
477
477
|
function Be(e) {
|
|
478
|
-
let
|
|
479
|
-
return g(e, r.strings) ?
|
|
478
|
+
let a = I.BOOLEAN;
|
|
479
|
+
return g(e, r.strings) ? a = I.STRING : g(e, r.numbers) ? a = I.NUMBER : g(e, r.bools) ? a = I.BOOLEAN : g(e, r.arrays) && (a = I.ARRAY), a;
|
|
480
480
|
}
|
|
481
481
|
function T(e) {
|
|
482
482
|
return e === void 0;
|
|
@@ -494,38 +494,38 @@ class Ne {
|
|
|
494
494
|
};
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
function ze(
|
|
497
|
+
function ze(i) {
|
|
498
498
|
const n = [], m = /* @__PURE__ */ Object.create(null);
|
|
499
499
|
let s = !0;
|
|
500
|
-
for (Object.keys(
|
|
501
|
-
n.push([].concat(
|
|
500
|
+
for (Object.keys(i).forEach(function(u) {
|
|
501
|
+
n.push([].concat(i[u], u));
|
|
502
502
|
}); s; ) {
|
|
503
503
|
s = !1;
|
|
504
504
|
for (let u = 0; u < n.length; u++)
|
|
505
|
-
for (let
|
|
505
|
+
for (let k = u + 1; k < n.length; k++)
|
|
506
506
|
if (n[u].filter(function(h) {
|
|
507
|
-
return n[
|
|
507
|
+
return n[k].indexOf(h) !== -1;
|
|
508
508
|
}).length) {
|
|
509
|
-
n[u] = n[u].concat(n[
|
|
509
|
+
n[u] = n[u].concat(n[k]), n.splice(k, 1), s = !0;
|
|
510
510
|
break;
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
513
|
return n.forEach(function(u) {
|
|
514
|
-
u = u.filter(function(
|
|
515
|
-
return f.indexOf(
|
|
514
|
+
u = u.filter(function(_, h, f) {
|
|
515
|
+
return f.indexOf(_) === h;
|
|
516
516
|
});
|
|
517
|
-
const
|
|
518
|
-
|
|
517
|
+
const k = u.pop();
|
|
518
|
+
k !== void 0 && typeof k == "string" && (m[k] = u);
|
|
519
519
|
}), m;
|
|
520
520
|
}
|
|
521
|
-
function Z(
|
|
522
|
-
return
|
|
521
|
+
function Z(i) {
|
|
522
|
+
return i !== void 0 ? i + 1 : 1;
|
|
523
523
|
}
|
|
524
|
-
function le(
|
|
525
|
-
return
|
|
524
|
+
function le(i) {
|
|
525
|
+
return i === "__proto__" ? "___proto___" : i;
|
|
526
526
|
}
|
|
527
|
-
function je(
|
|
528
|
-
return typeof
|
|
527
|
+
function je(i) {
|
|
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
|
/**
|
|
531
531
|
* @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
|
|
@@ -545,27 +545,27 @@ new Ne({
|
|
|
545
545
|
env: () => Qe,
|
|
546
546
|
format: he,
|
|
547
547
|
normalize: Ie,
|
|
548
|
-
resolve:
|
|
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
|
-
require: (
|
|
551
|
+
require: (i) => {
|
|
552
552
|
if (typeof require < "u")
|
|
553
|
-
return require(
|
|
554
|
-
if (
|
|
555
|
-
return JSON.parse(
|
|
553
|
+
return require(i);
|
|
554
|
+
if (i.match(/\.json$/))
|
|
555
|
+
return JSON.parse(_e(i, "utf8"));
|
|
556
556
|
throw Error("only .json config files are supported in ESM");
|
|
557
557
|
}
|
|
558
558
|
});
|
|
559
559
|
const Fe = {
|
|
560
560
|
fs: {
|
|
561
|
-
readFileSync:
|
|
561
|
+
readFileSync: _e,
|
|
562
562
|
writeFile: Le
|
|
563
563
|
},
|
|
564
564
|
format: he,
|
|
565
|
-
resolve:
|
|
566
|
-
exists: (
|
|
565
|
+
resolve: ae,
|
|
566
|
+
exists: (i) => {
|
|
567
567
|
try {
|
|
568
|
-
return Pe(
|
|
568
|
+
return Pe(i).isFile();
|
|
569
569
|
} catch {
|
|
570
570
|
return !1;
|
|
571
571
|
}
|
|
@@ -591,20 +591,20 @@ class De {
|
|
|
591
591
|
}
|
|
592
592
|
__n() {
|
|
593
593
|
const n = Array.prototype.slice.call(arguments), m = n.shift(), s = n.shift(), u = n.shift();
|
|
594
|
-
let
|
|
594
|
+
let k = function() {
|
|
595
595
|
};
|
|
596
|
-
typeof n[n.length - 1] == "function" && (
|
|
597
|
-
let
|
|
598
|
-
this.cache[this.locale][m] && (
|
|
596
|
+
typeof n[n.length - 1] == "function" && (k = n.pop()), this.cache[this.locale] || this._readLocaleFile();
|
|
597
|
+
let _ = u === 1 ? m : s;
|
|
598
|
+
this.cache[this.locale][m] && (_ = this.cache[this.locale][m][u === 1 ? "one" : "other"]), !this.cache[this.locale][m] && this.updateFiles ? (this.cache[this.locale][m] = {
|
|
599
599
|
one: m,
|
|
600
600
|
other: s
|
|
601
601
|
}, this._enqueueWrite({
|
|
602
602
|
directory: this.directory,
|
|
603
603
|
locale: this.locale,
|
|
604
|
-
cb:
|
|
605
|
-
})) :
|
|
606
|
-
const h = [
|
|
607
|
-
return ~
|
|
604
|
+
cb: k
|
|
605
|
+
})) : k();
|
|
606
|
+
const h = [_];
|
|
607
|
+
return ~_.indexOf("%d") && h.push(u), M.format.apply(M.format, h.concat(n));
|
|
608
608
|
}
|
|
609
609
|
setLocale(n) {
|
|
610
610
|
this.locale = n;
|
|
@@ -619,18 +619,18 @@ class De {
|
|
|
619
619
|
}
|
|
620
620
|
_taggedLiteral(n, ...m) {
|
|
621
621
|
let s = "";
|
|
622
|
-
return n.forEach(function(u,
|
|
623
|
-
const
|
|
624
|
-
s += u, typeof
|
|
622
|
+
return n.forEach(function(u, k) {
|
|
623
|
+
const _ = m[k + 1];
|
|
624
|
+
s += u, typeof _ < "u" && (s += "%s");
|
|
625
625
|
}), this.__.apply(this, [s].concat([].slice.call(m, 1)));
|
|
626
626
|
}
|
|
627
627
|
_enqueueWrite(n) {
|
|
628
628
|
this.writeQueue.push(n), this.writeQueue.length === 1 && this._processWriteQueue();
|
|
629
629
|
}
|
|
630
630
|
_processWriteQueue() {
|
|
631
|
-
const n = this, m = this.writeQueue[0], s = m.directory, u = m.locale,
|
|
632
|
-
M.fs.writeFile(
|
|
633
|
-
n.writeQueue.shift(), n.writeQueue.length > 0 && n._processWriteQueue(),
|
|
631
|
+
const n = this, m = this.writeQueue[0], s = m.directory, u = m.locale, k = m.cb, _ = this._resolveLocaleFile(s, u), h = JSON.stringify(this.cache[u], null, 2);
|
|
632
|
+
M.fs.writeFile(_, h, "utf-8", function(f) {
|
|
633
|
+
n.writeQueue.shift(), n.writeQueue.length > 0 && n._processWriteQueue(), k(f);
|
|
634
634
|
});
|
|
635
635
|
}
|
|
636
636
|
_readLocaleFile() {
|
|
@@ -658,9 +658,9 @@ class De {
|
|
|
658
658
|
return M.exists(n);
|
|
659
659
|
}
|
|
660
660
|
}
|
|
661
|
-
function Ve(
|
|
661
|
+
function Ve(i, n) {
|
|
662
662
|
M = n;
|
|
663
|
-
const m = new De(
|
|
663
|
+
const m = new De(i);
|
|
664
664
|
return {
|
|
665
665
|
__: m.__.bind(m),
|
|
666
666
|
__n: m.__n.bind(m),
|
|
@@ -670,7 +670,7 @@ function Ve(a, n) {
|
|
|
670
670
|
locale: m.locale
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
|
-
const $e = (
|
|
673
|
+
const $e = (i) => Ve(i, Fe);
|
|
674
674
|
let z;
|
|
675
675
|
try {
|
|
676
676
|
z = Te(import.meta.url);
|
|
@@ -679,10 +679,10 @@ try {
|
|
|
679
679
|
}
|
|
680
680
|
const He = z.substring(0, z.lastIndexOf("node_modules"));
|
|
681
681
|
He || process.cwd(), process.cwd, process.exit, process.nextTick, typeof process.stdout.columns < "u" && process.stdout.columns, $e({
|
|
682
|
-
directory:
|
|
682
|
+
directory: ae(z, "../../../locales"),
|
|
683
683
|
updateFiles: !1
|
|
684
684
|
});
|
|
685
|
-
const
|
|
685
|
+
const ie = [
|
|
686
686
|
{
|
|
687
687
|
id: "anthropic",
|
|
688
688
|
name: "Anthropic",
|
|
@@ -1147,13 +1147,13 @@ const ae = [
|
|
|
1147
1147
|
],
|
|
1148
1148
|
models: [
|
|
1149
1149
|
{
|
|
1150
|
-
id: "meta.llama3-8b-instruct-v1
|
|
1150
|
+
id: "meta.llama3-8b-instruct-v1:0",
|
|
1151
1151
|
match: {
|
|
1152
|
-
|
|
1152
|
+
contains: "llama3-8b-instruct-v1"
|
|
1153
1153
|
},
|
|
1154
1154
|
prices: {
|
|
1155
|
-
input_mtok:
|
|
1156
|
-
output_mtok:
|
|
1155
|
+
input_mtok: 0.3,
|
|
1156
|
+
output_mtok: 0.6
|
|
1157
1157
|
}
|
|
1158
1158
|
},
|
|
1159
1159
|
{
|
|
@@ -1163,15 +1163,13 @@ const ae = [
|
|
|
1163
1163
|
match: {
|
|
1164
1164
|
or: [
|
|
1165
1165
|
{
|
|
1166
|
-
|
|
1167
|
-
},
|
|
1168
|
-
{
|
|
1169
|
-
equals: "amazon.nova-lite-v1:0"
|
|
1166
|
+
contains: "nova-lite-v1"
|
|
1170
1167
|
}
|
|
1171
1168
|
]
|
|
1172
1169
|
},
|
|
1173
1170
|
prices: {
|
|
1174
1171
|
input_mtok: 0.06,
|
|
1172
|
+
cache_read_mtok: 0.015,
|
|
1175
1173
|
output_mtok: 0.24
|
|
1176
1174
|
}
|
|
1177
1175
|
},
|
|
@@ -1182,15 +1180,13 @@ const ae = [
|
|
|
1182
1180
|
match: {
|
|
1183
1181
|
or: [
|
|
1184
1182
|
{
|
|
1185
|
-
|
|
1186
|
-
},
|
|
1187
|
-
{
|
|
1188
|
-
equals: "amazon.nova-micro-v1:0"
|
|
1183
|
+
contains: "nova-micro-v1"
|
|
1189
1184
|
}
|
|
1190
1185
|
]
|
|
1191
1186
|
},
|
|
1192
1187
|
prices: {
|
|
1193
1188
|
input_mtok: 0.035,
|
|
1189
|
+
cache_read_mtok: 875e-5,
|
|
1194
1190
|
output_mtok: 0.14
|
|
1195
1191
|
}
|
|
1196
1192
|
},
|
|
@@ -1201,15 +1197,13 @@ const ae = [
|
|
|
1201
1197
|
match: {
|
|
1202
1198
|
or: [
|
|
1203
1199
|
{
|
|
1204
|
-
|
|
1205
|
-
},
|
|
1206
|
-
{
|
|
1207
|
-
equals: "amazon.nova-pro-v1:0"
|
|
1200
|
+
contains: "nova-pro-v1"
|
|
1208
1201
|
}
|
|
1209
1202
|
]
|
|
1210
1203
|
},
|
|
1211
1204
|
prices: {
|
|
1212
1205
|
input_mtok: 0.8,
|
|
1206
|
+
cache_read_mtok: 0.2,
|
|
1213
1207
|
output_mtok: 3.2
|
|
1214
1208
|
}
|
|
1215
1209
|
}
|
|
@@ -1986,6 +1980,135 @@ const ae = [
|
|
|
1986
1980
|
}
|
|
1987
1981
|
]
|
|
1988
1982
|
},
|
|
1983
|
+
{
|
|
1984
|
+
id: "cerebras",
|
|
1985
|
+
name: "Cerebras",
|
|
1986
|
+
pricing_urls: ["https://www.cerebras.ai/pricing#pricing", "https://inference-docs.cerebras.ai/models/openai-oss"],
|
|
1987
|
+
api_pattern: "https://api\\.cerebras\\.ai",
|
|
1988
|
+
model_match: {
|
|
1989
|
+
contains: "cerebras"
|
|
1990
|
+
},
|
|
1991
|
+
provider_match: {
|
|
1992
|
+
contains: "cerebras"
|
|
1993
|
+
},
|
|
1994
|
+
extractors: [
|
|
1995
|
+
{
|
|
1996
|
+
api_flavor: "chat",
|
|
1997
|
+
root: "usage",
|
|
1998
|
+
model_path: "model",
|
|
1999
|
+
mappings: [
|
|
2000
|
+
{
|
|
2001
|
+
path: "prompt_tokens",
|
|
2002
|
+
dest: "input_tokens",
|
|
2003
|
+
required: !0
|
|
2004
|
+
},
|
|
2005
|
+
{
|
|
2006
|
+
path: "completion_tokens",
|
|
2007
|
+
dest: "output_tokens",
|
|
2008
|
+
required: !0
|
|
2009
|
+
}
|
|
2010
|
+
]
|
|
2011
|
+
}
|
|
2012
|
+
],
|
|
2013
|
+
models: [
|
|
2014
|
+
{
|
|
2015
|
+
id: "gpt-oss-120b",
|
|
2016
|
+
name: "GPT-OSS 120B",
|
|
2017
|
+
description: "OpenAI's flagship open source model, built on a Mixture-of-Experts (MoE) architecture with 120 billion parameters and 128 experts. Delivers frontier reasoning capabilities with record-breaking inference speeds on Cerebras hardware (~3,000 tokens/second).",
|
|
2018
|
+
match: {
|
|
2019
|
+
or: [
|
|
2020
|
+
{
|
|
2021
|
+
equals: "gpt-oss-120b"
|
|
2022
|
+
},
|
|
2023
|
+
{
|
|
2024
|
+
starts_with: "cerebras/gpt-oss-120b"
|
|
2025
|
+
},
|
|
2026
|
+
{
|
|
2027
|
+
starts_with: "cerebras:gpt-oss-120b"
|
|
2028
|
+
}
|
|
2029
|
+
]
|
|
2030
|
+
},
|
|
2031
|
+
context_window: 131072,
|
|
2032
|
+
price_comments: "Developer tier pricing. Free tier: 65k context, Paid tier: 131k context.",
|
|
2033
|
+
prices: {
|
|
2034
|
+
input_mtok: 0.35,
|
|
2035
|
+
output_mtok: 0.75
|
|
2036
|
+
}
|
|
2037
|
+
},
|
|
2038
|
+
{
|
|
2039
|
+
id: "llama-3.3-70b",
|
|
2040
|
+
name: "Llama 3.3 70B",
|
|
2041
|
+
description: "Meta's enhanced 70B model delivering 405B-level accuracy. Optimized for chat, coding, instruction following, mathematics, and reasoning with high-speed inference on Cerebras hardware (~2,100 tokens/second).",
|
|
2042
|
+
match: {
|
|
2043
|
+
or: [
|
|
2044
|
+
{
|
|
2045
|
+
equals: "llama-3.3-70b"
|
|
2046
|
+
},
|
|
2047
|
+
{
|
|
2048
|
+
starts_with: "cerebras/llama-3.3-70b"
|
|
2049
|
+
},
|
|
2050
|
+
{
|
|
2051
|
+
starts_with: "cerebras:llama-3.3-70b"
|
|
2052
|
+
}
|
|
2053
|
+
]
|
|
2054
|
+
},
|
|
2055
|
+
context_window: 128e3,
|
|
2056
|
+
price_comments: "Developer tier pricing. Free tier: 65k context, Paid tier: 128k context.",
|
|
2057
|
+
prices: {
|
|
2058
|
+
input_mtok: 0.85,
|
|
2059
|
+
output_mtok: 1.2
|
|
2060
|
+
}
|
|
2061
|
+
},
|
|
2062
|
+
{
|
|
2063
|
+
id: "llama3.1-8b",
|
|
2064
|
+
name: "Llama 3.1 8B",
|
|
2065
|
+
description: "Meta's Llama 3.1 8B model for general-purpose tasks including chat, coding, and instruction following. Optimized for fast inference on Cerebras hardware (~2,200 tokens/second).",
|
|
2066
|
+
match: {
|
|
2067
|
+
or: [
|
|
2068
|
+
{
|
|
2069
|
+
equals: "llama3.1-8b"
|
|
2070
|
+
},
|
|
2071
|
+
{
|
|
2072
|
+
starts_with: "cerebras/llama3.1-8b"
|
|
2073
|
+
},
|
|
2074
|
+
{
|
|
2075
|
+
starts_with: "cerebras:llama3.1-8b"
|
|
2076
|
+
}
|
|
2077
|
+
]
|
|
2078
|
+
},
|
|
2079
|
+
context_window: 32768,
|
|
2080
|
+
price_comments: "Developer tier pricing. Free tier: 8k context, Paid tier: 32k context.",
|
|
2081
|
+
prices: {
|
|
2082
|
+
input_mtok: 0.1,
|
|
2083
|
+
output_mtok: 0.1
|
|
2084
|
+
}
|
|
2085
|
+
},
|
|
2086
|
+
{
|
|
2087
|
+
id: "qwen-3-32b",
|
|
2088
|
+
name: "Qwen 3 32B",
|
|
2089
|
+
description: "Qwen's 32B parameter model with enhanced reasoning and coding capabilities. Supports both standard and reasoning modes for complex tasks, with fast inference speeds on Cerebras hardware (~2,600 tokens/second).",
|
|
2090
|
+
match: {
|
|
2091
|
+
or: [
|
|
2092
|
+
{
|
|
2093
|
+
equals: "qwen-3-32b"
|
|
2094
|
+
},
|
|
2095
|
+
{
|
|
2096
|
+
starts_with: "cerebras/qwen-3-32b"
|
|
2097
|
+
},
|
|
2098
|
+
{
|
|
2099
|
+
starts_with: "cerebras:qwen-3-32b"
|
|
2100
|
+
}
|
|
2101
|
+
]
|
|
2102
|
+
},
|
|
2103
|
+
context_window: 131072,
|
|
2104
|
+
price_comments: "Developer tier pricing. Free tier: 65k context, Paid tier: 131k context.",
|
|
2105
|
+
prices: {
|
|
2106
|
+
input_mtok: 0.4,
|
|
2107
|
+
output_mtok: 0.8
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
]
|
|
2111
|
+
},
|
|
1989
2112
|
{
|
|
1990
2113
|
id: "cohere",
|
|
1991
2114
|
name: "Cohere",
|
|
@@ -2383,7 +2506,12 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
2383
2506
|
{
|
|
2384
2507
|
path: "promptTokenCount",
|
|
2385
2508
|
dest: "input_tokens",
|
|
2386
|
-
required: !
|
|
2509
|
+
required: !1
|
|
2510
|
+
},
|
|
2511
|
+
{
|
|
2512
|
+
path: "cachedContentTokenCount",
|
|
2513
|
+
dest: "cache_read_tokens",
|
|
2514
|
+
required: !1
|
|
2387
2515
|
},
|
|
2388
2516
|
{
|
|
2389
2517
|
path: [
|
|
@@ -2392,17 +2520,17 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
2392
2520
|
type: "array-match",
|
|
2393
2521
|
field: "modality",
|
|
2394
2522
|
match: {
|
|
2395
|
-
equals: "
|
|
2523
|
+
equals: "AUDIO"
|
|
2396
2524
|
}
|
|
2397
2525
|
},
|
|
2398
2526
|
"tokenCount"
|
|
2399
2527
|
],
|
|
2400
|
-
dest: "
|
|
2528
|
+
dest: "cache_audio_read_tokens",
|
|
2401
2529
|
required: !1
|
|
2402
2530
|
},
|
|
2403
2531
|
{
|
|
2404
2532
|
path: [
|
|
2405
|
-
"
|
|
2533
|
+
"promptTokensDetails",
|
|
2406
2534
|
{
|
|
2407
2535
|
type: "array-match",
|
|
2408
2536
|
field: "modality",
|
|
@@ -2412,12 +2540,12 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
2412
2540
|
},
|
|
2413
2541
|
"tokenCount"
|
|
2414
2542
|
],
|
|
2415
|
-
dest: "
|
|
2543
|
+
dest: "input_audio_tokens",
|
|
2416
2544
|
required: !1
|
|
2417
2545
|
},
|
|
2418
2546
|
{
|
|
2419
2547
|
path: [
|
|
2420
|
-
"
|
|
2548
|
+
"candidatesTokensDetails",
|
|
2421
2549
|
{
|
|
2422
2550
|
type: "array-match",
|
|
2423
2551
|
field: "modality",
|
|
@@ -2427,18 +2555,23 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
2427
2555
|
},
|
|
2428
2556
|
"tokenCount"
|
|
2429
2557
|
],
|
|
2430
|
-
dest: "
|
|
2558
|
+
dest: "output_audio_tokens",
|
|
2431
2559
|
required: !1
|
|
2432
2560
|
},
|
|
2433
2561
|
{
|
|
2434
2562
|
path: "candidatesTokenCount",
|
|
2435
2563
|
dest: "output_tokens",
|
|
2436
|
-
required: !
|
|
2564
|
+
required: !1
|
|
2437
2565
|
},
|
|
2438
2566
|
{
|
|
2439
2567
|
path: "thoughtsTokenCount",
|
|
2440
2568
|
dest: "output_tokens",
|
|
2441
2569
|
required: !1
|
|
2570
|
+
},
|
|
2571
|
+
{
|
|
2572
|
+
path: "toolUsePromptTokenCount",
|
|
2573
|
+
dest: "output_tokens",
|
|
2574
|
+
required: !1
|
|
2442
2575
|
}
|
|
2443
2576
|
]
|
|
2444
2577
|
},
|
|
@@ -3084,6 +3217,16 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3084
3217
|
output_mtok: 0.99
|
|
3085
3218
|
}
|
|
3086
3219
|
},
|
|
3220
|
+
{
|
|
3221
|
+
id: "gemma-7b-it",
|
|
3222
|
+
match: {
|
|
3223
|
+
equals: "gemma-7b-it"
|
|
3224
|
+
},
|
|
3225
|
+
prices: {
|
|
3226
|
+
input_mtok: 0.07,
|
|
3227
|
+
output_mtok: 0.07
|
|
3228
|
+
}
|
|
3229
|
+
},
|
|
3087
3230
|
{
|
|
3088
3231
|
id: "gemma2-9b-it",
|
|
3089
3232
|
name: "Gemma 2 9B 8k",
|
|
@@ -3102,6 +3245,26 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3102
3245
|
output_mtok: 0.2
|
|
3103
3246
|
}
|
|
3104
3247
|
},
|
|
3248
|
+
{
|
|
3249
|
+
id: "llama-3.1-405b-reasoning",
|
|
3250
|
+
match: {
|
|
3251
|
+
equals: "llama-3.1-405b-reasoning"
|
|
3252
|
+
},
|
|
3253
|
+
prices: {
|
|
3254
|
+
input_mtok: 0.59,
|
|
3255
|
+
output_mtok: 0.79
|
|
3256
|
+
}
|
|
3257
|
+
},
|
|
3258
|
+
{
|
|
3259
|
+
id: "llama-3.1-70b-versatile",
|
|
3260
|
+
match: {
|
|
3261
|
+
equals: "llama-3.1-70b-versatile"
|
|
3262
|
+
},
|
|
3263
|
+
prices: {
|
|
3264
|
+
input_mtok: 0.59,
|
|
3265
|
+
output_mtok: 0.79
|
|
3266
|
+
}
|
|
3267
|
+
},
|
|
3105
3268
|
{
|
|
3106
3269
|
id: "llama-3.1-8b-instant",
|
|
3107
3270
|
name: "Llama 3.1 8B Instant 128k",
|
|
@@ -3113,6 +3276,76 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3113
3276
|
output_mtok: 0.08
|
|
3114
3277
|
}
|
|
3115
3278
|
},
|
|
3279
|
+
{
|
|
3280
|
+
id: "llama-3.2-11b-text-preview",
|
|
3281
|
+
match: {
|
|
3282
|
+
equals: "llama-3.2-11b-text-preview"
|
|
3283
|
+
},
|
|
3284
|
+
prices: {
|
|
3285
|
+
input_mtok: 0.18,
|
|
3286
|
+
output_mtok: 0.18
|
|
3287
|
+
}
|
|
3288
|
+
},
|
|
3289
|
+
{
|
|
3290
|
+
id: "llama-3.2-11b-vision-preview",
|
|
3291
|
+
match: {
|
|
3292
|
+
equals: "llama-3.2-11b-vision-preview"
|
|
3293
|
+
},
|
|
3294
|
+
prices: {
|
|
3295
|
+
input_mtok: 0.18,
|
|
3296
|
+
output_mtok: 0.18
|
|
3297
|
+
}
|
|
3298
|
+
},
|
|
3299
|
+
{
|
|
3300
|
+
id: "llama-3.2-1b-preview",
|
|
3301
|
+
match: {
|
|
3302
|
+
equals: "llama-3.2-1b-preview"
|
|
3303
|
+
},
|
|
3304
|
+
prices: {
|
|
3305
|
+
input_mtok: 0.04,
|
|
3306
|
+
output_mtok: 0.04
|
|
3307
|
+
}
|
|
3308
|
+
},
|
|
3309
|
+
{
|
|
3310
|
+
id: "llama-3.2-3b-preview",
|
|
3311
|
+
match: {
|
|
3312
|
+
equals: "llama-3.2-3b-preview"
|
|
3313
|
+
},
|
|
3314
|
+
prices: {
|
|
3315
|
+
input_mtok: 0.06,
|
|
3316
|
+
output_mtok: 0.06
|
|
3317
|
+
}
|
|
3318
|
+
},
|
|
3319
|
+
{
|
|
3320
|
+
id: "llama-3.2-90b-text-preview",
|
|
3321
|
+
match: {
|
|
3322
|
+
equals: "llama-3.2-90b-text-preview"
|
|
3323
|
+
},
|
|
3324
|
+
prices: {
|
|
3325
|
+
input_mtok: 0.9,
|
|
3326
|
+
output_mtok: 0.9
|
|
3327
|
+
}
|
|
3328
|
+
},
|
|
3329
|
+
{
|
|
3330
|
+
id: "llama-3.2-90b-vision-preview",
|
|
3331
|
+
match: {
|
|
3332
|
+
equals: "llama-3.2-90b-vision-preview"
|
|
3333
|
+
},
|
|
3334
|
+
prices: {
|
|
3335
|
+
input_mtok: 0.9,
|
|
3336
|
+
output_mtok: 0.9
|
|
3337
|
+
}
|
|
3338
|
+
},
|
|
3339
|
+
{
|
|
3340
|
+
id: "llama-3.3-70b-specdec",
|
|
3341
|
+
match: {
|
|
3342
|
+
equals: "llama-3.3-70b-specdec"
|
|
3343
|
+
},
|
|
3344
|
+
prices: {
|
|
3345
|
+
input_mtok: 0.59,
|
|
3346
|
+
output_mtok: 0.99
|
|
3347
|
+
}
|
|
3348
|
+
},
|
|
3116
3349
|
{
|
|
3117
3350
|
id: "llama-3.3-70b-versatile",
|
|
3118
3351
|
name: "Llama 3.3 70B Versatile 128k",
|
|
@@ -3124,6 +3357,16 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3124
3357
|
output_mtok: 0.79
|
|
3125
3358
|
}
|
|
3126
3359
|
},
|
|
3360
|
+
{
|
|
3361
|
+
id: "llama-guard-3-8b",
|
|
3362
|
+
match: {
|
|
3363
|
+
equals: "llama-guard-3-8b"
|
|
3364
|
+
},
|
|
3365
|
+
prices: {
|
|
3366
|
+
input_mtok: 0.2,
|
|
3367
|
+
output_mtok: 0.2
|
|
3368
|
+
}
|
|
3369
|
+
},
|
|
3127
3370
|
{
|
|
3128
3371
|
id: "llama2-70b-4096",
|
|
3129
3372
|
match: {
|
|
@@ -3209,15 +3452,43 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3209
3452
|
output_mtok: 0.2
|
|
3210
3453
|
}
|
|
3211
3454
|
},
|
|
3455
|
+
{
|
|
3456
|
+
id: "mistral-saba-24b",
|
|
3457
|
+
match: {
|
|
3458
|
+
equals: "mistral-saba-24b"
|
|
3459
|
+
},
|
|
3460
|
+
prices: {
|
|
3461
|
+
input_mtok: 0.79,
|
|
3462
|
+
output_mtok: 0.79
|
|
3463
|
+
}
|
|
3464
|
+
},
|
|
3465
|
+
{
|
|
3466
|
+
id: "mixtral-8x7b-32768",
|
|
3467
|
+
match: {
|
|
3468
|
+
equals: "mixtral-8x7b-32768"
|
|
3469
|
+
},
|
|
3470
|
+
prices: {
|
|
3471
|
+
input_mtok: 0.24,
|
|
3472
|
+
output_mtok: 0.24
|
|
3473
|
+
}
|
|
3474
|
+
},
|
|
3212
3475
|
{
|
|
3213
3476
|
id: "moonshotai/kimi-k2-instruct",
|
|
3214
3477
|
name: "Kimi K2 1T 128k",
|
|
3215
3478
|
match: {
|
|
3216
|
-
|
|
3479
|
+
or: [
|
|
3480
|
+
{
|
|
3481
|
+
equals: "moonshotai/kimi-k2-instruct"
|
|
3482
|
+
},
|
|
3483
|
+
{
|
|
3484
|
+
equals: "moonshotai/kimi-k2-instruct-0905"
|
|
3485
|
+
}
|
|
3486
|
+
]
|
|
3217
3487
|
},
|
|
3218
3488
|
context_window: 131072,
|
|
3219
3489
|
prices: {
|
|
3220
3490
|
input_mtok: 1,
|
|
3491
|
+
cache_read_mtok: 0.5,
|
|
3221
3492
|
output_mtok: 3
|
|
3222
3493
|
}
|
|
3223
3494
|
},
|
|
@@ -3227,12 +3498,20 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3227
3498
|
120 billion parameters and 128 experts.
|
|
3228
3499
|
`,
|
|
3229
3500
|
match: {
|
|
3230
|
-
|
|
3501
|
+
or: [
|
|
3502
|
+
{
|
|
3503
|
+
equals: "openai/gpt-oss-120b"
|
|
3504
|
+
},
|
|
3505
|
+
{
|
|
3506
|
+
equals: "openai/gpt-oss-safeguard-20b"
|
|
3507
|
+
}
|
|
3508
|
+
]
|
|
3231
3509
|
},
|
|
3232
3510
|
context_window: 131072,
|
|
3233
3511
|
prices: {
|
|
3234
3512
|
input_mtok: 0.15,
|
|
3235
|
-
|
|
3513
|
+
cache_read_mtok: 0.075,
|
|
3514
|
+
output_mtok: 0.6
|
|
3236
3515
|
}
|
|
3237
3516
|
},
|
|
3238
3517
|
{
|
|
@@ -3245,8 +3524,9 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
3245
3524
|
},
|
|
3246
3525
|
context_window: 131072,
|
|
3247
3526
|
prices: {
|
|
3248
|
-
input_mtok: 0.
|
|
3249
|
-
|
|
3527
|
+
input_mtok: 0.075,
|
|
3528
|
+
cache_read_mtok: 0.0375,
|
|
3529
|
+
output_mtok: 0.3
|
|
3250
3530
|
}
|
|
3251
3531
|
},
|
|
3252
3532
|
{
|
|
@@ -4060,6 +4340,18 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
4060
4340
|
required: !0
|
|
4061
4341
|
}
|
|
4062
4342
|
]
|
|
4343
|
+
},
|
|
4344
|
+
{
|
|
4345
|
+
api_flavor: "embeddings",
|
|
4346
|
+
root: "usage",
|
|
4347
|
+
model_path: "model",
|
|
4348
|
+
mappings: [
|
|
4349
|
+
{
|
|
4350
|
+
path: "prompt_tokens",
|
|
4351
|
+
dest: "input_tokens",
|
|
4352
|
+
required: !0
|
|
4353
|
+
}
|
|
4354
|
+
]
|
|
4063
4355
|
}
|
|
4064
4356
|
],
|
|
4065
4357
|
models: [
|
|
@@ -4122,6 +4414,17 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
4122
4414
|
output_mtok: 6
|
|
4123
4415
|
}
|
|
4124
4416
|
},
|
|
4417
|
+
{
|
|
4418
|
+
id: "computer-use",
|
|
4419
|
+
name: "Computer use",
|
|
4420
|
+
match: {
|
|
4421
|
+
starts_with: "computer-use"
|
|
4422
|
+
},
|
|
4423
|
+
prices: {
|
|
4424
|
+
input_mtok: 3,
|
|
4425
|
+
output_mtok: 12
|
|
4426
|
+
}
|
|
4427
|
+
},
|
|
4125
4428
|
{
|
|
4126
4429
|
id: "curie",
|
|
4127
4430
|
match: {
|
|
@@ -4771,11 +5074,59 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
4771
5074
|
}
|
|
4772
5075
|
]
|
|
4773
5076
|
},
|
|
5077
|
+
context_window: 4e5,
|
|
4774
5078
|
prices: {
|
|
4775
5079
|
input_mtok: 15,
|
|
4776
5080
|
output_mtok: 120
|
|
4777
5081
|
}
|
|
4778
5082
|
},
|
|
5083
|
+
{
|
|
5084
|
+
id: "gpt-5.1",
|
|
5085
|
+
name: "GPT-5.1",
|
|
5086
|
+
description: "The best model for coding and agentic tasks across industries",
|
|
5087
|
+
match: {
|
|
5088
|
+
or: [
|
|
5089
|
+
{
|
|
5090
|
+
equals: "gpt-5.1"
|
|
5091
|
+
},
|
|
5092
|
+
{
|
|
5093
|
+
equals: "gpt-5.1-2025-11-13"
|
|
5094
|
+
},
|
|
5095
|
+
{
|
|
5096
|
+
equals: "gpt-5.1-codex"
|
|
5097
|
+
},
|
|
5098
|
+
{
|
|
5099
|
+
equals: "gpt-5.1-chat-latest"
|
|
5100
|
+
}
|
|
5101
|
+
]
|
|
5102
|
+
},
|
|
5103
|
+
context_window: 4e5,
|
|
5104
|
+
prices: {
|
|
5105
|
+
input_mtok: 1.25,
|
|
5106
|
+
cache_read_mtok: 0.125,
|
|
5107
|
+
output_mtok: 10
|
|
5108
|
+
}
|
|
5109
|
+
},
|
|
5110
|
+
{
|
|
5111
|
+
id: "gpt-5.1-codex-mini",
|
|
5112
|
+
name: "GPT-5.1 Codex Mini",
|
|
5113
|
+
match: {
|
|
5114
|
+
or: [
|
|
5115
|
+
{
|
|
5116
|
+
equals: "gpt-5.1-codex-mini"
|
|
5117
|
+
},
|
|
5118
|
+
{
|
|
5119
|
+
equals: "gpt-5.1-mini"
|
|
5120
|
+
}
|
|
5121
|
+
]
|
|
5122
|
+
},
|
|
5123
|
+
context_window: 4e5,
|
|
5124
|
+
prices: {
|
|
5125
|
+
input_mtok: 0.25,
|
|
5126
|
+
cache_read_mtok: 0.025,
|
|
5127
|
+
output_mtok: 2
|
|
5128
|
+
}
|
|
5129
|
+
},
|
|
4779
5130
|
{
|
|
4780
5131
|
id: "gpt-realtime",
|
|
4781
5132
|
match: {
|
|
@@ -12218,37 +12569,37 @@ Compared to other leading proprietary and open-weights models Command A delivers
|
|
|
12218
12569
|
]
|
|
12219
12570
|
}
|
|
12220
12571
|
];
|
|
12221
|
-
function We(
|
|
12572
|
+
function We(i, n) {
|
|
12222
12573
|
if (n <= 0) return 0;
|
|
12223
12574
|
let m = 0;
|
|
12224
|
-
const s = [...
|
|
12225
|
-
m +=
|
|
12226
|
-
for (let
|
|
12227
|
-
const h = s[
|
|
12575
|
+
const s = [...i.tiers].sort((_, h) => _.start - h.start), u = s[0]?.start ?? n, k = Math.min(n, u);
|
|
12576
|
+
m += k * i.base / 1e6;
|
|
12577
|
+
for (let _ = 0; _ < s.length; _++) {
|
|
12578
|
+
const h = s[_], f = s[_ + 1]?.start ?? 1 / 0, y = Math.max(0, Math.min(n, f) - h.start);
|
|
12228
12579
|
y > 0 && (m += y * h.price / 1e6);
|
|
12229
12580
|
}
|
|
12230
12581
|
return m;
|
|
12231
12582
|
}
|
|
12232
|
-
function O(
|
|
12233
|
-
return
|
|
12583
|
+
function O(i, n, m) {
|
|
12584
|
+
return i === void 0 || n === void 0 ? 0 : typeof i == "number" ? i * n / 1e6 : We(i, n);
|
|
12234
12585
|
}
|
|
12235
|
-
function Ue(
|
|
12586
|
+
function Ue(i, n) {
|
|
12236
12587
|
let m = 0, s = 0;
|
|
12237
|
-
const u =
|
|
12238
|
-
let f =
|
|
12239
|
-
if (f -=
|
|
12588
|
+
const u = i.cache_read_tokens ?? 0, k = i.cache_write_tokens ?? 0, _ = i.cache_audio_read_tokens ?? 0, h = i.output_audio_tokens ?? 0;
|
|
12589
|
+
let f = i.input_audio_tokens ?? 0;
|
|
12590
|
+
if (f -= _, f < 0)
|
|
12240
12591
|
throw new Error("cache_audio_read_tokens cannot be greater than input_audio_tokens");
|
|
12241
|
-
let y =
|
|
12242
|
-
if (y -= u, y -=
|
|
12592
|
+
let y = i.input_tokens ?? 0;
|
|
12593
|
+
if (y -= u, y -= k, y -= f, y < 0)
|
|
12243
12594
|
throw new Error("Uncached text input tokens cannot be negative");
|
|
12244
12595
|
let P = u;
|
|
12245
|
-
if (P -=
|
|
12596
|
+
if (P -= _, P < 0)
|
|
12246
12597
|
throw new Error("cache_audio_read_tokens cannot be greater than cache_read_tokens");
|
|
12247
|
-
m += O(n.input_mtok, y), m += O(n.cache_read_mtok, P), m += O(n.cache_write_mtok,
|
|
12248
|
-
let S =
|
|
12598
|
+
m += O(n.input_mtok, y), m += O(n.cache_read_mtok, P), m += O(n.cache_write_mtok, k), m += O(n.input_audio_mtok, f), m += O(n.cache_audio_read_mtok, _);
|
|
12599
|
+
let S = i.output_tokens ?? 0;
|
|
12249
12600
|
if (S -= h, S < 0)
|
|
12250
12601
|
throw new Error("output_audio_tokens cannot be greater than output_tokens");
|
|
12251
|
-
s += O(n.output_mtok, S), s += O(n.output_audio_mtok,
|
|
12602
|
+
s += O(n.output_mtok, S), s += O(n.output_audio_mtok, i.output_audio_tokens);
|
|
12252
12603
|
let G = m + s;
|
|
12253
12604
|
return n.requests_kcount !== void 0 && (G += n.requests_kcount / 1e3), {
|
|
12254
12605
|
input_price: m,
|
|
@@ -12256,56 +12607,56 @@ function Ue(a, n) {
|
|
|
12256
12607
|
total_price: G
|
|
12257
12608
|
};
|
|
12258
12609
|
}
|
|
12259
|
-
function Ke(
|
|
12260
|
-
if (!Array.isArray(
|
|
12261
|
-
return
|
|
12262
|
-
for (let m =
|
|
12263
|
-
const s =
|
|
12610
|
+
function Ke(i, n) {
|
|
12611
|
+
if (!Array.isArray(i.prices))
|
|
12612
|
+
return i.prices;
|
|
12613
|
+
for (let m = i.prices.length - 1; m >= 0; m--) {
|
|
12614
|
+
const s = i.prices[m], u = s.constraint;
|
|
12264
12615
|
if (u === void 0)
|
|
12265
12616
|
return s.prices;
|
|
12266
12617
|
if (u.type === "start_date") {
|
|
12267
12618
|
if (n >= new Date(u.start_date))
|
|
12268
12619
|
return s.prices;
|
|
12269
12620
|
} else {
|
|
12270
|
-
const
|
|
12271
|
-
if (h <
|
|
12272
|
-
if (
|
|
12621
|
+
const k = n.toISOString().slice(11, 19), _ = u.start_time, h = u.end_time;
|
|
12622
|
+
if (h < _) {
|
|
12623
|
+
if (k >= _ || k < h)
|
|
12273
12624
|
return s.prices;
|
|
12274
|
-
} else if (
|
|
12625
|
+
} else if (k >= _ && k < h)
|
|
12275
12626
|
return s.prices;
|
|
12276
12627
|
}
|
|
12277
12628
|
}
|
|
12278
|
-
return
|
|
12629
|
+
return i.prices[0].prices;
|
|
12279
12630
|
}
|
|
12280
|
-
function j(
|
|
12281
|
-
return "or" in
|
|
12631
|
+
function j(i, n) {
|
|
12632
|
+
return "or" in i ? i.or.some((m) => j(m, n)) : "and" in i ? i.and.every((m) => j(m, n)) : "equals" in i ? n === i.equals : "starts_with" in i ? n.startsWith(i.starts_with) : "ends_with" in i ? n.endsWith(i.ends_with) : "contains" in i ? n.includes(i.contains) : "regex" in i ? new RegExp(i.regex).test(n) : !1;
|
|
12282
12633
|
}
|
|
12283
|
-
function Ye(
|
|
12284
|
-
const m = n.toLowerCase().trim(), s =
|
|
12285
|
-
return s ||
|
|
12634
|
+
function Ye(i, n) {
|
|
12635
|
+
const m = n.toLowerCase().trim(), s = i.find((u) => u.id === m);
|
|
12636
|
+
return s || i.find((u) => u.provider_match && j(u.provider_match, m));
|
|
12286
12637
|
}
|
|
12287
|
-
function Je(
|
|
12638
|
+
function Je(i, { modelId: n, providerApiUrl: m, providerId: s }) {
|
|
12288
12639
|
if (s)
|
|
12289
|
-
return Ye(
|
|
12640
|
+
return Ye(i, s);
|
|
12290
12641
|
if (m)
|
|
12291
|
-
return
|
|
12642
|
+
return i.find((u) => new RegExp(u.api_pattern).test(m));
|
|
12292
12643
|
if (n)
|
|
12293
|
-
return
|
|
12644
|
+
return i.find((u) => u.model_match && j(u.model_match, n));
|
|
12294
12645
|
}
|
|
12295
|
-
function Ze(
|
|
12296
|
-
return
|
|
12646
|
+
function Ze(i, n) {
|
|
12647
|
+
return i.find((m) => j(m.match, n));
|
|
12297
12648
|
}
|
|
12298
|
-
let Xe =
|
|
12299
|
-
Promise.resolve(
|
|
12300
|
-
function et(
|
|
12649
|
+
let Xe = ie;
|
|
12650
|
+
Promise.resolve(ie);
|
|
12651
|
+
function et(i, n, m) {
|
|
12301
12652
|
const s = n.toLowerCase().trim(), u = m?.provider ?? Je(Xe, { modelId: s, providerApiUrl: m?.providerApiUrl, providerId: m?.providerId });
|
|
12302
12653
|
if (!u) return null;
|
|
12303
|
-
const
|
|
12304
|
-
if (!
|
|
12305
|
-
const
|
|
12654
|
+
const k = Ze(u.models, s);
|
|
12655
|
+
if (!k) return null;
|
|
12656
|
+
const _ = m?.timestamp ?? /* @__PURE__ */ new Date(), h = Ke(k, _), f = Ue(i, h);
|
|
12306
12657
|
return {
|
|
12307
12658
|
auto_update_timestamp: void 0,
|
|
12308
|
-
model:
|
|
12659
|
+
model: k,
|
|
12309
12660
|
model_price: h,
|
|
12310
12661
|
provider: u,
|
|
12311
12662
|
...f
|
|
@@ -12314,15 +12665,15 @@ function et(a, n, m) {
|
|
|
12314
12665
|
const b = de(Ce(process.argv)).scriptName("genai-prices").command(
|
|
12315
12666
|
"list [provider]",
|
|
12316
12667
|
"List providers and models",
|
|
12317
|
-
(
|
|
12668
|
+
(i) => i.positional("provider", { describe: "Provider ID to filter", type: "string" })
|
|
12318
12669
|
).command(
|
|
12319
12670
|
"calc <model...>",
|
|
12320
12671
|
"Calculate price",
|
|
12321
|
-
(
|
|
12672
|
+
(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" })
|
|
12322
12673
|
).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();
|
|
12323
12674
|
function tt() {
|
|
12324
12675
|
if (b._[0] === "list") {
|
|
12325
|
-
const m =
|
|
12676
|
+
const m = ie;
|
|
12326
12677
|
if (b.provider) {
|
|
12327
12678
|
const s = m.find((u) => u.id === b.provider);
|
|
12328
12679
|
s || (console.error(`Provider ${b.provider} not found.`), process.exit(1)), console.log(`${s.name}: (${s.models.length} models)`);
|
|
@@ -12349,13 +12700,13 @@ function tt() {
|
|
|
12349
12700
|
requests: b.requests !== void 0 ? Number(b.requests) : void 0
|
|
12350
12701
|
}, s = b.timestamp ? new Date(String(b.timestamp)) : void 0;
|
|
12351
12702
|
let u = !1;
|
|
12352
|
-
for (const
|
|
12353
|
-
let
|
|
12354
|
-
h.includes(":") && ([
|
|
12703
|
+
for (const k of n) {
|
|
12704
|
+
let _, h = k;
|
|
12705
|
+
h.includes(":") && ([_, h] = h.split(":", 2));
|
|
12355
12706
|
try {
|
|
12356
|
-
const f = et(m, h, { providerId:
|
|
12707
|
+
const f = et(m, h, { providerId: _, timestamp: s });
|
|
12357
12708
|
if (!f) {
|
|
12358
|
-
u = !0, console.error(`No price found for model ${
|
|
12709
|
+
u = !0, console.error(`No price found for model ${k}`);
|
|
12359
12710
|
continue;
|
|
12360
12711
|
}
|
|
12361
12712
|
const y = f.model.context_window, P = [
|
|
@@ -12371,7 +12722,7 @@ function tt() {
|
|
|
12371
12722
|
G !== void 0 && console.log(`${S.padStart(14)}: ${G}`);
|
|
12372
12723
|
console.log("");
|
|
12373
12724
|
} catch (f) {
|
|
12374
|
-
u = !0, f instanceof Error && console.error(`Error for model ${
|
|
12725
|
+
u = !0, f instanceof Error && console.error(`Error for model ${k}:`, f.message);
|
|
12375
12726
|
}
|
|
12376
12727
|
}
|
|
12377
12728
|
process.exit(u ? 1 : 0);
|