@teinai/cli 1.1.42 → 1.1.44
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 +1185 -1117
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
3
|
+
var wi = Object.create;
|
|
4
|
+
var Ke = Object.defineProperty;
|
|
5
|
+
var xi = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var ki = Object.getOwnPropertyNames;
|
|
7
|
+
var _i = Object.getPrototypeOf,
|
|
8
|
+
Pi = Object.prototype.hasOwnProperty;
|
|
9
9
|
var y = (e, t, r) => () => {
|
|
10
10
|
if (r) throw r[0];
|
|
11
11
|
try {
|
|
12
12
|
return (e && (t = e((e = 0))), t);
|
|
13
|
-
} catch (
|
|
14
|
-
throw ((r = [
|
|
13
|
+
} catch (i) {
|
|
14
|
+
throw ((r = [i]), i);
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
var
|
|
18
|
-
for (var r in t)
|
|
17
|
+
var Ii = (e, t) => {
|
|
18
|
+
for (var r in t) Ke(e, r, { get: t[r], enumerable: !0 });
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
vi = (e, t, r, i) => {
|
|
21
21
|
if ((t && typeof t == 'object') || typeof t == 'function')
|
|
22
|
-
for (let n of
|
|
23
|
-
!
|
|
22
|
+
for (let n of ki(t))
|
|
23
|
+
!Pi.call(e, n) &&
|
|
24
24
|
n !== r &&
|
|
25
|
-
|
|
25
|
+
Ke(e, n, { get: () => t[n], enumerable: !(i = xi(t, n)) || i.enumerable });
|
|
26
26
|
return e;
|
|
27
27
|
};
|
|
28
28
|
var M = (e, t, r) => (
|
|
29
|
-
(r = e != null ?
|
|
30
|
-
|
|
29
|
+
(r = e != null ? wi(_i(e)) : {}),
|
|
30
|
+
vi(t || !e || !e.__esModule ? Ke(r, 'default', { value: e, enumerable: !0 }) : r, e)
|
|
31
31
|
);
|
|
32
|
-
function
|
|
32
|
+
function Si(e) {
|
|
33
33
|
for (let t of e)
|
|
34
34
|
try {
|
|
35
|
-
let r = JSON.parse(
|
|
35
|
+
let r = JSON.parse(kt.default.readFileSync(t, 'utf8'));
|
|
36
36
|
if (r.name === '@teinai/cli' && typeof r.version == 'string' && r.version.trim())
|
|
37
37
|
return r.version.trim();
|
|
38
38
|
} catch {}
|
|
39
|
-
return
|
|
39
|
+
return Mi;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function Ki() {
|
|
42
42
|
let e = typeof __dirname == 'string' ? __dirname : process.cwd();
|
|
43
43
|
return [
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
Ee.default.join(e, 'package.json'),
|
|
45
|
+
Ee.default.join(e, '..', '..', 'cli-package', 'package.json'),
|
|
46
46
|
];
|
|
47
47
|
}
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
var kt,
|
|
49
|
+
Ee,
|
|
50
|
+
Mi,
|
|
51
51
|
z,
|
|
52
52
|
oe = y(() => {
|
|
53
53
|
'use strict';
|
|
54
|
-
((
|
|
55
|
-
z =
|
|
54
|
+
((kt = M(require('node:fs'))), (Ee = M(require('node:path'))), (Mi = '0.0.0-dev'));
|
|
55
|
+
z = Si(Ki());
|
|
56
56
|
});
|
|
57
57
|
function J() {
|
|
58
58
|
try {
|
|
@@ -63,12 +63,12 @@ function J() {
|
|
|
63
63
|
} catch {}
|
|
64
64
|
return {};
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function Ce(e) {
|
|
67
67
|
try {
|
|
68
|
-
L.default.existsSync(
|
|
68
|
+
L.default.existsSync(pe) || L.default.mkdirSync(pe, { recursive: !0, mode: 448 });
|
|
69
69
|
let r = { ...J(), ...e };
|
|
70
70
|
(L.default.writeFileSync(W, JSON.stringify(r, null, 2), { encoding: 'utf-8', mode: 384 }),
|
|
71
|
-
L.default.chmodSync(
|
|
71
|
+
L.default.chmodSync(pe, 448),
|
|
72
72
|
L.default.chmodSync(W, 384));
|
|
73
73
|
} catch (t) {
|
|
74
74
|
throw new Error(`Failed to save config to ${W}: ${t}`);
|
|
@@ -88,45 +88,45 @@ function x(e) {
|
|
|
88
88
|
let r = J();
|
|
89
89
|
return r.apiUrl && r.apiUrl.trim() ? r.apiUrl.trim().replace(/\/+$/, '') : 'https://api.tein.ai';
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function de() {
|
|
92
92
|
return W;
|
|
93
93
|
}
|
|
94
94
|
var L,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
Tt,
|
|
96
|
+
$e,
|
|
97
|
+
pe,
|
|
98
98
|
W,
|
|
99
99
|
R = y(() => {
|
|
100
100
|
'use strict';
|
|
101
101
|
((L = M(require('node:fs'))),
|
|
102
|
-
(
|
|
103
|
-
(
|
|
104
|
-
(
|
|
105
|
-
(W =
|
|
102
|
+
(Tt = M(require('node:os'))),
|
|
103
|
+
($e = M(require('node:path'))),
|
|
104
|
+
(pe = $e.default.join(Tt.default.homedir(), '.tein')),
|
|
105
|
+
(W = $e.default.join(pe, 'config.json')));
|
|
106
106
|
});
|
|
107
|
-
var
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
var Ri,
|
|
108
|
+
Mt,
|
|
109
|
+
St,
|
|
110
|
+
Kt = y(() => {
|
|
111
111
|
'use strict';
|
|
112
|
-
((
|
|
113
|
-
(
|
|
114
|
-
(
|
|
112
|
+
((Ri = ['1:1', '16:9', '9:16', '21:9', '3:2', '2:3', '4:3', '3:4', '4:5', '5:4']),
|
|
113
|
+
(Mt = [...Ri, 'auto']),
|
|
114
|
+
(St =
|
|
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
|
});
|
|
117
117
|
var ce,
|
|
118
|
-
|
|
118
|
+
Re = y(() => {
|
|
119
119
|
'use strict';
|
|
120
120
|
ce = new Set([]);
|
|
121
121
|
});
|
|
122
122
|
function Z(e) {
|
|
123
123
|
return !1;
|
|
124
124
|
}
|
|
125
|
-
var
|
|
125
|
+
var Et = y(() => {
|
|
126
126
|
'use strict';
|
|
127
127
|
});
|
|
128
128
|
var ue,
|
|
129
|
-
|
|
129
|
+
$t = y(() => {
|
|
130
130
|
'use strict';
|
|
131
131
|
ue = {
|
|
132
132
|
source: 'TEIN Price Board',
|
|
@@ -1505,6 +1505,13 @@ var ue,
|
|
|
1505
1505
|
resolution: '2K',
|
|
1506
1506
|
unfiltered: { starter: 0.0294, plus: 0.0279, scale: 0.0249 },
|
|
1507
1507
|
},
|
|
1508
|
+
{
|
|
1509
|
+
id: '4k',
|
|
1510
|
+
price: { starter: 0.0632, plus: 0.06, scale: 0.0537 },
|
|
1511
|
+
label: '4K',
|
|
1512
|
+
resolution: '4K',
|
|
1513
|
+
unfiltered: { starter: 0.0663, plus: 0.063, scale: 0.0563 },
|
|
1514
|
+
},
|
|
1508
1515
|
],
|
|
1509
1516
|
unfiltered: 0.05,
|
|
1510
1517
|
priority: null,
|
|
@@ -1518,7 +1525,7 @@ var ue,
|
|
|
1518
1525
|
unfiltered: { starter: 0.0067, plus: 0.0063, scale: 0.0056 },
|
|
1519
1526
|
},
|
|
1520
1527
|
],
|
|
1521
|
-
axes: { resolution: ['1K', '1.5K', '2K'] },
|
|
1528
|
+
axes: { resolution: ['1K', '1.5K', '2K', '4K'] },
|
|
1522
1529
|
from: { variant: '1k' },
|
|
1523
1530
|
},
|
|
1524
1531
|
{
|
|
@@ -5802,14 +5809,14 @@ var ue,
|
|
|
5802
5809
|
},
|
|
5803
5810
|
{
|
|
5804
5811
|
id: '1080p',
|
|
5805
|
-
price: { starter: 0.
|
|
5812
|
+
price: { starter: 0.0897, plus: 0.0897, scale: 0.0897 },
|
|
5806
5813
|
label: '1080p',
|
|
5807
5814
|
resolution: '1080p',
|
|
5808
5815
|
withVideo: !1,
|
|
5809
5816
|
},
|
|
5810
5817
|
{
|
|
5811
5818
|
id: '1080p-with-video',
|
|
5812
|
-
price: { starter: 0.
|
|
5819
|
+
price: { starter: 0.0897, plus: 0.0897, scale: 0.0897 },
|
|
5813
5820
|
label: '1080p \xB7 with reference video',
|
|
5814
5821
|
resolution: '1080p',
|
|
5815
5822
|
withVideo: !0,
|
|
@@ -6303,14 +6310,14 @@ var ue,
|
|
|
6303
6310
|
],
|
|
6304
6311
|
};
|
|
6305
6312
|
});
|
|
6306
|
-
var
|
|
6307
|
-
|
|
6313
|
+
var Ct,
|
|
6314
|
+
At = y(() => {
|
|
6308
6315
|
'use strict';
|
|
6309
|
-
|
|
6316
|
+
Ct = [];
|
|
6310
6317
|
});
|
|
6311
6318
|
var me,
|
|
6312
|
-
|
|
6313
|
-
|
|
6319
|
+
Rt,
|
|
6320
|
+
Oe = y(() => {
|
|
6314
6321
|
'use strict';
|
|
6315
6322
|
((me = [
|
|
6316
6323
|
{
|
|
@@ -6387,12 +6394,12 @@ var me,
|
|
|
6387
6394
|
from: { variant: 'swap' },
|
|
6388
6395
|
},
|
|
6389
6396
|
]),
|
|
6390
|
-
(
|
|
6397
|
+
(Rt = [{ slug: 'tein-labs', name: 'Tein Labs', models: ['tein-video-upscaler', 'doppel'] }]));
|
|
6391
6398
|
});
|
|
6392
|
-
function
|
|
6399
|
+
function De(e, t) {
|
|
6393
6400
|
return `${e.trim().toLowerCase()}|${(t ?? '').trim().toLowerCase()}`;
|
|
6394
6401
|
}
|
|
6395
|
-
function
|
|
6402
|
+
function qi(e, t) {
|
|
6396
6403
|
if (e === 'seedance-2-mini') return 'mini';
|
|
6397
6404
|
if (e !== 'seedance-2') return;
|
|
6398
6405
|
let r = typeof t?.quality == 'string' ? t.quality.trim().toLowerCase() : '';
|
|
@@ -6402,103 +6409,104 @@ function Ei(e, t) {
|
|
|
6402
6409
|
? 'fast'
|
|
6403
6410
|
: 'standard';
|
|
6404
6411
|
}
|
|
6405
|
-
function
|
|
6412
|
+
function Li(e, t) {
|
|
6406
6413
|
let r = e
|
|
6407
6414
|
.trim()
|
|
6408
6415
|
.toLowerCase()
|
|
6409
6416
|
.replace(/-(?:unfiltered|uncensored)$/, '');
|
|
6410
6417
|
if (r === 'seedance-2' || r === 'seedance-2-mini') {
|
|
6411
|
-
let n =
|
|
6412
|
-
s =
|
|
6418
|
+
let n = qi(r, t),
|
|
6419
|
+
s = qe.get(De('seedance-2', n));
|
|
6413
6420
|
return s ? s.slug : null;
|
|
6414
6421
|
}
|
|
6415
|
-
let
|
|
6416
|
-
return
|
|
6422
|
+
let i = fe.get(r) ?? qe.get(De(r));
|
|
6423
|
+
return i ? i.slug : null;
|
|
6417
6424
|
}
|
|
6418
|
-
function
|
|
6419
|
-
return fe.has(e) && !(
|
|
6425
|
+
function Ni(e, t) {
|
|
6426
|
+
return fe.has(e) && !(Di.has(e) && t) ? e : Li(e, t);
|
|
6420
6427
|
}
|
|
6421
6428
|
function B(e, t) {
|
|
6422
|
-
let r =
|
|
6429
|
+
let r = Ni(e, t);
|
|
6423
6430
|
return r ? (fe.get(r) ?? null) : null;
|
|
6424
6431
|
}
|
|
6425
|
-
function
|
|
6432
|
+
function Vt(e, t) {
|
|
6426
6433
|
return `${e}/addon/${t}`;
|
|
6427
6434
|
}
|
|
6428
|
-
function
|
|
6429
|
-
return
|
|
6435
|
+
function Ut(e) {
|
|
6436
|
+
return Nt.get(e) ?? null;
|
|
6430
6437
|
}
|
|
6431
6438
|
function ge() {
|
|
6432
|
-
return
|
|
6439
|
+
return Dt;
|
|
6433
6440
|
}
|
|
6434
|
-
var
|
|
6435
|
-
At,
|
|
6436
|
-
Rt,
|
|
6437
|
-
Ot,
|
|
6438
|
-
Ki,
|
|
6439
|
-
fe,
|
|
6440
|
-
Oe,
|
|
6441
|
-
Ct,
|
|
6441
|
+
var Ne,
|
|
6442
6442
|
qt,
|
|
6443
|
+
Lt,
|
|
6444
|
+
Dt,
|
|
6445
|
+
Oi,
|
|
6446
|
+
fe,
|
|
6443
6447
|
qe,
|
|
6444
|
-
|
|
6448
|
+
Ot,
|
|
6449
|
+
Nt,
|
|
6450
|
+
Le,
|
|
6451
|
+
Di,
|
|
6445
6452
|
j = y(() => {
|
|
6446
6453
|
'use strict';
|
|
6447
|
-
Mt();
|
|
6448
|
-
St();
|
|
6449
6454
|
Et();
|
|
6450
|
-
|
|
6451
|
-
(
|
|
6455
|
+
$t();
|
|
6456
|
+
At();
|
|
6457
|
+
Oe();
|
|
6458
|
+
((Ne = {
|
|
6452
6459
|
...ue,
|
|
6453
6460
|
families: ue.families.map((e) => ({ ...e, models: e.models.filter((t) => !Z(t)) })),
|
|
6454
6461
|
models: ue.models.filter((e) => !Z(e.slug)),
|
|
6455
6462
|
}),
|
|
6456
|
-
(
|
|
6457
|
-
(
|
|
6458
|
-
(
|
|
6459
|
-
(
|
|
6460
|
-
...
|
|
6461
|
-
let t =
|
|
6463
|
+
(qt = me.filter((e) => !Z(e.slug))),
|
|
6464
|
+
(Lt = Ct.filter((e) => !Z(e.slug) && !Ne.models.some((t) => t.slug === e.slug))),
|
|
6465
|
+
(Dt = [...Ne.models, ...Lt, ...qt]),
|
|
6466
|
+
(Oi = [
|
|
6467
|
+
...Ne.families.map((e) => {
|
|
6468
|
+
let t = Lt.filter((r) => r.family === e.slug).map((r) => r.slug);
|
|
6462
6469
|
return t.length ? { ...e, models: [...e.models, ...t] } : e;
|
|
6463
6470
|
}),
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
.filter((
|
|
6471
|
+
...Rt.map((e) => ({
|
|
6472
|
+
...e,
|
|
6473
|
+
models: qt.filter((t) => t.family === e.slug).map((t) => t.slug),
|
|
6474
|
+
})).filter((e) => e.models.length > 0),
|
|
6467
6475
|
]),
|
|
6468
6476
|
(fe = new Map()),
|
|
6469
|
-
(
|
|
6470
|
-
(
|
|
6471
|
-
(
|
|
6472
|
-
(
|
|
6473
|
-
for (let e of
|
|
6474
|
-
(fe.set(e.slug, e),
|
|
6475
|
-
for (let t of e.variants)
|
|
6477
|
+
(qe = new Map()),
|
|
6478
|
+
(Ot = new Map()),
|
|
6479
|
+
(Nt = new Map()),
|
|
6480
|
+
(Le = new Map()));
|
|
6481
|
+
for (let e of Dt) {
|
|
6482
|
+
(fe.set(e.slug, e), qe.set(De(e.api.model, e.api.quality), e));
|
|
6483
|
+
for (let t of e.variants) Ot.set(`${e.slug}/${t.id}`, { model: e, variant: t, edit: !1 });
|
|
6476
6484
|
for (let t of e.editVariants ?? [])
|
|
6477
|
-
|
|
6478
|
-
for (let t of e.addons ?? [])
|
|
6479
|
-
|
|
6485
|
+
Ot.set(`${e.slug}/edit/${t.id}`, { model: e, variant: t, edit: !0 });
|
|
6486
|
+
for (let t of e.addons ?? []) Nt.set(`${e.slug}/addon/${t.id}`, { model: e, addon: t });
|
|
6487
|
+
Le.set(e.slug, e.family);
|
|
6480
6488
|
}
|
|
6481
|
-
for (let e of
|
|
6482
|
-
|
|
6489
|
+
for (let e of Oi) for (let t of e.models) Le.has(t) || Le.set(t, e.slug);
|
|
6490
|
+
Di = new Set(['seedance-2']);
|
|
6483
6491
|
});
|
|
6484
6492
|
function he(e) {
|
|
6485
6493
|
let t = e.from?.variant;
|
|
6486
6494
|
return (t && e.variants.find((r) => r.id === t)) || e.variants[0];
|
|
6487
6495
|
}
|
|
6488
|
-
function
|
|
6496
|
+
function Ve(e) {
|
|
6489
6497
|
if (e.endpoints?.length)
|
|
6490
|
-
return e.editVariants?.length && e.endpoints.some((t) => t.id ===
|
|
6491
|
-
?
|
|
6498
|
+
return e.editVariants?.length && e.endpoints.some((t) => t.id === Ft)
|
|
6499
|
+
? Ft
|
|
6492
6500
|
: (e.defaultEndpoint ?? e.endpoints[0].id);
|
|
6493
6501
|
}
|
|
6494
|
-
var
|
|
6495
|
-
|
|
6502
|
+
var Ft,
|
|
6503
|
+
Ue = y(() => {
|
|
6496
6504
|
'use strict';
|
|
6497
6505
|
j();
|
|
6498
|
-
|
|
6506
|
+
Ft = 'dynamic';
|
|
6499
6507
|
});
|
|
6500
|
-
function
|
|
6501
|
-
return
|
|
6508
|
+
function Fi(e) {
|
|
6509
|
+
return Vt(e, Vi);
|
|
6502
6510
|
}
|
|
6503
6511
|
function ye(e) {
|
|
6504
6512
|
let t = e.toFixed(5).replace(/0+$/, '');
|
|
@@ -6507,43 +6515,43 @@ function ye(e) {
|
|
|
6507
6515
|
(t.split('.')[1] ?? '').length < 2 ? `$${e.toFixed(2)}` : `$${t}`
|
|
6508
6516
|
);
|
|
6509
6517
|
}
|
|
6510
|
-
function
|
|
6518
|
+
function Fe(e) {
|
|
6511
6519
|
return e.starter === e.plus && e.plus === e.scale
|
|
6512
6520
|
? `${ye(e.starter)} on every plan`
|
|
6513
6521
|
: `${ye(e.starter)} on Starter, ${ye(e.plus)} on Plus, ${ye(e.scale)} on Scale`;
|
|
6514
6522
|
}
|
|
6515
|
-
function
|
|
6523
|
+
function Bt(e) {
|
|
6516
6524
|
let t = [],
|
|
6517
|
-
r =
|
|
6518
|
-
|
|
6519
|
-
if (
|
|
6525
|
+
r = Ui[e],
|
|
6526
|
+
i = r != null ? Ut(Fi(e)) : null;
|
|
6527
|
+
if (i && r != null) {
|
|
6520
6528
|
let n =
|
|
6521
|
-
|
|
6529
|
+
i.addon.unfiltered && Fe(i.addon.unfiltered) === Fe(i.addon.price)
|
|
6522
6530
|
? ', Creative mode included'
|
|
6523
6531
|
: '';
|
|
6524
|
-
t.push(`Each reference image after the ${
|
|
6532
|
+
t.push(`Each reference image after the ${ji[r] ?? `${r}th`} adds ${Fe(i.addon.price)}${n}.`);
|
|
6525
6533
|
}
|
|
6526
6534
|
return (
|
|
6527
|
-
|
|
6535
|
+
Bi.has(e) &&
|
|
6528
6536
|
t.push(
|
|
6529
6537
|
'With reference videos (multiple references mode), their seconds are billed with the output, at the same price per second (a 5 s video with a 10 s reference video bills 15 s).',
|
|
6530
6538
|
),
|
|
6531
6539
|
t
|
|
6532
6540
|
);
|
|
6533
6541
|
}
|
|
6534
|
-
var
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6542
|
+
var Vi,
|
|
6543
|
+
Ui,
|
|
6544
|
+
Bi,
|
|
6545
|
+
ji,
|
|
6546
|
+
jt = y(() => {
|
|
6539
6547
|
'use strict';
|
|
6540
6548
|
j();
|
|
6541
|
-
((
|
|
6542
|
-
|
|
6543
|
-
|
|
6549
|
+
((Vi = 'extra-image-input'), (Ui = { 'seedream-5-pro': 1, 'minimax-h3': 5 }));
|
|
6550
|
+
Bi = new Set(['minimax-h3']);
|
|
6551
|
+
ji = { 1: 'first', 5: '5th' };
|
|
6544
6552
|
});
|
|
6545
6553
|
var be,
|
|
6546
|
-
|
|
6554
|
+
Be = y(() => {
|
|
6547
6555
|
'use strict';
|
|
6548
6556
|
be = {
|
|
6549
6557
|
'gemini-3-8-flash': 'gemini-3.8-flash',
|
|
@@ -6555,29 +6563,29 @@ var be,
|
|
|
6555
6563
|
'gpt-image-2-6-sunburst': 'gpt-image-2.6-sunburst',
|
|
6556
6564
|
};
|
|
6557
6565
|
});
|
|
6558
|
-
var
|
|
6566
|
+
var Gt = y(() => {
|
|
6559
6567
|
'use strict';
|
|
6560
6568
|
});
|
|
6561
|
-
function
|
|
6562
|
-
return typeof t == 'string' && (
|
|
6569
|
+
function Ht(e, t) {
|
|
6570
|
+
return typeof t == 'string' && (Gi[e]?.includes(t) ?? !1);
|
|
6563
6571
|
}
|
|
6564
|
-
var
|
|
6565
|
-
|
|
6572
|
+
var Gi,
|
|
6573
|
+
zt = y(() => {
|
|
6566
6574
|
'use strict';
|
|
6567
6575
|
j();
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6576
|
+
Ue();
|
|
6577
|
+
Gt();
|
|
6578
|
+
Gi = {};
|
|
6571
6579
|
});
|
|
6572
|
-
function
|
|
6573
|
-
return e === 'nano-banana-pro' ?
|
|
6580
|
+
function Wt(e) {
|
|
6581
|
+
return e === 'nano-banana-pro' ? Hi : zi;
|
|
6574
6582
|
}
|
|
6575
|
-
var
|
|
6576
|
-
|
|
6577
|
-
|
|
6583
|
+
var Hi,
|
|
6584
|
+
zi,
|
|
6585
|
+
Jt = y(() => {
|
|
6578
6586
|
'use strict';
|
|
6579
|
-
((
|
|
6580
|
-
(
|
|
6587
|
+
((Hi = ['auto', '1:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9']),
|
|
6588
|
+
(zi = [
|
|
6581
6589
|
'auto',
|
|
6582
6590
|
'1:1',
|
|
6583
6591
|
'1:4',
|
|
@@ -6595,10 +6603,10 @@ var Vi,
|
|
|
6595
6603
|
'21:9',
|
|
6596
6604
|
]));
|
|
6597
6605
|
});
|
|
6598
|
-
var
|
|
6599
|
-
|
|
6606
|
+
var Yt,
|
|
6607
|
+
Xt = y(() => {
|
|
6600
6608
|
'use strict';
|
|
6601
|
-
|
|
6609
|
+
Yt = [
|
|
6602
6610
|
'prompt',
|
|
6603
6611
|
'system',
|
|
6604
6612
|
'messages',
|
|
@@ -6612,10 +6620,10 @@ var zt,
|
|
|
6612
6620
|
'endpoint',
|
|
6613
6621
|
];
|
|
6614
6622
|
});
|
|
6615
|
-
var
|
|
6616
|
-
|
|
6623
|
+
var Qt,
|
|
6624
|
+
Zt = y(() => {
|
|
6617
6625
|
'use strict';
|
|
6618
|
-
|
|
6626
|
+
Qt = [
|
|
6619
6627
|
{
|
|
6620
6628
|
slug: 'claude-fable-5-1',
|
|
6621
6629
|
family: 'fable-5-1',
|
|
@@ -6684,13 +6692,13 @@ var Jt,
|
|
|
6684
6692
|
},
|
|
6685
6693
|
];
|
|
6686
6694
|
});
|
|
6687
|
-
function
|
|
6695
|
+
function er(e) {
|
|
6688
6696
|
return `$${e}`;
|
|
6689
6697
|
}
|
|
6690
|
-
function
|
|
6698
|
+
function je(e, t, r) {
|
|
6691
6699
|
return B(e)?.variants.find((n) => n.endpoint === t && n.component === r)?.price.starter ?? null;
|
|
6692
6700
|
}
|
|
6693
|
-
function
|
|
6701
|
+
function Wi(e) {
|
|
6694
6702
|
return [
|
|
6695
6703
|
{
|
|
6696
6704
|
name: 'prompt',
|
|
@@ -6756,17 +6764,17 @@ function Fi(e) {
|
|
|
6756
6764
|
},
|
|
6757
6765
|
];
|
|
6758
6766
|
}
|
|
6759
|
-
function
|
|
6760
|
-
let t =
|
|
6761
|
-
r =
|
|
6762
|
-
return t != null && r != null ? `${
|
|
6767
|
+
function tr(e) {
|
|
6768
|
+
let t = je(e, 'cheap', 'input'),
|
|
6769
|
+
r = je(e, 'cheap', 'output');
|
|
6770
|
+
return t != null && r != null ? `${er(t)}/M in \xB7 ${er(r)}/M out` : '';
|
|
6763
6771
|
}
|
|
6764
|
-
function
|
|
6772
|
+
function rr() {
|
|
6765
6773
|
return Object.fromEntries(
|
|
6766
|
-
|
|
6767
|
-
let t =
|
|
6768
|
-
r =
|
|
6769
|
-
|
|
6774
|
+
Qt.map((e) => {
|
|
6775
|
+
let t = je(e.slug, 'stable', 'input') != null,
|
|
6776
|
+
r = tr(e.slug),
|
|
6777
|
+
i = {
|
|
6770
6778
|
slug: e.slug,
|
|
6771
6779
|
name: e.name,
|
|
6772
6780
|
category: 'Text',
|
|
@@ -6776,50 +6784,50 @@ function Zt() {
|
|
|
6776
6784
|
priceFormatted: r,
|
|
6777
6785
|
unit: '/M tokens',
|
|
6778
6786
|
primaryToolName: 'run_task',
|
|
6779
|
-
parameters:
|
|
6787
|
+
parameters: Wi(t),
|
|
6780
6788
|
};
|
|
6781
|
-
return [e.slug,
|
|
6789
|
+
return [e.slug, i];
|
|
6782
6790
|
}),
|
|
6783
6791
|
);
|
|
6784
6792
|
}
|
|
6785
|
-
var
|
|
6793
|
+
var ir = y(() => {
|
|
6786
6794
|
'use strict';
|
|
6787
|
-
|
|
6795
|
+
Zt();
|
|
6788
6796
|
j();
|
|
6789
6797
|
});
|
|
6790
6798
|
function we(e) {
|
|
6791
|
-
return e ?
|
|
6799
|
+
return e ? Yi.get(e) : void 0;
|
|
6792
6800
|
}
|
|
6793
|
-
function
|
|
6801
|
+
function or(e, t) {
|
|
6794
6802
|
return !e.aspects?.length || e.sourceFramedModes?.includes(t)
|
|
6795
6803
|
? null
|
|
6796
6804
|
: e.adaptiveModes?.includes(t)
|
|
6797
6805
|
? [...e.aspects, 'adaptive']
|
|
6798
6806
|
: [...e.aspects];
|
|
6799
6807
|
}
|
|
6800
|
-
function
|
|
6808
|
+
function lr(e, t, r) {
|
|
6801
6809
|
return e.modes.includes('motion_control')
|
|
6802
6810
|
? t === 'motion_control'
|
|
6803
|
-
? !
|
|
6804
|
-
: !
|
|
6811
|
+
? !Qi.includes(r)
|
|
6812
|
+
: !Xi.includes(r)
|
|
6805
6813
|
: !0;
|
|
6806
6814
|
}
|
|
6807
|
-
var
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
je,
|
|
6814
|
-
ss,
|
|
6815
|
+
var ar,
|
|
6816
|
+
Ji,
|
|
6817
|
+
nr,
|
|
6818
|
+
ms,
|
|
6819
|
+
Yi,
|
|
6820
|
+
sr,
|
|
6815
6821
|
Ge,
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6822
|
+
fs,
|
|
6823
|
+
He,
|
|
6824
|
+
Xi,
|
|
6825
|
+
Qi,
|
|
6826
|
+
ze = y(() => {
|
|
6819
6827
|
'use strict';
|
|
6820
|
-
((
|
|
6821
|
-
(
|
|
6822
|
-
(
|
|
6828
|
+
((ar = ['16:9', '9:16', '1:1', '21:9']),
|
|
6829
|
+
(Ji = ['16:9', '9:16', '1:1', '4:3', '3:4', '21:9']),
|
|
6830
|
+
(nr = [
|
|
6823
6831
|
{
|
|
6824
6832
|
slug: 'kling-v4',
|
|
6825
6833
|
kind: 'video',
|
|
@@ -6827,7 +6835,7 @@ var tr,
|
|
|
6827
6835
|
promptMax: 26e3,
|
|
6828
6836
|
duration: { min: 3, max: 30, default: 5 },
|
|
6829
6837
|
heights: { '720p': 720, '1080p': 1080 },
|
|
6830
|
-
aspects:
|
|
6838
|
+
aspects: ar,
|
|
6831
6839
|
sourceFramedModes: ['image_to_video'],
|
|
6832
6840
|
adaptiveModes: ['multi_reference'],
|
|
6833
6841
|
fps: 24,
|
|
@@ -6851,7 +6859,7 @@ var tr,
|
|
|
6851
6859
|
promptMax: 26e3,
|
|
6852
6860
|
duration: { min: 3, max: 20, default: 5 },
|
|
6853
6861
|
heights: { '720p': 720 },
|
|
6854
|
-
aspects: [...
|
|
6862
|
+
aspects: [...ar, '4:3', '3:4'],
|
|
6855
6863
|
sourceFramedModes: ['image_to_video'],
|
|
6856
6864
|
adaptiveModes: ['multi_reference'],
|
|
6857
6865
|
fps: 24,
|
|
@@ -6891,7 +6899,7 @@ var tr,
|
|
|
6891
6899
|
promptMax: 65535,
|
|
6892
6900
|
duration: { min: 5, max: 15, default: 5 },
|
|
6893
6901
|
heights: { '480p': 480, '768p': 768 },
|
|
6894
|
-
aspects:
|
|
6902
|
+
aspects: Ji,
|
|
6895
6903
|
fps: 24,
|
|
6896
6904
|
audio: 'free',
|
|
6897
6905
|
seed: !0,
|
|
@@ -6966,10 +6974,10 @@ var tr,
|
|
|
6966
6974
|
seed: !0,
|
|
6967
6975
|
},
|
|
6968
6976
|
]),
|
|
6969
|
-
(
|
|
6970
|
-
(
|
|
6971
|
-
((
|
|
6972
|
-
(
|
|
6977
|
+
(ms = nr.map((e) => e.slug)),
|
|
6978
|
+
(Yi = new Map(nr.map((e) => [e.slug, e]))));
|
|
6979
|
+
((sr = 'EXAVITQu4vr4xnSDxMaL'),
|
|
6980
|
+
(Ge = {
|
|
6973
6981
|
hpp4J3VqNfWAUOO0d1Us: 'Bella',
|
|
6974
6982
|
CwhRBWXzGAHq8TQ4Fs17: 'Roger',
|
|
6975
6983
|
EXAVITQu4vr4xnSDxMaL: 'Sarah',
|
|
@@ -6991,8 +6999,8 @@ var tr,
|
|
|
6991
6999
|
pqHfZKP75CvOlQylNhV4: 'Bill',
|
|
6992
7000
|
pNInz6obpgDQGcFmaJgB: 'Adam',
|
|
6993
7001
|
}),
|
|
6994
|
-
(
|
|
6995
|
-
(
|
|
7002
|
+
(fs = Object.keys(Ge)),
|
|
7003
|
+
(He = [
|
|
6996
7004
|
'mp3_44100_128',
|
|
6997
7005
|
'mp3_22050_32',
|
|
6998
7006
|
'mp3_24000_48',
|
|
@@ -7006,8 +7014,8 @@ var tr,
|
|
|
7006
7014
|
'opus_48000_128',
|
|
7007
7015
|
'opus_48000_192',
|
|
7008
7016
|
]));
|
|
7009
|
-
((
|
|
7010
|
-
(
|
|
7017
|
+
((Xi = ['image_url', 'video_url', 'character_orientation', 'keep_original_sound']),
|
|
7018
|
+
(Qi = [
|
|
7011
7019
|
'duration',
|
|
7012
7020
|
'aspect_ratio',
|
|
7013
7021
|
'generate_audio',
|
|
@@ -7019,7 +7027,7 @@ var tr,
|
|
|
7019
7027
|
'audios',
|
|
7020
7028
|
]));
|
|
7021
7029
|
});
|
|
7022
|
-
function
|
|
7030
|
+
function ea() {
|
|
7023
7031
|
return [
|
|
7024
7032
|
{
|
|
7025
7033
|
name: 'image_url',
|
|
@@ -7047,10 +7055,10 @@ function Wi() {
|
|
|
7047
7055
|
},
|
|
7048
7056
|
];
|
|
7049
7057
|
}
|
|
7050
|
-
function
|
|
7058
|
+
function ta(e) {
|
|
7051
7059
|
let t = e.duration,
|
|
7052
7060
|
r = Object.keys(e.heights),
|
|
7053
|
-
|
|
7061
|
+
i = e.sourceFramedModes?.length
|
|
7054
7062
|
? ` Not taken by ${e.sourceFramedModes.join(', ')}: the source image sets the frame.`
|
|
7055
7063
|
: '',
|
|
7056
7064
|
n = e.modeRequired ? void 0 : e.modes[0],
|
|
@@ -7077,7 +7085,7 @@ function Ji(e) {
|
|
|
7077
7085
|
type: 'select',
|
|
7078
7086
|
...(s ? {} : { default: e.aspects[0] }),
|
|
7079
7087
|
options: [...e.aspects, ...(e.adaptiveModes?.length ? ['adaptive'] : [])],
|
|
7080
|
-
description: `The frame.${e.adaptiveModes?.length ? ` adaptive: ${e.adaptiveModes.join(', ')} only.` : ''}${
|
|
7088
|
+
description: `The frame.${e.adaptiveModes?.length ? ` adaptive: ${e.adaptiveModes.join(', ')} only.` : ''}${i}`,
|
|
7081
7089
|
},
|
|
7082
7090
|
];
|
|
7083
7091
|
if (
|
|
@@ -7115,32 +7123,32 @@ function Ji(e) {
|
|
|
7115
7123
|
}),
|
|
7116
7124
|
e.reference?.maxVideos)
|
|
7117
7125
|
) {
|
|
7118
|
-
let
|
|
7126
|
+
let p = e.reference,
|
|
7119
7127
|
l = e.videoInputBilling
|
|
7120
7128
|
? ` Billed as input plus output seconds${e.videoInputBilling.minOutputMultiple > 1 ? `, at least ${e.videoInputBilling.minOutputMultiple}x the output` : ''}.`
|
|
7121
7129
|
: '';
|
|
7122
7130
|
o.push({
|
|
7123
7131
|
name: 'videos',
|
|
7124
7132
|
type: 'string[]',
|
|
7125
|
-
description: `multi_reference: up to ${
|
|
7133
|
+
description: `multi_reference: up to ${p.maxVideos} reference videos${p.videoClipMinSeconds ? `, each longer than ${p.videoClipMinSeconds} s` : ''}${p.videoSides ? `, ${p.videoSides.min} to ${p.videoSides.max} px tall and wide` : ''}${p.maxVideoSeconds ? `, ${p.maxVideoSeconds} s in all` : ''}.${e.referenceHandles ? ' In the prompt, name them @Video1, @Video2, ... in this order.' : ''}${l} ${D}`,
|
|
7126
7134
|
});
|
|
7127
7135
|
}
|
|
7128
7136
|
if (e.reference?.maxAudios) {
|
|
7129
|
-
let
|
|
7130
|
-
l =
|
|
7131
|
-
? `, each ${
|
|
7132
|
-
:
|
|
7133
|
-
? `, ${
|
|
7137
|
+
let p = e.reference,
|
|
7138
|
+
l = p.audioClipSeconds
|
|
7139
|
+
? `, each ${p.audioClipSeconds.min} to ${p.audioClipSeconds.max} s`
|
|
7140
|
+
: p.maxAudioSeconds
|
|
7141
|
+
? `, ${p.maxAudioSeconds} s in all`
|
|
7134
7142
|
: '';
|
|
7135
7143
|
o.push({
|
|
7136
7144
|
name: 'audios',
|
|
7137
7145
|
type: 'string[]',
|
|
7138
|
-
description: `multi_reference: up to ${
|
|
7146
|
+
description: `multi_reference: up to ${p.maxAudios} reference audios${l}, with at least one image or video. ${D}`,
|
|
7139
7147
|
});
|
|
7140
7148
|
}
|
|
7141
7149
|
return o;
|
|
7142
7150
|
}
|
|
7143
|
-
function
|
|
7151
|
+
function ra(e) {
|
|
7144
7152
|
let t = Object.keys(e.sizes);
|
|
7145
7153
|
return [
|
|
7146
7154
|
{
|
|
@@ -7157,13 +7165,13 @@ function Yi(e) {
|
|
|
7157
7165
|
},
|
|
7158
7166
|
];
|
|
7159
7167
|
}
|
|
7160
|
-
function
|
|
7168
|
+
function aa() {
|
|
7161
7169
|
return [
|
|
7162
7170
|
{
|
|
7163
7171
|
name: 'voice_id',
|
|
7164
7172
|
type: 'string',
|
|
7165
|
-
default:
|
|
7166
|
-
description: `text_to_speech: the ElevenLabs voice id, one of: ${
|
|
7173
|
+
default: sr,
|
|
7174
|
+
description: `text_to_speech: the ElevenLabs voice id, one of: ${ia}.`,
|
|
7167
7175
|
},
|
|
7168
7176
|
{
|
|
7169
7177
|
name: 'turns',
|
|
@@ -7171,7 +7179,7 @@ function Qi() {
|
|
|
7171
7179
|
description:
|
|
7172
7180
|
'dialogue: a JSON list of {voice_id, text}, up to 20 turns, 10 voices and 2000 characters in all; plain text is refused. Each voice_id is one of the voice_id voices. Leave prompt out.',
|
|
7173
7181
|
},
|
|
7174
|
-
{ name: 'output_format', type: 'select', default:
|
|
7182
|
+
{ name: 'output_format', type: 'select', default: He[0], options: [...He] },
|
|
7175
7183
|
{ name: 'stability', type: 'number', min: 0, max: 1, description: 'Voice stability, 0 to 1.' },
|
|
7176
7184
|
{
|
|
7177
7185
|
name: 'similarity_boost',
|
|
@@ -7182,7 +7190,7 @@ function Qi() {
|
|
|
7182
7190
|
},
|
|
7183
7191
|
];
|
|
7184
7192
|
}
|
|
7185
|
-
function
|
|
7193
|
+
function pr(e) {
|
|
7186
7194
|
let t = e.promptOptionalModes?.length ? ` Optional on ${e.promptOptionalModes.join(', ')}.` : '',
|
|
7187
7195
|
r = [
|
|
7188
7196
|
{
|
|
@@ -7197,26 +7205,26 @@ function sr(e) {
|
|
|
7197
7205
|
required: !0,
|
|
7198
7206
|
...(e.modeRequired ? {} : { default: e.modes[0] }),
|
|
7199
7207
|
options: [...e.modes],
|
|
7200
|
-
description: `${e.modeRequired ? 'Required. ' : ''}${e.modes.map((
|
|
7208
|
+
description: `${e.modeRequired ? 'Required. ' : ''}${e.modes.map((i) => Zi[i]).join(' ')}`,
|
|
7201
7209
|
},
|
|
7202
7210
|
];
|
|
7203
7211
|
return (
|
|
7204
|
-
e.kind === 'video' ? r.push(...
|
|
7205
|
-
e.modes.includes('motion_control') && r.push(...
|
|
7212
|
+
e.kind === 'video' ? r.push(...ta(e)) : e.kind === 'image' ? r.push(...ra(e)) : r.push(...aa()),
|
|
7213
|
+
e.modes.includes('motion_control') && r.push(...ea()),
|
|
7206
7214
|
e.seed &&
|
|
7207
7215
|
r.push({ name: 'seed', type: 'number', min: 0, description: 'Seed for repeatable runs.' }),
|
|
7208
7216
|
r
|
|
7209
7217
|
);
|
|
7210
7218
|
}
|
|
7211
7219
|
var D,
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7220
|
+
Zi,
|
|
7221
|
+
ia,
|
|
7222
|
+
dr = y(() => {
|
|
7215
7223
|
'use strict';
|
|
7216
|
-
|
|
7224
|
+
ze();
|
|
7217
7225
|
((D =
|
|
7218
7226
|
'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.'),
|
|
7219
|
-
(
|
|
7227
|
+
(Zi = {
|
|
7220
7228
|
text_to_video: 'text_to_video: from the prompt alone.',
|
|
7221
7229
|
image_to_video: 'image_to_video: a start image in first_frame_image.',
|
|
7222
7230
|
first_n_last_frames: 'first_n_last_frames: first_frame_image and last_frame_image.',
|
|
@@ -7228,44 +7236,44 @@ var D,
|
|
|
7228
7236
|
motion_control:
|
|
7229
7237
|
'motion_control: the character in image_url performs the motion of video_url; length and frame follow the video.',
|
|
7230
7238
|
}));
|
|
7231
|
-
|
|
7239
|
+
ia = Object.entries(Ge)
|
|
7232
7240
|
.map(([e, t]) => `${e} (${t})`)
|
|
7233
7241
|
.join(', ');
|
|
7234
7242
|
});
|
|
7235
|
-
function
|
|
7243
|
+
function mr(e) {
|
|
7236
7244
|
return e === xe || e === ke;
|
|
7237
7245
|
}
|
|
7238
7246
|
var xe,
|
|
7239
|
-
lr,
|
|
7240
|
-
ke,
|
|
7241
|
-
dr,
|
|
7242
|
-
ze,
|
|
7243
7247
|
cr,
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
|
|
7248
|
+
ke,
|
|
7249
|
+
ur,
|
|
7250
|
+
We,
|
|
7251
|
+
fr,
|
|
7252
|
+
bs,
|
|
7253
|
+
ws,
|
|
7254
|
+
xs,
|
|
7255
|
+
ks,
|
|
7256
|
+
gr = y(() => {
|
|
7249
7257
|
'use strict';
|
|
7250
7258
|
((xe = 'enhancor-ultrafine'),
|
|
7251
|
-
(
|
|
7259
|
+
(cr = 'Enhancor Ultrafine'),
|
|
7252
7260
|
(ke = 'enhancor-deblur'),
|
|
7253
|
-
(
|
|
7254
|
-
((
|
|
7255
|
-
(
|
|
7256
|
-
(
|
|
7257
|
-
(
|
|
7258
|
-
(
|
|
7259
|
-
(
|
|
7261
|
+
(ur = 'Enhancor Deblur'));
|
|
7262
|
+
((We = { skin: [2, 3, 4], noSkin: [2, 3, 4, 8, 16] }),
|
|
7263
|
+
(fr = 2),
|
|
7264
|
+
(bs = 24 * 1024 * 1024),
|
|
7265
|
+
(ws = 4096 * 4096),
|
|
7266
|
+
(xs = 30 * 6e4),
|
|
7267
|
+
(ks = 120 * 6e4));
|
|
7260
7268
|
});
|
|
7261
|
-
var
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7269
|
+
var na,
|
|
7270
|
+
hr,
|
|
7271
|
+
sa,
|
|
7272
|
+
Je,
|
|
7273
|
+
yr = y(() => {
|
|
7266
7274
|
'use strict';
|
|
7267
|
-
((
|
|
7268
|
-
(
|
|
7275
|
+
((na = ['natural', 'pores', 'freckles', 'more_freckles', 'blemish', 'glow', 'unblur']),
|
|
7276
|
+
(hr = {
|
|
7269
7277
|
natural: 'Natural',
|
|
7270
7278
|
pores: 'Pores',
|
|
7271
7279
|
freckles: 'Freckles',
|
|
@@ -7274,12 +7282,12 @@ var Zi,
|
|
|
7274
7282
|
glow: 'Glow',
|
|
7275
7283
|
unblur: 'Unblur',
|
|
7276
7284
|
}),
|
|
7277
|
-
(
|
|
7278
|
-
(
|
|
7285
|
+
(sa = 'unblur'),
|
|
7286
|
+
(Je = na.filter((e) => e !== sa)));
|
|
7279
7287
|
});
|
|
7280
7288
|
var ee,
|
|
7281
7289
|
_e,
|
|
7282
|
-
|
|
7290
|
+
Ye = y(() => {
|
|
7283
7291
|
'use strict';
|
|
7284
7292
|
((ee = [
|
|
7285
7293
|
'seedance-2-5',
|
|
@@ -7296,10 +7304,34 @@ var ee,
|
|
|
7296
7304
|
(_e =
|
|
7297
7305
|
'a request with creative_mode: true answers 503 checkpoint_unavailable and nothing is charged'));
|
|
7298
7306
|
});
|
|
7307
|
+
function oa(e) {
|
|
7308
|
+
return br.includes(e);
|
|
7309
|
+
}
|
|
7310
|
+
function Pe(e = process.env) {
|
|
7311
|
+
let t = String(e.IMAGE_PRIORITY_MODELS ?? ''),
|
|
7312
|
+
r = new Set(
|
|
7313
|
+
t
|
|
7314
|
+
.split(',')
|
|
7315
|
+
.map((i) => i.trim().toLowerCase())
|
|
7316
|
+
.filter(Boolean),
|
|
7317
|
+
);
|
|
7318
|
+
return br.filter((i) => r.has(i));
|
|
7319
|
+
}
|
|
7320
|
+
function wr(e, t = process.env) {
|
|
7321
|
+
return oa(e) && Pe(t).includes(e);
|
|
7322
|
+
}
|
|
7323
|
+
function xr(e) {
|
|
7324
|
+
return e === 'nano-banana-pro' ? 'Nano Banana Pro' : 'Nano Banana 2.1';
|
|
7325
|
+
}
|
|
7326
|
+
var br,
|
|
7327
|
+
Xe = y(() => {
|
|
7328
|
+
'use strict';
|
|
7329
|
+
br = ['nano-banana-2.1', 'nano-banana-pro'];
|
|
7330
|
+
});
|
|
7299
7331
|
function te(e) {
|
|
7300
7332
|
return `$${Number(e.toFixed(5))}`;
|
|
7301
7333
|
}
|
|
7302
|
-
function
|
|
7334
|
+
function it(e) {
|
|
7303
7335
|
if (e.kind === 'llm') {
|
|
7304
7336
|
let t = e.defaultEndpoint,
|
|
7305
7337
|
r = (s) =>
|
|
@@ -7309,28 +7341,28 @@ function tt(e) {
|
|
|
7309
7341
|
(!t || !o.endpoint || o.endpoint === t) &&
|
|
7310
7342
|
(!o.context || o.context === '0\u201332K'),
|
|
7311
7343
|
),
|
|
7312
|
-
|
|
7344
|
+
i = r('input'),
|
|
7313
7345
|
n = r('output');
|
|
7314
|
-
return
|
|
7315
|
-
? `${te(
|
|
7346
|
+
return i && n
|
|
7347
|
+
? `${te(i.price.starter)}/M in \xB7 ${te(n.price.starter)}/M out`
|
|
7316
7348
|
: `from ${te(he(e).price.starter)}/M tokens`;
|
|
7317
7349
|
}
|
|
7318
7350
|
return `from ${te(he(e).price.starter)}${e.unit}`;
|
|
7319
7351
|
}
|
|
7320
|
-
function
|
|
7321
|
-
let r = t.filter((
|
|
7352
|
+
function da(e, t) {
|
|
7353
|
+
let r = t.filter((i) => Number.isFinite(i) && i > 0);
|
|
7322
7354
|
return r.length ? `from ${te(Math.min(...r))}${e}` : null;
|
|
7323
7355
|
}
|
|
7324
|
-
function
|
|
7356
|
+
function Ir(e) {
|
|
7325
7357
|
for (let t of ce) {
|
|
7326
7358
|
let r = Y[t],
|
|
7327
|
-
|
|
7328
|
-
r &&
|
|
7359
|
+
i = r ? da(r.unit, e[t] ?? []) : null;
|
|
7360
|
+
r && i && (r.priceFormatted = i);
|
|
7329
7361
|
}
|
|
7330
7362
|
}
|
|
7331
7363
|
function A(e, t) {
|
|
7332
7364
|
let r = e.axes?.resolution ?? [
|
|
7333
|
-
...new Set(e.variants.map((
|
|
7365
|
+
...new Set(e.variants.map((i) => i.resolution).filter((i) => !!i)),
|
|
7334
7366
|
];
|
|
7335
7367
|
return {
|
|
7336
7368
|
name: 'resolution',
|
|
@@ -7340,13 +7372,13 @@ function A(e, t) {
|
|
|
7340
7372
|
...(t ? { description: t } : {}),
|
|
7341
7373
|
};
|
|
7342
7374
|
}
|
|
7343
|
-
function
|
|
7375
|
+
function vr(e) {
|
|
7344
7376
|
if (!e.endpoints?.length) return null;
|
|
7345
|
-
let t = e.endpoints.filter((r) =>
|
|
7377
|
+
let t = e.endpoints.filter((r) => Ht(e.slug, r.id));
|
|
7346
7378
|
return {
|
|
7347
7379
|
name: 'endpoint',
|
|
7348
7380
|
type: 'select',
|
|
7349
|
-
default:
|
|
7381
|
+
default: Ve(e),
|
|
7350
7382
|
options: e.endpoints.filter((r) => !t.includes(r)).map((r) => r.id),
|
|
7351
7383
|
description:
|
|
7352
7384
|
(e.slug === 'gemini-3.1-pro-preview'
|
|
@@ -7355,55 +7387,55 @@ function wr(e) {
|
|
|
7355
7387
|
(t.length ? ` ${t.map((r) => r.label).join(' and ')}: coming soon.` : ''),
|
|
7356
7388
|
};
|
|
7357
7389
|
}
|
|
7358
|
-
function
|
|
7359
|
-
if (e.unfiltered == null || t.some((
|
|
7390
|
+
function ua(e, t) {
|
|
7391
|
+
if (e.unfiltered == null || t.some((i) => i.name === 'creative_mode')) return t;
|
|
7360
7392
|
let r = ee.includes(e.api.model);
|
|
7361
|
-
return [...t.filter((
|
|
7393
|
+
return [...t.filter((i) => !Ie.has(i.name)), r ? nt : ca];
|
|
7362
7394
|
}
|
|
7363
|
-
function
|
|
7364
|
-
let r = e.filter((n) => !
|
|
7365
|
-
|
|
7366
|
-
return (
|
|
7395
|
+
function Qe(e, t) {
|
|
7396
|
+
let r = e.filter((n) => !Ie.has(n.name)),
|
|
7397
|
+
i = [nt, Tr];
|
|
7398
|
+
return (i.push(st, ot), [...r, ...i]);
|
|
7367
7399
|
}
|
|
7368
|
-
function
|
|
7400
|
+
function ha(e) {
|
|
7369
7401
|
return [
|
|
7370
7402
|
...e
|
|
7371
|
-
.filter((t) => !
|
|
7403
|
+
.filter((t) => !fa.has(t.name) && !Ie.has(t.name))
|
|
7372
7404
|
.map((t) => {
|
|
7373
7405
|
if (t.name === 'resolution')
|
|
7374
7406
|
return {
|
|
7375
7407
|
...t,
|
|
7376
7408
|
...(t.options
|
|
7377
7409
|
? {
|
|
7378
|
-
options: t.options.filter((
|
|
7379
|
-
['480p', '720p'].includes(String(
|
|
7410
|
+
options: t.options.filter((i) =>
|
|
7411
|
+
['480p', '720p'].includes(String(i).toLowerCase()),
|
|
7380
7412
|
),
|
|
7381
7413
|
}
|
|
7382
7414
|
: {}),
|
|
7383
7415
|
description: `Output resolution: 480p or 720p (8-bit). This tier has no 1080p or 4k. ${re}`,
|
|
7384
7416
|
};
|
|
7385
|
-
let r =
|
|
7417
|
+
let r = ga[t.name];
|
|
7386
7418
|
return r && typeof t.description == 'string'
|
|
7387
7419
|
? { ...t, description: t.description.replace(/\(up to [^)]*\)/, `(${r})`) }
|
|
7388
7420
|
: t;
|
|
7389
7421
|
}),
|
|
7390
|
-
it,
|
|
7391
|
-
xr,
|
|
7392
|
-
at,
|
|
7393
7422
|
nt,
|
|
7423
|
+
Tr,
|
|
7424
|
+
st,
|
|
7425
|
+
ot,
|
|
7394
7426
|
];
|
|
7395
7427
|
}
|
|
7396
|
-
function
|
|
7428
|
+
function Mr(e) {
|
|
7397
7429
|
return (
|
|
7398
7430
|
e.startsWith('seedance-2-5-') &&
|
|
7399
7431
|
e !== 'seedance-2-5-lite' &&
|
|
7400
7432
|
!/-(creative-mode|unfiltered|uncensored)$/.test(e)
|
|
7401
7433
|
);
|
|
7402
7434
|
}
|
|
7403
|
-
function
|
|
7435
|
+
function kr(e, t = {}) {
|
|
7404
7436
|
return [
|
|
7405
7437
|
...e
|
|
7406
|
-
.filter((r) => !
|
|
7438
|
+
.filter((r) => !ma.has(r.name) && !Ie.has(r.name))
|
|
7407
7439
|
.map((r) =>
|
|
7408
7440
|
r.name === 'prompt'
|
|
7409
7441
|
? { ...r, required: !0 }
|
|
@@ -7411,7 +7443,7 @@ function gr(e, t = {}) {
|
|
|
7411
7443
|
? {
|
|
7412
7444
|
...r,
|
|
7413
7445
|
...(t.no4k && r.options
|
|
7414
|
-
? { options: r.options.filter((
|
|
7446
|
+
? { options: r.options.filter((i) => String(i).toLowerCase() !== '4k') }
|
|
7415
7447
|
: {}),
|
|
7416
7448
|
description: `Output resolution. TEIN LITE is the lower-priced endpoint for getting started. Stability and reliability are not guaranteed. ${re}`,
|
|
7417
7449
|
}
|
|
@@ -7424,11 +7456,11 @@ function gr(e, t = {}) {
|
|
|
7424
7456
|
options: ['standard'],
|
|
7425
7457
|
description: 'LITE uses standard bitrate. High bitrate is on the standard endpoint.',
|
|
7426
7458
|
},
|
|
7427
|
-
|
|
7428
|
-
|
|
7459
|
+
st,
|
|
7460
|
+
ot,
|
|
7429
7461
|
];
|
|
7430
7462
|
}
|
|
7431
|
-
function
|
|
7463
|
+
function Ze(e, t) {
|
|
7432
7464
|
return [
|
|
7433
7465
|
S('Text prompt describing the video.'),
|
|
7434
7466
|
{ name: 'mode', type: 'select', required: !0, default: t.modes[0], options: t.modes },
|
|
@@ -7457,13 +7489,13 @@ function Xe(e, t) {
|
|
|
7457
7489
|
),
|
|
7458
7490
|
];
|
|
7459
7491
|
}
|
|
7460
|
-
function
|
|
7492
|
+
function ya(e, t) {
|
|
7461
7493
|
return e.map((r) =>
|
|
7462
7494
|
t[r.name] ? { ...r, description: `${r.description ?? ''} ${t[r.name]}`.trim() } : r,
|
|
7463
7495
|
);
|
|
7464
7496
|
}
|
|
7465
|
-
function
|
|
7466
|
-
let t =
|
|
7497
|
+
function ba(e) {
|
|
7498
|
+
let t = vr(e);
|
|
7467
7499
|
return [
|
|
7468
7500
|
S('Image prompt text. Supports complex composition and text instructions.'),
|
|
7469
7501
|
...(t ? [t] : []),
|
|
@@ -7476,14 +7508,14 @@ function ca(e) {
|
|
|
7476
7508
|
A(
|
|
7477
7509
|
e,
|
|
7478
7510
|
e.slug === 'gpt-image-2'
|
|
7479
|
-
? `1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count. ${
|
|
7511
|
+
? `1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count. ${St}`
|
|
7480
7512
|
: '1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count.',
|
|
7481
7513
|
),
|
|
7482
7514
|
{
|
|
7483
7515
|
name: 'aspect_ratio',
|
|
7484
7516
|
type: 'select',
|
|
7485
7517
|
default: 'auto',
|
|
7486
|
-
options: [...
|
|
7518
|
+
options: [...Mt],
|
|
7487
7519
|
description:
|
|
7488
7520
|
"The frame. auto: an edit keeps its first input image's ratio (the nearest listed one), text to image is 1:1. The image is delivered at exactly the size for the ratio and resolution.",
|
|
7489
7521
|
},
|
|
@@ -7530,7 +7562,7 @@ function ca(e) {
|
|
|
7530
7562
|
},
|
|
7531
7563
|
];
|
|
7532
7564
|
}
|
|
7533
|
-
function
|
|
7565
|
+
function wa(e) {
|
|
7534
7566
|
return [
|
|
7535
7567
|
S('Image prompt text.'),
|
|
7536
7568
|
{
|
|
@@ -7538,7 +7570,7 @@ function ua(e) {
|
|
|
7538
7570
|
type: 'string[]',
|
|
7539
7571
|
description: 'Images to edit or use as reference (up to 14).',
|
|
7540
7572
|
},
|
|
7541
|
-
{ name: 'aspect_ratio', type: 'select', default: '1:1', options: [...
|
|
7573
|
+
{ name: 'aspect_ratio', type: 'select', default: '1:1', options: [...Wt(e.slug)] },
|
|
7542
7574
|
A(e),
|
|
7543
7575
|
{
|
|
7544
7576
|
name: 'n',
|
|
@@ -7564,10 +7596,10 @@ function ua(e) {
|
|
|
7564
7596
|
},
|
|
7565
7597
|
];
|
|
7566
7598
|
}
|
|
7567
|
-
function
|
|
7568
|
-
let e =
|
|
7599
|
+
function Pa() {
|
|
7600
|
+
let e = Yt,
|
|
7569
7601
|
t = [];
|
|
7570
|
-
for (let r of
|
|
7602
|
+
for (let r of lt(!0))
|
|
7571
7603
|
e.includes(r.name) &&
|
|
7572
7604
|
(t.push({
|
|
7573
7605
|
...r,
|
|
@@ -7589,12 +7621,12 @@ function ha() {
|
|
|
7589
7621
|
}));
|
|
7590
7622
|
return t;
|
|
7591
7623
|
}
|
|
7592
|
-
function
|
|
7593
|
-
return
|
|
7624
|
+
function Ia() {
|
|
7625
|
+
return lt(!0).map((e) =>
|
|
7594
7626
|
e.name === 'max_tokens' || e.name === 'max_completion_tokens' ? { ...e, min: 128 } : e,
|
|
7595
7627
|
);
|
|
7596
7628
|
}
|
|
7597
|
-
function
|
|
7629
|
+
function lt(e) {
|
|
7598
7630
|
return [
|
|
7599
7631
|
S('The user message or task.'),
|
|
7600
7632
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
@@ -7689,21 +7721,21 @@ function st(e) {
|
|
|
7689
7721
|
},
|
|
7690
7722
|
];
|
|
7691
7723
|
}
|
|
7692
|
-
function
|
|
7693
|
-
if (e.slug === 'seed-2-1-turbo') return
|
|
7694
|
-
let t =
|
|
7724
|
+
function va(e) {
|
|
7725
|
+
if (e.slug === 'seed-2-1-turbo') return ka;
|
|
7726
|
+
let t = vr(e);
|
|
7695
7727
|
return [
|
|
7696
7728
|
...(e.slug === 'gemini-3.1-pro-preview'
|
|
7697
|
-
?
|
|
7729
|
+
? Pa()
|
|
7698
7730
|
: e.slug === 'gemini-3.7-flash'
|
|
7699
|
-
?
|
|
7700
|
-
: e.slug === 'gpt-6-astra' ||
|
|
7701
|
-
?
|
|
7702
|
-
:
|
|
7731
|
+
? Ia()
|
|
7732
|
+
: e.slug === 'gpt-6-astra' || _a.includes(e.slug)
|
|
7733
|
+
? lt(e.slug !== 'gpt-6-astra')
|
|
7734
|
+
: xa),
|
|
7703
7735
|
...(t ? [t] : []),
|
|
7704
7736
|
];
|
|
7705
7737
|
}
|
|
7706
|
-
function
|
|
7738
|
+
function et() {
|
|
7707
7739
|
return {
|
|
7708
7740
|
name: 'image',
|
|
7709
7741
|
type: 'string',
|
|
@@ -7711,7 +7743,7 @@ function Qe() {
|
|
|
7711
7743
|
description: 'The photo to fix: one JPEG or PNG URL.',
|
|
7712
7744
|
};
|
|
7713
7745
|
}
|
|
7714
|
-
function
|
|
7746
|
+
function Ma(e) {
|
|
7715
7747
|
return [
|
|
7716
7748
|
{
|
|
7717
7749
|
name: 'video_url',
|
|
@@ -7733,7 +7765,7 @@ function xa(e) {
|
|
|
7733
7765
|
},
|
|
7734
7766
|
];
|
|
7735
7767
|
}
|
|
7736
|
-
function
|
|
7768
|
+
function Sa() {
|
|
7737
7769
|
return [
|
|
7738
7770
|
{
|
|
7739
7771
|
name: 'mode',
|
|
@@ -7804,30 +7836,30 @@ function ka() {
|
|
|
7804
7836
|
},
|
|
7805
7837
|
];
|
|
7806
7838
|
}
|
|
7807
|
-
function
|
|
7839
|
+
function Ka(e) {
|
|
7808
7840
|
let t = e.slug;
|
|
7809
|
-
if (e.family === 'tein-labs' && e.kind === 'image') return
|
|
7810
|
-
if (me.some((
|
|
7811
|
-
if (e.kind === 'llm') return
|
|
7812
|
-
if (e.editVariants?.length) return
|
|
7841
|
+
if (e.family === 'tein-labs' && e.kind === 'image') return Sa();
|
|
7842
|
+
if (me.some((i) => i.slug === t)) return Ma(e);
|
|
7843
|
+
if (e.kind === 'llm') return va(e);
|
|
7844
|
+
if (e.editVariants?.length) return ba(e);
|
|
7813
7845
|
let r = we(t);
|
|
7814
|
-
if (r) return
|
|
7815
|
-
if (
|
|
7846
|
+
if (r) return pr(r);
|
|
7847
|
+
if (Mr(t)) return ha(tt);
|
|
7816
7848
|
switch (t) {
|
|
7817
7849
|
case 'seedance-2-5':
|
|
7818
|
-
return
|
|
7850
|
+
return Qe(tt, t);
|
|
7819
7851
|
case 'seedance-2-5-lite':
|
|
7820
|
-
return
|
|
7852
|
+
return kr(tt, { no4k: !0 });
|
|
7821
7853
|
case 'seedance-2':
|
|
7822
|
-
return
|
|
7854
|
+
return Qe(_r, t);
|
|
7823
7855
|
case 'seedance-2-lite':
|
|
7824
|
-
return
|
|
7856
|
+
return kr(_r);
|
|
7825
7857
|
case 'seedance-2-mini':
|
|
7826
|
-
return
|
|
7858
|
+
return Qe(Ea, t);
|
|
7827
7859
|
case 'nano-banana-2':
|
|
7828
7860
|
case 'nano-banana-2.1':
|
|
7829
7861
|
case 'nano-banana-pro':
|
|
7830
|
-
return
|
|
7862
|
+
return wa(e);
|
|
7831
7863
|
case 'seedream-5-pro':
|
|
7832
7864
|
return [
|
|
7833
7865
|
S('Detailed description of the image to generate.'),
|
|
@@ -7906,7 +7938,7 @@ function _a(e) {
|
|
|
7906
7938
|
},
|
|
7907
7939
|
A(
|
|
7908
7940
|
e,
|
|
7909
|
-
'1K and 1.5K are one price, 2K the next. layer_decomposition
|
|
7941
|
+
'1K and 1.5K are one price, 2K the next, 4K (up to 3840x2160 or 2880x2880) the top. 4K needs an aspect_ratio other than adaptive, or exact pixels in size. layer_decomposition takes 1K, 1.5K, 2K or auto (keep the input size), billed at the 2K price.',
|
|
7910
7942
|
),
|
|
7911
7943
|
{
|
|
7912
7944
|
name: 'aspect_ratio',
|
|
@@ -7915,6 +7947,12 @@ function _a(e) {
|
|
|
7915
7947
|
options: ['1:1', '4:3', '3:4', '16:9', '9:16', '3:2', '2:3', '21:9', 'adaptive'],
|
|
7916
7948
|
description: 'Not used by layer_decomposition. adaptive lets the prompt pick the shape.',
|
|
7917
7949
|
},
|
|
7950
|
+
{
|
|
7951
|
+
name: 'size',
|
|
7952
|
+
type: 'string',
|
|
7953
|
+
description:
|
|
7954
|
+
'Exact output pixels as <width>x<height>, e.g. 3840x2160, in place of resolution and aspect_ratio (the image comes back at exactly that size). 1280x720 up to 8,294,400 pixels (3840x2160 or 2880x2880), sides at most 16 to 1. Billed at the price its pixels reach: up to 2.61 MP the 1K / 1.5K price, up to 4.63 MP 2K, above that 4K. Not used by layer_decomposition.',
|
|
7955
|
+
},
|
|
7918
7956
|
{
|
|
7919
7957
|
name: 'background',
|
|
7920
7958
|
type: 'select',
|
|
@@ -8066,7 +8104,7 @@ function _a(e) {
|
|
|
8066
8104
|
];
|
|
8067
8105
|
case 'enhancor-skin-fix-v1':
|
|
8068
8106
|
return [
|
|
8069
|
-
|
|
8107
|
+
et(),
|
|
8070
8108
|
{
|
|
8071
8109
|
name: 'mode',
|
|
8072
8110
|
type: 'select',
|
|
@@ -8099,11 +8137,11 @@ function _a(e) {
|
|
|
8099
8137
|
max: 0.4,
|
|
8100
8138
|
description: 'Portrait depth. Heavy only.',
|
|
8101
8139
|
},
|
|
8102
|
-
...
|
|
8140
|
+
...Ta,
|
|
8103
8141
|
];
|
|
8104
8142
|
case 'enhancor-skin-fix-v3':
|
|
8105
8143
|
return [
|
|
8106
|
-
|
|
8144
|
+
et(),
|
|
8107
8145
|
{
|
|
8108
8146
|
name: 'mask_image',
|
|
8109
8147
|
type: 'string',
|
|
@@ -8143,7 +8181,7 @@ function _a(e) {
|
|
|
8143
8181
|
];
|
|
8144
8182
|
case 'enhancor-skin-fix-v4':
|
|
8145
8183
|
return [
|
|
8146
|
-
|
|
8184
|
+
et(),
|
|
8147
8185
|
{
|
|
8148
8186
|
name: 'mode',
|
|
8149
8187
|
type: 'select',
|
|
@@ -8174,7 +8212,7 @@ function _a(e) {
|
|
|
8174
8212
|
];
|
|
8175
8213
|
case 'wan-3-0':
|
|
8176
8214
|
case 'wan-3-0-prime':
|
|
8177
|
-
return
|
|
8215
|
+
return Ze(e, {
|
|
8178
8216
|
modes: ['text_to_video', 'first_n_last_frames', 'multi_reference'],
|
|
8179
8217
|
aspects: ['16:9', '9:16', '4:3', '3:4', '1:1', 'adaptive'],
|
|
8180
8218
|
minSec: 2,
|
|
@@ -8184,7 +8222,7 @@ function _a(e) {
|
|
|
8184
8222
|
});
|
|
8185
8223
|
case 'happy-horse-1-1':
|
|
8186
8224
|
case 'happy-horse-1-0':
|
|
8187
|
-
return
|
|
8225
|
+
return Ze(e, {
|
|
8188
8226
|
modes:
|
|
8189
8227
|
t === 'happy-horse-1-0'
|
|
8190
8228
|
? ['text-to-video', 'single-image', 'multi-reference', 'video-editing']
|
|
@@ -8275,13 +8313,19 @@ function _a(e) {
|
|
|
8275
8313
|
max: 30,
|
|
8276
8314
|
description: 'Video length in whole seconds: 4 to 15 at 720p, 4 to 30 at 1080p.',
|
|
8277
8315
|
},
|
|
8278
|
-
{
|
|
8316
|
+
{
|
|
8317
|
+
...A(
|
|
8318
|
+
e,
|
|
8319
|
+
'Sound is the same price on or off. A 1080p run takes 5 to 15 minutes, sometimes longer.',
|
|
8320
|
+
),
|
|
8321
|
+
default: '720p',
|
|
8322
|
+
},
|
|
8279
8323
|
{
|
|
8280
8324
|
name: 'aspect_ratio',
|
|
8281
8325
|
type: 'select',
|
|
8282
8326
|
options: ['16:9', '9:16', '1:1', '4:3', '3:4', '21:9'],
|
|
8283
8327
|
description:
|
|
8284
|
-
'text_to_video and multi_reference (left out: 16:9). image_to_video
|
|
8328
|
+
'text_to_video and multi_reference only (left out: 16:9). image_to_video takes no ratio: the video follows the start image.',
|
|
8285
8329
|
},
|
|
8286
8330
|
{
|
|
8287
8331
|
name: 'generate_audio',
|
|
@@ -8316,12 +8360,12 @@ function _a(e) {
|
|
|
8316
8360
|
name: 'audios',
|
|
8317
8361
|
type: 'string[]',
|
|
8318
8362
|
description:
|
|
8319
|
-
'multi_reference: reference audio, MP3 or WAV (up to 3 at 720p
|
|
8363
|
+
'multi_reference: reference audio, MP3 or WAV (up to 3 at 720p, 5 at 1080p), always with at least one reference image or video.',
|
|
8320
8364
|
},
|
|
8321
8365
|
];
|
|
8322
8366
|
case 'minimax-h3':
|
|
8323
|
-
return
|
|
8324
|
-
|
|
8367
|
+
return ya(
|
|
8368
|
+
Ze(e, {
|
|
8325
8369
|
modes: ['text_to_video', 'first_n_last_frames', 'multi_reference'],
|
|
8326
8370
|
aspects: ['16:9', '21:9', '4:3', '1:1', '3:4', '9:16', 'adaptive'],
|
|
8327
8371
|
minSec: 4,
|
|
@@ -8339,7 +8383,7 @@ function _a(e) {
|
|
|
8339
8383
|
return [S('Prompt text.')];
|
|
8340
8384
|
}
|
|
8341
8385
|
}
|
|
8342
|
-
function
|
|
8386
|
+
function Er() {
|
|
8343
8387
|
let e = (t, r) => ({
|
|
8344
8388
|
name: t,
|
|
8345
8389
|
type: 'slider',
|
|
@@ -8360,7 +8404,7 @@ function vr() {
|
|
|
8360
8404
|
),
|
|
8361
8405
|
];
|
|
8362
8406
|
}
|
|
8363
|
-
function
|
|
8407
|
+
function $r(e) {
|
|
8364
8408
|
return {
|
|
8365
8409
|
name: 'image',
|
|
8366
8410
|
type: 'string',
|
|
@@ -8368,10 +8412,10 @@ function Ir(e) {
|
|
|
8368
8412
|
description: `The photo to ${e}: one JPEG, PNG or WebP URL, up to 24 MB and 16.7 MP, with a shorter side of at least 256 px. HEIC/HEIF isn't supported.`,
|
|
8369
8413
|
};
|
|
8370
8414
|
}
|
|
8371
|
-
function
|
|
8415
|
+
function $a() {
|
|
8372
8416
|
return {
|
|
8373
8417
|
slug: xe,
|
|
8374
|
-
name:
|
|
8418
|
+
name: cr,
|
|
8375
8419
|
category: 'Image',
|
|
8376
8420
|
kind: 'Image-to-Image',
|
|
8377
8421
|
vendor: 'Enhancor',
|
|
@@ -8379,14 +8423,14 @@ function va() {
|
|
|
8379
8423
|
'Upscales a photo, with an optional skin preset that gives AI or smooth skin real texture first (Natural, Pores, Freckles, More freckles, Blemish, Glow). Full makes the picture its size times the scale; Fast makes a fixed size (long side 2432 px). For a blurry photo use Enhancor Deblur (enhancor-deblur).',
|
|
8380
8424
|
priceFormatted: '',
|
|
8381
8425
|
unit: '/img',
|
|
8382
|
-
primaryToolName:
|
|
8426
|
+
primaryToolName: at.image,
|
|
8383
8427
|
parameters: [
|
|
8384
|
-
|
|
8428
|
+
$r('upscale'),
|
|
8385
8429
|
{
|
|
8386
8430
|
name: 'preset',
|
|
8387
8431
|
type: 'select',
|
|
8388
|
-
options: [...
|
|
8389
|
-
description: `Skin preset, run before the upscale: ${
|
|
8432
|
+
options: [...Je],
|
|
8433
|
+
description: `Skin preset, run before the upscale: ${Je.map((e) => `${e} (${hr[e]})`).join(', ')}. Seedream 5.5 redraws the skin at about the photo's own size and shape, keeping the person, the background and any text; that picture is brought back to the photo's size and upscaled, so the output is still the photo times the scale. Priced at the skin rate. Leave it out for a plain upscale.`,
|
|
8390
8434
|
},
|
|
8391
8435
|
{
|
|
8392
8436
|
name: 'skin_fix',
|
|
@@ -8394,16 +8438,16 @@ function va() {
|
|
|
8394
8438
|
default: !1,
|
|
8395
8439
|
description: 'Same as preset natural. Off by default.',
|
|
8396
8440
|
},
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
...
|
|
8441
|
+
Cr,
|
|
8442
|
+
Ar,
|
|
8443
|
+
...Er(),
|
|
8400
8444
|
],
|
|
8401
8445
|
};
|
|
8402
8446
|
}
|
|
8403
|
-
function
|
|
8447
|
+
function Ca() {
|
|
8404
8448
|
return {
|
|
8405
8449
|
slug: ke,
|
|
8406
|
-
name:
|
|
8450
|
+
name: ur,
|
|
8407
8451
|
category: 'Image',
|
|
8408
8452
|
kind: 'Image-to-Image',
|
|
8409
8453
|
vendor: 'Enhancor',
|
|
@@ -8411,72 +8455,78 @@ function Ia() {
|
|
|
8411
8455
|
'Sharpens a blurry or soft photo and upscales it: Seedream 5.5 unblurs the photo at about its own size and shape, keeping the same person, face, freckles and moles, then that picture is upscaled. Full makes the picture its size times the scale; Fast makes a fixed size (long side 2432 px). No prompt.',
|
|
8412
8456
|
priceFormatted: '',
|
|
8413
8457
|
unit: '/img',
|
|
8414
|
-
primaryToolName:
|
|
8415
|
-
parameters: [
|
|
8458
|
+
primaryToolName: at.image,
|
|
8459
|
+
parameters: [$r('deblur'), Cr, Ar, ...Er()],
|
|
8416
8460
|
};
|
|
8417
8461
|
}
|
|
8418
|
-
function
|
|
8419
|
-
let r =
|
|
8462
|
+
function rt(e, t = e.api.model) {
|
|
8463
|
+
let r = Bt(e.slug);
|
|
8420
8464
|
return {
|
|
8421
8465
|
slug: t,
|
|
8422
8466
|
name: e.name,
|
|
8423
|
-
category:
|
|
8424
|
-
kind: t.startsWith('enhancor-skin-fix-') ? 'Image-to-Image' :
|
|
8467
|
+
category: la[e.kind],
|
|
8468
|
+
kind: t.startsWith('enhancor-skin-fix-') ? 'Image-to-Image' : pa[e.kind],
|
|
8425
8469
|
vendor: e.vendor ?? '',
|
|
8426
8470
|
description: e.desc ?? e.name,
|
|
8427
|
-
priceFormatted:
|
|
8471
|
+
priceFormatted: it(e),
|
|
8428
8472
|
...(r.length ? { priceNotes: r } : {}),
|
|
8429
8473
|
unit: e.unit,
|
|
8430
|
-
primaryToolName:
|
|
8431
|
-
parameters:
|
|
8474
|
+
primaryToolName: at[e.kind],
|
|
8475
|
+
parameters: ua(e, Ka(e)),
|
|
8432
8476
|
};
|
|
8433
8477
|
}
|
|
8434
|
-
function
|
|
8478
|
+
function Aa() {
|
|
8435
8479
|
let e = {};
|
|
8436
8480
|
for (let t of ge())
|
|
8437
8481
|
if (t.slug !== 'seedance-2-fast') {
|
|
8438
8482
|
if (t.slug === 'seedance-2-mini') {
|
|
8439
|
-
e['seedance-2-mini'] =
|
|
8483
|
+
e['seedance-2-mini'] = rt(t, 'seedance-2-mini');
|
|
8440
8484
|
continue;
|
|
8441
8485
|
}
|
|
8442
8486
|
if (t.slug === 'seedance-2') {
|
|
8443
|
-
let r =
|
|
8487
|
+
let r = rt(t);
|
|
8444
8488
|
((r.description = `${t.desc ?? t.name} Send quality fast or mini for Seedance 2.0 Fast or Mini.`),
|
|
8445
|
-
(r.priceFormatted =
|
|
8489
|
+
(r.priceFormatted = Ra(t)),
|
|
8446
8490
|
(e['seedance-2'] = r));
|
|
8447
8491
|
continue;
|
|
8448
8492
|
}
|
|
8449
|
-
t.slug.startsWith('claude-') || (e[t.api.model] =
|
|
8493
|
+
t.slug.startsWith('claude-') || (e[t.api.model] = rt(t));
|
|
8450
8494
|
}
|
|
8451
|
-
(Object.assign(e,
|
|
8495
|
+
(Object.assign(e, rr()), (e[xe] = $a()), (e[ke] = Ca()));
|
|
8452
8496
|
for (let [t, r] of Object.entries(be))
|
|
8453
8497
|
e[r] && Object.defineProperty(e, t, { value: e[r], enumerable: !1 });
|
|
8454
8498
|
return e;
|
|
8455
8499
|
}
|
|
8456
|
-
function
|
|
8500
|
+
function Ra(e = B('seedance-2')) {
|
|
8457
8501
|
let t = B('seedance-2-fast'),
|
|
8458
|
-
r = e ?
|
|
8502
|
+
r = e ? it(e) : '';
|
|
8459
8503
|
if (!t) return r;
|
|
8460
|
-
let
|
|
8461
|
-
return r ? `${r} \xB7 ${
|
|
8504
|
+
let i = `Fast ${it(t)}`;
|
|
8505
|
+
return r ? `${r} \xB7 ${i}` : i;
|
|
8462
8506
|
}
|
|
8463
|
-
function
|
|
8507
|
+
function Rr(e) {
|
|
8464
8508
|
if (!(!e || typeof e != 'object' || Array.isArray(e)))
|
|
8465
8509
|
for (let [t, r] of Object.entries(e)) {
|
|
8466
|
-
let
|
|
8467
|
-
|
|
8510
|
+
let i = Object.prototype.hasOwnProperty.call(Y, t) ? Y[t] : null;
|
|
8511
|
+
i && typeof r == 'string' && r.trim() && (i.priceFormatted = r.trim());
|
|
8468
8512
|
}
|
|
8469
8513
|
}
|
|
8470
8514
|
function ve(e) {
|
|
8471
8515
|
return !!e?.parameters.some((t) => t.name === 'image');
|
|
8472
8516
|
}
|
|
8473
8517
|
function G(e) {
|
|
8474
|
-
|
|
8518
|
+
let t = Y[e];
|
|
8519
|
+
return t ? Or(t) : null;
|
|
8520
|
+
}
|
|
8521
|
+
function Or(e) {
|
|
8522
|
+
return !wr(e.slug) || e.parameters.some((t) => t.name === 'priority')
|
|
8523
|
+
? e
|
|
8524
|
+
: { ...e, parameters: [...e.parameters, Oa] };
|
|
8475
8525
|
}
|
|
8476
|
-
function
|
|
8526
|
+
function qa(e, t, r) {
|
|
8477
8527
|
if (
|
|
8478
8528
|
e.startsWith('enhancor-skin-fix-') ||
|
|
8479
|
-
|
|
8529
|
+
mr(e) ||
|
|
8480
8530
|
(e === 'gemini-omni-1.2-flash' && (t === 'aspect_ratio' || t === 'duration')) ||
|
|
8481
8531
|
(e === 'magi-2' &&
|
|
8482
8532
|
t === 'aspect_ratio' &&
|
|
@@ -8484,13 +8534,13 @@ function Sa(e, t, r) {
|
|
|
8484
8534
|
'image_to_video')
|
|
8485
8535
|
)
|
|
8486
8536
|
return !1;
|
|
8487
|
-
if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite' ||
|
|
8537
|
+
if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite' || Mr(e)) && t === 'duration') {
|
|
8488
8538
|
let n = (s) => (typeof s == 'string' ? s.trim().toLowerCase() : '');
|
|
8489
8539
|
if (n(r.mode) === 'edit' || n(r.omni_reference_task_type) === 'edit') return !1;
|
|
8490
8540
|
}
|
|
8491
8541
|
if (
|
|
8492
|
-
(t === 'max_tokens' &&
|
|
8493
|
-
(t === 'max_completion_tokens' &&
|
|
8542
|
+
(t === 'max_tokens' && Pr(r.max_completion_tokens)) ||
|
|
8543
|
+
(t === 'max_completion_tokens' && Pr(r.max_tokens))
|
|
8494
8544
|
)
|
|
8495
8545
|
return !1;
|
|
8496
8546
|
if (t === 'aspect_ratio') {
|
|
@@ -8498,128 +8548,130 @@ function Sa(e, t, r) {
|
|
|
8498
8548
|
if (n) {
|
|
8499
8549
|
let s = typeof r.mode == 'string' ? r.mode.trim().toLowerCase() : '',
|
|
8500
8550
|
o = s ? s.replace(/-/g, '_') : n.modes[0];
|
|
8501
|
-
if (n.modes.includes(o) && !
|
|
8551
|
+
if (n.modes.includes(o) && !or(n, o)) return !1;
|
|
8502
8552
|
}
|
|
8503
8553
|
}
|
|
8504
|
-
let
|
|
8505
|
-
if (
|
|
8554
|
+
let i = we(e);
|
|
8555
|
+
if (i) {
|
|
8506
8556
|
let n = typeof r.mode == 'string' ? r.mode.trim().toLowerCase() : '',
|
|
8507
|
-
s = n ? n.replace(/-/g, '_') :
|
|
8508
|
-
if (
|
|
8557
|
+
s = n ? n.replace(/-/g, '_') : i.modes[0];
|
|
8558
|
+
if (i.modes.includes(s) && !lr(i, s, t)) return !1;
|
|
8509
8559
|
}
|
|
8510
8560
|
return !0;
|
|
8511
8561
|
}
|
|
8512
|
-
function
|
|
8562
|
+
function Pr(e) {
|
|
8513
8563
|
return e != null && e !== '';
|
|
8514
8564
|
}
|
|
8515
|
-
function
|
|
8565
|
+
function qr(e, t) {
|
|
8516
8566
|
let r = { ...t };
|
|
8517
8567
|
if (e?.slug === 'seedance-2-5') {
|
|
8518
|
-
let
|
|
8519
|
-
for (let n of
|
|
8520
|
-
if (!
|
|
8568
|
+
let i = (n) => typeof n != 'string' || !n.trim();
|
|
8569
|
+
for (let n of La) (i(r.finalize) && !i(r[n]) && (r.finalize = r[n]), delete r[n]);
|
|
8570
|
+
if (!i(r.finalize)) return r;
|
|
8521
8571
|
}
|
|
8522
|
-
for (let
|
|
8523
|
-
|
|
8524
|
-
r[
|
|
8525
|
-
|
|
8526
|
-
(r[
|
|
8572
|
+
for (let i of e?.parameters ?? [])
|
|
8573
|
+
i.default !== void 0 &&
|
|
8574
|
+
r[i.name] === void 0 &&
|
|
8575
|
+
qa(e.slug, i.name, t) &&
|
|
8576
|
+
(r[i.name] = i.default);
|
|
8527
8577
|
return r;
|
|
8528
8578
|
}
|
|
8529
8579
|
function N() {
|
|
8530
|
-
return Object.values(Y);
|
|
8580
|
+
return Object.values(Y).map(Or);
|
|
8531
8581
|
}
|
|
8532
|
-
var
|
|
8533
|
-
rt,
|
|
8534
|
-
ra,
|
|
8535
|
-
S,
|
|
8536
|
-
it,
|
|
8537
|
-
aa,
|
|
8538
|
-
xr,
|
|
8582
|
+
var la,
|
|
8539
8583
|
at,
|
|
8584
|
+
pa,
|
|
8585
|
+
S,
|
|
8540
8586
|
nt,
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8587
|
+
ca,
|
|
8588
|
+
Tr,
|
|
8589
|
+
st,
|
|
8590
|
+
ot,
|
|
8591
|
+
Ie,
|
|
8545
8592
|
ma,
|
|
8546
8593
|
fa,
|
|
8547
8594
|
ga,
|
|
8548
|
-
|
|
8595
|
+
xa,
|
|
8596
|
+
ka,
|
|
8597
|
+
_a,
|
|
8598
|
+
Ta,
|
|
8549
8599
|
re,
|
|
8550
|
-
|
|
8600
|
+
tt,
|
|
8601
|
+
Sr,
|
|
8602
|
+
Kr,
|
|
8551
8603
|
_r,
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
Tr,
|
|
8556
|
-
Mr,
|
|
8604
|
+
Ea,
|
|
8605
|
+
Cr,
|
|
8606
|
+
Ar,
|
|
8557
8607
|
Y,
|
|
8558
|
-
|
|
8608
|
+
Oa,
|
|
8609
|
+
La,
|
|
8559
8610
|
ie = y(() => {
|
|
8560
8611
|
'use strict';
|
|
8561
|
-
|
|
8562
|
-
Ae();
|
|
8563
|
-
j();
|
|
8564
|
-
Ve();
|
|
8565
|
-
Ut();
|
|
8612
|
+
Kt();
|
|
8566
8613
|
Re();
|
|
8567
|
-
|
|
8614
|
+
j();
|
|
8615
|
+
Ue();
|
|
8568
8616
|
jt();
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
(
|
|
8578
|
-
|
|
8617
|
+
Oe();
|
|
8618
|
+
Be();
|
|
8619
|
+
zt();
|
|
8620
|
+
Jt();
|
|
8621
|
+
Xt();
|
|
8622
|
+
ir();
|
|
8623
|
+
ze();
|
|
8624
|
+
dr();
|
|
8625
|
+
gr();
|
|
8626
|
+
yr();
|
|
8627
|
+
Ye();
|
|
8628
|
+
Xe();
|
|
8629
|
+
((la = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
|
|
8630
|
+
(at = {
|
|
8579
8631
|
video: 'generate_video',
|
|
8580
8632
|
image: 'generate_image',
|
|
8581
8633
|
audio: 'generate_audio',
|
|
8582
8634
|
llm: 'run_task',
|
|
8583
8635
|
}),
|
|
8584
|
-
(
|
|
8636
|
+
(pa = {
|
|
8585
8637
|
video: 'Text-to-Video',
|
|
8586
8638
|
image: 'Text-to-Image',
|
|
8587
8639
|
audio: 'Text-to-Audio',
|
|
8588
8640
|
llm: 'Reasoning (LLM)',
|
|
8589
8641
|
}));
|
|
8590
8642
|
S = (e) => ({ name: 'prompt', type: 'string', required: !0, description: e });
|
|
8591
|
-
((
|
|
8643
|
+
((nt = {
|
|
8592
8644
|
name: 'creative_mode',
|
|
8593
8645
|
type: 'boolean',
|
|
8594
8646
|
default: !1,
|
|
8595
8647
|
description:
|
|
8596
8648
|
'Runs the Creative mode checkpoint at its published price (+5%). The Acceptable Use Policy applies.',
|
|
8597
8649
|
}),
|
|
8598
|
-
(
|
|
8650
|
+
(ca = {
|
|
8599
8651
|
name: 'creative_mode',
|
|
8600
8652
|
type: 'boolean',
|
|
8601
8653
|
default: !1,
|
|
8602
8654
|
description: `Not available yet on this model: ${_e}.`,
|
|
8603
8655
|
}),
|
|
8604
|
-
(
|
|
8656
|
+
(Tr = {
|
|
8605
8657
|
name: 'priority',
|
|
8606
8658
|
type: 'boolean',
|
|
8607
8659
|
default: !1,
|
|
8608
8660
|
description: 'Guaranteed speed and no queue, at the published Priority price (+6%).',
|
|
8609
8661
|
}),
|
|
8610
|
-
(
|
|
8662
|
+
(st = {
|
|
8611
8663
|
name: 'reference_roles',
|
|
8612
8664
|
type: 'json',
|
|
8613
8665
|
description: `Omni Reference only. Role of each reference, by tag { "@Image1": "prop" } or by kind { "image": ["prop"] }. Image: appearance, clothing, prop, scene_layout, lighting, first_frame, last_frame; Seedance 2.5 also keyframe, storyboard. Video: motion, camera, style; Seedance 2.5 also blockout_coarse, blockout_fine. Audio: voice, ambience, music, sound_effect. On a tag, the value image, video or audio uses that kind's default (appearance, motion, voice).`,
|
|
8614
8666
|
}),
|
|
8615
|
-
(
|
|
8667
|
+
(ot = {
|
|
8616
8668
|
name: 'auto_fit_images',
|
|
8617
8669
|
type: 'boolean',
|
|
8618
8670
|
description:
|
|
8619
8671
|
'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.',
|
|
8620
8672
|
}),
|
|
8621
|
-
(
|
|
8622
|
-
((
|
|
8673
|
+
(Ie = new Set(['full_access', 'is_uncensored', 'unfiltered', 'verificationSignature'])));
|
|
8674
|
+
((ma = new Set([
|
|
8623
8675
|
'quality',
|
|
8624
8676
|
'bitrate_mode',
|
|
8625
8677
|
'draft',
|
|
@@ -8628,7 +8680,7 @@ var ta,
|
|
|
8628
8680
|
'draft_generation_id',
|
|
8629
8681
|
'pass_faces',
|
|
8630
8682
|
])),
|
|
8631
|
-
(
|
|
8683
|
+
(fa = new Set([
|
|
8632
8684
|
'quality',
|
|
8633
8685
|
'bitrate_mode',
|
|
8634
8686
|
'draft',
|
|
@@ -8636,12 +8688,12 @@ var ta,
|
|
|
8636
8688
|
'draft_task_id',
|
|
8637
8689
|
'draft_generation_id',
|
|
8638
8690
|
])),
|
|
8639
|
-
(
|
|
8691
|
+
(ga = {
|
|
8640
8692
|
images: 'up to 10',
|
|
8641
8693
|
videos: 'up to 5; combined duration < 30s',
|
|
8642
8694
|
audios: 'up to 5; combined duration < 30s',
|
|
8643
8695
|
}));
|
|
8644
|
-
((
|
|
8696
|
+
((xa = [
|
|
8645
8697
|
S('The user message or task.'),
|
|
8646
8698
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
8647
8699
|
{
|
|
@@ -8659,7 +8711,7 @@ var ta,
|
|
|
8659
8711
|
{ name: 'temperature', type: 'slider', min: 0, max: 1, step: 0.1 },
|
|
8660
8712
|
{ name: 'top_p', type: 'slider', min: 0, max: 1, step: 0.05 },
|
|
8661
8713
|
]),
|
|
8662
|
-
(
|
|
8714
|
+
(ka = [
|
|
8663
8715
|
S('The user message or task.'),
|
|
8664
8716
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
8665
8717
|
{
|
|
@@ -8741,8 +8793,8 @@ var ta,
|
|
|
8741
8793
|
description: 'Video frames read a second.',
|
|
8742
8794
|
},
|
|
8743
8795
|
]),
|
|
8744
|
-
(
|
|
8745
|
-
|
|
8796
|
+
(_a = ['gemini-3.8-flash', 'gemini-3.7-flash']));
|
|
8797
|
+
Ta = Object.entries({
|
|
8746
8798
|
background: !1,
|
|
8747
8799
|
skin: !1,
|
|
8748
8800
|
nose: !1,
|
|
@@ -8769,7 +8821,7 @@ var ta,
|
|
|
8769
8821
|
description: 'Keep this part out of the fix. Standard only.',
|
|
8770
8822
|
}));
|
|
8771
8823
|
((re = 'Left out: 480p, the same default as the API, the playground and workflow steps.'),
|
|
8772
|
-
(
|
|
8824
|
+
(tt = [
|
|
8773
8825
|
{
|
|
8774
8826
|
name: 'prompt',
|
|
8775
8827
|
type: 'string',
|
|
@@ -8918,19 +8970,19 @@ var ta,
|
|
|
8918
8970
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
8919
8971
|
},
|
|
8920
8972
|
]),
|
|
8921
|
-
(
|
|
8973
|
+
(Sr = {
|
|
8922
8974
|
name: 'images',
|
|
8923
8975
|
type: 'string[]',
|
|
8924
8976
|
description:
|
|
8925
8977
|
'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.',
|
|
8926
8978
|
}),
|
|
8927
|
-
(
|
|
8979
|
+
(Kr = {
|
|
8928
8980
|
name: 'audios',
|
|
8929
8981
|
type: 'string[]',
|
|
8930
8982
|
description:
|
|
8931
8983
|
'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.',
|
|
8932
8984
|
}),
|
|
8933
|
-
(
|
|
8985
|
+
(_r = [
|
|
8934
8986
|
{
|
|
8935
8987
|
name: 'prompt',
|
|
8936
8988
|
type: 'string',
|
|
@@ -9008,8 +9060,8 @@ var ta,
|
|
|
9008
9060
|
description:
|
|
9009
9061
|
'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
|
|
9010
9062
|
},
|
|
9011
|
-
|
|
9012
|
-
|
|
9063
|
+
Sr,
|
|
9064
|
+
Kr,
|
|
9013
9065
|
{
|
|
9014
9066
|
name: 'first_frame_image',
|
|
9015
9067
|
type: 'string',
|
|
@@ -9030,7 +9082,7 @@ var ta,
|
|
|
9030
9082
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
9031
9083
|
},
|
|
9032
9084
|
]),
|
|
9033
|
-
(
|
|
9085
|
+
(Ea = [
|
|
9034
9086
|
{
|
|
9035
9087
|
name: 'prompt',
|
|
9036
9088
|
type: 'string',
|
|
@@ -9085,8 +9137,8 @@ var ta,
|
|
|
9085
9137
|
description:
|
|
9086
9138
|
'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
|
|
9087
9139
|
},
|
|
9088
|
-
|
|
9089
|
-
|
|
9140
|
+
Sr,
|
|
9141
|
+
Kr,
|
|
9090
9142
|
{
|
|
9091
9143
|
name: 'first_frame_image',
|
|
9092
9144
|
type: 'string',
|
|
@@ -9101,7 +9153,7 @@ var ta,
|
|
|
9101
9153
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
9102
9154
|
},
|
|
9103
9155
|
]));
|
|
9104
|
-
((
|
|
9156
|
+
((Cr = {
|
|
9105
9157
|
name: 'mode',
|
|
9106
9158
|
type: 'select',
|
|
9107
9159
|
default: 'full',
|
|
@@ -9109,60 +9161,67 @@ var ta,
|
|
|
9109
9161
|
description:
|
|
9110
9162
|
'Full: the photo times the scale. Fast: long side 2432 px. Both are priced per output megapixel, no minimum: the first 10 MP at one rate, every MP past 10 at a lower one (get_pricing).',
|
|
9111
9163
|
}),
|
|
9112
|
-
(
|
|
9164
|
+
(Ar = {
|
|
9113
9165
|
name: 'scale',
|
|
9114
9166
|
type: 'select',
|
|
9115
|
-
default: String(
|
|
9116
|
-
options:
|
|
9117
|
-
description: `Full only: ${
|
|
9167
|
+
default: String(fr),
|
|
9168
|
+
options: We.noSkin.map(String),
|
|
9169
|
+
description: `Full only: ${We.noSkin.join(', ')}. The output is the photo times the scale (a 500 x 500 photo at 4 is 2000 x 2000), at most 48 megapixels: a scale past that is refused with the scales that fit.`,
|
|
9118
9170
|
}));
|
|
9119
|
-
Y =
|
|
9120
|
-
|
|
9171
|
+
Y = Aa();
|
|
9172
|
+
Oa = {
|
|
9173
|
+
name: 'priority',
|
|
9174
|
+
type: 'boolean',
|
|
9175
|
+
default: !1,
|
|
9176
|
+
description:
|
|
9177
|
+
"Sent straight to Google's own API, skipping the shared queue, at Google's price + 10% (per output image and per input image, the same on every plan). If Google can not serve it, the request fails and nothing is charged.",
|
|
9178
|
+
};
|
|
9179
|
+
La = ['draft_task_id', 'draft_generation_id'];
|
|
9121
9180
|
});
|
|
9122
|
-
function
|
|
9181
|
+
function Te(e) {
|
|
9123
9182
|
let t = '/v1/pricing/models',
|
|
9124
9183
|
r = e?.trim();
|
|
9125
9184
|
return r ? `${t}?model=${encodeURIComponent(r)}` : t;
|
|
9126
9185
|
}
|
|
9127
|
-
var
|
|
9186
|
+
var ct = y(() => {
|
|
9128
9187
|
'use strict';
|
|
9129
9188
|
});
|
|
9130
|
-
function
|
|
9189
|
+
function ht(e) {
|
|
9131
9190
|
return e.length <= 1 ? (e[0] ?? '') : `${e.slice(0, -1).join(', ')} and ${e[e.length - 1]}`;
|
|
9132
9191
|
}
|
|
9133
|
-
function
|
|
9192
|
+
function ii(e) {
|
|
9134
9193
|
let t = ge().filter((s) => s.kind === e && s.unfiltered != null),
|
|
9135
9194
|
r = t.filter((s) => ee.includes(s.api.model)).map((s) => s.name),
|
|
9136
|
-
|
|
9195
|
+
i = t.filter((s) => !ee.includes(s.api.model)).map((s) => s.name);
|
|
9137
9196
|
return [
|
|
9138
9197
|
...(r.length
|
|
9139
|
-
? [`${
|
|
9198
|
+
? [`${ht(r)}: runs the Creative mode checkpoint at its published price (+5%).`]
|
|
9140
9199
|
: []),
|
|
9141
|
-
...(
|
|
9200
|
+
...(i.length ? [`Not available yet on ${ht(i)}: ${_e}.`] : []),
|
|
9142
9201
|
'The Acceptable Use Policy applies.',
|
|
9143
9202
|
].join(' ');
|
|
9144
9203
|
}
|
|
9145
|
-
function
|
|
9146
|
-
if (
|
|
9204
|
+
function hn(e) {
|
|
9205
|
+
if (cn.has(e.name)) return e;
|
|
9147
9206
|
let t = e.inputSchema.properties;
|
|
9148
9207
|
return !t || t.callback_url
|
|
9149
9208
|
? e
|
|
9150
|
-
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url:
|
|
9209
|
+
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url: dn } } };
|
|
9151
9210
|
}
|
|
9152
|
-
function
|
|
9211
|
+
function yn(e) {
|
|
9153
9212
|
let t = e.inputSchema.properties;
|
|
9154
9213
|
if (!t) return e;
|
|
9155
9214
|
let r = !1,
|
|
9156
|
-
|
|
9215
|
+
i = {};
|
|
9157
9216
|
for (let [n, s] of Object.entries(t))
|
|
9158
|
-
|
|
9159
|
-
? ((
|
|
9160
|
-
:
|
|
9161
|
-
? ((
|
|
9162
|
-
: (
|
|
9163
|
-
return r ? { ...e, inputSchema: { ...e.inputSchema, properties:
|
|
9164
|
-
}
|
|
9165
|
-
function
|
|
9217
|
+
ai.has(n) && s.type === 'string' && !s.format
|
|
9218
|
+
? ((i[n] = { ...s, format: 'uri' }), (r = !0))
|
|
9219
|
+
: ai.has(n) && s.type === 'array' && s.items?.type === 'string' && !s.items.format
|
|
9220
|
+
? ((i[n] = { ...s, items: { ...s.items, format: 'uri' } }), (r = !0))
|
|
9221
|
+
: (i[n] = s);
|
|
9222
|
+
return r ? { ...e, inputSchema: { ...e.inputSchema, properties: i } } : e;
|
|
9223
|
+
}
|
|
9224
|
+
function bn(e) {
|
|
9166
9225
|
switch (e.type) {
|
|
9167
9226
|
case 'string':
|
|
9168
9227
|
return {
|
|
@@ -9217,14 +9276,14 @@ function pn(e) {
|
|
|
9217
9276
|
return { type: 'string', description: e.description };
|
|
9218
9277
|
}
|
|
9219
9278
|
}
|
|
9220
|
-
function
|
|
9279
|
+
function wn(e, t) {
|
|
9221
9280
|
let r = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
|
|
9222
|
-
|
|
9281
|
+
i = {},
|
|
9223
9282
|
n = [];
|
|
9224
|
-
for (let o of e.parameters) ((
|
|
9283
|
+
for (let o of e.parameters) ((i[o.name] = bn(o)), o.required && n.push(o.name));
|
|
9225
9284
|
let s = {
|
|
9226
9285
|
type: 'object',
|
|
9227
|
-
properties:
|
|
9286
|
+
properties: i,
|
|
9228
9287
|
...(n.length > 0 ? { required: n } : {}),
|
|
9229
9288
|
additionalProperties: !0,
|
|
9230
9289
|
};
|
|
@@ -9234,11 +9293,11 @@ function cn(e, t) {
|
|
|
9234
9293
|
inputSchema: s,
|
|
9235
9294
|
};
|
|
9236
9295
|
}
|
|
9237
|
-
function
|
|
9296
|
+
function xn() {
|
|
9238
9297
|
let e = N().filter((u) => u.category === 'Image' && !ve(u)),
|
|
9239
9298
|
t = N().filter((u) => u.category === 'Video'),
|
|
9240
9299
|
r = N().filter((u) => u.category === 'Text'),
|
|
9241
|
-
|
|
9300
|
+
i = N().filter((u) => u.category === 'Audio'),
|
|
9242
9301
|
n = {
|
|
9243
9302
|
name: 'generate_image',
|
|
9244
9303
|
description:
|
|
@@ -9325,7 +9384,15 @@ function un() {
|
|
|
9325
9384
|
maximum: 2147483647,
|
|
9326
9385
|
description: 'Nano Banana 2 and Nano Banana Pro. Omit it for a new image each time.',
|
|
9327
9386
|
},
|
|
9328
|
-
creative_mode: { type: 'boolean', description:
|
|
9387
|
+
creative_mode: { type: 'boolean', description: ii('image') },
|
|
9388
|
+
...(Pe().length
|
|
9389
|
+
? {
|
|
9390
|
+
priority: {
|
|
9391
|
+
type: 'boolean',
|
|
9392
|
+
description: `${ht(Pe().map(xr))} only: sent straight to Google's own API, skipping the shared queue, at Google's price + 10% (per output image and per input image, the same on every plan). If Google can not serve it, the request fails and nothing is charged.`,
|
|
9393
|
+
},
|
|
9394
|
+
}
|
|
9395
|
+
: {}),
|
|
9329
9396
|
},
|
|
9330
9397
|
required: ['prompt'],
|
|
9331
9398
|
additionalProperties: !0,
|
|
@@ -9362,7 +9429,7 @@ function un() {
|
|
|
9362
9429
|
description:
|
|
9363
9430
|
"Video resolution, where the model takes it (see each model tool). Left out: the model's own default, which that model's tool shows.",
|
|
9364
9431
|
},
|
|
9365
|
-
creative_mode: { type: 'boolean', description:
|
|
9432
|
+
creative_mode: { type: 'boolean', description: ii('video') },
|
|
9366
9433
|
priority: {
|
|
9367
9434
|
type: 'boolean',
|
|
9368
9435
|
description:
|
|
@@ -9418,7 +9485,7 @@ function un() {
|
|
|
9418
9485
|
additionalProperties: !0,
|
|
9419
9486
|
},
|
|
9420
9487
|
},
|
|
9421
|
-
|
|
9488
|
+
p = {
|
|
9422
9489
|
name: 'run_task',
|
|
9423
9490
|
description:
|
|
9424
9491
|
'Run a reasoning, analysis or code task on a Tein AI language model (Claude, GPT-6 Astra, Gemini, Dola-Seed). Billed per token at the published price.',
|
|
@@ -9498,10 +9565,10 @@ function un() {
|
|
|
9498
9565
|
additionalProperties: !0,
|
|
9499
9566
|
},
|
|
9500
9567
|
},
|
|
9501
|
-
|
|
9502
|
-
return [n, s, o,
|
|
9568
|
+
d = kn();
|
|
9569
|
+
return [n, s, o, p, l, d, c, un, ...ni];
|
|
9503
9570
|
}
|
|
9504
|
-
function
|
|
9571
|
+
function kn() {
|
|
9505
9572
|
return {
|
|
9506
9573
|
name: 'upload_asset',
|
|
9507
9574
|
description:
|
|
@@ -9548,31 +9615,32 @@ function mn() {
|
|
|
9548
9615
|
},
|
|
9549
9616
|
};
|
|
9550
9617
|
}
|
|
9551
|
-
function
|
|
9552
|
-
let e =
|
|
9553
|
-
t = N().map((r) =>
|
|
9554
|
-
return [...e, ...t].map(
|
|
9555
|
-
}
|
|
9556
|
-
var
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
|
|
9618
|
+
function yt() {
|
|
9619
|
+
let e = xn(),
|
|
9620
|
+
t = N().map((r) => wn(r));
|
|
9621
|
+
return [...e, ...t].map(hn).map(yn);
|
|
9622
|
+
}
|
|
9623
|
+
var dn,
|
|
9624
|
+
cn,
|
|
9625
|
+
un,
|
|
9626
|
+
mn,
|
|
9627
|
+
fn,
|
|
9628
|
+
gn,
|
|
9629
|
+
ni,
|
|
9630
|
+
Ao,
|
|
9631
|
+
ai,
|
|
9632
|
+
si = y(() => {
|
|
9566
9633
|
'use strict';
|
|
9567
9634
|
j();
|
|
9568
|
-
|
|
9635
|
+
Xe();
|
|
9636
|
+
Ye();
|
|
9569
9637
|
ie();
|
|
9570
|
-
((
|
|
9638
|
+
((dn = {
|
|
9571
9639
|
type: 'string',
|
|
9572
9640
|
description:
|
|
9573
9641
|
'Optional HTTPS URL. Tein POSTs the finished job here when it succeeds, fails, expires, or is cancelled. The body matches GET /v1/jobs/:id and is signed with X-Tein-Signature.',
|
|
9574
9642
|
}),
|
|
9575
|
-
(
|
|
9643
|
+
(cn = new Set([
|
|
9576
9644
|
'upload_asset',
|
|
9577
9645
|
'upload_media',
|
|
9578
9646
|
'upload_image',
|
|
@@ -9583,7 +9651,7 @@ var tn,
|
|
|
9583
9651
|
'get_usage',
|
|
9584
9652
|
'get_balance_history',
|
|
9585
9653
|
])),
|
|
9586
|
-
(
|
|
9654
|
+
(un = {
|
|
9587
9655
|
name: 'get_pricing',
|
|
9588
9656
|
description:
|
|
9589
9657
|
'Published USD prices for every Tein model: Starter, Plus and Scale on each variant, plus Creative mode, Priority and draft tables where they are published, and Admin prices for models that are not on the board. price_texts has the current "from" price of each model. No API key is required; with one, your_prices lists the prices your workspace pays (Your price) next to the published price of each row on its price list. Pass model to keep one catalog slug or API model id (for example seedance-2-5). The same payload as GET /v1/pricing/models.',
|
|
@@ -9598,13 +9666,13 @@ var tn,
|
|
|
9598
9666
|
additionalProperties: !1,
|
|
9599
9667
|
},
|
|
9600
9668
|
}),
|
|
9601
|
-
(
|
|
9669
|
+
(mn = {
|
|
9602
9670
|
name: 'get_balance',
|
|
9603
9671
|
description:
|
|
9604
9672
|
"Your Tein workspace's balance right now, what this API key can still spend (the balance, or less when the key has its own spending limit), credits on hold, and the workspace's usage this month and in the last 30 days from every channel (website, API, MCP, CLI, workflows). Use it before a run to check the balance covers it, or to show the balance in an app. Nothing runs and nothing is charged. The same payload as GET /v1/balance.",
|
|
9605
9673
|
inputSchema: { type: 'object', properties: {}, additionalProperties: !1 },
|
|
9606
9674
|
}),
|
|
9607
|
-
(
|
|
9675
|
+
(fn = {
|
|
9608
9676
|
name: 'get_usage',
|
|
9609
9677
|
description:
|
|
9610
9678
|
"Your Tein workspace's usage in detail, the same numbers as the dashboard's Usage page: total spend and requests (succeeded, failed, running), this API key's own share, and breakdowns by model, by channel (website, api, mcp, cli), by API key, and over time. Covers every run of the workspace, wherever it was started. Nothing runs and nothing is charged. The same payload as GET /v1/usage.",
|
|
@@ -9635,7 +9703,7 @@ var tn,
|
|
|
9635
9703
|
additionalProperties: !1,
|
|
9636
9704
|
},
|
|
9637
9705
|
}),
|
|
9638
|
-
(
|
|
9706
|
+
(gn = {
|
|
9639
9707
|
name: 'get_balance_history',
|
|
9640
9708
|
description:
|
|
9641
9709
|
"Your Tein balance's history, newest first, the same list as the Billing page: top ups, each run's charge (with its job_id and model), refunds, credits from Tein and adjustments, each with the balance after it. Nothing runs and nothing is charged. The same payload as GET /v1/balance/transactions.",
|
|
@@ -9653,9 +9721,9 @@ var tn,
|
|
|
9653
9721
|
additionalProperties: !1,
|
|
9654
9722
|
},
|
|
9655
9723
|
}),
|
|
9656
|
-
(
|
|
9657
|
-
(
|
|
9658
|
-
|
|
9724
|
+
(ni = [mn, fn, gn]),
|
|
9725
|
+
(Ao = new Set(ni.map((e) => e.name))));
|
|
9726
|
+
ai = new Set([
|
|
9659
9727
|
'image',
|
|
9660
9728
|
'images',
|
|
9661
9729
|
'image_url',
|
|
@@ -9672,32 +9740,32 @@ var tn,
|
|
|
9672
9740
|
'lipsyncing_audio',
|
|
9673
9741
|
]);
|
|
9674
9742
|
});
|
|
9675
|
-
var
|
|
9676
|
-
|
|
9677
|
-
forgetToolSchemas: () =>
|
|
9678
|
-
jsonRpcAnswer: () =>
|
|
9679
|
-
preprocessLocalFiles: () =>
|
|
9680
|
-
startStdioServer: () =>
|
|
9743
|
+
var hi = {};
|
|
9744
|
+
Ii(hi, {
|
|
9745
|
+
forgetToolSchemas: () => Tn,
|
|
9746
|
+
jsonRpcAnswer: () => di,
|
|
9747
|
+
preprocessLocalFiles: () => fi,
|
|
9748
|
+
startStdioServer: () => gi,
|
|
9681
9749
|
});
|
|
9682
|
-
function
|
|
9750
|
+
function _n(e) {
|
|
9683
9751
|
let t = (r) =>
|
|
9684
9752
|
!!r && typeof r == 'object' && r.jsonrpc === '2.0' && ('result' in r || 'error' in r);
|
|
9685
9753
|
return Array.isArray(e) ? e.length > 0 && e.every(t) : t(e);
|
|
9686
9754
|
}
|
|
9687
|
-
function
|
|
9688
|
-
let
|
|
9689
|
-
n =
|
|
9755
|
+
function di(e, t, r) {
|
|
9756
|
+
let i = e?.id,
|
|
9757
|
+
n = i == null,
|
|
9690
9758
|
s = null;
|
|
9691
9759
|
try {
|
|
9692
9760
|
s = r ? JSON.parse(r) : null;
|
|
9693
9761
|
} catch {
|
|
9694
9762
|
s = null;
|
|
9695
9763
|
}
|
|
9696
|
-
if (s !== null &&
|
|
9764
|
+
if (s !== null && _n(s)) return n ? null : s;
|
|
9697
9765
|
if (n) return null;
|
|
9698
9766
|
if (!r && t >= 200 && t < 300) return;
|
|
9699
9767
|
let o = s?.error,
|
|
9700
|
-
|
|
9768
|
+
p =
|
|
9701
9769
|
typeof o == 'string'
|
|
9702
9770
|
? o
|
|
9703
9771
|
: o && typeof o == 'object' && typeof o.message == 'string'
|
|
@@ -9706,39 +9774,39 @@ function ai(e, t, r) {
|
|
|
9706
9774
|
l = o && typeof o == 'object' && typeof o.code == 'string' ? o.code : null;
|
|
9707
9775
|
return {
|
|
9708
9776
|
jsonrpc: '2.0',
|
|
9709
|
-
id:
|
|
9777
|
+
id: i,
|
|
9710
9778
|
error: {
|
|
9711
9779
|
code: t === 401 ? -32001 : -32603,
|
|
9712
|
-
message:
|
|
9780
|
+
message: p,
|
|
9713
9781
|
data: { status: t, ...(l ? { code: l } : {}) },
|
|
9714
9782
|
},
|
|
9715
9783
|
};
|
|
9716
9784
|
}
|
|
9717
|
-
function
|
|
9785
|
+
function Pn() {
|
|
9718
9786
|
let e = process.argv.slice(2),
|
|
9719
9787
|
t = e.indexOf('--api-key');
|
|
9720
9788
|
return _(t >= 0 ? e[t + 1] : void 0);
|
|
9721
9789
|
}
|
|
9722
|
-
async function
|
|
9723
|
-
let
|
|
9724
|
-
if (!V.default.existsSync(
|
|
9790
|
+
async function ci(e, t, r) {
|
|
9791
|
+
let i = Q.default.resolve(e);
|
|
9792
|
+
if (!V.default.existsSync(i) || !V.default.statSync(i).isFile())
|
|
9725
9793
|
throw new Error(`File not found: ${e}`);
|
|
9726
|
-
let n = V.default.readFileSync(
|
|
9794
|
+
let n = V.default.readFileSync(i),
|
|
9727
9795
|
s = n.toString('base64'),
|
|
9728
9796
|
o = n.length,
|
|
9729
|
-
|
|
9730
|
-
l = await fetch(
|
|
9797
|
+
p = `${r.replace(/\/$/, '')}/v1/upload`,
|
|
9798
|
+
l = await fetch(p, {
|
|
9731
9799
|
method: 'POST',
|
|
9732
9800
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${t}` },
|
|
9733
9801
|
body: JSON.stringify({ data: s }),
|
|
9734
9802
|
});
|
|
9735
9803
|
if (!l.ok) {
|
|
9736
|
-
let
|
|
9804
|
+
let d = `Upload failed (HTTP ${l.status})`;
|
|
9737
9805
|
try {
|
|
9738
9806
|
let u = await l.json();
|
|
9739
|
-
|
|
9807
|
+
d = (typeof u.error == 'string' ? u.error : u.error?.message) || u.message || d;
|
|
9740
9808
|
} catch {}
|
|
9741
|
-
throw new Error(
|
|
9809
|
+
throw new Error(d);
|
|
9742
9810
|
}
|
|
9743
9811
|
let c = await l.json();
|
|
9744
9812
|
return {
|
|
@@ -9748,15 +9816,15 @@ async function ni(e, t, r) {
|
|
|
9748
9816
|
mimeType: c.mime_type || c.mimeType || 'image/png',
|
|
9749
9817
|
};
|
|
9750
9818
|
}
|
|
9751
|
-
function
|
|
9752
|
-
return
|
|
9819
|
+
function ui(e) {
|
|
9820
|
+
return In.has(Q.default.extname(e).toLowerCase());
|
|
9753
9821
|
}
|
|
9754
|
-
function
|
|
9822
|
+
function mi(e) {
|
|
9755
9823
|
return new Error(
|
|
9756
9824
|
`Tein uploads image, video and audio files only, and ${Q.default.basename(e)} is not one.`,
|
|
9757
9825
|
);
|
|
9758
9826
|
}
|
|
9759
|
-
function
|
|
9827
|
+
function vn(e) {
|
|
9760
9828
|
let t = e.trim();
|
|
9761
9829
|
if (
|
|
9762
9830
|
!t ||
|
|
@@ -9769,7 +9837,7 @@ function yn(e) {
|
|
|
9769
9837
|
let r = Q.default.resolve(t);
|
|
9770
9838
|
return V.default.existsSync(r) && V.default.statSync(r).isFile() ? r : null;
|
|
9771
9839
|
}
|
|
9772
|
-
function
|
|
9840
|
+
function wt(e) {
|
|
9773
9841
|
if (Array.isArray(e))
|
|
9774
9842
|
for (let t of e) {
|
|
9775
9843
|
let r = t;
|
|
@@ -9779,14 +9847,14 @@ function ht(e) {
|
|
|
9779
9847
|
se.set(r.name, r.inputSchema);
|
|
9780
9848
|
}
|
|
9781
9849
|
}
|
|
9782
|
-
function
|
|
9783
|
-
(se.clear(), (
|
|
9850
|
+
function Tn() {
|
|
9851
|
+
(se.clear(), (bt = 0));
|
|
9784
9852
|
}
|
|
9785
|
-
async function
|
|
9786
|
-
if (!(Date.now() -
|
|
9787
|
-
|
|
9853
|
+
async function Mn(e, t) {
|
|
9854
|
+
if (!(Date.now() - bt < 6e4)) {
|
|
9855
|
+
bt = Date.now();
|
|
9788
9856
|
try {
|
|
9789
|
-
let
|
|
9857
|
+
let i = await (
|
|
9790
9858
|
await fetch(e, {
|
|
9791
9859
|
method: 'POST',
|
|
9792
9860
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${t}` },
|
|
@@ -9794,39 +9862,39 @@ async function wn(e, t) {
|
|
|
9794
9862
|
signal: AbortSignal.timeout(1e4),
|
|
9795
9863
|
})
|
|
9796
9864
|
).json();
|
|
9797
|
-
|
|
9865
|
+
wt(i.result?.tools);
|
|
9798
9866
|
} catch {}
|
|
9799
9867
|
}
|
|
9800
9868
|
}
|
|
9801
|
-
function
|
|
9869
|
+
function Sn(e) {
|
|
9802
9870
|
return e
|
|
9803
9871
|
? e.type === 'string'
|
|
9804
9872
|
? e.format === 'uri'
|
|
9805
9873
|
: e.type === 'array' && e.items?.format === 'uri'
|
|
9806
9874
|
: !1;
|
|
9807
9875
|
}
|
|
9808
|
-
async function
|
|
9876
|
+
async function oi(e, t, r) {
|
|
9809
9877
|
if (typeof e != 'string') return e;
|
|
9810
|
-
let
|
|
9811
|
-
if (!
|
|
9812
|
-
if (!
|
|
9813
|
-
return (await
|
|
9878
|
+
let i = vn(e);
|
|
9879
|
+
if (!i) return e;
|
|
9880
|
+
if (!ui(i)) throw mi(i);
|
|
9881
|
+
return (await ci(i, t, r)).url;
|
|
9814
9882
|
}
|
|
9815
|
-
async function
|
|
9816
|
-
(se.size === 0 &&
|
|
9883
|
+
async function fi(e, t, r, i, n) {
|
|
9884
|
+
(se.size === 0 && wt(yt()), se.has(e) || (await Mn(n, r)));
|
|
9817
9885
|
let s = se.get(e)?.properties;
|
|
9818
9886
|
if (!s) return t;
|
|
9819
9887
|
let o = { ...t };
|
|
9820
|
-
for (let [
|
|
9821
|
-
if (
|
|
9888
|
+
for (let [p, l] of Object.entries(t))
|
|
9889
|
+
if (Sn(s[p]))
|
|
9822
9890
|
if (Array.isArray(l)) {
|
|
9823
9891
|
let c = [];
|
|
9824
|
-
for (let
|
|
9825
|
-
o[
|
|
9826
|
-
} else o[
|
|
9892
|
+
for (let d of l) c.push(await oi(d, r, i));
|
|
9893
|
+
o[p] = c;
|
|
9894
|
+
} else o[p] = await oi(l, r, i);
|
|
9827
9895
|
return o;
|
|
9828
9896
|
}
|
|
9829
|
-
function
|
|
9897
|
+
function Kn(e) {
|
|
9830
9898
|
let t = e.id ?? null;
|
|
9831
9899
|
switch (e.method) {
|
|
9832
9900
|
case 'initialize':
|
|
@@ -9844,7 +9912,7 @@ function kn(e) {
|
|
|
9844
9912
|
case 'ping':
|
|
9845
9913
|
return { jsonrpc: '2.0', id: t, result: {} };
|
|
9846
9914
|
case 'tools/list':
|
|
9847
|
-
return { jsonrpc: '2.0', id: t, result: { tools:
|
|
9915
|
+
return { jsonrpc: '2.0', id: t, result: { tools: yt() } };
|
|
9848
9916
|
case 'tools/call':
|
|
9849
9917
|
return {
|
|
9850
9918
|
jsonrpc: '2.0',
|
|
@@ -9867,13 +9935,13 @@ function kn(e) {
|
|
|
9867
9935
|
};
|
|
9868
9936
|
}
|
|
9869
9937
|
}
|
|
9870
|
-
async function
|
|
9871
|
-
if (
|
|
9872
|
-
|
|
9873
|
-
let e =
|
|
9938
|
+
async function gi() {
|
|
9939
|
+
if (li) return;
|
|
9940
|
+
li = !0;
|
|
9941
|
+
let e = Pn(),
|
|
9874
9942
|
t = x(),
|
|
9875
9943
|
r = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
|
|
9876
|
-
(
|
|
9944
|
+
(pi.default
|
|
9877
9945
|
.createInterface({ input: process.stdin, output: process.stdout, terminal: !1 })
|
|
9878
9946
|
.on('line', async (n) => {
|
|
9879
9947
|
let s = n.trim();
|
|
@@ -9884,8 +9952,8 @@ async function di() {
|
|
|
9884
9952
|
let l = o.params.name,
|
|
9885
9953
|
c = o.params.arguments || {};
|
|
9886
9954
|
if (l === 'get_pricing') {
|
|
9887
|
-
let
|
|
9888
|
-
u = `${t.replace(/\/+$/, '')}${
|
|
9955
|
+
let d = typeof c.model == 'string' ? c.model.trim() : '',
|
|
9956
|
+
u = `${t.replace(/\/+$/, '')}${Te(d)}`;
|
|
9889
9957
|
try {
|
|
9890
9958
|
let m = await fetch(u, {
|
|
9891
9959
|
signal: AbortSignal.timeout(1e4),
|
|
@@ -9927,18 +9995,18 @@ async function di() {
|
|
|
9927
9995
|
return;
|
|
9928
9996
|
}
|
|
9929
9997
|
if (l === 'upload_asset' || l === 'upload_media' || l === 'upload_image') {
|
|
9930
|
-
let
|
|
9998
|
+
let d = c.path || c.filepath || c.file_path || c.file || c.data;
|
|
9931
9999
|
if (
|
|
9932
|
-
typeof
|
|
9933
|
-
!
|
|
9934
|
-
!
|
|
9935
|
-
!
|
|
10000
|
+
typeof d == 'string' &&
|
|
10001
|
+
!d.startsWith('http://') &&
|
|
10002
|
+
!d.startsWith('https://') &&
|
|
10003
|
+
!d.startsWith('data:')
|
|
9936
10004
|
)
|
|
9937
10005
|
try {
|
|
9938
|
-
let u = Q.default.resolve(
|
|
10006
|
+
let u = Q.default.resolve(d.trim());
|
|
9939
10007
|
if (V.default.existsSync(u) && V.default.statSync(u).isFile() && e) {
|
|
9940
|
-
if (!
|
|
9941
|
-
let m = await
|
|
10008
|
+
if (!ui(u)) throw mi(u);
|
|
10009
|
+
let m = await ci(u, e, t),
|
|
9942
10010
|
g = (m.sizeBytes / 1024).toFixed(1),
|
|
9943
10011
|
C =
|
|
9944
10012
|
m.mimeType.startsWith('image/') ||
|
|
@@ -9994,9 +10062,9 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9994
10062
|
}
|
|
9995
10063
|
if (e)
|
|
9996
10064
|
try {
|
|
9997
|
-
o.params.arguments = await
|
|
9998
|
-
} catch (
|
|
9999
|
-
let u =
|
|
10065
|
+
o.params.arguments = await fi(String(l), c, e, t, r);
|
|
10066
|
+
} catch (d) {
|
|
10067
|
+
let u = d instanceof Error ? d.message : String(d);
|
|
10000
10068
|
process.stdout.write(
|
|
10001
10069
|
JSON.stringify({
|
|
10002
10070
|
jsonrpc: '2.0',
|
|
@@ -10025,32 +10093,32 @@ Pass this URL to any Tein generation tool.`,
|
|
|
10025
10093
|
body: JSON.stringify(o),
|
|
10026
10094
|
}),
|
|
10027
10095
|
c = await l.text(),
|
|
10028
|
-
|
|
10029
|
-
if (
|
|
10030
|
-
if (
|
|
10031
|
-
(o?.method === 'tools/list' &&
|
|
10096
|
+
d = di(o, l.status, c);
|
|
10097
|
+
if (d === null) return;
|
|
10098
|
+
if (d) {
|
|
10099
|
+
(o?.method === 'tools/list' && wt(d.result?.tools),
|
|
10032
10100
|
process.stdout.write(
|
|
10033
|
-
JSON.stringify(
|
|
10101
|
+
JSON.stringify(d) +
|
|
10034
10102
|
`
|
|
10035
10103
|
`,
|
|
10036
10104
|
));
|
|
10037
10105
|
return;
|
|
10038
10106
|
}
|
|
10039
10107
|
} catch {}
|
|
10040
|
-
let
|
|
10041
|
-
|
|
10108
|
+
let p = Kn(o);
|
|
10109
|
+
p !== null &&
|
|
10042
10110
|
process.stdout.write(
|
|
10043
|
-
JSON.stringify(
|
|
10111
|
+
JSON.stringify(p) +
|
|
10044
10112
|
`
|
|
10045
10113
|
`,
|
|
10046
10114
|
);
|
|
10047
10115
|
} catch (o) {
|
|
10048
|
-
let
|
|
10116
|
+
let p = o instanceof Error ? o.message : String(o);
|
|
10049
10117
|
process.stdout.write(
|
|
10050
10118
|
JSON.stringify({
|
|
10051
10119
|
jsonrpc: '2.0',
|
|
10052
10120
|
id: null,
|
|
10053
|
-
error: { code: -32700, message: `Parse error: ${
|
|
10121
|
+
error: { code: -32700, message: `Parse error: ${p}` },
|
|
10054
10122
|
}) +
|
|
10055
10123
|
`
|
|
10056
10124
|
`,
|
|
@@ -10062,21 +10130,21 @@ Pass this URL to any Tein generation tool.`,
|
|
|
10062
10130
|
}
|
|
10063
10131
|
var V,
|
|
10064
10132
|
Q,
|
|
10065
|
-
|
|
10066
|
-
|
|
10133
|
+
pi,
|
|
10134
|
+
In,
|
|
10067
10135
|
se,
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10136
|
+
bt,
|
|
10137
|
+
li,
|
|
10138
|
+
yi = y(() => {
|
|
10071
10139
|
'use strict';
|
|
10072
10140
|
((V = M(require('node:fs'))),
|
|
10073
10141
|
(Q = M(require('node:path'))),
|
|
10074
|
-
(
|
|
10075
|
-
|
|
10076
|
-
|
|
10142
|
+
(pi = M(require('node:readline'))));
|
|
10143
|
+
ct();
|
|
10144
|
+
si();
|
|
10077
10145
|
R();
|
|
10078
10146
|
oe();
|
|
10079
|
-
|
|
10147
|
+
In = new Set([
|
|
10080
10148
|
'.png',
|
|
10081
10149
|
'.jpg',
|
|
10082
10150
|
'.jpeg',
|
|
@@ -10102,22 +10170,22 @@ var V,
|
|
|
10102
10170
|
'.flac',
|
|
10103
10171
|
'.opus',
|
|
10104
10172
|
]);
|
|
10105
|
-
((se = new Map()), (
|
|
10106
|
-
|
|
10173
|
+
((se = new Map()), (bt = 0));
|
|
10174
|
+
li = !1;
|
|
10107
10175
|
require.main === module &&
|
|
10108
|
-
|
|
10176
|
+
gi().catch((e) => {
|
|
10109
10177
|
(process.stderr.write(`Fatal error in Tein MCP CLI: ${e}
|
|
10110
10178
|
`),
|
|
10111
10179
|
process.exit(1));
|
|
10112
10180
|
});
|
|
10113
10181
|
});
|
|
10114
|
-
var
|
|
10182
|
+
var Ti =
|
|
10115
10183
|
!process.env.NO_COLOR &&
|
|
10116
10184
|
(process.stdout.isTTY || process.env.FORCE_COLOR === '1' || process.env.TERM !== 'dumb');
|
|
10117
10185
|
function k(e, t) {
|
|
10118
|
-
return (r) => (
|
|
10186
|
+
return (r) => (Ti ? `\x1B[${e}m${r}\x1B[${t}m` : String(r));
|
|
10119
10187
|
}
|
|
10120
|
-
var
|
|
10188
|
+
var a = {
|
|
10121
10189
|
bold: k(1, 22),
|
|
10122
10190
|
dim: k(2, 22),
|
|
10123
10191
|
italic: k(3, 23),
|
|
@@ -10161,7 +10229,7 @@ var i = {
|
|
|
10161
10229
|
process.stdout.isTTY
|
|
10162
10230
|
? (this.stop(),
|
|
10163
10231
|
(this.timer = setInterval(() => {
|
|
10164
|
-
let r =
|
|
10232
|
+
let r = a.cyan(this.frames[this.current]);
|
|
10165
10233
|
(process.stdout.write(`\r${r} ${this.text} `),
|
|
10166
10234
|
(this.current = (this.current + 1) % this.frames.length));
|
|
10167
10235
|
}, 80)),
|
|
@@ -10178,7 +10246,7 @@ var i = {
|
|
|
10178
10246
|
this.stop();
|
|
10179
10247
|
let r = t || this.text;
|
|
10180
10248
|
process.stdout.isTTY
|
|
10181
|
-
? process.stdout.write(`\r${
|
|
10249
|
+
? process.stdout.write(`\r${a.green('\u2713')} ${r}
|
|
10182
10250
|
`)
|
|
10183
10251
|
: process.stdout.write(`[\u2713] ${r}
|
|
10184
10252
|
`);
|
|
@@ -10187,7 +10255,7 @@ var i = {
|
|
|
10187
10255
|
this.stop();
|
|
10188
10256
|
let r = t || this.text;
|
|
10189
10257
|
process.stdout.isTTY
|
|
10190
|
-
? process.stdout.write(`\r${
|
|
10258
|
+
? process.stdout.write(`\r${a.red('\u2717')} ${r}
|
|
10191
10259
|
`)
|
|
10192
10260
|
: process.stdout.write(`[\u2717] ${r}
|
|
10193
10261
|
`);
|
|
@@ -10202,10 +10270,10 @@ var i = {
|
|
|
10202
10270
|
var H = M(require('node:fs')),
|
|
10203
10271
|
O = M(require('node:path'));
|
|
10204
10272
|
var le = M(require('node:fs')),
|
|
10205
|
-
|
|
10206
|
-
|
|
10273
|
+
It = M(require('node:path')),
|
|
10274
|
+
vt = require('node:stream/promises');
|
|
10207
10275
|
oe();
|
|
10208
|
-
var
|
|
10276
|
+
var Ei = new Set([
|
|
10209
10277
|
'account_suspended',
|
|
10210
10278
|
'account_terminated',
|
|
10211
10279
|
'creative_mode_restricted',
|
|
@@ -10213,59 +10281,59 @@ var vi = new Set([
|
|
|
10213
10281
|
'workspace_paused',
|
|
10214
10282
|
]),
|
|
10215
10283
|
T = 1,
|
|
10216
|
-
|
|
10284
|
+
$i = 3,
|
|
10217
10285
|
b = class extends Error {
|
|
10218
|
-
constructor(t, r,
|
|
10286
|
+
constructor(t, r, i, n = {}) {
|
|
10219
10287
|
(super(r),
|
|
10220
10288
|
(this.name = 'TeinApiError'),
|
|
10221
10289
|
(this.status = t),
|
|
10222
|
-
|
|
10290
|
+
i && (this.code = i),
|
|
10223
10291
|
(this.fields = n));
|
|
10224
10292
|
}
|
|
10225
10293
|
get exitCode() {
|
|
10226
|
-
return this.code &&
|
|
10294
|
+
return this.code && Ei.has(this.code) ? $i : T;
|
|
10227
10295
|
}
|
|
10228
10296
|
};
|
|
10229
|
-
function
|
|
10230
|
-
let
|
|
10231
|
-
if (!r || typeof r != 'object') return new b(e,
|
|
10297
|
+
function Ci(e, t, r) {
|
|
10298
|
+
let i = `HTTP ${e}${t ? ` ${t}` : ''}`;
|
|
10299
|
+
if (!r || typeof r != 'object') return new b(e, i);
|
|
10232
10300
|
let n = r;
|
|
10233
10301
|
if (n.error && typeof n.error == 'object' && !Array.isArray(n.error)) {
|
|
10234
|
-
let
|
|
10235
|
-
{ code: u, message: m, ...g } =
|
|
10236
|
-
return new b(e, typeof m == 'string' && m ? m :
|
|
10302
|
+
let d = n.error,
|
|
10303
|
+
{ code: u, message: m, ...g } = d;
|
|
10304
|
+
return new b(e, typeof m == 'string' && m ? m : i, typeof u == 'string' ? u : void 0, g);
|
|
10237
10305
|
}
|
|
10238
|
-
let { error: s, code: o, message:
|
|
10239
|
-
c = (typeof s == 'string' && s) || (typeof
|
|
10306
|
+
let { error: s, code: o, message: p, ...l } = n,
|
|
10307
|
+
c = (typeof s == 'string' && s) || (typeof p == 'string' && p) || i;
|
|
10240
10308
|
return new b(e, c, typeof o == 'string' ? o : void 0, l);
|
|
10241
10309
|
}
|
|
10242
|
-
function
|
|
10310
|
+
function _t(e) {
|
|
10243
10311
|
return typeof e == 'number' && Number.isFinite(e) ? `$${e.toFixed(4)}` : null;
|
|
10244
10312
|
}
|
|
10245
10313
|
function E(e) {
|
|
10246
10314
|
let t = [e.message],
|
|
10247
|
-
r =
|
|
10248
|
-
|
|
10249
|
-
(r ||
|
|
10250
|
-
t.push([r ? `Required: ${r}` : '',
|
|
10315
|
+
r = _t(e.fields.required),
|
|
10316
|
+
i = _t(e.fields.balance);
|
|
10317
|
+
(r || i) &&
|
|
10318
|
+
t.push([r ? `Required: ${r}` : '', i ? `Balance: ${i}` : ''].filter(Boolean).join(' '));
|
|
10251
10319
|
let n = e.fields.org_name ?? e.fields.orgName;
|
|
10252
10320
|
typeof n == 'string' && n && t.push(`Workspace: ${n}`);
|
|
10253
10321
|
let s = e.fields.url ?? e.fields.appeal_url ?? e.fields.top_up_url;
|
|
10254
10322
|
return (typeof s == 'string' && s && t.push(s), e.code && t.push(`(${e.code})`), t);
|
|
10255
10323
|
}
|
|
10256
|
-
function
|
|
10324
|
+
function Ai(e) {
|
|
10257
10325
|
return /\.(mp4|webm|mov)(\?|$)/i.test(e)
|
|
10258
10326
|
? 'video'
|
|
10259
10327
|
: /\.(mp3|wav|ogg|flac)(\?|$)/i.test(e)
|
|
10260
10328
|
? 'audio'
|
|
10261
10329
|
: 'image';
|
|
10262
10330
|
}
|
|
10263
|
-
function
|
|
10331
|
+
function Pt(e) {
|
|
10264
10332
|
let t = [];
|
|
10265
10333
|
for (let r of e.data ?? [])
|
|
10266
10334
|
typeof r.message?.content == 'string'
|
|
10267
10335
|
? t.push({ type: 'text', text: r.message.content })
|
|
10268
|
-
: r.url && t.push({ type:
|
|
10336
|
+
: r.url && t.push({ type: Ai(r.url), url: r.url, ...(r.layer ? { layer: r.layer } : {}) });
|
|
10269
10337
|
return t;
|
|
10270
10338
|
}
|
|
10271
10339
|
var K = class {
|
|
@@ -10280,18 +10348,18 @@ var K = class {
|
|
|
10280
10348
|
'X-Tein-Client': 'cli',
|
|
10281
10349
|
};
|
|
10282
10350
|
}
|
|
10283
|
-
async send(t, r,
|
|
10351
|
+
async send(t, r, i) {
|
|
10284
10352
|
let n = await fetch(`${this.baseUrl}${r}`, {
|
|
10285
10353
|
method: t,
|
|
10286
10354
|
headers: this.getHeaders(),
|
|
10287
|
-
...(
|
|
10355
|
+
...(i === void 0 ? {} : { body: JSON.stringify(i) }),
|
|
10288
10356
|
});
|
|
10289
10357
|
if (!n.ok) {
|
|
10290
10358
|
let s = null;
|
|
10291
10359
|
try {
|
|
10292
10360
|
s = await n.json();
|
|
10293
10361
|
} catch {}
|
|
10294
|
-
throw
|
|
10362
|
+
throw Ci(n.status, n.statusText, s);
|
|
10295
10363
|
}
|
|
10296
10364
|
return await n.json();
|
|
10297
10365
|
}
|
|
@@ -10299,31 +10367,31 @@ var K = class {
|
|
|
10299
10367
|
await this.send('GET', '/v1/jobs?limit=1');
|
|
10300
10368
|
}
|
|
10301
10369
|
queueJob(t, r) {
|
|
10302
|
-
return this.send('POST', '/v1/generate', { model: t, ...r }).then((
|
|
10303
|
-
let n =
|
|
10370
|
+
return this.send('POST', '/v1/generate', { model: t, ...r }).then((i) => {
|
|
10371
|
+
let n = i.status,
|
|
10304
10372
|
s =
|
|
10305
10373
|
n === 'succeeded' || n === 'failed' || n === 'expired' || n === 'cancelled'
|
|
10306
10374
|
? n
|
|
10307
10375
|
: 'processing',
|
|
10308
|
-
o =
|
|
10376
|
+
o = Pt(i);
|
|
10309
10377
|
return {
|
|
10310
|
-
request_id:
|
|
10311
|
-
model:
|
|
10378
|
+
request_id: i.request_id || i.id || '',
|
|
10379
|
+
model: i.model,
|
|
10312
10380
|
status: s,
|
|
10313
10381
|
...(o.length ? { output: o } : {}),
|
|
10314
|
-
error:
|
|
10315
|
-
...(
|
|
10382
|
+
error: i.error && typeof i.error.message == 'string' ? i.error.message : null,
|
|
10383
|
+
...(i.usage ? { usage: i.usage } : {}),
|
|
10316
10384
|
};
|
|
10317
10385
|
});
|
|
10318
10386
|
}
|
|
10319
10387
|
getStatus(t) {
|
|
10320
10388
|
return this.send('GET', `/v1/jobs/${encodeURIComponent(t)}`).then((r) => {
|
|
10321
|
-
let
|
|
10389
|
+
let i = r.status,
|
|
10322
10390
|
n =
|
|
10323
|
-
|
|
10324
|
-
?
|
|
10391
|
+
i === 'succeeded' || i === 'failed' || i === 'expired' || i === 'cancelled'
|
|
10392
|
+
? i
|
|
10325
10393
|
: 'processing',
|
|
10326
|
-
s =
|
|
10394
|
+
s = Pt(r),
|
|
10327
10395
|
o = r.error && typeof r.error.message == 'string' ? r.error.message : null;
|
|
10328
10396
|
return {
|
|
10329
10397
|
request_id: r.id || t,
|
|
@@ -10350,65 +10418,65 @@ var K = class {
|
|
|
10350
10418
|
return this.send('POST', '/v1/upload', { data: t });
|
|
10351
10419
|
}
|
|
10352
10420
|
async downloadOutput(t, r) {
|
|
10353
|
-
let
|
|
10354
|
-
if (!
|
|
10355
|
-
let n =
|
|
10421
|
+
let i = await fetch(t);
|
|
10422
|
+
if (!i.ok) throw new Error(`The file could not be downloaded (HTTP ${i.status})`);
|
|
10423
|
+
let n = It.default.dirname(r);
|
|
10356
10424
|
le.default.existsSync(n) || le.default.mkdirSync(n, { recursive: !0 });
|
|
10357
10425
|
let s = le.default.createWriteStream(r);
|
|
10358
|
-
return (await (0,
|
|
10426
|
+
return (await (0, vt.pipeline)(i.body, s), r);
|
|
10359
10427
|
}
|
|
10360
10428
|
};
|
|
10361
10429
|
R();
|
|
10362
|
-
function
|
|
10430
|
+
function Ae(e) {
|
|
10363
10431
|
if (typeof e != 'number' || !Number.isFinite(e)) return '';
|
|
10364
10432
|
if (Math.abs(e) >= 1 || Math.abs(Number(e.toFixed(4)) - e) < 1e-12) return `$${e.toFixed(4)}`;
|
|
10365
10433
|
let t = Math.max(0, 3 - Number(e.toExponential(3).split('e')[1])),
|
|
10366
10434
|
r = 10 ** t,
|
|
10367
|
-
|
|
10368
|
-
return
|
|
10435
|
+
i = Math.round(Number((e * r).toFixed(6))) / r;
|
|
10436
|
+
return i >= 1 ? `$${i.toFixed(4)}` : `$${i.toFixed(t).replace(/0+$/, '')}`;
|
|
10369
10437
|
}
|
|
10370
10438
|
ie();
|
|
10371
|
-
var
|
|
10372
|
-
function
|
|
10373
|
-
for (let t of
|
|
10439
|
+
var Lr = ['images', 'input_images', 'videos', 'audios'];
|
|
10440
|
+
function Da(e) {
|
|
10441
|
+
for (let t of Lr) typeof e[t] == 'string' && (e[t] = [e[t]]);
|
|
10374
10442
|
}
|
|
10375
|
-
function
|
|
10443
|
+
function Na(e) {
|
|
10376
10444
|
if (e.startsWith('http://') || e.startsWith('https://')) return null;
|
|
10377
10445
|
let t = O.default.resolve(e);
|
|
10378
10446
|
return H.default.existsSync(t) && H.default.statSync(t).isFile() ? t : null;
|
|
10379
10447
|
}
|
|
10380
|
-
async function
|
|
10381
|
-
for (let r of
|
|
10448
|
+
async function Va(e, t) {
|
|
10449
|
+
for (let r of Lr) {
|
|
10382
10450
|
if (!Array.isArray(e[r])) continue;
|
|
10383
|
-
let
|
|
10451
|
+
let i = [];
|
|
10384
10452
|
for (let n of e[r]) {
|
|
10385
10453
|
if (typeof n != 'string') continue;
|
|
10386
|
-
let s =
|
|
10387
|
-
|
|
10454
|
+
let s = Na(n);
|
|
10455
|
+
i.push(s ? await t(s) : n);
|
|
10388
10456
|
}
|
|
10389
|
-
e[r] =
|
|
10457
|
+
e[r] = i;
|
|
10390
10458
|
}
|
|
10391
10459
|
}
|
|
10392
10460
|
var ae = { starter: 10, plus: 25, scale: 40, enterprise: 200 };
|
|
10393
|
-
function
|
|
10461
|
+
function Ua(e) {
|
|
10394
10462
|
if (e.count === void 0 || e.count === !0) return 1;
|
|
10395
10463
|
let t = typeof e.count == 'number' ? e.count : Number(e.count),
|
|
10396
10464
|
r = ae.enterprise;
|
|
10397
10465
|
return (
|
|
10398
10466
|
(!Number.isInteger(t) || t < 1 || t > r) &&
|
|
10399
10467
|
(process.stderr
|
|
10400
|
-
.write(`${
|
|
10468
|
+
.write(`${a.red('Error:')} --count must be a whole number from 1 to ${r}. The API allows Starter ${ae.starter}, Plus ${ae.plus}, Scale ${ae.scale}, Enterprise ${ae.enterprise} at once, including polling.
|
|
10401
10469
|
`),
|
|
10402
10470
|
process.exit(1)),
|
|
10403
10471
|
t
|
|
10404
10472
|
);
|
|
10405
10473
|
}
|
|
10406
|
-
async function
|
|
10474
|
+
async function Fa(e, t, r, i, n) {
|
|
10407
10475
|
n.isJson ||
|
|
10408
|
-
process.stderr.write(`Starting ${
|
|
10476
|
+
process.stderr.write(`Starting ${i} ${t} jobs together...
|
|
10409
10477
|
`);
|
|
10410
10478
|
let s = await Promise.all(
|
|
10411
|
-
Array.from({ length:
|
|
10479
|
+
Array.from({ length: i }, async () => {
|
|
10412
10480
|
try {
|
|
10413
10481
|
return { job: await e.queueJob(t, r) };
|
|
10414
10482
|
} catch (l) {
|
|
@@ -10417,26 +10485,26 @@ async function Ra(e, t, r, a, n) {
|
|
|
10417
10485
|
}),
|
|
10418
10486
|
),
|
|
10419
10487
|
o = [],
|
|
10420
|
-
|
|
10488
|
+
p = [];
|
|
10421
10489
|
for (let l of s)
|
|
10422
10490
|
'job' in l && l.job
|
|
10423
10491
|
? o.push(l.job)
|
|
10424
10492
|
: 'err' in l &&
|
|
10425
|
-
|
|
10493
|
+
p.push(
|
|
10426
10494
|
l.err instanceof b
|
|
10427
10495
|
? l.err
|
|
10428
10496
|
: new b(0, l.err instanceof Error ? l.err.message : String(l.err)),
|
|
10429
10497
|
);
|
|
10430
10498
|
if (!n.isAsync) {
|
|
10431
10499
|
let l = Date.now(),
|
|
10432
|
-
c = o.filter((
|
|
10500
|
+
c = o.filter((d) => d.status === 'processing' && d.request_id);
|
|
10433
10501
|
for (; c.length;) {
|
|
10434
10502
|
if ((await new Promise((u) => setTimeout(u, 2e3)), !n.isJson)) {
|
|
10435
10503
|
let u = Math.round((Date.now() - l) / 1e3);
|
|
10436
|
-
process.stderr.write(`Waiting on ${c.length} of ${
|
|
10504
|
+
process.stderr.write(`Waiting on ${c.length} of ${i} (${u}s)...
|
|
10437
10505
|
`);
|
|
10438
10506
|
}
|
|
10439
|
-
let
|
|
10507
|
+
let d = await Promise.all(
|
|
10440
10508
|
c.map(async (u) => {
|
|
10441
10509
|
try {
|
|
10442
10510
|
return await e.getStatus(u.request_id);
|
|
@@ -10445,7 +10513,7 @@ async function Ra(e, t, r, a, n) {
|
|
|
10445
10513
|
}
|
|
10446
10514
|
}),
|
|
10447
10515
|
);
|
|
10448
|
-
for (let u of
|
|
10516
|
+
for (let u of d) {
|
|
10449
10517
|
let m = o.findIndex((g) => g.request_id === u.request_id);
|
|
10450
10518
|
m >= 0 && (o[m] = u);
|
|
10451
10519
|
}
|
|
@@ -10455,7 +10523,7 @@ async function Ra(e, t, r, a, n) {
|
|
|
10455
10523
|
if (n.isJson)
|
|
10456
10524
|
process.stdout.write(
|
|
10457
10525
|
JSON.stringify(
|
|
10458
|
-
{ jobs: o, errors:
|
|
10526
|
+
{ jobs: o, errors: p.map((l) => ({ code: l.code ?? null, message: l.message })) },
|
|
10459
10527
|
null,
|
|
10460
10528
|
2,
|
|
10461
10529
|
) +
|
|
@@ -10466,46 +10534,46 @@ async function Ra(e, t, r, a, n) {
|
|
|
10466
10534
|
for (let l of o) {
|
|
10467
10535
|
if ((process.stdout.write(`${l.request_id} ${l.status}`), l.usage?.cost !== void 0)) {
|
|
10468
10536
|
let c = l.usage.estimated ? ' (estimated)' : '';
|
|
10469
|
-
process.stdout.write(` ${
|
|
10537
|
+
process.stdout.write(` ${Ae(l.usage.cost)}${c}`);
|
|
10470
10538
|
}
|
|
10471
10539
|
(l.error && process.stdout.write(` ${l.error}`),
|
|
10472
10540
|
process.stdout.write(`
|
|
10473
10541
|
`));
|
|
10474
10542
|
}
|
|
10475
|
-
for (let l of
|
|
10543
|
+
for (let l of p)
|
|
10476
10544
|
process.stderr.write(`${E(l).join(`
|
|
10477
10545
|
`)}
|
|
10478
10546
|
`);
|
|
10479
10547
|
}
|
|
10480
|
-
(
|
|
10548
|
+
(p.length ||
|
|
10481
10549
|
o.some((l) => l.status === 'failed' || l.status === 'expired' || l.status === 'cancelled')) &&
|
|
10482
10550
|
process.exit(T);
|
|
10483
10551
|
}
|
|
10484
|
-
function
|
|
10552
|
+
function Ba(e, t, r) {
|
|
10485
10553
|
if (r <= 1) return e;
|
|
10486
|
-
let
|
|
10487
|
-
return `${e.slice(0, e.length -
|
|
10554
|
+
let i = O.default.extname(e);
|
|
10555
|
+
return `${e.slice(0, e.length - i.length)}-${t + 1}${i}`;
|
|
10488
10556
|
}
|
|
10489
|
-
function
|
|
10557
|
+
function Dr(e) {
|
|
10490
10558
|
let t = {},
|
|
10491
10559
|
r = new Set(),
|
|
10492
|
-
|
|
10560
|
+
i = [];
|
|
10493
10561
|
for (let n = 0; n < e.length; n++) {
|
|
10494
10562
|
let s = e[n];
|
|
10495
10563
|
if (s.startsWith('--')) {
|
|
10496
10564
|
let o = s.slice(2);
|
|
10497
10565
|
if (o.includes('=')) {
|
|
10498
|
-
let [
|
|
10499
|
-
t[
|
|
10566
|
+
let [p, l] = o.split('=', 2);
|
|
10567
|
+
t[p.replace(/-/g, '_')] = l;
|
|
10500
10568
|
} else if (n + 1 < e.length && !e[n + 1].startsWith('-')) {
|
|
10501
|
-
let
|
|
10502
|
-
(
|
|
10569
|
+
let p = e[n + 1];
|
|
10570
|
+
(p === 'true'
|
|
10503
10571
|
? (t[o.replace(/-/g, '_')] = !0)
|
|
10504
|
-
:
|
|
10572
|
+
: p === 'false'
|
|
10505
10573
|
? (t[o.replace(/-/g, '_')] = !1)
|
|
10506
|
-
: /^-?\d+(\.\d+)?$/.test(
|
|
10507
|
-
? (t[o.replace(/-/g, '_')] = Number(
|
|
10508
|
-
: (t[o.replace(/-/g, '_')] =
|
|
10574
|
+
: /^-?\d+(\.\d+)?$/.test(p)
|
|
10575
|
+
? (t[o.replace(/-/g, '_')] = Number(p))
|
|
10576
|
+
: (t[o.replace(/-/g, '_')] = p),
|
|
10509
10577
|
n++);
|
|
10510
10578
|
} else ((t[o.replace(/-/g, '_')] = !0), r.add(o));
|
|
10511
10579
|
} else if (s.startsWith('-') && s.length === 2) {
|
|
@@ -10527,33 +10595,33 @@ function $r(e) {
|
|
|
10527
10595
|
: n + 1 < e.length && !e[n + 1].startsWith('-')
|
|
10528
10596
|
? ((t[l] = e[n + 1]), n++)
|
|
10529
10597
|
: (t[l] = !0);
|
|
10530
|
-
} else
|
|
10598
|
+
} else i.push(s);
|
|
10531
10599
|
}
|
|
10532
|
-
return { command:
|
|
10600
|
+
return { command: i[0] || '', subcommand: i[1], modelSlug: i[1] || i[0], options: t, flags: r };
|
|
10533
10601
|
}
|
|
10534
|
-
async function
|
|
10602
|
+
async function pt(e, t) {
|
|
10535
10603
|
let r = _(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
10536
|
-
|
|
10604
|
+
i = x(typeof t.api_url == 'string' ? t.api_url : void 0);
|
|
10537
10605
|
(r ||
|
|
10538
|
-
(process.stderr.write(`${
|
|
10606
|
+
(process.stderr.write(`${a.red('Error:')} Authentication required.
|
|
10539
10607
|
`),
|
|
10540
10608
|
process.stderr
|
|
10541
|
-
.write(`Please run ${
|
|
10609
|
+
.write(`Please run ${a.cyan('tein auth login')} or set ${a.cyan('TEIN_API_KEY')} environment variable.
|
|
10542
10610
|
`),
|
|
10543
10611
|
process.exit(1)),
|
|
10544
10612
|
e ||
|
|
10545
|
-
(process.stderr.write(`${
|
|
10613
|
+
(process.stderr.write(`${a.red('Error:')} Missing model slug.
|
|
10546
10614
|
`),
|
|
10547
|
-
process.stderr.write(`Usage: ${
|
|
10615
|
+
process.stderr.write(`Usage: ${a.cyan('tein run <model-slug> --prompt "..."')}
|
|
10548
10616
|
`),
|
|
10549
|
-
process.stderr.write(`Run ${
|
|
10617
|
+
process.stderr.write(`Run ${a.cyan('tein models')} to list all available models.
|
|
10550
10618
|
`),
|
|
10551
10619
|
process.exit(1)));
|
|
10552
10620
|
let n = G(e),
|
|
10553
10621
|
s = !!t.json,
|
|
10554
10622
|
o = !!(t.async || t.no_wait),
|
|
10555
|
-
|
|
10556
|
-
l =
|
|
10623
|
+
p = typeof t.output == 'string' ? t.output : void 0,
|
|
10624
|
+
l = Ua(t),
|
|
10557
10625
|
c = { ...t };
|
|
10558
10626
|
(delete c.json,
|
|
10559
10627
|
delete c.async,
|
|
@@ -10562,14 +10630,14 @@ async function ot(e, t) {
|
|
|
10562
10630
|
delete c.api_key,
|
|
10563
10631
|
delete c.api_url,
|
|
10564
10632
|
delete c.count);
|
|
10565
|
-
let
|
|
10566
|
-
(
|
|
10567
|
-
typeof
|
|
10568
|
-
|
|
10569
|
-
!
|
|
10633
|
+
let d = qr(n, c);
|
|
10634
|
+
(Da(d),
|
|
10635
|
+
typeof d.image == 'string' && !d.images && !ve(n) && ((d.images = [d.image]), delete d.image),
|
|
10636
|
+
d.image_url &&
|
|
10637
|
+
!d.first_frame_image &&
|
|
10570
10638
|
(e.startsWith('seedance') || e.startsWith('happy-horse')) &&
|
|
10571
|
-
(
|
|
10572
|
-
let u = new K(r,
|
|
10639
|
+
(d.first_frame_image = d.image_url));
|
|
10640
|
+
let u = new K(r, i),
|
|
10573
10641
|
m = [
|
|
10574
10642
|
'image',
|
|
10575
10643
|
'mask_image',
|
|
@@ -10582,16 +10650,16 @@ async function ot(e, t) {
|
|
|
10582
10650
|
'video_url',
|
|
10583
10651
|
];
|
|
10584
10652
|
for (let w of m) {
|
|
10585
|
-
let h =
|
|
10653
|
+
let h = d[w];
|
|
10586
10654
|
if (typeof h == 'string' && !h.startsWith('http://') && !h.startsWith('https://')) {
|
|
10587
|
-
let
|
|
10588
|
-
if (H.default.existsSync(
|
|
10589
|
-
let
|
|
10590
|
-
s ||
|
|
10655
|
+
let I = O.default.resolve(h);
|
|
10656
|
+
if (H.default.existsSync(I) && H.default.statSync(I).isFile()) {
|
|
10657
|
+
let v = new $(`Uploading local file ${O.default.basename(I)} to CDN...`);
|
|
10658
|
+
s || v.start();
|
|
10591
10659
|
try {
|
|
10592
|
-
let F = H.default.readFileSync(
|
|
10660
|
+
let F = H.default.readFileSync(I),
|
|
10593
10661
|
q = await u.uploadAsset(F.toString('base64'));
|
|
10594
|
-
((
|
|
10662
|
+
((d[w] = q.url), s || v.succeed(`Uploaded ${O.default.basename(I)} to CDN`));
|
|
10595
10663
|
} catch (F) {
|
|
10596
10664
|
let q = F instanceof Error ? F.message : String(F);
|
|
10597
10665
|
(s
|
|
@@ -10600,40 +10668,40 @@ async function ot(e, t) {
|
|
|
10600
10668
|
`
|
|
10601
10669
|
`,
|
|
10602
10670
|
)
|
|
10603
|
-
:
|
|
10671
|
+
: v.fail(`Upload failed: ${q}`),
|
|
10604
10672
|
process.exit(1));
|
|
10605
10673
|
}
|
|
10606
10674
|
}
|
|
10607
10675
|
}
|
|
10608
10676
|
}
|
|
10609
|
-
await
|
|
10677
|
+
await Va(d, async (w) => {
|
|
10610
10678
|
let h = new $(`Uploading local file ${O.default.basename(w)} to CDN...`);
|
|
10611
10679
|
s || h.start();
|
|
10612
10680
|
try {
|
|
10613
|
-
let
|
|
10614
|
-
|
|
10615
|
-
return (s || h.succeed(`Uploaded ${O.default.basename(w)} to CDN`),
|
|
10616
|
-
} catch (
|
|
10617
|
-
let
|
|
10681
|
+
let I = H.default.readFileSync(w),
|
|
10682
|
+
v = await u.uploadAsset(I.toString('base64'));
|
|
10683
|
+
return (s || h.succeed(`Uploaded ${O.default.basename(w)} to CDN`), v.url);
|
|
10684
|
+
} catch (I) {
|
|
10685
|
+
let v = I instanceof Error ? I.message : String(I);
|
|
10618
10686
|
(s
|
|
10619
10687
|
? process.stdout.write(
|
|
10620
|
-
JSON.stringify({ error:
|
|
10688
|
+
JSON.stringify({ error: v }) +
|
|
10621
10689
|
`
|
|
10622
10690
|
`,
|
|
10623
10691
|
)
|
|
10624
|
-
: h.fail(`Upload failed: ${
|
|
10692
|
+
: h.fail(`Upload failed: ${v}`),
|
|
10625
10693
|
process.exit(1));
|
|
10626
10694
|
}
|
|
10627
10695
|
});
|
|
10628
|
-
let g = new $(`Submitting task for ${
|
|
10696
|
+
let g = new $(`Submitting task for ${a.bold(e)}...`);
|
|
10629
10697
|
s || g.start();
|
|
10630
10698
|
let f;
|
|
10631
10699
|
try {
|
|
10632
10700
|
if (l > 1) {
|
|
10633
|
-
await
|
|
10701
|
+
await Fa(u, e, d, l, { isJson: s, isAsync: o });
|
|
10634
10702
|
return;
|
|
10635
10703
|
}
|
|
10636
|
-
f = await u.queueJob(e,
|
|
10704
|
+
f = await u.queueJob(e, d);
|
|
10637
10705
|
} catch (w) {
|
|
10638
10706
|
let h = w instanceof b ? w : null;
|
|
10639
10707
|
(s
|
|
@@ -10663,8 +10731,8 @@ async function ot(e, t) {
|
|
|
10663
10731
|
`
|
|
10664
10732
|
`,
|
|
10665
10733
|
)
|
|
10666
|
-
: (g.succeed(`Queued successfully! Request ID: ${
|
|
10667
|
-
process.stdout.write(`Check status anytime with: ${
|
|
10734
|
+
: (g.succeed(`Queued successfully! Request ID: ${a.bold(f.request_id)}`),
|
|
10735
|
+
process.stdout.write(`Check status anytime with: ${a.cyan(`tein status ${f.request_id}`)}
|
|
10668
10736
|
`));
|
|
10669
10737
|
return;
|
|
10670
10738
|
}
|
|
@@ -10672,7 +10740,7 @@ async function ot(e, t) {
|
|
|
10672
10740
|
U = 1500;
|
|
10673
10741
|
for (; f.status === 'processing';) {
|
|
10674
10742
|
let w = Math.round((Date.now() - C) / 1e3);
|
|
10675
|
-
(s || g.update(`Rendering ${
|
|
10743
|
+
(s || g.update(`Rendering ${a.bold(e)} (${w}s elapsed)... [ID: ${f.request_id}]`),
|
|
10676
10744
|
await new Promise((h) => setTimeout(h, U)));
|
|
10677
10745
|
try {
|
|
10678
10746
|
f = await u.getStatus(f.request_id);
|
|
@@ -10697,7 +10765,7 @@ async function ot(e, t) {
|
|
|
10697
10765
|
)
|
|
10698
10766
|
: g.fail(`Generation ${f.status}: ${f.error || 'Something failed on our side.'}`),
|
|
10699
10767
|
process.exit(T)),
|
|
10700
|
-
s || g.succeed(`Generation completed for ${
|
|
10768
|
+
s || g.succeed(`Generation completed for ${a.bold(n?.name || e)}!`),
|
|
10701
10769
|
s)
|
|
10702
10770
|
) {
|
|
10703
10771
|
process.stdout.write(
|
|
@@ -10710,51 +10778,51 @@ async function ot(e, t) {
|
|
|
10710
10778
|
if (
|
|
10711
10779
|
(process.stdout.write(`
|
|
10712
10780
|
`),
|
|
10713
|
-
process.stdout.write(` ${
|
|
10781
|
+
process.stdout.write(` ${a.bold('Status:')} ${a.green('Succeeded')}
|
|
10714
10782
|
`),
|
|
10715
|
-
process.stdout.write(` ${
|
|
10783
|
+
process.stdout.write(` ${a.bold('Request ID:')} ${f.request_id}
|
|
10716
10784
|
`),
|
|
10717
10785
|
f.usage?.cost !== void 0 &&
|
|
10718
|
-
process.stdout.write(` ${
|
|
10786
|
+
process.stdout.write(` ${a.bold('Cost:')} ${Ae(f.usage.cost)}
|
|
10719
10787
|
`),
|
|
10720
10788
|
f.output && f.output.length > 0)
|
|
10721
10789
|
) {
|
|
10722
10790
|
process.stdout.write(`
|
|
10723
|
-
${
|
|
10791
|
+
${a.bold('Outputs:')}
|
|
10724
10792
|
`);
|
|
10725
|
-
let w = f.output.filter((
|
|
10793
|
+
let w = f.output.filter((I) => I.url).length,
|
|
10726
10794
|
h = 0;
|
|
10727
|
-
for (let
|
|
10728
|
-
let
|
|
10729
|
-
if (
|
|
10730
|
-
let F =
|
|
10795
|
+
for (let I = 0; I < f.output.length; I++) {
|
|
10796
|
+
let v = f.output[I];
|
|
10797
|
+
if (v.url) {
|
|
10798
|
+
let F = v.layer?.name ? ` ${a.bold(v.layer.name)}` : '';
|
|
10731
10799
|
if (
|
|
10732
|
-
(process.stdout.write(` [${
|
|
10800
|
+
(process.stdout.write(` [${v.type.toUpperCase()}]${F} ${a.cyan(a.underline(v.url))}
|
|
10733
10801
|
`),
|
|
10734
|
-
|
|
10802
|
+
p)
|
|
10735
10803
|
) {
|
|
10736
|
-
let q =
|
|
10737
|
-
|
|
10804
|
+
let q = Ba(p, h++, w),
|
|
10805
|
+
xt = new $(`Downloading output to ${q}...`).start();
|
|
10738
10806
|
try {
|
|
10739
|
-
(await u.downloadOutput(
|
|
10740
|
-
|
|
10741
|
-
} catch (
|
|
10742
|
-
|
|
10807
|
+
(await u.downloadOutput(v.url, O.default.resolve(process.cwd(), q)),
|
|
10808
|
+
xt.succeed(`Saved to ${a.bold(q)}`));
|
|
10809
|
+
} catch (Se) {
|
|
10810
|
+
xt.fail(`Failed to download: ${Se instanceof Error ? Se.message : Se}`);
|
|
10743
10811
|
}
|
|
10744
10812
|
}
|
|
10745
10813
|
} else
|
|
10746
|
-
|
|
10814
|
+
v.text &&
|
|
10747
10815
|
process.stdout.write(`
|
|
10748
|
-
${
|
|
10816
|
+
${v.text}
|
|
10749
10817
|
`);
|
|
10750
10818
|
}
|
|
10751
10819
|
}
|
|
10752
10820
|
process.stdout.write(`
|
|
10753
10821
|
`);
|
|
10754
10822
|
}
|
|
10755
|
-
var
|
|
10823
|
+
var Nr = M(require('node:readline'));
|
|
10756
10824
|
R();
|
|
10757
|
-
async function
|
|
10825
|
+
async function ja(e) {
|
|
10758
10826
|
try {
|
|
10759
10827
|
return (await new K(e, x()).checkKey(), 'ok');
|
|
10760
10828
|
} catch (t) {
|
|
@@ -10765,11 +10833,11 @@ async function qa(e) {
|
|
|
10765
10833
|
return 'unchecked';
|
|
10766
10834
|
}
|
|
10767
10835
|
}
|
|
10768
|
-
function
|
|
10769
|
-
let t =
|
|
10836
|
+
function Ga(e) {
|
|
10837
|
+
let t = Nr.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
10770
10838
|
return new Promise((r) => {
|
|
10771
|
-
t.question(e, (
|
|
10772
|
-
(t.close(), r(
|
|
10839
|
+
t.question(e, (i) => {
|
|
10840
|
+
(t.close(), r(i.trim()));
|
|
10773
10841
|
});
|
|
10774
10842
|
});
|
|
10775
10843
|
}
|
|
@@ -10780,38 +10848,38 @@ async function ne(e, t) {
|
|
|
10780
10848
|
let r = t?.trim() || '';
|
|
10781
10849
|
(r ||
|
|
10782
10850
|
(process.stdout.write(`
|
|
10783
|
-
${
|
|
10851
|
+
${a.bold('Tein AI Authentication')}
|
|
10784
10852
|
`),
|
|
10785
|
-
process.stdout.write(`Get your API key at: ${
|
|
10853
|
+
process.stdout.write(`Get your API key at: ${a.cyan('https://tein.ai/dashboard/keys')}
|
|
10786
10854
|
|
|
10787
10855
|
`),
|
|
10788
|
-
(r = await
|
|
10856
|
+
(r = await Ga('Enter your Tein API Key (sk_live_...): '))),
|
|
10789
10857
|
!r.startsWith('sk_live_') &&
|
|
10790
10858
|
!r.startsWith('sk_test_') &&
|
|
10791
10859
|
(process.stderr
|
|
10792
|
-
.write(`${
|
|
10860
|
+
.write(`${a.red('Error:')} Invalid key format. Tein API keys start with 'sk_live_' or 'sk_test_'.
|
|
10793
10861
|
`),
|
|
10794
10862
|
process.exit(1)));
|
|
10795
|
-
let
|
|
10796
|
-
(
|
|
10863
|
+
let i = await ja(r);
|
|
10864
|
+
(i === 'invalid' &&
|
|
10797
10865
|
(process.stderr
|
|
10798
|
-
.write(`${
|
|
10866
|
+
.write(`${a.red('Error:')} Tein did not accept this key. Copy it again from ${a.cyan('https://tein.ai/dashboard/keys')}. Nothing was saved.
|
|
10799
10867
|
`),
|
|
10800
10868
|
process.exit(1)),
|
|
10801
|
-
|
|
10869
|
+
Ce({ apiKey: r }),
|
|
10802
10870
|
process.stdout.write(`
|
|
10803
|
-
${
|
|
10871
|
+
${a.green('\u2713')} API key saved to ${a.dim(de())}
|
|
10804
10872
|
`),
|
|
10805
|
-
|
|
10873
|
+
i === 'blocked'
|
|
10806
10874
|
? process.stdout
|
|
10807
|
-
.write(`${
|
|
10875
|
+
.write(`${a.yellow('\u2139')} The key is valid, but this account cannot run requests right now. Check your dashboard.
|
|
10808
10876
|
`)
|
|
10809
|
-
:
|
|
10877
|
+
: i === 'unchecked' &&
|
|
10810
10878
|
process.stdout
|
|
10811
|
-
.write(`${
|
|
10879
|
+
.write(`${a.yellow('\u2139')} Could not reach Tein to check the key. It is saved; run ${a.cyan('tein auth set-key')} again once you are online to check it.
|
|
10812
10880
|
`),
|
|
10813
10881
|
process.stdout
|
|
10814
|
-
.write(`You can now run models directly using: ${
|
|
10882
|
+
.write(`You can now run models directly using: ${a.cyan('tein run <model-slug> --prompt "..."')}
|
|
10815
10883
|
|
|
10816
10884
|
`));
|
|
10817
10885
|
break;
|
|
@@ -10819,41 +10887,41 @@ ${i.green('\u2713')} API key saved to ${i.dim(pe())}
|
|
|
10819
10887
|
case 'logout': {
|
|
10820
10888
|
if (!J().apiKey) {
|
|
10821
10889
|
process.stdout
|
|
10822
|
-
.write(`${
|
|
10890
|
+
.write(`${a.yellow('\u2139')} No active API key found. You are already logged out.
|
|
10823
10891
|
`);
|
|
10824
10892
|
break;
|
|
10825
10893
|
}
|
|
10826
|
-
(
|
|
10894
|
+
(Ce({ apiKey: '' }),
|
|
10827
10895
|
process.stdout
|
|
10828
|
-
.write(`${
|
|
10896
|
+
.write(`${a.green('\u2713')} Logged out successfully. Stored API key has been cleared from ${a.dim(de())}
|
|
10829
10897
|
`));
|
|
10830
10898
|
break;
|
|
10831
10899
|
}
|
|
10832
10900
|
default: {
|
|
10833
10901
|
let r = _(),
|
|
10834
|
-
|
|
10902
|
+
i = x(),
|
|
10835
10903
|
n = J();
|
|
10836
10904
|
if (
|
|
10837
10905
|
(process.stdout.write(`
|
|
10838
|
-
${
|
|
10906
|
+
${a.bold('Tein AI CLI Configuration')}
|
|
10839
10907
|
`),
|
|
10840
|
-
process.stdout.write(` Config file: ${
|
|
10908
|
+
process.stdout.write(` Config file: ${a.dim(de())}
|
|
10841
10909
|
`),
|
|
10842
|
-
process.stdout.write(` API URL: ${
|
|
10910
|
+
process.stdout.write(` API URL: ${a.cyan(i)}
|
|
10843
10911
|
`),
|
|
10844
10912
|
!r)
|
|
10845
10913
|
)
|
|
10846
|
-
(process.stdout.write(` API Key: ${
|
|
10914
|
+
(process.stdout.write(` API Key: ${a.red('Not configured')}
|
|
10847
10915
|
|
|
10848
10916
|
`),
|
|
10849
10917
|
process.stdout
|
|
10850
|
-
.write(`Run ${
|
|
10918
|
+
.write(`Run ${a.cyan('tein auth login')} or set ${a.cyan('TEIN_API_KEY')} environment variable.
|
|
10851
10919
|
|
|
10852
10920
|
`));
|
|
10853
10921
|
else {
|
|
10854
10922
|
let s = `${r.slice(0, 10)}...${r.slice(-4)}`;
|
|
10855
10923
|
process.stdout
|
|
10856
|
-
.write(` API Key: ${
|
|
10924
|
+
.write(` API Key: ${a.green(s)} (${r.startsWith('sk_live_') ? 'Live Key' : 'Test Key'})
|
|
10857
10925
|
|
|
10858
10926
|
`);
|
|
10859
10927
|
}
|
|
@@ -10867,10 +10935,10 @@ function P(e) {
|
|
|
10867
10935
|
? `$${e.toFixed(6).replace(/0+$/, '').replace(/\.$/, '')}`
|
|
10868
10936
|
: `$${e.toFixed(2)}`;
|
|
10869
10937
|
}
|
|
10870
|
-
function
|
|
10938
|
+
function Vr(e) {
|
|
10871
10939
|
return `${e} ${e === 1 ? 'request' : 'requests'}`;
|
|
10872
10940
|
}
|
|
10873
|
-
function
|
|
10941
|
+
function Ha(e) {
|
|
10874
10942
|
let t = [
|
|
10875
10943
|
['Balance', P(e.balance)],
|
|
10876
10944
|
['Available to this key', P(e.available)],
|
|
@@ -10890,8 +10958,8 @@ function Da(e) {
|
|
|
10890
10958
|
`${P(r.remaining)} left of ${P(r.amount)}${r.resets_at ? `, resets ${r.resets_at.slice(0, 10)}` : ''}`,
|
|
10891
10959
|
]),
|
|
10892
10960
|
t.push(
|
|
10893
|
-
['This month', `${P(e.usage.this_month.spend)} on ${
|
|
10894
|
-
['Last 30 days', `${P(e.usage.last_30_days.spend)} on ${
|
|
10961
|
+
['This month', `${P(e.usage.this_month.spend)} on ${Vr(e.usage.this_month.requests)}`],
|
|
10962
|
+
['Last 30 days', `${P(e.usage.last_30_days.spend)} on ${Vr(e.usage.last_30_days.requests)}`],
|
|
10895
10963
|
[
|
|
10896
10964
|
'Auto top up',
|
|
10897
10965
|
e.auto_top_up.enabled
|
|
@@ -10901,18 +10969,18 @@ function Da(e) {
|
|
|
10901
10969
|
['Workspace', `${e.workspace.name} (${e.workspace.plan.name})`],
|
|
10902
10970
|
['Key', `${e.key.name} (${e.key.env})`],
|
|
10903
10971
|
));
|
|
10904
|
-
let
|
|
10905
|
-
return t.map(([n, s]) => ` ${n.padEnd(
|
|
10972
|
+
let i = Math.max(...t.map(([n]) => n.length));
|
|
10973
|
+
return t.map(([n, s]) => ` ${n.padEnd(i)} ${s}`);
|
|
10906
10974
|
}
|
|
10907
|
-
async function
|
|
10975
|
+
async function Ur(e) {
|
|
10908
10976
|
let t = _(typeof e.api_key == 'string' ? e.api_key : void 0),
|
|
10909
10977
|
r = x(typeof e.api_url == 'string' ? e.api_url : void 0),
|
|
10910
|
-
|
|
10978
|
+
i = !!e.json;
|
|
10911
10979
|
t ||
|
|
10912
|
-
(process.stderr.write(`${
|
|
10980
|
+
(process.stderr.write(`${a.red('Error:')} Authentication required.
|
|
10913
10981
|
`),
|
|
10914
10982
|
process.stderr
|
|
10915
|
-
.write(`Please run ${
|
|
10983
|
+
.write(`Please run ${a.cyan('tein auth login')} or set ${a.cyan('TEIN_API_KEY')} environment variable.
|
|
10916
10984
|
`),
|
|
10917
10985
|
process.exit(1));
|
|
10918
10986
|
let n;
|
|
@@ -10920,7 +10988,7 @@ async function Rr(e) {
|
|
|
10920
10988
|
n = await new K(t, r).getBalance();
|
|
10921
10989
|
} catch (s) {
|
|
10922
10990
|
(s instanceof b &&
|
|
10923
|
-
(
|
|
10991
|
+
(i
|
|
10924
10992
|
? process.stdout.write(
|
|
10925
10993
|
JSON.stringify(
|
|
10926
10994
|
{ error: { code: s.code ?? null, message: s.message, ...s.fields } },
|
|
@@ -10930,15 +10998,15 @@ async function Rr(e) {
|
|
|
10930
10998
|
`
|
|
10931
10999
|
`,
|
|
10932
11000
|
)
|
|
10933
|
-
: process.stderr.write(`${
|
|
11001
|
+
: process.stderr.write(`${a.red('Error:')} ${E(s).join(`
|
|
10934
11002
|
`)}
|
|
10935
11003
|
`),
|
|
10936
11004
|
process.exit(s.exitCode)),
|
|
10937
|
-
process.stderr.write(`${
|
|
11005
|
+
process.stderr.write(`${a.red('Error:')} ${s instanceof Error ? s.message : String(s)}
|
|
10938
11006
|
`),
|
|
10939
11007
|
process.exit(T));
|
|
10940
11008
|
}
|
|
10941
|
-
if (
|
|
11009
|
+
if (i) {
|
|
10942
11010
|
process.stdout.write(
|
|
10943
11011
|
JSON.stringify(n, null, 2) +
|
|
10944
11012
|
`
|
|
@@ -10947,36 +11015,36 @@ async function Rr(e) {
|
|
|
10947
11015
|
return;
|
|
10948
11016
|
}
|
|
10949
11017
|
process.stdout.write(`
|
|
10950
|
-
${
|
|
10951
|
-
${
|
|
11018
|
+
${a.bold('Tein balance')}
|
|
11019
|
+
${Ha(n).join(`
|
|
10952
11020
|
`)}
|
|
10953
11021
|
|
|
10954
11022
|
`);
|
|
10955
11023
|
}
|
|
10956
11024
|
R();
|
|
10957
|
-
function
|
|
11025
|
+
function Fr(e) {
|
|
10958
11026
|
let t = _(typeof e.api_key == 'string' ? e.api_key : void 0),
|
|
10959
11027
|
r = x(typeof e.api_url == 'string' ? e.api_url : void 0);
|
|
10960
11028
|
return (
|
|
10961
11029
|
t ||
|
|
10962
|
-
(process.stderr.write(`${
|
|
11030
|
+
(process.stderr.write(`${a.red('Error:')} Authentication required.
|
|
10963
11031
|
`),
|
|
10964
11032
|
process.stderr
|
|
10965
|
-
.write(`Please run ${
|
|
11033
|
+
.write(`Please run ${a.cyan('tein auth login')} or set ${a.cyan('TEIN_API_KEY')} environment variable.
|
|
10966
11034
|
`),
|
|
10967
11035
|
process.exit(1)),
|
|
10968
11036
|
new K(t, r)
|
|
10969
11037
|
);
|
|
10970
11038
|
}
|
|
10971
|
-
function
|
|
11039
|
+
function Br(e, t) {
|
|
10972
11040
|
let r = {};
|
|
10973
|
-
for (let
|
|
10974
|
-
let n = e[
|
|
10975
|
-
(typeof n == 'string' || typeof n == 'number') && (r[
|
|
11041
|
+
for (let i of t) {
|
|
11042
|
+
let n = e[i];
|
|
11043
|
+
(typeof n == 'string' || typeof n == 'number') && (r[i] = String(n));
|
|
10976
11044
|
}
|
|
10977
11045
|
return r;
|
|
10978
11046
|
}
|
|
10979
|
-
async function
|
|
11047
|
+
async function jr(e, t) {
|
|
10980
11048
|
try {
|
|
10981
11049
|
return await t();
|
|
10982
11050
|
} catch (r) {
|
|
@@ -10991,27 +11059,27 @@ async function Lr(e, t) {
|
|
|
10991
11059
|
`
|
|
10992
11060
|
`,
|
|
10993
11061
|
)
|
|
10994
|
-
: process.stderr.write(`${
|
|
11062
|
+
: process.stderr.write(`${a.red('Error:')} ${E(r).join(`
|
|
10995
11063
|
`)}
|
|
10996
11064
|
`),
|
|
10997
11065
|
process.exit(r.exitCode)),
|
|
10998
|
-
process.stderr.write(`${
|
|
11066
|
+
process.stderr.write(`${a.red('Error:')} ${r instanceof Error ? r.message : String(r)}
|
|
10999
11067
|
`),
|
|
11000
11068
|
process.exit(T));
|
|
11001
11069
|
}
|
|
11002
11070
|
}
|
|
11003
|
-
function
|
|
11004
|
-
let t = e[0].map((
|
|
11005
|
-
r = (
|
|
11071
|
+
function dt(e) {
|
|
11072
|
+
let t = e[0].map((i, n) => Math.max(...e.map((s) => s[n].length))),
|
|
11073
|
+
r = (i) => e.slice(1).every((n) => /^[-+$\d]/.test(n[i]));
|
|
11006
11074
|
return e.map(
|
|
11007
|
-
(
|
|
11008
|
-
` ${
|
|
11075
|
+
(i) =>
|
|
11076
|
+
` ${i
|
|
11009
11077
|
.map((n, s) => (s > 0 && r(s) ? n.padStart(t[s]) : n.padEnd(t[s])))
|
|
11010
11078
|
.join(' ')
|
|
11011
11079
|
.trimEnd()}`,
|
|
11012
11080
|
);
|
|
11013
11081
|
}
|
|
11014
|
-
function
|
|
11082
|
+
function za(e) {
|
|
11015
11083
|
let t = e.summary,
|
|
11016
11084
|
r = [
|
|
11017
11085
|
` 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}` : ''}`,
|
|
@@ -11021,46 +11089,46 @@ function Na(e) {
|
|
|
11021
11089
|
];
|
|
11022
11090
|
return (
|
|
11023
11091
|
e.by_channel.length &&
|
|
11024
|
-
(r.push('',
|
|
11092
|
+
(r.push('', a.bold('By channel')),
|
|
11025
11093
|
r.push(
|
|
11026
|
-
...
|
|
11094
|
+
...dt([
|
|
11027
11095
|
['Channel', 'Spend', 'Requests'],
|
|
11028
|
-
...e.by_channel.map((
|
|
11096
|
+
...e.by_channel.map((i) => [i.channel, P(i.spend), String(i.requests)]),
|
|
11029
11097
|
]),
|
|
11030
11098
|
)),
|
|
11031
11099
|
e.by_model.length &&
|
|
11032
|
-
(r.push('',
|
|
11100
|
+
(r.push('', a.bold('By model')),
|
|
11033
11101
|
r.push(
|
|
11034
|
-
...
|
|
11102
|
+
...dt([
|
|
11035
11103
|
['Model', 'Spend', 'Requests', 'Failed'],
|
|
11036
|
-
...e.by_model.map((
|
|
11104
|
+
...e.by_model.map((i) => [i.name, P(i.spend), String(i.requests), String(i.failed)]),
|
|
11037
11105
|
]),
|
|
11038
11106
|
)),
|
|
11039
11107
|
r
|
|
11040
11108
|
);
|
|
11041
11109
|
}
|
|
11042
|
-
async function
|
|
11110
|
+
async function Gr(e) {
|
|
11043
11111
|
let t = !!e.json,
|
|
11044
|
-
r =
|
|
11045
|
-
|
|
11112
|
+
r = Fr(e),
|
|
11113
|
+
i = await jr(t, () => r.getUsage(Br(e, ['range', 'from', 'to', 'model', 'channel'])));
|
|
11046
11114
|
if (t) {
|
|
11047
11115
|
process.stdout.write(
|
|
11048
|
-
JSON.stringify(
|
|
11116
|
+
JSON.stringify(i, null, 2) +
|
|
11049
11117
|
`
|
|
11050
11118
|
`,
|
|
11051
11119
|
);
|
|
11052
11120
|
return;
|
|
11053
11121
|
}
|
|
11054
11122
|
process.stdout.write(`
|
|
11055
|
-
${
|
|
11056
|
-
${
|
|
11123
|
+
${a.bold('Tein usage')}
|
|
11124
|
+
${za(i).join(`
|
|
11057
11125
|
`)}
|
|
11058
11126
|
|
|
11059
11127
|
`);
|
|
11060
11128
|
}
|
|
11061
|
-
function
|
|
11129
|
+
function Wa(e) {
|
|
11062
11130
|
return e.data.length
|
|
11063
|
-
?
|
|
11131
|
+
? dt([
|
|
11064
11132
|
['When (UTC)', 'Amount', 'Balance after', 'What'],
|
|
11065
11133
|
...e.data.map((t) => [
|
|
11066
11134
|
t.created_at.slice(0, 16).replace('T', ' '),
|
|
@@ -11071,37 +11139,37 @@ function Va(e) {
|
|
|
11071
11139
|
])
|
|
11072
11140
|
: [' No transactions yet.'];
|
|
11073
11141
|
}
|
|
11074
|
-
async function
|
|
11142
|
+
async function Hr(e) {
|
|
11075
11143
|
let t = !!e.json,
|
|
11076
|
-
r =
|
|
11077
|
-
|
|
11144
|
+
r = Fr(e),
|
|
11145
|
+
i = await jr(t, () => r.getTransactions(Br(e, ['limit', 'type', 'after'])));
|
|
11078
11146
|
if (t) {
|
|
11079
11147
|
process.stdout.write(
|
|
11080
|
-
JSON.stringify(
|
|
11148
|
+
JSON.stringify(i, null, 2) +
|
|
11081
11149
|
`
|
|
11082
11150
|
`,
|
|
11083
11151
|
);
|
|
11084
11152
|
return;
|
|
11085
11153
|
}
|
|
11086
11154
|
let n =
|
|
11087
|
-
|
|
11155
|
+
i.has_more && i.next_cursor
|
|
11088
11156
|
? `
|
|
11089
|
-
More: tein transactions --after ${
|
|
11157
|
+
More: tein transactions --after ${i.next_cursor}`
|
|
11090
11158
|
: '';
|
|
11091
11159
|
process.stdout.write(`
|
|
11092
|
-
${
|
|
11093
|
-
${
|
|
11160
|
+
${a.bold('Tein balance history')}
|
|
11161
|
+
${Wa(i).join(`
|
|
11094
11162
|
`)}${n}
|
|
11095
11163
|
|
|
11096
11164
|
`);
|
|
11097
11165
|
}
|
|
11098
11166
|
R();
|
|
11099
|
-
|
|
11167
|
+
Re();
|
|
11100
11168
|
ie();
|
|
11101
11169
|
R();
|
|
11102
|
-
|
|
11103
|
-
var
|
|
11104
|
-
|
|
11170
|
+
ct();
|
|
11171
|
+
var Ja = 1e4,
|
|
11172
|
+
zr = {
|
|
11105
11173
|
price: '',
|
|
11106
11174
|
creativeMode: 'Creative mode',
|
|
11107
11175
|
priority: 'Priority',
|
|
@@ -11111,27 +11179,27 @@ var Ua = 1e4,
|
|
|
11111
11179
|
priorityDraft: 'Priority + Draft',
|
|
11112
11180
|
creativeModePriorityDraft: 'Creative mode + Priority + Draft',
|
|
11113
11181
|
},
|
|
11114
|
-
|
|
11115
|
-
|
|
11182
|
+
Ya = Object.keys(zr),
|
|
11183
|
+
Xa = {
|
|
11116
11184
|
creativeMode: 'unfiltered',
|
|
11117
11185
|
creativeModePriority: 'unfilteredPriority',
|
|
11118
11186
|
creativeModeDraft: 'unfilteredDraft',
|
|
11119
11187
|
creativeModePriorityDraft: 'unfilteredPriorityDraft',
|
|
11120
11188
|
};
|
|
11121
|
-
function
|
|
11122
|
-
let r =
|
|
11189
|
+
function Qa(e, t) {
|
|
11190
|
+
let r = Xa[t];
|
|
11123
11191
|
return e[t] ?? (r ? e[r] : void 0);
|
|
11124
11192
|
}
|
|
11125
|
-
async function
|
|
11126
|
-
let
|
|
11193
|
+
async function Za(e, t, r = _()) {
|
|
11194
|
+
let i = `${x(e)}${Te(t)}`,
|
|
11127
11195
|
n;
|
|
11128
11196
|
try {
|
|
11129
|
-
n = await fetch(
|
|
11130
|
-
signal: AbortSignal.timeout(
|
|
11197
|
+
n = await fetch(i, {
|
|
11198
|
+
signal: AbortSignal.timeout(Ja),
|
|
11131
11199
|
...(r ? { headers: { Authorization: `Bearer ${r}` } } : {}),
|
|
11132
11200
|
});
|
|
11133
11201
|
} catch {
|
|
11134
|
-
throw new Error(`Could not reach ${
|
|
11202
|
+
throw new Error(`Could not reach ${i}`);
|
|
11135
11203
|
}
|
|
11136
11204
|
let s = await n.json().catch(() => null);
|
|
11137
11205
|
if (!n.ok || !s || s.object !== 'list' || !s.board) {
|
|
@@ -11145,95 +11213,95 @@ async function Ga(e, t, r = _()) {
|
|
|
11145
11213
|
}
|
|
11146
11214
|
return s;
|
|
11147
11215
|
}
|
|
11148
|
-
function
|
|
11216
|
+
function Me(e) {
|
|
11149
11217
|
let t = e.toFixed(4).replace(/0+$/, '').replace(/\.$/, ''),
|
|
11150
|
-
[r,
|
|
11151
|
-
return `$${r}.${
|
|
11218
|
+
[r, i = ''] = t.split('.');
|
|
11219
|
+
return `$${r}.${i.padEnd(2, '0')}`;
|
|
11152
11220
|
}
|
|
11153
11221
|
function X(e) {
|
|
11154
11222
|
if (!e || typeof e.starter != 'number') return null;
|
|
11155
11223
|
let t = typeof e.plus == 'number' ? e.plus : e.starter,
|
|
11156
11224
|
r = typeof e.scale == 'number' ? e.scale : t;
|
|
11157
|
-
return `Starter ${
|
|
11225
|
+
return `Starter ${Me(e.starter)} Plus ${Me(t)} Scale ${Me(r)}`;
|
|
11158
11226
|
}
|
|
11159
|
-
function
|
|
11160
|
-
let t =
|
|
11227
|
+
function Wr(e) {
|
|
11228
|
+
let t = zr[e];
|
|
11161
11229
|
return t ? ` (${t})` : '';
|
|
11162
11230
|
}
|
|
11163
|
-
function
|
|
11231
|
+
function ut(e) {
|
|
11164
11232
|
let t = X(e.price) ?? '',
|
|
11165
|
-
r = e.public ? ` ${
|
|
11166
|
-
return `${e.label}${
|
|
11233
|
+
r = e.public ? ` ${a.dim(`(published Starter ${Me(e.public.starter)})`)}` : '';
|
|
11234
|
+
return `${e.label}${Wr(e.table)} ${t}${r}`;
|
|
11167
11235
|
}
|
|
11168
|
-
function
|
|
11169
|
-
return `${e}|${
|
|
11236
|
+
function mt(e, t, r, i = !1) {
|
|
11237
|
+
return `${e}|${i ? 'edit/' : ''}${t}|${r}`;
|
|
11170
11238
|
}
|
|
11171
|
-
function
|
|
11239
|
+
function en(e) {
|
|
11172
11240
|
let t = new Map();
|
|
11173
11241
|
for (let r of e ?? []) {
|
|
11174
|
-
let
|
|
11175
|
-
t.set(
|
|
11242
|
+
let i = r.addon ? `addon/${r.addon}` : (r.variant ?? '');
|
|
11243
|
+
t.set(mt(r.slug, i, r.table, r.edit === !0), r);
|
|
11176
11244
|
}
|
|
11177
11245
|
return t;
|
|
11178
11246
|
}
|
|
11179
|
-
function
|
|
11247
|
+
function tn(e) {
|
|
11180
11248
|
if (typeof e.label == 'string' && e.label.trim()) return e.label.trim();
|
|
11181
11249
|
let t = [];
|
|
11182
11250
|
for (let r of ['endpoint', 'resolution', 'quality', 'mode', 'task', 'component', 'token']) {
|
|
11183
|
-
let
|
|
11184
|
-
|
|
11251
|
+
let i = e[r];
|
|
11252
|
+
i != null && i !== '' && t.push(String(i));
|
|
11185
11253
|
}
|
|
11186
11254
|
return (
|
|
11187
11255
|
e.withVideo === !0 && t.push('with video'),
|
|
11188
11256
|
t.length ? t.join(' \xB7 ') : String(e.id ?? 'default')
|
|
11189
11257
|
);
|
|
11190
11258
|
}
|
|
11191
|
-
function
|
|
11192
|
-
let s =
|
|
11193
|
-
for (let o of
|
|
11194
|
-
let
|
|
11195
|
-
if (!
|
|
11196
|
-
let l =
|
|
11197
|
-
r.push(` ${s}${l} ${
|
|
11198
|
-
let c =
|
|
11199
|
-
c && (n.add(c), r.push(` ${
|
|
11259
|
+
function rn(e, t, r, i, n) {
|
|
11260
|
+
let s = tn(t);
|
|
11261
|
+
for (let o of Ya) {
|
|
11262
|
+
let p = X(Qa(t, o));
|
|
11263
|
+
if (!p) continue;
|
|
11264
|
+
let l = Wr(o);
|
|
11265
|
+
r.push(` ${s}${l} ${p}`);
|
|
11266
|
+
let c = i.get(mt(e, String(t.id ?? ''), o));
|
|
11267
|
+
c && (n.add(c), r.push(` ${a.yellow('Your price')} ${X(c.price) ?? ''}`));
|
|
11200
11268
|
}
|
|
11201
11269
|
}
|
|
11202
|
-
function
|
|
11270
|
+
function an(e, t, r, i) {
|
|
11203
11271
|
let n = e.quality ? ` quality=${e.quality}` : '';
|
|
11204
11272
|
t.push(
|
|
11205
|
-
` ${
|
|
11273
|
+
` ${a.bold(e.slug.padEnd(26))} ${a.gray(e.name)} ${a.dim(`${e.kind} ${e.unit} model=${e.model}${n}`)}`,
|
|
11206
11274
|
);
|
|
11207
|
-
for (let o of e.variants ?? [])
|
|
11275
|
+
for (let o of e.variants ?? []) rn(e.slug, o, t, r, i);
|
|
11208
11276
|
let s = e.addons;
|
|
11209
11277
|
if (Array.isArray(s))
|
|
11210
11278
|
for (let o of s) {
|
|
11211
11279
|
if (!o || typeof o != 'object') continue;
|
|
11212
|
-
let
|
|
11213
|
-
l = typeof
|
|
11214
|
-
c = X(
|
|
11280
|
+
let p = o,
|
|
11281
|
+
l = typeof p.label == 'string' ? p.label : String(p.id ?? 'add-on'),
|
|
11282
|
+
c = X(p.price);
|
|
11215
11283
|
c && t.push(` ${l} (add-on) ${c}`);
|
|
11216
|
-
let
|
|
11217
|
-
c &&
|
|
11284
|
+
let d = r.get(mt(e.slug, `addon/${String(p.id ?? '')}`, 'price'));
|
|
11285
|
+
c && d && (i.add(d), t.push(` ${a.yellow('Your price')} ${X(d.price) ?? ''}`));
|
|
11218
11286
|
}
|
|
11219
11287
|
for (let o of Array.isArray(e.notes) ? e.notes : [])
|
|
11220
|
-
typeof o == 'string' && o.trim() && t.push(` ${
|
|
11288
|
+
typeof o == 'string' && o.trim() && t.push(` ${a.dim(o.trim())}`);
|
|
11221
11289
|
t.push('');
|
|
11222
11290
|
}
|
|
11223
|
-
function
|
|
11291
|
+
function nn(e) {
|
|
11224
11292
|
let t = [],
|
|
11225
11293
|
r = e.board.checked ? ` \xB7 checked ${e.board.checked}` : '';
|
|
11226
|
-
(t.push(`${
|
|
11294
|
+
(t.push(`${a.bold('Tein prices')} ${a.green(e.currency)} ${e.count} models${r}`),
|
|
11227
11295
|
t.push(
|
|
11228
|
-
`${
|
|
11296
|
+
`${a.dim('Starter, Plus and Scale. Creative mode, Priority and draft show only where published.')}`,
|
|
11229
11297
|
));
|
|
11230
|
-
let
|
|
11231
|
-
(
|
|
11298
|
+
let i = e.your_prices?.rows ?? [];
|
|
11299
|
+
(i.length &&
|
|
11232
11300
|
t.push(
|
|
11233
|
-
`${
|
|
11301
|
+
`${a.yellow('Your price')} ${a.dim('rows are the prices your workspace pays instead of the published ones.')}`,
|
|
11234
11302
|
),
|
|
11235
11303
|
t.push(''));
|
|
11236
|
-
let n =
|
|
11304
|
+
let n = en(i),
|
|
11237
11305
|
s = new Set(),
|
|
11238
11306
|
o = new Map();
|
|
11239
11307
|
for (let m of e.board.models) {
|
|
@@ -11241,28 +11309,28 @@ function Ya(e) {
|
|
|
11241
11309
|
f = o.get(g) ?? [];
|
|
11242
11310
|
(f.push(m), o.set(g, f));
|
|
11243
11311
|
}
|
|
11244
|
-
let
|
|
11312
|
+
let p = ['video', 'image', 'audio', 'llm', 'text', '3d'],
|
|
11245
11313
|
l = [...o.keys()].sort((m, g) => {
|
|
11246
|
-
let f =
|
|
11247
|
-
C =
|
|
11314
|
+
let f = p.indexOf(m),
|
|
11315
|
+
C = p.indexOf(g);
|
|
11248
11316
|
return (f === -1 ? 99 : f) - (C === -1 ? 99 : C);
|
|
11249
11317
|
});
|
|
11250
11318
|
for (let m of l) {
|
|
11251
|
-
t.push(`${
|
|
11252
|
-
for (let g of o.get(m) ?? [])
|
|
11319
|
+
t.push(`${a.bold(a.cyan(`\u2500\u2500 ${m} \u2500\u2500`))}`);
|
|
11320
|
+
for (let g of o.get(m) ?? []) an(g, t, n, s);
|
|
11253
11321
|
}
|
|
11254
|
-
let c =
|
|
11322
|
+
let c = i.filter((m) => !s.has(m));
|
|
11255
11323
|
if (c.length) {
|
|
11256
|
-
t.push(`${
|
|
11324
|
+
t.push(`${a.bold(a.cyan('\u2500\u2500 your prices \u2500\u2500'))}`);
|
|
11257
11325
|
for (let m of c)
|
|
11258
|
-
(t.push(` ${
|
|
11259
|
-
t.push(` ${
|
|
11326
|
+
(t.push(` ${a.bold(m.slug.padEnd(26))} ${a.gray(m.name)} ${a.dim(m.unit)}`),
|
|
11327
|
+
t.push(` ${a.yellow('Your price')} ${ut(m)}`));
|
|
11260
11328
|
t.push('');
|
|
11261
11329
|
}
|
|
11262
|
-
let
|
|
11263
|
-
u = (e.configs ?? []).filter((m) => !
|
|
11330
|
+
let d = new Set(e.board.models.map((m) => m.slug.toLowerCase())),
|
|
11331
|
+
u = (e.configs ?? []).filter((m) => !d.has(String(m.modelSlug ?? '').toLowerCase()));
|
|
11264
11332
|
if (u.length) {
|
|
11265
|
-
t.push(`${
|
|
11333
|
+
t.push(`${a.bold(a.cyan('\u2500\u2500 other prices \u2500\u2500'))}`);
|
|
11266
11334
|
let m = new Map();
|
|
11267
11335
|
for (let g of u) {
|
|
11268
11336
|
let f = String(g.modelSlug ?? ''),
|
|
@@ -11271,7 +11339,7 @@ function Ya(e) {
|
|
|
11271
11339
|
}
|
|
11272
11340
|
for (let [g, f] of m) {
|
|
11273
11341
|
let C = String(f[0]?.modelName ?? g);
|
|
11274
|
-
t.push(` ${
|
|
11342
|
+
t.push(` ${a.bold(g.padEnd(26))} ${a.gray(C)}`);
|
|
11275
11343
|
for (let U of f) {
|
|
11276
11344
|
let w = String(U.displayLabel ?? U.billingUnit ?? 'price'),
|
|
11277
11345
|
h = X(U.prices);
|
|
@@ -11281,19 +11349,19 @@ function Ya(e) {
|
|
|
11281
11349
|
}
|
|
11282
11350
|
}
|
|
11283
11351
|
return (
|
|
11284
|
-
t.push(`${
|
|
11352
|
+
t.push(`${a.dim('JSON:')} ${a.cyan('tein pricing --json')}`),
|
|
11285
11353
|
`${t.join(`
|
|
11286
11354
|
`)}
|
|
11287
11355
|
`
|
|
11288
11356
|
);
|
|
11289
11357
|
}
|
|
11290
|
-
async function
|
|
11358
|
+
async function Jr(e) {
|
|
11291
11359
|
let t;
|
|
11292
11360
|
try {
|
|
11293
|
-
t = await
|
|
11361
|
+
t = await Za(e.apiUrl, e.model);
|
|
11294
11362
|
} catch (r) {
|
|
11295
|
-
let
|
|
11296
|
-
(process.stderr.write(`${
|
|
11363
|
+
let i = r instanceof Error ? r.message : String(r);
|
|
11364
|
+
(process.stderr.write(`${a.red('Error:')} ${i}
|
|
11297
11365
|
`),
|
|
11298
11366
|
process.exit(1));
|
|
11299
11367
|
}
|
|
@@ -11301,73 +11369,73 @@ async function Fr(e) {
|
|
|
11301
11369
|
e.json
|
|
11302
11370
|
? `${JSON.stringify(t, null, 2)}
|
|
11303
11371
|
`
|
|
11304
|
-
:
|
|
11372
|
+
: nn(t),
|
|
11305
11373
|
);
|
|
11306
11374
|
}
|
|
11307
|
-
var
|
|
11308
|
-
async function
|
|
11375
|
+
var sn = 3e3;
|
|
11376
|
+
async function Yr(e, t) {
|
|
11309
11377
|
let r = t ?? _();
|
|
11310
11378
|
try {
|
|
11311
|
-
let
|
|
11312
|
-
signal: AbortSignal.timeout(
|
|
11379
|
+
let i = await fetch(`${x(e)}/v1/pricing`, {
|
|
11380
|
+
signal: AbortSignal.timeout(sn),
|
|
11313
11381
|
...(r ? { headers: { Authorization: `Bearer ${r}` } } : {}),
|
|
11314
11382
|
});
|
|
11315
|
-
if (!
|
|
11316
|
-
let n = await
|
|
11383
|
+
if (!i.ok) return { live: !1, yourPrices: null };
|
|
11384
|
+
let n = await i.json(),
|
|
11317
11385
|
s = {};
|
|
11318
|
-
for (let
|
|
11319
|
-
let l = String(
|
|
11320
|
-
ce.has(l) && (s[l] ??= []).push(Number(
|
|
11386
|
+
for (let p of n.configs ?? []) {
|
|
11387
|
+
let l = String(p.modelSlug ?? '');
|
|
11388
|
+
ce.has(l) && (s[l] ??= []).push(Number(p.starterPrice));
|
|
11321
11389
|
}
|
|
11322
|
-
(
|
|
11390
|
+
(Ir(s), Rr(n.price_texts));
|
|
11323
11391
|
let o = n.your_prices?.rows;
|
|
11324
11392
|
return { live: !0, yourPrices: Array.isArray(o) ? o : null };
|
|
11325
11393
|
} catch {
|
|
11326
11394
|
return { live: !1, yourPrices: null };
|
|
11327
11395
|
}
|
|
11328
11396
|
}
|
|
11329
|
-
function
|
|
11397
|
+
function on(e) {
|
|
11330
11398
|
return G(e.slug) ? e.slug : e.model;
|
|
11331
11399
|
}
|
|
11332
|
-
function
|
|
11333
|
-
return (t ?? []).filter((r) => r &&
|
|
11400
|
+
function Xr(e, t) {
|
|
11401
|
+
return (t ?? []).filter((r) => r && on(r) === e);
|
|
11334
11402
|
}
|
|
11335
|
-
var
|
|
11336
|
-
|
|
11337
|
-
async function
|
|
11338
|
-
let r = await
|
|
11339
|
-
|
|
11403
|
+
var ln = new Set(['video', 'image', 'text', 'audio', '3d']),
|
|
11404
|
+
pn = { llm: 'text', chat: 'text', reasoning: 'text' };
|
|
11405
|
+
async function Qr(e, t) {
|
|
11406
|
+
let r = await Yr(t),
|
|
11407
|
+
i = N();
|
|
11340
11408
|
if (e) {
|
|
11341
11409
|
let o = e.toLowerCase(),
|
|
11342
|
-
|
|
11343
|
-
|
|
11344
|
-
?
|
|
11345
|
-
:
|
|
11410
|
+
p = pn[o] ?? o;
|
|
11411
|
+
i = ln.has(p)
|
|
11412
|
+
? i.filter((l) => l.category.toLowerCase() === p)
|
|
11413
|
+
: i.filter((l) => l.kind.toLowerCase().includes(o) || l.slug.toLowerCase().includes(o));
|
|
11346
11414
|
}
|
|
11347
11415
|
(process.stdout.write(`
|
|
11348
|
-
${
|
|
11416
|
+
${a.bold('Tein AI Models Catalog')} (${i.length} available)
|
|
11349
11417
|
`),
|
|
11350
11418
|
process.stdout
|
|
11351
|
-
.write(`${
|
|
11419
|
+
.write(`${a.dim('Run `tein info <model-slug>` to see detailed parameters and options.')}
|
|
11352
11420
|
|
|
11353
11421
|
`));
|
|
11354
11422
|
let n = {};
|
|
11355
|
-
for (let o of
|
|
11356
|
-
let
|
|
11357
|
-
(n[
|
|
11423
|
+
for (let o of i) {
|
|
11424
|
+
let p = o.category;
|
|
11425
|
+
(n[p] || (n[p] = []), n[p].push(o));
|
|
11358
11426
|
}
|
|
11359
11427
|
let s = ['Video', 'Image', 'Text', 'Audio', '3D'];
|
|
11360
11428
|
for (let o of s) {
|
|
11361
|
-
let
|
|
11362
|
-
if (!(!
|
|
11363
|
-
process.stdout.write(`${
|
|
11429
|
+
let p = n[o];
|
|
11430
|
+
if (!(!p || p.length === 0)) {
|
|
11431
|
+
process.stdout.write(`${a.bold(a.cyan(`\u2500\u2500 ${o} Models \u2500\u2500`))}
|
|
11364
11432
|
`);
|
|
11365
|
-
for (let l of
|
|
11433
|
+
for (let l of p) {
|
|
11366
11434
|
let c = l.slug.padEnd(24),
|
|
11367
|
-
|
|
11435
|
+
d = l.name.padEnd(22),
|
|
11368
11436
|
u = l.priceFormatted.padEnd(22),
|
|
11369
|
-
m =
|
|
11370
|
-
process.stdout.write(` ${
|
|
11437
|
+
m = Xr(l.slug, r.yourPrices).length ? ` ${a.yellow('Your price')}` : '';
|
|
11438
|
+
process.stdout.write(` ${a.bold(c)} ${a.gray(d)} ${a.green(u)} ${a.dim(l.vendor)}${m}
|
|
11371
11439
|
`);
|
|
11372
11440
|
}
|
|
11373
11441
|
process.stdout.write(`
|
|
@@ -11376,69 +11444,69 @@ ${i.bold('Tein AI Models Catalog')} (${a.length} available)
|
|
|
11376
11444
|
}
|
|
11377
11445
|
(r.yourPrices?.length &&
|
|
11378
11446
|
process.stdout
|
|
11379
|
-
.write(`${
|
|
11447
|
+
.write(`${a.yellow('Your price:')} your workspace has its own prices on these models. See ${a.cyan('tein info <model-slug>')} or ${a.cyan('tein pricing <model-slug>')}.
|
|
11380
11448
|
`),
|
|
11381
11449
|
r.live ||
|
|
11382
11450
|
process.stdout
|
|
11383
|
-
.write(`${
|
|
11451
|
+
.write(`${a.dim('Prices could not be checked online; showing the prices this CLI was built with.')}
|
|
11384
11452
|
`),
|
|
11385
11453
|
process.stdout
|
|
11386
|
-
.write(`${
|
|
11454
|
+
.write(`${a.dim('Tip:')} Generate directly with ${a.cyan('tein run <model-slug> --prompt "..."')}
|
|
11387
11455
|
|
|
11388
11456
|
`));
|
|
11389
11457
|
}
|
|
11390
|
-
async function
|
|
11458
|
+
async function Zr(e, t) {
|
|
11391
11459
|
let r = G(e);
|
|
11392
11460
|
r ||
|
|
11393
|
-
(process.stderr.write(`${
|
|
11461
|
+
(process.stderr.write(`${a.red('Error:')} Model "${e}" not found in Tein AI registry.
|
|
11394
11462
|
`),
|
|
11395
|
-
process.stderr.write(`Run ${
|
|
11463
|
+
process.stderr.write(`Run ${a.cyan('tein models')} to see all available model slugs.
|
|
11396
11464
|
`),
|
|
11397
11465
|
process.exit(1));
|
|
11398
|
-
let
|
|
11466
|
+
let i = await Yr(t);
|
|
11399
11467
|
(process.stdout.write(`
|
|
11400
|
-
${
|
|
11468
|
+
${a.bold(a.cyan(r.name))} (${a.bold(r.slug)})
|
|
11401
11469
|
`),
|
|
11402
|
-
process.stdout.write(` ${
|
|
11470
|
+
process.stdout.write(` ${a.gray(r.description)}
|
|
11403
11471
|
|
|
11404
11472
|
`),
|
|
11405
|
-
process.stdout.write(`${
|
|
11473
|
+
process.stdout.write(`${a.bold('Metadata:')}
|
|
11406
11474
|
`),
|
|
11407
|
-
process.stdout.write(` Category: ${
|
|
11475
|
+
process.stdout.write(` Category: ${a.yellow(r.category)}
|
|
11408
11476
|
`),
|
|
11409
11477
|
process.stdout.write(` Kind: ${r.kind}
|
|
11410
11478
|
`),
|
|
11411
11479
|
process.stdout.write(` Vendor: ${r.vendor}
|
|
11412
11480
|
`),
|
|
11413
|
-
process.stdout.write(` Pricing: ${
|
|
11481
|
+
process.stdout.write(` Pricing: ${a.green(r.priceFormatted)}
|
|
11414
11482
|
`));
|
|
11415
11483
|
for (let n of r.priceNotes ?? [])
|
|
11416
|
-
process.stdout.write(` ${
|
|
11484
|
+
process.stdout.write(` ${a.dim(n)}
|
|
11417
11485
|
`);
|
|
11418
|
-
for (let n of
|
|
11486
|
+
for (let n of Xr(r.slug, i.yourPrices)) {
|
|
11419
11487
|
let s = n.slug === r.slug ? n : { ...n, label: `${n.name} \xB7 ${n.label}` };
|
|
11420
|
-
process.stdout.write(` ${
|
|
11488
|
+
process.stdout.write(` ${a.yellow('Your price:')} ${ut(s)}
|
|
11421
11489
|
`);
|
|
11422
11490
|
}
|
|
11423
|
-
(
|
|
11424
|
-
process.stdout.write(` ${
|
|
11491
|
+
(i.live ||
|
|
11492
|
+
process.stdout.write(` ${a.dim('(the price this CLI was built with: offline)')}
|
|
11425
11493
|
`),
|
|
11426
11494
|
process.stdout.write(`
|
|
11427
11495
|
`),
|
|
11428
|
-
process.stdout.write(`${
|
|
11496
|
+
process.stdout.write(`${a.bold('Parameters:')}
|
|
11429
11497
|
`));
|
|
11430
11498
|
for (let n of r.parameters) {
|
|
11431
|
-
let s = n.required ?
|
|
11432
|
-
o = n.default !== void 0 ?
|
|
11499
|
+
let s = n.required ? a.red('(required)') : a.dim('(optional)'),
|
|
11500
|
+
o = n.default !== void 0 ? a.dim(` [default: ${n.default}]`) : '';
|
|
11433
11501
|
(process.stdout
|
|
11434
|
-
.write(` ${
|
|
11502
|
+
.write(` ${a.bold(`--${n.name.replace(/_/g, '-')}`)} ${a.yellow(`<${n.type}>`)} ${s}${o}
|
|
11435
11503
|
`),
|
|
11436
11504
|
n.description &&
|
|
11437
|
-
process.stdout.write(` ${
|
|
11505
|
+
process.stdout.write(` ${a.gray(n.description)}
|
|
11438
11506
|
`),
|
|
11439
11507
|
n.options &&
|
|
11440
11508
|
n.options.length > 0 &&
|
|
11441
|
-
process.stdout.write(` Allowed values: ${
|
|
11509
|
+
process.stdout.write(` Allowed values: ${a.dim(n.options.join(', '))}
|
|
11442
11510
|
`),
|
|
11443
11511
|
(n.min !== void 0 || n.max !== void 0) &&
|
|
11444
11512
|
process.stdout.write(` Range: ${n.min ?? ''} to ${n.max ?? ''}
|
|
@@ -11449,70 +11517,70 @@ ${i.bold(i.cyan(r.name))} (${i.bold(r.slug)})
|
|
|
11449
11517
|
if (
|
|
11450
11518
|
(r.parameters.some((n) => n.name === 'callback_url') ||
|
|
11451
11519
|
(process.stdout
|
|
11452
|
-
.write(` ${
|
|
11520
|
+
.write(` ${a.bold('--callback-url')} ${a.yellow('<string>')} ${a.dim('(optional)')}
|
|
11453
11521
|
`),
|
|
11454
11522
|
process.stdout
|
|
11455
|
-
.write(` ${
|
|
11523
|
+
.write(` ${a.gray('HTTPS URL. Tein POSTs the finished job here when it succeeds, fails, expires, or is cancelled.')}
|
|
11456
11524
|
|
|
11457
11525
|
`)),
|
|
11458
|
-
process.stdout.write(`${
|
|
11526
|
+
process.stdout.write(`${a.bold('Sample CLI Usage:')}
|
|
11459
11527
|
`),
|
|
11460
11528
|
r.category === 'Video')
|
|
11461
11529
|
)
|
|
11462
11530
|
process.stdout
|
|
11463
|
-
.write(` ${
|
|
11531
|
+
.write(` ${a.cyan(`tein run ${r.slug} --prompt "Cinematic camera drone shot of a coastline" --aspect-ratio 16:9 --duration 5 -o output.mp4`)}
|
|
11464
11532
|
|
|
11465
11533
|
`);
|
|
11466
11534
|
else if (r.category === 'Image') {
|
|
11467
11535
|
let n = r.parameters.some((s) => s.name === 'aspect_ratio') ? ' --aspect-ratio 16:9' : '';
|
|
11468
11536
|
process.stdout
|
|
11469
|
-
.write(` ${
|
|
11537
|
+
.write(` ${a.cyan(`tein run ${r.slug} --prompt "Cyberpunk city in the rain, 8k render"${n} -o output.png`)}
|
|
11470
11538
|
|
|
11471
11539
|
`);
|
|
11472
11540
|
} else
|
|
11473
11541
|
r.category === 'Audio'
|
|
11474
11542
|
? process.stdout
|
|
11475
|
-
.write(` ${
|
|
11543
|
+
.write(` ${a.cyan(`tein run ${r.slug} --prompt "Hello world from Tein AI" --speaker en_female_warm -o speech.wav`)}
|
|
11476
11544
|
|
|
11477
11545
|
`)
|
|
11478
11546
|
: process.stdout
|
|
11479
|
-
.write(` ${
|
|
11547
|
+
.write(` ${a.cyan(`tein run ${r.slug} --prompt "Explain quantum computing in simple terms"`)}
|
|
11480
11548
|
|
|
11481
11549
|
`);
|
|
11482
11550
|
}
|
|
11483
|
-
var
|
|
11551
|
+
var ei = M(require('node:path'));
|
|
11484
11552
|
R();
|
|
11485
|
-
async function
|
|
11553
|
+
async function ti(e, t) {
|
|
11486
11554
|
let r = _(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
11487
|
-
|
|
11555
|
+
i = x(typeof t.api_url == 'string' ? t.api_url : void 0);
|
|
11488
11556
|
(r ||
|
|
11489
|
-
(process.stderr.write(`${
|
|
11557
|
+
(process.stderr.write(`${a.red('Error:')} Authentication required.
|
|
11490
11558
|
`),
|
|
11491
11559
|
process.stderr
|
|
11492
|
-
.write(`Please run ${
|
|
11560
|
+
.write(`Please run ${a.cyan('tein auth login')} or set ${a.cyan('TEIN_API_KEY')} environment variable.
|
|
11493
11561
|
`),
|
|
11494
11562
|
process.exit(1)),
|
|
11495
11563
|
e ||
|
|
11496
|
-
(process.stderr.write(`${
|
|
11564
|
+
(process.stderr.write(`${a.red('Error:')} Missing request ID.
|
|
11497
11565
|
`),
|
|
11498
|
-
process.stderr.write(`Usage: ${
|
|
11566
|
+
process.stderr.write(`Usage: ${a.cyan('tein status <request-id> [--wait] [-o output.mp4]')}
|
|
11499
11567
|
`),
|
|
11500
11568
|
process.exit(1)));
|
|
11501
11569
|
let n = !!t.json,
|
|
11502
11570
|
s = !!t.wait,
|
|
11503
11571
|
o = typeof t.output == 'string' ? t.output : void 0,
|
|
11504
|
-
|
|
11505
|
-
l = new $(`Checking status of ${
|
|
11572
|
+
p = new K(r, i),
|
|
11573
|
+
l = new $(`Checking status of ${a.bold(e)}...`);
|
|
11506
11574
|
n || l.start();
|
|
11507
11575
|
let c;
|
|
11508
11576
|
try {
|
|
11509
|
-
c = await
|
|
11510
|
-
} catch (
|
|
11511
|
-
(
|
|
11577
|
+
c = await p.getStatus(e);
|
|
11578
|
+
} catch (d) {
|
|
11579
|
+
(d instanceof b &&
|
|
11512
11580
|
(n
|
|
11513
11581
|
? process.stdout.write(
|
|
11514
11582
|
JSON.stringify(
|
|
11515
|
-
{ error: { code:
|
|
11583
|
+
{ error: { code: d.code ?? null, message: d.message, ...d.fields } },
|
|
11516
11584
|
null,
|
|
11517
11585
|
2,
|
|
11518
11586
|
) +
|
|
@@ -11520,21 +11588,21 @@ async function Wr(e, t) {
|
|
|
11520
11588
|
`,
|
|
11521
11589
|
)
|
|
11522
11590
|
: l.fail(
|
|
11523
|
-
E(
|
|
11591
|
+
E(d).join(`
|
|
11524
11592
|
`),
|
|
11525
11593
|
),
|
|
11526
|
-
process.exit(
|
|
11527
|
-
n || l.fail(
|
|
11594
|
+
process.exit(d.exitCode)),
|
|
11595
|
+
n || l.fail(d instanceof Error ? d.message : String(d)),
|
|
11528
11596
|
process.exit(T));
|
|
11529
11597
|
}
|
|
11530
11598
|
if (s && c.status === 'processing') {
|
|
11531
|
-
let
|
|
11599
|
+
let d = Date.now();
|
|
11532
11600
|
for (; c.status === 'processing';) {
|
|
11533
|
-
let u = Math.round((Date.now() -
|
|
11534
|
-
(n || l.update(`Waiting for ${
|
|
11601
|
+
let u = Math.round((Date.now() - d) / 1e3);
|
|
11602
|
+
(n || l.update(`Waiting for ${a.bold(c.model)} (${u}s elapsed)...`),
|
|
11535
11603
|
await new Promise((m) => setTimeout(m, 1500)));
|
|
11536
11604
|
try {
|
|
11537
|
-
c = await
|
|
11605
|
+
c = await p.getStatus(e);
|
|
11538
11606
|
} catch {}
|
|
11539
11607
|
}
|
|
11540
11608
|
}
|
|
@@ -11556,72 +11624,72 @@ async function Wr(e, t) {
|
|
|
11556
11624
|
}
|
|
11557
11625
|
if (
|
|
11558
11626
|
(process.stdout.write(`
|
|
11559
|
-
${
|
|
11627
|
+
${a.bold('Model:')} ${c.model}
|
|
11560
11628
|
`),
|
|
11561
11629
|
process.stdout
|
|
11562
|
-
.write(` ${
|
|
11630
|
+
.write(` ${a.bold('Status:')} ${c.status === 'succeeded' ? a.green(c.status) : c.status === 'processing' ? a.yellow(c.status) : a.red(c.status)}
|
|
11563
11631
|
`),
|
|
11564
|
-
process.stdout.write(` ${
|
|
11632
|
+
process.stdout.write(` ${a.bold('Request ID:')} ${c.request_id}
|
|
11565
11633
|
`),
|
|
11566
11634
|
c.output && c.output.length > 0)
|
|
11567
11635
|
) {
|
|
11568
11636
|
process.stdout.write(`
|
|
11569
|
-
${
|
|
11637
|
+
${a.bold('Outputs:')}
|
|
11570
11638
|
`);
|
|
11571
|
-
for (let
|
|
11572
|
-
if (
|
|
11639
|
+
for (let d of c.output)
|
|
11640
|
+
if (d.url) {
|
|
11573
11641
|
if (
|
|
11574
|
-
(process.stdout.write(` [${
|
|
11642
|
+
(process.stdout.write(` [${d.type.toUpperCase()}] ${a.cyan(a.underline(d.url))}
|
|
11575
11643
|
`),
|
|
11576
11644
|
o)
|
|
11577
11645
|
) {
|
|
11578
11646
|
let u = new $(`Downloading output to ${o}...`).start();
|
|
11579
11647
|
try {
|
|
11580
|
-
(await
|
|
11581
|
-
u.succeed(`Saved to ${
|
|
11648
|
+
(await p.downloadOutput(d.url, ei.default.resolve(process.cwd(), o)),
|
|
11649
|
+
u.succeed(`Saved to ${a.bold(o)}`));
|
|
11582
11650
|
} catch (m) {
|
|
11583
11651
|
u.fail(`Failed to download: ${m instanceof Error ? m.message : m}`);
|
|
11584
11652
|
}
|
|
11585
11653
|
}
|
|
11586
11654
|
} else
|
|
11587
|
-
|
|
11655
|
+
d.text &&
|
|
11588
11656
|
process.stdout.write(`
|
|
11589
|
-
${
|
|
11657
|
+
${d.text}
|
|
11590
11658
|
`);
|
|
11591
11659
|
}
|
|
11592
11660
|
process.stdout.write(`
|
|
11593
11661
|
`);
|
|
11594
11662
|
}
|
|
11595
|
-
var
|
|
11596
|
-
|
|
11663
|
+
var ft = M(require('node:fs')),
|
|
11664
|
+
gt = M(require('node:path'));
|
|
11597
11665
|
R();
|
|
11598
|
-
async function
|
|
11666
|
+
async function ri(e, t = {}) {
|
|
11599
11667
|
let r = _(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
11600
|
-
|
|
11668
|
+
i = x(typeof t.api_url == 'string' ? t.api_url : void 0),
|
|
11601
11669
|
n = !!t.json;
|
|
11602
11670
|
(r ||
|
|
11603
|
-
(process.stderr.write(`${
|
|
11671
|
+
(process.stderr.write(`${a.red('Error:')} Authentication required.
|
|
11604
11672
|
`),
|
|
11605
11673
|
process.stderr
|
|
11606
|
-
.write(`Please run ${
|
|
11674
|
+
.write(`Please run ${a.cyan('tein auth login')} or set ${a.cyan('TEIN_API_KEY')} environment variable.
|
|
11607
11675
|
`),
|
|
11608
11676
|
process.exit(1)),
|
|
11609
11677
|
e ||
|
|
11610
|
-
(process.stderr.write(`${
|
|
11678
|
+
(process.stderr.write(`${a.red('Error:')} Missing file path.
|
|
11611
11679
|
`),
|
|
11612
|
-
process.stderr.write(`Usage: ${
|
|
11680
|
+
process.stderr.write(`Usage: ${a.cyan('tein upload <image.png|video.mp4>')}
|
|
11613
11681
|
`),
|
|
11614
11682
|
process.exit(1)));
|
|
11615
|
-
let s =
|
|
11616
|
-
|
|
11617
|
-
(process.stderr.write(`${
|
|
11683
|
+
let s = gt.default.resolve(e);
|
|
11684
|
+
ft.default.existsSync(s) ||
|
|
11685
|
+
(process.stderr.write(`${a.red('Error:')} File not found: ${s}
|
|
11618
11686
|
`),
|
|
11619
11687
|
process.exit(1));
|
|
11620
|
-
let o =
|
|
11621
|
-
l =
|
|
11622
|
-
c = new K(r,
|
|
11623
|
-
|
|
11624
|
-
n ||
|
|
11688
|
+
let o = gt.default.basename(s),
|
|
11689
|
+
l = ft.default.readFileSync(s).toString('base64'),
|
|
11690
|
+
c = new K(r, i),
|
|
11691
|
+
d = new $(`Uploading ${a.bold(o)} to Tein AI CDN...`);
|
|
11692
|
+
n || d.start();
|
|
11625
11693
|
try {
|
|
11626
11694
|
let u = await c.uploadAsset(l);
|
|
11627
11695
|
n
|
|
@@ -11630,15 +11698,15 @@ async function Jr(e, t = {}) {
|
|
|
11630
11698
|
`
|
|
11631
11699
|
`,
|
|
11632
11700
|
)
|
|
11633
|
-
: (
|
|
11701
|
+
: (d.succeed('Upload successful!'),
|
|
11634
11702
|
process.stdout.write(`
|
|
11635
|
-
${
|
|
11703
|
+
${a.bold('CDN URL:')} ${a.green(u.url)}
|
|
11636
11704
|
`),
|
|
11637
|
-
process.stdout.write(`${
|
|
11705
|
+
process.stdout.write(`${a.dim(`Key: ${u.key}`)}
|
|
11638
11706
|
|
|
11639
11707
|
`),
|
|
11640
11708
|
process.stdout.write(`Use this CDN URL directly in your CLI runs:
|
|
11641
|
-
${
|
|
11709
|
+
${a.cyan(`tein run seedance-2-5 --prompt "Animate this scene" --image "${u.url}"`)}
|
|
11642
11710
|
|
|
11643
11711
|
`));
|
|
11644
11712
|
} catch (u) {
|
|
@@ -11655,100 +11723,100 @@ ${i.bold('CDN URL:')} ${i.green(u.url)}
|
|
|
11655
11723
|
`
|
|
11656
11724
|
`,
|
|
11657
11725
|
)
|
|
11658
|
-
:
|
|
11726
|
+
: d.fail(`Upload failed: ${g}`),
|
|
11659
11727
|
process.exit(m ? m.exitCode : T));
|
|
11660
11728
|
}
|
|
11661
11729
|
}
|
|
11662
11730
|
oe();
|
|
11663
11731
|
ie();
|
|
11664
|
-
|
|
11665
|
-
function
|
|
11732
|
+
Be();
|
|
11733
|
+
function bi() {
|
|
11666
11734
|
process.stdout.write(`
|
|
11667
|
-
${
|
|
11735
|
+
${a.bold(a.cyan('Tein AI CLI'))} - Official Command-Line Interface for Tein AI models
|
|
11668
11736
|
|
|
11669
|
-
${
|
|
11670
|
-
${
|
|
11737
|
+
${a.bold('USAGE:')}
|
|
11738
|
+
${a.cyan('tein')} <command> [arguments] [options]
|
|
11671
11739
|
|
|
11672
|
-
${
|
|
11673
|
-
${
|
|
11674
|
-
${
|
|
11675
|
-
${
|
|
11676
|
-
${
|
|
11677
|
-
${
|
|
11678
|
-
${
|
|
11679
|
-
${
|
|
11680
|
-
${
|
|
11681
|
-
${
|
|
11682
|
-
${
|
|
11683
|
-
${
|
|
11684
|
-
${
|
|
11740
|
+
${a.bold('COMMANDS:')}
|
|
11741
|
+
${a.bold('auth')} <login|set-key|logout|status> Manage Tein API key and authentication
|
|
11742
|
+
${a.bold('models')} [category] List all 25+ models (Video, Image, Audio, Text, 3D)
|
|
11743
|
+
${a.bold('pricing')} [model-slug] Every published price (Starter, Plus, Scale)
|
|
11744
|
+
${a.bold('info')} <model-slug> View parameter schemas, pricing, and options
|
|
11745
|
+
${a.bold('upload')} <filepath> Upload local image/video directly to Tein CDN
|
|
11746
|
+
${a.bold('run')} <model-slug> [options] Generate video, image, audio, or reasoning outputs
|
|
11747
|
+
${a.bold('status')} <request-id> [options] Check generation progress and retrieve output files
|
|
11748
|
+
${a.bold('balance')} [--json] Workspace balance, this key's limit and usage
|
|
11749
|
+
${a.bold('usage')} [options] [--json] Spend by model, channel, key and time (Usage page)
|
|
11750
|
+
${a.bold('transactions')} [options] [--json] Balance history: top ups, charges, refunds (alias: history)
|
|
11751
|
+
${a.bold('mcp')} Launch stdio MCP server for Claude Desktop / Code
|
|
11752
|
+
${a.bold('--version')}, ${a.bold('-v')} Print the installed CLI version
|
|
11685
11753
|
|
|
11686
|
-
${
|
|
11687
|
-
${
|
|
11754
|
+
${a.bold('ACCOUNT OPTIONS (read only, nothing is charged; the same JSON as GET /v1/balance, /v1/usage, /v1/balance/transactions):')}
|
|
11755
|
+
${a.cyan('--range')} hour|day|week|month|custom tein usage: the row size, over a fixed period ending now:
|
|
11688
11756
|
hour = last 24 h, day = last 30 days (default),
|
|
11689
11757
|
week = last 12 weeks, month = last 12 months
|
|
11690
|
-
${
|
|
11691
|
-
${
|
|
11692
|
-
${
|
|
11693
|
-
${
|
|
11694
|
-
${
|
|
11695
|
-
${
|
|
11696
|
-
${
|
|
11758
|
+
${a.cyan('--from, --to')} <YYYY-MM-DD> tein usage --range custom: first and last day (UTC), at most 366 days
|
|
11759
|
+
${a.cyan('--model')} <model-id> tein usage: only this model
|
|
11760
|
+
${a.cyan('--channel')} website|api|mcp|cli tein usage: only runs started there
|
|
11761
|
+
${a.cyan('--limit')} <1-100> tein transactions: rows per page (default 50)
|
|
11762
|
+
${a.cyan('--type')} <types> tein transactions: e.g. usage,refund or topup,auto_topup
|
|
11763
|
+
${a.cyan('--after')} <cursor> tein transactions: the next page (printed under each page)
|
|
11764
|
+
${a.cyan('--json')} Print the API's JSON as is
|
|
11697
11765
|
|
|
11698
|
-
${
|
|
11699
|
-
${
|
|
11700
|
-
${
|
|
11701
|
-
${
|
|
11702
|
-
${
|
|
11703
|
-
${
|
|
11704
|
-
${
|
|
11705
|
-
${
|
|
11706
|
-
${
|
|
11707
|
-
${
|
|
11708
|
-
${
|
|
11709
|
-
${
|
|
11710
|
-
${
|
|
11711
|
-
${
|
|
11712
|
-
${
|
|
11766
|
+
${a.bold('GENERATION OPTIONS (for `tein run`):')}
|
|
11767
|
+
${a.cyan('-p, --prompt')} <text> Text prompt for generation ${a.red('(required)')}
|
|
11768
|
+
${a.cyan('-o, --output')} <filepath> Download output file locally (e.g. video.mp4, image.png)
|
|
11769
|
+
${a.cyan('--aspect-ratio')} <ratio> Aspect ratio, per model (see tein info <model-slug>)
|
|
11770
|
+
${a.cyan('-d, --duration')} <seconds> Video duration in seconds (4-30s depending on model)
|
|
11771
|
+
${a.cyan('-r, --resolution')} <res> Resolution (720p, 1080p, 1K, 2K, 4K)
|
|
11772
|
+
${a.cyan('-q, --quality')} <quality> Quality tier (standard, fast, mini, high)
|
|
11773
|
+
${a.cyan('-s, --speaker')} <speaker_id> Voice speaker ID for audio TTS models
|
|
11774
|
+
${a.cyan('--image')} <url> Input image URL for image-to-video or image-to-image
|
|
11775
|
+
${a.cyan('--generate-audio')} Enable native synchronized audio (Seedance 2.5)
|
|
11776
|
+
${a.cyan('--finalize')} <job-id> Render a Seedance 2.5 draft at 1080p, or 4K with -r 4k (no prompt)
|
|
11777
|
+
${a.cyan('--callback-url')} <url> HTTPS URL that receives the finished job
|
|
11778
|
+
${a.cyan('--async, --no-wait')} Queue task and return request ID immediately
|
|
11779
|
+
${a.cyan('--json')} Output response in raw JSON format
|
|
11780
|
+
${a.cyan('--api-key')} <key> Override API key for this request
|
|
11713
11781
|
|
|
11714
|
-
${
|
|
11715
|
-
${
|
|
11716
|
-
${
|
|
11782
|
+
${a.bold('EXAMPLES:')}
|
|
11783
|
+
${a.dim('# 1. Authenticate with your Tein API key')}
|
|
11784
|
+
${a.cyan('tein auth login')}
|
|
11717
11785
|
|
|
11718
|
-
${
|
|
11719
|
-
${
|
|
11786
|
+
${a.dim('# 2. List all Video models')}
|
|
11787
|
+
${a.cyan('tein models video')}
|
|
11720
11788
|
|
|
11721
|
-
${
|
|
11722
|
-
${
|
|
11723
|
-
${
|
|
11789
|
+
${a.dim('# 3. Every published price, or one model as JSON')}
|
|
11790
|
+
${a.cyan('tein pricing')}
|
|
11791
|
+
${a.cyan('tein pricing seedance-2-5 --json')}
|
|
11724
11792
|
|
|
11725
|
-
${
|
|
11726
|
-
${
|
|
11793
|
+
${a.dim('# 4. Generate a high-quality 2K image and download it')}
|
|
11794
|
+
${a.cyan('tein run gpt-image-2 --prompt "Neon Tokyo street in rain" --quality high -r 2K -o tokyo.png')}
|
|
11727
11795
|
|
|
11728
|
-
${
|
|
11729
|
-
${
|
|
11730
|
-
${
|
|
11731
|
-
${
|
|
11796
|
+
${a.dim('# 5. Generate a video using Seedance 2.5 with audio')}
|
|
11797
|
+
${a.cyan('tein run seedance-2-5 --prompt "Drone shot of ocean waves at sunrise" --duration 5 -o ocean.mp4')}
|
|
11798
|
+
${a.dim('# The same at 4K (10-bit H.265; add --creative-mode true for Creative mode)')}
|
|
11799
|
+
${a.cyan('tein run seedance-2-5 --prompt "Drone shot of ocean waves at sunrise" --duration 5 -r 4k -o ocean-4k.mp4')}
|
|
11732
11800
|
|
|
11733
|
-
${
|
|
11734
|
-
${
|
|
11801
|
+
${a.dim('# 6. Generate speech with Seed Audio 1.0')}
|
|
11802
|
+
${a.cyan('tein run seed-audio-1-0 --prompt "Welcome to Tein AI CLI" -o welcome.wav')}
|
|
11735
11803
|
|
|
11736
|
-
${
|
|
11737
|
-
${
|
|
11804
|
+
${a.dim('# 7. Run deep reasoning task with GPT-6 Astra')}
|
|
11805
|
+
${a.cyan('tein run gpt-6-astra --prompt "Write a TypeScript binary search tree implementation"')}
|
|
11738
11806
|
|
|
11739
|
-
${
|
|
11740
|
-
${
|
|
11741
|
-
${
|
|
11742
|
-
${
|
|
11743
|
-
${
|
|
11807
|
+
${a.dim('# 8. Balance, API usage week by week, a custom period as JSON, the latest charges')}
|
|
11808
|
+
${a.cyan('tein balance')}
|
|
11809
|
+
${a.cyan('tein usage --range week --channel api')}
|
|
11810
|
+
${a.cyan('tein usage --range custom --from 2026-11-01 --to 2026-11-19 --json')}
|
|
11811
|
+
${a.cyan('tein transactions --limit 20 --type usage,refund')}
|
|
11744
11812
|
|
|
11745
11813
|
`);
|
|
11746
11814
|
}
|
|
11747
|
-
async function
|
|
11815
|
+
async function En() {
|
|
11748
11816
|
let e = process.argv.slice(2),
|
|
11749
|
-
t =
|
|
11817
|
+
t = Dr(e);
|
|
11750
11818
|
if (t.flags.has('help') || t.options.help || t.command === 'help') {
|
|
11751
|
-
|
|
11819
|
+
bi();
|
|
11752
11820
|
return;
|
|
11753
11821
|
}
|
|
11754
11822
|
if (t.flags.has('version') || t.options.version || t.command === 'version') {
|
|
@@ -11775,15 +11843,15 @@ async function _n() {
|
|
|
11775
11843
|
}
|
|
11776
11844
|
case 'models':
|
|
11777
11845
|
case 'list': {
|
|
11778
|
-
await
|
|
11846
|
+
await Qr(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0);
|
|
11779
11847
|
break;
|
|
11780
11848
|
}
|
|
11781
11849
|
case 'pricing':
|
|
11782
11850
|
case 'prices': {
|
|
11783
11851
|
let r = t.options.model,
|
|
11784
|
-
|
|
11785
|
-
await
|
|
11786
|
-
model:
|
|
11852
|
+
i = t.subcommand || (typeof r == 'string' ? r : void 0);
|
|
11853
|
+
await Jr({
|
|
11854
|
+
model: i,
|
|
11787
11855
|
json: !!t.options.json,
|
|
11788
11856
|
apiUrl: typeof t.options.api_url == 'string' ? t.options.api_url : void 0,
|
|
11789
11857
|
});
|
|
@@ -11792,45 +11860,45 @@ async function _n() {
|
|
|
11792
11860
|
case 'info':
|
|
11793
11861
|
case 'show': {
|
|
11794
11862
|
(t.subcommand ||
|
|
11795
|
-
(process.stderr.write(`${
|
|
11863
|
+
(process.stderr.write(`${a.red('Error:')} Missing model slug.
|
|
11796
11864
|
`),
|
|
11797
|
-
process.stderr.write(`Usage: ${
|
|
11865
|
+
process.stderr.write(`Usage: ${a.cyan('tein info <model-slug>')}
|
|
11798
11866
|
`),
|
|
11799
11867
|
process.exit(1)),
|
|
11800
|
-
await
|
|
11868
|
+
await Zr(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0));
|
|
11801
11869
|
break;
|
|
11802
11870
|
}
|
|
11803
11871
|
case 'upload': {
|
|
11804
11872
|
let r = t.subcommand || '';
|
|
11805
|
-
await
|
|
11873
|
+
await ri(r, t.options);
|
|
11806
11874
|
break;
|
|
11807
11875
|
}
|
|
11808
11876
|
case 'run':
|
|
11809
11877
|
case 'generate': {
|
|
11810
11878
|
let r = t.subcommand || '';
|
|
11811
|
-
await
|
|
11879
|
+
await pt(r, t.options);
|
|
11812
11880
|
break;
|
|
11813
11881
|
}
|
|
11814
11882
|
case 'status': {
|
|
11815
11883
|
let r = t.subcommand || '';
|
|
11816
|
-
await
|
|
11884
|
+
await ti(r, t.options);
|
|
11817
11885
|
break;
|
|
11818
11886
|
}
|
|
11819
11887
|
case 'balance': {
|
|
11820
|
-
await
|
|
11888
|
+
await Ur(t.options);
|
|
11821
11889
|
break;
|
|
11822
11890
|
}
|
|
11823
11891
|
case 'usage': {
|
|
11824
|
-
await
|
|
11892
|
+
await Gr(t.options);
|
|
11825
11893
|
break;
|
|
11826
11894
|
}
|
|
11827
11895
|
case 'transactions':
|
|
11828
11896
|
case 'history': {
|
|
11829
|
-
await
|
|
11897
|
+
await Hr(t.options);
|
|
11830
11898
|
break;
|
|
11831
11899
|
}
|
|
11832
11900
|
case 'mcp': {
|
|
11833
|
-
let { startStdioServer: r } = await Promise.resolve().then(() => (
|
|
11901
|
+
let { startStdioServer: r } = await Promise.resolve().then(() => (yi(), hi));
|
|
11834
11902
|
await r();
|
|
11835
11903
|
break;
|
|
11836
11904
|
}
|
|
@@ -11839,27 +11907,27 @@ async function _n() {
|
|
|
11839
11907
|
(!G(t.command) &&
|
|
11840
11908
|
!be[t.command] &&
|
|
11841
11909
|
(process.stderr.write(`
|
|
11842
|
-
${
|
|
11843
|
-
Run ${
|
|
11910
|
+
${a.red('Error:')} Unknown command or model "${t.command}".
|
|
11911
|
+
Run ${a.cyan('tein --help')} for the commands, or ${a.cyan('tein models')} for the model slugs.
|
|
11844
11912
|
`),
|
|
11845
11913
|
process.exit(T)),
|
|
11846
|
-
await
|
|
11914
|
+
await pt(t.command, t.options));
|
|
11847
11915
|
return;
|
|
11848
11916
|
}
|
|
11849
|
-
|
|
11917
|
+
bi();
|
|
11850
11918
|
break;
|
|
11851
11919
|
}
|
|
11852
11920
|
}
|
|
11853
11921
|
}
|
|
11854
|
-
|
|
11922
|
+
En().catch((e) => {
|
|
11855
11923
|
(e instanceof b &&
|
|
11856
11924
|
(process.stderr.write(`
|
|
11857
|
-
${
|
|
11925
|
+
${a.red('Error:')} ${E(e).join(`
|
|
11858
11926
|
`)}
|
|
11859
11927
|
`),
|
|
11860
11928
|
process.exit(e.exitCode)),
|
|
11861
11929
|
process.stderr.write(`
|
|
11862
|
-
${
|
|
11930
|
+
${a.red('Fatal error:')} ${e instanceof Error ? e.message : e}
|
|
11863
11931
|
`),
|
|
11864
11932
|
process.exit(T));
|
|
11865
11933
|
});
|