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