@teinai/cli 1.1.33 → 1.1.34
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/index.js +796 -740
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
|
-
var
|
|
3
|
+
var Ni = Object.create;
|
|
4
4
|
var ve = Object.defineProperty;
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var h = (e, t,
|
|
10
|
-
if (
|
|
5
|
+
var Ui = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var Fi = Object.getOwnPropertyNames;
|
|
7
|
+
var Bi = Object.getPrototypeOf,
|
|
8
|
+
ji = Object.prototype.hasOwnProperty;
|
|
9
|
+
var h = (e, t, i) => () => {
|
|
10
|
+
if (i) throw i[0];
|
|
11
11
|
try {
|
|
12
12
|
return (e && (t = e((e = 0))), t);
|
|
13
|
-
} catch (
|
|
14
|
-
throw ((
|
|
13
|
+
} catch (a) {
|
|
14
|
+
throw ((i = [a]), a);
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
var
|
|
18
|
-
for (var
|
|
17
|
+
var Gi = (e, t) => {
|
|
18
|
+
for (var i in t) ve(e, i, { get: t[i], enumerable: !0 });
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
Hi = (e, t, i, a) => {
|
|
21
21
|
if ((t && typeof t == 'object') || typeof t == 'function')
|
|
22
|
-
for (let n of
|
|
23
|
-
!
|
|
24
|
-
n !==
|
|
25
|
-
ve(e, n, { get: () => t[n], enumerable: !(
|
|
22
|
+
for (let n of Fi(t))
|
|
23
|
+
!ji.call(e, n) &&
|
|
24
|
+
n !== i &&
|
|
25
|
+
ve(e, n, { get: () => t[n], enumerable: !(a = Ui(t, n)) || a.enumerable });
|
|
26
26
|
return e;
|
|
27
27
|
};
|
|
28
|
-
var T = (e, t,
|
|
29
|
-
(
|
|
30
|
-
|
|
28
|
+
var T = (e, t, i) => (
|
|
29
|
+
(i = e != null ? Ni(Bi(e)) : {}),
|
|
30
|
+
Hi(t || !e || !e.__esModule ? ve(i, 'default', { value: e, enumerable: !0 }) : i, e)
|
|
31
31
|
);
|
|
32
|
-
function
|
|
32
|
+
function Wi(e) {
|
|
33
33
|
for (let t of e)
|
|
34
34
|
try {
|
|
35
|
-
let
|
|
36
|
-
if (
|
|
37
|
-
return
|
|
35
|
+
let i = JSON.parse(dt.default.readFileSync(t, 'utf8'));
|
|
36
|
+
if (i.name === '@teinai/cli' && typeof i.version == 'string' && i.version.trim())
|
|
37
|
+
return i.version.trim();
|
|
38
38
|
} catch {}
|
|
39
|
-
return
|
|
39
|
+
return Ji;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function Yi() {
|
|
42
42
|
let e = typeof __dirname == 'string' ? __dirname : process.cwd();
|
|
43
43
|
return [
|
|
44
44
|
Te.default.join(e, 'package.json'),
|
|
@@ -47,12 +47,12 @@ function Wa() {
|
|
|
47
47
|
}
|
|
48
48
|
var dt,
|
|
49
49
|
Te,
|
|
50
|
-
|
|
50
|
+
Ji,
|
|
51
51
|
F,
|
|
52
52
|
re = h(() => {
|
|
53
53
|
'use strict';
|
|
54
|
-
((dt = T(require('node:fs'))), (Te = T(require('node:path'))), (
|
|
55
|
-
F =
|
|
54
|
+
((dt = T(require('node:fs'))), (Te = T(require('node:path'))), (Ji = '0.0.0-dev'));
|
|
55
|
+
F = Wi(Yi());
|
|
56
56
|
});
|
|
57
57
|
function j() {
|
|
58
58
|
try {
|
|
@@ -66,8 +66,8 @@ function j() {
|
|
|
66
66
|
function Ke(e) {
|
|
67
67
|
try {
|
|
68
68
|
R.default.existsSync(se) || R.default.mkdirSync(se, { recursive: !0, mode: 448 });
|
|
69
|
-
let
|
|
70
|
-
(R.default.writeFileSync(B, JSON.stringify(
|
|
69
|
+
let i = { ...j(), ...e };
|
|
70
|
+
(R.default.writeFileSync(B, JSON.stringify(i, null, 2), { encoding: 'utf-8', mode: 384 }),
|
|
71
71
|
R.default.chmodSync(se, 448),
|
|
72
72
|
R.default.chmodSync(B, 384));
|
|
73
73
|
} catch (t) {
|
|
@@ -78,15 +78,15 @@ function S(e) {
|
|
|
78
78
|
if (e && e.trim()) return e.trim();
|
|
79
79
|
let t = process.env.TEIN_API_KEY || process.env.TEIN_KEY;
|
|
80
80
|
if (t && t.trim()) return t.trim();
|
|
81
|
-
let
|
|
82
|
-
return
|
|
81
|
+
let i = j();
|
|
82
|
+
return i.apiKey && i.apiKey.trim() ? i.apiKey.trim() : '';
|
|
83
83
|
}
|
|
84
84
|
function w(e) {
|
|
85
85
|
if (e && e.trim()) return e.trim().replace(/\/+$/, '');
|
|
86
86
|
let t = process.env.TEIN_API_URL;
|
|
87
87
|
if (t && t.trim()) return t.trim().replace(/\/+$/, '');
|
|
88
|
-
let
|
|
89
|
-
return
|
|
88
|
+
let i = j();
|
|
89
|
+
return i.apiUrl && i.apiUrl.trim() ? i.apiUrl.trim().replace(/\/+$/, '') : 'https://api.tein.ai';
|
|
90
90
|
}
|
|
91
91
|
function oe() {
|
|
92
92
|
return B;
|
|
@@ -96,7 +96,7 @@ var R,
|
|
|
96
96
|
Me,
|
|
97
97
|
se,
|
|
98
98
|
B,
|
|
99
|
-
|
|
99
|
+
E = h(() => {
|
|
100
100
|
'use strict';
|
|
101
101
|
((R = T(require('node:fs'))),
|
|
102
102
|
(gt = T(require('node:os'))),
|
|
@@ -104,13 +104,13 @@ var R,
|
|
|
104
104
|
(se = Me.default.join(gt.default.homedir(), '.tein')),
|
|
105
105
|
(B = Me.default.join(se, 'config.json')));
|
|
106
106
|
});
|
|
107
|
-
var
|
|
107
|
+
var ta,
|
|
108
108
|
ht,
|
|
109
109
|
yt,
|
|
110
110
|
bt = h(() => {
|
|
111
111
|
'use strict';
|
|
112
|
-
((
|
|
113
|
-
(ht = [...
|
|
112
|
+
((ta = ['1:1', '16:9', '9:16', '21:9', '3:2', '2:3', '4:3', '3:4', '4:5', '5:4']),
|
|
113
|
+
(ht = [...ta, 'auto']),
|
|
114
114
|
(yt =
|
|
115
115
|
'The medium endpoint renders non-square images at 1K only. Use resolution 1K, aspect_ratio 1:1, or the dynamic endpoint for a non-square 2K or 4K image.'));
|
|
116
116
|
});
|
|
@@ -216,7 +216,7 @@ var pe,
|
|
|
216
216
|
'claude-haiku-4-5',
|
|
217
217
|
],
|
|
218
218
|
},
|
|
219
|
-
{ slug: 'kling', name: 'Kling', models: ['kling-v4', 'kling-v3-video'] },
|
|
219
|
+
{ slug: 'kling', name: 'Kling', models: ['kling-v4', 'kling-v4-flash', 'kling-v3-video'] },
|
|
220
220
|
{ slug: 'ltx', name: 'LTX', models: ['ltx-2.3-pro'] },
|
|
221
221
|
{ slug: 'vidu', name: 'Vidu', models: ['vidu-q4-preview'] },
|
|
222
222
|
{ slug: 'flux', name: 'FLUX', models: ['flux-2-dev'] },
|
|
@@ -5761,6 +5761,37 @@ var pe,
|
|
|
5761
5761
|
axes: { resolution: ['720p', '1080p'] },
|
|
5762
5762
|
from: { variant: '720p' },
|
|
5763
5763
|
},
|
|
5764
|
+
{
|
|
5765
|
+
slug: 'kling-v4-flash',
|
|
5766
|
+
name: 'Kling Video 4.0 Flash',
|
|
5767
|
+
family: 'kling',
|
|
5768
|
+
vendor: 'Kuaishou',
|
|
5769
|
+
desc: 'Kling 4.0, faster and cheaper: text, a start frame, or up to 10 images and 5 videos, at 720p for 3 to 20 seconds.',
|
|
5770
|
+
kind: 'video',
|
|
5771
|
+
unit: '/sec',
|
|
5772
|
+
api: { model: 'kling-v4-flash' },
|
|
5773
|
+
variants: [
|
|
5774
|
+
{
|
|
5775
|
+
id: '720p',
|
|
5776
|
+
price: { starter: 0.1175, plus: 0.1116, scale: 0.1045 },
|
|
5777
|
+
label: '720p',
|
|
5778
|
+
resolution: '720p',
|
|
5779
|
+
withVideo: !1,
|
|
5780
|
+
},
|
|
5781
|
+
{
|
|
5782
|
+
id: '720p-video',
|
|
5783
|
+
price: { starter: 0.0788, plus: 0.0748, scale: 0.07 },
|
|
5784
|
+
label: '720p \xB7 with reference video',
|
|
5785
|
+
resolution: '720p',
|
|
5786
|
+
withVideo: !0,
|
|
5787
|
+
},
|
|
5788
|
+
],
|
|
5789
|
+
unfiltered: null,
|
|
5790
|
+
priority: null,
|
|
5791
|
+
draft: null,
|
|
5792
|
+
axes: { resolution: ['720p'] },
|
|
5793
|
+
from: { variant: '720p' },
|
|
5794
|
+
},
|
|
5764
5795
|
{
|
|
5765
5796
|
slug: 'kling-v3-video',
|
|
5766
5797
|
name: 'Kling Video 3.0',
|
|
@@ -6169,7 +6200,7 @@ var pe,
|
|
|
6169
6200
|
});
|
|
6170
6201
|
var de,
|
|
6171
6202
|
xt,
|
|
6172
|
-
|
|
6203
|
+
$e = h(() => {
|
|
6173
6204
|
'use strict';
|
|
6174
6205
|
((de = [
|
|
6175
6206
|
{
|
|
@@ -6251,35 +6282,35 @@ var de,
|
|
|
6251
6282
|
function qe(e, t) {
|
|
6252
6283
|
return `${e.trim().toLowerCase()}|${(t ?? '').trim().toLowerCase()}`;
|
|
6253
6284
|
}
|
|
6254
|
-
function
|
|
6285
|
+
function ra(e, t) {
|
|
6255
6286
|
if (e === 'seedance-2-mini') return 'mini';
|
|
6256
6287
|
if (e !== 'seedance-2') return;
|
|
6257
|
-
let
|
|
6258
|
-
return
|
|
6259
|
-
?
|
|
6288
|
+
let i = typeof t?.quality == 'string' ? t.quality.trim().toLowerCase() : '';
|
|
6289
|
+
return i === 'fast' || i === 'mini' || i === 'standard'
|
|
6290
|
+
? i
|
|
6260
6291
|
: t?.fast_mode === !0
|
|
6261
6292
|
? 'fast'
|
|
6262
6293
|
: 'standard';
|
|
6263
6294
|
}
|
|
6264
|
-
function
|
|
6265
|
-
let
|
|
6295
|
+
function na(e, t) {
|
|
6296
|
+
let i = e
|
|
6266
6297
|
.trim()
|
|
6267
6298
|
.toLowerCase()
|
|
6268
6299
|
.replace(/-(?:unfiltered|uncensored)$/, '');
|
|
6269
|
-
if (
|
|
6270
|
-
let n =
|
|
6271
|
-
s =
|
|
6300
|
+
if (i === 'seedance-2' || i === 'seedance-2-mini') {
|
|
6301
|
+
let n = ra(i, t),
|
|
6302
|
+
s = Ee.get(qe('seedance-2', n));
|
|
6272
6303
|
return s ? s.slug : null;
|
|
6273
6304
|
}
|
|
6274
|
-
let
|
|
6275
|
-
return
|
|
6305
|
+
let a = ce.get(i) ?? Ee.get(qe(i));
|
|
6306
|
+
return a ? a.slug : null;
|
|
6276
6307
|
}
|
|
6277
|
-
function
|
|
6278
|
-
return ce.has(e) && !(
|
|
6308
|
+
function oa(e, t) {
|
|
6309
|
+
return ce.has(e) && !(sa.has(e) && t) ? e : na(e, t);
|
|
6279
6310
|
}
|
|
6280
6311
|
function W(e, t) {
|
|
6281
|
-
let
|
|
6282
|
-
return
|
|
6312
|
+
let i = oa(e, t);
|
|
6313
|
+
return i ? (ce.get(i) ?? null) : null;
|
|
6283
6314
|
}
|
|
6284
6315
|
function ue() {
|
|
6285
6316
|
return vt;
|
|
@@ -6287,18 +6318,18 @@ function ue() {
|
|
|
6287
6318
|
var Pt,
|
|
6288
6319
|
It,
|
|
6289
6320
|
vt,
|
|
6290
|
-
|
|
6321
|
+
ia,
|
|
6291
6322
|
ce,
|
|
6292
|
-
|
|
6323
|
+
Ee,
|
|
6293
6324
|
_t,
|
|
6294
|
-
|
|
6325
|
+
aa,
|
|
6295
6326
|
Ae,
|
|
6296
|
-
|
|
6327
|
+
sa,
|
|
6297
6328
|
G = h(() => {
|
|
6298
6329
|
'use strict';
|
|
6299
6330
|
kt();
|
|
6300
6331
|
wt();
|
|
6301
|
-
|
|
6332
|
+
$e();
|
|
6302
6333
|
((Pt = {
|
|
6303
6334
|
...pe,
|
|
6304
6335
|
families: pe.families.map((e) => ({ ...e, models: e.models.filter((t) => !le(t)) })),
|
|
@@ -6306,31 +6337,31 @@ var Pt,
|
|
|
6306
6337
|
}),
|
|
6307
6338
|
(It = de.filter((e) => !le(e.slug))),
|
|
6308
6339
|
(vt = [...Pt.models, ...It]),
|
|
6309
|
-
(
|
|
6340
|
+
(ia = [
|
|
6310
6341
|
...Pt.families,
|
|
6311
6342
|
...xt
|
|
6312
6343
|
.map((e) => ({ ...e, models: It.filter((t) => t.family === e.slug).map((t) => t.slug) }))
|
|
6313
6344
|
.filter((e) => e.models.length > 0),
|
|
6314
6345
|
]),
|
|
6315
6346
|
(ce = new Map()),
|
|
6316
|
-
(
|
|
6347
|
+
(Ee = new Map()),
|
|
6317
6348
|
(_t = new Map()),
|
|
6318
|
-
(
|
|
6349
|
+
(aa = new Map()),
|
|
6319
6350
|
(Ae = new Map()));
|
|
6320
6351
|
for (let e of vt) {
|
|
6321
|
-
(ce.set(e.slug, e),
|
|
6352
|
+
(ce.set(e.slug, e), Ee.set(qe(e.api.model, e.api.quality), e));
|
|
6322
6353
|
for (let t of e.variants) _t.set(`${e.slug}/${t.id}`, { model: e, variant: t, edit: !1 });
|
|
6323
6354
|
for (let t of e.editVariants ?? [])
|
|
6324
6355
|
_t.set(`${e.slug}/edit/${t.id}`, { model: e, variant: t, edit: !0 });
|
|
6325
|
-
for (let t of e.addons ?? [])
|
|
6356
|
+
for (let t of e.addons ?? []) aa.set(`${e.slug}/addon/${t.id}`, { model: e, addon: t });
|
|
6326
6357
|
Ae.set(e.slug, e.family);
|
|
6327
6358
|
}
|
|
6328
|
-
for (let e of
|
|
6329
|
-
|
|
6359
|
+
for (let e of ia) for (let t of e.models) Ae.has(t) || Ae.set(t, e.slug);
|
|
6360
|
+
sa = new Set(['seedance-2']);
|
|
6330
6361
|
});
|
|
6331
6362
|
function me(e) {
|
|
6332
6363
|
let t = e.from?.variant;
|
|
6333
|
-
return (t && e.variants.find((
|
|
6364
|
+
return (t && e.variants.find((i) => i.id === t)) || e.variants[0];
|
|
6334
6365
|
}
|
|
6335
6366
|
function Oe(e) {
|
|
6336
6367
|
if (e.endpoints?.length)
|
|
@@ -6361,25 +6392,25 @@ var Mt = h(() => {
|
|
|
6361
6392
|
'use strict';
|
|
6362
6393
|
});
|
|
6363
6394
|
function Kt(e, t) {
|
|
6364
|
-
return typeof t == 'string' && (
|
|
6395
|
+
return typeof t == 'string' && (la[e]?.includes(t) ?? !1);
|
|
6365
6396
|
}
|
|
6366
|
-
var
|
|
6397
|
+
var la,
|
|
6367
6398
|
St = h(() => {
|
|
6368
6399
|
'use strict';
|
|
6369
6400
|
G();
|
|
6370
6401
|
Re();
|
|
6371
6402
|
Mt();
|
|
6372
|
-
|
|
6403
|
+
la = {};
|
|
6373
6404
|
});
|
|
6374
6405
|
function Ct(e) {
|
|
6375
|
-
return e === 'nano-banana-pro' ?
|
|
6406
|
+
return e === 'nano-banana-pro' ? pa : da;
|
|
6376
6407
|
}
|
|
6377
|
-
var
|
|
6378
|
-
|
|
6379
|
-
|
|
6408
|
+
var pa,
|
|
6409
|
+
da,
|
|
6410
|
+
$t = h(() => {
|
|
6380
6411
|
'use strict';
|
|
6381
|
-
((
|
|
6382
|
-
(
|
|
6412
|
+
((pa = ['auto', '1:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9']),
|
|
6413
|
+
(da = [
|
|
6383
6414
|
'auto',
|
|
6384
6415
|
'1:1',
|
|
6385
6416
|
'1:4',
|
|
@@ -6397,10 +6428,10 @@ var li,
|
|
|
6397
6428
|
'21:9',
|
|
6398
6429
|
]));
|
|
6399
6430
|
});
|
|
6400
|
-
var
|
|
6431
|
+
var Et,
|
|
6401
6432
|
At = h(() => {
|
|
6402
6433
|
'use strict';
|
|
6403
|
-
|
|
6434
|
+
Et = [
|
|
6404
6435
|
'prompt',
|
|
6405
6436
|
'system',
|
|
6406
6437
|
'messages',
|
|
@@ -6489,10 +6520,10 @@ var qt,
|
|
|
6489
6520
|
function Rt(e) {
|
|
6490
6521
|
return `$${e}`;
|
|
6491
6522
|
}
|
|
6492
|
-
function De(e, t,
|
|
6493
|
-
return W(e)?.variants.find((n) => n.endpoint === t && n.component ===
|
|
6523
|
+
function De(e, t, i) {
|
|
6524
|
+
return W(e)?.variants.find((n) => n.endpoint === t && n.component === i)?.price.starter ?? null;
|
|
6494
6525
|
}
|
|
6495
|
-
function
|
|
6526
|
+
function ca(e) {
|
|
6496
6527
|
return [
|
|
6497
6528
|
{
|
|
6498
6529
|
name: 'prompt',
|
|
@@ -6562,9 +6593,9 @@ function Lt() {
|
|
|
6562
6593
|
return Object.fromEntries(
|
|
6563
6594
|
qt.map((e) => {
|
|
6564
6595
|
let t = De(e.slug, 'cheap', 'input'),
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
n = t != null &&
|
|
6596
|
+
i = De(e.slug, 'cheap', 'output'),
|
|
6597
|
+
a = De(e.slug, 'stable', 'input') != null,
|
|
6598
|
+
n = t != null && i != null ? `${Rt(t)}/M in \xB7 ${Rt(i)}/M out` : '',
|
|
6568
6599
|
s = {
|
|
6569
6600
|
slug: e.slug,
|
|
6570
6601
|
name: e.name,
|
|
@@ -6575,7 +6606,7 @@ function Lt() {
|
|
|
6575
6606
|
priceFormatted: n,
|
|
6576
6607
|
unit: '/M tokens',
|
|
6577
6608
|
primaryToolName: 'run_task',
|
|
6578
|
-
parameters:
|
|
6609
|
+
parameters: ca(a),
|
|
6579
6610
|
};
|
|
6580
6611
|
return [e.slug, s];
|
|
6581
6612
|
}),
|
|
@@ -6587,38 +6618,38 @@ var Dt = h(() => {
|
|
|
6587
6618
|
G();
|
|
6588
6619
|
});
|
|
6589
6620
|
function ge(e) {
|
|
6590
|
-
return e ?
|
|
6621
|
+
return e ? ma.get(e) : void 0;
|
|
6591
6622
|
}
|
|
6592
|
-
function
|
|
6623
|
+
function Ft(e, t) {
|
|
6593
6624
|
return !e.aspects?.length || e.sourceFramedModes?.includes(t)
|
|
6594
6625
|
? null
|
|
6595
6626
|
: e.adaptiveModes?.includes(t)
|
|
6596
6627
|
? [...e.aspects, 'adaptive']
|
|
6597
6628
|
: [...e.aspects];
|
|
6598
6629
|
}
|
|
6599
|
-
function
|
|
6630
|
+
function Bt(e, t, i) {
|
|
6600
6631
|
return e.modes.includes('motion_control')
|
|
6601
6632
|
? t === 'motion_control'
|
|
6602
|
-
? !
|
|
6603
|
-
: !
|
|
6633
|
+
? !ga.includes(i)
|
|
6634
|
+
: !fa.includes(i)
|
|
6604
6635
|
: !0;
|
|
6605
6636
|
}
|
|
6606
|
-
var
|
|
6607
|
-
|
|
6608
|
-
Vt,
|
|
6609
|
-
bn,
|
|
6610
|
-
mi,
|
|
6637
|
+
var Vt,
|
|
6638
|
+
ua,
|
|
6611
6639
|
Nt,
|
|
6640
|
+
bn,
|
|
6641
|
+
ma,
|
|
6642
|
+
Ut,
|
|
6612
6643
|
Ve,
|
|
6613
6644
|
kn,
|
|
6614
6645
|
Ne,
|
|
6615
|
-
|
|
6616
|
-
|
|
6646
|
+
fa,
|
|
6647
|
+
ga,
|
|
6617
6648
|
Ue = h(() => {
|
|
6618
6649
|
'use strict';
|
|
6619
|
-
((
|
|
6620
|
-
(
|
|
6621
|
-
(
|
|
6650
|
+
((Vt = ['16:9', '9:16', '1:1', '21:9']),
|
|
6651
|
+
(ua = ['16:9', '9:16', '1:1', '4:3', '3:4', '21:9']),
|
|
6652
|
+
(Nt = [
|
|
6622
6653
|
{
|
|
6623
6654
|
slug: 'kling-v4',
|
|
6624
6655
|
kind: 'video',
|
|
@@ -6626,7 +6657,7 @@ var ci,
|
|
|
6626
6657
|
promptMax: 26e3,
|
|
6627
6658
|
duration: { min: 3, max: 30, default: 5 },
|
|
6628
6659
|
heights: { '720p': 720, '1080p': 1080 },
|
|
6629
|
-
aspects:
|
|
6660
|
+
aspects: Vt,
|
|
6630
6661
|
sourceFramedModes: ['image_to_video'],
|
|
6631
6662
|
adaptiveModes: ['multi_reference'],
|
|
6632
6663
|
fps: 24,
|
|
@@ -6643,6 +6674,31 @@ var ci,
|
|
|
6643
6674
|
},
|
|
6644
6675
|
videoInputBilling: { minOutputMultiple: 2, withVideoRows: !0 },
|
|
6645
6676
|
},
|
|
6677
|
+
{
|
|
6678
|
+
slug: 'kling-v4-flash',
|
|
6679
|
+
kind: 'video',
|
|
6680
|
+
modes: ['text_to_video', 'image_to_video', 'multi_reference'],
|
|
6681
|
+
promptMax: 26e3,
|
|
6682
|
+
duration: { min: 3, max: 20, default: 5 },
|
|
6683
|
+
heights: { '720p': 720 },
|
|
6684
|
+
aspects: [...Vt, '4:3', '3:4'],
|
|
6685
|
+
sourceFramedModes: ['image_to_video'],
|
|
6686
|
+
adaptiveModes: ['multi_reference'],
|
|
6687
|
+
fps: 24,
|
|
6688
|
+
audio: 'none',
|
|
6689
|
+
seed: !1,
|
|
6690
|
+
referenceHandles: !0,
|
|
6691
|
+
reference: {
|
|
6692
|
+
maxImages: 10,
|
|
6693
|
+
maxVideos: 5,
|
|
6694
|
+
maxAudios: 0,
|
|
6695
|
+
maxFiles: 15,
|
|
6696
|
+
maxVideoSeconds: 20,
|
|
6697
|
+
videoClipMinSeconds: 3,
|
|
6698
|
+
videoSides: { min: 700, max: 4553, maxPixels: 8294400, maxRatio: 2.5 },
|
|
6699
|
+
},
|
|
6700
|
+
videoInputBilling: { minOutputMultiple: 2, withVideoRows: !0 },
|
|
6701
|
+
},
|
|
6646
6702
|
{
|
|
6647
6703
|
slug: 'kling-v3-video',
|
|
6648
6704
|
kind: 'video',
|
|
@@ -6665,7 +6721,7 @@ var ci,
|
|
|
6665
6721
|
promptMax: 65535,
|
|
6666
6722
|
duration: { min: 5, max: 15, default: 5 },
|
|
6667
6723
|
heights: { '480p': 480, '768p': 768 },
|
|
6668
|
-
aspects:
|
|
6724
|
+
aspects: ua,
|
|
6669
6725
|
fps: 24,
|
|
6670
6726
|
audio: 'free',
|
|
6671
6727
|
seed: !0,
|
|
@@ -6740,9 +6796,9 @@ var ci,
|
|
|
6740
6796
|
seed: !0,
|
|
6741
6797
|
},
|
|
6742
6798
|
]),
|
|
6743
|
-
(bn =
|
|
6744
|
-
(
|
|
6745
|
-
((
|
|
6799
|
+
(bn = Nt.map((e) => e.slug)),
|
|
6800
|
+
(ma = new Map(Nt.map((e) => [e.slug, e]))));
|
|
6801
|
+
((Ut = 'EXAVITQu4vr4xnSDxMaL'),
|
|
6746
6802
|
(Ve = {
|
|
6747
6803
|
hpp4J3VqNfWAUOO0d1Us: 'Bella',
|
|
6748
6804
|
CwhRBWXzGAHq8TQ4Fs17: 'Roger',
|
|
@@ -6780,8 +6836,8 @@ var ci,
|
|
|
6780
6836
|
'opus_48000_128',
|
|
6781
6837
|
'opus_48000_192',
|
|
6782
6838
|
]));
|
|
6783
|
-
((
|
|
6784
|
-
(
|
|
6839
|
+
((fa = ['image_url', 'video_url', 'character_orientation', 'keep_original_sound']),
|
|
6840
|
+
(ga = [
|
|
6785
6841
|
'duration',
|
|
6786
6842
|
'aspect_ratio',
|
|
6787
6843
|
'generate_audio',
|
|
@@ -6793,7 +6849,7 @@ var ci,
|
|
|
6793
6849
|
'audios',
|
|
6794
6850
|
]));
|
|
6795
6851
|
});
|
|
6796
|
-
function
|
|
6852
|
+
function ya() {
|
|
6797
6853
|
return [
|
|
6798
6854
|
{
|
|
6799
6855
|
name: 'image_url',
|
|
@@ -6821,10 +6877,10 @@ function yi() {
|
|
|
6821
6877
|
},
|
|
6822
6878
|
];
|
|
6823
6879
|
}
|
|
6824
|
-
function
|
|
6880
|
+
function ba(e) {
|
|
6825
6881
|
let t = e.duration,
|
|
6826
|
-
|
|
6827
|
-
|
|
6882
|
+
i = Object.keys(e.heights),
|
|
6883
|
+
a = e.sourceFramedModes?.length
|
|
6828
6884
|
? ` Not taken by ${e.sourceFramedModes.join(', ')}: the source image sets the frame.`
|
|
6829
6885
|
: '',
|
|
6830
6886
|
n = e.modeRequired ? void 0 : e.modes[0],
|
|
@@ -6842,8 +6898,8 @@ function bi(e) {
|
|
|
6842
6898
|
{
|
|
6843
6899
|
name: 'resolution',
|
|
6844
6900
|
type: 'select',
|
|
6845
|
-
default:
|
|
6846
|
-
options:
|
|
6901
|
+
default: i[0],
|
|
6902
|
+
options: i,
|
|
6847
6903
|
description: `Output resolution. Higher resolutions cost more per second.${e.modes.includes('motion_control') ? ' motion_control: 720p or 1080p.' : ''}`,
|
|
6848
6904
|
},
|
|
6849
6905
|
{
|
|
@@ -6851,7 +6907,7 @@ function bi(e) {
|
|
|
6851
6907
|
type: 'select',
|
|
6852
6908
|
...(s ? {} : { default: e.aspects[0] }),
|
|
6853
6909
|
options: [...e.aspects, ...(e.adaptiveModes?.length ? ['adaptive'] : [])],
|
|
6854
|
-
description: `The frame.${e.adaptiveModes?.length ? ` adaptive: ${e.adaptiveModes.join(', ')} only.` : ''}${
|
|
6910
|
+
description: `The frame.${e.adaptiveModes?.length ? ` adaptive: ${e.adaptiveModes.join(', ')} only.` : ''}${a}`,
|
|
6855
6911
|
},
|
|
6856
6912
|
];
|
|
6857
6913
|
if (
|
|
@@ -6896,7 +6952,7 @@ function bi(e) {
|
|
|
6896
6952
|
o.push({
|
|
6897
6953
|
name: 'videos',
|
|
6898
6954
|
type: 'string[]',
|
|
6899
|
-
description: `multi_reference: up to ${u.maxVideos} reference videos${u.maxVideoSeconds ? `, ${u.maxVideoSeconds} s in all` : ''}.${e.referenceHandles ? ' In the prompt, name them @Video1, @Video2, ... in this order.' : ''}${l} ${L}`,
|
|
6955
|
+
description: `multi_reference: up to ${u.maxVideos} reference videos${u.videoClipMinSeconds ? `, each longer than ${u.videoClipMinSeconds} s` : ''}${u.videoSides ? `, ${u.videoSides.min} to ${u.videoSides.max} px tall and wide` : ''}${u.maxVideoSeconds ? `, ${u.maxVideoSeconds} s in all` : ''}.${e.referenceHandles ? ' In the prompt, name them @Video1, @Video2, ... in this order.' : ''}${l} ${L}`,
|
|
6900
6956
|
});
|
|
6901
6957
|
}
|
|
6902
6958
|
if (e.reference?.maxAudios) {
|
|
@@ -6914,7 +6970,7 @@ function bi(e) {
|
|
|
6914
6970
|
}
|
|
6915
6971
|
return o;
|
|
6916
6972
|
}
|
|
6917
|
-
function
|
|
6973
|
+
function ka(e) {
|
|
6918
6974
|
let t = Object.keys(e.sizes);
|
|
6919
6975
|
return [
|
|
6920
6976
|
{
|
|
@@ -6931,13 +6987,13 @@ function ki(e) {
|
|
|
6931
6987
|
},
|
|
6932
6988
|
];
|
|
6933
6989
|
}
|
|
6934
|
-
function
|
|
6990
|
+
function xa() {
|
|
6935
6991
|
return [
|
|
6936
6992
|
{
|
|
6937
6993
|
name: 'voice_id',
|
|
6938
6994
|
type: 'string',
|
|
6939
|
-
default:
|
|
6940
|
-
description: `text_to_speech: the ElevenLabs voice id, one of: ${
|
|
6995
|
+
default: Ut,
|
|
6996
|
+
description: `text_to_speech: the ElevenLabs voice id, one of: ${wa}.`,
|
|
6941
6997
|
},
|
|
6942
6998
|
{
|
|
6943
6999
|
name: 'turns',
|
|
@@ -6956,9 +7012,9 @@ function xi() {
|
|
|
6956
7012
|
},
|
|
6957
7013
|
];
|
|
6958
7014
|
}
|
|
6959
|
-
function
|
|
7015
|
+
function jt(e) {
|
|
6960
7016
|
let t = e.promptOptionalModes?.length ? ` Optional on ${e.promptOptionalModes.join(', ')}.` : '',
|
|
6961
|
-
|
|
7017
|
+
i = [
|
|
6962
7018
|
{
|
|
6963
7019
|
name: 'prompt',
|
|
6964
7020
|
type: 'string',
|
|
@@ -6971,26 +7027,26 @@ function Bt(e) {
|
|
|
6971
7027
|
required: !0,
|
|
6972
7028
|
...(e.modeRequired ? {} : { default: e.modes[0] }),
|
|
6973
7029
|
options: [...e.modes],
|
|
6974
|
-
description: `${e.modeRequired ? 'Required. ' : ''}${e.modes.map((
|
|
7030
|
+
description: `${e.modeRequired ? 'Required. ' : ''}${e.modes.map((a) => ha[a]).join(' ')}`,
|
|
6975
7031
|
},
|
|
6976
7032
|
];
|
|
6977
7033
|
return (
|
|
6978
|
-
e.kind === 'video' ?
|
|
6979
|
-
e.modes.includes('motion_control') &&
|
|
7034
|
+
e.kind === 'video' ? i.push(...ba(e)) : e.kind === 'image' ? i.push(...ka(e)) : i.push(...xa()),
|
|
7035
|
+
e.modes.includes('motion_control') && i.push(...ya()),
|
|
6980
7036
|
e.seed &&
|
|
6981
|
-
|
|
6982
|
-
|
|
7037
|
+
i.push({ name: 'seed', type: 'number', min: 0, description: 'Seed for repeatable runs.' }),
|
|
7038
|
+
i
|
|
6983
7039
|
);
|
|
6984
7040
|
}
|
|
6985
7041
|
var L,
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
7042
|
+
ha,
|
|
7043
|
+
wa,
|
|
7044
|
+
Gt = h(() => {
|
|
6989
7045
|
'use strict';
|
|
6990
7046
|
Ue();
|
|
6991
7047
|
((L =
|
|
6992
7048
|
'as public http(s) URLs or data URIs. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.'),
|
|
6993
|
-
(
|
|
7049
|
+
(ha = {
|
|
6994
7050
|
text_to_video: 'text_to_video: from the prompt alone.',
|
|
6995
7051
|
image_to_video: 'image_to_video: a start image in first_frame_image.',
|
|
6996
7052
|
first_n_last_frames: 'first_n_last_frames: first_frame_image and last_frame_image.',
|
|
@@ -7002,24 +7058,24 @@ var L,
|
|
|
7002
7058
|
motion_control:
|
|
7003
7059
|
'motion_control: the character in image_url performs the motion of video_url; length and frame follow the video.',
|
|
7004
7060
|
}));
|
|
7005
|
-
|
|
7061
|
+
wa = Object.entries(Ve)
|
|
7006
7062
|
.map(([e, t]) => `${e} (${t})`)
|
|
7007
7063
|
.join(', ');
|
|
7008
7064
|
});
|
|
7009
7065
|
var he,
|
|
7010
|
-
Gt,
|
|
7011
|
-
Y,
|
|
7012
7066
|
Ht,
|
|
7067
|
+
Y,
|
|
7068
|
+
zt,
|
|
7013
7069
|
Pn,
|
|
7014
7070
|
In,
|
|
7015
7071
|
vn,
|
|
7016
7072
|
Tn,
|
|
7017
|
-
|
|
7073
|
+
Jt = h(() => {
|
|
7018
7074
|
'use strict';
|
|
7019
7075
|
((he = 'enhancor-ultrafine'),
|
|
7020
|
-
(
|
|
7076
|
+
(Ht = 'Enhancor Ultrafine'),
|
|
7021
7077
|
(Y = { skin: [2, 3, 4], noSkin: [2, 3, 4, 8, 16] }),
|
|
7022
|
-
(
|
|
7078
|
+
(zt = 2),
|
|
7023
7079
|
(Pn = 24 * 1024 * 1024),
|
|
7024
7080
|
(In = 4096 * 4096),
|
|
7025
7081
|
(vn = 30 * 6e4),
|
|
@@ -7047,123 +7103,123 @@ var X,
|
|
|
7047
7103
|
function Q(e) {
|
|
7048
7104
|
return `$${Number(e.toFixed(5))}`;
|
|
7049
7105
|
}
|
|
7050
|
-
function
|
|
7106
|
+
function Ia(e) {
|
|
7051
7107
|
if (e.kind === 'llm') {
|
|
7052
7108
|
let t = e.defaultEndpoint,
|
|
7053
|
-
|
|
7109
|
+
i = (s) =>
|
|
7054
7110
|
e.variants.find(
|
|
7055
7111
|
(o) =>
|
|
7056
7112
|
o.component === s &&
|
|
7057
7113
|
(!t || !o.endpoint || o.endpoint === t) &&
|
|
7058
7114
|
(!o.context || o.context === '0\u201332K'),
|
|
7059
7115
|
),
|
|
7060
|
-
|
|
7061
|
-
n =
|
|
7062
|
-
return
|
|
7063
|
-
? `${Q(
|
|
7116
|
+
a = i('input'),
|
|
7117
|
+
n = i('output');
|
|
7118
|
+
return a && n
|
|
7119
|
+
? `${Q(a.price.starter)}/M in \xB7 ${Q(n.price.starter)}/M out`
|
|
7064
7120
|
: `from ${Q(me(e).price.starter)}/M tokens`;
|
|
7065
7121
|
}
|
|
7066
7122
|
return `from ${Q(me(e).price.starter)}${e.unit}`;
|
|
7067
7123
|
}
|
|
7068
|
-
function
|
|
7069
|
-
let
|
|
7070
|
-
return
|
|
7124
|
+
function va(e, t) {
|
|
7125
|
+
let i = t.filter((a) => Number.isFinite(a) && a > 0);
|
|
7126
|
+
return i.length ? `from ${Q(Math.min(...i))}${e}` : null;
|
|
7071
7127
|
}
|
|
7072
|
-
function
|
|
7128
|
+
function Zt(e) {
|
|
7073
7129
|
for (let t of J) {
|
|
7074
|
-
let
|
|
7075
|
-
|
|
7076
|
-
|
|
7130
|
+
let i = ke[t],
|
|
7131
|
+
a = i ? va(i.unit, e[t] ?? []) : null;
|
|
7132
|
+
i && a && (i.priceFormatted = a);
|
|
7077
7133
|
}
|
|
7078
7134
|
}
|
|
7079
7135
|
function A(e, t) {
|
|
7080
|
-
let
|
|
7081
|
-
...new Set(e.variants.map((
|
|
7136
|
+
let i = e.axes?.resolution ?? [
|
|
7137
|
+
...new Set(e.variants.map((a) => a.resolution).filter((a) => !!a)),
|
|
7082
7138
|
];
|
|
7083
7139
|
return {
|
|
7084
7140
|
name: 'resolution',
|
|
7085
7141
|
type: 'select',
|
|
7086
|
-
default: me(e).resolution ??
|
|
7087
|
-
options:
|
|
7142
|
+
default: me(e).resolution ?? i[0],
|
|
7143
|
+
options: i,
|
|
7088
7144
|
...(t ? { description: t } : {}),
|
|
7089
7145
|
};
|
|
7090
7146
|
}
|
|
7091
|
-
function
|
|
7147
|
+
function ei(e) {
|
|
7092
7148
|
if (!e.endpoints?.length) return null;
|
|
7093
|
-
let t = e.endpoints.filter((
|
|
7149
|
+
let t = e.endpoints.filter((i) => Kt(e.slug, i.id));
|
|
7094
7150
|
return {
|
|
7095
7151
|
name: 'endpoint',
|
|
7096
7152
|
type: 'select',
|
|
7097
7153
|
default: Oe(e),
|
|
7098
|
-
options: e.endpoints.filter((
|
|
7154
|
+
options: e.endpoints.filter((i) => !t.includes(i)).map((i) => i.id),
|
|
7099
7155
|
description:
|
|
7100
7156
|
(e.slug === 'gemini-3.1-pro-preview'
|
|
7101
7157
|
? 'Where the request is served; a missing endpoint is the default, the lowest price, and an unknown one is refused.'
|
|
7102
7158
|
: 'Where the request is served; a missing or unknown endpoint is the default, the lowest price.') +
|
|
7103
|
-
(t.length ? ` ${t.map((
|
|
7159
|
+
(t.length ? ` ${t.map((i) => i.label).join(' and ')}: coming soon.` : ''),
|
|
7104
7160
|
};
|
|
7105
7161
|
}
|
|
7106
|
-
function
|
|
7107
|
-
if (e.unfiltered == null || t.some((
|
|
7108
|
-
let
|
|
7109
|
-
return [...t.filter((
|
|
7162
|
+
function Ma(e, t) {
|
|
7163
|
+
if (e.unfiltered == null || t.some((a) => a.name === 'creative_mode')) return t;
|
|
7164
|
+
let i = X.includes(e.api.model);
|
|
7165
|
+
return [...t.filter((a) => !be.has(a.name)), i ? Je : Ta];
|
|
7110
7166
|
}
|
|
7111
7167
|
function Be(e, t) {
|
|
7112
|
-
let
|
|
7113
|
-
|
|
7114
|
-
return (
|
|
7168
|
+
let i = e.filter((n) => !be.has(n.name)),
|
|
7169
|
+
a = [Je, ti];
|
|
7170
|
+
return (a.push(We, Ye), [...i, ...a]);
|
|
7115
7171
|
}
|
|
7116
|
-
function
|
|
7172
|
+
function $a(e) {
|
|
7117
7173
|
return [
|
|
7118
7174
|
...e
|
|
7119
|
-
.filter((t) => !
|
|
7175
|
+
.filter((t) => !Sa.has(t.name) && !be.has(t.name))
|
|
7120
7176
|
.map((t) => {
|
|
7121
7177
|
if (t.name === 'resolution')
|
|
7122
7178
|
return {
|
|
7123
7179
|
...t,
|
|
7124
7180
|
...(t.options
|
|
7125
7181
|
? {
|
|
7126
|
-
options: t.options.filter((
|
|
7127
|
-
['480p', '720p'].includes(String(
|
|
7182
|
+
options: t.options.filter((a) =>
|
|
7183
|
+
['480p', '720p'].includes(String(a).toLowerCase()),
|
|
7128
7184
|
),
|
|
7129
7185
|
}
|
|
7130
7186
|
: {}),
|
|
7131
7187
|
description: `Output resolution: 480p or 720p (8-bit). This tier has no 1080p or 4k. ${Z}`,
|
|
7132
7188
|
};
|
|
7133
|
-
let
|
|
7134
|
-
return
|
|
7135
|
-
? { ...t, description: t.description.replace(/\(up to [^)]*\)/, `(${
|
|
7189
|
+
let i = Ca[t.name];
|
|
7190
|
+
return i && typeof t.description == 'string'
|
|
7191
|
+
? { ...t, description: t.description.replace(/\(up to [^)]*\)/, `(${i})`) }
|
|
7136
7192
|
: t;
|
|
7137
7193
|
}),
|
|
7138
7194
|
Je,
|
|
7139
|
-
|
|
7195
|
+
ti,
|
|
7140
7196
|
We,
|
|
7141
7197
|
Ye,
|
|
7142
7198
|
];
|
|
7143
7199
|
}
|
|
7144
|
-
function
|
|
7200
|
+
function ii(e) {
|
|
7145
7201
|
return (
|
|
7146
7202
|
e.startsWith('seedance-2-5-') &&
|
|
7147
7203
|
e !== 'seedance-2-5-lite' &&
|
|
7148
7204
|
!/-(creative-mode|unfiltered|uncensored)$/.test(e)
|
|
7149
7205
|
);
|
|
7150
7206
|
}
|
|
7151
|
-
function
|
|
7207
|
+
function Wt(e, t = {}) {
|
|
7152
7208
|
return [
|
|
7153
7209
|
...e
|
|
7154
|
-
.filter((
|
|
7155
|
-
.map((
|
|
7156
|
-
|
|
7157
|
-
? { ...
|
|
7158
|
-
:
|
|
7210
|
+
.filter((i) => !Ka.has(i.name) && !be.has(i.name))
|
|
7211
|
+
.map((i) =>
|
|
7212
|
+
i.name === 'prompt'
|
|
7213
|
+
? { ...i, required: !0 }
|
|
7214
|
+
: i.name === 'resolution'
|
|
7159
7215
|
? {
|
|
7160
|
-
...
|
|
7161
|
-
...(t.no4k &&
|
|
7162
|
-
? { options:
|
|
7216
|
+
...i,
|
|
7217
|
+
...(t.no4k && i.options
|
|
7218
|
+
? { options: i.options.filter((a) => String(a).toLowerCase() !== '4k') }
|
|
7163
7219
|
: {}),
|
|
7164
7220
|
description: `Output resolution. TEIN LITE is the lower-priced endpoint for getting started. Stability and reliability are not guaranteed. ${Z}`,
|
|
7165
7221
|
}
|
|
7166
|
-
:
|
|
7222
|
+
: i,
|
|
7167
7223
|
),
|
|
7168
7224
|
{
|
|
7169
7225
|
name: 'bitrate_mode',
|
|
@@ -7190,23 +7246,23 @@ function je(e, t) {
|
|
|
7190
7246
|
},
|
|
7191
7247
|
A(e),
|
|
7192
7248
|
{ name: 'aspect_ratio', type: 'select', default: t.aspects[0], options: t.aspects },
|
|
7193
|
-
...t.references.map((
|
|
7194
|
-
|
|
7249
|
+
...t.references.map((i) =>
|
|
7250
|
+
i.endsWith('s')
|
|
7195
7251
|
? {
|
|
7196
|
-
name:
|
|
7252
|
+
name: i,
|
|
7197
7253
|
type: 'string[]',
|
|
7198
|
-
description: `${
|
|
7254
|
+
description: `${i} as public http(s) URLs or data URIs. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.`,
|
|
7199
7255
|
}
|
|
7200
7256
|
: {
|
|
7201
|
-
name:
|
|
7257
|
+
name: i,
|
|
7202
7258
|
type: 'string',
|
|
7203
|
-
description: `${
|
|
7259
|
+
description: `${i} as a public http(s) URL or data URI. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.`,
|
|
7204
7260
|
},
|
|
7205
7261
|
),
|
|
7206
7262
|
];
|
|
7207
7263
|
}
|
|
7208
|
-
function
|
|
7209
|
-
let t =
|
|
7264
|
+
function Ea(e) {
|
|
7265
|
+
let t = ei(e);
|
|
7210
7266
|
return [
|
|
7211
7267
|
C('Image prompt text. Supports complex composition and text instructions.'),
|
|
7212
7268
|
...(t ? [t] : []),
|
|
@@ -7273,7 +7329,7 @@ function $i(e) {
|
|
|
7273
7329
|
},
|
|
7274
7330
|
];
|
|
7275
7331
|
}
|
|
7276
|
-
function
|
|
7332
|
+
function Aa(e) {
|
|
7277
7333
|
return [
|
|
7278
7334
|
C('Image prompt text.'),
|
|
7279
7335
|
{
|
|
@@ -7307,22 +7363,22 @@ function Ai(e) {
|
|
|
7307
7363
|
},
|
|
7308
7364
|
];
|
|
7309
7365
|
}
|
|
7310
|
-
function
|
|
7311
|
-
let e =
|
|
7366
|
+
function La() {
|
|
7367
|
+
let e = Et,
|
|
7312
7368
|
t = [];
|
|
7313
|
-
for (let
|
|
7314
|
-
e.includes(
|
|
7369
|
+
for (let i of Xe(!0))
|
|
7370
|
+
e.includes(i.name) &&
|
|
7315
7371
|
(t.push({
|
|
7316
|
-
...
|
|
7317
|
-
...(
|
|
7318
|
-
...(
|
|
7372
|
+
...i,
|
|
7373
|
+
...(i.name === 'max_tokens' ? { min: 64 } : {}),
|
|
7374
|
+
...(i.name === 'messages'
|
|
7319
7375
|
? {
|
|
7320
7376
|
description:
|
|
7321
7377
|
'Chat history: system, developer, user (text and image_url parts) and assistant turns; no tool turns.',
|
|
7322
7378
|
}
|
|
7323
7379
|
: {}),
|
|
7324
7380
|
}),
|
|
7325
|
-
|
|
7381
|
+
i.name === 'top_p' &&
|
|
7326
7382
|
t.push({
|
|
7327
7383
|
name: 'top_k',
|
|
7328
7384
|
type: 'number',
|
|
@@ -7332,7 +7388,7 @@ function Li() {
|
|
|
7332
7388
|
}));
|
|
7333
7389
|
return t;
|
|
7334
7390
|
}
|
|
7335
|
-
function
|
|
7391
|
+
function Da() {
|
|
7336
7392
|
return Xe(!0).map((e) =>
|
|
7337
7393
|
e.name === 'max_tokens' || e.name === 'max_completion_tokens' ? { ...e, min: 128 } : e,
|
|
7338
7394
|
);
|
|
@@ -7432,17 +7488,17 @@ function Xe(e) {
|
|
|
7432
7488
|
},
|
|
7433
7489
|
];
|
|
7434
7490
|
}
|
|
7435
|
-
function
|
|
7436
|
-
if (e.slug === 'seed-2-1-turbo') return
|
|
7437
|
-
let t =
|
|
7491
|
+
function Va(e) {
|
|
7492
|
+
if (e.slug === 'seed-2-1-turbo') return Oa;
|
|
7493
|
+
let t = ei(e);
|
|
7438
7494
|
return [
|
|
7439
7495
|
...(e.slug === 'gemini-3.1-pro-preview'
|
|
7440
|
-
?
|
|
7496
|
+
? La()
|
|
7441
7497
|
: e.slug === 'gemini-3.7-flash'
|
|
7442
|
-
?
|
|
7443
|
-
: e.slug === 'gpt-6-astra' ||
|
|
7498
|
+
? Da()
|
|
7499
|
+
: e.slug === 'gpt-6-astra' || Ra.includes(e.slug)
|
|
7444
7500
|
? Xe(e.slug !== 'gpt-6-astra')
|
|
7445
|
-
:
|
|
7501
|
+
: qa),
|
|
7446
7502
|
...(t ? [t] : []),
|
|
7447
7503
|
];
|
|
7448
7504
|
}
|
|
@@ -7454,7 +7510,7 @@ function Ge() {
|
|
|
7454
7510
|
description: 'The photo to fix: one JPEG or PNG URL.',
|
|
7455
7511
|
};
|
|
7456
7512
|
}
|
|
7457
|
-
function
|
|
7513
|
+
function Ua(e) {
|
|
7458
7514
|
return [
|
|
7459
7515
|
{
|
|
7460
7516
|
name: 'video_url',
|
|
@@ -7476,7 +7532,7 @@ function Ui(e) {
|
|
|
7476
7532
|
},
|
|
7477
7533
|
];
|
|
7478
7534
|
}
|
|
7479
|
-
function
|
|
7535
|
+
function Fa() {
|
|
7480
7536
|
return [
|
|
7481
7537
|
{
|
|
7482
7538
|
name: 'mode',
|
|
@@ -7547,30 +7603,30 @@ function Fi() {
|
|
|
7547
7603
|
},
|
|
7548
7604
|
];
|
|
7549
7605
|
}
|
|
7550
|
-
function
|
|
7606
|
+
function Ba(e) {
|
|
7551
7607
|
let t = e.slug;
|
|
7552
|
-
if (e.family === 'tein-labs' && e.kind === 'image') return
|
|
7553
|
-
if (de.some((
|
|
7554
|
-
if (e.kind === 'llm') return
|
|
7555
|
-
if (e.editVariants?.length) return
|
|
7556
|
-
let
|
|
7557
|
-
if (
|
|
7558
|
-
if (
|
|
7608
|
+
if (e.family === 'tein-labs' && e.kind === 'image') return Fa();
|
|
7609
|
+
if (de.some((a) => a.slug === t)) return Ua(e);
|
|
7610
|
+
if (e.kind === 'llm') return Va(e);
|
|
7611
|
+
if (e.editVariants?.length) return Ea(e);
|
|
7612
|
+
let i = ge(t);
|
|
7613
|
+
if (i) return jt(i);
|
|
7614
|
+
if (ii(t)) return $a(He);
|
|
7559
7615
|
switch (t) {
|
|
7560
7616
|
case 'seedance-2-5':
|
|
7561
7617
|
return Be(He, t);
|
|
7562
7618
|
case 'seedance-2-5-lite':
|
|
7563
|
-
return
|
|
7619
|
+
return Wt(He, { no4k: !0 });
|
|
7564
7620
|
case 'seedance-2':
|
|
7565
|
-
return Be(
|
|
7621
|
+
return Be(Yt, t);
|
|
7566
7622
|
case 'seedance-2-lite':
|
|
7567
|
-
return
|
|
7623
|
+
return Wt(Yt);
|
|
7568
7624
|
case 'seedance-2-mini':
|
|
7569
|
-
return Be(
|
|
7625
|
+
return Be(ja, t);
|
|
7570
7626
|
case 'nano-banana-2':
|
|
7571
7627
|
case 'nano-banana-2.1':
|
|
7572
7628
|
case 'nano-banana-pro':
|
|
7573
|
-
return
|
|
7629
|
+
return Aa(e);
|
|
7574
7630
|
case 'seedream-5-pro':
|
|
7575
7631
|
return [
|
|
7576
7632
|
C('Detailed description of the image to generate.'),
|
|
@@ -7837,7 +7893,7 @@ function Bi(e) {
|
|
|
7837
7893
|
max: 0.4,
|
|
7838
7894
|
description: 'Portrait depth. Heavy only.',
|
|
7839
7895
|
},
|
|
7840
|
-
...
|
|
7896
|
+
...Na,
|
|
7841
7897
|
];
|
|
7842
7898
|
case 'enhancor-skin-fix-v3':
|
|
7843
7899
|
return [
|
|
@@ -7944,10 +8000,10 @@ function Bi(e) {
|
|
|
7944
8000
|
return [C('Prompt text.')];
|
|
7945
8001
|
}
|
|
7946
8002
|
}
|
|
7947
|
-
function
|
|
8003
|
+
function Ga() {
|
|
7948
8004
|
return {
|
|
7949
8005
|
slug: he,
|
|
7950
|
-
name:
|
|
8006
|
+
name: Ht,
|
|
7951
8007
|
category: 'Image',
|
|
7952
8008
|
kind: 'Image-to-Image',
|
|
7953
8009
|
vendor: 'Enhancor',
|
|
@@ -7955,7 +8011,7 @@ function Gi() {
|
|
|
7955
8011
|
'Upscales a photo, with an optional skin fix. Full makes the photo its size times the scale; Fast makes a fixed size (long side 2432 px).',
|
|
7956
8012
|
priceFormatted: '',
|
|
7957
8013
|
unit: '/img',
|
|
7958
|
-
primaryToolName:
|
|
8014
|
+
primaryToolName: Qt.image,
|
|
7959
8015
|
parameters: [
|
|
7960
8016
|
{
|
|
7961
8017
|
name: 'image',
|
|
@@ -7981,7 +8037,7 @@ function Gi() {
|
|
|
7981
8037
|
{
|
|
7982
8038
|
name: 'scale',
|
|
7983
8039
|
type: 'select',
|
|
7984
|
-
default: String(
|
|
8040
|
+
default: String(zt),
|
|
7985
8041
|
options: Y.noSkin.map(String),
|
|
7986
8042
|
description: `Full only. ${Y.skin.join(', ')} with skin_fix on; also ${Y.noSkin.filter((e) => !Y.skin.includes(e)).join(' and ')} with it off. The output is at most 48 megapixels.`,
|
|
7987
8043
|
},
|
|
@@ -7992,17 +8048,17 @@ function ze(e, t = e.api.model) {
|
|
|
7992
8048
|
return {
|
|
7993
8049
|
slug: t,
|
|
7994
8050
|
name: e.name,
|
|
7995
|
-
category:
|
|
7996
|
-
kind: t.startsWith('enhancor-skin-fix-') ? 'Image-to-Image' :
|
|
8051
|
+
category: _a[e.kind],
|
|
8052
|
+
kind: t.startsWith('enhancor-skin-fix-') ? 'Image-to-Image' : Pa[e.kind],
|
|
7997
8053
|
vendor: e.vendor ?? '',
|
|
7998
8054
|
description: e.desc ?? e.name,
|
|
7999
|
-
priceFormatted:
|
|
8055
|
+
priceFormatted: Ia(e),
|
|
8000
8056
|
unit: e.unit,
|
|
8001
|
-
primaryToolName:
|
|
8002
|
-
parameters:
|
|
8057
|
+
primaryToolName: Qt[e.kind],
|
|
8058
|
+
parameters: Ma(e, Ba(e)),
|
|
8003
8059
|
};
|
|
8004
8060
|
}
|
|
8005
|
-
function
|
|
8061
|
+
function Ha() {
|
|
8006
8062
|
let e = {};
|
|
8007
8063
|
for (let t of ue())
|
|
8008
8064
|
if (t.slug !== 'seedance-2-fast') {
|
|
@@ -8011,16 +8067,16 @@ function Hi() {
|
|
|
8011
8067
|
continue;
|
|
8012
8068
|
}
|
|
8013
8069
|
if (t.slug === 'seedance-2') {
|
|
8014
|
-
let
|
|
8015
|
-
((
|
|
8016
|
-
(e['seedance-2'] =
|
|
8070
|
+
let i = ze(t);
|
|
8071
|
+
((i.description = `${t.desc ?? t.name} Send quality fast or mini for Seedance 2.0 Fast or Mini.`),
|
|
8072
|
+
(e['seedance-2'] = i));
|
|
8017
8073
|
continue;
|
|
8018
8074
|
}
|
|
8019
8075
|
t.slug.startsWith('claude-') || (e[t.api.model] = ze(t));
|
|
8020
8076
|
}
|
|
8021
|
-
(Object.assign(e, Lt()), (e[he] =
|
|
8022
|
-
for (let [t,
|
|
8023
|
-
e[
|
|
8077
|
+
(Object.assign(e, Lt()), (e[he] = Ga()));
|
|
8078
|
+
for (let [t, i] of Object.entries(fe))
|
|
8079
|
+
e[i] && Object.defineProperty(e, t, { value: e[i], enumerable: !1 });
|
|
8024
8080
|
return e;
|
|
8025
8081
|
}
|
|
8026
8082
|
function we(e) {
|
|
@@ -8029,102 +8085,102 @@ function we(e) {
|
|
|
8029
8085
|
function H(e) {
|
|
8030
8086
|
return ke[e] ?? null;
|
|
8031
8087
|
}
|
|
8032
|
-
function
|
|
8088
|
+
function za(e, t, i) {
|
|
8033
8089
|
if (e.startsWith('enhancor-skin-fix-') || e === he) return !1;
|
|
8034
|
-
if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite' ||
|
|
8090
|
+
if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite' || ii(e)) && t === 'duration') {
|
|
8035
8091
|
let n = (s) => (typeof s == 'string' ? s.trim().toLowerCase() : '');
|
|
8036
|
-
if (n(
|
|
8092
|
+
if (n(i.mode) === 'edit' || n(i.omni_reference_task_type) === 'edit') return !1;
|
|
8037
8093
|
}
|
|
8038
8094
|
if (
|
|
8039
|
-
(t === 'max_tokens' &&
|
|
8040
|
-
(t === 'max_completion_tokens' &&
|
|
8095
|
+
(t === 'max_tokens' && Xt(i.max_completion_tokens)) ||
|
|
8096
|
+
(t === 'max_completion_tokens' && Xt(i.max_tokens))
|
|
8041
8097
|
)
|
|
8042
8098
|
return !1;
|
|
8043
8099
|
if (t === 'aspect_ratio') {
|
|
8044
8100
|
let n = ge(e);
|
|
8045
8101
|
if (n) {
|
|
8046
|
-
let s = typeof
|
|
8102
|
+
let s = typeof i.mode == 'string' ? i.mode.trim().toLowerCase() : '',
|
|
8047
8103
|
o = s ? s.replace(/-/g, '_') : n.modes[0];
|
|
8048
|
-
if (n.modes.includes(o) && !
|
|
8104
|
+
if (n.modes.includes(o) && !Ft(n, o)) return !1;
|
|
8049
8105
|
}
|
|
8050
8106
|
}
|
|
8051
|
-
let
|
|
8052
|
-
if (
|
|
8053
|
-
let n = typeof
|
|
8054
|
-
s = n ? n.replace(/-/g, '_') :
|
|
8055
|
-
if (
|
|
8107
|
+
let a = ge(e);
|
|
8108
|
+
if (a) {
|
|
8109
|
+
let n = typeof i.mode == 'string' ? i.mode.trim().toLowerCase() : '',
|
|
8110
|
+
s = n ? n.replace(/-/g, '_') : a.modes[0];
|
|
8111
|
+
if (a.modes.includes(s) && !Bt(a, s, t)) return !1;
|
|
8056
8112
|
}
|
|
8057
8113
|
return !0;
|
|
8058
8114
|
}
|
|
8059
|
-
function
|
|
8115
|
+
function Xt(e) {
|
|
8060
8116
|
return e != null && e !== '';
|
|
8061
8117
|
}
|
|
8062
|
-
function
|
|
8063
|
-
let
|
|
8118
|
+
function ni(e, t) {
|
|
8119
|
+
let i = { ...t };
|
|
8064
8120
|
if (e?.slug === 'seedance-2-5') {
|
|
8065
|
-
let
|
|
8066
|
-
for (let n of
|
|
8067
|
-
if (!i
|
|
8121
|
+
let a = (n) => typeof n != 'string' || !n.trim();
|
|
8122
|
+
for (let n of Ja) (a(i.finalize) && !a(i[n]) && (i.finalize = i[n]), delete i[n]);
|
|
8123
|
+
if (!a(i.finalize)) return i;
|
|
8068
8124
|
}
|
|
8069
|
-
for (let
|
|
8070
|
-
|
|
8071
|
-
a
|
|
8072
|
-
|
|
8073
|
-
(a
|
|
8074
|
-
return
|
|
8125
|
+
for (let a of e?.parameters ?? [])
|
|
8126
|
+
a.default !== void 0 &&
|
|
8127
|
+
i[a.name] === void 0 &&
|
|
8128
|
+
za(e.slug, a.name, t) &&
|
|
8129
|
+
(i[a.name] = a.default);
|
|
8130
|
+
return i;
|
|
8075
8131
|
}
|
|
8076
8132
|
function D() {
|
|
8077
8133
|
return Object.values(ke);
|
|
8078
8134
|
}
|
|
8079
|
-
var
|
|
8080
|
-
|
|
8081
|
-
|
|
8135
|
+
var _a,
|
|
8136
|
+
Qt,
|
|
8137
|
+
Pa,
|
|
8082
8138
|
C,
|
|
8083
8139
|
Je,
|
|
8084
|
-
|
|
8085
|
-
|
|
8140
|
+
Ta,
|
|
8141
|
+
ti,
|
|
8086
8142
|
We,
|
|
8087
8143
|
Ye,
|
|
8088
8144
|
be,
|
|
8089
|
-
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8145
|
+
Ka,
|
|
8146
|
+
Sa,
|
|
8147
|
+
Ca,
|
|
8148
|
+
qa,
|
|
8149
|
+
Oa,
|
|
8150
|
+
Ra,
|
|
8151
|
+
Na,
|
|
8096
8152
|
Z,
|
|
8097
8153
|
He,
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8154
|
+
ai,
|
|
8155
|
+
ri,
|
|
8156
|
+
Yt,
|
|
8157
|
+
ja,
|
|
8102
8158
|
ke,
|
|
8103
|
-
|
|
8159
|
+
Ja,
|
|
8104
8160
|
ee = h(() => {
|
|
8105
8161
|
'use strict';
|
|
8106
8162
|
bt();
|
|
8107
8163
|
Ce();
|
|
8108
8164
|
G();
|
|
8109
8165
|
Re();
|
|
8110
|
-
|
|
8166
|
+
$e();
|
|
8111
8167
|
Le();
|
|
8112
8168
|
St();
|
|
8113
|
-
|
|
8169
|
+
$t();
|
|
8114
8170
|
At();
|
|
8115
8171
|
Dt();
|
|
8116
8172
|
Ue();
|
|
8117
|
-
|
|
8118
|
-
|
|
8173
|
+
Gt();
|
|
8174
|
+
Jt();
|
|
8119
8175
|
Fe();
|
|
8120
|
-
((
|
|
8121
|
-
(
|
|
8176
|
+
((_a = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
|
|
8177
|
+
(Qt = {
|
|
8122
8178
|
video: 'generate_video',
|
|
8123
8179
|
image: 'generate_image',
|
|
8124
8180
|
audio: 'generate_audio',
|
|
8125
8181
|
llm: 'run_task',
|
|
8126
8182
|
}),
|
|
8127
|
-
(
|
|
8183
|
+
(Pa = {
|
|
8128
8184
|
video: 'Text-to-Video',
|
|
8129
8185
|
image: 'Text-to-Image',
|
|
8130
8186
|
audio: 'Text-to-Audio',
|
|
@@ -8138,13 +8194,13 @@ var _i,
|
|
|
8138
8194
|
description:
|
|
8139
8195
|
'Runs the Creative mode checkpoint at its published price (+5%). The Acceptable Use Policy applies.',
|
|
8140
8196
|
}),
|
|
8141
|
-
(
|
|
8197
|
+
(Ta = {
|
|
8142
8198
|
name: 'creative_mode',
|
|
8143
8199
|
type: 'boolean',
|
|
8144
8200
|
default: !1,
|
|
8145
8201
|
description: `Not available yet on this model: ${ye}.`,
|
|
8146
8202
|
}),
|
|
8147
|
-
(
|
|
8203
|
+
(ti = {
|
|
8148
8204
|
name: 'priority',
|
|
8149
8205
|
type: 'boolean',
|
|
8150
8206
|
default: !1,
|
|
@@ -8162,7 +8218,7 @@ var _i,
|
|
|
8162
8218
|
'Fits a reference image whose aspect ratio (width / height) is outside 0.40-2.50 just inside it: a slight stretch, or the image on a blurred copy of itself, never cropped. Off: such an image is refused with a 422. First and last frames are never changed. Same price.',
|
|
8163
8219
|
}),
|
|
8164
8220
|
(be = new Set(['full_access', 'is_uncensored', 'unfiltered', 'verificationSignature'])));
|
|
8165
|
-
((
|
|
8221
|
+
((Ka = new Set([
|
|
8166
8222
|
'quality',
|
|
8167
8223
|
'bitrate_mode',
|
|
8168
8224
|
'draft',
|
|
@@ -8171,7 +8227,7 @@ var _i,
|
|
|
8171
8227
|
'draft_generation_id',
|
|
8172
8228
|
'pass_faces',
|
|
8173
8229
|
])),
|
|
8174
|
-
(
|
|
8230
|
+
(Sa = new Set([
|
|
8175
8231
|
'quality',
|
|
8176
8232
|
'bitrate_mode',
|
|
8177
8233
|
'draft',
|
|
@@ -8179,12 +8235,12 @@ var _i,
|
|
|
8179
8235
|
'draft_task_id',
|
|
8180
8236
|
'draft_generation_id',
|
|
8181
8237
|
])),
|
|
8182
|
-
(
|
|
8238
|
+
(Ca = {
|
|
8183
8239
|
images: 'up to 10',
|
|
8184
8240
|
videos: 'up to 5; combined duration < 30s',
|
|
8185
8241
|
audios: 'up to 5; combined duration < 30s',
|
|
8186
8242
|
}));
|
|
8187
|
-
((
|
|
8243
|
+
((qa = [
|
|
8188
8244
|
C('The user message or task.'),
|
|
8189
8245
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
8190
8246
|
{
|
|
@@ -8202,7 +8258,7 @@ var _i,
|
|
|
8202
8258
|
{ name: 'temperature', type: 'slider', min: 0, max: 1, step: 0.1 },
|
|
8203
8259
|
{ name: 'top_p', type: 'slider', min: 0, max: 1, step: 0.05 },
|
|
8204
8260
|
]),
|
|
8205
|
-
(
|
|
8261
|
+
(Oa = [
|
|
8206
8262
|
C('The user message or task.'),
|
|
8207
8263
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
8208
8264
|
{
|
|
@@ -8284,8 +8340,8 @@ var _i,
|
|
|
8284
8340
|
description: 'Video frames read a second.',
|
|
8285
8341
|
},
|
|
8286
8342
|
]),
|
|
8287
|
-
(
|
|
8288
|
-
|
|
8343
|
+
(Ra = ['gemini-3.8-flash', 'gemini-3.7-flash']));
|
|
8344
|
+
Na = Object.entries({
|
|
8289
8345
|
background: !1,
|
|
8290
8346
|
skin: !1,
|
|
8291
8347
|
nose: !1,
|
|
@@ -8461,19 +8517,19 @@ var _i,
|
|
|
8461
8517
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
8462
8518
|
},
|
|
8463
8519
|
]),
|
|
8464
|
-
(
|
|
8520
|
+
(ai = {
|
|
8465
8521
|
name: 'images',
|
|
8466
8522
|
type: 'string[]',
|
|
8467
8523
|
description:
|
|
8468
8524
|
'Reference images as public http(s) URLs or data URIs (up to 9). The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.',
|
|
8469
8525
|
}),
|
|
8470
|
-
(
|
|
8526
|
+
(ri = {
|
|
8471
8527
|
name: 'audios',
|
|
8472
8528
|
type: 'string[]',
|
|
8473
8529
|
description:
|
|
8474
8530
|
'Reference audio as public http(s) URLs or data URIs (up to 3; each 2 to 15s, combined 15s or less). Needs at least one photo in images. A first or last frame sent with it is used only as a reference image, with mode multi_reference. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.',
|
|
8475
8531
|
}),
|
|
8476
|
-
(
|
|
8532
|
+
(Yt = [
|
|
8477
8533
|
{
|
|
8478
8534
|
name: 'prompt',
|
|
8479
8535
|
type: 'string',
|
|
@@ -8551,8 +8607,8 @@ var _i,
|
|
|
8551
8607
|
description:
|
|
8552
8608
|
'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
|
|
8553
8609
|
},
|
|
8554
|
-
|
|
8555
|
-
|
|
8610
|
+
ai,
|
|
8611
|
+
ri,
|
|
8556
8612
|
{
|
|
8557
8613
|
name: 'first_frame_image',
|
|
8558
8614
|
type: 'string',
|
|
@@ -8573,7 +8629,7 @@ var _i,
|
|
|
8573
8629
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
8574
8630
|
},
|
|
8575
8631
|
]),
|
|
8576
|
-
(
|
|
8632
|
+
(ja = [
|
|
8577
8633
|
{
|
|
8578
8634
|
name: 'prompt',
|
|
8579
8635
|
type: 'string',
|
|
@@ -8628,8 +8684,8 @@ var _i,
|
|
|
8628
8684
|
description:
|
|
8629
8685
|
'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
|
|
8630
8686
|
},
|
|
8631
|
-
|
|
8632
|
-
|
|
8687
|
+
ai,
|
|
8688
|
+
ri,
|
|
8633
8689
|
{
|
|
8634
8690
|
name: 'first_frame_image',
|
|
8635
8691
|
type: 'string',
|
|
@@ -8644,29 +8700,29 @@ var _i,
|
|
|
8644
8700
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
8645
8701
|
},
|
|
8646
8702
|
]));
|
|
8647
|
-
ke =
|
|
8648
|
-
|
|
8703
|
+
ke = Ha();
|
|
8704
|
+
Ja = ['draft_task_id', 'draft_generation_id'];
|
|
8649
8705
|
});
|
|
8650
8706
|
function xe(e) {
|
|
8651
8707
|
let t = '/v1/pricing/models',
|
|
8652
|
-
|
|
8653
|
-
return
|
|
8708
|
+
i = e?.trim();
|
|
8709
|
+
return i ? `${t}?model=${encodeURIComponent(i)}` : t;
|
|
8654
8710
|
}
|
|
8655
8711
|
var et = h(() => {
|
|
8656
8712
|
'use strict';
|
|
8657
8713
|
});
|
|
8658
|
-
function
|
|
8714
|
+
function Pi(e) {
|
|
8659
8715
|
return e.length <= 1 ? (e[0] ?? '') : `${e.slice(0, -1).join(', ')} and ${e[e.length - 1]}`;
|
|
8660
8716
|
}
|
|
8661
|
-
function
|
|
8717
|
+
function Ii(e) {
|
|
8662
8718
|
let t = ue().filter((s) => s.kind === e && s.unfiltered != null),
|
|
8663
|
-
|
|
8664
|
-
|
|
8719
|
+
i = t.filter((s) => X.includes(s.api.model)).map((s) => s.name),
|
|
8720
|
+
a = t.filter((s) => !X.includes(s.api.model)).map((s) => s.name);
|
|
8665
8721
|
return [
|
|
8666
|
-
...(
|
|
8667
|
-
? [`${
|
|
8722
|
+
...(i.length
|
|
8723
|
+
? [`${Pi(i)}: runs the Creative mode checkpoint at its published price (+5%).`]
|
|
8668
8724
|
: []),
|
|
8669
|
-
...(
|
|
8725
|
+
...(a.length ? [`Not available yet on ${Pi(a)}: ${ye}.`] : []),
|
|
8670
8726
|
'The Acceptable Use Policy applies.',
|
|
8671
8727
|
].join(' ');
|
|
8672
8728
|
}
|
|
@@ -8680,15 +8736,15 @@ function Ir(e) {
|
|
|
8680
8736
|
function vr(e) {
|
|
8681
8737
|
let t = e.inputSchema.properties;
|
|
8682
8738
|
if (!t) return e;
|
|
8683
|
-
let
|
|
8684
|
-
|
|
8739
|
+
let i = !1,
|
|
8740
|
+
a = {};
|
|
8685
8741
|
for (let [n, s] of Object.entries(t))
|
|
8686
|
-
|
|
8687
|
-
? ((
|
|
8688
|
-
:
|
|
8689
|
-
? ((
|
|
8690
|
-
: (
|
|
8691
|
-
return
|
|
8742
|
+
vi.has(n) && s.type === 'string' && !s.format
|
|
8743
|
+
? ((a[n] = { ...s, format: 'uri' }), (i = !0))
|
|
8744
|
+
: vi.has(n) && s.type === 'array' && s.items?.type === 'string' && !s.items.format
|
|
8745
|
+
? ((a[n] = { ...s, items: { ...s.items, format: 'uri' } }), (i = !0))
|
|
8746
|
+
: (a[n] = s);
|
|
8747
|
+
return i ? { ...e, inputSchema: { ...e.inputSchema, properties: a } } : e;
|
|
8692
8748
|
}
|
|
8693
8749
|
function Tr(e) {
|
|
8694
8750
|
switch (e.type) {
|
|
@@ -8746,18 +8802,18 @@ function Tr(e) {
|
|
|
8746
8802
|
}
|
|
8747
8803
|
}
|
|
8748
8804
|
function Mr(e, t) {
|
|
8749
|
-
let
|
|
8750
|
-
|
|
8805
|
+
let i = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
|
|
8806
|
+
a = {},
|
|
8751
8807
|
n = [];
|
|
8752
|
-
for (let o of e.parameters) ((
|
|
8808
|
+
for (let o of e.parameters) ((a[o.name] = Tr(o)), o.required && n.push(o.name));
|
|
8753
8809
|
let s = {
|
|
8754
8810
|
type: 'object',
|
|
8755
|
-
properties:
|
|
8811
|
+
properties: a,
|
|
8756
8812
|
...(n.length > 0 ? { required: n } : {}),
|
|
8757
8813
|
additionalProperties: !0,
|
|
8758
8814
|
};
|
|
8759
8815
|
return {
|
|
8760
|
-
name:
|
|
8816
|
+
name: i,
|
|
8761
8817
|
description: `[Tein AI - ${e.name} (${e.category})] ${e.description} (Pricing: ${e.priceFormatted})`,
|
|
8762
8818
|
inputSchema: s,
|
|
8763
8819
|
};
|
|
@@ -8765,8 +8821,8 @@ function Mr(e, t) {
|
|
|
8765
8821
|
function Kr() {
|
|
8766
8822
|
let e = D().filter((d) => d.category === 'Image' && !we(d)),
|
|
8767
8823
|
t = D().filter((d) => d.category === 'Video'),
|
|
8768
|
-
|
|
8769
|
-
|
|
8824
|
+
i = D().filter((d) => d.category === 'Text'),
|
|
8825
|
+
a = D().filter((d) => d.category === 'Audio'),
|
|
8770
8826
|
n = {
|
|
8771
8827
|
name: 'generate_image',
|
|
8772
8828
|
description:
|
|
@@ -8853,7 +8909,7 @@ function Kr() {
|
|
|
8853
8909
|
maximum: 2147483647,
|
|
8854
8910
|
description: 'Nano Banana 2 and Nano Banana Pro. Omit it for a new image each time.',
|
|
8855
8911
|
},
|
|
8856
|
-
creative_mode: { type: 'boolean', description:
|
|
8912
|
+
creative_mode: { type: 'boolean', description: Ii('image') },
|
|
8857
8913
|
},
|
|
8858
8914
|
required: ['prompt'],
|
|
8859
8915
|
additionalProperties: !0,
|
|
@@ -8890,7 +8946,7 @@ function Kr() {
|
|
|
8890
8946
|
description:
|
|
8891
8947
|
"Video resolution, where the model takes it (see each model tool). Left out: the model's own default, its lowest price.",
|
|
8892
8948
|
},
|
|
8893
|
-
creative_mode: { type: 'boolean', description:
|
|
8949
|
+
creative_mode: { type: 'boolean', description: Ii('video') },
|
|
8894
8950
|
priority: {
|
|
8895
8951
|
type: 'boolean',
|
|
8896
8952
|
description:
|
|
@@ -8956,7 +9012,7 @@ function Kr() {
|
|
|
8956
9012
|
prompt: { type: 'string', description: 'The reasoning task or query to execute.' },
|
|
8957
9013
|
model: {
|
|
8958
9014
|
type: 'string',
|
|
8959
|
-
enum:
|
|
9015
|
+
enum: i.map((d) => d.slug),
|
|
8960
9016
|
default: 'gpt-6-astra',
|
|
8961
9017
|
description: 'The reasoning model to use (default: gpt-6-astra).',
|
|
8962
9018
|
},
|
|
@@ -9027,7 +9083,7 @@ function Kr() {
|
|
|
9027
9083
|
},
|
|
9028
9084
|
},
|
|
9029
9085
|
p = Sr();
|
|
9030
|
-
return [n, s, o, u, l, p, c, wr, ...
|
|
9086
|
+
return [n, s, o, u, l, p, c, wr, ...Ti];
|
|
9031
9087
|
}
|
|
9032
9088
|
function Sr() {
|
|
9033
9089
|
return {
|
|
@@ -9078,7 +9134,7 @@ function Sr() {
|
|
|
9078
9134
|
}
|
|
9079
9135
|
function st() {
|
|
9080
9136
|
let e = Kr(),
|
|
9081
|
-
t = D().map((
|
|
9137
|
+
t = D().map((i) => Mr(i));
|
|
9082
9138
|
return [...e, ...t].map(Ir).map(vr);
|
|
9083
9139
|
}
|
|
9084
9140
|
var br,
|
|
@@ -9087,10 +9143,10 @@ var br,
|
|
|
9087
9143
|
xr,
|
|
9088
9144
|
_r,
|
|
9089
9145
|
Pr,
|
|
9090
|
-
|
|
9146
|
+
Ti,
|
|
9091
9147
|
Cs,
|
|
9092
|
-
|
|
9093
|
-
|
|
9148
|
+
vi,
|
|
9149
|
+
Mi = h(() => {
|
|
9094
9150
|
'use strict';
|
|
9095
9151
|
G();
|
|
9096
9152
|
Fe();
|
|
@@ -9181,9 +9237,9 @@ var br,
|
|
|
9181
9237
|
additionalProperties: !1,
|
|
9182
9238
|
},
|
|
9183
9239
|
}),
|
|
9184
|
-
(
|
|
9185
|
-
(Cs = new Set(
|
|
9186
|
-
|
|
9240
|
+
(Ti = [xr, _r, Pr]),
|
|
9241
|
+
(Cs = new Set(Ti.map((e) => e.name))));
|
|
9242
|
+
vi = new Set([
|
|
9187
9243
|
'image',
|
|
9188
9244
|
'images',
|
|
9189
9245
|
'image_url',
|
|
@@ -9200,30 +9256,30 @@ var br,
|
|
|
9200
9256
|
'lipsyncing_audio',
|
|
9201
9257
|
]);
|
|
9202
9258
|
});
|
|
9203
|
-
var
|
|
9204
|
-
|
|
9259
|
+
var Li = {};
|
|
9260
|
+
Gi(Li, {
|
|
9205
9261
|
forgetToolSchemas: () => qr,
|
|
9206
|
-
jsonRpcAnswer: () =>
|
|
9207
|
-
preprocessLocalFiles: () =>
|
|
9208
|
-
startStdioServer: () =>
|
|
9262
|
+
jsonRpcAnswer: () => $i,
|
|
9263
|
+
preprocessLocalFiles: () => Oi,
|
|
9264
|
+
startStdioServer: () => Ri,
|
|
9209
9265
|
});
|
|
9210
9266
|
function Cr(e) {
|
|
9211
|
-
let t = (
|
|
9212
|
-
!!
|
|
9267
|
+
let t = (i) =>
|
|
9268
|
+
!!i && typeof i == 'object' && i.jsonrpc === '2.0' && ('result' in i || 'error' in i);
|
|
9213
9269
|
return Array.isArray(e) ? e.length > 0 && e.every(t) : t(e);
|
|
9214
9270
|
}
|
|
9215
|
-
function
|
|
9216
|
-
let
|
|
9217
|
-
n =
|
|
9271
|
+
function $i(e, t, i) {
|
|
9272
|
+
let a = e?.id,
|
|
9273
|
+
n = a == null,
|
|
9218
9274
|
s = null;
|
|
9219
9275
|
try {
|
|
9220
|
-
s =
|
|
9276
|
+
s = i ? JSON.parse(i) : null;
|
|
9221
9277
|
} catch {
|
|
9222
9278
|
s = null;
|
|
9223
9279
|
}
|
|
9224
9280
|
if (s !== null && Cr(s)) return n ? null : s;
|
|
9225
9281
|
if (n) return null;
|
|
9226
|
-
if (!
|
|
9282
|
+
if (!i && t >= 200 && t < 300) return;
|
|
9227
9283
|
let o = s?.error,
|
|
9228
9284
|
u =
|
|
9229
9285
|
typeof o == 'string'
|
|
@@ -9234,7 +9290,7 @@ function Ca(e, t, a) {
|
|
|
9234
9290
|
l = o && typeof o == 'object' && typeof o.code == 'string' ? o.code : null;
|
|
9235
9291
|
return {
|
|
9236
9292
|
jsonrpc: '2.0',
|
|
9237
|
-
id:
|
|
9293
|
+
id: a,
|
|
9238
9294
|
error: {
|
|
9239
9295
|
code: t === 401 ? -32001 : -32603,
|
|
9240
9296
|
message: u,
|
|
@@ -9242,19 +9298,19 @@ function Ca(e, t, a) {
|
|
|
9242
9298
|
},
|
|
9243
9299
|
};
|
|
9244
9300
|
}
|
|
9245
|
-
function
|
|
9301
|
+
function $r() {
|
|
9246
9302
|
let e = process.argv.slice(2),
|
|
9247
9303
|
t = e.indexOf('--api-key');
|
|
9248
9304
|
return S(t >= 0 ? e[t + 1] : void 0);
|
|
9249
9305
|
}
|
|
9250
|
-
async function
|
|
9251
|
-
let
|
|
9252
|
-
if (!V.default.existsSync(
|
|
9306
|
+
async function Ei(e, t, i) {
|
|
9307
|
+
let a = z.default.resolve(e);
|
|
9308
|
+
if (!V.default.existsSync(a) || !V.default.statSync(a).isFile())
|
|
9253
9309
|
throw new Error(`File not found: ${e}`);
|
|
9254
|
-
let n = V.default.readFileSync(
|
|
9310
|
+
let n = V.default.readFileSync(a),
|
|
9255
9311
|
s = n.toString('base64'),
|
|
9256
9312
|
o = n.length,
|
|
9257
|
-
u = `${
|
|
9313
|
+
u = `${i.replace(/\/$/, '')}/v1/upload`,
|
|
9258
9314
|
l = await fetch(u, {
|
|
9259
9315
|
method: 'POST',
|
|
9260
9316
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${t}` },
|
|
@@ -9276,10 +9332,10 @@ async function Ea(e, t, a) {
|
|
|
9276
9332
|
mimeType: c.mime_type || c.mimeType || 'image/png',
|
|
9277
9333
|
};
|
|
9278
9334
|
}
|
|
9279
|
-
function
|
|
9280
|
-
return
|
|
9335
|
+
function Ai(e) {
|
|
9336
|
+
return Er.has(z.default.extname(e).toLowerCase());
|
|
9281
9337
|
}
|
|
9282
|
-
function
|
|
9338
|
+
function qi(e) {
|
|
9283
9339
|
return new Error(
|
|
9284
9340
|
`Tein uploads image, video and audio files only, and ${z.default.basename(e)} is not one.`,
|
|
9285
9341
|
);
|
|
@@ -9294,27 +9350,27 @@ function Ar(e) {
|
|
|
9294
9350
|
`)
|
|
9295
9351
|
)
|
|
9296
9352
|
return null;
|
|
9297
|
-
let
|
|
9298
|
-
return V.default.existsSync(
|
|
9353
|
+
let i = z.default.resolve(t);
|
|
9354
|
+
return V.default.existsSync(i) && V.default.statSync(i).isFile() ? i : null;
|
|
9299
9355
|
}
|
|
9300
9356
|
function lt(e) {
|
|
9301
9357
|
if (Array.isArray(e))
|
|
9302
9358
|
for (let t of e) {
|
|
9303
|
-
let
|
|
9304
|
-
typeof
|
|
9305
|
-
|
|
9306
|
-
typeof
|
|
9307
|
-
|
|
9359
|
+
let i = t;
|
|
9360
|
+
typeof i.name == 'string' &&
|
|
9361
|
+
i.inputSchema &&
|
|
9362
|
+
typeof i.inputSchema == 'object' &&
|
|
9363
|
+
ae.set(i.name, i.inputSchema);
|
|
9308
9364
|
}
|
|
9309
9365
|
}
|
|
9310
9366
|
function qr() {
|
|
9311
|
-
(
|
|
9367
|
+
(ae.clear(), (ot = 0));
|
|
9312
9368
|
}
|
|
9313
9369
|
async function Or(e, t) {
|
|
9314
9370
|
if (!(Date.now() - ot < 6e4)) {
|
|
9315
9371
|
ot = Date.now();
|
|
9316
9372
|
try {
|
|
9317
|
-
let
|
|
9373
|
+
let a = await (
|
|
9318
9374
|
await fetch(e, {
|
|
9319
9375
|
method: 'POST',
|
|
9320
9376
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${t}` },
|
|
@@ -9322,7 +9378,7 @@ async function Or(e, t) {
|
|
|
9322
9378
|
signal: AbortSignal.timeout(1e4),
|
|
9323
9379
|
})
|
|
9324
9380
|
).json();
|
|
9325
|
-
lt(
|
|
9381
|
+
lt(a.result?.tools);
|
|
9326
9382
|
} catch {}
|
|
9327
9383
|
}
|
|
9328
9384
|
}
|
|
@@ -9333,25 +9389,25 @@ function Rr(e) {
|
|
|
9333
9389
|
: e.type === 'array' && e.items?.format === 'uri'
|
|
9334
9390
|
: !1;
|
|
9335
9391
|
}
|
|
9336
|
-
async function
|
|
9392
|
+
async function Ki(e, t, i) {
|
|
9337
9393
|
if (typeof e != 'string') return e;
|
|
9338
|
-
let
|
|
9339
|
-
if (!
|
|
9340
|
-
if (
|
|
9341
|
-
return (await
|
|
9342
|
-
}
|
|
9343
|
-
async function
|
|
9344
|
-
(
|
|
9345
|
-
let s =
|
|
9394
|
+
let a = Ar(e);
|
|
9395
|
+
if (!a) return e;
|
|
9396
|
+
if (!Ai(a)) throw qi(a);
|
|
9397
|
+
return (await Ei(a, t, i)).url;
|
|
9398
|
+
}
|
|
9399
|
+
async function Oi(e, t, i, a, n) {
|
|
9400
|
+
(ae.size === 0 && lt(st()), ae.has(e) || (await Or(n, i)));
|
|
9401
|
+
let s = ae.get(e)?.properties;
|
|
9346
9402
|
if (!s) return t;
|
|
9347
9403
|
let o = { ...t };
|
|
9348
9404
|
for (let [u, l] of Object.entries(t))
|
|
9349
9405
|
if (Rr(s[u]))
|
|
9350
9406
|
if (Array.isArray(l)) {
|
|
9351
9407
|
let c = [];
|
|
9352
|
-
for (let p of l) c.push(await
|
|
9408
|
+
for (let p of l) c.push(await Ki(p, i, a));
|
|
9353
9409
|
o[u] = c;
|
|
9354
|
-
} else o[u] = await
|
|
9410
|
+
} else o[u] = await Ki(l, i, a);
|
|
9355
9411
|
return o;
|
|
9356
9412
|
}
|
|
9357
9413
|
function Lr(e) {
|
|
@@ -9395,13 +9451,13 @@ function Lr(e) {
|
|
|
9395
9451
|
};
|
|
9396
9452
|
}
|
|
9397
9453
|
}
|
|
9398
|
-
async function
|
|
9399
|
-
if (
|
|
9400
|
-
|
|
9401
|
-
let e =
|
|
9454
|
+
async function Ri() {
|
|
9455
|
+
if (Si) return;
|
|
9456
|
+
Si = !0;
|
|
9457
|
+
let e = $r(),
|
|
9402
9458
|
t = w(),
|
|
9403
|
-
|
|
9404
|
-
(
|
|
9459
|
+
i = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
|
|
9460
|
+
(Ci.default
|
|
9405
9461
|
.createInterface({ input: process.stdin, output: process.stdout, terminal: !1 })
|
|
9406
9462
|
.on('line', async (n) => {
|
|
9407
9463
|
let s = n.trim();
|
|
@@ -9462,8 +9518,8 @@ async function Oa() {
|
|
|
9462
9518
|
try {
|
|
9463
9519
|
let d = z.default.resolve(p.trim());
|
|
9464
9520
|
if (V.default.existsSync(d) && V.default.statSync(d).isFile() && e) {
|
|
9465
|
-
if (
|
|
9466
|
-
let m = await
|
|
9521
|
+
if (!Ai(d)) throw qi(d);
|
|
9522
|
+
let m = await Ei(d, e, t),
|
|
9467
9523
|
y = (m.sizeBytes / 1024).toFixed(1),
|
|
9468
9524
|
_e =
|
|
9469
9525
|
m.mimeType.startsWith('image/') ||
|
|
@@ -9519,7 +9575,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9519
9575
|
}
|
|
9520
9576
|
if (e)
|
|
9521
9577
|
try {
|
|
9522
|
-
o.params.arguments = await
|
|
9578
|
+
o.params.arguments = await Oi(String(l), c, e, t, i);
|
|
9523
9579
|
} catch (p) {
|
|
9524
9580
|
let d = p instanceof Error ? p.message : String(p);
|
|
9525
9581
|
process.stdout.write(
|
|
@@ -9544,13 +9600,13 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9544
9600
|
}
|
|
9545
9601
|
if (e)
|
|
9546
9602
|
try {
|
|
9547
|
-
let l = await fetch(
|
|
9603
|
+
let l = await fetch(i, {
|
|
9548
9604
|
method: 'POST',
|
|
9549
9605
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${e}` },
|
|
9550
9606
|
body: JSON.stringify(o),
|
|
9551
9607
|
}),
|
|
9552
9608
|
c = await l.text(),
|
|
9553
|
-
p =
|
|
9609
|
+
p = $i(o, l.status, c);
|
|
9554
9610
|
if (p === null) return;
|
|
9555
9611
|
if (p) {
|
|
9556
9612
|
(o?.method === 'tools/list' && lt(p.result?.tools),
|
|
@@ -9587,21 +9643,21 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9587
9643
|
}
|
|
9588
9644
|
var V,
|
|
9589
9645
|
z,
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9646
|
+
Ci,
|
|
9647
|
+
Er,
|
|
9648
|
+
ae,
|
|
9593
9649
|
ot,
|
|
9594
|
-
|
|
9595
|
-
|
|
9650
|
+
Si,
|
|
9651
|
+
Di = h(() => {
|
|
9596
9652
|
'use strict';
|
|
9597
9653
|
((V = T(require('node:fs'))),
|
|
9598
9654
|
(z = T(require('node:path'))),
|
|
9599
|
-
(
|
|
9655
|
+
(Ci = T(require('node:readline'))));
|
|
9600
9656
|
et();
|
|
9601
|
-
|
|
9602
|
-
|
|
9657
|
+
Mi();
|
|
9658
|
+
E();
|
|
9603
9659
|
re();
|
|
9604
|
-
|
|
9660
|
+
Er = new Set([
|
|
9605
9661
|
'.png',
|
|
9606
9662
|
'.jpg',
|
|
9607
9663
|
'.jpeg',
|
|
@@ -9627,20 +9683,20 @@ var V,
|
|
|
9627
9683
|
'.flac',
|
|
9628
9684
|
'.opus',
|
|
9629
9685
|
]);
|
|
9630
|
-
((
|
|
9631
|
-
|
|
9686
|
+
((ae = new Map()), (ot = 0));
|
|
9687
|
+
Si = !1;
|
|
9632
9688
|
require.main === module &&
|
|
9633
|
-
|
|
9689
|
+
Ri().catch((e) => {
|
|
9634
9690
|
(process.stderr.write(`Fatal error in Tein MCP CLI: ${e}
|
|
9635
9691
|
`),
|
|
9636
9692
|
process.exit(1));
|
|
9637
9693
|
});
|
|
9638
9694
|
});
|
|
9639
|
-
var
|
|
9695
|
+
var zi =
|
|
9640
9696
|
!process.env.NO_COLOR &&
|
|
9641
9697
|
(process.stdout.isTTY || process.env.FORCE_COLOR === '1' || process.env.TERM !== 'dumb');
|
|
9642
9698
|
function x(e, t) {
|
|
9643
|
-
return (
|
|
9699
|
+
return (i) => (zi ? `\x1B[${e}m${i}\x1B[${t}m` : String(i));
|
|
9644
9700
|
}
|
|
9645
9701
|
var r = {
|
|
9646
9702
|
bold: x(1, 22),
|
|
@@ -9662,7 +9718,7 @@ var r = {
|
|
|
9662
9718
|
bgCyan: x(46, 49),
|
|
9663
9719
|
bgGreen: x(42, 49),
|
|
9664
9720
|
},
|
|
9665
|
-
|
|
9721
|
+
$ = class {
|
|
9666
9722
|
constructor(t = '') {
|
|
9667
9723
|
this.frames = [
|
|
9668
9724
|
'\u280B',
|
|
@@ -9686,8 +9742,8 @@ var r = {
|
|
|
9686
9742
|
process.stdout.isTTY
|
|
9687
9743
|
? (this.stop(),
|
|
9688
9744
|
(this.timer = setInterval(() => {
|
|
9689
|
-
let
|
|
9690
|
-
(process.stdout.write(`\r${
|
|
9745
|
+
let i = r.cyan(this.frames[this.current]);
|
|
9746
|
+
(process.stdout.write(`\r${i} ${this.text} `),
|
|
9691
9747
|
(this.current = (this.current + 1) % this.frames.length));
|
|
9692
9748
|
}, 80)),
|
|
9693
9749
|
this)
|
|
@@ -9701,20 +9757,20 @@ var r = {
|
|
|
9701
9757
|
}
|
|
9702
9758
|
succeed(t) {
|
|
9703
9759
|
this.stop();
|
|
9704
|
-
let
|
|
9760
|
+
let i = t || this.text;
|
|
9705
9761
|
process.stdout.isTTY
|
|
9706
|
-
? process.stdout.write(`\r${r.green('\u2713')} ${
|
|
9762
|
+
? process.stdout.write(`\r${r.green('\u2713')} ${i}
|
|
9707
9763
|
`)
|
|
9708
|
-
: process.stdout.write(`[\u2713] ${
|
|
9764
|
+
: process.stdout.write(`[\u2713] ${i}
|
|
9709
9765
|
`);
|
|
9710
9766
|
}
|
|
9711
9767
|
fail(t) {
|
|
9712
9768
|
this.stop();
|
|
9713
|
-
let
|
|
9769
|
+
let i = t || this.text;
|
|
9714
9770
|
process.stdout.isTTY
|
|
9715
|
-
? process.stdout.write(`\r${r.red('\u2717')} ${
|
|
9771
|
+
? process.stdout.write(`\r${r.red('\u2717')} ${i}
|
|
9716
9772
|
`)
|
|
9717
|
-
: process.stdout.write(`[\u2717] ${
|
|
9773
|
+
: process.stdout.write(`[\u2717] ${i}
|
|
9718
9774
|
`);
|
|
9719
9775
|
}
|
|
9720
9776
|
stop() {
|
|
@@ -9730,7 +9786,7 @@ var ne = T(require('node:fs')),
|
|
|
9730
9786
|
mt = T(require('node:path')),
|
|
9731
9787
|
ft = require('node:stream/promises');
|
|
9732
9788
|
re();
|
|
9733
|
-
var
|
|
9789
|
+
var Xi = new Set([
|
|
9734
9790
|
'account_suspended',
|
|
9735
9791
|
'account_terminated',
|
|
9736
9792
|
'creative_mode_restricted',
|
|
@@ -9738,30 +9794,30 @@ var Ya = new Set([
|
|
|
9738
9794
|
'workspace_paused',
|
|
9739
9795
|
]),
|
|
9740
9796
|
v = 1,
|
|
9741
|
-
|
|
9797
|
+
Qi = 3,
|
|
9742
9798
|
b = class extends Error {
|
|
9743
|
-
constructor(t,
|
|
9744
|
-
(super(
|
|
9799
|
+
constructor(t, i, a, n = {}) {
|
|
9800
|
+
(super(i),
|
|
9745
9801
|
(this.name = 'TeinApiError'),
|
|
9746
9802
|
(this.status = t),
|
|
9747
|
-
|
|
9803
|
+
a && (this.code = a),
|
|
9748
9804
|
(this.fields = n));
|
|
9749
9805
|
}
|
|
9750
9806
|
get exitCode() {
|
|
9751
|
-
return this.code &&
|
|
9807
|
+
return this.code && Xi.has(this.code) ? Qi : v;
|
|
9752
9808
|
}
|
|
9753
9809
|
};
|
|
9754
|
-
function
|
|
9755
|
-
let
|
|
9756
|
-
if (!
|
|
9757
|
-
let n =
|
|
9810
|
+
function Zi(e, t, i) {
|
|
9811
|
+
let a = `HTTP ${e}${t ? ` ${t}` : ''}`;
|
|
9812
|
+
if (!i || typeof i != 'object') return new b(e, a);
|
|
9813
|
+
let n = i;
|
|
9758
9814
|
if (n.error && typeof n.error == 'object' && !Array.isArray(n.error)) {
|
|
9759
9815
|
let p = n.error,
|
|
9760
9816
|
{ code: d, message: m, ...y } = p;
|
|
9761
|
-
return new b(e, typeof m == 'string' && m ? m :
|
|
9817
|
+
return new b(e, typeof m == 'string' && m ? m : a, typeof d == 'string' ? d : void 0, y);
|
|
9762
9818
|
}
|
|
9763
9819
|
let { error: s, code: o, message: u, ...l } = n,
|
|
9764
|
-
c = (typeof s == 'string' && s) || (typeof u == 'string' && u) ||
|
|
9820
|
+
c = (typeof s == 'string' && s) || (typeof u == 'string' && u) || a;
|
|
9765
9821
|
return new b(e, c, typeof o == 'string' ? o : void 0, l);
|
|
9766
9822
|
}
|
|
9767
9823
|
function ct(e) {
|
|
@@ -9769,16 +9825,16 @@ function ct(e) {
|
|
|
9769
9825
|
}
|
|
9770
9826
|
function K(e) {
|
|
9771
9827
|
let t = [e.message],
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
(
|
|
9775
|
-
t.push([
|
|
9828
|
+
i = ct(e.fields.required),
|
|
9829
|
+
a = ct(e.fields.balance);
|
|
9830
|
+
(i || a) &&
|
|
9831
|
+
t.push([i ? `Required: ${i}` : '', a ? `Balance: ${a}` : ''].filter(Boolean).join(' '));
|
|
9776
9832
|
let n = e.fields.org_name ?? e.fields.orgName;
|
|
9777
9833
|
typeof n == 'string' && n && t.push(`Workspace: ${n}`);
|
|
9778
9834
|
let s = e.fields.url ?? e.fields.appeal_url ?? e.fields.top_up_url;
|
|
9779
9835
|
return (typeof s == 'string' && s && t.push(s), e.code && t.push(`(${e.code})`), t);
|
|
9780
9836
|
}
|
|
9781
|
-
function
|
|
9837
|
+
function ea(e) {
|
|
9782
9838
|
return /\.(mp4|webm|mov)(\?|$)/i.test(e)
|
|
9783
9839
|
? 'video'
|
|
9784
9840
|
: /\.(mp3|wav|ogg|flac)(\?|$)/i.test(e)
|
|
@@ -9787,15 +9843,15 @@ function Za(e) {
|
|
|
9787
9843
|
}
|
|
9788
9844
|
function ut(e) {
|
|
9789
9845
|
let t = [];
|
|
9790
|
-
for (let
|
|
9791
|
-
typeof
|
|
9792
|
-
? t.push({ type: 'text', text:
|
|
9793
|
-
:
|
|
9846
|
+
for (let i of e.data ?? [])
|
|
9847
|
+
typeof i.message?.content == 'string'
|
|
9848
|
+
? t.push({ type: 'text', text: i.message.content })
|
|
9849
|
+
: i.url && t.push({ type: ea(i.url), url: i.url, ...(i.layer ? { layer: i.layer } : {}) });
|
|
9794
9850
|
return t;
|
|
9795
9851
|
}
|
|
9796
9852
|
var M = class {
|
|
9797
|
-
constructor(t,
|
|
9798
|
-
((this.apiKey = t), (this.baseUrl =
|
|
9853
|
+
constructor(t, i) {
|
|
9854
|
+
((this.apiKey = t), (this.baseUrl = i.replace(/\/+$/, '')));
|
|
9799
9855
|
}
|
|
9800
9856
|
getHeaders() {
|
|
9801
9857
|
return {
|
|
@@ -9805,58 +9861,58 @@ var M = class {
|
|
|
9805
9861
|
'X-Tein-Client': 'cli',
|
|
9806
9862
|
};
|
|
9807
9863
|
}
|
|
9808
|
-
async send(t,
|
|
9809
|
-
let n = await fetch(`${this.baseUrl}${
|
|
9864
|
+
async send(t, i, a) {
|
|
9865
|
+
let n = await fetch(`${this.baseUrl}${i}`, {
|
|
9810
9866
|
method: t,
|
|
9811
9867
|
headers: this.getHeaders(),
|
|
9812
|
-
...(
|
|
9868
|
+
...(a === void 0 ? {} : { body: JSON.stringify(a) }),
|
|
9813
9869
|
});
|
|
9814
9870
|
if (!n.ok) {
|
|
9815
9871
|
let s = null;
|
|
9816
9872
|
try {
|
|
9817
9873
|
s = await n.json();
|
|
9818
9874
|
} catch {}
|
|
9819
|
-
throw
|
|
9875
|
+
throw Zi(n.status, n.statusText, s);
|
|
9820
9876
|
}
|
|
9821
9877
|
return await n.json();
|
|
9822
9878
|
}
|
|
9823
9879
|
async checkKey() {
|
|
9824
9880
|
await this.send('GET', '/v1/jobs?limit=1');
|
|
9825
9881
|
}
|
|
9826
|
-
queueJob(t,
|
|
9827
|
-
return this.send('POST', '/v1/generate', { model: t, ...
|
|
9828
|
-
let n =
|
|
9882
|
+
queueJob(t, i) {
|
|
9883
|
+
return this.send('POST', '/v1/generate', { model: t, ...i }).then((a) => {
|
|
9884
|
+
let n = a.status,
|
|
9829
9885
|
s =
|
|
9830
9886
|
n === 'succeeded' || n === 'failed' || n === 'expired' || n === 'cancelled'
|
|
9831
9887
|
? n
|
|
9832
9888
|
: 'processing',
|
|
9833
|
-
o = ut(
|
|
9889
|
+
o = ut(a);
|
|
9834
9890
|
return {
|
|
9835
|
-
request_id:
|
|
9836
|
-
model:
|
|
9891
|
+
request_id: a.request_id || a.id || '',
|
|
9892
|
+
model: a.model,
|
|
9837
9893
|
status: s,
|
|
9838
9894
|
...(o.length ? { output: o } : {}),
|
|
9839
|
-
error:
|
|
9840
|
-
...(
|
|
9895
|
+
error: a.error && typeof a.error.message == 'string' ? a.error.message : null,
|
|
9896
|
+
...(a.usage ? { usage: a.usage } : {}),
|
|
9841
9897
|
};
|
|
9842
9898
|
});
|
|
9843
9899
|
}
|
|
9844
9900
|
getStatus(t) {
|
|
9845
|
-
return this.send('GET', `/v1/jobs/${encodeURIComponent(t)}`).then((
|
|
9846
|
-
let
|
|
9901
|
+
return this.send('GET', `/v1/jobs/${encodeURIComponent(t)}`).then((i) => {
|
|
9902
|
+
let a = i.status,
|
|
9847
9903
|
n =
|
|
9848
|
-
|
|
9849
|
-
?
|
|
9904
|
+
a === 'succeeded' || a === 'failed' || a === 'expired' || a === 'cancelled'
|
|
9905
|
+
? a
|
|
9850
9906
|
: 'processing',
|
|
9851
|
-
s = ut(
|
|
9852
|
-
o =
|
|
9907
|
+
s = ut(i),
|
|
9908
|
+
o = i.error && typeof i.error.message == 'string' ? i.error.message : null;
|
|
9853
9909
|
return {
|
|
9854
|
-
request_id:
|
|
9855
|
-
model:
|
|
9910
|
+
request_id: i.id || t,
|
|
9911
|
+
model: i.model,
|
|
9856
9912
|
status: n,
|
|
9857
9913
|
...(s.length ? { output: s } : {}),
|
|
9858
9914
|
error: o,
|
|
9859
|
-
...(
|
|
9915
|
+
...(i.usage ? { usage: i.usage } : {}),
|
|
9860
9916
|
};
|
|
9861
9917
|
});
|
|
9862
9918
|
}
|
|
@@ -9864,78 +9920,78 @@ var M = class {
|
|
|
9864
9920
|
return this.send('GET', '/v1/balance');
|
|
9865
9921
|
}
|
|
9866
9922
|
getUsage(t) {
|
|
9867
|
-
let
|
|
9868
|
-
return this.send('GET', `/v1/usage${
|
|
9923
|
+
let i = new URLSearchParams(t).toString();
|
|
9924
|
+
return this.send('GET', `/v1/usage${i ? `?${i}` : ''}`);
|
|
9869
9925
|
}
|
|
9870
9926
|
getTransactions(t) {
|
|
9871
|
-
let
|
|
9872
|
-
return this.send('GET', `/v1/balance/transactions${
|
|
9927
|
+
let i = new URLSearchParams(t).toString();
|
|
9928
|
+
return this.send('GET', `/v1/balance/transactions${i ? `?${i}` : ''}`);
|
|
9873
9929
|
}
|
|
9874
9930
|
uploadAsset(t) {
|
|
9875
9931
|
return this.send('POST', '/v1/upload', { data: t });
|
|
9876
9932
|
}
|
|
9877
|
-
async downloadOutput(t,
|
|
9878
|
-
let
|
|
9879
|
-
if (!
|
|
9880
|
-
let n = mt.default.dirname(
|
|
9933
|
+
async downloadOutput(t, i) {
|
|
9934
|
+
let a = await fetch(t);
|
|
9935
|
+
if (!a.ok) throw new Error(`The file could not be downloaded (HTTP ${a.status})`);
|
|
9936
|
+
let n = mt.default.dirname(i);
|
|
9881
9937
|
ne.default.existsSync(n) || ne.default.mkdirSync(n, { recursive: !0 });
|
|
9882
|
-
let s = ne.default.createWriteStream(
|
|
9883
|
-
return (await (0, ft.pipeline)(
|
|
9938
|
+
let s = ne.default.createWriteStream(i);
|
|
9939
|
+
return (await (0, ft.pipeline)(a.body, s), i);
|
|
9884
9940
|
}
|
|
9885
9941
|
};
|
|
9886
|
-
|
|
9942
|
+
E();
|
|
9887
9943
|
function Se(e) {
|
|
9888
9944
|
if (typeof e != 'number' || !Number.isFinite(e)) return '';
|
|
9889
9945
|
if (Math.abs(e) >= 1 || Math.abs(Number(e.toFixed(4)) - e) < 1e-12) return `$${e.toFixed(4)}`;
|
|
9890
9946
|
let t = Math.max(0, 3 - Number(e.toExponential(3).split('e')[1])),
|
|
9891
|
-
|
|
9892
|
-
|
|
9893
|
-
return
|
|
9947
|
+
i = 10 ** t,
|
|
9948
|
+
a = Math.round(Number((e * i).toFixed(6))) / i;
|
|
9949
|
+
return a >= 1 ? `$${a.toFixed(4)}` : `$${a.toFixed(t).replace(/0+$/, '')}`;
|
|
9894
9950
|
}
|
|
9895
9951
|
ee();
|
|
9896
|
-
var
|
|
9897
|
-
function
|
|
9898
|
-
for (let t of
|
|
9952
|
+
var si = ['images', 'input_images', 'videos', 'audios'];
|
|
9953
|
+
function Wa(e) {
|
|
9954
|
+
for (let t of si) typeof e[t] == 'string' && (e[t] = [e[t]]);
|
|
9899
9955
|
}
|
|
9900
|
-
function
|
|
9956
|
+
function Ya(e) {
|
|
9901
9957
|
if (e.startsWith('http://') || e.startsWith('https://')) return null;
|
|
9902
9958
|
let t = q.default.resolve(e);
|
|
9903
9959
|
return U.default.existsSync(t) && U.default.statSync(t).isFile() ? t : null;
|
|
9904
9960
|
}
|
|
9905
|
-
async function
|
|
9906
|
-
for (let
|
|
9907
|
-
if (!Array.isArray(e[
|
|
9908
|
-
let
|
|
9909
|
-
for (let n of e[
|
|
9961
|
+
async function Xa(e, t) {
|
|
9962
|
+
for (let i of si) {
|
|
9963
|
+
if (!Array.isArray(e[i])) continue;
|
|
9964
|
+
let a = [];
|
|
9965
|
+
for (let n of e[i]) {
|
|
9910
9966
|
if (typeof n != 'string') continue;
|
|
9911
|
-
let s =
|
|
9912
|
-
|
|
9967
|
+
let s = Ya(n);
|
|
9968
|
+
a.push(s ? await t(s) : n);
|
|
9913
9969
|
}
|
|
9914
|
-
e[
|
|
9970
|
+
e[i] = a;
|
|
9915
9971
|
}
|
|
9916
9972
|
}
|
|
9917
9973
|
var te = { starter: 10, plus: 25, scale: 40, enterprise: 200 };
|
|
9918
|
-
function
|
|
9974
|
+
function Qa(e) {
|
|
9919
9975
|
if (e.count === void 0 || e.count === !0) return 1;
|
|
9920
9976
|
let t = typeof e.count == 'number' ? e.count : Number(e.count),
|
|
9921
|
-
|
|
9977
|
+
i = te.enterprise;
|
|
9922
9978
|
return (
|
|
9923
|
-
(!Number.isInteger(t) || t < 1 || t >
|
|
9979
|
+
(!Number.isInteger(t) || t < 1 || t > i) &&
|
|
9924
9980
|
(process.stderr
|
|
9925
|
-
.write(`${r.red('Error:')} --count must be a whole number from 1 to ${
|
|
9981
|
+
.write(`${r.red('Error:')} --count must be a whole number from 1 to ${i}. The API allows Starter ${te.starter}, Plus ${te.plus}, Scale ${te.scale}, Enterprise ${te.enterprise} at once, including polling.
|
|
9926
9982
|
`),
|
|
9927
9983
|
process.exit(1)),
|
|
9928
9984
|
t
|
|
9929
9985
|
);
|
|
9930
9986
|
}
|
|
9931
|
-
async function
|
|
9987
|
+
async function Za(e, t, i, a, n) {
|
|
9932
9988
|
n.isJson ||
|
|
9933
|
-
process.stderr.write(`Starting ${
|
|
9989
|
+
process.stderr.write(`Starting ${a} ${t} jobs together...
|
|
9934
9990
|
`);
|
|
9935
9991
|
let s = await Promise.all(
|
|
9936
|
-
Array.from({ length:
|
|
9992
|
+
Array.from({ length: a }, async () => {
|
|
9937
9993
|
try {
|
|
9938
|
-
return { job: await e.queueJob(t,
|
|
9994
|
+
return { job: await e.queueJob(t, i) };
|
|
9939
9995
|
} catch (l) {
|
|
9940
9996
|
return { err: l };
|
|
9941
9997
|
}
|
|
@@ -9958,7 +10014,7 @@ async function Zi(e, t, a, i, n) {
|
|
|
9958
10014
|
for (; c.length;) {
|
|
9959
10015
|
if ((await new Promise((d) => setTimeout(d, 2e3)), !n.isJson)) {
|
|
9960
10016
|
let d = Math.round((Date.now() - l) / 1e3);
|
|
9961
|
-
process.stderr.write(`Waiting on ${c.length} of ${
|
|
10017
|
+
process.stderr.write(`Waiting on ${c.length} of ${a} (${d}s)...
|
|
9962
10018
|
`);
|
|
9963
10019
|
}
|
|
9964
10020
|
let p = await Promise.all(
|
|
@@ -10003,15 +10059,15 @@ async function Zi(e, t, a, i, n) {
|
|
|
10003
10059
|
o.some((l) => l.status === 'failed' || l.status === 'expired' || l.status === 'cancelled')) &&
|
|
10004
10060
|
process.exit(v);
|
|
10005
10061
|
}
|
|
10006
|
-
function er(e, t,
|
|
10007
|
-
if (
|
|
10008
|
-
let
|
|
10009
|
-
return `${e.slice(0, e.length -
|
|
10062
|
+
function er(e, t, i) {
|
|
10063
|
+
if (i <= 1) return e;
|
|
10064
|
+
let a = q.default.extname(e);
|
|
10065
|
+
return `${e.slice(0, e.length - a.length)}-${t + 1}${a}`;
|
|
10010
10066
|
}
|
|
10011
|
-
function
|
|
10067
|
+
function oi(e) {
|
|
10012
10068
|
let t = {},
|
|
10013
|
-
|
|
10014
|
-
|
|
10069
|
+
i = new Set(),
|
|
10070
|
+
a = [];
|
|
10015
10071
|
for (let n = 0; n < e.length; n++) {
|
|
10016
10072
|
let s = e[n];
|
|
10017
10073
|
if (s.startsWith('--')) {
|
|
@@ -10029,7 +10085,7 @@ function sa(e) {
|
|
|
10029
10085
|
? (t[o.replace(/-/g, '_')] = Number(u))
|
|
10030
10086
|
: (t[o.replace(/-/g, '_')] = u),
|
|
10031
10087
|
n++);
|
|
10032
|
-
} else ((t[o.replace(/-/g, '_')] = !0),
|
|
10088
|
+
} else ((t[o.replace(/-/g, '_')] = !0), i.add(o));
|
|
10033
10089
|
} else if (s.startsWith('-') && s.length === 2) {
|
|
10034
10090
|
let o = s[1],
|
|
10035
10091
|
l =
|
|
@@ -10045,18 +10101,18 @@ function sa(e) {
|
|
|
10045
10101
|
v: 'version',
|
|
10046
10102
|
}[o] || o;
|
|
10047
10103
|
o === 'j' || o === 'h' || o === 'v'
|
|
10048
|
-
? ((t[l] = !0),
|
|
10104
|
+
? ((t[l] = !0), i.add(l))
|
|
10049
10105
|
: n + 1 < e.length && !e[n + 1].startsWith('-')
|
|
10050
10106
|
? ((t[l] = e[n + 1]), n++)
|
|
10051
10107
|
: (t[l] = !0);
|
|
10052
|
-
} else
|
|
10108
|
+
} else a.push(s);
|
|
10053
10109
|
}
|
|
10054
|
-
return { command:
|
|
10110
|
+
return { command: a[0] || '', subcommand: a[1], modelSlug: a[1] || a[0], options: t, flags: i };
|
|
10055
10111
|
}
|
|
10056
10112
|
async function Qe(e, t) {
|
|
10057
|
-
let
|
|
10058
|
-
|
|
10059
|
-
(
|
|
10113
|
+
let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
10114
|
+
a = w(typeof t.api_url == 'string' ? t.api_url : void 0);
|
|
10115
|
+
(i ||
|
|
10060
10116
|
(process.stderr.write(`${r.red('Error:')} Authentication required.
|
|
10061
10117
|
`),
|
|
10062
10118
|
process.stderr
|
|
@@ -10075,7 +10131,7 @@ async function Qe(e, t) {
|
|
|
10075
10131
|
s = !!t.json,
|
|
10076
10132
|
o = !!(t.async || t.no_wait),
|
|
10077
10133
|
u = typeof t.output == 'string' ? t.output : void 0,
|
|
10078
|
-
l =
|
|
10134
|
+
l = Qa(t),
|
|
10079
10135
|
c = { ...t };
|
|
10080
10136
|
(delete c.json,
|
|
10081
10137
|
delete c.async,
|
|
@@ -10084,14 +10140,14 @@ async function Qe(e, t) {
|
|
|
10084
10140
|
delete c.api_key,
|
|
10085
10141
|
delete c.api_url,
|
|
10086
10142
|
delete c.count);
|
|
10087
|
-
let p =
|
|
10088
|
-
(
|
|
10143
|
+
let p = ni(n, c);
|
|
10144
|
+
(Wa(p),
|
|
10089
10145
|
typeof p.image == 'string' && !p.images && !we(n) && ((p.images = [p.image]), delete p.image),
|
|
10090
10146
|
p.image_url &&
|
|
10091
10147
|
!p.first_frame_image &&
|
|
10092
10148
|
(e.startsWith('seedance') || e.startsWith('happy-horse')) &&
|
|
10093
10149
|
(p.first_frame_image = p.image_url));
|
|
10094
|
-
let d = new M(
|
|
10150
|
+
let d = new M(i, a),
|
|
10095
10151
|
m = [
|
|
10096
10152
|
'image',
|
|
10097
10153
|
'mask_image',
|
|
@@ -10108,7 +10164,7 @@ async function Qe(e, t) {
|
|
|
10108
10164
|
if (typeof g == 'string' && !g.startsWith('http://') && !g.startsWith('https://')) {
|
|
10109
10165
|
let P = q.default.resolve(g);
|
|
10110
10166
|
if (U.default.existsSync(P) && U.default.statSync(P).isFile()) {
|
|
10111
|
-
let I = new
|
|
10167
|
+
let I = new $(`Uploading local file ${q.default.basename(P)} to CDN...`);
|
|
10112
10168
|
s || I.start();
|
|
10113
10169
|
try {
|
|
10114
10170
|
let N = U.default.readFileSync(P),
|
|
@@ -10128,8 +10184,8 @@ async function Qe(e, t) {
|
|
|
10128
10184
|
}
|
|
10129
10185
|
}
|
|
10130
10186
|
}
|
|
10131
|
-
await
|
|
10132
|
-
let g = new
|
|
10187
|
+
await Xa(p, async (k) => {
|
|
10188
|
+
let g = new $(`Uploading local file ${q.default.basename(k)} to CDN...`);
|
|
10133
10189
|
s || g.start();
|
|
10134
10190
|
try {
|
|
10135
10191
|
let P = U.default.readFileSync(k),
|
|
@@ -10147,12 +10203,12 @@ async function Qe(e, t) {
|
|
|
10147
10203
|
process.exit(1));
|
|
10148
10204
|
}
|
|
10149
10205
|
});
|
|
10150
|
-
let y = new
|
|
10206
|
+
let y = new $(`Submitting task for ${r.bold(e)}...`);
|
|
10151
10207
|
s || y.start();
|
|
10152
10208
|
let f;
|
|
10153
10209
|
try {
|
|
10154
10210
|
if (l > 1) {
|
|
10155
|
-
await
|
|
10211
|
+
await Za(d, e, p, l, { isJson: s, isAsync: o });
|
|
10156
10212
|
return;
|
|
10157
10213
|
}
|
|
10158
10214
|
f = await d.queueJob(e, p);
|
|
@@ -10256,7 +10312,7 @@ ${r.bold('Outputs:')}
|
|
|
10256
10312
|
u)
|
|
10257
10313
|
) {
|
|
10258
10314
|
let O = er(u, g++, k),
|
|
10259
|
-
pt = new
|
|
10315
|
+
pt = new $(`Downloading output to ${O}...`).start();
|
|
10260
10316
|
try {
|
|
10261
10317
|
(await d.downloadOutput(I.url, q.default.resolve(process.cwd(), O)),
|
|
10262
10318
|
pt.succeed(`Saved to ${r.bold(O)}`));
|
|
@@ -10274,8 +10330,8 @@ ${I.text}
|
|
|
10274
10330
|
process.stdout.write(`
|
|
10275
10331
|
`);
|
|
10276
10332
|
}
|
|
10277
|
-
var
|
|
10278
|
-
|
|
10333
|
+
var li = T(require('node:readline'));
|
|
10334
|
+
E();
|
|
10279
10335
|
async function tr(e) {
|
|
10280
10336
|
try {
|
|
10281
10337
|
return (await new M(e, w()).checkKey(), 'ok');
|
|
@@ -10287,48 +10343,48 @@ async function tr(e) {
|
|
|
10287
10343
|
return 'unchecked';
|
|
10288
10344
|
}
|
|
10289
10345
|
}
|
|
10290
|
-
function
|
|
10291
|
-
let t =
|
|
10292
|
-
return new Promise((
|
|
10293
|
-
t.question(e, (
|
|
10294
|
-
(t.close(), a
|
|
10346
|
+
function ir(e) {
|
|
10347
|
+
let t = li.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
10348
|
+
return new Promise((i) => {
|
|
10349
|
+
t.question(e, (a) => {
|
|
10350
|
+
(t.close(), i(a.trim()));
|
|
10295
10351
|
});
|
|
10296
10352
|
});
|
|
10297
10353
|
}
|
|
10298
|
-
async function
|
|
10354
|
+
async function ie(e, t) {
|
|
10299
10355
|
switch (e) {
|
|
10300
10356
|
case 'login':
|
|
10301
10357
|
case 'set-key': {
|
|
10302
|
-
let
|
|
10303
|
-
(
|
|
10358
|
+
let i = t?.trim() || '';
|
|
10359
|
+
(i ||
|
|
10304
10360
|
(process.stdout.write(`
|
|
10305
10361
|
${r.bold('Tein AI Authentication')}
|
|
10306
10362
|
`),
|
|
10307
10363
|
process.stdout.write(`Get your API key at: ${r.cyan('https://tein.ai/dashboard/keys')}
|
|
10308
10364
|
|
|
10309
10365
|
`),
|
|
10310
|
-
(
|
|
10311
|
-
!
|
|
10312
|
-
!
|
|
10366
|
+
(i = await ir('Enter your Tein API Key (sk_live_...): '))),
|
|
10367
|
+
!i.startsWith('sk_live_') &&
|
|
10368
|
+
!i.startsWith('sk_test_') &&
|
|
10313
10369
|
(process.stderr
|
|
10314
10370
|
.write(`${r.red('Error:')} Invalid key format. Tein API keys start with 'sk_live_' or 'sk_test_'.
|
|
10315
10371
|
`),
|
|
10316
10372
|
process.exit(1)));
|
|
10317
|
-
let
|
|
10318
|
-
(
|
|
10373
|
+
let a = await tr(i);
|
|
10374
|
+
(a === 'invalid' &&
|
|
10319
10375
|
(process.stderr
|
|
10320
10376
|
.write(`${r.red('Error:')} Tein did not accept this key. Copy it again from ${r.cyan('https://tein.ai/dashboard/keys')}. Nothing was saved.
|
|
10321
10377
|
`),
|
|
10322
10378
|
process.exit(1)),
|
|
10323
|
-
Ke({ apiKey:
|
|
10379
|
+
Ke({ apiKey: i }),
|
|
10324
10380
|
process.stdout.write(`
|
|
10325
10381
|
${r.green('\u2713')} API key saved to ${r.dim(oe())}
|
|
10326
10382
|
`),
|
|
10327
|
-
|
|
10383
|
+
a === 'blocked'
|
|
10328
10384
|
? process.stdout
|
|
10329
10385
|
.write(`${r.yellow('\u2139')} The key is valid, but this account cannot run requests right now. Check your dashboard.
|
|
10330
10386
|
`)
|
|
10331
|
-
:
|
|
10387
|
+
: a === 'unchecked' &&
|
|
10332
10388
|
process.stdout
|
|
10333
10389
|
.write(`${r.yellow('\u2139')} Could not reach Tein to check the key. It is saved; run ${r.cyan('tein auth set-key')} again once you are online to check it.
|
|
10334
10390
|
`),
|
|
@@ -10352,8 +10408,8 @@ ${r.green('\u2713')} API key saved to ${r.dim(oe())}
|
|
|
10352
10408
|
break;
|
|
10353
10409
|
}
|
|
10354
10410
|
default: {
|
|
10355
|
-
let
|
|
10356
|
-
|
|
10411
|
+
let i = S(),
|
|
10412
|
+
a = w(),
|
|
10357
10413
|
n = j();
|
|
10358
10414
|
if (
|
|
10359
10415
|
(process.stdout.write(`
|
|
@@ -10361,9 +10417,9 @@ ${r.bold('Tein AI CLI Configuration')}
|
|
|
10361
10417
|
`),
|
|
10362
10418
|
process.stdout.write(` Config file: ${r.dim(oe())}
|
|
10363
10419
|
`),
|
|
10364
|
-
process.stdout.write(` API URL: ${r.cyan(
|
|
10420
|
+
process.stdout.write(` API URL: ${r.cyan(a)}
|
|
10365
10421
|
`),
|
|
10366
|
-
!
|
|
10422
|
+
!i)
|
|
10367
10423
|
)
|
|
10368
10424
|
(process.stdout.write(` API Key: ${r.red('Not configured')}
|
|
10369
10425
|
|
|
@@ -10373,9 +10429,9 @@ ${r.bold('Tein AI CLI Configuration')}
|
|
|
10373
10429
|
|
|
10374
10430
|
`));
|
|
10375
10431
|
else {
|
|
10376
|
-
let s = `${
|
|
10432
|
+
let s = `${i.slice(0, 10)}...${i.slice(-4)}`;
|
|
10377
10433
|
process.stdout
|
|
10378
|
-
.write(` API Key: ${r.green(s)} (${
|
|
10434
|
+
.write(` API Key: ${r.green(s)} (${i.startsWith('sk_live_') ? 'Live Key' : 'Test Key'})
|
|
10379
10435
|
|
|
10380
10436
|
`);
|
|
10381
10437
|
}
|
|
@@ -10383,16 +10439,16 @@ ${r.bold('Tein AI CLI Configuration')}
|
|
|
10383
10439
|
}
|
|
10384
10440
|
}
|
|
10385
10441
|
}
|
|
10386
|
-
|
|
10442
|
+
E();
|
|
10387
10443
|
function _(e) {
|
|
10388
10444
|
return e !== 0 && Math.abs(e) < 0.01
|
|
10389
10445
|
? `$${e.toFixed(6).replace(/0+$/, '').replace(/\.$/, '')}`
|
|
10390
10446
|
: `$${e.toFixed(2)}`;
|
|
10391
10447
|
}
|
|
10392
|
-
function
|
|
10448
|
+
function pi(e) {
|
|
10393
10449
|
return `${e} ${e === 1 ? 'request' : 'requests'}`;
|
|
10394
10450
|
}
|
|
10395
|
-
function
|
|
10451
|
+
function ar(e) {
|
|
10396
10452
|
let t = [
|
|
10397
10453
|
['Balance', _(e.balance)],
|
|
10398
10454
|
['Available to this key', _(e.available)],
|
|
@@ -10405,15 +10461,15 @@ function ir(e) {
|
|
|
10405
10461
|
: '';
|
|
10406
10462
|
t.push(['Credits from Tein', `${_(e.credits_from_tein.amount)}${n}`]);
|
|
10407
10463
|
}
|
|
10408
|
-
let
|
|
10409
|
-
(
|
|
10464
|
+
let i = e.key.spending_limit;
|
|
10465
|
+
(i &&
|
|
10410
10466
|
t.push([
|
|
10411
|
-
`Key limit (${
|
|
10412
|
-
`${_(
|
|
10467
|
+
`Key limit (${i.period})`,
|
|
10468
|
+
`${_(i.remaining)} left of ${_(i.amount)}${i.resets_at ? `, resets ${i.resets_at.slice(0, 10)}` : ''}`,
|
|
10413
10469
|
]),
|
|
10414
10470
|
t.push(
|
|
10415
|
-
['This month', `${_(e.usage.this_month.spend)} on ${
|
|
10416
|
-
['Last 30 days', `${_(e.usage.last_30_days.spend)} on ${
|
|
10471
|
+
['This month', `${_(e.usage.this_month.spend)} on ${pi(e.usage.this_month.requests)}`],
|
|
10472
|
+
['Last 30 days', `${_(e.usage.last_30_days.spend)} on ${pi(e.usage.last_30_days.requests)}`],
|
|
10417
10473
|
[
|
|
10418
10474
|
'Auto top up',
|
|
10419
10475
|
e.auto_top_up.enabled
|
|
@@ -10423,13 +10479,13 @@ function ir(e) {
|
|
|
10423
10479
|
['Workspace', `${e.workspace.name} (${e.workspace.plan.name})`],
|
|
10424
10480
|
['Key', `${e.key.name} (${e.key.env})`],
|
|
10425
10481
|
));
|
|
10426
|
-
let
|
|
10427
|
-
return t.map(([n, s]) => ` ${n.padEnd(
|
|
10482
|
+
let a = Math.max(...t.map(([n]) => n.length));
|
|
10483
|
+
return t.map(([n, s]) => ` ${n.padEnd(a)} ${s}`);
|
|
10428
10484
|
}
|
|
10429
|
-
async function
|
|
10485
|
+
async function di(e) {
|
|
10430
10486
|
let t = S(typeof e.api_key == 'string' ? e.api_key : void 0),
|
|
10431
|
-
|
|
10432
|
-
|
|
10487
|
+
i = w(typeof e.api_url == 'string' ? e.api_url : void 0),
|
|
10488
|
+
a = !!e.json;
|
|
10433
10489
|
t ||
|
|
10434
10490
|
(process.stderr.write(`${r.red('Error:')} Authentication required.
|
|
10435
10491
|
`),
|
|
@@ -10439,10 +10495,10 @@ async function pa(e) {
|
|
|
10439
10495
|
process.exit(1));
|
|
10440
10496
|
let n;
|
|
10441
10497
|
try {
|
|
10442
|
-
n = await new M(t,
|
|
10498
|
+
n = await new M(t, i).getBalance();
|
|
10443
10499
|
} catch (s) {
|
|
10444
10500
|
(s instanceof b &&
|
|
10445
|
-
(
|
|
10501
|
+
(a
|
|
10446
10502
|
? process.stdout.write(
|
|
10447
10503
|
JSON.stringify(
|
|
10448
10504
|
{ error: { code: s.code ?? null, message: s.message, ...s.fields } },
|
|
@@ -10460,7 +10516,7 @@ async function pa(e) {
|
|
|
10460
10516
|
`),
|
|
10461
10517
|
process.exit(v));
|
|
10462
10518
|
}
|
|
10463
|
-
if (
|
|
10519
|
+
if (a) {
|
|
10464
10520
|
process.stdout.write(
|
|
10465
10521
|
JSON.stringify(n, null, 2) +
|
|
10466
10522
|
`
|
|
@@ -10470,15 +10526,15 @@ async function pa(e) {
|
|
|
10470
10526
|
}
|
|
10471
10527
|
process.stdout.write(`
|
|
10472
10528
|
${r.bold('Tein balance')}
|
|
10473
|
-
${
|
|
10529
|
+
${ar(n).join(`
|
|
10474
10530
|
`)}
|
|
10475
10531
|
|
|
10476
10532
|
`);
|
|
10477
10533
|
}
|
|
10478
|
-
|
|
10479
|
-
function
|
|
10534
|
+
E();
|
|
10535
|
+
function ci(e) {
|
|
10480
10536
|
let t = S(typeof e.api_key == 'string' ? e.api_key : void 0),
|
|
10481
|
-
|
|
10537
|
+
i = w(typeof e.api_url == 'string' ? e.api_url : void 0);
|
|
10482
10538
|
return (
|
|
10483
10539
|
t ||
|
|
10484
10540
|
(process.stderr.write(`${r.red('Error:')} Authentication required.
|
|
@@ -10487,55 +10543,55 @@ function da(e) {
|
|
|
10487
10543
|
.write(`Please run ${r.cyan('tein auth login')} or set ${r.cyan('TEIN_API_KEY')} environment variable.
|
|
10488
10544
|
`),
|
|
10489
10545
|
process.exit(1)),
|
|
10490
|
-
new M(t,
|
|
10546
|
+
new M(t, i)
|
|
10491
10547
|
);
|
|
10492
10548
|
}
|
|
10493
|
-
function
|
|
10494
|
-
let
|
|
10495
|
-
for (let
|
|
10496
|
-
let n = e[
|
|
10497
|
-
(typeof n == 'string' || typeof n == 'number') && (a
|
|
10549
|
+
function ui(e, t) {
|
|
10550
|
+
let i = {};
|
|
10551
|
+
for (let a of t) {
|
|
10552
|
+
let n = e[a];
|
|
10553
|
+
(typeof n == 'string' || typeof n == 'number') && (i[a] = String(n));
|
|
10498
10554
|
}
|
|
10499
|
-
return
|
|
10555
|
+
return i;
|
|
10500
10556
|
}
|
|
10501
|
-
async function
|
|
10557
|
+
async function mi(e, t) {
|
|
10502
10558
|
try {
|
|
10503
10559
|
return await t();
|
|
10504
|
-
} catch (
|
|
10505
|
-
(
|
|
10560
|
+
} catch (i) {
|
|
10561
|
+
(i instanceof b &&
|
|
10506
10562
|
(e
|
|
10507
10563
|
? process.stdout.write(
|
|
10508
10564
|
JSON.stringify(
|
|
10509
|
-
{ error: { code:
|
|
10565
|
+
{ error: { code: i.code ?? null, message: i.message, ...i.fields } },
|
|
10510
10566
|
null,
|
|
10511
10567
|
2,
|
|
10512
10568
|
) +
|
|
10513
10569
|
`
|
|
10514
10570
|
`,
|
|
10515
10571
|
)
|
|
10516
|
-
: process.stderr.write(`${r.red('Error:')} ${K(
|
|
10572
|
+
: process.stderr.write(`${r.red('Error:')} ${K(i).join(`
|
|
10517
10573
|
`)}
|
|
10518
10574
|
`),
|
|
10519
|
-
process.exit(
|
|
10520
|
-
process.stderr.write(`${r.red('Error:')} ${
|
|
10575
|
+
process.exit(i.exitCode)),
|
|
10576
|
+
process.stderr.write(`${r.red('Error:')} ${i instanceof Error ? i.message : String(i)}
|
|
10521
10577
|
`),
|
|
10522
10578
|
process.exit(v));
|
|
10523
10579
|
}
|
|
10524
10580
|
}
|
|
10525
10581
|
function Ze(e) {
|
|
10526
|
-
let t = e[0].map((
|
|
10527
|
-
|
|
10582
|
+
let t = e[0].map((a, n) => Math.max(...e.map((s) => s[n].length))),
|
|
10583
|
+
i = (a) => e.slice(1).every((n) => /^[-+$\d]/.test(n[a]));
|
|
10528
10584
|
return e.map(
|
|
10529
|
-
(
|
|
10530
|
-
` ${
|
|
10531
|
-
.map((n, s) => (s > 0 &&
|
|
10585
|
+
(a) =>
|
|
10586
|
+
` ${a
|
|
10587
|
+
.map((n, s) => (s > 0 && i(s) ? n.padStart(t[s]) : n.padEnd(t[s])))
|
|
10532
10588
|
.join(' ')
|
|
10533
10589
|
.trimEnd()}`,
|
|
10534
10590
|
);
|
|
10535
10591
|
}
|
|
10536
10592
|
function rr(e) {
|
|
10537
10593
|
let t = e.summary,
|
|
10538
|
-
|
|
10594
|
+
i = [
|
|
10539
10595
|
` Window ${e.from.slice(0, 10)} to ${e.to.slice(0, 10)} (${e.range})${e.filters.model ? `, model ${e.filters.model}` : ''}${e.filters.channel ? `, channel ${e.filters.channel}` : ''}`,
|
|
10540
10596
|
` Spent ${_(t.spend)} on ${t.requests} requests (${t.succeeded} succeeded, ${t.failed} failed${t.running ? `, ${t.running} running` : ''})`,
|
|
10541
10597
|
` Daily burn ${_(t.daily_burn)}`,
|
|
@@ -10543,31 +10599,31 @@ function rr(e) {
|
|
|
10543
10599
|
];
|
|
10544
10600
|
return (
|
|
10545
10601
|
e.by_channel.length &&
|
|
10546
|
-
(
|
|
10547
|
-
|
|
10602
|
+
(i.push('', r.bold('By channel')),
|
|
10603
|
+
i.push(
|
|
10548
10604
|
...Ze([
|
|
10549
10605
|
['Channel', 'Spend', 'Requests'],
|
|
10550
|
-
...e.by_channel.map((
|
|
10606
|
+
...e.by_channel.map((a) => [a.channel, _(a.spend), String(a.requests)]),
|
|
10551
10607
|
]),
|
|
10552
10608
|
)),
|
|
10553
10609
|
e.by_model.length &&
|
|
10554
|
-
(
|
|
10555
|
-
|
|
10610
|
+
(i.push('', r.bold('By model')),
|
|
10611
|
+
i.push(
|
|
10556
10612
|
...Ze([
|
|
10557
10613
|
['Model', 'Spend', 'Requests', 'Failed'],
|
|
10558
|
-
...e.by_model.map((
|
|
10614
|
+
...e.by_model.map((a) => [a.name, _(a.spend), String(a.requests), String(a.failed)]),
|
|
10559
10615
|
]),
|
|
10560
10616
|
)),
|
|
10561
|
-
|
|
10617
|
+
i
|
|
10562
10618
|
);
|
|
10563
10619
|
}
|
|
10564
|
-
async function
|
|
10620
|
+
async function fi(e) {
|
|
10565
10621
|
let t = !!e.json,
|
|
10566
|
-
|
|
10567
|
-
|
|
10622
|
+
i = ci(e),
|
|
10623
|
+
a = await mi(t, () => i.getUsage(ui(e, ['range', 'from', 'to', 'model', 'channel'])));
|
|
10568
10624
|
if (t) {
|
|
10569
10625
|
process.stdout.write(
|
|
10570
|
-
JSON.stringify(
|
|
10626
|
+
JSON.stringify(a, null, 2) +
|
|
10571
10627
|
`
|
|
10572
10628
|
`,
|
|
10573
10629
|
);
|
|
@@ -10575,7 +10631,7 @@ async function ma(e) {
|
|
|
10575
10631
|
}
|
|
10576
10632
|
process.stdout.write(`
|
|
10577
10633
|
${r.bold('Tein usage')}
|
|
10578
|
-
${rr(
|
|
10634
|
+
${rr(a).join(`
|
|
10579
10635
|
`)}
|
|
10580
10636
|
|
|
10581
10637
|
`);
|
|
@@ -10593,74 +10649,74 @@ function nr(e) {
|
|
|
10593
10649
|
])
|
|
10594
10650
|
: [' No transactions yet.'];
|
|
10595
10651
|
}
|
|
10596
|
-
async function
|
|
10652
|
+
async function gi(e) {
|
|
10597
10653
|
let t = !!e.json,
|
|
10598
|
-
|
|
10599
|
-
|
|
10654
|
+
i = ci(e),
|
|
10655
|
+
a = await mi(t, () => i.getTransactions(ui(e, ['limit', 'type', 'after'])));
|
|
10600
10656
|
if (t) {
|
|
10601
10657
|
process.stdout.write(
|
|
10602
|
-
JSON.stringify(
|
|
10658
|
+
JSON.stringify(a, null, 2) +
|
|
10603
10659
|
`
|
|
10604
10660
|
`,
|
|
10605
10661
|
);
|
|
10606
10662
|
return;
|
|
10607
10663
|
}
|
|
10608
10664
|
let n =
|
|
10609
|
-
|
|
10665
|
+
a.has_more && a.next_cursor
|
|
10610
10666
|
? `
|
|
10611
|
-
More: tein transactions --after ${
|
|
10667
|
+
More: tein transactions --after ${a.next_cursor}`
|
|
10612
10668
|
: '';
|
|
10613
10669
|
process.stdout.write(`
|
|
10614
10670
|
${r.bold('Tein balance history')}
|
|
10615
|
-
${nr(
|
|
10671
|
+
${nr(a).join(`
|
|
10616
10672
|
`)}${n}
|
|
10617
10673
|
|
|
10618
10674
|
`);
|
|
10619
10675
|
}
|
|
10620
|
-
|
|
10676
|
+
E();
|
|
10621
10677
|
Ce();
|
|
10622
10678
|
ee();
|
|
10623
10679
|
var sr = 3e3;
|
|
10624
|
-
async function
|
|
10680
|
+
async function hi(e) {
|
|
10625
10681
|
try {
|
|
10626
10682
|
let t = await fetch(`${w(e)}/v1/pricing`, { signal: AbortSignal.timeout(sr) });
|
|
10627
10683
|
if (!t.ok) return;
|
|
10628
|
-
let
|
|
10629
|
-
|
|
10630
|
-
for (let n of
|
|
10684
|
+
let i = await t.json(),
|
|
10685
|
+
a = {};
|
|
10686
|
+
for (let n of i.configs ?? []) {
|
|
10631
10687
|
let s = String(n.modelSlug ?? '');
|
|
10632
|
-
J.has(s) && (
|
|
10688
|
+
J.has(s) && (a[s] ??= []).push(Number(n.starterPrice));
|
|
10633
10689
|
}
|
|
10634
|
-
|
|
10690
|
+
Zt(a);
|
|
10635
10691
|
} catch {}
|
|
10636
10692
|
}
|
|
10637
10693
|
var or = new Set(['video', 'image', 'text', 'audio', '3d']),
|
|
10638
10694
|
lr = { llm: 'text', chat: 'text', reasoning: 'text' };
|
|
10639
|
-
async function
|
|
10640
|
-
await
|
|
10641
|
-
let
|
|
10695
|
+
async function yi(e, t) {
|
|
10696
|
+
await hi(t);
|
|
10697
|
+
let i = D();
|
|
10642
10698
|
if (e) {
|
|
10643
10699
|
let s = e.toLowerCase(),
|
|
10644
10700
|
o = lr[s] ?? s;
|
|
10645
|
-
|
|
10646
|
-
?
|
|
10647
|
-
:
|
|
10701
|
+
i = or.has(o)
|
|
10702
|
+
? i.filter((u) => u.category.toLowerCase() === o)
|
|
10703
|
+
: i.filter((u) => u.kind.toLowerCase().includes(s) || u.slug.toLowerCase().includes(s));
|
|
10648
10704
|
}
|
|
10649
10705
|
(process.stdout.write(`
|
|
10650
|
-
${r.bold('Tein AI Models Catalog')} (${
|
|
10706
|
+
${r.bold('Tein AI Models Catalog')} (${i.length} available)
|
|
10651
10707
|
`),
|
|
10652
10708
|
process.stdout
|
|
10653
10709
|
.write(`${r.dim('Run `tein info <model-slug>` to see detailed parameters and options.')}
|
|
10654
10710
|
|
|
10655
10711
|
`));
|
|
10656
|
-
let
|
|
10657
|
-
for (let s of
|
|
10712
|
+
let a = {};
|
|
10713
|
+
for (let s of i) {
|
|
10658
10714
|
let o = s.category;
|
|
10659
|
-
(
|
|
10715
|
+
(a[o] || (a[o] = []), a[o].push(s));
|
|
10660
10716
|
}
|
|
10661
10717
|
let n = ['Video', 'Image', 'Text', 'Audio', '3D'];
|
|
10662
10718
|
for (let s of n) {
|
|
10663
|
-
let o =
|
|
10719
|
+
let o = a[s];
|
|
10664
10720
|
if (!(!o || o.length === 0)) {
|
|
10665
10721
|
process.stdout.write(`${r.bold(r.cyan(`\u2500\u2500 ${s} Models \u2500\u2500`))}
|
|
10666
10722
|
`);
|
|
@@ -10680,55 +10736,55 @@ ${r.bold('Tein AI Models Catalog')} (${a.length} available)
|
|
|
10680
10736
|
|
|
10681
10737
|
`);
|
|
10682
10738
|
}
|
|
10683
|
-
async function
|
|
10684
|
-
J.has(e) && (await
|
|
10685
|
-
let
|
|
10686
|
-
(
|
|
10739
|
+
async function bi(e, t) {
|
|
10740
|
+
J.has(e) && (await hi(t));
|
|
10741
|
+
let i = H(e);
|
|
10742
|
+
(i ||
|
|
10687
10743
|
(process.stderr.write(`${r.red('Error:')} Model "${e}" not found in Tein AI registry.
|
|
10688
10744
|
`),
|
|
10689
10745
|
process.stderr.write(`Run ${r.cyan('tein models')} to see all available model slugs.
|
|
10690
10746
|
`),
|
|
10691
10747
|
process.exit(1)),
|
|
10692
10748
|
process.stdout.write(`
|
|
10693
|
-
${r.bold(r.cyan(
|
|
10749
|
+
${r.bold(r.cyan(i.name))} (${r.bold(i.slug)})
|
|
10694
10750
|
`),
|
|
10695
|
-
process.stdout.write(` ${r.gray(
|
|
10751
|
+
process.stdout.write(` ${r.gray(i.description)}
|
|
10696
10752
|
|
|
10697
10753
|
`),
|
|
10698
10754
|
process.stdout.write(`${r.bold('Metadata:')}
|
|
10699
10755
|
`),
|
|
10700
|
-
process.stdout.write(` Category: ${r.yellow(
|
|
10756
|
+
process.stdout.write(` Category: ${r.yellow(i.category)}
|
|
10701
10757
|
`),
|
|
10702
|
-
process.stdout.write(` Kind: ${
|
|
10758
|
+
process.stdout.write(` Kind: ${i.kind}
|
|
10703
10759
|
`),
|
|
10704
|
-
process.stdout.write(` Vendor: ${
|
|
10760
|
+
process.stdout.write(` Vendor: ${i.vendor}
|
|
10705
10761
|
`),
|
|
10706
|
-
process.stdout.write(` Pricing: ${r.green(
|
|
10762
|
+
process.stdout.write(` Pricing: ${r.green(i.priceFormatted)}
|
|
10707
10763
|
|
|
10708
10764
|
`),
|
|
10709
10765
|
process.stdout.write(`${r.bold('Parameters:')}
|
|
10710
10766
|
`));
|
|
10711
|
-
for (let
|
|
10712
|
-
let n =
|
|
10713
|
-
s =
|
|
10767
|
+
for (let a of i.parameters) {
|
|
10768
|
+
let n = a.required ? r.red('(required)') : r.dim('(optional)'),
|
|
10769
|
+
s = a.default !== void 0 ? r.dim(` [default: ${a.default}]`) : '';
|
|
10714
10770
|
(process.stdout
|
|
10715
|
-
.write(` ${r.bold(`--${
|
|
10771
|
+
.write(` ${r.bold(`--${a.name.replace(/_/g, '-')}`)} ${r.yellow(`<${a.type}>`)} ${n}${s}
|
|
10716
10772
|
`),
|
|
10717
|
-
|
|
10718
|
-
process.stdout.write(` ${r.gray(
|
|
10773
|
+
a.description &&
|
|
10774
|
+
process.stdout.write(` ${r.gray(a.description)}
|
|
10719
10775
|
`),
|
|
10720
|
-
|
|
10721
|
-
|
|
10722
|
-
process.stdout.write(` Allowed values: ${r.dim(
|
|
10776
|
+
a.options &&
|
|
10777
|
+
a.options.length > 0 &&
|
|
10778
|
+
process.stdout.write(` Allowed values: ${r.dim(a.options.join(', '))}
|
|
10723
10779
|
`),
|
|
10724
|
-
(
|
|
10725
|
-
process.stdout.write(` Range: ${
|
|
10780
|
+
(a.min !== void 0 || a.max !== void 0) &&
|
|
10781
|
+
process.stdout.write(` Range: ${a.min ?? ''} to ${a.max ?? ''}
|
|
10726
10782
|
`),
|
|
10727
10783
|
process.stdout.write(`
|
|
10728
10784
|
`));
|
|
10729
10785
|
}
|
|
10730
10786
|
if (
|
|
10731
|
-
(
|
|
10787
|
+
(i.parameters.some((a) => a.name === 'callback_url') ||
|
|
10732
10788
|
(process.stdout
|
|
10733
10789
|
.write(` ${r.bold('--callback-url')} ${r.yellow('<string>')} ${r.dim('(optional)')}
|
|
10734
10790
|
`),
|
|
@@ -10738,33 +10794,33 @@ ${r.bold(r.cyan(a.name))} (${r.bold(a.slug)})
|
|
|
10738
10794
|
`)),
|
|
10739
10795
|
process.stdout.write(`${r.bold('Sample CLI Usage:')}
|
|
10740
10796
|
`),
|
|
10741
|
-
|
|
10797
|
+
i.category === 'Video')
|
|
10742
10798
|
)
|
|
10743
10799
|
process.stdout
|
|
10744
|
-
.write(` ${r.cyan(`tein run ${
|
|
10800
|
+
.write(` ${r.cyan(`tein run ${i.slug} --prompt "Cinematic camera drone shot of a coastline" --aspect-ratio 16:9 --duration 5 -o output.mp4`)}
|
|
10745
10801
|
|
|
10746
10802
|
`);
|
|
10747
|
-
else if (
|
|
10748
|
-
let
|
|
10803
|
+
else if (i.category === 'Image') {
|
|
10804
|
+
let a = i.parameters.some((n) => n.name === 'aspect_ratio') ? ' --aspect-ratio 16:9' : '';
|
|
10749
10805
|
process.stdout
|
|
10750
|
-
.write(` ${r.cyan(`tein run ${
|
|
10806
|
+
.write(` ${r.cyan(`tein run ${i.slug} --prompt "Cyberpunk city in the rain, 8k render"${a} -o output.png`)}
|
|
10751
10807
|
|
|
10752
10808
|
`);
|
|
10753
10809
|
} else
|
|
10754
|
-
|
|
10810
|
+
i.category === 'Audio'
|
|
10755
10811
|
? process.stdout
|
|
10756
|
-
.write(` ${r.cyan(`tein run ${
|
|
10812
|
+
.write(` ${r.cyan(`tein run ${i.slug} --prompt "Hello world from Tein AI" --speaker en_female_warm -o speech.wav`)}
|
|
10757
10813
|
|
|
10758
10814
|
`)
|
|
10759
10815
|
: process.stdout
|
|
10760
|
-
.write(` ${r.cyan(`tein run ${
|
|
10816
|
+
.write(` ${r.cyan(`tein run ${i.slug} --prompt "Explain quantum computing in simple terms"`)}
|
|
10761
10817
|
|
|
10762
10818
|
`);
|
|
10763
10819
|
}
|
|
10764
|
-
|
|
10820
|
+
E();
|
|
10765
10821
|
et();
|
|
10766
10822
|
var pr = 1e4,
|
|
10767
|
-
|
|
10823
|
+
it = {
|
|
10768
10824
|
price: '',
|
|
10769
10825
|
creativeMode: 'Creative mode',
|
|
10770
10826
|
priority: 'Priority',
|
|
@@ -10774,7 +10830,7 @@ var pr = 1e4,
|
|
|
10774
10830
|
priorityDraft: 'Priority + Draft',
|
|
10775
10831
|
creativeModePriorityDraft: 'Creative mode + Priority + Draft',
|
|
10776
10832
|
},
|
|
10777
|
-
dr = Object.keys(
|
|
10833
|
+
dr = Object.keys(it),
|
|
10778
10834
|
cr = {
|
|
10779
10835
|
creativeMode: 'unfiltered',
|
|
10780
10836
|
creativeModePriority: 'unfilteredPriority',
|
|
@@ -10782,46 +10838,46 @@ var pr = 1e4,
|
|
|
10782
10838
|
creativeModePriorityDraft: 'unfilteredPriorityDraft',
|
|
10783
10839
|
};
|
|
10784
10840
|
function ur(e, t) {
|
|
10785
|
-
let
|
|
10786
|
-
return e[t] ?? (
|
|
10841
|
+
let i = cr[t];
|
|
10842
|
+
return e[t] ?? (i ? e[i] : void 0);
|
|
10787
10843
|
}
|
|
10788
10844
|
async function mr(e, t) {
|
|
10789
|
-
let
|
|
10790
|
-
|
|
10845
|
+
let i = `${w(e)}${xe(t)}`,
|
|
10846
|
+
a;
|
|
10791
10847
|
try {
|
|
10792
|
-
|
|
10848
|
+
a = await fetch(i, { signal: AbortSignal.timeout(pr) });
|
|
10793
10849
|
} catch {
|
|
10794
|
-
throw new Error(`Could not reach ${
|
|
10850
|
+
throw new Error(`Could not reach ${i}`);
|
|
10795
10851
|
}
|
|
10796
|
-
let n = await
|
|
10797
|
-
if (!
|
|
10852
|
+
let n = await a.json().catch(() => null);
|
|
10853
|
+
if (!a.ok || !n || n.object !== 'list' || !n.board) {
|
|
10798
10854
|
let s =
|
|
10799
10855
|
n && typeof n.error == 'string'
|
|
10800
10856
|
? n.error
|
|
10801
10857
|
: n && typeof n.error == 'object' && n.error?.message
|
|
10802
10858
|
? n.error.message
|
|
10803
|
-
: `Pricing request failed (${
|
|
10859
|
+
: `Pricing request failed (${a.status})`;
|
|
10804
10860
|
throw new Error(s);
|
|
10805
10861
|
}
|
|
10806
10862
|
return n;
|
|
10807
10863
|
}
|
|
10808
10864
|
function tt(e) {
|
|
10809
10865
|
let t = e.toFixed(4).replace(/0+$/, '').replace(/\.$/, ''),
|
|
10810
|
-
[
|
|
10811
|
-
return `$${
|
|
10866
|
+
[i, a = ''] = t.split('.');
|
|
10867
|
+
return `$${i}.${a.padEnd(2, '0')}`;
|
|
10812
10868
|
}
|
|
10813
|
-
function
|
|
10869
|
+
function at(e) {
|
|
10814
10870
|
if (!e || typeof e.starter != 'number') return null;
|
|
10815
10871
|
let t = typeof e.plus == 'number' ? e.plus : e.starter,
|
|
10816
|
-
|
|
10817
|
-
return `Starter ${tt(e.starter)} Plus ${tt(t)} Scale ${tt(
|
|
10872
|
+
i = typeof e.scale == 'number' ? e.scale : t;
|
|
10873
|
+
return `Starter ${tt(e.starter)} Plus ${tt(t)} Scale ${tt(i)}`;
|
|
10818
10874
|
}
|
|
10819
10875
|
function fr(e) {
|
|
10820
10876
|
if (typeof e.label == 'string' && e.label.trim()) return e.label.trim();
|
|
10821
10877
|
let t = [];
|
|
10822
|
-
for (let
|
|
10823
|
-
let
|
|
10824
|
-
|
|
10878
|
+
for (let i of ['endpoint', 'resolution', 'quality', 'mode', 'task', 'component', 'token']) {
|
|
10879
|
+
let a = e[i];
|
|
10880
|
+
a != null && a !== '' && t.push(String(a));
|
|
10825
10881
|
}
|
|
10826
10882
|
return (
|
|
10827
10883
|
e.withVideo === !0 && t.push('with video'),
|
|
@@ -10829,54 +10885,54 @@ function fr(e) {
|
|
|
10829
10885
|
);
|
|
10830
10886
|
}
|
|
10831
10887
|
function gr(e, t) {
|
|
10832
|
-
let
|
|
10833
|
-
for (let
|
|
10834
|
-
let n =
|
|
10888
|
+
let i = fr(e);
|
|
10889
|
+
for (let a of dr) {
|
|
10890
|
+
let n = at(ur(e, a));
|
|
10835
10891
|
if (!n) continue;
|
|
10836
|
-
let s =
|
|
10837
|
-
t.push(` ${
|
|
10892
|
+
let s = it[a] ? ` (${it[a]})` : '';
|
|
10893
|
+
t.push(` ${i}${s} ${n}`);
|
|
10838
10894
|
}
|
|
10839
10895
|
}
|
|
10840
10896
|
function hr(e, t) {
|
|
10841
|
-
let
|
|
10897
|
+
let i = e.quality ? ` quality=${e.quality}` : '';
|
|
10842
10898
|
t.push(
|
|
10843
|
-
` ${r.bold(e.slug.padEnd(26))} ${r.gray(e.name)} ${r.dim(`${e.kind} ${e.unit} model=${e.model}${
|
|
10899
|
+
` ${r.bold(e.slug.padEnd(26))} ${r.gray(e.name)} ${r.dim(`${e.kind} ${e.unit} model=${e.model}${i}`)}`,
|
|
10844
10900
|
);
|
|
10845
10901
|
for (let n of e.variants ?? []) gr(n, t);
|
|
10846
|
-
let
|
|
10847
|
-
if (Array.isArray(
|
|
10848
|
-
for (let n of
|
|
10902
|
+
let a = e.addons;
|
|
10903
|
+
if (Array.isArray(a))
|
|
10904
|
+
for (let n of a) {
|
|
10849
10905
|
if (!n || typeof n != 'object') continue;
|
|
10850
10906
|
let s = n,
|
|
10851
10907
|
o = typeof s.label == 'string' ? s.label : String(s.id ?? 'add-on'),
|
|
10852
|
-
u =
|
|
10908
|
+
u = at(s.price);
|
|
10853
10909
|
u && t.push(` ${o} (add-on) ${u}`);
|
|
10854
10910
|
}
|
|
10855
10911
|
t.push('');
|
|
10856
10912
|
}
|
|
10857
10913
|
function yr(e) {
|
|
10858
10914
|
let t = [],
|
|
10859
|
-
|
|
10860
|
-
(t.push(`${r.bold('Tein prices')} ${r.green(e.currency)} ${e.count} models${
|
|
10915
|
+
i = e.board.checked ? ` \xB7 checked ${e.board.checked}` : '';
|
|
10916
|
+
(t.push(`${r.bold('Tein prices')} ${r.green(e.currency)} ${e.count} models${i}`),
|
|
10861
10917
|
t.push(
|
|
10862
10918
|
`${r.dim('Starter, Plus and Scale. Creative mode, Priority and draft show only where published.')}`,
|
|
10863
10919
|
),
|
|
10864
10920
|
t.push(''));
|
|
10865
|
-
let
|
|
10921
|
+
let a = new Map();
|
|
10866
10922
|
for (let l of e.board.models) {
|
|
10867
10923
|
let c = l.kind || 'other',
|
|
10868
|
-
p =
|
|
10869
|
-
(p.push(l),
|
|
10924
|
+
p = a.get(c) ?? [];
|
|
10925
|
+
(p.push(l), a.set(c, p));
|
|
10870
10926
|
}
|
|
10871
10927
|
let n = ['video', 'image', 'audio', 'llm', 'text', '3d'],
|
|
10872
|
-
s = [...
|
|
10928
|
+
s = [...a.keys()].sort((l, c) => {
|
|
10873
10929
|
let p = n.indexOf(l),
|
|
10874
10930
|
d = n.indexOf(c);
|
|
10875
10931
|
return (p === -1 ? 99 : p) - (d === -1 ? 99 : d);
|
|
10876
10932
|
});
|
|
10877
10933
|
for (let l of s) {
|
|
10878
10934
|
t.push(`${r.bold(r.cyan(`\u2500\u2500 ${l} \u2500\u2500`))}`);
|
|
10879
|
-
for (let c of
|
|
10935
|
+
for (let c of a.get(l) ?? []) hr(c, t);
|
|
10880
10936
|
}
|
|
10881
10937
|
let o = new Set(e.board.models.map((l) => l.slug.toLowerCase())),
|
|
10882
10938
|
u = (e.configs ?? []).filter((l) => !o.has(String(l.modelSlug ?? '').toLowerCase()));
|
|
@@ -10893,7 +10949,7 @@ function yr(e) {
|
|
|
10893
10949
|
t.push(` ${r.bold(c.padEnd(26))} ${r.gray(d)}`);
|
|
10894
10950
|
for (let m of p) {
|
|
10895
10951
|
let y = String(m.displayLabel ?? m.billingUnit ?? 'price'),
|
|
10896
|
-
f =
|
|
10952
|
+
f = at(m.prices);
|
|
10897
10953
|
f && t.push(` ${y} ${f}`);
|
|
10898
10954
|
}
|
|
10899
10955
|
t.push('');
|
|
@@ -10906,13 +10962,13 @@ function yr(e) {
|
|
|
10906
10962
|
`
|
|
10907
10963
|
);
|
|
10908
10964
|
}
|
|
10909
|
-
async function
|
|
10965
|
+
async function ki(e) {
|
|
10910
10966
|
let t;
|
|
10911
10967
|
try {
|
|
10912
10968
|
t = await mr(e.apiUrl, e.model);
|
|
10913
|
-
} catch (
|
|
10914
|
-
let
|
|
10915
|
-
(process.stderr.write(`${r.red('Error:')} ${
|
|
10969
|
+
} catch (i) {
|
|
10970
|
+
let a = i instanceof Error ? i.message : String(i);
|
|
10971
|
+
(process.stderr.write(`${r.red('Error:')} ${a}
|
|
10916
10972
|
`),
|
|
10917
10973
|
process.exit(1));
|
|
10918
10974
|
}
|
|
@@ -10923,12 +10979,12 @@ async function ba(e) {
|
|
|
10923
10979
|
: yr(t),
|
|
10924
10980
|
);
|
|
10925
10981
|
}
|
|
10926
|
-
var
|
|
10927
|
-
|
|
10928
|
-
async function
|
|
10929
|
-
let
|
|
10930
|
-
|
|
10931
|
-
(
|
|
10982
|
+
var wi = T(require('node:path'));
|
|
10983
|
+
E();
|
|
10984
|
+
async function xi(e, t) {
|
|
10985
|
+
let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
10986
|
+
a = w(typeof t.api_url == 'string' ? t.api_url : void 0);
|
|
10987
|
+
(i ||
|
|
10932
10988
|
(process.stderr.write(`${r.red('Error:')} Authentication required.
|
|
10933
10989
|
`),
|
|
10934
10990
|
process.stderr
|
|
@@ -10944,8 +11000,8 @@ async function wa(e, t) {
|
|
|
10944
11000
|
let n = !!t.json,
|
|
10945
11001
|
s = !!t.wait,
|
|
10946
11002
|
o = typeof t.output == 'string' ? t.output : void 0,
|
|
10947
|
-
u = new M(
|
|
10948
|
-
l = new
|
|
11003
|
+
u = new M(i, a),
|
|
11004
|
+
l = new $(`Checking status of ${r.bold(e)}...`);
|
|
10949
11005
|
n || l.start();
|
|
10950
11006
|
let c;
|
|
10951
11007
|
try {
|
|
@@ -11018,9 +11074,9 @@ ${r.bold('Outputs:')}
|
|
|
11018
11074
|
`),
|
|
11019
11075
|
o)
|
|
11020
11076
|
) {
|
|
11021
|
-
let d = new
|
|
11077
|
+
let d = new $(`Downloading output to ${o}...`).start();
|
|
11022
11078
|
try {
|
|
11023
|
-
(await u.downloadOutput(p.url,
|
|
11079
|
+
(await u.downloadOutput(p.url, wi.default.resolve(process.cwd(), o)),
|
|
11024
11080
|
d.succeed(`Saved to ${r.bold(o)}`));
|
|
11025
11081
|
} catch (m) {
|
|
11026
11082
|
d.fail(`Failed to download: ${m instanceof Error ? m.message : m}`);
|
|
@@ -11037,12 +11093,12 @@ ${p.text}
|
|
|
11037
11093
|
}
|
|
11038
11094
|
var rt = T(require('node:fs')),
|
|
11039
11095
|
nt = T(require('node:path'));
|
|
11040
|
-
|
|
11041
|
-
async function
|
|
11042
|
-
let
|
|
11043
|
-
|
|
11096
|
+
E();
|
|
11097
|
+
async function _i(e, t = {}) {
|
|
11098
|
+
let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
11099
|
+
a = w(typeof t.api_url == 'string' ? t.api_url : void 0),
|
|
11044
11100
|
n = !!t.json;
|
|
11045
|
-
(
|
|
11101
|
+
(i ||
|
|
11046
11102
|
(process.stderr.write(`${r.red('Error:')} Authentication required.
|
|
11047
11103
|
`),
|
|
11048
11104
|
process.stderr
|
|
@@ -11062,8 +11118,8 @@ async function xa(e, t = {}) {
|
|
|
11062
11118
|
process.exit(1));
|
|
11063
11119
|
let o = nt.default.basename(s),
|
|
11064
11120
|
l = rt.default.readFileSync(s).toString('base64'),
|
|
11065
|
-
c = new M(
|
|
11066
|
-
p = new
|
|
11121
|
+
c = new M(i, a),
|
|
11122
|
+
p = new $(`Uploading ${r.bold(o)} to Tein AI CDN...`);
|
|
11067
11123
|
n || p.start();
|
|
11068
11124
|
try {
|
|
11069
11125
|
let d = await c.uploadAsset(l);
|
|
@@ -11105,7 +11161,7 @@ ${r.bold('CDN URL:')} ${r.green(d.url)}
|
|
|
11105
11161
|
re();
|
|
11106
11162
|
ee();
|
|
11107
11163
|
Le();
|
|
11108
|
-
function
|
|
11164
|
+
function Vi() {
|
|
11109
11165
|
process.stdout.write(`
|
|
11110
11166
|
${r.bold(r.cyan('Tein AI CLI'))} - Official Command-Line Interface for Tein AI models
|
|
11111
11167
|
|
|
@@ -11189,9 +11245,9 @@ ${r.bold('EXAMPLES:')}
|
|
|
11189
11245
|
}
|
|
11190
11246
|
async function Dr() {
|
|
11191
11247
|
let e = process.argv.slice(2),
|
|
11192
|
-
t =
|
|
11248
|
+
t = oi(e);
|
|
11193
11249
|
if (t.flags.has('help') || t.options.help || t.command === 'help') {
|
|
11194
|
-
|
|
11250
|
+
Vi();
|
|
11195
11251
|
return;
|
|
11196
11252
|
}
|
|
11197
11253
|
if (t.flags.has('version') || t.options.version || t.command === 'version') {
|
|
@@ -11201,32 +11257,32 @@ async function Dr() {
|
|
|
11201
11257
|
}
|
|
11202
11258
|
switch (t.command) {
|
|
11203
11259
|
case 'auth': {
|
|
11204
|
-
await
|
|
11260
|
+
await ie(t.subcommand, t.options.key);
|
|
11205
11261
|
break;
|
|
11206
11262
|
}
|
|
11207
11263
|
case 'login': {
|
|
11208
|
-
await
|
|
11264
|
+
await ie('login', t.options.key);
|
|
11209
11265
|
break;
|
|
11210
11266
|
}
|
|
11211
11267
|
case 'logout': {
|
|
11212
|
-
await
|
|
11268
|
+
await ie('logout');
|
|
11213
11269
|
break;
|
|
11214
11270
|
}
|
|
11215
11271
|
case 'whoami': {
|
|
11216
|
-
await
|
|
11272
|
+
await ie('status');
|
|
11217
11273
|
break;
|
|
11218
11274
|
}
|
|
11219
11275
|
case 'models':
|
|
11220
11276
|
case 'list': {
|
|
11221
|
-
await
|
|
11277
|
+
await yi(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0);
|
|
11222
11278
|
break;
|
|
11223
11279
|
}
|
|
11224
11280
|
case 'pricing':
|
|
11225
11281
|
case 'prices': {
|
|
11226
|
-
let
|
|
11227
|
-
|
|
11228
|
-
await
|
|
11229
|
-
model:
|
|
11282
|
+
let i = t.options.model,
|
|
11283
|
+
a = t.subcommand || (typeof i == 'string' ? i : void 0);
|
|
11284
|
+
await ki({
|
|
11285
|
+
model: a,
|
|
11230
11286
|
json: !!t.options.json,
|
|
11231
11287
|
apiUrl: typeof t.options.api_url == 'string' ? t.options.api_url : void 0,
|
|
11232
11288
|
});
|
|
@@ -11240,41 +11296,41 @@ async function Dr() {
|
|
|
11240
11296
|
process.stderr.write(`Usage: ${r.cyan('tein info <model-slug>')}
|
|
11241
11297
|
`),
|
|
11242
11298
|
process.exit(1)),
|
|
11243
|
-
await
|
|
11299
|
+
await bi(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0));
|
|
11244
11300
|
break;
|
|
11245
11301
|
}
|
|
11246
11302
|
case 'upload': {
|
|
11247
|
-
let
|
|
11248
|
-
await
|
|
11303
|
+
let i = t.subcommand || '';
|
|
11304
|
+
await _i(i, t.options);
|
|
11249
11305
|
break;
|
|
11250
11306
|
}
|
|
11251
11307
|
case 'run':
|
|
11252
11308
|
case 'generate': {
|
|
11253
|
-
let
|
|
11254
|
-
await Qe(
|
|
11309
|
+
let i = t.subcommand || '';
|
|
11310
|
+
await Qe(i, t.options);
|
|
11255
11311
|
break;
|
|
11256
11312
|
}
|
|
11257
11313
|
case 'status': {
|
|
11258
|
-
let
|
|
11259
|
-
await
|
|
11314
|
+
let i = t.subcommand || '';
|
|
11315
|
+
await xi(i, t.options);
|
|
11260
11316
|
break;
|
|
11261
11317
|
}
|
|
11262
11318
|
case 'balance': {
|
|
11263
|
-
await
|
|
11319
|
+
await di(t.options);
|
|
11264
11320
|
break;
|
|
11265
11321
|
}
|
|
11266
11322
|
case 'usage': {
|
|
11267
|
-
await
|
|
11323
|
+
await fi(t.options);
|
|
11268
11324
|
break;
|
|
11269
11325
|
}
|
|
11270
11326
|
case 'transactions':
|
|
11271
11327
|
case 'history': {
|
|
11272
|
-
await
|
|
11328
|
+
await gi(t.options);
|
|
11273
11329
|
break;
|
|
11274
11330
|
}
|
|
11275
11331
|
case 'mcp': {
|
|
11276
|
-
let { startStdioServer:
|
|
11277
|
-
await
|
|
11332
|
+
let { startStdioServer: i } = await Promise.resolve().then(() => (Di(), Li));
|
|
11333
|
+
await i();
|
|
11278
11334
|
break;
|
|
11279
11335
|
}
|
|
11280
11336
|
default: {
|
|
@@ -11289,7 +11345,7 @@ Run ${r.cyan('tein --help')} for the commands, or ${r.cyan('tein models')} for t
|
|
|
11289
11345
|
await Qe(t.command, t.options));
|
|
11290
11346
|
return;
|
|
11291
11347
|
}
|
|
11292
|
-
|
|
11348
|
+
Vi();
|
|
11293
11349
|
break;
|
|
11294
11350
|
}
|
|
11295
11351
|
}
|