@teinai/cli 1.1.49 → 1.1.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1168 -951
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
|
-
var
|
|
3
|
+
var kr = Object.create;
|
|
4
4
|
var Se = Object.defineProperty;
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var y = (e, t,
|
|
10
|
-
if (
|
|
5
|
+
var _r = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var Pr = Object.getOwnPropertyNames;
|
|
7
|
+
var vr = Object.getPrototypeOf,
|
|
8
|
+
Ir = Object.prototype.hasOwnProperty;
|
|
9
|
+
var y = (e, t, i) => () => {
|
|
10
|
+
if (i) throw i[0];
|
|
11
11
|
try {
|
|
12
12
|
return (e && (t = e((e = 0))), t);
|
|
13
|
-
} catch (
|
|
14
|
-
throw ((
|
|
13
|
+
} catch (r) {
|
|
14
|
+
throw ((i = [r]), r);
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
var
|
|
18
|
-
for (var
|
|
17
|
+
var Tr = (e, t) => {
|
|
18
|
+
for (var i in t) Se(e, i, { get: t[i], enumerable: !0 });
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
Mr = (e, t, i, r) => {
|
|
21
21
|
if ((t && typeof t == 'object') || typeof t == 'function')
|
|
22
|
-
for (let n of
|
|
23
|
-
!
|
|
24
|
-
n !==
|
|
25
|
-
Se(e, n, { get: () => t[n], enumerable: !(
|
|
22
|
+
for (let n of Pr(t))
|
|
23
|
+
!Ir.call(e, n) &&
|
|
24
|
+
n !== i &&
|
|
25
|
+
Se(e, n, { get: () => t[n], enumerable: !(r = _r(t, n)) || r.enumerable });
|
|
26
26
|
return e;
|
|
27
27
|
};
|
|
28
|
-
var M = (e, t,
|
|
29
|
-
(
|
|
30
|
-
|
|
28
|
+
var M = (e, t, i) => (
|
|
29
|
+
(i = e != null ? kr(vr(e)) : {}),
|
|
30
|
+
Mr(t || !e || !e.__esModule ? Se(i, 'default', { value: e, enumerable: !0 }) : i, e)
|
|
31
31
|
);
|
|
32
|
-
function
|
|
32
|
+
function Er(e) {
|
|
33
33
|
for (let t of e)
|
|
34
34
|
try {
|
|
35
|
-
let
|
|
36
|
-
if (
|
|
37
|
-
return
|
|
35
|
+
let i = JSON.parse(kt.default.readFileSync(t, 'utf8'));
|
|
36
|
+
if (i.name === '@teinai/cli' && typeof i.version == 'string' && i.version.trim())
|
|
37
|
+
return i.version.trim();
|
|
38
38
|
} catch {}
|
|
39
|
-
return
|
|
39
|
+
return Kr;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function $r() {
|
|
42
42
|
let e = typeof __dirname == 'string' ? __dirname : process.cwd();
|
|
43
43
|
return [
|
|
44
44
|
Ke.default.join(e, 'package.json'),
|
|
@@ -47,12 +47,12 @@ function Ki() {
|
|
|
47
47
|
}
|
|
48
48
|
var kt,
|
|
49
49
|
Ke,
|
|
50
|
-
|
|
50
|
+
Kr,
|
|
51
51
|
H,
|
|
52
52
|
oe = y(() => {
|
|
53
53
|
'use strict';
|
|
54
|
-
((kt = M(require('node:fs'))), (Ke = M(require('node:path'))), (
|
|
55
|
-
H =
|
|
54
|
+
((kt = M(require('node:fs'))), (Ke = M(require('node:path'))), (Kr = '0.0.0-dev'));
|
|
55
|
+
H = Er($r());
|
|
56
56
|
});
|
|
57
57
|
function W() {
|
|
58
58
|
try {
|
|
@@ -66,8 +66,8 @@ function W() {
|
|
|
66
66
|
function $e(e) {
|
|
67
67
|
try {
|
|
68
68
|
L.default.existsSync(pe) || L.default.mkdirSync(pe, { recursive: !0, mode: 448 });
|
|
69
|
-
let
|
|
70
|
-
(L.default.writeFileSync(z, JSON.stringify(
|
|
69
|
+
let i = { ...W(), ...e };
|
|
70
|
+
(L.default.writeFileSync(z, JSON.stringify(i, null, 2), { encoding: 'utf-8', mode: 384 }),
|
|
71
71
|
L.default.chmodSync(pe, 448),
|
|
72
72
|
L.default.chmodSync(z, 384));
|
|
73
73
|
} catch (t) {
|
|
@@ -78,15 +78,15 @@ function _(e) {
|
|
|
78
78
|
if (e && e.trim()) return e.trim();
|
|
79
79
|
let t = process.env.TEIN_API_KEY || process.env.TEIN_KEY;
|
|
80
80
|
if (t && t.trim()) return t.trim();
|
|
81
|
-
let
|
|
82
|
-
return
|
|
81
|
+
let i = W();
|
|
82
|
+
return i.apiKey && i.apiKey.trim() ? i.apiKey.trim() : '';
|
|
83
83
|
}
|
|
84
84
|
function x(e) {
|
|
85
85
|
if (e && e.trim()) return e.trim().replace(/\/+$/, '');
|
|
86
86
|
let t = process.env.TEIN_API_URL;
|
|
87
87
|
if (t && t.trim()) return t.trim().replace(/\/+$/, '');
|
|
88
|
-
let
|
|
89
|
-
return
|
|
88
|
+
let i = W();
|
|
89
|
+
return i.apiUrl && i.apiUrl.trim() ? i.apiUrl.trim().replace(/\/+$/, '') : 'https://api.tein.ai';
|
|
90
90
|
}
|
|
91
91
|
function de() {
|
|
92
92
|
return z;
|
|
@@ -104,13 +104,13 @@ var L,
|
|
|
104
104
|
(pe = Ee.default.join(Tt.default.homedir(), '.tein')),
|
|
105
105
|
(z = Ee.default.join(pe, 'config.json')));
|
|
106
106
|
});
|
|
107
|
-
var
|
|
107
|
+
var qr,
|
|
108
108
|
Mt,
|
|
109
109
|
St,
|
|
110
110
|
Kt = y(() => {
|
|
111
111
|
'use strict';
|
|
112
|
-
((
|
|
113
|
-
(Mt = [...
|
|
112
|
+
((qr = ['1:1', '16:9', '9:16', '21:9', '3:2', '2:3', '4:3', '3:4', '4:5', '5:4']),
|
|
113
|
+
(Mt = [...qr, 'auto']),
|
|
114
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
|
});
|
|
@@ -158,10 +158,12 @@ var ue,
|
|
|
158
158
|
'seedance-2-lite',
|
|
159
159
|
'seedance-2-fast',
|
|
160
160
|
'seedance-2-mini',
|
|
161
|
+
'seedance-2-5-vip',
|
|
161
162
|
],
|
|
162
163
|
},
|
|
163
164
|
{ slug: 'seedream', name: 'Seedream', models: ['seedream-5-pro', 'seedream-5-5'] },
|
|
164
165
|
{ slug: 'seed', name: 'Seed', models: ['seed-audio-1-0', 'seed-2-1-turbo'] },
|
|
166
|
+
{ slug: 'omnihuman', name: 'OmniHuman', models: ['omnihuman-2-0'] },
|
|
165
167
|
{ slug: 'wan', name: 'Wan', models: ['wan-3-0', 'wan-3-0-prime', 'wan-2-5-image'] },
|
|
166
168
|
{ slug: 'happy-horse', name: 'HappyHorse', models: ['happy-horse-1-1', 'happy-horse-1-0'] },
|
|
167
169
|
{ slug: 'minimax', name: 'Hailuo', models: ['minimax-h3', 'minimax-h3-turbo'] },
|
|
@@ -874,6 +876,79 @@ var ue,
|
|
|
874
876
|
axes: { resolution: ['480p', '720p'] },
|
|
875
877
|
from: { variant: '480p-no-video-omni' },
|
|
876
878
|
},
|
|
879
|
+
{
|
|
880
|
+
slug: 'seedance-2-5-vip',
|
|
881
|
+
name: 'Seedance 2.5 VIP',
|
|
882
|
+
family: 'seedance',
|
|
883
|
+
vendor: 'ByteDance',
|
|
884
|
+
desc: 'A distilled version of Seedance 2.5 for cheaper results: 480p to 4K with native sound, from text, a start frame (with an optional end frame), or images, videos and audio clips as references, up to 30 seconds. Slower than Seedance 2.5: expect a video in 9 to 11 minutes.',
|
|
885
|
+
kind: 'video',
|
|
886
|
+
unit: '/sec',
|
|
887
|
+
api: { model: 'seedance-2-5-vip' },
|
|
888
|
+
variants: [
|
|
889
|
+
{
|
|
890
|
+
id: '480p',
|
|
891
|
+
price: { starter: 0.0496, plus: 0.0465, scale: 0.0438 },
|
|
892
|
+
label: '480p',
|
|
893
|
+
resolution: '480p',
|
|
894
|
+
withVideo: !1,
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
id: '480p-with-video',
|
|
898
|
+
price: { starter: 0.0992, plus: 0.093, scale: 0.0876 },
|
|
899
|
+
label: '480p \xB7 with reference video',
|
|
900
|
+
resolution: '480p',
|
|
901
|
+
withVideo: !0,
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
id: '720p',
|
|
905
|
+
price: { starter: 0.078, plus: 0.0731, scale: 0.0688 },
|
|
906
|
+
label: '720p',
|
|
907
|
+
resolution: '720p',
|
|
908
|
+
withVideo: !1,
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
id: '720p-with-video',
|
|
912
|
+
price: { starter: 0.156, plus: 0.1462, scale: 0.1376 },
|
|
913
|
+
label: '720p \xB7 with reference video',
|
|
914
|
+
resolution: '720p',
|
|
915
|
+
withVideo: !0,
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
id: '1080p',
|
|
919
|
+
price: { starter: 0.1399, plus: 0.1312, scale: 0.1235 },
|
|
920
|
+
label: '1080p',
|
|
921
|
+
resolution: '1080p',
|
|
922
|
+
withVideo: !1,
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
id: '1080p-with-video',
|
|
926
|
+
price: { starter: 0.2798, plus: 0.2624, scale: 0.247 },
|
|
927
|
+
label: '1080p \xB7 with reference video',
|
|
928
|
+
resolution: '1080p',
|
|
929
|
+
withVideo: !0,
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
id: '4k',
|
|
933
|
+
price: { starter: 0.3807, plus: 0.357, scale: 0.336 },
|
|
934
|
+
label: '4K',
|
|
935
|
+
resolution: '4k',
|
|
936
|
+
withVideo: !1,
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
id: '4k-with-video',
|
|
940
|
+
price: { starter: 0.7614, plus: 0.714, scale: 0.672 },
|
|
941
|
+
label: '4K \xB7 with reference video',
|
|
942
|
+
resolution: '4k',
|
|
943
|
+
withVideo: !0,
|
|
944
|
+
},
|
|
945
|
+
],
|
|
946
|
+
unfiltered: null,
|
|
947
|
+
priority: null,
|
|
948
|
+
draft: null,
|
|
949
|
+
axes: { resolution: ['480p', '720p', '1080p', '4k'] },
|
|
950
|
+
from: { variant: '480p' },
|
|
951
|
+
},
|
|
877
952
|
{
|
|
878
953
|
slug: 'seedance-2',
|
|
879
954
|
name: 'Seedance 2.0',
|
|
@@ -1993,6 +2068,29 @@ var ue,
|
|
|
1993
2068
|
axes: {},
|
|
1994
2069
|
from: { variant: 'standard' },
|
|
1995
2070
|
},
|
|
2071
|
+
{
|
|
2072
|
+
slug: 'omnihuman-2-0',
|
|
2073
|
+
name: 'OmniHuman 2.0',
|
|
2074
|
+
family: 'omnihuman',
|
|
2075
|
+
vendor: 'ByteDance',
|
|
2076
|
+
desc: "ByteDance's OmniHuman 2.0 \u2014 one photo and an audio track become a 720p video of the person speaking, singing or performing, up to 5 minutes in one shot, with an optional prompt for camera and body movement.",
|
|
2077
|
+
kind: 'video',
|
|
2078
|
+
unit: '/sec',
|
|
2079
|
+
api: { model: 'omnihuman-2-0' },
|
|
2080
|
+
variants: [
|
|
2081
|
+
{
|
|
2082
|
+
id: '720p',
|
|
2083
|
+
price: { starter: 0.0875, plus: 0.0831, scale: 0.0778 },
|
|
2084
|
+
label: '720p',
|
|
2085
|
+
resolution: '720p',
|
|
2086
|
+
},
|
|
2087
|
+
],
|
|
2088
|
+
unfiltered: null,
|
|
2089
|
+
priority: null,
|
|
2090
|
+
draft: null,
|
|
2091
|
+
axes: { resolution: ['720p'] },
|
|
2092
|
+
from: { variant: '720p' },
|
|
2093
|
+
},
|
|
1996
2094
|
{
|
|
1997
2095
|
slug: 'nano-banana-2',
|
|
1998
2096
|
name: 'Nano Banana 2',
|
|
@@ -6418,40 +6516,40 @@ var me,
|
|
|
6418
6516
|
function Le(e, t) {
|
|
6419
6517
|
return `${e.trim().toLowerCase()}|${(t ?? '').trim().toLowerCase()}`;
|
|
6420
6518
|
}
|
|
6421
|
-
function
|
|
6519
|
+
function Dr(e, t) {
|
|
6422
6520
|
if (e === 'seedance-2-mini') return 'mini';
|
|
6423
6521
|
if (e !== 'seedance-2') return;
|
|
6424
|
-
let
|
|
6425
|
-
return
|
|
6426
|
-
?
|
|
6522
|
+
let i = typeof t?.quality == 'string' ? t.quality.trim().toLowerCase() : '';
|
|
6523
|
+
return i === 'fast' || i === 'mini' || i === 'standard'
|
|
6524
|
+
? i
|
|
6427
6525
|
: t?.fast_mode === !0
|
|
6428
6526
|
? 'fast'
|
|
6429
6527
|
: 'standard';
|
|
6430
6528
|
}
|
|
6431
|
-
function
|
|
6432
|
-
let
|
|
6529
|
+
function Nr(e, t) {
|
|
6530
|
+
let i = e
|
|
6433
6531
|
.trim()
|
|
6434
6532
|
.toLowerCase()
|
|
6435
6533
|
.replace(/-(?:unfiltered|uncensored)$/, '');
|
|
6436
|
-
if (
|
|
6437
|
-
let n =
|
|
6534
|
+
if (i === 'seedance-2' || i === 'seedance-2-mini') {
|
|
6535
|
+
let n = Dr(i, t),
|
|
6438
6536
|
s = Oe.get(Le('seedance-2', n));
|
|
6439
6537
|
return s ? s.slug : null;
|
|
6440
6538
|
}
|
|
6441
|
-
let
|
|
6442
|
-
return
|
|
6539
|
+
let r = fe.get(i) ?? Oe.get(Le(i));
|
|
6540
|
+
return r ? r.slug : null;
|
|
6443
6541
|
}
|
|
6444
|
-
function
|
|
6445
|
-
return fe.has(e) && !(
|
|
6542
|
+
function Ur(e, t) {
|
|
6543
|
+
return fe.has(e) && !(Vr.has(e) && t) ? e : Nr(e, t);
|
|
6446
6544
|
}
|
|
6447
6545
|
function F(e, t) {
|
|
6448
|
-
let
|
|
6449
|
-
return
|
|
6546
|
+
let i = Ur(e, t);
|
|
6547
|
+
return i ? (fe.get(i) ?? null) : null;
|
|
6450
6548
|
}
|
|
6451
|
-
function
|
|
6549
|
+
function Vt(e, t) {
|
|
6452
6550
|
return `${e}/addon/${t}`;
|
|
6453
6551
|
}
|
|
6454
|
-
function
|
|
6552
|
+
function Ut(e) {
|
|
6455
6553
|
return Nt.get(e) ?? null;
|
|
6456
6554
|
}
|
|
6457
6555
|
function ge() {
|
|
@@ -6461,13 +6559,13 @@ var De,
|
|
|
6461
6559
|
qt,
|
|
6462
6560
|
Lt,
|
|
6463
6561
|
Dt,
|
|
6464
|
-
|
|
6562
|
+
Lr,
|
|
6465
6563
|
fe,
|
|
6466
6564
|
Oe,
|
|
6467
6565
|
Ot,
|
|
6468
6566
|
Nt,
|
|
6469
6567
|
qe,
|
|
6470
|
-
|
|
6568
|
+
Vr,
|
|
6471
6569
|
B = y(() => {
|
|
6472
6570
|
'use strict';
|
|
6473
6571
|
Et();
|
|
@@ -6476,15 +6574,17 @@ var De,
|
|
|
6476
6574
|
Re();
|
|
6477
6575
|
((De = {
|
|
6478
6576
|
...ue,
|
|
6479
|
-
families: ue.families
|
|
6577
|
+
families: ue.families
|
|
6578
|
+
.map((e) => ({ ...e, models: e.models.filter((t) => !Z(t)) }))
|
|
6579
|
+
.filter((e) => e.models.length > 0),
|
|
6480
6580
|
models: ue.models.filter((e) => !Z(e.slug)),
|
|
6481
6581
|
}),
|
|
6482
6582
|
(qt = me.filter((e) => !Z(e.slug))),
|
|
6483
6583
|
(Lt = Ct.filter((e) => !Z(e.slug) && !De.models.some((t) => t.slug === e.slug))),
|
|
6484
6584
|
(Dt = [...De.models, ...Lt, ...qt]),
|
|
6485
|
-
(
|
|
6585
|
+
(Lr = [
|
|
6486
6586
|
...De.families.map((e) => {
|
|
6487
|
-
let t = Lt.filter((
|
|
6587
|
+
let t = Lt.filter((i) => i.family === e.slug).map((i) => i.slug);
|
|
6488
6588
|
return t.length ? { ...e, models: [...e.models, ...t] } : e;
|
|
6489
6589
|
}),
|
|
6490
6590
|
...Rt.map((e) => ({
|
|
@@ -6505,27 +6605,46 @@ var De,
|
|
|
6505
6605
|
for (let t of e.addons ?? []) Nt.set(`${e.slug}/addon/${t.id}`, { model: e, addon: t });
|
|
6506
6606
|
qe.set(e.slug, e.family);
|
|
6507
6607
|
}
|
|
6508
|
-
for (let e of
|
|
6509
|
-
|
|
6608
|
+
for (let e of Lr) for (let t of e.models) qe.has(t) || qe.set(t, e.slug);
|
|
6609
|
+
Vr = new Set(['seedance-2']);
|
|
6510
6610
|
});
|
|
6511
6611
|
function he(e) {
|
|
6512
6612
|
let t = e.from?.variant;
|
|
6513
|
-
return (t && e.variants.find((
|
|
6613
|
+
return (t && e.variants.find((i) => i.id === t)) || e.variants[0];
|
|
6614
|
+
}
|
|
6615
|
+
function jt(e) {
|
|
6616
|
+
let t = he(e),
|
|
6617
|
+
i = Fr[e.slug];
|
|
6618
|
+
return !i || Ft(t.resolution, i)
|
|
6619
|
+
? t
|
|
6620
|
+
: (e.variants.find(
|
|
6621
|
+
(r) =>
|
|
6622
|
+
Ft(r.resolution, i) &&
|
|
6623
|
+
!!r.withVideo == !!t.withVideo &&
|
|
6624
|
+
(r.endpoint ?? null) === (t.endpoint ?? null),
|
|
6625
|
+
) ?? t);
|
|
6514
6626
|
}
|
|
6515
6627
|
function Ne(e) {
|
|
6516
6628
|
if (e.endpoints?.length)
|
|
6517
|
-
return e.editVariants?.length && e.endpoints.some((t) => t.id ===
|
|
6518
|
-
?
|
|
6629
|
+
return e.editVariants?.length && e.endpoints.some((t) => t.id === Bt)
|
|
6630
|
+
? Bt
|
|
6519
6631
|
: (e.defaultEndpoint ?? e.endpoints[0].id);
|
|
6520
6632
|
}
|
|
6521
6633
|
var Ft,
|
|
6522
|
-
|
|
6634
|
+
Fr,
|
|
6635
|
+
Bt,
|
|
6636
|
+
Ve = y(() => {
|
|
6523
6637
|
'use strict';
|
|
6524
6638
|
B();
|
|
6525
|
-
Ft =
|
|
6639
|
+
Ft = (e, t) =>
|
|
6640
|
+
typeof e == 'string' &&
|
|
6641
|
+
typeof t == 'string' &&
|
|
6642
|
+
e.trim().toLowerCase() === t.trim().toLowerCase();
|
|
6643
|
+
Fr = { 'seedance-2-5-vip': '1080p' };
|
|
6644
|
+
Bt = 'dynamic';
|
|
6526
6645
|
});
|
|
6527
|
-
function
|
|
6528
|
-
return
|
|
6646
|
+
function Gr(e) {
|
|
6647
|
+
return Vt(e, Br);
|
|
6529
6648
|
}
|
|
6530
6649
|
function ye(e) {
|
|
6531
6650
|
let t = e.toFixed(5).replace(/0+$/, '');
|
|
@@ -6534,40 +6653,40 @@ function ye(e) {
|
|
|
6534
6653
|
(t.split('.')[1] ?? '').length < 2 ? `$${e.toFixed(2)}` : `$${t}`
|
|
6535
6654
|
);
|
|
6536
6655
|
}
|
|
6537
|
-
function
|
|
6656
|
+
function Ue(e) {
|
|
6538
6657
|
return e.starter === e.plus && e.plus === e.scale
|
|
6539
6658
|
? `${ye(e.starter)} on every plan`
|
|
6540
6659
|
: `${ye(e.starter)} on Starter, ${ye(e.plus)} on Plus, ${ye(e.scale)} on Scale`;
|
|
6541
6660
|
}
|
|
6542
|
-
function
|
|
6661
|
+
function Gt(e) {
|
|
6543
6662
|
let t = [],
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
if (
|
|
6663
|
+
i = jr[e],
|
|
6664
|
+
r = i != null ? Ut(Gr(e)) : null;
|
|
6665
|
+
if (r && i != null) {
|
|
6547
6666
|
let n =
|
|
6548
|
-
|
|
6667
|
+
r.addon.unfiltered && Ue(r.addon.unfiltered) === Ue(r.addon.price)
|
|
6549
6668
|
? ', Creative mode included'
|
|
6550
6669
|
: '';
|
|
6551
|
-
t.push(`Each reference image after the ${
|
|
6670
|
+
t.push(`Each reference image after the ${zr[i] ?? `${i}th`} adds ${Ue(r.addon.price)}${n}.`);
|
|
6552
6671
|
}
|
|
6553
6672
|
return (
|
|
6554
|
-
|
|
6673
|
+
Hr.has(e) &&
|
|
6555
6674
|
t.push(
|
|
6556
6675
|
'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).',
|
|
6557
6676
|
),
|
|
6558
6677
|
t
|
|
6559
6678
|
);
|
|
6560
6679
|
}
|
|
6561
|
-
var
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6680
|
+
var Br,
|
|
6681
|
+
jr,
|
|
6682
|
+
Hr,
|
|
6683
|
+
zr,
|
|
6684
|
+
Ht = y(() => {
|
|
6566
6685
|
'use strict';
|
|
6567
6686
|
B();
|
|
6568
|
-
((
|
|
6569
|
-
|
|
6570
|
-
|
|
6687
|
+
((Br = 'extra-image-input'), (jr = { 'seedream-5-pro': 1, 'minimax-h3': 5 }));
|
|
6688
|
+
Hr = new Set(['minimax-h3']);
|
|
6689
|
+
zr = { 1: 'first', 5: '5th' };
|
|
6571
6690
|
});
|
|
6572
6691
|
var be,
|
|
6573
6692
|
Fe = y(() => {
|
|
@@ -6582,29 +6701,29 @@ var be,
|
|
|
6582
6701
|
'gpt-image-2-6-sunburst': 'gpt-image-2.6-sunburst',
|
|
6583
6702
|
};
|
|
6584
6703
|
});
|
|
6585
|
-
var
|
|
6704
|
+
var zt = y(() => {
|
|
6586
6705
|
'use strict';
|
|
6587
6706
|
});
|
|
6588
|
-
function
|
|
6589
|
-
return typeof t == 'string' && (
|
|
6707
|
+
function Wt(e, t) {
|
|
6708
|
+
return typeof t == 'string' && (Wr[e]?.includes(t) ?? !1);
|
|
6590
6709
|
}
|
|
6591
|
-
var
|
|
6592
|
-
|
|
6710
|
+
var Wr,
|
|
6711
|
+
Jt = y(() => {
|
|
6593
6712
|
'use strict';
|
|
6594
6713
|
B();
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6714
|
+
Ve();
|
|
6715
|
+
zt();
|
|
6716
|
+
Wr = {};
|
|
6598
6717
|
});
|
|
6599
|
-
function
|
|
6600
|
-
return e === 'nano-banana-pro' ?
|
|
6718
|
+
function Yt(e) {
|
|
6719
|
+
return e === 'nano-banana-pro' ? Jr : Yr;
|
|
6601
6720
|
}
|
|
6602
|
-
var
|
|
6603
|
-
|
|
6604
|
-
|
|
6721
|
+
var Jr,
|
|
6722
|
+
Yr,
|
|
6723
|
+
Xt = y(() => {
|
|
6605
6724
|
'use strict';
|
|
6606
|
-
((
|
|
6607
|
-
(
|
|
6725
|
+
((Jr = ['auto', '1:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9']),
|
|
6726
|
+
(Yr = [
|
|
6608
6727
|
'auto',
|
|
6609
6728
|
'1:1',
|
|
6610
6729
|
'1:4',
|
|
@@ -6622,10 +6741,10 @@ var Hi,
|
|
|
6622
6741
|
'21:9',
|
|
6623
6742
|
]));
|
|
6624
6743
|
});
|
|
6625
|
-
var
|
|
6626
|
-
|
|
6744
|
+
var Qt,
|
|
6745
|
+
Zt = y(() => {
|
|
6627
6746
|
'use strict';
|
|
6628
|
-
|
|
6747
|
+
Qt = [
|
|
6629
6748
|
'prompt',
|
|
6630
6749
|
'system',
|
|
6631
6750
|
'messages',
|
|
@@ -6639,10 +6758,10 @@ var Yt,
|
|
|
6639
6758
|
'endpoint',
|
|
6640
6759
|
];
|
|
6641
6760
|
});
|
|
6642
|
-
var
|
|
6643
|
-
|
|
6761
|
+
var ei,
|
|
6762
|
+
ti = y(() => {
|
|
6644
6763
|
'use strict';
|
|
6645
|
-
|
|
6764
|
+
ei = [
|
|
6646
6765
|
{
|
|
6647
6766
|
slug: 'claude-fable-5-1',
|
|
6648
6767
|
family: 'fable-5-1',
|
|
@@ -6711,13 +6830,13 @@ var Qt,
|
|
|
6711
6830
|
},
|
|
6712
6831
|
];
|
|
6713
6832
|
});
|
|
6714
|
-
function
|
|
6833
|
+
function ii(e) {
|
|
6715
6834
|
return `$${e}`;
|
|
6716
6835
|
}
|
|
6717
|
-
function Be(e, t,
|
|
6718
|
-
return F(e)?.variants.find((n) => n.endpoint === t && n.component ===
|
|
6836
|
+
function Be(e, t, i) {
|
|
6837
|
+
return F(e)?.variants.find((n) => n.endpoint === t && n.component === i)?.price.starter ?? null;
|
|
6719
6838
|
}
|
|
6720
|
-
function
|
|
6839
|
+
function Xr(e) {
|
|
6721
6840
|
return [
|
|
6722
6841
|
{
|
|
6723
6842
|
name: 'prompt',
|
|
@@ -6783,61 +6902,61 @@ function Wi(e) {
|
|
|
6783
6902
|
},
|
|
6784
6903
|
];
|
|
6785
6904
|
}
|
|
6786
|
-
function
|
|
6905
|
+
function ri(e) {
|
|
6787
6906
|
let t = Be(e, 'cheap', 'input'),
|
|
6788
|
-
|
|
6789
|
-
return t != null &&
|
|
6907
|
+
i = Be(e, 'cheap', 'output');
|
|
6908
|
+
return t != null && i != null ? `${ii(t)}/M in \xB7 ${ii(i)}/M out` : '';
|
|
6790
6909
|
}
|
|
6791
|
-
function
|
|
6910
|
+
function ai() {
|
|
6792
6911
|
return Object.fromEntries(
|
|
6793
|
-
|
|
6912
|
+
ei.map((e) => {
|
|
6794
6913
|
let t = Be(e.slug, 'stable', 'input') != null,
|
|
6795
|
-
|
|
6796
|
-
|
|
6914
|
+
i = ri(e.slug),
|
|
6915
|
+
r = {
|
|
6797
6916
|
slug: e.slug,
|
|
6798
6917
|
name: e.name,
|
|
6799
6918
|
category: 'Text',
|
|
6800
6919
|
kind: 'Reasoning (LLM)',
|
|
6801
6920
|
vendor: 'Anthropic',
|
|
6802
6921
|
description: e.description,
|
|
6803
|
-
priceFormatted:
|
|
6922
|
+
priceFormatted: i,
|
|
6804
6923
|
unit: '/M tokens',
|
|
6805
6924
|
primaryToolName: 'run_task',
|
|
6806
|
-
parameters:
|
|
6925
|
+
parameters: Xr(t),
|
|
6807
6926
|
};
|
|
6808
|
-
return [e.slug,
|
|
6927
|
+
return [e.slug, r];
|
|
6809
6928
|
}),
|
|
6810
6929
|
);
|
|
6811
6930
|
}
|
|
6812
|
-
var
|
|
6931
|
+
var ni = y(() => {
|
|
6813
6932
|
'use strict';
|
|
6814
|
-
|
|
6933
|
+
ti();
|
|
6815
6934
|
B();
|
|
6816
6935
|
});
|
|
6817
6936
|
function je(e) {
|
|
6818
|
-
return e ?
|
|
6937
|
+
return e ? Zr.get(e) : void 0;
|
|
6819
6938
|
}
|
|
6820
|
-
function
|
|
6939
|
+
function pi(e, t) {
|
|
6821
6940
|
return !e.aspects?.length || e.sourceFramedModes?.includes(t)
|
|
6822
6941
|
? null
|
|
6823
6942
|
: e.adaptiveModes?.includes(t)
|
|
6824
6943
|
? [...e.aspects, 'adaptive']
|
|
6825
6944
|
: [...e.aspects];
|
|
6826
6945
|
}
|
|
6827
|
-
var
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6946
|
+
var si,
|
|
6947
|
+
Qr,
|
|
6948
|
+
oi,
|
|
6949
|
+
gs,
|
|
6950
|
+
Zr,
|
|
6951
|
+
li,
|
|
6833
6952
|
Ge,
|
|
6834
|
-
|
|
6953
|
+
hs,
|
|
6835
6954
|
He,
|
|
6836
6955
|
ze = y(() => {
|
|
6837
6956
|
'use strict';
|
|
6838
|
-
((
|
|
6839
|
-
(
|
|
6840
|
-
(
|
|
6957
|
+
((si = ['16:9', '9:16', '1:1', '21:9']),
|
|
6958
|
+
(Qr = ['16:9', '9:16', '1:1', '4:3', '3:4', '21:9']),
|
|
6959
|
+
(oi = [
|
|
6841
6960
|
{
|
|
6842
6961
|
slug: 'kling-v4',
|
|
6843
6962
|
kind: 'video',
|
|
@@ -6845,7 +6964,7 @@ var ar,
|
|
|
6845
6964
|
promptMax: 26e3,
|
|
6846
6965
|
duration: { min: 3, max: 30, default: 5 },
|
|
6847
6966
|
heights: { '720p': 720, '1080p': 1080 },
|
|
6848
|
-
aspects:
|
|
6967
|
+
aspects: si,
|
|
6849
6968
|
sourceFramedModes: ['image_to_video'],
|
|
6850
6969
|
adaptiveModes: ['multi_reference'],
|
|
6851
6970
|
fps: 24,
|
|
@@ -6869,7 +6988,7 @@ var ar,
|
|
|
6869
6988
|
promptMax: 26e3,
|
|
6870
6989
|
duration: { min: 3, max: 20, default: 5 },
|
|
6871
6990
|
heights: { '720p': 720 },
|
|
6872
|
-
aspects: [...
|
|
6991
|
+
aspects: [...si, '4:3', '3:4'],
|
|
6873
6992
|
sourceFramedModes: ['image_to_video'],
|
|
6874
6993
|
adaptiveModes: ['multi_reference'],
|
|
6875
6994
|
fps: 24,
|
|
@@ -6908,7 +7027,7 @@ var ar,
|
|
|
6908
7027
|
promptMax: 65535,
|
|
6909
7028
|
duration: { min: 5, max: 15, default: 5 },
|
|
6910
7029
|
heights: { '480p': 480, '768p': 768 },
|
|
6911
|
-
aspects:
|
|
7030
|
+
aspects: Qr,
|
|
6912
7031
|
fps: 24,
|
|
6913
7032
|
audio: 'free',
|
|
6914
7033
|
seed: !0,
|
|
@@ -6983,9 +7102,9 @@ var ar,
|
|
|
6983
7102
|
seed: !0,
|
|
6984
7103
|
},
|
|
6985
7104
|
]),
|
|
6986
|
-
(
|
|
6987
|
-
(
|
|
6988
|
-
((
|
|
7105
|
+
(gs = oi.map((e) => e.slug)),
|
|
7106
|
+
(Zr = new Map(oi.map((e) => [e.slug, e]))));
|
|
7107
|
+
((li = 'EXAVITQu4vr4xnSDxMaL'),
|
|
6989
7108
|
(Ge = {
|
|
6990
7109
|
hpp4J3VqNfWAUOO0d1Us: 'Bella',
|
|
6991
7110
|
CwhRBWXzGAHq8TQ4Fs17: 'Roger',
|
|
@@ -7008,7 +7127,7 @@ var ar,
|
|
|
7008
7127
|
pqHfZKP75CvOlQylNhV4: 'Bill',
|
|
7009
7128
|
pNInz6obpgDQGcFmaJgB: 'Adam',
|
|
7010
7129
|
}),
|
|
7011
|
-
(
|
|
7130
|
+
(hs = Object.keys(Ge)),
|
|
7012
7131
|
(He = [
|
|
7013
7132
|
'mp3_44100_128',
|
|
7014
7133
|
'mp3_22050_32',
|
|
@@ -7024,10 +7143,10 @@ var ar,
|
|
|
7024
7143
|
'opus_48000_192',
|
|
7025
7144
|
]));
|
|
7026
7145
|
});
|
|
7027
|
-
function
|
|
7146
|
+
function ta(e) {
|
|
7028
7147
|
let t = e.duration,
|
|
7029
|
-
|
|
7030
|
-
|
|
7148
|
+
i = Object.keys(e.heights),
|
|
7149
|
+
r = e.sourceFramedModes?.length
|
|
7031
7150
|
? ` Not taken by ${e.sourceFramedModes.join(', ')}: the source image sets the frame.`
|
|
7032
7151
|
: '',
|
|
7033
7152
|
n = e.modeRequired ? void 0 : e.modes[0],
|
|
@@ -7045,8 +7164,8 @@ function Qi(e) {
|
|
|
7045
7164
|
{
|
|
7046
7165
|
name: 'resolution',
|
|
7047
7166
|
type: 'select',
|
|
7048
|
-
default:
|
|
7049
|
-
options:
|
|
7167
|
+
default: i[0],
|
|
7168
|
+
options: i,
|
|
7050
7169
|
description: 'Output resolution. Higher resolutions cost more per second.',
|
|
7051
7170
|
},
|
|
7052
7171
|
{
|
|
@@ -7054,7 +7173,7 @@ function Qi(e) {
|
|
|
7054
7173
|
type: 'select',
|
|
7055
7174
|
...(s ? {} : { default: e.aspects[0] }),
|
|
7056
7175
|
options: [...e.aspects, ...(e.adaptiveModes?.length ? ['adaptive'] : [])],
|
|
7057
|
-
description: `The frame.${e.adaptiveModes?.length ? ` adaptive: ${e.adaptiveModes.join(', ')} only.` : ''}${
|
|
7176
|
+
description: `The frame.${e.adaptiveModes?.length ? ` adaptive: ${e.adaptiveModes.join(', ')} only.` : ''}${r}`,
|
|
7058
7177
|
},
|
|
7059
7178
|
];
|
|
7060
7179
|
if (
|
|
@@ -7117,7 +7236,7 @@ function Qi(e) {
|
|
|
7117
7236
|
}
|
|
7118
7237
|
return o;
|
|
7119
7238
|
}
|
|
7120
|
-
function
|
|
7239
|
+
function ia(e) {
|
|
7121
7240
|
let t = Object.keys(e.sizes);
|
|
7122
7241
|
return [
|
|
7123
7242
|
{
|
|
@@ -7134,13 +7253,13 @@ function Zi(e) {
|
|
|
7134
7253
|
},
|
|
7135
7254
|
];
|
|
7136
7255
|
}
|
|
7137
|
-
function
|
|
7256
|
+
function aa() {
|
|
7138
7257
|
return [
|
|
7139
7258
|
{
|
|
7140
7259
|
name: 'voice_id',
|
|
7141
7260
|
type: 'string',
|
|
7142
|
-
default:
|
|
7143
|
-
description: `text_to_speech: the ElevenLabs voice id, one of: ${
|
|
7261
|
+
default: li,
|
|
7262
|
+
description: `text_to_speech: the ElevenLabs voice id, one of: ${ra}.`,
|
|
7144
7263
|
},
|
|
7145
7264
|
{
|
|
7146
7265
|
name: 'turns',
|
|
@@ -7159,9 +7278,9 @@ function ta() {
|
|
|
7159
7278
|
},
|
|
7160
7279
|
];
|
|
7161
7280
|
}
|
|
7162
|
-
function
|
|
7281
|
+
function di(e) {
|
|
7163
7282
|
let t = e.promptOptionalModes?.length ? ` Optional on ${e.promptOptionalModes.join(', ')}.` : '',
|
|
7164
|
-
|
|
7283
|
+
i = [
|
|
7165
7284
|
{
|
|
7166
7285
|
name: 'prompt',
|
|
7167
7286
|
type: 'string',
|
|
@@ -7174,25 +7293,25 @@ function lr(e) {
|
|
|
7174
7293
|
required: !0,
|
|
7175
7294
|
...(e.modeRequired ? {} : { default: e.modes[0] }),
|
|
7176
7295
|
options: [...e.modes],
|
|
7177
|
-
description: `${e.modeRequired ? 'Required. ' : ''}${e.modes.map((
|
|
7296
|
+
description: `${e.modeRequired ? 'Required. ' : ''}${e.modes.map((r) => ea[r]).join(' ')}`,
|
|
7178
7297
|
},
|
|
7179
7298
|
];
|
|
7180
7299
|
return (
|
|
7181
|
-
e.kind === 'video' ?
|
|
7300
|
+
e.kind === 'video' ? i.push(...ta(e)) : e.kind === 'image' ? i.push(...ia(e)) : i.push(...aa()),
|
|
7182
7301
|
e.seed &&
|
|
7183
|
-
|
|
7184
|
-
|
|
7302
|
+
i.push({ name: 'seed', type: 'number', min: 0, description: 'Seed for repeatable runs.' }),
|
|
7303
|
+
i
|
|
7185
7304
|
);
|
|
7186
7305
|
}
|
|
7187
7306
|
var J,
|
|
7188
|
-
Xi,
|
|
7189
7307
|
ea,
|
|
7190
|
-
|
|
7308
|
+
ra,
|
|
7309
|
+
ci = y(() => {
|
|
7191
7310
|
'use strict';
|
|
7192
7311
|
ze();
|
|
7193
7312
|
((J =
|
|
7194
7313
|
'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.'),
|
|
7195
|
-
(
|
|
7314
|
+
(ea = {
|
|
7196
7315
|
text_to_video: 'text_to_video: from the prompt alone.',
|
|
7197
7316
|
image_to_video: 'image_to_video: a start image in first_frame_image.',
|
|
7198
7317
|
first_n_last_frames: 'first_n_last_frames: first_frame_image and last_frame_image.',
|
|
@@ -7202,44 +7321,44 @@ var J,
|
|
|
7202
7321
|
text_to_speech: 'text_to_speech: speaks the prompt in one voice.',
|
|
7203
7322
|
dialogue: 'dialogue: speaks `turns`, each with its own voice.',
|
|
7204
7323
|
}));
|
|
7205
|
-
|
|
7324
|
+
ra = Object.entries(Ge)
|
|
7206
7325
|
.map(([e, t]) => `${e} (${t})`)
|
|
7207
7326
|
.join(', ');
|
|
7208
7327
|
});
|
|
7209
|
-
function
|
|
7328
|
+
function fi(e) {
|
|
7210
7329
|
return e === we || e === xe;
|
|
7211
7330
|
}
|
|
7212
7331
|
var we,
|
|
7213
|
-
|
|
7332
|
+
ui,
|
|
7214
7333
|
xe,
|
|
7215
|
-
|
|
7334
|
+
mi,
|
|
7216
7335
|
We,
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7336
|
+
gi,
|
|
7337
|
+
xs,
|
|
7338
|
+
ks,
|
|
7339
|
+
_s,
|
|
7340
|
+
Ps,
|
|
7341
|
+
hi = y(() => {
|
|
7223
7342
|
'use strict';
|
|
7224
7343
|
((we = 'enhancor-ultrafine'),
|
|
7225
|
-
(
|
|
7344
|
+
(ui = 'Enhancor Ultrafine'),
|
|
7226
7345
|
(xe = 'enhancor-deblur'),
|
|
7227
|
-
(
|
|
7346
|
+
(mi = 'Enhancor Deblur'));
|
|
7228
7347
|
((We = { skin: [2, 3, 4], noSkin: [2, 3, 4, 8, 16] }),
|
|
7229
|
-
(
|
|
7230
|
-
(
|
|
7231
|
-
(
|
|
7232
|
-
(
|
|
7233
|
-
(
|
|
7348
|
+
(gi = 2),
|
|
7349
|
+
(xs = 24 * 1024 * 1024),
|
|
7350
|
+
(ks = 4096 * 4096),
|
|
7351
|
+
(_s = 30 * 6e4),
|
|
7352
|
+
(Ps = 120 * 6e4));
|
|
7234
7353
|
});
|
|
7235
|
-
var
|
|
7236
|
-
|
|
7237
|
-
|
|
7354
|
+
var na,
|
|
7355
|
+
yi,
|
|
7356
|
+
sa,
|
|
7238
7357
|
Je,
|
|
7239
|
-
|
|
7358
|
+
bi = y(() => {
|
|
7240
7359
|
'use strict';
|
|
7241
|
-
((
|
|
7242
|
-
(
|
|
7360
|
+
((na = ['natural', 'pores', 'freckles', 'more_freckles', 'blemish', 'glow', 'unblur']),
|
|
7361
|
+
(yi = {
|
|
7243
7362
|
natural: 'Natural',
|
|
7244
7363
|
pores: 'Pores',
|
|
7245
7364
|
freckles: 'Freckles',
|
|
@@ -7248,8 +7367,8 @@ var ra,
|
|
|
7248
7367
|
glow: 'Glow',
|
|
7249
7368
|
unblur: 'Unblur',
|
|
7250
7369
|
}),
|
|
7251
|
-
(
|
|
7252
|
-
(Je =
|
|
7370
|
+
(sa = 'unblur'),
|
|
7371
|
+
(Je = na.filter((e) => e !== sa)));
|
|
7253
7372
|
});
|
|
7254
7373
|
var ee,
|
|
7255
7374
|
ke,
|
|
@@ -7270,150 +7389,222 @@ var ee,
|
|
|
7270
7389
|
(ke =
|
|
7271
7390
|
'a request with creative_mode: true answers 503 checkpoint_unavailable and nothing is charged'));
|
|
7272
7391
|
});
|
|
7273
|
-
function
|
|
7274
|
-
return
|
|
7392
|
+
function oa(e) {
|
|
7393
|
+
return wi.includes(e);
|
|
7275
7394
|
}
|
|
7276
7395
|
function _e(e = process.env) {
|
|
7277
7396
|
let t = String(e.IMAGE_PRIORITY_MODELS ?? ''),
|
|
7278
|
-
|
|
7397
|
+
i = new Set(
|
|
7279
7398
|
t
|
|
7280
7399
|
.split(',')
|
|
7281
|
-
.map((
|
|
7400
|
+
.map((r) => r.trim().toLowerCase())
|
|
7282
7401
|
.filter(Boolean),
|
|
7283
7402
|
);
|
|
7284
|
-
return
|
|
7403
|
+
return wi.filter((r) => i.has(r));
|
|
7285
7404
|
}
|
|
7286
|
-
function
|
|
7287
|
-
return
|
|
7405
|
+
function xi(e, t = process.env) {
|
|
7406
|
+
return oa(e) && _e(t).includes(e);
|
|
7288
7407
|
}
|
|
7289
|
-
function
|
|
7408
|
+
function ki(e) {
|
|
7290
7409
|
return e === 'nano-banana-pro' ? 'Nano Banana Pro' : 'Nano Banana 2.1';
|
|
7291
7410
|
}
|
|
7292
|
-
var
|
|
7411
|
+
var wi,
|
|
7293
7412
|
Xe = y(() => {
|
|
7294
7413
|
'use strict';
|
|
7295
|
-
|
|
7414
|
+
wi = ['nano-banana-2.1', 'nano-banana-pro'];
|
|
7296
7415
|
});
|
|
7297
7416
|
function te(e) {
|
|
7298
7417
|
return `$${Number(e.toFixed(5))}`;
|
|
7299
7418
|
}
|
|
7300
|
-
function
|
|
7419
|
+
function rt(e) {
|
|
7301
7420
|
if (e.kind === 'llm') {
|
|
7302
7421
|
let t = e.defaultEndpoint,
|
|
7303
|
-
|
|
7422
|
+
i = (s) =>
|
|
7304
7423
|
e.variants.find(
|
|
7305
7424
|
(o) =>
|
|
7306
7425
|
o.component === s &&
|
|
7307
7426
|
(!t || !o.endpoint || o.endpoint === t) &&
|
|
7308
7427
|
(!o.context || o.context === '0\u201332K'),
|
|
7309
7428
|
),
|
|
7310
|
-
|
|
7311
|
-
n =
|
|
7312
|
-
return
|
|
7313
|
-
? `${te(
|
|
7429
|
+
r = i('input'),
|
|
7430
|
+
n = i('output');
|
|
7431
|
+
return r && n
|
|
7432
|
+
? `${te(r.price.starter)}/M in \xB7 ${te(n.price.starter)}/M out`
|
|
7314
7433
|
: `from ${te(he(e).price.starter)}/M tokens`;
|
|
7315
7434
|
}
|
|
7316
7435
|
return `from ${te(he(e).price.starter)}${e.unit}`;
|
|
7317
7436
|
}
|
|
7318
|
-
function
|
|
7319
|
-
let
|
|
7320
|
-
return
|
|
7437
|
+
function da(e, t) {
|
|
7438
|
+
let i = t.filter((r) => Number.isFinite(r) && r > 0);
|
|
7439
|
+
return i.length ? `from ${te(Math.min(...i))}${e}` : null;
|
|
7321
7440
|
}
|
|
7322
|
-
function
|
|
7441
|
+
function Ti(e) {
|
|
7323
7442
|
for (let t of ce) {
|
|
7324
|
-
let
|
|
7325
|
-
|
|
7326
|
-
|
|
7443
|
+
let i = Y[t],
|
|
7444
|
+
r = i ? da(i.unit, e[t] ?? []) : null;
|
|
7445
|
+
i && r && (i.priceFormatted = r);
|
|
7327
7446
|
}
|
|
7328
7447
|
}
|
|
7329
|
-
function
|
|
7330
|
-
let
|
|
7331
|
-
...new Set(e.variants.map((
|
|
7448
|
+
function $(e, t) {
|
|
7449
|
+
let i = e.axes?.resolution ?? [
|
|
7450
|
+
...new Set(e.variants.map((r) => r.resolution).filter((r) => !!r)),
|
|
7332
7451
|
];
|
|
7333
7452
|
return {
|
|
7334
7453
|
name: 'resolution',
|
|
7335
7454
|
type: 'select',
|
|
7336
|
-
default:
|
|
7337
|
-
options:
|
|
7455
|
+
default: jt(e).resolution ?? i[0],
|
|
7456
|
+
options: i,
|
|
7338
7457
|
...(t ? { description: t } : {}),
|
|
7339
7458
|
};
|
|
7340
7459
|
}
|
|
7341
|
-
function
|
|
7460
|
+
function Mi(e) {
|
|
7342
7461
|
if (!e.endpoints?.length) return null;
|
|
7343
|
-
let t = e.endpoints.filter((
|
|
7462
|
+
let t = e.endpoints.filter((i) => Wt(e.slug, i.id));
|
|
7344
7463
|
return {
|
|
7345
7464
|
name: 'endpoint',
|
|
7346
7465
|
type: 'select',
|
|
7347
7466
|
default: Ne(e),
|
|
7348
|
-
options: e.endpoints.filter((
|
|
7467
|
+
options: e.endpoints.filter((i) => !t.includes(i)).map((i) => i.id),
|
|
7349
7468
|
description:
|
|
7350
7469
|
(e.slug === 'gemini-3.1-pro-preview'
|
|
7351
7470
|
? 'Where the request is served; a missing endpoint is the default, the lowest price, and an unknown one is refused.'
|
|
7352
7471
|
: 'Where the request is served; a missing or unknown endpoint is the default, the lowest price.') +
|
|
7353
|
-
(t.length ? ` ${t.map((
|
|
7472
|
+
(t.length ? ` ${t.map((i) => i.label).join(' and ')}: coming soon.` : ''),
|
|
7354
7473
|
};
|
|
7355
7474
|
}
|
|
7356
|
-
function
|
|
7357
|
-
if (e.unfiltered == null || t.some((
|
|
7358
|
-
let
|
|
7359
|
-
return [...t.filter((
|
|
7475
|
+
function ua(e, t) {
|
|
7476
|
+
if (e.unfiltered == null || t.some((r) => r.name === 'creative_mode')) return t;
|
|
7477
|
+
let i = ee.includes(e.api.model);
|
|
7478
|
+
return [...t.filter((r) => !Pe.has(r.name)), i ? nt : ca];
|
|
7360
7479
|
}
|
|
7361
7480
|
function Qe(e, t) {
|
|
7362
|
-
let
|
|
7363
|
-
|
|
7364
|
-
return (
|
|
7481
|
+
let i = e.filter((n) => !Pe.has(n.name)),
|
|
7482
|
+
r = [nt, Si];
|
|
7483
|
+
return (r.push(st, ot), [...i, ...r]);
|
|
7365
7484
|
}
|
|
7366
|
-
function
|
|
7485
|
+
function ha(e) {
|
|
7367
7486
|
return [
|
|
7368
7487
|
...e
|
|
7369
|
-
.filter((t) => !
|
|
7488
|
+
.filter((t) => !fa.has(t.name) && !Pe.has(t.name))
|
|
7370
7489
|
.map((t) => {
|
|
7371
7490
|
if (t.name === 'resolution')
|
|
7372
7491
|
return {
|
|
7373
7492
|
...t,
|
|
7374
7493
|
...(t.options
|
|
7375
7494
|
? {
|
|
7376
|
-
options: t.options.filter((
|
|
7377
|
-
['480p', '720p'].includes(String(
|
|
7495
|
+
options: t.options.filter((r) =>
|
|
7496
|
+
['480p', '720p'].includes(String(r).toLowerCase()),
|
|
7378
7497
|
),
|
|
7379
7498
|
}
|
|
7380
7499
|
: {}),
|
|
7381
|
-
description: `Output resolution: 480p or 720p (8-bit). This tier has no 1080p or 4k. ${
|
|
7500
|
+
description: `Output resolution: 480p or 720p (8-bit). This tier has no 1080p or 4k. ${ie}`,
|
|
7382
7501
|
};
|
|
7383
|
-
let
|
|
7384
|
-
return
|
|
7385
|
-
? { ...t, description: t.description.replace(/\(up to [^)]*\)/, `(${
|
|
7502
|
+
let i = ga[t.name];
|
|
7503
|
+
return i && typeof t.description == 'string'
|
|
7504
|
+
? { ...t, description: t.description.replace(/\(up to [^)]*\)/, `(${i})`) }
|
|
7386
7505
|
: t;
|
|
7387
7506
|
}),
|
|
7388
7507
|
nt,
|
|
7389
|
-
|
|
7508
|
+
Si,
|
|
7390
7509
|
st,
|
|
7391
7510
|
ot,
|
|
7392
7511
|
];
|
|
7393
7512
|
}
|
|
7394
|
-
function
|
|
7513
|
+
function Ki(e) {
|
|
7395
7514
|
return (
|
|
7396
7515
|
e.startsWith('seedance-2-5-') &&
|
|
7397
7516
|
e !== 'seedance-2-5-lite' &&
|
|
7517
|
+
e !== 'seedance-2-5-vip' &&
|
|
7398
7518
|
!/-(creative-mode|unfiltered|uncensored)$/.test(e)
|
|
7399
7519
|
);
|
|
7400
7520
|
}
|
|
7401
|
-
function
|
|
7521
|
+
function ya(e) {
|
|
7522
|
+
return [
|
|
7523
|
+
S(
|
|
7524
|
+
'Describe the video, the camera and its sound; for multi_reference say what each reference is for (up to 15000 characters).',
|
|
7525
|
+
),
|
|
7526
|
+
{
|
|
7527
|
+
name: 'mode',
|
|
7528
|
+
type: 'select',
|
|
7529
|
+
required: !0,
|
|
7530
|
+
options: ['text_to_video', 'image_to_video', 'multi_reference'],
|
|
7531
|
+
description:
|
|
7532
|
+
'text_to_video; image_to_video (first_frame_image, optional last_frame_image); multi_reference (images, videos and/or audios).',
|
|
7533
|
+
},
|
|
7534
|
+
{
|
|
7535
|
+
name: 'duration',
|
|
7536
|
+
type: 'slider',
|
|
7537
|
+
default: 5,
|
|
7538
|
+
min: 4,
|
|
7539
|
+
max: 30,
|
|
7540
|
+
description: 'Video length in whole seconds: 4 to 30.',
|
|
7541
|
+
},
|
|
7542
|
+
{
|
|
7543
|
+
...$(
|
|
7544
|
+
e,
|
|
7545
|
+
'Left out: 1080p. Sound is the same price on or off. Slower than Seedance 2.5: expect 9 to 11 minutes a run.',
|
|
7546
|
+
),
|
|
7547
|
+
default: '1080p',
|
|
7548
|
+
},
|
|
7549
|
+
{
|
|
7550
|
+
name: 'aspect_ratio',
|
|
7551
|
+
type: 'select',
|
|
7552
|
+
options: ['16:9', '9:16', '1:1', '4:3', '3:4', '21:9'],
|
|
7553
|
+
description:
|
|
7554
|
+
'text_to_video and multi_reference only (left out: 16:9). image_to_video takes no ratio: the video follows the start image.',
|
|
7555
|
+
},
|
|
7556
|
+
{
|
|
7557
|
+
name: 'generate_audio',
|
|
7558
|
+
type: 'boolean',
|
|
7559
|
+
default: !0,
|
|
7560
|
+
description: 'Generate sound with the video (same price either way).',
|
|
7561
|
+
},
|
|
7562
|
+
{
|
|
7563
|
+
name: 'first_frame_image',
|
|
7564
|
+
type: 'string',
|
|
7565
|
+
description:
|
|
7566
|
+
'image_to_video: the start frame (JPEG, PNG or WebP), as a public http(s) URL or data URI. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.',
|
|
7567
|
+
},
|
|
7568
|
+
{
|
|
7569
|
+
name: 'last_frame_image',
|
|
7570
|
+
type: 'string',
|
|
7571
|
+
description: 'image_to_video: an optional end frame.',
|
|
7572
|
+
},
|
|
7573
|
+
{
|
|
7574
|
+
name: 'images',
|
|
7575
|
+
type: 'string[]',
|
|
7576
|
+
description: 'multi_reference: up to 10 reference images. Public http(s) URLs or data URIs.',
|
|
7577
|
+
},
|
|
7578
|
+
{
|
|
7579
|
+
name: 'videos',
|
|
7580
|
+
type: 'string[]',
|
|
7581
|
+
description:
|
|
7582
|
+
'multi_reference: up to 5 reference videos, MP4 or MOV, 2-30 s each and 30 s in all. A run with a reference video is priced on its own row.',
|
|
7583
|
+
},
|
|
7584
|
+
{
|
|
7585
|
+
name: 'audios',
|
|
7586
|
+
type: 'string[]',
|
|
7587
|
+
description:
|
|
7588
|
+
'multi_reference: up to 5 reference audio clips, MP3 or WAV, 2-30 s each and 30 s in all, always with at least one reference image or video.',
|
|
7589
|
+
},
|
|
7590
|
+
];
|
|
7591
|
+
}
|
|
7592
|
+
function Pi(e, t = {}) {
|
|
7402
7593
|
return [
|
|
7403
7594
|
...e
|
|
7404
|
-
.filter((
|
|
7405
|
-
.map((
|
|
7406
|
-
|
|
7407
|
-
? { ...
|
|
7408
|
-
:
|
|
7595
|
+
.filter((i) => !ma.has(i.name) && !Pe.has(i.name))
|
|
7596
|
+
.map((i) =>
|
|
7597
|
+
i.name === 'prompt'
|
|
7598
|
+
? { ...i, required: !0 }
|
|
7599
|
+
: i.name === 'resolution'
|
|
7409
7600
|
? {
|
|
7410
|
-
...
|
|
7411
|
-
...(t.no4k &&
|
|
7412
|
-
? { options:
|
|
7601
|
+
...i,
|
|
7602
|
+
...(t.no4k && i.options
|
|
7603
|
+
? { options: i.options.filter((r) => String(r).toLowerCase() !== '4k') }
|
|
7413
7604
|
: {}),
|
|
7414
|
-
description: `Output resolution. TEIN LITE is the lower-priced endpoint for getting started. Stability and reliability are not guaranteed. ${
|
|
7605
|
+
description: `Output resolution. TEIN LITE is the lower-priced endpoint for getting started. Stability and reliability are not guaranteed. ${ie}`,
|
|
7415
7606
|
}
|
|
7416
|
-
:
|
|
7607
|
+
: i,
|
|
7417
7608
|
),
|
|
7418
7609
|
{
|
|
7419
7610
|
name: 'bitrate_mode',
|
|
@@ -7438,30 +7629,30 @@ function Ze(e, t) {
|
|
|
7438
7629
|
max: t.maxSec,
|
|
7439
7630
|
description: `Video length in seconds (${t.minSec} to ${t.maxSec}).`,
|
|
7440
7631
|
},
|
|
7441
|
-
|
|
7632
|
+
$(e),
|
|
7442
7633
|
{ name: 'aspect_ratio', type: 'select', default: t.aspects[0], options: t.aspects },
|
|
7443
|
-
...t.references.map((
|
|
7444
|
-
|
|
7634
|
+
...t.references.map((i) =>
|
|
7635
|
+
i.endsWith('s')
|
|
7445
7636
|
? {
|
|
7446
|
-
name:
|
|
7637
|
+
name: i,
|
|
7447
7638
|
type: 'string[]',
|
|
7448
|
-
description: `${
|
|
7639
|
+
description: `${i} as public http(s) URLs or data URIs. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.`,
|
|
7449
7640
|
}
|
|
7450
7641
|
: {
|
|
7451
|
-
name:
|
|
7642
|
+
name: i,
|
|
7452
7643
|
type: 'string',
|
|
7453
|
-
description: `${
|
|
7644
|
+
description: `${i} as a public http(s) URL or data URI. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.`,
|
|
7454
7645
|
},
|
|
7455
7646
|
),
|
|
7456
7647
|
];
|
|
7457
7648
|
}
|
|
7458
|
-
function
|
|
7459
|
-
return e.map((
|
|
7460
|
-
t[
|
|
7649
|
+
function ba(e, t) {
|
|
7650
|
+
return e.map((i) =>
|
|
7651
|
+
t[i.name] ? { ...i, description: `${i.description ?? ''} ${t[i.name]}`.trim() } : i,
|
|
7461
7652
|
);
|
|
7462
7653
|
}
|
|
7463
|
-
function
|
|
7464
|
-
let t =
|
|
7654
|
+
function wa(e) {
|
|
7655
|
+
let t = Mi(e);
|
|
7465
7656
|
return [
|
|
7466
7657
|
S('Image prompt text. Supports complex composition and text instructions.'),
|
|
7467
7658
|
...(t ? [t] : []),
|
|
@@ -7471,7 +7662,7 @@ function ga(e) {
|
|
|
7471
7662
|
default: 'low',
|
|
7472
7663
|
options: e.axes?.quality ?? ['low', 'medium', 'high'],
|
|
7473
7664
|
},
|
|
7474
|
-
|
|
7665
|
+
$(
|
|
7475
7666
|
e,
|
|
7476
7667
|
e.slug === 'gpt-image-2'
|
|
7477
7668
|
? `1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count. ${St}`
|
|
@@ -7528,7 +7719,7 @@ function ga(e) {
|
|
|
7528
7719
|
},
|
|
7529
7720
|
];
|
|
7530
7721
|
}
|
|
7531
|
-
function
|
|
7722
|
+
function xa(e) {
|
|
7532
7723
|
return [
|
|
7533
7724
|
S('Image prompt text.'),
|
|
7534
7725
|
{
|
|
@@ -7536,8 +7727,8 @@ function ha(e) {
|
|
|
7536
7727
|
type: 'string[]',
|
|
7537
7728
|
description: 'Images to edit or use as reference (up to 14).',
|
|
7538
7729
|
},
|
|
7539
|
-
{ name: 'aspect_ratio', type: 'select', default: '1:1', options: [...
|
|
7540
|
-
|
|
7730
|
+
{ name: 'aspect_ratio', type: 'select', default: '1:1', options: [...Yt(e.slug)] },
|
|
7731
|
+
$(e),
|
|
7541
7732
|
{
|
|
7542
7733
|
name: 'n',
|
|
7543
7734
|
type: 'slider',
|
|
@@ -7562,22 +7753,22 @@ function ha(e) {
|
|
|
7562
7753
|
},
|
|
7563
7754
|
];
|
|
7564
7755
|
}
|
|
7565
|
-
function
|
|
7566
|
-
let e =
|
|
7756
|
+
function va() {
|
|
7757
|
+
let e = Qt,
|
|
7567
7758
|
t = [];
|
|
7568
|
-
for (let
|
|
7569
|
-
e.includes(
|
|
7759
|
+
for (let i of lt(!0))
|
|
7760
|
+
e.includes(i.name) &&
|
|
7570
7761
|
(t.push({
|
|
7571
|
-
...
|
|
7572
|
-
...(
|
|
7573
|
-
...(
|
|
7762
|
+
...i,
|
|
7763
|
+
...(i.name === 'max_tokens' ? { min: 64 } : {}),
|
|
7764
|
+
...(i.name === 'messages'
|
|
7574
7765
|
? {
|
|
7575
7766
|
description:
|
|
7576
7767
|
'Chat history: system, developer, user (text and image_url parts) and assistant turns; no tool turns.',
|
|
7577
7768
|
}
|
|
7578
7769
|
: {}),
|
|
7579
7770
|
}),
|
|
7580
|
-
|
|
7771
|
+
i.name === 'top_p' &&
|
|
7581
7772
|
t.push({
|
|
7582
7773
|
name: 'top_k',
|
|
7583
7774
|
type: 'number',
|
|
@@ -7587,7 +7778,7 @@ function xa() {
|
|
|
7587
7778
|
}));
|
|
7588
7779
|
return t;
|
|
7589
7780
|
}
|
|
7590
|
-
function
|
|
7781
|
+
function Ia() {
|
|
7591
7782
|
return lt(!0).map((e) =>
|
|
7592
7783
|
e.name === 'max_tokens' || e.name === 'max_completion_tokens' ? { ...e, min: 128 } : e,
|
|
7593
7784
|
);
|
|
@@ -7687,17 +7878,17 @@ function lt(e) {
|
|
|
7687
7878
|
},
|
|
7688
7879
|
];
|
|
7689
7880
|
}
|
|
7690
|
-
function
|
|
7691
|
-
if (e.slug === 'seed-2-1-turbo') return
|
|
7692
|
-
let t =
|
|
7881
|
+
function Ta(e) {
|
|
7882
|
+
if (e.slug === 'seed-2-1-turbo') return _a;
|
|
7883
|
+
let t = Mi(e);
|
|
7693
7884
|
return [
|
|
7694
7885
|
...(e.slug === 'gemini-3.1-pro-preview'
|
|
7695
|
-
?
|
|
7886
|
+
? va()
|
|
7696
7887
|
: e.slug === 'gemini-3.7-flash'
|
|
7697
|
-
?
|
|
7698
|
-
: e.slug === 'gpt-6-astra' ||
|
|
7888
|
+
? Ia()
|
|
7889
|
+
: e.slug === 'gpt-6-astra' || Pa.includes(e.slug)
|
|
7699
7890
|
? lt(e.slug !== 'gpt-6-astra')
|
|
7700
|
-
:
|
|
7891
|
+
: ka),
|
|
7701
7892
|
...(t ? [t] : []),
|
|
7702
7893
|
];
|
|
7703
7894
|
}
|
|
@@ -7709,7 +7900,7 @@ function et() {
|
|
|
7709
7900
|
description: 'The photo to fix: one JPEG or PNG URL.',
|
|
7710
7901
|
};
|
|
7711
7902
|
}
|
|
7712
|
-
function
|
|
7903
|
+
function Sa(e) {
|
|
7713
7904
|
return [
|
|
7714
7905
|
{
|
|
7715
7906
|
name: 'video_url',
|
|
@@ -7718,7 +7909,7 @@ function Ia(e) {
|
|
|
7718
7909
|
description:
|
|
7719
7910
|
'The video to upscale (up to 30 seconds): a Tein upload link, or any public https link.',
|
|
7720
7911
|
},
|
|
7721
|
-
|
|
7912
|
+
$(
|
|
7722
7913
|
e,
|
|
7723
7914
|
'Size of the result: 1080p, 2k or 4k. A video already near a size cannot be upscaled to it.',
|
|
7724
7915
|
),
|
|
@@ -7731,7 +7922,7 @@ function Ia(e) {
|
|
|
7731
7922
|
},
|
|
7732
7923
|
];
|
|
7733
7924
|
}
|
|
7734
|
-
function
|
|
7925
|
+
function Ka() {
|
|
7735
7926
|
return [
|
|
7736
7927
|
{
|
|
7737
7928
|
name: 'mode',
|
|
@@ -7802,30 +7993,57 @@ function va() {
|
|
|
7802
7993
|
},
|
|
7803
7994
|
];
|
|
7804
7995
|
}
|
|
7805
|
-
function
|
|
7996
|
+
function Ea(e) {
|
|
7997
|
+
return [
|
|
7998
|
+
{
|
|
7999
|
+
name: 'image',
|
|
8000
|
+
type: 'string',
|
|
8001
|
+
required: !0,
|
|
8002
|
+
description:
|
|
8003
|
+
'One clear photo of the person (or people) to animate, as a public https URL. JPEG, PNG, WEBP, BMP, TIFF or GIF; each side 300-6000 px; aspect ratio (width / height) 0.4-2.5. The Tein CLI and local MCP client read a file path on your machine and upload it first.',
|
|
8004
|
+
},
|
|
8005
|
+
{
|
|
8006
|
+
name: 'audio',
|
|
8007
|
+
type: 'string',
|
|
8008
|
+
required: !0,
|
|
8009
|
+
description:
|
|
8010
|
+
'The speech, singing or music to perform, as a public https URL: MP3 or WAV, 4-300 seconds, up to 15 MB. The video runs about as long as the audio (usually under a second longer) and is billed per second of the video made, to the nearest whole second.',
|
|
8011
|
+
},
|
|
8012
|
+
{
|
|
8013
|
+
name: 'prompt',
|
|
8014
|
+
type: 'string',
|
|
8015
|
+
description:
|
|
8016
|
+
'Optional direction for camera, body movement, expression or scene (up to 2000 characters), in Chinese, English, Japanese, Korean, Spanish (Mexican) or Indonesian. The lips follow the audio either way.',
|
|
8017
|
+
},
|
|
8018
|
+
$(e, 'Output resolution. 720p only.'),
|
|
8019
|
+
];
|
|
8020
|
+
}
|
|
8021
|
+
function $a(e) {
|
|
7806
8022
|
let t = e.slug;
|
|
7807
|
-
if (e.family === 'tein-labs' && e.kind === 'image') return
|
|
7808
|
-
if (me.some((
|
|
7809
|
-
if (e.kind === 'llm') return
|
|
7810
|
-
if (e.
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
if (
|
|
8023
|
+
if (e.family === 'tein-labs' && e.kind === 'image') return Ka();
|
|
8024
|
+
if (me.some((r) => r.slug === t)) return Sa(e);
|
|
8025
|
+
if (e.kind === 'llm') return Ta(e);
|
|
8026
|
+
if (e.family === 'omnihuman') return Ea(e);
|
|
8027
|
+
if (e.editVariants?.length) return wa(e);
|
|
8028
|
+
let i = je(t);
|
|
8029
|
+
if (i) return di(i);
|
|
8030
|
+
if (t === 'seedance-2-5-vip') return ya(e);
|
|
8031
|
+
if (Ki(t)) return ha(tt);
|
|
7814
8032
|
switch (t) {
|
|
7815
8033
|
case 'seedance-2-5':
|
|
7816
8034
|
return Qe(tt, t);
|
|
7817
8035
|
case 'seedance-2-5-lite':
|
|
7818
|
-
return
|
|
8036
|
+
return Pi(tt, { no4k: !0 });
|
|
7819
8037
|
case 'seedance-2':
|
|
7820
|
-
return Qe(
|
|
8038
|
+
return Qe(vi, t);
|
|
7821
8039
|
case 'seedance-2-lite':
|
|
7822
|
-
return
|
|
8040
|
+
return Pi(vi);
|
|
7823
8041
|
case 'seedance-2-mini':
|
|
7824
|
-
return Qe(
|
|
8042
|
+
return Qe(Ca, t);
|
|
7825
8043
|
case 'nano-banana-2':
|
|
7826
8044
|
case 'nano-banana-2.1':
|
|
7827
8045
|
case 'nano-banana-pro':
|
|
7828
|
-
return
|
|
8046
|
+
return xa(e);
|
|
7829
8047
|
case 'seedream-5-pro':
|
|
7830
8048
|
return [
|
|
7831
8049
|
S('Detailed description of the image to generate.'),
|
|
@@ -7835,7 +8053,7 @@ function Ta(e) {
|
|
|
7835
8053
|
description:
|
|
7836
8054
|
'Reference images. The first is free; each one after it adds the extra reference image charge (see the price).',
|
|
7837
8055
|
},
|
|
7838
|
-
|
|
8056
|
+
$(e),
|
|
7839
8057
|
{
|
|
7840
8058
|
name: 'aspect_ratio',
|
|
7841
8059
|
type: 'select',
|
|
@@ -7854,7 +8072,7 @@ function Ta(e) {
|
|
|
7854
8072
|
description:
|
|
7855
8073
|
'Reference images to edit or combine (up to 16). Leave empty for text to image. Each reference image is billed.',
|
|
7856
8074
|
},
|
|
7857
|
-
{
|
|
8075
|
+
{ ...$(e, '1K, 2K or 4K (about 16 megapixels).'), default: '2K' },
|
|
7858
8076
|
{
|
|
7859
8077
|
name: 'aspect_ratio',
|
|
7860
8078
|
type: 'select',
|
|
@@ -7902,7 +8120,7 @@ function Ta(e) {
|
|
|
7902
8120
|
description:
|
|
7903
8121
|
'Reference images (up to 10), or for layer_decomposition the one JPEG or PNG to split (at least 512x512). Each input image is billed.',
|
|
7904
8122
|
},
|
|
7905
|
-
|
|
8123
|
+
$(
|
|
7906
8124
|
e,
|
|
7907
8125
|
'1K and 1.5K are one price, 2K the next, 4K (up to 3840x2160 or 2880x2880) the top. 4K needs an aspect_ratio other than adaptive, or exact pixels in size. layer_decomposition takes 1K, 1.5K, 2K or auto (keep the input size), billed at the 2K price.',
|
|
7908
8126
|
),
|
|
@@ -7954,7 +8172,7 @@ function Ta(e) {
|
|
|
7954
8172
|
type: 'string[]',
|
|
7955
8173
|
description: 'Up to 3 reference images, each billed at the published add-on price.',
|
|
7956
8174
|
},
|
|
7957
|
-
|
|
8175
|
+
$(e),
|
|
7958
8176
|
{
|
|
7959
8177
|
name: 'aspect_ratio',
|
|
7960
8178
|
type: 'select',
|
|
@@ -7973,7 +8191,7 @@ function Ta(e) {
|
|
|
7973
8191
|
case 'z-image-pro':
|
|
7974
8192
|
return [
|
|
7975
8193
|
S('Image prompt text: subject, scene, style, composition and lighting.'),
|
|
7976
|
-
|
|
8194
|
+
$(e, 'Long edge: 1K is 1024 px, 2K is 2048 px. Same price.'),
|
|
7977
8195
|
{
|
|
7978
8196
|
name: 'aspect_ratio',
|
|
7979
8197
|
type: 'select',
|
|
@@ -8103,7 +8321,7 @@ function Ta(e) {
|
|
|
8103
8321
|
max: 0.4,
|
|
8104
8322
|
description: 'Portrait depth. Heavy only.',
|
|
8105
8323
|
},
|
|
8106
|
-
...
|
|
8324
|
+
...Ma,
|
|
8107
8325
|
];
|
|
8108
8326
|
case 'enhancor-skin-fix-v3':
|
|
8109
8327
|
return [
|
|
@@ -8182,13 +8400,13 @@ function Ta(e) {
|
|
|
8182
8400
|
name: 'image_url',
|
|
8183
8401
|
type: 'string',
|
|
8184
8402
|
required: !0,
|
|
8185
|
-
description: `The character to animate: one jpg or png, at least 300 px a side, aspect 1:2.5 to 2.5:1, with the head and upper or full body clearly visible. ${
|
|
8403
|
+
description: `The character to animate: one jpg or png, at least 300 px a side, aspect 1:2.5 to 2.5:1, with the head and upper or full body clearly visible. ${_i}`,
|
|
8186
8404
|
},
|
|
8187
8405
|
{
|
|
8188
8406
|
name: 'video_url',
|
|
8189
8407
|
type: 'string',
|
|
8190
8408
|
required: !0,
|
|
8191
|
-
description: `The motion to copy: one mp4 or mov of a single person in one continuous take, 3 to 30 s (up to 10 s when character_orientation is image). Billed per second of this video, rounded up. ${
|
|
8409
|
+
description: `The motion to copy: one mp4 or mov of a single person in one continuous take, 3 to 30 s (up to 10 s when character_orientation is image). Billed per second of this video, rounded up. ${_i}`,
|
|
8192
8410
|
},
|
|
8193
8411
|
{
|
|
8194
8412
|
name: 'prompt',
|
|
@@ -8204,7 +8422,7 @@ function Ta(e) {
|
|
|
8204
8422
|
description:
|
|
8205
8423
|
'video: the character faces as in the reference video (better for complex motion, up to 30 s). image: as in the image (better for following camera moves, up to 10 s).',
|
|
8206
8424
|
},
|
|
8207
|
-
|
|
8425
|
+
$(e),
|
|
8208
8426
|
{
|
|
8209
8427
|
name: 'keep_original_sound',
|
|
8210
8428
|
type: 'boolean',
|
|
@@ -8262,7 +8480,7 @@ function Ta(e) {
|
|
|
8262
8480
|
description:
|
|
8263
8481
|
'Video length in seconds (3 to 15). With a last frame 3 to 10; for video_extend the seconds added (3 to 10). Not taken by video_edit, which bills the input video length.',
|
|
8264
8482
|
},
|
|
8265
|
-
{
|
|
8483
|
+
{ ...$(e, '1080p and 4k are upscaled. Sound is always included.'), default: '720p' },
|
|
8266
8484
|
{
|
|
8267
8485
|
name: 'aspect_ratio',
|
|
8268
8486
|
type: 'select',
|
|
@@ -8316,7 +8534,7 @@ function Ta(e) {
|
|
|
8316
8534
|
description: 'Video length in whole seconds: 4 to 15 at 720p, 4 to 30 at 1080p.',
|
|
8317
8535
|
},
|
|
8318
8536
|
{
|
|
8319
|
-
|
|
8537
|
+
...$(
|
|
8320
8538
|
e,
|
|
8321
8539
|
'Sound is the same price on or off. 1080p takes about 6 to 16 minutes (up to about 28 for a 21-30 s clip); 720p about 2 to 4.',
|
|
8322
8540
|
),
|
|
@@ -8366,7 +8584,7 @@ function Ta(e) {
|
|
|
8366
8584
|
},
|
|
8367
8585
|
];
|
|
8368
8586
|
case 'minimax-h3':
|
|
8369
|
-
return
|
|
8587
|
+
return ba(
|
|
8370
8588
|
Ze(e, {
|
|
8371
8589
|
modes: ['text_to_video', 'first_n_last_frames', 'multi_reference'],
|
|
8372
8590
|
aspects: ['16:9', '21:9', '4:3', '1:1', '3:4', '9:16', 'adaptive'],
|
|
@@ -8385,15 +8603,15 @@ function Ta(e) {
|
|
|
8385
8603
|
return [S('Prompt text.')];
|
|
8386
8604
|
}
|
|
8387
8605
|
}
|
|
8388
|
-
function
|
|
8389
|
-
let e = (t,
|
|
8606
|
+
function Ci() {
|
|
8607
|
+
let e = (t, i) => ({
|
|
8390
8608
|
name: t,
|
|
8391
8609
|
type: 'slider',
|
|
8392
8610
|
default: 50,
|
|
8393
8611
|
min: 0,
|
|
8394
8612
|
max: 100,
|
|
8395
8613
|
step: 1,
|
|
8396
|
-
description: `${
|
|
8614
|
+
description: `${i} 0 to 100. 50 is the default look.`,
|
|
8397
8615
|
});
|
|
8398
8616
|
return [
|
|
8399
8617
|
e(
|
|
@@ -8406,7 +8624,7 @@ function Er() {
|
|
|
8406
8624
|
),
|
|
8407
8625
|
];
|
|
8408
8626
|
}
|
|
8409
|
-
function
|
|
8627
|
+
function Ai(e) {
|
|
8410
8628
|
return {
|
|
8411
8629
|
name: 'image',
|
|
8412
8630
|
type: 'string',
|
|
@@ -8414,10 +8632,10 @@ function $r(e) {
|
|
|
8414
8632
|
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.`,
|
|
8415
8633
|
};
|
|
8416
8634
|
}
|
|
8417
|
-
function
|
|
8635
|
+
function Aa() {
|
|
8418
8636
|
return {
|
|
8419
8637
|
slug: we,
|
|
8420
|
-
name:
|
|
8638
|
+
name: ui,
|
|
8421
8639
|
category: 'Image',
|
|
8422
8640
|
kind: 'Image-to-Image',
|
|
8423
8641
|
vendor: 'Enhancor',
|
|
@@ -8427,12 +8645,12 @@ function Sa() {
|
|
|
8427
8645
|
unit: '/img',
|
|
8428
8646
|
primaryToolName: at.image,
|
|
8429
8647
|
parameters: [
|
|
8430
|
-
|
|
8648
|
+
Ai('upscale'),
|
|
8431
8649
|
{
|
|
8432
8650
|
name: 'preset',
|
|
8433
8651
|
type: 'select',
|
|
8434
8652
|
options: [...Je],
|
|
8435
|
-
description: `Skin preset, run before the upscale: ${Je.map((e) => `${e} (${
|
|
8653
|
+
description: `Skin preset, run before the upscale: ${Je.map((e) => `${e} (${yi[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.`,
|
|
8436
8654
|
},
|
|
8437
8655
|
{
|
|
8438
8656
|
name: 'skin_fix',
|
|
@@ -8440,16 +8658,16 @@ function Sa() {
|
|
|
8440
8658
|
default: !1,
|
|
8441
8659
|
description: 'Same as preset natural. Off by default.',
|
|
8442
8660
|
},
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
...
|
|
8661
|
+
Ri,
|
|
8662
|
+
Oi,
|
|
8663
|
+
...Ci(),
|
|
8446
8664
|
],
|
|
8447
8665
|
};
|
|
8448
8666
|
}
|
|
8449
|
-
function
|
|
8667
|
+
function Ra() {
|
|
8450
8668
|
return {
|
|
8451
8669
|
slug: xe,
|
|
8452
|
-
name:
|
|
8670
|
+
name: mi,
|
|
8453
8671
|
category: 'Image',
|
|
8454
8672
|
kind: 'Image-to-Image',
|
|
8455
8673
|
vendor: 'Enhancor',
|
|
@@ -8458,185 +8676,184 @@ function Ka() {
|
|
|
8458
8676
|
priceFormatted: '',
|
|
8459
8677
|
unit: '/img',
|
|
8460
8678
|
primaryToolName: at.image,
|
|
8461
|
-
parameters: [
|
|
8679
|
+
parameters: [Ai('deblur'), Ri, Oi, ...Ci()],
|
|
8462
8680
|
};
|
|
8463
8681
|
}
|
|
8464
|
-
function
|
|
8465
|
-
let
|
|
8682
|
+
function it(e, t = e.api.model) {
|
|
8683
|
+
let i = Gt(e.slug);
|
|
8466
8684
|
return {
|
|
8467
8685
|
slug: t,
|
|
8468
8686
|
name: e.name,
|
|
8469
|
-
category:
|
|
8470
|
-
kind: t.startsWith('enhancor-skin-fix-') ? 'Image-to-Image' :
|
|
8687
|
+
category: la[e.kind],
|
|
8688
|
+
kind: t.startsWith('enhancor-skin-fix-') ? 'Image-to-Image' : pa[e.kind],
|
|
8471
8689
|
vendor: e.vendor ?? '',
|
|
8472
8690
|
description: e.desc ?? e.name,
|
|
8473
|
-
priceFormatted:
|
|
8474
|
-
...(
|
|
8691
|
+
priceFormatted: rt(e),
|
|
8692
|
+
...(i.length ? { priceNotes: i } : {}),
|
|
8475
8693
|
unit: e.unit,
|
|
8476
8694
|
primaryToolName: at[e.kind],
|
|
8477
|
-
parameters:
|
|
8695
|
+
parameters: ua(e, $a(e)),
|
|
8478
8696
|
};
|
|
8479
8697
|
}
|
|
8480
|
-
function
|
|
8698
|
+
function Oa() {
|
|
8481
8699
|
let e = {};
|
|
8482
8700
|
for (let t of ge())
|
|
8483
8701
|
if (t.slug !== 'seedance-2-fast') {
|
|
8484
8702
|
if (t.slug === 'seedance-2-mini') {
|
|
8485
|
-
e['seedance-2-mini'] =
|
|
8703
|
+
e['seedance-2-mini'] = it(t, 'seedance-2-mini');
|
|
8486
8704
|
continue;
|
|
8487
8705
|
}
|
|
8488
8706
|
if (t.slug === 'seedance-2') {
|
|
8489
|
-
let
|
|
8490
|
-
((
|
|
8491
|
-
(
|
|
8492
|
-
(e['seedance-2'] =
|
|
8707
|
+
let i = it(t);
|
|
8708
|
+
((i.description = `${t.desc ?? t.name} Send quality fast or mini for Seedance 2.0 Fast or Mini.`),
|
|
8709
|
+
(i.priceFormatted = qa(t)),
|
|
8710
|
+
(e['seedance-2'] = i));
|
|
8493
8711
|
continue;
|
|
8494
8712
|
}
|
|
8495
|
-
t.slug.startsWith('claude-') || (e[t.api.model] =
|
|
8713
|
+
t.slug.startsWith('claude-') || (e[t.api.model] = it(t));
|
|
8496
8714
|
}
|
|
8497
|
-
(Object.assign(e,
|
|
8498
|
-
for (let [t,
|
|
8499
|
-
e[
|
|
8715
|
+
(Object.assign(e, ai()), (e[we] = Aa()), (e[xe] = Ra()));
|
|
8716
|
+
for (let [t, i] of Object.entries(be))
|
|
8717
|
+
e[i] && Object.defineProperty(e, t, { value: e[i], enumerable: !1 });
|
|
8500
8718
|
return e;
|
|
8501
8719
|
}
|
|
8502
|
-
function
|
|
8720
|
+
function qa(e = F('seedance-2')) {
|
|
8503
8721
|
let t = F('seedance-2-fast'),
|
|
8504
|
-
|
|
8505
|
-
if (!t) return
|
|
8506
|
-
let
|
|
8507
|
-
return
|
|
8722
|
+
i = e ? rt(e) : '';
|
|
8723
|
+
if (!t) return i;
|
|
8724
|
+
let r = `Fast ${rt(t)}`;
|
|
8725
|
+
return i ? `${i} \xB7 ${r}` : r;
|
|
8508
8726
|
}
|
|
8509
|
-
function
|
|
8727
|
+
function qi(e) {
|
|
8510
8728
|
if (!(!e || typeof e != 'object' || Array.isArray(e)))
|
|
8511
|
-
for (let [t,
|
|
8512
|
-
let
|
|
8513
|
-
|
|
8729
|
+
for (let [t, i] of Object.entries(e)) {
|
|
8730
|
+
let r = Object.prototype.hasOwnProperty.call(Y, t) ? Y[t] : null;
|
|
8731
|
+
r && typeof i == 'string' && i.trim() && (r.priceFormatted = i.trim());
|
|
8514
8732
|
}
|
|
8515
8733
|
}
|
|
8516
|
-
function
|
|
8734
|
+
function ve(e) {
|
|
8517
8735
|
return !!e?.parameters.some((t) => t.name === 'image');
|
|
8518
8736
|
}
|
|
8519
8737
|
function j(e) {
|
|
8520
8738
|
let t = Y[e];
|
|
8521
|
-
return t ?
|
|
8739
|
+
return t ? Li(t) : null;
|
|
8522
8740
|
}
|
|
8523
|
-
function
|
|
8524
|
-
return !
|
|
8741
|
+
function Li(e) {
|
|
8742
|
+
return !xi(e.slug) || e.parameters.some((t) => t.name === 'priority')
|
|
8525
8743
|
? e
|
|
8526
|
-
: { ...e, parameters: [...e.parameters,
|
|
8744
|
+
: { ...e, parameters: [...e.parameters, La] };
|
|
8527
8745
|
}
|
|
8528
|
-
function
|
|
8746
|
+
function Da(e, t, i) {
|
|
8529
8747
|
if (
|
|
8530
8748
|
e.startsWith('enhancor-skin-fix-') ||
|
|
8531
|
-
|
|
8532
|
-
(e === 'gemini-omni-1.2-flash' && (t === 'aspect_ratio' || t === 'duration'))
|
|
8533
|
-
(e === 'magi-2' &&
|
|
8534
|
-
t === 'aspect_ratio' &&
|
|
8535
|
-
(typeof r.mode == 'string' ? r.mode.trim().toLowerCase() : '').replace(/-/g, '_') ===
|
|
8536
|
-
'image_to_video')
|
|
8749
|
+
fi(e) ||
|
|
8750
|
+
(e === 'gemini-omni-1.2-flash' && (t === 'aspect_ratio' || t === 'duration'))
|
|
8537
8751
|
)
|
|
8538
8752
|
return !1;
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8753
|
+
let r = typeof i.mode == 'string' ? i.mode.trim().toLowerCase() : '',
|
|
8754
|
+
n = t === 'aspect_ratio' && r.replace(/-/g, '_') === 'image_to_video';
|
|
8755
|
+
if ((n && e === 'magi-2') || (n && e === 'seedance-2-5-vip')) return !1;
|
|
8756
|
+
if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite' || Ki(e)) && t === 'duration') {
|
|
8757
|
+
let s = (o) => (typeof o == 'string' ? o.trim().toLowerCase() : '');
|
|
8758
|
+
if (s(i.mode) === 'edit' || s(i.omni_reference_task_type) === 'edit') return !1;
|
|
8542
8759
|
}
|
|
8543
8760
|
if (
|
|
8544
|
-
(t === 'max_tokens' &&
|
|
8545
|
-
(t === 'max_completion_tokens' &&
|
|
8761
|
+
(t === 'max_tokens' && Ii(i.max_completion_tokens)) ||
|
|
8762
|
+
(t === 'max_completion_tokens' && Ii(i.max_tokens))
|
|
8546
8763
|
)
|
|
8547
8764
|
return !1;
|
|
8548
8765
|
if (t === 'aspect_ratio') {
|
|
8549
|
-
let
|
|
8550
|
-
if (
|
|
8551
|
-
let
|
|
8552
|
-
|
|
8553
|
-
if (
|
|
8766
|
+
let s = je(e);
|
|
8767
|
+
if (s) {
|
|
8768
|
+
let o = typeof i.mode == 'string' ? i.mode.trim().toLowerCase() : '',
|
|
8769
|
+
p = o ? o.replace(/-/g, '_') : s.modes[0];
|
|
8770
|
+
if (s.modes.includes(p) && !pi(s, p)) return !1;
|
|
8554
8771
|
}
|
|
8555
8772
|
}
|
|
8556
8773
|
return !0;
|
|
8557
8774
|
}
|
|
8558
|
-
function
|
|
8775
|
+
function Ii(e) {
|
|
8559
8776
|
return e != null && e !== '';
|
|
8560
8777
|
}
|
|
8561
|
-
function
|
|
8562
|
-
let
|
|
8778
|
+
function Di(e, t) {
|
|
8779
|
+
let i = { ...t };
|
|
8563
8780
|
if (e?.slug === 'seedance-2-5') {
|
|
8564
|
-
let
|
|
8565
|
-
for (let n of
|
|
8566
|
-
if (!i
|
|
8781
|
+
let r = (n) => typeof n != 'string' || !n.trim();
|
|
8782
|
+
for (let n of Na) (r(i.finalize) && !r(i[n]) && (i.finalize = i[n]), delete i[n]);
|
|
8783
|
+
if (!r(i.finalize)) return i;
|
|
8567
8784
|
}
|
|
8568
|
-
for (let
|
|
8569
|
-
|
|
8570
|
-
r
|
|
8571
|
-
|
|
8572
|
-
(r
|
|
8573
|
-
return
|
|
8785
|
+
for (let r of e?.parameters ?? [])
|
|
8786
|
+
r.default !== void 0 &&
|
|
8787
|
+
i[r.name] === void 0 &&
|
|
8788
|
+
Da(e.slug, r.name, t) &&
|
|
8789
|
+
(i[r.name] = r.default);
|
|
8790
|
+
return i;
|
|
8574
8791
|
}
|
|
8575
8792
|
function D() {
|
|
8576
|
-
return Object.values(Y).map(
|
|
8793
|
+
return Object.values(Y).map(Li);
|
|
8577
8794
|
}
|
|
8578
|
-
var
|
|
8795
|
+
var la,
|
|
8579
8796
|
at,
|
|
8580
|
-
|
|
8581
|
-
|
|
8797
|
+
pa,
|
|
8798
|
+
_i,
|
|
8582
8799
|
S,
|
|
8583
8800
|
nt,
|
|
8584
|
-
|
|
8585
|
-
|
|
8801
|
+
ca,
|
|
8802
|
+
Si,
|
|
8586
8803
|
st,
|
|
8587
8804
|
ot,
|
|
8588
8805
|
Pe,
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
wa,
|
|
8806
|
+
ma,
|
|
8807
|
+
fa,
|
|
8808
|
+
ga,
|
|
8809
|
+
ka,
|
|
8810
|
+
_a,
|
|
8595
8811
|
Pa,
|
|
8596
|
-
re,
|
|
8597
|
-
tt,
|
|
8598
|
-
Sr,
|
|
8599
|
-
Kr,
|
|
8600
|
-
_r,
|
|
8601
8812
|
Ma,
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8813
|
+
ie,
|
|
8814
|
+
tt,
|
|
8815
|
+
Ei,
|
|
8816
|
+
$i,
|
|
8817
|
+
vi,
|
|
8605
8818
|
Ca,
|
|
8606
|
-
|
|
8607
|
-
|
|
8819
|
+
Ri,
|
|
8820
|
+
Oi,
|
|
8821
|
+
Y,
|
|
8822
|
+
La,
|
|
8823
|
+
Na,
|
|
8824
|
+
re = y(() => {
|
|
8608
8825
|
'use strict';
|
|
8609
8826
|
Kt();
|
|
8610
8827
|
Ae();
|
|
8611
8828
|
B();
|
|
8612
|
-
|
|
8613
|
-
|
|
8829
|
+
Ve();
|
|
8830
|
+
Ht();
|
|
8614
8831
|
Re();
|
|
8615
8832
|
Fe();
|
|
8616
|
-
zt();
|
|
8617
8833
|
Jt();
|
|
8618
8834
|
Xt();
|
|
8619
|
-
|
|
8835
|
+
Zt();
|
|
8836
|
+
ni();
|
|
8620
8837
|
ze();
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8838
|
+
ci();
|
|
8839
|
+
hi();
|
|
8840
|
+
bi();
|
|
8624
8841
|
Ye();
|
|
8625
8842
|
Xe();
|
|
8626
|
-
((
|
|
8843
|
+
((la = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
|
|
8627
8844
|
(at = {
|
|
8628
8845
|
video: 'generate_video',
|
|
8629
8846
|
image: 'generate_image',
|
|
8630
8847
|
audio: 'generate_audio',
|
|
8631
8848
|
llm: 'run_task',
|
|
8632
8849
|
}),
|
|
8633
|
-
(
|
|
8850
|
+
(pa = {
|
|
8634
8851
|
video: 'Text-to-Video',
|
|
8635
8852
|
image: 'Text-to-Image',
|
|
8636
8853
|
audio: 'Text-to-Audio',
|
|
8637
8854
|
llm: 'Reasoning (LLM)',
|
|
8638
8855
|
}));
|
|
8639
|
-
((
|
|
8856
|
+
((_i =
|
|
8640
8857
|
'A public http(s) URL or data URI. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.'),
|
|
8641
8858
|
(S = (e) => ({ name: 'prompt', type: 'string', required: !0, description: e })));
|
|
8642
8859
|
((nt = {
|
|
@@ -8646,13 +8863,13 @@ var na,
|
|
|
8646
8863
|
description:
|
|
8647
8864
|
'Runs the Creative mode checkpoint at its published price (+5%). The Acceptable Use Policy applies.',
|
|
8648
8865
|
}),
|
|
8649
|
-
(
|
|
8866
|
+
(ca = {
|
|
8650
8867
|
name: 'creative_mode',
|
|
8651
8868
|
type: 'boolean',
|
|
8652
8869
|
default: !1,
|
|
8653
8870
|
description: `Not available yet on this model: ${ke}.`,
|
|
8654
8871
|
}),
|
|
8655
|
-
(
|
|
8872
|
+
(Si = {
|
|
8656
8873
|
name: 'priority',
|
|
8657
8874
|
type: 'boolean',
|
|
8658
8875
|
default: !1,
|
|
@@ -8670,7 +8887,7 @@ var na,
|
|
|
8670
8887
|
'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.',
|
|
8671
8888
|
}),
|
|
8672
8889
|
(Pe = new Set(['full_access', 'is_uncensored', 'unfiltered', 'verificationSignature'])));
|
|
8673
|
-
((
|
|
8890
|
+
((ma = new Set([
|
|
8674
8891
|
'quality',
|
|
8675
8892
|
'bitrate_mode',
|
|
8676
8893
|
'draft',
|
|
@@ -8679,7 +8896,7 @@ var na,
|
|
|
8679
8896
|
'draft_generation_id',
|
|
8680
8897
|
'pass_faces',
|
|
8681
8898
|
])),
|
|
8682
|
-
(
|
|
8899
|
+
(fa = new Set([
|
|
8683
8900
|
'quality',
|
|
8684
8901
|
'bitrate_mode',
|
|
8685
8902
|
'draft',
|
|
@@ -8687,12 +8904,12 @@ var na,
|
|
|
8687
8904
|
'draft_task_id',
|
|
8688
8905
|
'draft_generation_id',
|
|
8689
8906
|
])),
|
|
8690
|
-
(
|
|
8907
|
+
(ga = {
|
|
8691
8908
|
images: 'up to 10',
|
|
8692
8909
|
videos: 'up to 5; combined duration < 30s',
|
|
8693
8910
|
audios: 'up to 5; combined duration < 30s',
|
|
8694
8911
|
}));
|
|
8695
|
-
((
|
|
8912
|
+
((ka = [
|
|
8696
8913
|
S('The user message or task.'),
|
|
8697
8914
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
8698
8915
|
{
|
|
@@ -8710,7 +8927,7 @@ var na,
|
|
|
8710
8927
|
{ name: 'temperature', type: 'slider', min: 0, max: 1, step: 0.1 },
|
|
8711
8928
|
{ name: 'top_p', type: 'slider', min: 0, max: 1, step: 0.05 },
|
|
8712
8929
|
]),
|
|
8713
|
-
(
|
|
8930
|
+
(_a = [
|
|
8714
8931
|
S('The user message or task.'),
|
|
8715
8932
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
8716
8933
|
{
|
|
@@ -8792,8 +9009,8 @@ var na,
|
|
|
8792
9009
|
description: 'Video frames read a second.',
|
|
8793
9010
|
},
|
|
8794
9011
|
]),
|
|
8795
|
-
(
|
|
8796
|
-
|
|
9012
|
+
(Pa = ['gemini-3.8-flash', 'gemini-3.7-flash']));
|
|
9013
|
+
Ma = Object.entries({
|
|
8797
9014
|
background: !1,
|
|
8798
9015
|
skin: !1,
|
|
8799
9016
|
nose: !1,
|
|
@@ -8819,7 +9036,7 @@ var na,
|
|
|
8819
9036
|
default: t,
|
|
8820
9037
|
description: 'Keep this part out of the fix. Standard only.',
|
|
8821
9038
|
}));
|
|
8822
|
-
((
|
|
9039
|
+
((ie = 'Left out: 480p, the same default as the API, the playground and workflow steps.'),
|
|
8823
9040
|
(tt = [
|
|
8824
9041
|
{
|
|
8825
9042
|
name: 'prompt',
|
|
@@ -8858,7 +9075,7 @@ var na,
|
|
|
8858
9075
|
type: 'select',
|
|
8859
9076
|
default: '480p',
|
|
8860
9077
|
options: ['480p', '720p', '1080p', '4k'],
|
|
8861
|
-
description: `Output resolution. 480p and 720p are 8-bit. 1080p and 4k are 10-bit H.265/HEVC. 4k is 3840x2160 at 16:9, works with Creative mode, and runs on one dedicated endpoint with no fallback, so it can be busy. ${
|
|
9078
|
+
description: `Output resolution. 480p and 720p are 8-bit. 1080p and 4k are 10-bit H.265/HEVC. 4k is 3840x2160 at 16:9, works with Creative mode, and runs on one dedicated endpoint with no fallback, so it can be busy. ${ie}`,
|
|
8862
9079
|
},
|
|
8863
9080
|
{
|
|
8864
9081
|
name: 'aspect_ratio',
|
|
@@ -8969,19 +9186,19 @@ var na,
|
|
|
8969
9186
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
8970
9187
|
},
|
|
8971
9188
|
]),
|
|
8972
|
-
(
|
|
9189
|
+
(Ei = {
|
|
8973
9190
|
name: 'images',
|
|
8974
9191
|
type: 'string[]',
|
|
8975
9192
|
description:
|
|
8976
9193
|
'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.',
|
|
8977
9194
|
}),
|
|
8978
|
-
(
|
|
9195
|
+
($i = {
|
|
8979
9196
|
name: 'audios',
|
|
8980
9197
|
type: 'string[]',
|
|
8981
9198
|
description:
|
|
8982
9199
|
'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.',
|
|
8983
9200
|
}),
|
|
8984
|
-
(
|
|
9201
|
+
(vi = [
|
|
8985
9202
|
{
|
|
8986
9203
|
name: 'prompt',
|
|
8987
9204
|
type: 'string',
|
|
@@ -9025,7 +9242,7 @@ var na,
|
|
|
9025
9242
|
type: 'select',
|
|
9026
9243
|
default: '480p',
|
|
9027
9244
|
options: ['480p', '720p', '1080p', '4k'],
|
|
9028
|
-
description: `Standard: 480p, 720p, 1080p (8-bit) and 4k (10-bit H.265). Fast and Mini: 480p and 720p only. ${
|
|
9245
|
+
description: `Standard: 480p, 720p, 1080p (8-bit) and 4k (10-bit H.265). Fast and Mini: 480p and 720p only. ${ie}`,
|
|
9029
9246
|
},
|
|
9030
9247
|
{
|
|
9031
9248
|
name: 'bitrate_mode',
|
|
@@ -9059,8 +9276,8 @@ var na,
|
|
|
9059
9276
|
description:
|
|
9060
9277
|
'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
|
|
9061
9278
|
},
|
|
9062
|
-
|
|
9063
|
-
|
|
9279
|
+
Ei,
|
|
9280
|
+
$i,
|
|
9064
9281
|
{
|
|
9065
9282
|
name: 'first_frame_image',
|
|
9066
9283
|
type: 'string',
|
|
@@ -9081,7 +9298,7 @@ var na,
|
|
|
9081
9298
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
9082
9299
|
},
|
|
9083
9300
|
]),
|
|
9084
|
-
(
|
|
9301
|
+
(Ca = [
|
|
9085
9302
|
{
|
|
9086
9303
|
name: 'prompt',
|
|
9087
9304
|
type: 'string',
|
|
@@ -9102,7 +9319,7 @@ var na,
|
|
|
9102
9319
|
type: 'select',
|
|
9103
9320
|
default: '480p',
|
|
9104
9321
|
options: ['480p', '720p'],
|
|
9105
|
-
description: `480p and 720p, both 8-bit. Mini does not serve 1080p or 4k. ${
|
|
9322
|
+
description: `480p and 720p, both 8-bit. Mini does not serve 1080p or 4k. ${ie}`,
|
|
9106
9323
|
},
|
|
9107
9324
|
{
|
|
9108
9325
|
name: 'bitrate_mode',
|
|
@@ -9136,8 +9353,8 @@ var na,
|
|
|
9136
9353
|
description:
|
|
9137
9354
|
'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
|
|
9138
9355
|
},
|
|
9139
|
-
|
|
9140
|
-
|
|
9356
|
+
Ei,
|
|
9357
|
+
$i,
|
|
9141
9358
|
{
|
|
9142
9359
|
name: 'first_frame_image',
|
|
9143
9360
|
type: 'string',
|
|
@@ -9152,7 +9369,7 @@ var na,
|
|
|
9152
9369
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
9153
9370
|
},
|
|
9154
9371
|
]));
|
|
9155
|
-
((
|
|
9372
|
+
((Ri = {
|
|
9156
9373
|
name: 'mode',
|
|
9157
9374
|
type: 'select',
|
|
9158
9375
|
default: 'full',
|
|
@@ -9160,27 +9377,27 @@ var na,
|
|
|
9160
9377
|
description:
|
|
9161
9378
|
'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).',
|
|
9162
9379
|
}),
|
|
9163
|
-
(
|
|
9380
|
+
(Oi = {
|
|
9164
9381
|
name: 'scale',
|
|
9165
9382
|
type: 'select',
|
|
9166
|
-
default: String(
|
|
9383
|
+
default: String(gi),
|
|
9167
9384
|
options: We.noSkin.map(String),
|
|
9168
9385
|
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.`,
|
|
9169
9386
|
}));
|
|
9170
|
-
Y =
|
|
9171
|
-
|
|
9387
|
+
Y = Oa();
|
|
9388
|
+
La = {
|
|
9172
9389
|
name: 'priority',
|
|
9173
9390
|
type: 'boolean',
|
|
9174
9391
|
default: !1,
|
|
9175
9392
|
description:
|
|
9176
9393
|
"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.",
|
|
9177
9394
|
};
|
|
9178
|
-
|
|
9395
|
+
Na = ['draft_task_id', 'draft_generation_id'];
|
|
9179
9396
|
});
|
|
9180
|
-
function
|
|
9397
|
+
function Ie(e) {
|
|
9181
9398
|
let t = '/v1/pricing/models',
|
|
9182
|
-
|
|
9183
|
-
return
|
|
9399
|
+
i = e?.trim();
|
|
9400
|
+
return i ? `${t}?model=${encodeURIComponent(i)}` : t;
|
|
9184
9401
|
}
|
|
9185
9402
|
var ct = y(() => {
|
|
9186
9403
|
'use strict';
|
|
@@ -9188,39 +9405,39 @@ var ct = y(() => {
|
|
|
9188
9405
|
function ht(e) {
|
|
9189
9406
|
return e.length <= 1 ? (e[0] ?? '') : `${e.slice(0, -1).join(', ')} and ${e[e.length - 1]}`;
|
|
9190
9407
|
}
|
|
9191
|
-
function
|
|
9408
|
+
function nr(e) {
|
|
9192
9409
|
let t = ge().filter((s) => s.kind === e && s.unfiltered != null),
|
|
9193
|
-
|
|
9194
|
-
|
|
9410
|
+
i = t.filter((s) => ee.includes(s.api.model)).map((s) => s.name),
|
|
9411
|
+
r = t.filter((s) => !ee.includes(s.api.model)).map((s) => s.name);
|
|
9195
9412
|
return [
|
|
9196
|
-
...(
|
|
9197
|
-
? [`${ht(
|
|
9413
|
+
...(i.length
|
|
9414
|
+
? [`${ht(i)}: runs the Creative mode checkpoint at its published price (+5%).`]
|
|
9198
9415
|
: []),
|
|
9199
|
-
...(
|
|
9416
|
+
...(r.length ? [`Not available yet on ${ht(r)}: ${ke}.`] : []),
|
|
9200
9417
|
'The Acceptable Use Policy applies.',
|
|
9201
9418
|
].join(' ');
|
|
9202
9419
|
}
|
|
9203
|
-
function
|
|
9204
|
-
if (
|
|
9420
|
+
function bn(e) {
|
|
9421
|
+
if (mn.has(e.name)) return e;
|
|
9205
9422
|
let t = e.inputSchema.properties;
|
|
9206
9423
|
return !t || t.callback_url
|
|
9207
9424
|
? e
|
|
9208
|
-
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url:
|
|
9425
|
+
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url: un } } };
|
|
9209
9426
|
}
|
|
9210
|
-
function
|
|
9427
|
+
function wn(e) {
|
|
9211
9428
|
let t = e.inputSchema.properties;
|
|
9212
9429
|
if (!t) return e;
|
|
9213
|
-
let
|
|
9214
|
-
|
|
9430
|
+
let i = !1,
|
|
9431
|
+
r = {};
|
|
9215
9432
|
for (let [n, s] of Object.entries(t))
|
|
9216
|
-
|
|
9217
|
-
? ((
|
|
9218
|
-
:
|
|
9219
|
-
? ((
|
|
9220
|
-
: (
|
|
9221
|
-
return
|
|
9222
|
-
}
|
|
9223
|
-
function
|
|
9433
|
+
sr.has(n) && s.type === 'string' && !s.format
|
|
9434
|
+
? ((r[n] = { ...s, format: 'uri' }), (i = !0))
|
|
9435
|
+
: sr.has(n) && s.type === 'array' && s.items?.type === 'string' && !s.items.format
|
|
9436
|
+
? ((r[n] = { ...s, items: { ...s.items, format: 'uri' } }), (i = !0))
|
|
9437
|
+
: (r[n] = s);
|
|
9438
|
+
return i ? { ...e, inputSchema: { ...e.inputSchema, properties: r } } : e;
|
|
9439
|
+
}
|
|
9440
|
+
function xn(e) {
|
|
9224
9441
|
switch (e.type) {
|
|
9225
9442
|
case 'string':
|
|
9226
9443
|
return {
|
|
@@ -9275,28 +9492,28 @@ function gn(e) {
|
|
|
9275
9492
|
return { type: 'string', description: e.description };
|
|
9276
9493
|
}
|
|
9277
9494
|
}
|
|
9278
|
-
function
|
|
9279
|
-
let
|
|
9280
|
-
|
|
9495
|
+
function kn(e, t) {
|
|
9496
|
+
let i = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
|
|
9497
|
+
r = {},
|
|
9281
9498
|
n = [];
|
|
9282
|
-
for (let o of e.parameters) ((
|
|
9499
|
+
for (let o of e.parameters) ((r[o.name] = xn(o)), o.required && n.push(o.name));
|
|
9283
9500
|
let s = {
|
|
9284
9501
|
type: 'object',
|
|
9285
|
-
properties:
|
|
9502
|
+
properties: r,
|
|
9286
9503
|
...(n.length > 0 ? { required: n } : {}),
|
|
9287
9504
|
additionalProperties: !0,
|
|
9288
9505
|
};
|
|
9289
9506
|
return {
|
|
9290
|
-
name:
|
|
9507
|
+
name: i,
|
|
9291
9508
|
description: `[Tein AI - ${e.name} (${e.category})] ${e.description} (Pricing: ${e.priceFormatted}${e.priceNotes?.length ? `. ${e.priceNotes.join(' ')}` : ''})`,
|
|
9292
9509
|
inputSchema: s,
|
|
9293
9510
|
};
|
|
9294
9511
|
}
|
|
9295
|
-
function
|
|
9296
|
-
let e = D().filter((u) => u.category === 'Image' && !
|
|
9512
|
+
function _n() {
|
|
9513
|
+
let e = D().filter((u) => u.category === 'Image' && !ve(u)),
|
|
9297
9514
|
t = D().filter((u) => u.category === 'Video'),
|
|
9298
|
-
|
|
9299
|
-
|
|
9515
|
+
i = D().filter((u) => u.category === 'Text'),
|
|
9516
|
+
r = D().filter((u) => u.category === 'Audio'),
|
|
9300
9517
|
n = {
|
|
9301
9518
|
name: 'generate_image',
|
|
9302
9519
|
description:
|
|
@@ -9383,12 +9600,12 @@ function yn() {
|
|
|
9383
9600
|
maximum: 2147483647,
|
|
9384
9601
|
description: 'Nano Banana 2 and Nano Banana Pro. Omit it for a new image each time.',
|
|
9385
9602
|
},
|
|
9386
|
-
creative_mode: { type: 'boolean', description:
|
|
9603
|
+
creative_mode: { type: 'boolean', description: nr('image') },
|
|
9387
9604
|
...(_e().length
|
|
9388
9605
|
? {
|
|
9389
9606
|
priority: {
|
|
9390
9607
|
type: 'boolean',
|
|
9391
|
-
description: `${ht(_e().map(
|
|
9608
|
+
description: `${ht(_e().map(ki))} 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.`,
|
|
9392
9609
|
},
|
|
9393
9610
|
}
|
|
9394
9611
|
: {}),
|
|
@@ -9428,7 +9645,7 @@ function yn() {
|
|
|
9428
9645
|
description:
|
|
9429
9646
|
"Video resolution, where the model takes it (see each model tool). Left out: the model's own default, which that model's tool shows.",
|
|
9430
9647
|
},
|
|
9431
|
-
creative_mode: { type: 'boolean', description:
|
|
9648
|
+
creative_mode: { type: 'boolean', description: nr('video') },
|
|
9432
9649
|
priority: {
|
|
9433
9650
|
type: 'boolean',
|
|
9434
9651
|
description:
|
|
@@ -9494,7 +9711,7 @@ function yn() {
|
|
|
9494
9711
|
prompt: { type: 'string', description: 'The reasoning task or query to execute.' },
|
|
9495
9712
|
model: {
|
|
9496
9713
|
type: 'string',
|
|
9497
|
-
enum:
|
|
9714
|
+
enum: i.map((u) => u.slug),
|
|
9498
9715
|
default: 'gpt-6-astra',
|
|
9499
9716
|
description: 'The reasoning model to use (default: gpt-6-astra).',
|
|
9500
9717
|
},
|
|
@@ -9564,10 +9781,10 @@ function yn() {
|
|
|
9564
9781
|
additionalProperties: !0,
|
|
9565
9782
|
},
|
|
9566
9783
|
},
|
|
9567
|
-
d =
|
|
9568
|
-
return [n, s, o, p, l, d, c,
|
|
9784
|
+
d = Pn();
|
|
9785
|
+
return [n, s, o, p, l, d, c, fn, ...or];
|
|
9569
9786
|
}
|
|
9570
|
-
function
|
|
9787
|
+
function Pn() {
|
|
9571
9788
|
return {
|
|
9572
9789
|
name: 'upload_asset',
|
|
9573
9790
|
description:
|
|
@@ -9615,31 +9832,31 @@ function bn() {
|
|
|
9615
9832
|
};
|
|
9616
9833
|
}
|
|
9617
9834
|
function yt() {
|
|
9618
|
-
let e =
|
|
9619
|
-
t = D().map((
|
|
9620
|
-
return [...e, ...t].map(
|
|
9621
|
-
}
|
|
9622
|
-
var
|
|
9623
|
-
|
|
9624
|
-
|
|
9625
|
-
|
|
9626
|
-
|
|
9627
|
-
|
|
9628
|
-
|
|
9629
|
-
|
|
9630
|
-
|
|
9631
|
-
|
|
9835
|
+
let e = _n(),
|
|
9836
|
+
t = D().map((i) => kn(i));
|
|
9837
|
+
return [...e, ...t].map(bn).map(wn);
|
|
9838
|
+
}
|
|
9839
|
+
var un,
|
|
9840
|
+
mn,
|
|
9841
|
+
fn,
|
|
9842
|
+
gn,
|
|
9843
|
+
hn,
|
|
9844
|
+
yn,
|
|
9845
|
+
or,
|
|
9846
|
+
Oo,
|
|
9847
|
+
sr,
|
|
9848
|
+
lr = y(() => {
|
|
9632
9849
|
'use strict';
|
|
9633
9850
|
B();
|
|
9634
9851
|
Xe();
|
|
9635
9852
|
Ye();
|
|
9636
|
-
|
|
9637
|
-
((
|
|
9853
|
+
re();
|
|
9854
|
+
((un = {
|
|
9638
9855
|
type: 'string',
|
|
9639
9856
|
description:
|
|
9640
9857
|
'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.',
|
|
9641
9858
|
}),
|
|
9642
|
-
(
|
|
9859
|
+
(mn = new Set([
|
|
9643
9860
|
'upload_asset',
|
|
9644
9861
|
'upload_media',
|
|
9645
9862
|
'upload_image',
|
|
@@ -9650,7 +9867,7 @@ var on,
|
|
|
9650
9867
|
'get_usage',
|
|
9651
9868
|
'get_balance_history',
|
|
9652
9869
|
])),
|
|
9653
|
-
(
|
|
9870
|
+
(fn = {
|
|
9654
9871
|
name: 'get_pricing',
|
|
9655
9872
|
description:
|
|
9656
9873
|
'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.',
|
|
@@ -9665,13 +9882,13 @@ var on,
|
|
|
9665
9882
|
additionalProperties: !1,
|
|
9666
9883
|
},
|
|
9667
9884
|
}),
|
|
9668
|
-
(
|
|
9885
|
+
(gn = {
|
|
9669
9886
|
name: 'get_balance',
|
|
9670
9887
|
description:
|
|
9671
9888
|
"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.",
|
|
9672
9889
|
inputSchema: { type: 'object', properties: {}, additionalProperties: !1 },
|
|
9673
9890
|
}),
|
|
9674
|
-
(
|
|
9891
|
+
(hn = {
|
|
9675
9892
|
name: 'get_usage',
|
|
9676
9893
|
description:
|
|
9677
9894
|
"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.",
|
|
@@ -9702,7 +9919,7 @@ var on,
|
|
|
9702
9919
|
additionalProperties: !1,
|
|
9703
9920
|
},
|
|
9704
9921
|
}),
|
|
9705
|
-
(
|
|
9922
|
+
(yn = {
|
|
9706
9923
|
name: 'get_balance_history',
|
|
9707
9924
|
description:
|
|
9708
9925
|
"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.",
|
|
@@ -9720,9 +9937,9 @@ var on,
|
|
|
9720
9937
|
additionalProperties: !1,
|
|
9721
9938
|
},
|
|
9722
9939
|
}),
|
|
9723
|
-
(
|
|
9724
|
-
(
|
|
9725
|
-
|
|
9940
|
+
(or = [gn, hn, yn]),
|
|
9941
|
+
(Oo = new Set(or.map((e) => e.name))));
|
|
9942
|
+
sr = new Set([
|
|
9726
9943
|
'image',
|
|
9727
9944
|
'images',
|
|
9728
9945
|
'image_url',
|
|
@@ -9739,30 +9956,30 @@ var on,
|
|
|
9739
9956
|
'lipsyncing_audio',
|
|
9740
9957
|
]);
|
|
9741
9958
|
});
|
|
9742
|
-
var
|
|
9743
|
-
|
|
9744
|
-
forgetToolSchemas: () =>
|
|
9745
|
-
jsonRpcAnswer: () =>
|
|
9746
|
-
preprocessLocalFiles: () =>
|
|
9747
|
-
startStdioServer: () =>
|
|
9959
|
+
var br = {};
|
|
9960
|
+
Tr(br, {
|
|
9961
|
+
forgetToolSchemas: () => Sn,
|
|
9962
|
+
jsonRpcAnswer: () => ur,
|
|
9963
|
+
preprocessLocalFiles: () => hr,
|
|
9964
|
+
startStdioServer: () => yr,
|
|
9748
9965
|
});
|
|
9749
|
-
function
|
|
9750
|
-
let t = (
|
|
9751
|
-
!!
|
|
9966
|
+
function vn(e) {
|
|
9967
|
+
let t = (i) =>
|
|
9968
|
+
!!i && typeof i == 'object' && i.jsonrpc === '2.0' && ('result' in i || 'error' in i);
|
|
9752
9969
|
return Array.isArray(e) ? e.length > 0 && e.every(t) : t(e);
|
|
9753
9970
|
}
|
|
9754
|
-
function
|
|
9755
|
-
let
|
|
9756
|
-
n =
|
|
9971
|
+
function ur(e, t, i) {
|
|
9972
|
+
let r = e?.id,
|
|
9973
|
+
n = r == null,
|
|
9757
9974
|
s = null;
|
|
9758
9975
|
try {
|
|
9759
|
-
s =
|
|
9976
|
+
s = i ? JSON.parse(i) : null;
|
|
9760
9977
|
} catch {
|
|
9761
9978
|
s = null;
|
|
9762
9979
|
}
|
|
9763
|
-
if (s !== null &&
|
|
9980
|
+
if (s !== null && vn(s)) return n ? null : s;
|
|
9764
9981
|
if (n) return null;
|
|
9765
|
-
if (!
|
|
9982
|
+
if (!i && t >= 200 && t < 300) return;
|
|
9766
9983
|
let o = s?.error,
|
|
9767
9984
|
p =
|
|
9768
9985
|
typeof o == 'string'
|
|
@@ -9773,7 +9990,7 @@ function di(e, t, r) {
|
|
|
9773
9990
|
l = o && typeof o == 'object' && typeof o.code == 'string' ? o.code : null;
|
|
9774
9991
|
return {
|
|
9775
9992
|
jsonrpc: '2.0',
|
|
9776
|
-
id:
|
|
9993
|
+
id: r,
|
|
9777
9994
|
error: {
|
|
9778
9995
|
code: t === 401 ? -32001 : -32603,
|
|
9779
9996
|
message: p,
|
|
@@ -9781,19 +9998,19 @@ function di(e, t, r) {
|
|
|
9781
9998
|
},
|
|
9782
9999
|
};
|
|
9783
10000
|
}
|
|
9784
|
-
function
|
|
10001
|
+
function In() {
|
|
9785
10002
|
let e = process.argv.slice(2),
|
|
9786
10003
|
t = e.indexOf('--api-key');
|
|
9787
10004
|
return _(t >= 0 ? e[t + 1] : void 0);
|
|
9788
10005
|
}
|
|
9789
|
-
async function
|
|
9790
|
-
let
|
|
9791
|
-
if (!N.default.existsSync(
|
|
10006
|
+
async function mr(e, t, i) {
|
|
10007
|
+
let r = Q.default.resolve(e);
|
|
10008
|
+
if (!N.default.existsSync(r) || !N.default.statSync(r).isFile())
|
|
9792
10009
|
throw new Error(`File not found: ${e}`);
|
|
9793
|
-
let n = N.default.readFileSync(
|
|
10010
|
+
let n = N.default.readFileSync(r),
|
|
9794
10011
|
s = n.toString('base64'),
|
|
9795
10012
|
o = n.length,
|
|
9796
|
-
p = `${
|
|
10013
|
+
p = `${i.replace(/\/$/, '')}/v1/upload`,
|
|
9797
10014
|
l = await fetch(p, {
|
|
9798
10015
|
method: 'POST',
|
|
9799
10016
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${t}` },
|
|
@@ -9815,15 +10032,15 @@ async function ci(e, t, r) {
|
|
|
9815
10032
|
mimeType: c.mime_type || c.mimeType || 'image/png',
|
|
9816
10033
|
};
|
|
9817
10034
|
}
|
|
9818
|
-
function
|
|
9819
|
-
return
|
|
10035
|
+
function fr(e) {
|
|
10036
|
+
return Tn.has(Q.default.extname(e).toLowerCase());
|
|
9820
10037
|
}
|
|
9821
|
-
function
|
|
10038
|
+
function gr(e) {
|
|
9822
10039
|
return new Error(
|
|
9823
10040
|
`Tein uploads image, video and audio files only, and ${Q.default.basename(e)} is not one.`,
|
|
9824
10041
|
);
|
|
9825
10042
|
}
|
|
9826
|
-
function
|
|
10043
|
+
function Mn(e) {
|
|
9827
10044
|
let t = e.trim();
|
|
9828
10045
|
if (
|
|
9829
10046
|
!t ||
|
|
@@ -9833,27 +10050,27 @@ function _n(e) {
|
|
|
9833
10050
|
`)
|
|
9834
10051
|
)
|
|
9835
10052
|
return null;
|
|
9836
|
-
let
|
|
9837
|
-
return N.default.existsSync(
|
|
10053
|
+
let i = Q.default.resolve(t);
|
|
10054
|
+
return N.default.existsSync(i) && N.default.statSync(i).isFile() ? i : null;
|
|
9838
10055
|
}
|
|
9839
10056
|
function wt(e) {
|
|
9840
10057
|
if (Array.isArray(e))
|
|
9841
10058
|
for (let t of e) {
|
|
9842
|
-
let
|
|
9843
|
-
typeof
|
|
9844
|
-
|
|
9845
|
-
typeof
|
|
9846
|
-
se.set(
|
|
10059
|
+
let i = t;
|
|
10060
|
+
typeof i.name == 'string' &&
|
|
10061
|
+
i.inputSchema &&
|
|
10062
|
+
typeof i.inputSchema == 'object' &&
|
|
10063
|
+
se.set(i.name, i.inputSchema);
|
|
9847
10064
|
}
|
|
9848
10065
|
}
|
|
9849
|
-
function
|
|
10066
|
+
function Sn() {
|
|
9850
10067
|
(se.clear(), (bt = 0));
|
|
9851
10068
|
}
|
|
9852
|
-
async function
|
|
10069
|
+
async function Kn(e, t) {
|
|
9853
10070
|
if (!(Date.now() - bt < 6e4)) {
|
|
9854
10071
|
bt = Date.now();
|
|
9855
10072
|
try {
|
|
9856
|
-
let
|
|
10073
|
+
let r = await (
|
|
9857
10074
|
await fetch(e, {
|
|
9858
10075
|
method: 'POST',
|
|
9859
10076
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${t}` },
|
|
@@ -9861,39 +10078,39 @@ async function In(e, t) {
|
|
|
9861
10078
|
signal: AbortSignal.timeout(1e4),
|
|
9862
10079
|
})
|
|
9863
10080
|
).json();
|
|
9864
|
-
wt(
|
|
10081
|
+
wt(r.result?.tools);
|
|
9865
10082
|
} catch {}
|
|
9866
10083
|
}
|
|
9867
10084
|
}
|
|
9868
|
-
function
|
|
10085
|
+
function En(e) {
|
|
9869
10086
|
return e
|
|
9870
10087
|
? e.type === 'string'
|
|
9871
10088
|
? e.format === 'uri'
|
|
9872
10089
|
: e.type === 'array' && e.items?.format === 'uri'
|
|
9873
10090
|
: !1;
|
|
9874
10091
|
}
|
|
9875
|
-
async function
|
|
10092
|
+
async function pr(e, t, i) {
|
|
9876
10093
|
if (typeof e != 'string') return e;
|
|
9877
|
-
let
|
|
9878
|
-
if (!
|
|
9879
|
-
if (!
|
|
9880
|
-
return (await
|
|
10094
|
+
let r = Mn(e);
|
|
10095
|
+
if (!r) return e;
|
|
10096
|
+
if (!fr(r)) throw gr(r);
|
|
10097
|
+
return (await mr(r, t, i)).url;
|
|
9881
10098
|
}
|
|
9882
|
-
async function
|
|
9883
|
-
(se.size === 0 && wt(yt()), se.has(e) || (await
|
|
10099
|
+
async function hr(e, t, i, r, n) {
|
|
10100
|
+
(se.size === 0 && wt(yt()), se.has(e) || (await Kn(n, i)));
|
|
9884
10101
|
let s = se.get(e)?.properties;
|
|
9885
10102
|
if (!s) return t;
|
|
9886
10103
|
let o = { ...t };
|
|
9887
10104
|
for (let [p, l] of Object.entries(t))
|
|
9888
|
-
if (
|
|
10105
|
+
if (En(s[p]))
|
|
9889
10106
|
if (Array.isArray(l)) {
|
|
9890
10107
|
let c = [];
|
|
9891
|
-
for (let d of l) c.push(await
|
|
10108
|
+
for (let d of l) c.push(await pr(d, i, r));
|
|
9892
10109
|
o[p] = c;
|
|
9893
|
-
} else o[p] = await
|
|
10110
|
+
} else o[p] = await pr(l, i, r);
|
|
9894
10111
|
return o;
|
|
9895
10112
|
}
|
|
9896
|
-
function
|
|
10113
|
+
function $n(e) {
|
|
9897
10114
|
let t = e.id ?? null;
|
|
9898
10115
|
switch (e.method) {
|
|
9899
10116
|
case 'initialize':
|
|
@@ -9934,13 +10151,13 @@ function Tn(e) {
|
|
|
9934
10151
|
};
|
|
9935
10152
|
}
|
|
9936
10153
|
}
|
|
9937
|
-
async function
|
|
9938
|
-
if (
|
|
9939
|
-
|
|
9940
|
-
let e =
|
|
10154
|
+
async function yr() {
|
|
10155
|
+
if (dr) return;
|
|
10156
|
+
dr = !0;
|
|
10157
|
+
let e = In(),
|
|
9941
10158
|
t = x(),
|
|
9942
|
-
|
|
9943
|
-
(
|
|
10159
|
+
i = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
|
|
10160
|
+
(cr.default
|
|
9944
10161
|
.createInterface({ input: process.stdin, output: process.stdout, terminal: !1 })
|
|
9945
10162
|
.on('line', async (n) => {
|
|
9946
10163
|
let s = n.trim();
|
|
@@ -9952,7 +10169,7 @@ async function gi() {
|
|
|
9952
10169
|
c = o.params.arguments || {};
|
|
9953
10170
|
if (l === 'get_pricing') {
|
|
9954
10171
|
let d = typeof c.model == 'string' ? c.model.trim() : '',
|
|
9955
|
-
u = `${t.replace(/\/+$/, '')}${
|
|
10172
|
+
u = `${t.replace(/\/+$/, '')}${Ie(d)}`;
|
|
9956
10173
|
try {
|
|
9957
10174
|
let m = await fetch(u, {
|
|
9958
10175
|
signal: AbortSignal.timeout(1e4),
|
|
@@ -10004,8 +10221,8 @@ async function gi() {
|
|
|
10004
10221
|
try {
|
|
10005
10222
|
let u = Q.default.resolve(d.trim());
|
|
10006
10223
|
if (N.default.existsSync(u) && N.default.statSync(u).isFile() && e) {
|
|
10007
|
-
if (!
|
|
10008
|
-
let m = await
|
|
10224
|
+
if (!fr(u)) throw gr(u);
|
|
10225
|
+
let m = await mr(u, e, t),
|
|
10009
10226
|
g = (m.sizeBytes / 1024).toFixed(1),
|
|
10010
10227
|
A =
|
|
10011
10228
|
m.mimeType.startsWith('image/') ||
|
|
@@ -10014,7 +10231,7 @@ async function gi() {
|
|
|
10014
10231
|
|
|
10015
10232
|
`
|
|
10016
10233
|
: '',
|
|
10017
|
-
|
|
10234
|
+
V = {
|
|
10018
10235
|
jsonrpc: '2.0',
|
|
10019
10236
|
id: o.id,
|
|
10020
10237
|
result: {
|
|
@@ -10034,7 +10251,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
10034
10251
|
},
|
|
10035
10252
|
};
|
|
10036
10253
|
process.stdout.write(
|
|
10037
|
-
JSON.stringify(
|
|
10254
|
+
JSON.stringify(V) +
|
|
10038
10255
|
`
|
|
10039
10256
|
`,
|
|
10040
10257
|
);
|
|
@@ -10061,7 +10278,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
10061
10278
|
}
|
|
10062
10279
|
if (e)
|
|
10063
10280
|
try {
|
|
10064
|
-
o.params.arguments = await
|
|
10281
|
+
o.params.arguments = await hr(String(l), c, e, t, i);
|
|
10065
10282
|
} catch (d) {
|
|
10066
10283
|
let u = d instanceof Error ? d.message : String(d);
|
|
10067
10284
|
process.stdout.write(
|
|
@@ -10086,13 +10303,13 @@ Pass this URL to any Tein generation tool.`,
|
|
|
10086
10303
|
}
|
|
10087
10304
|
if (e)
|
|
10088
10305
|
try {
|
|
10089
|
-
let l = await fetch(
|
|
10306
|
+
let l = await fetch(i, {
|
|
10090
10307
|
method: 'POST',
|
|
10091
10308
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${e}` },
|
|
10092
10309
|
body: JSON.stringify(o),
|
|
10093
10310
|
}),
|
|
10094
10311
|
c = await l.text(),
|
|
10095
|
-
d =
|
|
10312
|
+
d = ur(o, l.status, c);
|
|
10096
10313
|
if (d === null) return;
|
|
10097
10314
|
if (d) {
|
|
10098
10315
|
(o?.method === 'tools/list' && wt(d.result?.tools),
|
|
@@ -10104,7 +10321,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
10104
10321
|
return;
|
|
10105
10322
|
}
|
|
10106
10323
|
} catch {}
|
|
10107
|
-
let p =
|
|
10324
|
+
let p = $n(o);
|
|
10108
10325
|
p !== null &&
|
|
10109
10326
|
process.stdout.write(
|
|
10110
10327
|
JSON.stringify(p) +
|
|
@@ -10129,21 +10346,21 @@ Pass this URL to any Tein generation tool.`,
|
|
|
10129
10346
|
}
|
|
10130
10347
|
var N,
|
|
10131
10348
|
Q,
|
|
10132
|
-
|
|
10133
|
-
|
|
10349
|
+
cr,
|
|
10350
|
+
Tn,
|
|
10134
10351
|
se,
|
|
10135
10352
|
bt,
|
|
10136
|
-
|
|
10137
|
-
|
|
10353
|
+
dr,
|
|
10354
|
+
wr = y(() => {
|
|
10138
10355
|
'use strict';
|
|
10139
10356
|
((N = M(require('node:fs'))),
|
|
10140
10357
|
(Q = M(require('node:path'))),
|
|
10141
|
-
(
|
|
10358
|
+
(cr = M(require('node:readline'))));
|
|
10142
10359
|
ct();
|
|
10143
|
-
|
|
10360
|
+
lr();
|
|
10144
10361
|
R();
|
|
10145
10362
|
oe();
|
|
10146
|
-
|
|
10363
|
+
Tn = new Set([
|
|
10147
10364
|
'.png',
|
|
10148
10365
|
'.jpg',
|
|
10149
10366
|
'.jpeg',
|
|
@@ -10170,19 +10387,19 @@ var N,
|
|
|
10170
10387
|
'.opus',
|
|
10171
10388
|
]);
|
|
10172
10389
|
((se = new Map()), (bt = 0));
|
|
10173
|
-
|
|
10390
|
+
dr = !1;
|
|
10174
10391
|
require.main === module &&
|
|
10175
|
-
|
|
10392
|
+
yr().catch((e) => {
|
|
10176
10393
|
(process.stderr.write(`Fatal error in Tein MCP CLI: ${e}
|
|
10177
10394
|
`),
|
|
10178
10395
|
process.exit(1));
|
|
10179
10396
|
});
|
|
10180
10397
|
});
|
|
10181
|
-
var
|
|
10398
|
+
var Sr =
|
|
10182
10399
|
!process.env.NO_COLOR &&
|
|
10183
10400
|
(process.stdout.isTTY || process.env.FORCE_COLOR === '1' || process.env.TERM !== 'dumb');
|
|
10184
10401
|
function k(e, t) {
|
|
10185
|
-
return (
|
|
10402
|
+
return (i) => (Sr ? `\x1B[${e}m${i}\x1B[${t}m` : String(i));
|
|
10186
10403
|
}
|
|
10187
10404
|
var a = {
|
|
10188
10405
|
bold: k(1, 22),
|
|
@@ -10204,7 +10421,7 @@ var a = {
|
|
|
10204
10421
|
bgCyan: k(46, 49),
|
|
10205
10422
|
bgGreen: k(42, 49),
|
|
10206
10423
|
},
|
|
10207
|
-
|
|
10424
|
+
C = class {
|
|
10208
10425
|
constructor(t = '') {
|
|
10209
10426
|
this.frames = [
|
|
10210
10427
|
'\u280B',
|
|
@@ -10228,8 +10445,8 @@ var a = {
|
|
|
10228
10445
|
process.stdout.isTTY
|
|
10229
10446
|
? (this.stop(),
|
|
10230
10447
|
(this.timer = setInterval(() => {
|
|
10231
|
-
let
|
|
10232
|
-
(process.stdout.write(`\r${
|
|
10448
|
+
let i = a.cyan(this.frames[this.current]);
|
|
10449
|
+
(process.stdout.write(`\r${i} ${this.text} `),
|
|
10233
10450
|
(this.current = (this.current + 1) % this.frames.length));
|
|
10234
10451
|
}, 80)),
|
|
10235
10452
|
this)
|
|
@@ -10243,20 +10460,20 @@ var a = {
|
|
|
10243
10460
|
}
|
|
10244
10461
|
succeed(t) {
|
|
10245
10462
|
this.stop();
|
|
10246
|
-
let
|
|
10463
|
+
let i = t || this.text;
|
|
10247
10464
|
process.stdout.isTTY
|
|
10248
|
-
? process.stdout.write(`\r${a.green('\u2713')} ${
|
|
10465
|
+
? process.stdout.write(`\r${a.green('\u2713')} ${i}
|
|
10249
10466
|
`)
|
|
10250
|
-
: process.stdout.write(`[\u2713] ${
|
|
10467
|
+
: process.stdout.write(`[\u2713] ${i}
|
|
10251
10468
|
`);
|
|
10252
10469
|
}
|
|
10253
10470
|
fail(t) {
|
|
10254
10471
|
this.stop();
|
|
10255
|
-
let
|
|
10472
|
+
let i = t || this.text;
|
|
10256
10473
|
process.stdout.isTTY
|
|
10257
|
-
? process.stdout.write(`\r${a.red('\u2717')} ${
|
|
10474
|
+
? process.stdout.write(`\r${a.red('\u2717')} ${i}
|
|
10258
10475
|
`)
|
|
10259
|
-
: process.stdout.write(`[\u2717] ${
|
|
10476
|
+
: process.stdout.write(`[\u2717] ${i}
|
|
10260
10477
|
`);
|
|
10261
10478
|
}
|
|
10262
10479
|
stop() {
|
|
@@ -10269,10 +10486,10 @@ var a = {
|
|
|
10269
10486
|
var G = M(require('node:fs')),
|
|
10270
10487
|
O = M(require('node:path'));
|
|
10271
10488
|
var le = M(require('node:fs')),
|
|
10272
|
-
|
|
10273
|
-
|
|
10489
|
+
vt = M(require('node:path')),
|
|
10490
|
+
It = require('node:stream/promises');
|
|
10274
10491
|
oe();
|
|
10275
|
-
var
|
|
10492
|
+
var Cr = new Set([
|
|
10276
10493
|
'account_suspended',
|
|
10277
10494
|
'account_terminated',
|
|
10278
10495
|
'creative_mode_restricted',
|
|
@@ -10280,30 +10497,30 @@ var Ei = new Set([
|
|
|
10280
10497
|
'workspace_paused',
|
|
10281
10498
|
]),
|
|
10282
10499
|
T = 1,
|
|
10283
|
-
|
|
10500
|
+
Ar = 3,
|
|
10284
10501
|
b = class extends Error {
|
|
10285
|
-
constructor(t,
|
|
10286
|
-
(super(
|
|
10502
|
+
constructor(t, i, r, n = {}) {
|
|
10503
|
+
(super(i),
|
|
10287
10504
|
(this.name = 'TeinApiError'),
|
|
10288
10505
|
(this.status = t),
|
|
10289
|
-
|
|
10506
|
+
r && (this.code = r),
|
|
10290
10507
|
(this.fields = n));
|
|
10291
10508
|
}
|
|
10292
10509
|
get exitCode() {
|
|
10293
|
-
return this.code &&
|
|
10510
|
+
return this.code && Cr.has(this.code) ? Ar : T;
|
|
10294
10511
|
}
|
|
10295
10512
|
};
|
|
10296
|
-
function
|
|
10297
|
-
let
|
|
10298
|
-
if (!
|
|
10299
|
-
let n =
|
|
10513
|
+
function Rr(e, t, i) {
|
|
10514
|
+
let r = `HTTP ${e}${t ? ` ${t}` : ''}`;
|
|
10515
|
+
if (!i || typeof i != 'object') return new b(e, r);
|
|
10516
|
+
let n = i;
|
|
10300
10517
|
if (n.error && typeof n.error == 'object' && !Array.isArray(n.error)) {
|
|
10301
10518
|
let d = n.error,
|
|
10302
10519
|
{ code: u, message: m, ...g } = d;
|
|
10303
|
-
return new b(e, typeof m == 'string' && m ? m :
|
|
10520
|
+
return new b(e, typeof m == 'string' && m ? m : r, typeof u == 'string' ? u : void 0, g);
|
|
10304
10521
|
}
|
|
10305
10522
|
let { error: s, code: o, message: p, ...l } = n,
|
|
10306
|
-
c = (typeof s == 'string' && s) || (typeof p == 'string' && p) ||
|
|
10523
|
+
c = (typeof s == 'string' && s) || (typeof p == 'string' && p) || r;
|
|
10307
10524
|
return new b(e, c, typeof o == 'string' ? o : void 0, l);
|
|
10308
10525
|
}
|
|
10309
10526
|
function _t(e) {
|
|
@@ -10311,16 +10528,16 @@ function _t(e) {
|
|
|
10311
10528
|
}
|
|
10312
10529
|
function E(e) {
|
|
10313
10530
|
let t = [e.message],
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
(
|
|
10317
|
-
t.push([
|
|
10531
|
+
i = _t(e.fields.required),
|
|
10532
|
+
r = _t(e.fields.balance);
|
|
10533
|
+
(i || r) &&
|
|
10534
|
+
t.push([i ? `Required: ${i}` : '', r ? `Balance: ${r}` : ''].filter(Boolean).join(' '));
|
|
10318
10535
|
let n = e.fields.org_name ?? e.fields.orgName;
|
|
10319
10536
|
typeof n == 'string' && n && t.push(`Workspace: ${n}`);
|
|
10320
10537
|
let s = e.fields.url ?? e.fields.appeal_url ?? e.fields.top_up_url;
|
|
10321
10538
|
return (typeof s == 'string' && s && t.push(s), e.code && t.push(`(${e.code})`), t);
|
|
10322
10539
|
}
|
|
10323
|
-
function
|
|
10540
|
+
function Or(e) {
|
|
10324
10541
|
return /\.(mp4|webm|mov)(\?|$)/i.test(e)
|
|
10325
10542
|
? 'video'
|
|
10326
10543
|
: /\.(mp3|wav|ogg|flac)(\?|$)/i.test(e)
|
|
@@ -10329,15 +10546,15 @@ function Ai(e) {
|
|
|
10329
10546
|
}
|
|
10330
10547
|
function Pt(e) {
|
|
10331
10548
|
let t = [];
|
|
10332
|
-
for (let
|
|
10333
|
-
typeof
|
|
10334
|
-
? t.push({ type: 'text', text:
|
|
10335
|
-
:
|
|
10549
|
+
for (let i of e.data ?? [])
|
|
10550
|
+
typeof i.message?.content == 'string'
|
|
10551
|
+
? t.push({ type: 'text', text: i.message.content })
|
|
10552
|
+
: i.url && t.push({ type: Or(i.url), url: i.url, ...(i.layer ? { layer: i.layer } : {}) });
|
|
10336
10553
|
return t;
|
|
10337
10554
|
}
|
|
10338
10555
|
var K = class {
|
|
10339
|
-
constructor(t,
|
|
10340
|
-
((this.apiKey = t), (this.baseUrl =
|
|
10556
|
+
constructor(t, i) {
|
|
10557
|
+
((this.apiKey = t), (this.baseUrl = i.replace(/\/+$/, '')));
|
|
10341
10558
|
}
|
|
10342
10559
|
getHeaders() {
|
|
10343
10560
|
return {
|
|
@@ -10347,58 +10564,58 @@ var K = class {
|
|
|
10347
10564
|
'X-Tein-Client': 'cli',
|
|
10348
10565
|
};
|
|
10349
10566
|
}
|
|
10350
|
-
async send(t,
|
|
10351
|
-
let n = await fetch(`${this.baseUrl}${
|
|
10567
|
+
async send(t, i, r) {
|
|
10568
|
+
let n = await fetch(`${this.baseUrl}${i}`, {
|
|
10352
10569
|
method: t,
|
|
10353
10570
|
headers: this.getHeaders(),
|
|
10354
|
-
...(
|
|
10571
|
+
...(r === void 0 ? {} : { body: JSON.stringify(r) }),
|
|
10355
10572
|
});
|
|
10356
10573
|
if (!n.ok) {
|
|
10357
10574
|
let s = null;
|
|
10358
10575
|
try {
|
|
10359
10576
|
s = await n.json();
|
|
10360
10577
|
} catch {}
|
|
10361
|
-
throw
|
|
10578
|
+
throw Rr(n.status, n.statusText, s);
|
|
10362
10579
|
}
|
|
10363
10580
|
return await n.json();
|
|
10364
10581
|
}
|
|
10365
10582
|
async checkKey() {
|
|
10366
10583
|
await this.send('GET', '/v1/jobs?limit=1');
|
|
10367
10584
|
}
|
|
10368
|
-
queueJob(t,
|
|
10369
|
-
return this.send('POST', '/v1/generate', { model: t, ...
|
|
10370
|
-
let n =
|
|
10585
|
+
queueJob(t, i) {
|
|
10586
|
+
return this.send('POST', '/v1/generate', { model: t, ...i }).then((r) => {
|
|
10587
|
+
let n = r.status,
|
|
10371
10588
|
s =
|
|
10372
10589
|
n === 'succeeded' || n === 'failed' || n === 'expired' || n === 'cancelled'
|
|
10373
10590
|
? n
|
|
10374
10591
|
: 'processing',
|
|
10375
|
-
o = Pt(
|
|
10592
|
+
o = Pt(r);
|
|
10376
10593
|
return {
|
|
10377
|
-
request_id:
|
|
10378
|
-
model:
|
|
10594
|
+
request_id: r.request_id || r.id || '',
|
|
10595
|
+
model: r.model,
|
|
10379
10596
|
status: s,
|
|
10380
10597
|
...(o.length ? { output: o } : {}),
|
|
10381
|
-
error:
|
|
10382
|
-
...(
|
|
10598
|
+
error: r.error && typeof r.error.message == 'string' ? r.error.message : null,
|
|
10599
|
+
...(r.usage ? { usage: r.usage } : {}),
|
|
10383
10600
|
};
|
|
10384
10601
|
});
|
|
10385
10602
|
}
|
|
10386
10603
|
getStatus(t) {
|
|
10387
|
-
return this.send('GET', `/v1/jobs/${encodeURIComponent(t)}`).then((
|
|
10388
|
-
let
|
|
10604
|
+
return this.send('GET', `/v1/jobs/${encodeURIComponent(t)}`).then((i) => {
|
|
10605
|
+
let r = i.status,
|
|
10389
10606
|
n =
|
|
10390
|
-
|
|
10391
|
-
?
|
|
10607
|
+
r === 'succeeded' || r === 'failed' || r === 'expired' || r === 'cancelled'
|
|
10608
|
+
? r
|
|
10392
10609
|
: 'processing',
|
|
10393
|
-
s = Pt(
|
|
10394
|
-
o =
|
|
10610
|
+
s = Pt(i),
|
|
10611
|
+
o = i.error && typeof i.error.message == 'string' ? i.error.message : null;
|
|
10395
10612
|
return {
|
|
10396
|
-
request_id:
|
|
10397
|
-
model:
|
|
10613
|
+
request_id: i.id || t,
|
|
10614
|
+
model: i.model,
|
|
10398
10615
|
status: n,
|
|
10399
10616
|
...(s.length ? { output: s } : {}),
|
|
10400
10617
|
error: o,
|
|
10401
|
-
...(
|
|
10618
|
+
...(i.usage ? { usage: i.usage } : {}),
|
|
10402
10619
|
};
|
|
10403
10620
|
});
|
|
10404
10621
|
}
|
|
@@ -10406,23 +10623,23 @@ var K = class {
|
|
|
10406
10623
|
return this.send('GET', '/v1/balance');
|
|
10407
10624
|
}
|
|
10408
10625
|
getUsage(t) {
|
|
10409
|
-
let
|
|
10410
|
-
return this.send('GET', `/v1/usage${
|
|
10626
|
+
let i = new URLSearchParams(t).toString();
|
|
10627
|
+
return this.send('GET', `/v1/usage${i ? `?${i}` : ''}`);
|
|
10411
10628
|
}
|
|
10412
10629
|
getTransactions(t) {
|
|
10413
|
-
let
|
|
10414
|
-
return this.send('GET', `/v1/balance/transactions${
|
|
10630
|
+
let i = new URLSearchParams(t).toString();
|
|
10631
|
+
return this.send('GET', `/v1/balance/transactions${i ? `?${i}` : ''}`);
|
|
10415
10632
|
}
|
|
10416
10633
|
uploadAsset(t) {
|
|
10417
10634
|
return this.send('POST', '/v1/upload', { data: t });
|
|
10418
10635
|
}
|
|
10419
|
-
async downloadOutput(t,
|
|
10420
|
-
let
|
|
10421
|
-
if (!
|
|
10422
|
-
let n =
|
|
10636
|
+
async downloadOutput(t, i) {
|
|
10637
|
+
let r = await fetch(t);
|
|
10638
|
+
if (!r.ok) throw new Error(`The file could not be downloaded (HTTP ${r.status})`);
|
|
10639
|
+
let n = vt.default.dirname(i);
|
|
10423
10640
|
le.default.existsSync(n) || le.default.mkdirSync(n, { recursive: !0 });
|
|
10424
|
-
let s = le.default.createWriteStream(
|
|
10425
|
-
return (await (0,
|
|
10641
|
+
let s = le.default.createWriteStream(i);
|
|
10642
|
+
return (await (0, It.pipeline)(r.body, s), i);
|
|
10426
10643
|
}
|
|
10427
10644
|
};
|
|
10428
10645
|
R();
|
|
@@ -10430,54 +10647,54 @@ function Ce(e) {
|
|
|
10430
10647
|
if (typeof e != 'number' || !Number.isFinite(e)) return '';
|
|
10431
10648
|
if (Math.abs(e) >= 1 || Math.abs(Number(e.toFixed(4)) - e) < 1e-12) return `$${e.toFixed(4)}`;
|
|
10432
10649
|
let t = Math.max(0, 3 - Number(e.toExponential(3).split('e')[1])),
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
return
|
|
10650
|
+
i = 10 ** t,
|
|
10651
|
+
r = Math.round(Number((e * i).toFixed(6))) / i;
|
|
10652
|
+
return r >= 1 ? `$${r.toFixed(4)}` : `$${r.toFixed(t).replace(/0+$/, '')}`;
|
|
10436
10653
|
}
|
|
10437
|
-
|
|
10438
|
-
var
|
|
10439
|
-
function
|
|
10440
|
-
for (let t of
|
|
10654
|
+
re();
|
|
10655
|
+
var Ni = ['images', 'input_images', 'videos', 'audios'];
|
|
10656
|
+
function Va(e) {
|
|
10657
|
+
for (let t of Ni) typeof e[t] == 'string' && (e[t] = [e[t]]);
|
|
10441
10658
|
}
|
|
10442
|
-
function
|
|
10659
|
+
function Ua(e) {
|
|
10443
10660
|
if (e.startsWith('http://') || e.startsWith('https://')) return null;
|
|
10444
10661
|
let t = O.default.resolve(e);
|
|
10445
10662
|
return G.default.existsSync(t) && G.default.statSync(t).isFile() ? t : null;
|
|
10446
10663
|
}
|
|
10447
|
-
async function
|
|
10448
|
-
for (let
|
|
10449
|
-
if (!Array.isArray(e[
|
|
10450
|
-
let
|
|
10451
|
-
for (let n of e[
|
|
10664
|
+
async function Fa(e, t) {
|
|
10665
|
+
for (let i of Ni) {
|
|
10666
|
+
if (!Array.isArray(e[i])) continue;
|
|
10667
|
+
let r = [];
|
|
10668
|
+
for (let n of e[i]) {
|
|
10452
10669
|
if (typeof n != 'string') continue;
|
|
10453
|
-
let s =
|
|
10454
|
-
|
|
10670
|
+
let s = Ua(n);
|
|
10671
|
+
r.push(s ? await t(s) : n);
|
|
10455
10672
|
}
|
|
10456
|
-
e[
|
|
10673
|
+
e[i] = r;
|
|
10457
10674
|
}
|
|
10458
10675
|
}
|
|
10459
10676
|
var ae = { starter: 10, plus: 25, scale: 40, enterprise: 200 };
|
|
10460
|
-
function
|
|
10677
|
+
function Ba(e) {
|
|
10461
10678
|
if (e.count === void 0 || e.count === !0) return 1;
|
|
10462
10679
|
let t = typeof e.count == 'number' ? e.count : Number(e.count),
|
|
10463
|
-
|
|
10680
|
+
i = ae.enterprise;
|
|
10464
10681
|
return (
|
|
10465
|
-
(!Number.isInteger(t) || t < 1 || t >
|
|
10682
|
+
(!Number.isInteger(t) || t < 1 || t > i) &&
|
|
10466
10683
|
(process.stderr
|
|
10467
|
-
.write(`${a.red('Error:')} --count must be a whole number from 1 to ${
|
|
10684
|
+
.write(`${a.red('Error:')} --count must be a whole number from 1 to ${i}. The API allows Starter ${ae.starter}, Plus ${ae.plus}, Scale ${ae.scale}, Enterprise ${ae.enterprise} at once, including polling.
|
|
10468
10685
|
`),
|
|
10469
10686
|
process.exit(1)),
|
|
10470
10687
|
t
|
|
10471
10688
|
);
|
|
10472
10689
|
}
|
|
10473
|
-
async function
|
|
10690
|
+
async function ja(e, t, i, r, n) {
|
|
10474
10691
|
n.isJson ||
|
|
10475
|
-
process.stderr.write(`Starting ${
|
|
10692
|
+
process.stderr.write(`Starting ${r} ${t} jobs together...
|
|
10476
10693
|
`);
|
|
10477
10694
|
let s = await Promise.all(
|
|
10478
|
-
Array.from({ length:
|
|
10695
|
+
Array.from({ length: r }, async () => {
|
|
10479
10696
|
try {
|
|
10480
|
-
return { job: await e.queueJob(t,
|
|
10697
|
+
return { job: await e.queueJob(t, i) };
|
|
10481
10698
|
} catch (l) {
|
|
10482
10699
|
return { err: l };
|
|
10483
10700
|
}
|
|
@@ -10500,7 +10717,7 @@ async function Na(e, t, r, i, n) {
|
|
|
10500
10717
|
for (; c.length;) {
|
|
10501
10718
|
if ((await new Promise((u) => setTimeout(u, 2e3)), !n.isJson)) {
|
|
10502
10719
|
let u = Math.round((Date.now() - l) / 1e3);
|
|
10503
|
-
process.stderr.write(`Waiting on ${c.length} of ${
|
|
10720
|
+
process.stderr.write(`Waiting on ${c.length} of ${r} (${u}s)...
|
|
10504
10721
|
`);
|
|
10505
10722
|
}
|
|
10506
10723
|
let d = await Promise.all(
|
|
@@ -10548,15 +10765,15 @@ async function Na(e, t, r, i, n) {
|
|
|
10548
10765
|
o.some((l) => l.status === 'failed' || l.status === 'expired' || l.status === 'cancelled')) &&
|
|
10549
10766
|
process.exit(T);
|
|
10550
10767
|
}
|
|
10551
|
-
function
|
|
10552
|
-
if (
|
|
10553
|
-
let
|
|
10554
|
-
return `${e.slice(0, e.length -
|
|
10768
|
+
function Ga(e, t, i) {
|
|
10769
|
+
if (i <= 1) return e;
|
|
10770
|
+
let r = O.default.extname(e);
|
|
10771
|
+
return `${e.slice(0, e.length - r.length)}-${t + 1}${r}`;
|
|
10555
10772
|
}
|
|
10556
|
-
function
|
|
10773
|
+
function Vi(e) {
|
|
10557
10774
|
let t = {},
|
|
10558
|
-
|
|
10559
|
-
|
|
10775
|
+
i = new Set(),
|
|
10776
|
+
r = [];
|
|
10560
10777
|
for (let n = 0; n < e.length; n++) {
|
|
10561
10778
|
let s = e[n];
|
|
10562
10779
|
if (s.startsWith('--')) {
|
|
@@ -10574,7 +10791,7 @@ function Dr(e) {
|
|
|
10574
10791
|
? (t[o.replace(/-/g, '_')] = Number(p))
|
|
10575
10792
|
: (t[o.replace(/-/g, '_')] = p),
|
|
10576
10793
|
n++);
|
|
10577
|
-
} else ((t[o.replace(/-/g, '_')] = !0),
|
|
10794
|
+
} else ((t[o.replace(/-/g, '_')] = !0), i.add(o));
|
|
10578
10795
|
} else if (s.startsWith('-') && s.length === 2) {
|
|
10579
10796
|
let o = s[1],
|
|
10580
10797
|
l =
|
|
@@ -10590,18 +10807,18 @@ function Dr(e) {
|
|
|
10590
10807
|
v: 'version',
|
|
10591
10808
|
}[o] || o;
|
|
10592
10809
|
o === 'j' || o === 'h' || o === 'v'
|
|
10593
|
-
? ((t[l] = !0),
|
|
10810
|
+
? ((t[l] = !0), i.add(l))
|
|
10594
10811
|
: n + 1 < e.length && !e[n + 1].startsWith('-')
|
|
10595
10812
|
? ((t[l] = e[n + 1]), n++)
|
|
10596
10813
|
: (t[l] = !0);
|
|
10597
|
-
} else
|
|
10814
|
+
} else r.push(s);
|
|
10598
10815
|
}
|
|
10599
|
-
return { command:
|
|
10816
|
+
return { command: r[0] || '', subcommand: r[1], modelSlug: r[1] || r[0], options: t, flags: i };
|
|
10600
10817
|
}
|
|
10601
10818
|
async function pt(e, t) {
|
|
10602
|
-
let
|
|
10603
|
-
|
|
10604
|
-
(
|
|
10819
|
+
let i = _(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
10820
|
+
r = x(typeof t.api_url == 'string' ? t.api_url : void 0);
|
|
10821
|
+
(i ||
|
|
10605
10822
|
(process.stderr.write(`${a.red('Error:')} Authentication required.
|
|
10606
10823
|
`),
|
|
10607
10824
|
process.stderr
|
|
@@ -10620,7 +10837,7 @@ async function pt(e, t) {
|
|
|
10620
10837
|
s = !!t.json,
|
|
10621
10838
|
o = !!(t.async || t.no_wait),
|
|
10622
10839
|
p = typeof t.output == 'string' ? t.output : void 0,
|
|
10623
|
-
l =
|
|
10840
|
+
l = Ba(t),
|
|
10624
10841
|
c = { ...t };
|
|
10625
10842
|
(delete c.json,
|
|
10626
10843
|
delete c.async,
|
|
@@ -10629,14 +10846,14 @@ async function pt(e, t) {
|
|
|
10629
10846
|
delete c.api_key,
|
|
10630
10847
|
delete c.api_url,
|
|
10631
10848
|
delete c.count);
|
|
10632
|
-
let d =
|
|
10633
|
-
(
|
|
10634
|
-
typeof d.image == 'string' && !d.images && !
|
|
10849
|
+
let d = Di(n, c);
|
|
10850
|
+
(Va(d),
|
|
10851
|
+
typeof d.image == 'string' && !d.images && !ve(n) && ((d.images = [d.image]), delete d.image),
|
|
10635
10852
|
d.image_url &&
|
|
10636
10853
|
!d.first_frame_image &&
|
|
10637
10854
|
(e.startsWith('seedance') || e.startsWith('happy-horse')) &&
|
|
10638
10855
|
(d.first_frame_image = d.image_url));
|
|
10639
|
-
let u = new K(
|
|
10856
|
+
let u = new K(i, r),
|
|
10640
10857
|
m = [
|
|
10641
10858
|
'image',
|
|
10642
10859
|
'mask_image',
|
|
@@ -10651,53 +10868,53 @@ async function pt(e, t) {
|
|
|
10651
10868
|
for (let w of m) {
|
|
10652
10869
|
let h = d[w];
|
|
10653
10870
|
if (typeof h == 'string' && !h.startsWith('http://') && !h.startsWith('https://')) {
|
|
10654
|
-
let
|
|
10655
|
-
if (G.default.existsSync(
|
|
10656
|
-
let
|
|
10657
|
-
s ||
|
|
10871
|
+
let v = O.default.resolve(h);
|
|
10872
|
+
if (G.default.existsSync(v) && G.default.statSync(v).isFile()) {
|
|
10873
|
+
let I = new C(`Uploading local file ${O.default.basename(v)} to CDN...`);
|
|
10874
|
+
s || I.start();
|
|
10658
10875
|
try {
|
|
10659
|
-
let
|
|
10660
|
-
q = await u.uploadAsset(
|
|
10661
|
-
((d[w] = q.url), s ||
|
|
10662
|
-
} catch (
|
|
10663
|
-
let q =
|
|
10876
|
+
let U = G.default.readFileSync(v),
|
|
10877
|
+
q = await u.uploadAsset(U.toString('base64'));
|
|
10878
|
+
((d[w] = q.url), s || I.succeed(`Uploaded ${O.default.basename(v)} to CDN`));
|
|
10879
|
+
} catch (U) {
|
|
10880
|
+
let q = U instanceof Error ? U.message : String(U);
|
|
10664
10881
|
(s
|
|
10665
10882
|
? process.stdout.write(
|
|
10666
10883
|
JSON.stringify({ error: q }) +
|
|
10667
10884
|
`
|
|
10668
10885
|
`,
|
|
10669
10886
|
)
|
|
10670
|
-
:
|
|
10887
|
+
: I.fail(`Upload failed: ${q}`),
|
|
10671
10888
|
process.exit(1));
|
|
10672
10889
|
}
|
|
10673
10890
|
}
|
|
10674
10891
|
}
|
|
10675
10892
|
}
|
|
10676
|
-
await
|
|
10677
|
-
let h = new
|
|
10893
|
+
await Fa(d, async (w) => {
|
|
10894
|
+
let h = new C(`Uploading local file ${O.default.basename(w)} to CDN...`);
|
|
10678
10895
|
s || h.start();
|
|
10679
10896
|
try {
|
|
10680
|
-
let
|
|
10681
|
-
|
|
10682
|
-
return (s || h.succeed(`Uploaded ${O.default.basename(w)} to CDN`),
|
|
10683
|
-
} catch (
|
|
10684
|
-
let
|
|
10897
|
+
let v = G.default.readFileSync(w),
|
|
10898
|
+
I = await u.uploadAsset(v.toString('base64'));
|
|
10899
|
+
return (s || h.succeed(`Uploaded ${O.default.basename(w)} to CDN`), I.url);
|
|
10900
|
+
} catch (v) {
|
|
10901
|
+
let I = v instanceof Error ? v.message : String(v);
|
|
10685
10902
|
(s
|
|
10686
10903
|
? process.stdout.write(
|
|
10687
|
-
JSON.stringify({ error:
|
|
10904
|
+
JSON.stringify({ error: I }) +
|
|
10688
10905
|
`
|
|
10689
10906
|
`,
|
|
10690
10907
|
)
|
|
10691
|
-
: h.fail(`Upload failed: ${
|
|
10908
|
+
: h.fail(`Upload failed: ${I}`),
|
|
10692
10909
|
process.exit(1));
|
|
10693
10910
|
}
|
|
10694
10911
|
});
|
|
10695
|
-
let g = new
|
|
10912
|
+
let g = new C(`Submitting task for ${a.bold(e)}...`);
|
|
10696
10913
|
s || g.start();
|
|
10697
10914
|
let f;
|
|
10698
10915
|
try {
|
|
10699
10916
|
if (l > 1) {
|
|
10700
|
-
await
|
|
10917
|
+
await ja(u, e, d, l, { isJson: s, isAsync: o });
|
|
10701
10918
|
return;
|
|
10702
10919
|
}
|
|
10703
10920
|
f = await u.queueJob(e, d);
|
|
@@ -10736,11 +10953,11 @@ async function pt(e, t) {
|
|
|
10736
10953
|
return;
|
|
10737
10954
|
}
|
|
10738
10955
|
let A = Date.now(),
|
|
10739
|
-
|
|
10956
|
+
V = 1500;
|
|
10740
10957
|
for (; f.status === 'processing';) {
|
|
10741
10958
|
let w = Math.round((Date.now() - A) / 1e3);
|
|
10742
10959
|
(s || g.update(`Rendering ${a.bold(e)} (${w}s elapsed)... [ID: ${f.request_id}]`),
|
|
10743
|
-
await new Promise((h) => setTimeout(h,
|
|
10960
|
+
await new Promise((h) => setTimeout(h, V)));
|
|
10744
10961
|
try {
|
|
10745
10962
|
f = await u.getStatus(f.request_id);
|
|
10746
10963
|
} catch (h) {
|
|
@@ -10789,39 +11006,39 @@ async function pt(e, t) {
|
|
|
10789
11006
|
process.stdout.write(`
|
|
10790
11007
|
${a.bold('Outputs:')}
|
|
10791
11008
|
`);
|
|
10792
|
-
let w = f.output.filter((
|
|
11009
|
+
let w = f.output.filter((v) => v.url).length,
|
|
10793
11010
|
h = 0;
|
|
10794
|
-
for (let
|
|
10795
|
-
let
|
|
10796
|
-
if (
|
|
10797
|
-
let
|
|
11011
|
+
for (let v = 0; v < f.output.length; v++) {
|
|
11012
|
+
let I = f.output[v];
|
|
11013
|
+
if (I.url) {
|
|
11014
|
+
let U = I.layer?.name ? ` ${a.bold(I.layer.name)}` : '';
|
|
10798
11015
|
if (
|
|
10799
|
-
(process.stdout.write(` [${
|
|
11016
|
+
(process.stdout.write(` [${I.type.toUpperCase()}]${U} ${a.cyan(a.underline(I.url))}
|
|
10800
11017
|
`),
|
|
10801
11018
|
p)
|
|
10802
11019
|
) {
|
|
10803
|
-
let q =
|
|
10804
|
-
xt = new
|
|
11020
|
+
let q = Ga(p, h++, w),
|
|
11021
|
+
xt = new C(`Downloading output to ${q}...`).start();
|
|
10805
11022
|
try {
|
|
10806
|
-
(await u.downloadOutput(
|
|
11023
|
+
(await u.downloadOutput(I.url, O.default.resolve(process.cwd(), q)),
|
|
10807
11024
|
xt.succeed(`Saved to ${a.bold(q)}`));
|
|
10808
11025
|
} catch (Me) {
|
|
10809
11026
|
xt.fail(`Failed to download: ${Me instanceof Error ? Me.message : Me}`);
|
|
10810
11027
|
}
|
|
10811
11028
|
}
|
|
10812
11029
|
} else
|
|
10813
|
-
|
|
11030
|
+
I.text &&
|
|
10814
11031
|
process.stdout.write(`
|
|
10815
|
-
${
|
|
11032
|
+
${I.text}
|
|
10816
11033
|
`);
|
|
10817
11034
|
}
|
|
10818
11035
|
}
|
|
10819
11036
|
process.stdout.write(`
|
|
10820
11037
|
`);
|
|
10821
11038
|
}
|
|
10822
|
-
var
|
|
11039
|
+
var Ui = M(require('node:readline'));
|
|
10823
11040
|
R();
|
|
10824
|
-
async function
|
|
11041
|
+
async function Ha(e) {
|
|
10825
11042
|
try {
|
|
10826
11043
|
return (await new K(e, x()).checkKey(), 'ok');
|
|
10827
11044
|
} catch (t) {
|
|
@@ -10832,11 +11049,11 @@ async function Va(e) {
|
|
|
10832
11049
|
return 'unchecked';
|
|
10833
11050
|
}
|
|
10834
11051
|
}
|
|
10835
|
-
function
|
|
10836
|
-
let t =
|
|
10837
|
-
return new Promise((
|
|
10838
|
-
t.question(e, (
|
|
10839
|
-
(t.close(), r
|
|
11052
|
+
function za(e) {
|
|
11053
|
+
let t = Ui.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
11054
|
+
return new Promise((i) => {
|
|
11055
|
+
t.question(e, (r) => {
|
|
11056
|
+
(t.close(), i(r.trim()));
|
|
10840
11057
|
});
|
|
10841
11058
|
});
|
|
10842
11059
|
}
|
|
@@ -10844,36 +11061,36 @@ async function ne(e, t) {
|
|
|
10844
11061
|
switch (e) {
|
|
10845
11062
|
case 'login':
|
|
10846
11063
|
case 'set-key': {
|
|
10847
|
-
let
|
|
10848
|
-
(
|
|
11064
|
+
let i = t?.trim() || '';
|
|
11065
|
+
(i ||
|
|
10849
11066
|
(process.stdout.write(`
|
|
10850
11067
|
${a.bold('Tein AI Authentication')}
|
|
10851
11068
|
`),
|
|
10852
11069
|
process.stdout.write(`Get your API key at: ${a.cyan('https://tein.ai/dashboard/keys')}
|
|
10853
11070
|
|
|
10854
11071
|
`),
|
|
10855
|
-
(
|
|
10856
|
-
!
|
|
10857
|
-
!
|
|
11072
|
+
(i = await za('Enter your Tein API Key (sk_live_...): '))),
|
|
11073
|
+
!i.startsWith('sk_live_') &&
|
|
11074
|
+
!i.startsWith('sk_test_') &&
|
|
10858
11075
|
(process.stderr
|
|
10859
11076
|
.write(`${a.red('Error:')} Invalid key format. Tein API keys start with 'sk_live_' or 'sk_test_'.
|
|
10860
11077
|
`),
|
|
10861
11078
|
process.exit(1)));
|
|
10862
|
-
let
|
|
10863
|
-
(
|
|
11079
|
+
let r = await Ha(i);
|
|
11080
|
+
(r === 'invalid' &&
|
|
10864
11081
|
(process.stderr
|
|
10865
11082
|
.write(`${a.red('Error:')} Tein did not accept this key. Copy it again from ${a.cyan('https://tein.ai/dashboard/keys')}. Nothing was saved.
|
|
10866
11083
|
`),
|
|
10867
11084
|
process.exit(1)),
|
|
10868
|
-
$e({ apiKey:
|
|
11085
|
+
$e({ apiKey: i }),
|
|
10869
11086
|
process.stdout.write(`
|
|
10870
11087
|
${a.green('\u2713')} API key saved to ${a.dim(de())}
|
|
10871
11088
|
`),
|
|
10872
|
-
|
|
11089
|
+
r === 'blocked'
|
|
10873
11090
|
? process.stdout
|
|
10874
11091
|
.write(`${a.yellow('\u2139')} The key is valid, but this account cannot run requests right now. Check your dashboard.
|
|
10875
11092
|
`)
|
|
10876
|
-
:
|
|
11093
|
+
: r === 'unchecked' &&
|
|
10877
11094
|
process.stdout
|
|
10878
11095
|
.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.
|
|
10879
11096
|
`),
|
|
@@ -10897,8 +11114,8 @@ ${a.green('\u2713')} API key saved to ${a.dim(de())}
|
|
|
10897
11114
|
break;
|
|
10898
11115
|
}
|
|
10899
11116
|
default: {
|
|
10900
|
-
let
|
|
10901
|
-
|
|
11117
|
+
let i = _(),
|
|
11118
|
+
r = x(),
|
|
10902
11119
|
n = W();
|
|
10903
11120
|
if (
|
|
10904
11121
|
(process.stdout.write(`
|
|
@@ -10906,9 +11123,9 @@ ${a.bold('Tein AI CLI Configuration')}
|
|
|
10906
11123
|
`),
|
|
10907
11124
|
process.stdout.write(` Config file: ${a.dim(de())}
|
|
10908
11125
|
`),
|
|
10909
|
-
process.stdout.write(` API URL: ${a.cyan(
|
|
11126
|
+
process.stdout.write(` API URL: ${a.cyan(r)}
|
|
10910
11127
|
`),
|
|
10911
|
-
!
|
|
11128
|
+
!i)
|
|
10912
11129
|
)
|
|
10913
11130
|
(process.stdout.write(` API Key: ${a.red('Not configured')}
|
|
10914
11131
|
|
|
@@ -10918,9 +11135,9 @@ ${a.bold('Tein AI CLI Configuration')}
|
|
|
10918
11135
|
|
|
10919
11136
|
`));
|
|
10920
11137
|
else {
|
|
10921
|
-
let s = `${
|
|
11138
|
+
let s = `${i.slice(0, 10)}...${i.slice(-4)}`;
|
|
10922
11139
|
process.stdout
|
|
10923
|
-
.write(` API Key: ${a.green(s)} (${
|
|
11140
|
+
.write(` API Key: ${a.green(s)} (${i.startsWith('sk_live_') ? 'Live Key' : 'Test Key'})
|
|
10924
11141
|
|
|
10925
11142
|
`);
|
|
10926
11143
|
}
|
|
@@ -10934,10 +11151,10 @@ function P(e) {
|
|
|
10934
11151
|
? `$${e.toFixed(6).replace(/0+$/, '').replace(/\.$/, '')}`
|
|
10935
11152
|
: `$${e.toFixed(2)}`;
|
|
10936
11153
|
}
|
|
10937
|
-
function
|
|
11154
|
+
function Fi(e) {
|
|
10938
11155
|
return `${e} ${e === 1 ? 'request' : 'requests'}`;
|
|
10939
11156
|
}
|
|
10940
|
-
function
|
|
11157
|
+
function Wa(e) {
|
|
10941
11158
|
let t = [
|
|
10942
11159
|
['Balance', P(e.balance)],
|
|
10943
11160
|
['Available to this key', P(e.available)],
|
|
@@ -10950,15 +11167,15 @@ function Ba(e) {
|
|
|
10950
11167
|
: '';
|
|
10951
11168
|
t.push(['Credits from Tein', `${P(e.credits_from_tein.amount)}${n}`]);
|
|
10952
11169
|
}
|
|
10953
|
-
let
|
|
10954
|
-
(
|
|
11170
|
+
let i = e.key.spending_limit;
|
|
11171
|
+
(i &&
|
|
10955
11172
|
t.push([
|
|
10956
|
-
`Key limit (${
|
|
10957
|
-
`${P(
|
|
11173
|
+
`Key limit (${i.period})`,
|
|
11174
|
+
`${P(i.remaining)} left of ${P(i.amount)}${i.resets_at ? `, resets ${i.resets_at.slice(0, 10)}` : ''}`,
|
|
10958
11175
|
]),
|
|
10959
11176
|
t.push(
|
|
10960
|
-
['This month', `${P(e.usage.this_month.spend)} on ${
|
|
10961
|
-
['Last 30 days', `${P(e.usage.last_30_days.spend)} on ${
|
|
11177
|
+
['This month', `${P(e.usage.this_month.spend)} on ${Fi(e.usage.this_month.requests)}`],
|
|
11178
|
+
['Last 30 days', `${P(e.usage.last_30_days.spend)} on ${Fi(e.usage.last_30_days.requests)}`],
|
|
10962
11179
|
[
|
|
10963
11180
|
'Auto top up',
|
|
10964
11181
|
e.auto_top_up.enabled
|
|
@@ -10968,13 +11185,13 @@ function Ba(e) {
|
|
|
10968
11185
|
['Workspace', `${e.workspace.name} (${e.workspace.plan.name})`],
|
|
10969
11186
|
['Key', `${e.key.name} (${e.key.env})`],
|
|
10970
11187
|
));
|
|
10971
|
-
let
|
|
10972
|
-
return t.map(([n, s]) => ` ${n.padEnd(
|
|
11188
|
+
let r = Math.max(...t.map(([n]) => n.length));
|
|
11189
|
+
return t.map(([n, s]) => ` ${n.padEnd(r)} ${s}`);
|
|
10973
11190
|
}
|
|
10974
|
-
async function
|
|
11191
|
+
async function Bi(e) {
|
|
10975
11192
|
let t = _(typeof e.api_key == 'string' ? e.api_key : void 0),
|
|
10976
|
-
|
|
10977
|
-
|
|
11193
|
+
i = x(typeof e.api_url == 'string' ? e.api_url : void 0),
|
|
11194
|
+
r = !!e.json;
|
|
10978
11195
|
t ||
|
|
10979
11196
|
(process.stderr.write(`${a.red('Error:')} Authentication required.
|
|
10980
11197
|
`),
|
|
@@ -10984,10 +11201,10 @@ async function Vr(e) {
|
|
|
10984
11201
|
process.exit(1));
|
|
10985
11202
|
let n;
|
|
10986
11203
|
try {
|
|
10987
|
-
n = await new K(t,
|
|
11204
|
+
n = await new K(t, i).getBalance();
|
|
10988
11205
|
} catch (s) {
|
|
10989
11206
|
(s instanceof b &&
|
|
10990
|
-
(
|
|
11207
|
+
(r
|
|
10991
11208
|
? process.stdout.write(
|
|
10992
11209
|
JSON.stringify(
|
|
10993
11210
|
{ error: { code: s.code ?? null, message: s.message, ...s.fields } },
|
|
@@ -11005,7 +11222,7 @@ async function Vr(e) {
|
|
|
11005
11222
|
`),
|
|
11006
11223
|
process.exit(T));
|
|
11007
11224
|
}
|
|
11008
|
-
if (
|
|
11225
|
+
if (r) {
|
|
11009
11226
|
process.stdout.write(
|
|
11010
11227
|
JSON.stringify(n, null, 2) +
|
|
11011
11228
|
`
|
|
@@ -11015,15 +11232,15 @@ async function Vr(e) {
|
|
|
11015
11232
|
}
|
|
11016
11233
|
process.stdout.write(`
|
|
11017
11234
|
${a.bold('Tein balance')}
|
|
11018
|
-
${
|
|
11235
|
+
${Wa(n).join(`
|
|
11019
11236
|
`)}
|
|
11020
11237
|
|
|
11021
11238
|
`);
|
|
11022
11239
|
}
|
|
11023
11240
|
R();
|
|
11024
|
-
function
|
|
11241
|
+
function ji(e) {
|
|
11025
11242
|
let t = _(typeof e.api_key == 'string' ? e.api_key : void 0),
|
|
11026
|
-
|
|
11243
|
+
i = x(typeof e.api_url == 'string' ? e.api_url : void 0);
|
|
11027
11244
|
return (
|
|
11028
11245
|
t ||
|
|
11029
11246
|
(process.stderr.write(`${a.red('Error:')} Authentication required.
|
|
@@ -11032,55 +11249,55 @@ function Fr(e) {
|
|
|
11032
11249
|
.write(`Please run ${a.cyan('tein auth login')} or set ${a.cyan('TEIN_API_KEY')} environment variable.
|
|
11033
11250
|
`),
|
|
11034
11251
|
process.exit(1)),
|
|
11035
|
-
new K(t,
|
|
11252
|
+
new K(t, i)
|
|
11036
11253
|
);
|
|
11037
11254
|
}
|
|
11038
|
-
function
|
|
11039
|
-
let
|
|
11040
|
-
for (let
|
|
11041
|
-
let n = e[
|
|
11042
|
-
(typeof n == 'string' || typeof n == 'number') && (r
|
|
11255
|
+
function Gi(e, t) {
|
|
11256
|
+
let i = {};
|
|
11257
|
+
for (let r of t) {
|
|
11258
|
+
let n = e[r];
|
|
11259
|
+
(typeof n == 'string' || typeof n == 'number') && (i[r] = String(n));
|
|
11043
11260
|
}
|
|
11044
|
-
return
|
|
11261
|
+
return i;
|
|
11045
11262
|
}
|
|
11046
|
-
async function
|
|
11263
|
+
async function Hi(e, t) {
|
|
11047
11264
|
try {
|
|
11048
11265
|
return await t();
|
|
11049
|
-
} catch (
|
|
11050
|
-
(
|
|
11266
|
+
} catch (i) {
|
|
11267
|
+
(i instanceof b &&
|
|
11051
11268
|
(e
|
|
11052
11269
|
? process.stdout.write(
|
|
11053
11270
|
JSON.stringify(
|
|
11054
|
-
{ error: { code:
|
|
11271
|
+
{ error: { code: i.code ?? null, message: i.message, ...i.fields } },
|
|
11055
11272
|
null,
|
|
11056
11273
|
2,
|
|
11057
11274
|
) +
|
|
11058
11275
|
`
|
|
11059
11276
|
`,
|
|
11060
11277
|
)
|
|
11061
|
-
: process.stderr.write(`${a.red('Error:')} ${E(
|
|
11278
|
+
: process.stderr.write(`${a.red('Error:')} ${E(i).join(`
|
|
11062
11279
|
`)}
|
|
11063
11280
|
`),
|
|
11064
|
-
process.exit(
|
|
11065
|
-
process.stderr.write(`${a.red('Error:')} ${
|
|
11281
|
+
process.exit(i.exitCode)),
|
|
11282
|
+
process.stderr.write(`${a.red('Error:')} ${i instanceof Error ? i.message : String(i)}
|
|
11066
11283
|
`),
|
|
11067
11284
|
process.exit(T));
|
|
11068
11285
|
}
|
|
11069
11286
|
}
|
|
11070
11287
|
function dt(e) {
|
|
11071
|
-
let t = e[0].map((
|
|
11072
|
-
|
|
11288
|
+
let t = e[0].map((r, n) => Math.max(...e.map((s) => s[n].length))),
|
|
11289
|
+
i = (r) => e.slice(1).every((n) => /^[-+$\d]/.test(n[r]));
|
|
11073
11290
|
return e.map(
|
|
11074
|
-
(
|
|
11075
|
-
` ${
|
|
11076
|
-
.map((n, s) => (s > 0 &&
|
|
11291
|
+
(r) =>
|
|
11292
|
+
` ${r
|
|
11293
|
+
.map((n, s) => (s > 0 && i(s) ? n.padStart(t[s]) : n.padEnd(t[s])))
|
|
11077
11294
|
.join(' ')
|
|
11078
11295
|
.trimEnd()}`,
|
|
11079
11296
|
);
|
|
11080
11297
|
}
|
|
11081
|
-
function
|
|
11298
|
+
function Ja(e) {
|
|
11082
11299
|
let t = e.summary,
|
|
11083
|
-
|
|
11300
|
+
i = [
|
|
11084
11301
|
` 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}` : ''}`,
|
|
11085
11302
|
` Spent ${P(t.spend)} on ${t.requests} requests (${t.succeeded} succeeded, ${t.failed} failed${t.running ? `, ${t.running} running` : ''})`,
|
|
11086
11303
|
` Daily burn ${P(t.daily_burn)}`,
|
|
@@ -11088,31 +11305,31 @@ function ja(e) {
|
|
|
11088
11305
|
];
|
|
11089
11306
|
return (
|
|
11090
11307
|
e.by_channel.length &&
|
|
11091
|
-
(
|
|
11092
|
-
|
|
11308
|
+
(i.push('', a.bold('By channel')),
|
|
11309
|
+
i.push(
|
|
11093
11310
|
...dt([
|
|
11094
11311
|
['Channel', 'Spend', 'Requests'],
|
|
11095
|
-
...e.by_channel.map((
|
|
11312
|
+
...e.by_channel.map((r) => [r.channel, P(r.spend), String(r.requests)]),
|
|
11096
11313
|
]),
|
|
11097
11314
|
)),
|
|
11098
11315
|
e.by_model.length &&
|
|
11099
|
-
(
|
|
11100
|
-
|
|
11316
|
+
(i.push('', a.bold('By model')),
|
|
11317
|
+
i.push(
|
|
11101
11318
|
...dt([
|
|
11102
11319
|
['Model', 'Spend', 'Requests', 'Failed'],
|
|
11103
|
-
...e.by_model.map((
|
|
11320
|
+
...e.by_model.map((r) => [r.name, P(r.spend), String(r.requests), String(r.failed)]),
|
|
11104
11321
|
]),
|
|
11105
11322
|
)),
|
|
11106
|
-
|
|
11323
|
+
i
|
|
11107
11324
|
);
|
|
11108
11325
|
}
|
|
11109
|
-
async function
|
|
11326
|
+
async function zi(e) {
|
|
11110
11327
|
let t = !!e.json,
|
|
11111
|
-
|
|
11112
|
-
|
|
11328
|
+
i = ji(e),
|
|
11329
|
+
r = await Hi(t, () => i.getUsage(Gi(e, ['range', 'from', 'to', 'model', 'channel'])));
|
|
11113
11330
|
if (t) {
|
|
11114
11331
|
process.stdout.write(
|
|
11115
|
-
JSON.stringify(
|
|
11332
|
+
JSON.stringify(r, null, 2) +
|
|
11116
11333
|
`
|
|
11117
11334
|
`,
|
|
11118
11335
|
);
|
|
@@ -11120,12 +11337,12 @@ async function Gr(e) {
|
|
|
11120
11337
|
}
|
|
11121
11338
|
process.stdout.write(`
|
|
11122
11339
|
${a.bold('Tein usage')}
|
|
11123
|
-
${
|
|
11340
|
+
${Ja(r).join(`
|
|
11124
11341
|
`)}
|
|
11125
11342
|
|
|
11126
11343
|
`);
|
|
11127
11344
|
}
|
|
11128
|
-
function
|
|
11345
|
+
function Ya(e) {
|
|
11129
11346
|
return e.data.length
|
|
11130
11347
|
? dt([
|
|
11131
11348
|
['When (UTC)', 'Amount', 'Balance after', 'What'],
|
|
@@ -11138,37 +11355,37 @@ function Ga(e) {
|
|
|
11138
11355
|
])
|
|
11139
11356
|
: [' No transactions yet.'];
|
|
11140
11357
|
}
|
|
11141
|
-
async function
|
|
11358
|
+
async function Wi(e) {
|
|
11142
11359
|
let t = !!e.json,
|
|
11143
|
-
|
|
11144
|
-
|
|
11360
|
+
i = ji(e),
|
|
11361
|
+
r = await Hi(t, () => i.getTransactions(Gi(e, ['limit', 'type', 'after'])));
|
|
11145
11362
|
if (t) {
|
|
11146
11363
|
process.stdout.write(
|
|
11147
|
-
JSON.stringify(
|
|
11364
|
+
JSON.stringify(r, null, 2) +
|
|
11148
11365
|
`
|
|
11149
11366
|
`,
|
|
11150
11367
|
);
|
|
11151
11368
|
return;
|
|
11152
11369
|
}
|
|
11153
11370
|
let n =
|
|
11154
|
-
|
|
11371
|
+
r.has_more && r.next_cursor
|
|
11155
11372
|
? `
|
|
11156
|
-
More: tein transactions --after ${
|
|
11373
|
+
More: tein transactions --after ${r.next_cursor}`
|
|
11157
11374
|
: '';
|
|
11158
11375
|
process.stdout.write(`
|
|
11159
11376
|
${a.bold('Tein balance history')}
|
|
11160
|
-
${
|
|
11377
|
+
${Ya(r).join(`
|
|
11161
11378
|
`)}${n}
|
|
11162
11379
|
|
|
11163
11380
|
`);
|
|
11164
11381
|
}
|
|
11165
11382
|
R();
|
|
11166
11383
|
Ae();
|
|
11167
|
-
|
|
11384
|
+
re();
|
|
11168
11385
|
R();
|
|
11169
11386
|
ct();
|
|
11170
|
-
var
|
|
11171
|
-
|
|
11387
|
+
var Xa = 1e4,
|
|
11388
|
+
Ji = {
|
|
11172
11389
|
price: '',
|
|
11173
11390
|
creativeMode: 'Creative mode',
|
|
11174
11391
|
priority: 'Priority',
|
|
@@ -11178,27 +11395,27 @@ var Ha = 1e4,
|
|
|
11178
11395
|
priorityDraft: 'Priority + Draft',
|
|
11179
11396
|
creativeModePriorityDraft: 'Creative mode + Priority + Draft',
|
|
11180
11397
|
},
|
|
11181
|
-
|
|
11182
|
-
|
|
11398
|
+
Qa = Object.keys(Ji),
|
|
11399
|
+
Za = {
|
|
11183
11400
|
creativeMode: 'unfiltered',
|
|
11184
11401
|
creativeModePriority: 'unfilteredPriority',
|
|
11185
11402
|
creativeModeDraft: 'unfilteredDraft',
|
|
11186
11403
|
creativeModePriorityDraft: 'unfilteredPriorityDraft',
|
|
11187
11404
|
};
|
|
11188
|
-
function
|
|
11189
|
-
let
|
|
11190
|
-
return e[t] ?? (
|
|
11405
|
+
function en(e, t) {
|
|
11406
|
+
let i = Za[t];
|
|
11407
|
+
return e[t] ?? (i ? e[i] : void 0);
|
|
11191
11408
|
}
|
|
11192
|
-
async function
|
|
11193
|
-
let
|
|
11409
|
+
async function tn(e, t, i = _()) {
|
|
11410
|
+
let r = `${x(e)}${Ie(t)}`,
|
|
11194
11411
|
n;
|
|
11195
11412
|
try {
|
|
11196
|
-
n = await fetch(
|
|
11197
|
-
signal: AbortSignal.timeout(
|
|
11198
|
-
...(
|
|
11413
|
+
n = await fetch(r, {
|
|
11414
|
+
signal: AbortSignal.timeout(Xa),
|
|
11415
|
+
...(i ? { headers: { Authorization: `Bearer ${i}` } } : {}),
|
|
11199
11416
|
});
|
|
11200
11417
|
} catch {
|
|
11201
|
-
throw new Error(`Could not reach ${
|
|
11418
|
+
throw new Error(`Could not reach ${r}`);
|
|
11202
11419
|
}
|
|
11203
11420
|
let s = await n.json().catch(() => null);
|
|
11204
11421
|
if (!n.ok || !s || s.object !== 'list' || !s.board) {
|
|
@@ -11214,64 +11431,64 @@ async function Ya(e, t, r = _()) {
|
|
|
11214
11431
|
}
|
|
11215
11432
|
function Te(e) {
|
|
11216
11433
|
let t = e.toFixed(4).replace(/0+$/, '').replace(/\.$/, ''),
|
|
11217
|
-
[
|
|
11218
|
-
return `$${
|
|
11434
|
+
[i, r = ''] = t.split('.');
|
|
11435
|
+
return `$${i}.${r.padEnd(2, '0')}`;
|
|
11219
11436
|
}
|
|
11220
11437
|
function X(e) {
|
|
11221
11438
|
if (!e || typeof e.starter != 'number') return null;
|
|
11222
11439
|
let t = typeof e.plus == 'number' ? e.plus : e.starter,
|
|
11223
|
-
|
|
11224
|
-
return `Starter ${Te(e.starter)} Plus ${Te(t)} Scale ${Te(
|
|
11440
|
+
i = typeof e.scale == 'number' ? e.scale : t;
|
|
11441
|
+
return `Starter ${Te(e.starter)} Plus ${Te(t)} Scale ${Te(i)}`;
|
|
11225
11442
|
}
|
|
11226
|
-
function
|
|
11227
|
-
let t =
|
|
11443
|
+
function Yi(e) {
|
|
11444
|
+
let t = Ji[e];
|
|
11228
11445
|
return t ? ` (${t})` : '';
|
|
11229
11446
|
}
|
|
11230
11447
|
function ut(e) {
|
|
11231
11448
|
let t = X(e.price) ?? '',
|
|
11232
|
-
|
|
11233
|
-
return `${e.label}${
|
|
11449
|
+
i = e.public ? ` ${a.dim(`(published Starter ${Te(e.public.starter)})`)}` : '';
|
|
11450
|
+
return `${e.label}${Yi(e.table)} ${t}${i}`;
|
|
11234
11451
|
}
|
|
11235
|
-
function mt(e, t,
|
|
11236
|
-
return `${e}|${
|
|
11452
|
+
function mt(e, t, i, r = !1) {
|
|
11453
|
+
return `${e}|${r ? 'edit/' : ''}${t}|${i}`;
|
|
11237
11454
|
}
|
|
11238
|
-
function
|
|
11455
|
+
function rn(e) {
|
|
11239
11456
|
let t = new Map();
|
|
11240
|
-
for (let
|
|
11241
|
-
let
|
|
11242
|
-
t.set(mt(
|
|
11457
|
+
for (let i of e ?? []) {
|
|
11458
|
+
let r = i.addon ? `addon/${i.addon}` : (i.variant ?? '');
|
|
11459
|
+
t.set(mt(i.slug, r, i.table, i.edit === !0), i);
|
|
11243
11460
|
}
|
|
11244
11461
|
return t;
|
|
11245
11462
|
}
|
|
11246
|
-
function
|
|
11463
|
+
function an(e) {
|
|
11247
11464
|
if (typeof e.label == 'string' && e.label.trim()) return e.label.trim();
|
|
11248
11465
|
let t = [];
|
|
11249
|
-
for (let
|
|
11250
|
-
let
|
|
11251
|
-
|
|
11466
|
+
for (let i of ['endpoint', 'resolution', 'quality', 'mode', 'task', 'component', 'token']) {
|
|
11467
|
+
let r = e[i];
|
|
11468
|
+
r != null && r !== '' && t.push(String(r));
|
|
11252
11469
|
}
|
|
11253
11470
|
return (
|
|
11254
11471
|
e.withVideo === !0 && t.push('with video'),
|
|
11255
11472
|
t.length ? t.join(' \xB7 ') : String(e.id ?? 'default')
|
|
11256
11473
|
);
|
|
11257
11474
|
}
|
|
11258
|
-
function
|
|
11259
|
-
let s =
|
|
11260
|
-
for (let o of
|
|
11261
|
-
let p = X(
|
|
11475
|
+
function nn(e, t, i, r, n) {
|
|
11476
|
+
let s = an(t);
|
|
11477
|
+
for (let o of Qa) {
|
|
11478
|
+
let p = X(en(t, o));
|
|
11262
11479
|
if (!p) continue;
|
|
11263
|
-
let l =
|
|
11264
|
-
|
|
11265
|
-
let c =
|
|
11266
|
-
c && (n.add(c),
|
|
11480
|
+
let l = Yi(o);
|
|
11481
|
+
i.push(` ${s}${l} ${p}`);
|
|
11482
|
+
let c = r.get(mt(e, String(t.id ?? ''), o));
|
|
11483
|
+
c && (n.add(c), i.push(` ${a.yellow('Your price')} ${X(c.price) ?? ''}`));
|
|
11267
11484
|
}
|
|
11268
11485
|
}
|
|
11269
|
-
function
|
|
11486
|
+
function sn(e, t, i, r) {
|
|
11270
11487
|
let n = e.quality ? ` quality=${e.quality}` : '';
|
|
11271
11488
|
t.push(
|
|
11272
11489
|
` ${a.bold(e.slug.padEnd(26))} ${a.gray(e.name)} ${a.dim(`${e.kind} ${e.unit} model=${e.model}${n}`)}`,
|
|
11273
11490
|
);
|
|
11274
|
-
for (let o of e.variants ?? [])
|
|
11491
|
+
for (let o of e.variants ?? []) nn(e.slug, o, t, i, r);
|
|
11275
11492
|
let s = e.addons;
|
|
11276
11493
|
if (Array.isArray(s))
|
|
11277
11494
|
for (let o of s) {
|
|
@@ -11280,27 +11497,27 @@ function en(e, t, r, i) {
|
|
|
11280
11497
|
l = typeof p.label == 'string' ? p.label : String(p.id ?? 'add-on'),
|
|
11281
11498
|
c = X(p.price);
|
|
11282
11499
|
c && t.push(` ${l} (add-on) ${c}`);
|
|
11283
|
-
let d =
|
|
11284
|
-
c && d && (
|
|
11500
|
+
let d = i.get(mt(e.slug, `addon/${String(p.id ?? '')}`, 'price'));
|
|
11501
|
+
c && d && (r.add(d), t.push(` ${a.yellow('Your price')} ${X(d.price) ?? ''}`));
|
|
11285
11502
|
}
|
|
11286
11503
|
for (let o of Array.isArray(e.notes) ? e.notes : [])
|
|
11287
11504
|
typeof o == 'string' && o.trim() && t.push(` ${a.dim(o.trim())}`);
|
|
11288
11505
|
t.push('');
|
|
11289
11506
|
}
|
|
11290
|
-
function
|
|
11507
|
+
function on(e) {
|
|
11291
11508
|
let t = [],
|
|
11292
|
-
|
|
11293
|
-
(t.push(`${a.bold('Tein prices')} ${a.green(e.currency)} ${e.count} models${
|
|
11509
|
+
i = e.board.checked ? ` \xB7 checked ${e.board.checked}` : '';
|
|
11510
|
+
(t.push(`${a.bold('Tein prices')} ${a.green(e.currency)} ${e.count} models${i}`),
|
|
11294
11511
|
t.push(
|
|
11295
11512
|
`${a.dim('Starter, Plus and Scale. Creative mode, Priority and draft show only where published.')}`,
|
|
11296
11513
|
));
|
|
11297
|
-
let
|
|
11298
|
-
(
|
|
11514
|
+
let r = e.your_prices?.rows ?? [];
|
|
11515
|
+
(r.length &&
|
|
11299
11516
|
t.push(
|
|
11300
11517
|
`${a.yellow('Your price')} ${a.dim('rows are the prices your workspace pays instead of the published ones.')}`,
|
|
11301
11518
|
),
|
|
11302
11519
|
t.push(''));
|
|
11303
|
-
let n =
|
|
11520
|
+
let n = rn(r),
|
|
11304
11521
|
s = new Set(),
|
|
11305
11522
|
o = new Map();
|
|
11306
11523
|
for (let m of e.board.models) {
|
|
@@ -11316,9 +11533,9 @@ function tn(e) {
|
|
|
11316
11533
|
});
|
|
11317
11534
|
for (let m of l) {
|
|
11318
11535
|
t.push(`${a.bold(a.cyan(`\u2500\u2500 ${m} \u2500\u2500`))}`);
|
|
11319
|
-
for (let g of o.get(m) ?? [])
|
|
11536
|
+
for (let g of o.get(m) ?? []) sn(g, t, n, s);
|
|
11320
11537
|
}
|
|
11321
|
-
let c =
|
|
11538
|
+
let c = r.filter((m) => !s.has(m));
|
|
11322
11539
|
if (c.length) {
|
|
11323
11540
|
t.push(`${a.bold(a.cyan('\u2500\u2500 your prices \u2500\u2500'))}`);
|
|
11324
11541
|
for (let m of c)
|
|
@@ -11339,9 +11556,9 @@ function tn(e) {
|
|
|
11339
11556
|
for (let [g, f] of m) {
|
|
11340
11557
|
let A = String(f[0]?.modelName ?? g);
|
|
11341
11558
|
t.push(` ${a.bold(g.padEnd(26))} ${a.gray(A)}`);
|
|
11342
|
-
for (let
|
|
11343
|
-
let w = String(
|
|
11344
|
-
h = X(
|
|
11559
|
+
for (let V of f) {
|
|
11560
|
+
let w = String(V.displayLabel ?? V.billingUnit ?? 'price'),
|
|
11561
|
+
h = X(V.prices);
|
|
11345
11562
|
h && t.push(` ${w} ${h}`);
|
|
11346
11563
|
}
|
|
11347
11564
|
t.push('');
|
|
@@ -11354,13 +11571,13 @@ function tn(e) {
|
|
|
11354
11571
|
`
|
|
11355
11572
|
);
|
|
11356
11573
|
}
|
|
11357
|
-
async function
|
|
11574
|
+
async function Xi(e) {
|
|
11358
11575
|
let t;
|
|
11359
11576
|
try {
|
|
11360
|
-
t = await
|
|
11361
|
-
} catch (
|
|
11362
|
-
let
|
|
11363
|
-
(process.stderr.write(`${a.red('Error:')} ${
|
|
11577
|
+
t = await tn(e.apiUrl, e.model);
|
|
11578
|
+
} catch (i) {
|
|
11579
|
+
let r = i instanceof Error ? i.message : String(i);
|
|
11580
|
+
(process.stderr.write(`${a.red('Error:')} ${r}
|
|
11364
11581
|
`),
|
|
11365
11582
|
process.exit(1));
|
|
11366
11583
|
}
|
|
@@ -11368,58 +11585,58 @@ async function Jr(e) {
|
|
|
11368
11585
|
e.json
|
|
11369
11586
|
? `${JSON.stringify(t, null, 2)}
|
|
11370
11587
|
`
|
|
11371
|
-
:
|
|
11588
|
+
: on(t),
|
|
11372
11589
|
);
|
|
11373
11590
|
}
|
|
11374
|
-
var
|
|
11375
|
-
async function
|
|
11376
|
-
let
|
|
11591
|
+
var ln = 3e3;
|
|
11592
|
+
async function Qi(e, t) {
|
|
11593
|
+
let i = t ?? _();
|
|
11377
11594
|
try {
|
|
11378
|
-
let
|
|
11379
|
-
signal: AbortSignal.timeout(
|
|
11380
|
-
...(
|
|
11595
|
+
let r = await fetch(`${x(e)}/v1/pricing`, {
|
|
11596
|
+
signal: AbortSignal.timeout(ln),
|
|
11597
|
+
...(i ? { headers: { Authorization: `Bearer ${i}` } } : {}),
|
|
11381
11598
|
});
|
|
11382
|
-
if (!
|
|
11383
|
-
let n = await
|
|
11599
|
+
if (!r.ok) return { live: !1, yourPrices: null };
|
|
11600
|
+
let n = await r.json(),
|
|
11384
11601
|
s = {};
|
|
11385
11602
|
for (let p of n.configs ?? []) {
|
|
11386
11603
|
let l = String(p.modelSlug ?? '');
|
|
11387
11604
|
ce.has(l) && (s[l] ??= []).push(Number(p.starterPrice));
|
|
11388
11605
|
}
|
|
11389
|
-
(
|
|
11606
|
+
(Ti(s), qi(n.price_texts));
|
|
11390
11607
|
let o = n.your_prices?.rows;
|
|
11391
11608
|
return { live: !0, yourPrices: Array.isArray(o) ? o : null };
|
|
11392
11609
|
} catch {
|
|
11393
11610
|
return { live: !1, yourPrices: null };
|
|
11394
11611
|
}
|
|
11395
11612
|
}
|
|
11396
|
-
function
|
|
11613
|
+
function pn(e) {
|
|
11397
11614
|
return j(e.slug) ? e.slug : e.model;
|
|
11398
11615
|
}
|
|
11399
|
-
function
|
|
11400
|
-
return (t ?? []).filter((
|
|
11616
|
+
function Zi(e, t) {
|
|
11617
|
+
return (t ?? []).filter((i) => i && pn(i) === e);
|
|
11401
11618
|
}
|
|
11402
|
-
var
|
|
11403
|
-
|
|
11404
|
-
async function
|
|
11405
|
-
let
|
|
11406
|
-
|
|
11619
|
+
var dn = new Set(['video', 'image', 'text', 'audio', '3d']),
|
|
11620
|
+
cn = { llm: 'text', chat: 'text', reasoning: 'text' };
|
|
11621
|
+
async function er(e, t) {
|
|
11622
|
+
let i = await Qi(t),
|
|
11623
|
+
r = D();
|
|
11407
11624
|
if (e) {
|
|
11408
11625
|
let o = e.toLowerCase(),
|
|
11409
|
-
p =
|
|
11410
|
-
|
|
11411
|
-
?
|
|
11412
|
-
:
|
|
11626
|
+
p = cn[o] ?? o;
|
|
11627
|
+
r = dn.has(p)
|
|
11628
|
+
? r.filter((l) => l.category.toLowerCase() === p)
|
|
11629
|
+
: r.filter((l) => l.kind.toLowerCase().includes(o) || l.slug.toLowerCase().includes(o));
|
|
11413
11630
|
}
|
|
11414
11631
|
(process.stdout.write(`
|
|
11415
|
-
${a.bold('Tein AI Models Catalog')} (${
|
|
11632
|
+
${a.bold('Tein AI Models Catalog')} (${r.length} available)
|
|
11416
11633
|
`),
|
|
11417
11634
|
process.stdout
|
|
11418
11635
|
.write(`${a.dim('Run `tein info <model-slug>` to see detailed parameters and options.')}
|
|
11419
11636
|
|
|
11420
11637
|
`));
|
|
11421
11638
|
let n = {};
|
|
11422
|
-
for (let o of
|
|
11639
|
+
for (let o of r) {
|
|
11423
11640
|
let p = o.category;
|
|
11424
11641
|
(n[p] || (n[p] = []), n[p].push(o));
|
|
11425
11642
|
}
|
|
@@ -11433,7 +11650,7 @@ ${a.bold('Tein AI Models Catalog')} (${i.length} available)
|
|
|
11433
11650
|
let c = l.slug.padEnd(24),
|
|
11434
11651
|
d = l.name.padEnd(22),
|
|
11435
11652
|
u = l.priceFormatted.padEnd(22),
|
|
11436
|
-
m =
|
|
11653
|
+
m = Zi(l.slug, i.yourPrices).length ? ` ${a.yellow('Your price')}` : '';
|
|
11437
11654
|
process.stdout.write(` ${a.bold(c)} ${a.gray(d)} ${a.green(u)} ${a.dim(l.vendor)}${m}
|
|
11438
11655
|
`);
|
|
11439
11656
|
}
|
|
@@ -11441,11 +11658,11 @@ ${a.bold('Tein AI Models Catalog')} (${i.length} available)
|
|
|
11441
11658
|
`);
|
|
11442
11659
|
}
|
|
11443
11660
|
}
|
|
11444
|
-
(
|
|
11661
|
+
(i.yourPrices?.length &&
|
|
11445
11662
|
process.stdout
|
|
11446
11663
|
.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>')}.
|
|
11447
11664
|
`),
|
|
11448
|
-
|
|
11665
|
+
i.live ||
|
|
11449
11666
|
process.stdout
|
|
11450
11667
|
.write(`${a.dim('Prices could not be checked online; showing the prices this CLI was built with.')}
|
|
11451
11668
|
`),
|
|
@@ -11454,47 +11671,47 @@ ${a.bold('Tein AI Models Catalog')} (${i.length} available)
|
|
|
11454
11671
|
|
|
11455
11672
|
`));
|
|
11456
11673
|
}
|
|
11457
|
-
async function
|
|
11458
|
-
let
|
|
11459
|
-
|
|
11674
|
+
async function tr(e, t) {
|
|
11675
|
+
let i = j(e);
|
|
11676
|
+
i ||
|
|
11460
11677
|
(process.stderr.write(`${a.red('Error:')} Model "${e}" not found in Tein AI registry.
|
|
11461
11678
|
`),
|
|
11462
11679
|
process.stderr.write(`Run ${a.cyan('tein models')} to see all available model slugs.
|
|
11463
11680
|
`),
|
|
11464
11681
|
process.exit(1));
|
|
11465
|
-
let
|
|
11682
|
+
let r = await Qi(t);
|
|
11466
11683
|
(process.stdout.write(`
|
|
11467
|
-
${a.bold(a.cyan(
|
|
11684
|
+
${a.bold(a.cyan(i.name))} (${a.bold(i.slug)})
|
|
11468
11685
|
`),
|
|
11469
|
-
process.stdout.write(` ${a.gray(
|
|
11686
|
+
process.stdout.write(` ${a.gray(i.description)}
|
|
11470
11687
|
|
|
11471
11688
|
`),
|
|
11472
11689
|
process.stdout.write(`${a.bold('Metadata:')}
|
|
11473
11690
|
`),
|
|
11474
|
-
process.stdout.write(` Category: ${a.yellow(
|
|
11691
|
+
process.stdout.write(` Category: ${a.yellow(i.category)}
|
|
11475
11692
|
`),
|
|
11476
|
-
process.stdout.write(` Kind: ${
|
|
11693
|
+
process.stdout.write(` Kind: ${i.kind}
|
|
11477
11694
|
`),
|
|
11478
|
-
process.stdout.write(` Vendor: ${
|
|
11695
|
+
process.stdout.write(` Vendor: ${i.vendor}
|
|
11479
11696
|
`),
|
|
11480
|
-
process.stdout.write(` Pricing: ${a.green(
|
|
11697
|
+
process.stdout.write(` Pricing: ${a.green(i.priceFormatted)}
|
|
11481
11698
|
`));
|
|
11482
|
-
for (let n of
|
|
11699
|
+
for (let n of i.priceNotes ?? [])
|
|
11483
11700
|
process.stdout.write(` ${a.dim(n)}
|
|
11484
11701
|
`);
|
|
11485
|
-
for (let n of
|
|
11486
|
-
let s = n.slug ===
|
|
11702
|
+
for (let n of Zi(i.slug, r.yourPrices)) {
|
|
11703
|
+
let s = n.slug === i.slug ? n : { ...n, label: `${n.name} \xB7 ${n.label}` };
|
|
11487
11704
|
process.stdout.write(` ${a.yellow('Your price:')} ${ut(s)}
|
|
11488
11705
|
`);
|
|
11489
11706
|
}
|
|
11490
|
-
(
|
|
11707
|
+
(r.live ||
|
|
11491
11708
|
process.stdout.write(` ${a.dim('(the price this CLI was built with: offline)')}
|
|
11492
11709
|
`),
|
|
11493
11710
|
process.stdout.write(`
|
|
11494
11711
|
`),
|
|
11495
11712
|
process.stdout.write(`${a.bold('Parameters:')}
|
|
11496
11713
|
`));
|
|
11497
|
-
for (let n of
|
|
11714
|
+
for (let n of i.parameters) {
|
|
11498
11715
|
let s = n.required ? a.red('(required)') : a.dim('(optional)'),
|
|
11499
11716
|
o = n.default !== void 0 ? a.dim(` [default: ${n.default}]`) : '';
|
|
11500
11717
|
(process.stdout
|
|
@@ -11514,7 +11731,7 @@ ${a.bold(a.cyan(r.name))} (${a.bold(r.slug)})
|
|
|
11514
11731
|
`));
|
|
11515
11732
|
}
|
|
11516
11733
|
if (
|
|
11517
|
-
(
|
|
11734
|
+
(i.parameters.some((n) => n.name === 'callback_url') ||
|
|
11518
11735
|
(process.stdout
|
|
11519
11736
|
.write(` ${a.bold('--callback-url')} ${a.yellow('<string>')} ${a.dim('(optional)')}
|
|
11520
11737
|
`),
|
|
@@ -11524,35 +11741,35 @@ ${a.bold(a.cyan(r.name))} (${a.bold(r.slug)})
|
|
|
11524
11741
|
`)),
|
|
11525
11742
|
process.stdout.write(`${a.bold('Sample CLI Usage:')}
|
|
11526
11743
|
`),
|
|
11527
|
-
|
|
11744
|
+
i.category === 'Video')
|
|
11528
11745
|
)
|
|
11529
11746
|
process.stdout
|
|
11530
|
-
.write(` ${a.cyan(`tein run ${
|
|
11747
|
+
.write(` ${a.cyan(`tein run ${i.slug} --prompt "Cinematic camera drone shot of a coastline" --aspect-ratio 16:9 --duration 5 -o output.mp4`)}
|
|
11531
11748
|
|
|
11532
11749
|
`);
|
|
11533
|
-
else if (
|
|
11534
|
-
let n =
|
|
11750
|
+
else if (i.category === 'Image') {
|
|
11751
|
+
let n = i.parameters.some((s) => s.name === 'aspect_ratio') ? ' --aspect-ratio 16:9' : '';
|
|
11535
11752
|
process.stdout
|
|
11536
|
-
.write(` ${a.cyan(`tein run ${
|
|
11753
|
+
.write(` ${a.cyan(`tein run ${i.slug} --prompt "Cyberpunk city in the rain, 8k render"${n} -o output.png`)}
|
|
11537
11754
|
|
|
11538
11755
|
`);
|
|
11539
11756
|
} else
|
|
11540
|
-
|
|
11757
|
+
i.category === 'Audio'
|
|
11541
11758
|
? process.stdout
|
|
11542
|
-
.write(` ${a.cyan(`tein run ${
|
|
11759
|
+
.write(` ${a.cyan(`tein run ${i.slug} --prompt "Hello world from Tein AI" --speaker en_female_warm -o speech.wav`)}
|
|
11543
11760
|
|
|
11544
11761
|
`)
|
|
11545
11762
|
: process.stdout
|
|
11546
|
-
.write(` ${a.cyan(`tein run ${
|
|
11763
|
+
.write(` ${a.cyan(`tein run ${i.slug} --prompt "Explain quantum computing in simple terms"`)}
|
|
11547
11764
|
|
|
11548
11765
|
`);
|
|
11549
11766
|
}
|
|
11550
|
-
var
|
|
11767
|
+
var ir = M(require('node:path'));
|
|
11551
11768
|
R();
|
|
11552
|
-
async function
|
|
11553
|
-
let
|
|
11554
|
-
|
|
11555
|
-
(
|
|
11769
|
+
async function rr(e, t) {
|
|
11770
|
+
let i = _(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
11771
|
+
r = x(typeof t.api_url == 'string' ? t.api_url : void 0);
|
|
11772
|
+
(i ||
|
|
11556
11773
|
(process.stderr.write(`${a.red('Error:')} Authentication required.
|
|
11557
11774
|
`),
|
|
11558
11775
|
process.stderr
|
|
@@ -11568,8 +11785,8 @@ async function ti(e, t) {
|
|
|
11568
11785
|
let n = !!t.json,
|
|
11569
11786
|
s = !!t.wait,
|
|
11570
11787
|
o = typeof t.output == 'string' ? t.output : void 0,
|
|
11571
|
-
p = new K(
|
|
11572
|
-
l = new
|
|
11788
|
+
p = new K(i, r),
|
|
11789
|
+
l = new C(`Checking status of ${a.bold(e)}...`);
|
|
11573
11790
|
n || l.start();
|
|
11574
11791
|
let c;
|
|
11575
11792
|
try {
|
|
@@ -11642,9 +11859,9 @@ ${a.bold('Outputs:')}
|
|
|
11642
11859
|
`),
|
|
11643
11860
|
o)
|
|
11644
11861
|
) {
|
|
11645
|
-
let u = new
|
|
11862
|
+
let u = new C(`Downloading output to ${o}...`).start();
|
|
11646
11863
|
try {
|
|
11647
|
-
(await p.downloadOutput(d.url,
|
|
11864
|
+
(await p.downloadOutput(d.url, ir.default.resolve(process.cwd(), o)),
|
|
11648
11865
|
u.succeed(`Saved to ${a.bold(o)}`));
|
|
11649
11866
|
} catch (m) {
|
|
11650
11867
|
u.fail(`Failed to download: ${m instanceof Error ? m.message : m}`);
|
|
@@ -11662,11 +11879,11 @@ ${d.text}
|
|
|
11662
11879
|
var ft = M(require('node:fs')),
|
|
11663
11880
|
gt = M(require('node:path'));
|
|
11664
11881
|
R();
|
|
11665
|
-
async function
|
|
11666
|
-
let
|
|
11667
|
-
|
|
11882
|
+
async function ar(e, t = {}) {
|
|
11883
|
+
let i = _(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
11884
|
+
r = x(typeof t.api_url == 'string' ? t.api_url : void 0),
|
|
11668
11885
|
n = !!t.json;
|
|
11669
|
-
(
|
|
11886
|
+
(i ||
|
|
11670
11887
|
(process.stderr.write(`${a.red('Error:')} Authentication required.
|
|
11671
11888
|
`),
|
|
11672
11889
|
process.stderr
|
|
@@ -11686,8 +11903,8 @@ async function ri(e, t = {}) {
|
|
|
11686
11903
|
process.exit(1));
|
|
11687
11904
|
let o = gt.default.basename(s),
|
|
11688
11905
|
l = ft.default.readFileSync(s).toString('base64'),
|
|
11689
|
-
c = new K(
|
|
11690
|
-
d = new
|
|
11906
|
+
c = new K(i, r),
|
|
11907
|
+
d = new C(`Uploading ${a.bold(o)} to Tein AI CDN...`);
|
|
11691
11908
|
n || d.start();
|
|
11692
11909
|
try {
|
|
11693
11910
|
let u = await c.uploadAsset(l);
|
|
@@ -11727,9 +11944,9 @@ ${a.bold('CDN URL:')} ${a.green(u.url)}
|
|
|
11727
11944
|
}
|
|
11728
11945
|
}
|
|
11729
11946
|
oe();
|
|
11730
|
-
|
|
11947
|
+
re();
|
|
11731
11948
|
Fe();
|
|
11732
|
-
function
|
|
11949
|
+
function xr() {
|
|
11733
11950
|
process.stdout.write(`
|
|
11734
11951
|
${a.bold(a.cyan('Tein AI CLI'))} - Official Command-Line Interface for Tein AI models
|
|
11735
11952
|
|
|
@@ -11811,11 +12028,11 @@ ${a.bold('EXAMPLES:')}
|
|
|
11811
12028
|
|
|
11812
12029
|
`);
|
|
11813
12030
|
}
|
|
11814
|
-
async function
|
|
12031
|
+
async function Cn() {
|
|
11815
12032
|
let e = process.argv.slice(2),
|
|
11816
|
-
t =
|
|
12033
|
+
t = Vi(e);
|
|
11817
12034
|
if (t.flags.has('help') || t.options.help || t.command === 'help') {
|
|
11818
|
-
|
|
12035
|
+
xr();
|
|
11819
12036
|
return;
|
|
11820
12037
|
}
|
|
11821
12038
|
if (t.flags.has('version') || t.options.version || t.command === 'version') {
|
|
@@ -11842,15 +12059,15 @@ async function Mn() {
|
|
|
11842
12059
|
}
|
|
11843
12060
|
case 'models':
|
|
11844
12061
|
case 'list': {
|
|
11845
|
-
await
|
|
12062
|
+
await er(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0);
|
|
11846
12063
|
break;
|
|
11847
12064
|
}
|
|
11848
12065
|
case 'pricing':
|
|
11849
12066
|
case 'prices': {
|
|
11850
|
-
let
|
|
11851
|
-
|
|
11852
|
-
await
|
|
11853
|
-
model:
|
|
12067
|
+
let i = t.options.model,
|
|
12068
|
+
r = t.subcommand || (typeof i == 'string' ? i : void 0);
|
|
12069
|
+
await Xi({
|
|
12070
|
+
model: r,
|
|
11854
12071
|
json: !!t.options.json,
|
|
11855
12072
|
apiUrl: typeof t.options.api_url == 'string' ? t.options.api_url : void 0,
|
|
11856
12073
|
});
|
|
@@ -11864,41 +12081,41 @@ async function Mn() {
|
|
|
11864
12081
|
process.stderr.write(`Usage: ${a.cyan('tein info <model-slug>')}
|
|
11865
12082
|
`),
|
|
11866
12083
|
process.exit(1)),
|
|
11867
|
-
await
|
|
12084
|
+
await tr(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0));
|
|
11868
12085
|
break;
|
|
11869
12086
|
}
|
|
11870
12087
|
case 'upload': {
|
|
11871
|
-
let
|
|
11872
|
-
await
|
|
12088
|
+
let i = t.subcommand || '';
|
|
12089
|
+
await ar(i, t.options);
|
|
11873
12090
|
break;
|
|
11874
12091
|
}
|
|
11875
12092
|
case 'run':
|
|
11876
12093
|
case 'generate': {
|
|
11877
|
-
let
|
|
11878
|
-
await pt(
|
|
12094
|
+
let i = t.subcommand || '';
|
|
12095
|
+
await pt(i, t.options);
|
|
11879
12096
|
break;
|
|
11880
12097
|
}
|
|
11881
12098
|
case 'status': {
|
|
11882
|
-
let
|
|
11883
|
-
await
|
|
12099
|
+
let i = t.subcommand || '';
|
|
12100
|
+
await rr(i, t.options);
|
|
11884
12101
|
break;
|
|
11885
12102
|
}
|
|
11886
12103
|
case 'balance': {
|
|
11887
|
-
await
|
|
12104
|
+
await Bi(t.options);
|
|
11888
12105
|
break;
|
|
11889
12106
|
}
|
|
11890
12107
|
case 'usage': {
|
|
11891
|
-
await
|
|
12108
|
+
await zi(t.options);
|
|
11892
12109
|
break;
|
|
11893
12110
|
}
|
|
11894
12111
|
case 'transactions':
|
|
11895
12112
|
case 'history': {
|
|
11896
|
-
await
|
|
12113
|
+
await Wi(t.options);
|
|
11897
12114
|
break;
|
|
11898
12115
|
}
|
|
11899
12116
|
case 'mcp': {
|
|
11900
|
-
let { startStdioServer:
|
|
11901
|
-
await
|
|
12117
|
+
let { startStdioServer: i } = await Promise.resolve().then(() => (wr(), br));
|
|
12118
|
+
await i();
|
|
11902
12119
|
break;
|
|
11903
12120
|
}
|
|
11904
12121
|
default: {
|
|
@@ -11913,12 +12130,12 @@ Run ${a.cyan('tein --help')} for the commands, or ${a.cyan('tein models')} for t
|
|
|
11913
12130
|
await pt(t.command, t.options));
|
|
11914
12131
|
return;
|
|
11915
12132
|
}
|
|
11916
|
-
|
|
12133
|
+
xr();
|
|
11917
12134
|
break;
|
|
11918
12135
|
}
|
|
11919
12136
|
}
|
|
11920
12137
|
}
|
|
11921
|
-
|
|
12138
|
+
Cn().catch((e) => {
|
|
11922
12139
|
(e instanceof b &&
|
|
11923
12140
|
(process.stderr.write(`
|
|
11924
12141
|
${a.red('Error:')} ${E(e).join(`
|