@teinai/cli 1.1.31 → 1.1.33
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/README.md +34 -0
- package/index.js +1737 -1173
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,109 +1,134 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
if (
|
|
3
|
+
var Va = Object.create;
|
|
4
|
+
var ve = Object.defineProperty;
|
|
5
|
+
var Na = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var Ua = Object.getOwnPropertyNames;
|
|
7
|
+
var Fa = Object.getPrototypeOf,
|
|
8
|
+
Ba = Object.prototype.hasOwnProperty;
|
|
9
|
+
var h = (e, t, a) => () => {
|
|
10
|
+
if (a) throw a[0];
|
|
11
11
|
try {
|
|
12
12
|
return (e && (t = e((e = 0))), t);
|
|
13
13
|
} catch (i) {
|
|
14
|
-
throw ((
|
|
14
|
+
throw ((a = [i]), i);
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
var
|
|
18
|
-
for (var
|
|
17
|
+
var ja = (e, t) => {
|
|
18
|
+
for (var a in t) ve(e, a, { get: t[a], enumerable: !0 });
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
Ga = (e, t, a, i) => {
|
|
21
21
|
if ((t && typeof t == 'object') || typeof t == 'function')
|
|
22
|
-
for (let n of
|
|
23
|
-
!
|
|
24
|
-
n !==
|
|
25
|
-
|
|
22
|
+
for (let n of Ua(t))
|
|
23
|
+
!Ba.call(e, n) &&
|
|
24
|
+
n !== a &&
|
|
25
|
+
ve(e, n, { get: () => t[n], enumerable: !(i = Na(t, n)) || i.enumerable });
|
|
26
26
|
return e;
|
|
27
27
|
};
|
|
28
|
-
var
|
|
29
|
-
(
|
|
30
|
-
|
|
28
|
+
var T = (e, t, a) => (
|
|
29
|
+
(a = e != null ? Va(Fa(e)) : {}),
|
|
30
|
+
Ga(t || !e || !e.__esModule ? ve(a, 'default', { value: e, enumerable: !0 }) : a, e)
|
|
31
31
|
);
|
|
32
|
-
function
|
|
32
|
+
function Ja(e) {
|
|
33
|
+
for (let t of e)
|
|
34
|
+
try {
|
|
35
|
+
let a = JSON.parse(dt.default.readFileSync(t, 'utf8'));
|
|
36
|
+
if (a.name === '@teinai/cli' && typeof a.version == 'string' && a.version.trim())
|
|
37
|
+
return a.version.trim();
|
|
38
|
+
} catch {}
|
|
39
|
+
return za;
|
|
40
|
+
}
|
|
41
|
+
function Wa() {
|
|
42
|
+
let e = typeof __dirname == 'string' ? __dirname : process.cwd();
|
|
43
|
+
return [
|
|
44
|
+
Te.default.join(e, 'package.json'),
|
|
45
|
+
Te.default.join(e, '..', '..', 'cli-package', 'package.json'),
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
var dt,
|
|
49
|
+
Te,
|
|
50
|
+
za,
|
|
51
|
+
F,
|
|
52
|
+
re = h(() => {
|
|
53
|
+
'use strict';
|
|
54
|
+
((dt = T(require('node:fs'))), (Te = T(require('node:path'))), (za = '0.0.0-dev'));
|
|
55
|
+
F = Ja(Wa());
|
|
56
|
+
});
|
|
57
|
+
function j() {
|
|
33
58
|
try {
|
|
34
|
-
if (
|
|
35
|
-
let e =
|
|
59
|
+
if (R.default.existsSync(B)) {
|
|
60
|
+
let e = R.default.readFileSync(B, 'utf-8');
|
|
36
61
|
return JSON.parse(e);
|
|
37
62
|
}
|
|
38
63
|
} catch {}
|
|
39
64
|
return {};
|
|
40
65
|
}
|
|
41
|
-
function
|
|
66
|
+
function Ke(e) {
|
|
42
67
|
try {
|
|
43
|
-
|
|
44
|
-
let
|
|
45
|
-
(
|
|
46
|
-
|
|
47
|
-
|
|
68
|
+
R.default.existsSync(se) || R.default.mkdirSync(se, { recursive: !0, mode: 448 });
|
|
69
|
+
let a = { ...j(), ...e };
|
|
70
|
+
(R.default.writeFileSync(B, JSON.stringify(a, null, 2), { encoding: 'utf-8', mode: 384 }),
|
|
71
|
+
R.default.chmodSync(se, 448),
|
|
72
|
+
R.default.chmodSync(B, 384));
|
|
48
73
|
} catch (t) {
|
|
49
|
-
throw new Error(`Failed to save config to ${
|
|
74
|
+
throw new Error(`Failed to save config to ${B}: ${t}`);
|
|
50
75
|
}
|
|
51
76
|
}
|
|
52
|
-
function
|
|
77
|
+
function S(e) {
|
|
53
78
|
if (e && e.trim()) return e.trim();
|
|
54
79
|
let t = process.env.TEIN_API_KEY || process.env.TEIN_KEY;
|
|
55
80
|
if (t && t.trim()) return t.trim();
|
|
56
|
-
let
|
|
57
|
-
return
|
|
81
|
+
let a = j();
|
|
82
|
+
return a.apiKey && a.apiKey.trim() ? a.apiKey.trim() : '';
|
|
58
83
|
}
|
|
59
|
-
function
|
|
84
|
+
function w(e) {
|
|
60
85
|
if (e && e.trim()) return e.trim().replace(/\/+$/, '');
|
|
61
86
|
let t = process.env.TEIN_API_URL;
|
|
62
87
|
if (t && t.trim()) return t.trim().replace(/\/+$/, '');
|
|
63
|
-
let
|
|
64
|
-
return
|
|
65
|
-
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
68
|
-
}
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
88
|
+
let a = j();
|
|
89
|
+
return a.apiUrl && a.apiUrl.trim() ? a.apiUrl.trim().replace(/\/+$/, '') : 'https://api.tein.ai';
|
|
90
|
+
}
|
|
91
|
+
function oe() {
|
|
92
|
+
return B;
|
|
93
|
+
}
|
|
94
|
+
var R,
|
|
95
|
+
gt,
|
|
96
|
+
Me,
|
|
97
|
+
se,
|
|
98
|
+
B,
|
|
99
|
+
$ = h(() => {
|
|
75
100
|
'use strict';
|
|
76
|
-
((
|
|
77
|
-
(
|
|
78
|
-
(
|
|
79
|
-
(
|
|
80
|
-
(
|
|
101
|
+
((R = T(require('node:fs'))),
|
|
102
|
+
(gt = T(require('node:os'))),
|
|
103
|
+
(Me = T(require('node:path'))),
|
|
104
|
+
(se = Me.default.join(gt.default.homedir(), '.tein')),
|
|
105
|
+
(B = Me.default.join(se, 'config.json')));
|
|
81
106
|
});
|
|
82
|
-
var
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
107
|
+
var ei,
|
|
108
|
+
ht,
|
|
109
|
+
yt,
|
|
110
|
+
bt = h(() => {
|
|
86
111
|
'use strict';
|
|
87
|
-
((
|
|
88
|
-
(
|
|
89
|
-
(
|
|
112
|
+
((ei = ['1:1', '16:9', '9:16', '21:9', '3:2', '2:3', '4:3', '3:4', '4:5', '5:4']),
|
|
113
|
+
(ht = [...ei, 'auto']),
|
|
114
|
+
(yt =
|
|
90
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.'));
|
|
91
116
|
});
|
|
92
|
-
var
|
|
93
|
-
|
|
117
|
+
var J,
|
|
118
|
+
Ce = h(() => {
|
|
94
119
|
'use strict';
|
|
95
|
-
|
|
120
|
+
J = new Set(['nano-banana-2.1', 'seedance-2-lite', 'seedance-2-5-lite']);
|
|
96
121
|
});
|
|
97
|
-
function
|
|
122
|
+
function le(e) {
|
|
98
123
|
return !1;
|
|
99
124
|
}
|
|
100
|
-
var
|
|
125
|
+
var kt = h(() => {
|
|
101
126
|
'use strict';
|
|
102
127
|
});
|
|
103
|
-
var
|
|
104
|
-
|
|
128
|
+
var pe,
|
|
129
|
+
wt = h(() => {
|
|
105
130
|
'use strict';
|
|
106
|
-
|
|
131
|
+
pe = {
|
|
107
132
|
source: 'TEIN Price Board',
|
|
108
133
|
checked: '17 Sep 2026',
|
|
109
134
|
generated: '2026-10-01',
|
|
@@ -137,9 +162,14 @@ var oe,
|
|
|
137
162
|
},
|
|
138
163
|
{ slug: 'seedream', name: 'Seedream', models: ['seedream-5-pro', 'seedream-5-5'] },
|
|
139
164
|
{ slug: 'seed', name: 'Seed', models: ['seed-audio-1-0', 'seed-2-1-turbo'] },
|
|
140
|
-
{ slug: 'wan', name: 'Wan', models: ['wan-3-0', 'wan-3-0-prime'] },
|
|
165
|
+
{ slug: 'wan', name: 'Wan', models: ['wan-3-0', 'wan-3-0-prime', 'wan-2-5-image'] },
|
|
141
166
|
{ slug: 'happy-horse', name: 'HappyHorse', models: ['happy-horse-1-1', 'happy-horse-1-0'] },
|
|
142
167
|
{ slug: 'minimax', name: 'Hailuo', models: ['minimax-h3', 'minimax-h3-turbo'] },
|
|
168
|
+
{
|
|
169
|
+
slug: 'minimax-image',
|
|
170
|
+
name: 'Hailuo Image',
|
|
171
|
+
models: ['minimax-h3-image', 'minimax-h3-image-highspeed'],
|
|
172
|
+
},
|
|
143
173
|
{ slug: 'qwen', name: 'Qwen', models: ['qwen-3', 'qwen-3-pro'] },
|
|
144
174
|
{
|
|
145
175
|
slug: 'enhancor-skin-fix',
|
|
@@ -1480,6 +1510,92 @@ var oe,
|
|
|
1480
1510
|
axes: { resolution: ['1K', '1.5K', '2K'] },
|
|
1481
1511
|
from: { variant: '1k' },
|
|
1482
1512
|
},
|
|
1513
|
+
{
|
|
1514
|
+
slug: 'minimax-h3-image',
|
|
1515
|
+
name: 'Hailuo 3 Image',
|
|
1516
|
+
family: 'minimax-image',
|
|
1517
|
+
vendor: 'MiniMax',
|
|
1518
|
+
desc: "MiniMax's image model: detailed text-to-image and image editing from up to 16 reference images, at 1K, 2K or 4K (up to about 16 megapixels), with built-in prompt enhancement. Each reference image is billed.",
|
|
1519
|
+
kind: 'image',
|
|
1520
|
+
unit: '/img',
|
|
1521
|
+
api: { model: 'minimax-h3-image' },
|
|
1522
|
+
variants: [
|
|
1523
|
+
{
|
|
1524
|
+
id: '1k',
|
|
1525
|
+
price: { starter: 0.0274, plus: 0.0261, scale: 0.0243 },
|
|
1526
|
+
label: '1K',
|
|
1527
|
+
resolution: '1K',
|
|
1528
|
+
},
|
|
1529
|
+
{
|
|
1530
|
+
id: '2k',
|
|
1531
|
+
price: { starter: 0.0274, plus: 0.0261, scale: 0.0243 },
|
|
1532
|
+
label: '2K',
|
|
1533
|
+
resolution: '2K',
|
|
1534
|
+
},
|
|
1535
|
+
{
|
|
1536
|
+
id: '4k',
|
|
1537
|
+
price: { starter: 0.0845, plus: 0.0803, scale: 0.0751 },
|
|
1538
|
+
label: '4K',
|
|
1539
|
+
resolution: '4K',
|
|
1540
|
+
},
|
|
1541
|
+
],
|
|
1542
|
+
unfiltered: null,
|
|
1543
|
+
priority: null,
|
|
1544
|
+
draft: null,
|
|
1545
|
+
addons: [
|
|
1546
|
+
{
|
|
1547
|
+
id: 'image-input',
|
|
1548
|
+
price: { starter: 0.0079, plus: 0.0076, scale: 0.007 },
|
|
1549
|
+
label: 'Each reference image',
|
|
1550
|
+
unit: '/input image',
|
|
1551
|
+
},
|
|
1552
|
+
],
|
|
1553
|
+
axes: { resolution: ['1K', '2K', '4K'] },
|
|
1554
|
+
from: { variant: '2k' },
|
|
1555
|
+
},
|
|
1556
|
+
{
|
|
1557
|
+
slug: 'minimax-h3-image-highspeed',
|
|
1558
|
+
name: 'Hailuo 3 Image Highspeed',
|
|
1559
|
+
family: 'minimax-image',
|
|
1560
|
+
vendor: 'MiniMax',
|
|
1561
|
+
desc: 'The same Hailuo 3 Image output, generated faster: text-to-image and image editing from up to 16 reference images, at 1K, 2K or 4K. Each reference image is billed.',
|
|
1562
|
+
kind: 'image',
|
|
1563
|
+
unit: '/img',
|
|
1564
|
+
api: { model: 'minimax-h3-image-highspeed' },
|
|
1565
|
+
variants: [
|
|
1566
|
+
{
|
|
1567
|
+
id: '1k',
|
|
1568
|
+
price: { starter: 0.0464, plus: 0.0441, scale: 0.0412 },
|
|
1569
|
+
label: '1K',
|
|
1570
|
+
resolution: '1K',
|
|
1571
|
+
},
|
|
1572
|
+
{
|
|
1573
|
+
id: '2k',
|
|
1574
|
+
price: { starter: 0.0464, plus: 0.0441, scale: 0.0412 },
|
|
1575
|
+
label: '2K',
|
|
1576
|
+
resolution: '2K',
|
|
1577
|
+
},
|
|
1578
|
+
{
|
|
1579
|
+
id: '4k',
|
|
1580
|
+
price: { starter: 0.1607, plus: 0.1527, scale: 0.1428 },
|
|
1581
|
+
label: '4K',
|
|
1582
|
+
resolution: '4K',
|
|
1583
|
+
},
|
|
1584
|
+
],
|
|
1585
|
+
unfiltered: null,
|
|
1586
|
+
priority: null,
|
|
1587
|
+
draft: null,
|
|
1588
|
+
addons: [
|
|
1589
|
+
{
|
|
1590
|
+
id: 'image-input',
|
|
1591
|
+
price: { starter: 0.0129, plus: 0.0123, scale: 0.0114 },
|
|
1592
|
+
label: 'Each reference image',
|
|
1593
|
+
unit: '/input image',
|
|
1594
|
+
},
|
|
1595
|
+
],
|
|
1596
|
+
axes: { resolution: ['1K', '2K', '4K'] },
|
|
1597
|
+
from: { variant: '2k' },
|
|
1598
|
+
},
|
|
1483
1599
|
{
|
|
1484
1600
|
slug: 'seed-audio-1-0',
|
|
1485
1601
|
name: 'Seed Audio 1.0',
|
|
@@ -1824,6 +1940,29 @@ var oe,
|
|
|
1824
1940
|
axes: { resolution: ['1K', '2K'] },
|
|
1825
1941
|
from: { variant: '1k' },
|
|
1826
1942
|
},
|
|
1943
|
+
{
|
|
1944
|
+
slug: 'wan-2-5-image',
|
|
1945
|
+
name: 'Wan 2.5 Image',
|
|
1946
|
+
family: 'wan',
|
|
1947
|
+
vendor: 'Alibaba',
|
|
1948
|
+
desc: "Alibaba's Wan 2.5 Image \u2014 text-to-image and image editing from one or two input images, up to 4 images per run, with Creative mode.",
|
|
1949
|
+
kind: 'image',
|
|
1950
|
+
unit: '/img',
|
|
1951
|
+
api: { model: 'wan-2-5-image' },
|
|
1952
|
+
variants: [
|
|
1953
|
+
{
|
|
1954
|
+
id: 'standard',
|
|
1955
|
+
price: { starter: 0.045, plus: 0.0427, scale: 0.0382 },
|
|
1956
|
+
label: 'Standard',
|
|
1957
|
+
unfiltered: { starter: 0.0472, plus: 0.0448, scale: 0.0401 },
|
|
1958
|
+
},
|
|
1959
|
+
],
|
|
1960
|
+
unfiltered: 0.05,
|
|
1961
|
+
priority: null,
|
|
1962
|
+
draft: null,
|
|
1963
|
+
axes: {},
|
|
1964
|
+
from: { variant: 'standard' },
|
|
1965
|
+
},
|
|
1827
1966
|
{
|
|
1828
1967
|
slug: 'nano-banana-2',
|
|
1829
1968
|
name: 'Nano Banana 2',
|
|
@@ -6028,11 +6167,11 @@ var oe,
|
|
|
6028
6167
|
],
|
|
6029
6168
|
};
|
|
6030
6169
|
});
|
|
6031
|
-
var
|
|
6032
|
-
|
|
6033
|
-
|
|
6170
|
+
var de,
|
|
6171
|
+
xt,
|
|
6172
|
+
Ee = h(() => {
|
|
6034
6173
|
'use strict';
|
|
6035
|
-
((
|
|
6174
|
+
((de = [
|
|
6036
6175
|
{
|
|
6037
6176
|
slug: 'tein-video-upscaler',
|
|
6038
6177
|
name: 'Tein Video Upscaler',
|
|
@@ -6107,108 +6246,108 @@ var le,
|
|
|
6107
6246
|
from: { variant: 'swap' },
|
|
6108
6247
|
},
|
|
6109
6248
|
]),
|
|
6110
|
-
(
|
|
6249
|
+
(xt = [{ slug: 'tein-labs', name: 'Tein Labs', models: ['tein-video-upscaler', 'doppel'] }]));
|
|
6111
6250
|
});
|
|
6112
|
-
function
|
|
6251
|
+
function qe(e, t) {
|
|
6113
6252
|
return `${e.trim().toLowerCase()}|${(t ?? '').trim().toLowerCase()}`;
|
|
6114
6253
|
}
|
|
6115
|
-
function
|
|
6254
|
+
function ii(e, t) {
|
|
6116
6255
|
if (e === 'seedance-2-mini') return 'mini';
|
|
6117
6256
|
if (e !== 'seedance-2') return;
|
|
6118
|
-
let
|
|
6119
|
-
return
|
|
6120
|
-
?
|
|
6257
|
+
let a = typeof t?.quality == 'string' ? t.quality.trim().toLowerCase() : '';
|
|
6258
|
+
return a === 'fast' || a === 'mini' || a === 'standard'
|
|
6259
|
+
? a
|
|
6121
6260
|
: t?.fast_mode === !0
|
|
6122
6261
|
? 'fast'
|
|
6123
6262
|
: 'standard';
|
|
6124
6263
|
}
|
|
6125
|
-
function
|
|
6126
|
-
let
|
|
6264
|
+
function ri(e, t) {
|
|
6265
|
+
let a = e
|
|
6127
6266
|
.trim()
|
|
6128
6267
|
.toLowerCase()
|
|
6129
6268
|
.replace(/-(?:unfiltered|uncensored)$/, '');
|
|
6130
|
-
if (
|
|
6131
|
-
let n =
|
|
6132
|
-
s =
|
|
6269
|
+
if (a === 'seedance-2' || a === 'seedance-2-mini') {
|
|
6270
|
+
let n = ii(a, t),
|
|
6271
|
+
s = $e.get(qe('seedance-2', n));
|
|
6133
6272
|
return s ? s.slug : null;
|
|
6134
6273
|
}
|
|
6135
|
-
let i =
|
|
6274
|
+
let i = ce.get(a) ?? $e.get(qe(a));
|
|
6136
6275
|
return i ? i.slug : null;
|
|
6137
6276
|
}
|
|
6138
|
-
function
|
|
6139
|
-
return
|
|
6277
|
+
function si(e, t) {
|
|
6278
|
+
return ce.has(e) && !(ni.has(e) && t) ? e : ri(e, t);
|
|
6140
6279
|
}
|
|
6141
|
-
function
|
|
6142
|
-
let
|
|
6143
|
-
return
|
|
6280
|
+
function W(e, t) {
|
|
6281
|
+
let a = si(e, t);
|
|
6282
|
+
return a ? (ce.get(a) ?? null) : null;
|
|
6144
6283
|
}
|
|
6145
|
-
function
|
|
6146
|
-
return
|
|
6284
|
+
function ue() {
|
|
6285
|
+
return vt;
|
|
6147
6286
|
}
|
|
6148
|
-
var
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6287
|
+
var Pt,
|
|
6288
|
+
It,
|
|
6289
|
+
vt,
|
|
6290
|
+
ti,
|
|
6291
|
+
ce,
|
|
6292
|
+
$e,
|
|
6293
|
+
_t,
|
|
6294
|
+
ai,
|
|
6295
|
+
Ae,
|
|
6296
|
+
ni,
|
|
6297
|
+
G = h(() => {
|
|
6159
6298
|
'use strict';
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
((
|
|
6164
|
-
...
|
|
6165
|
-
families:
|
|
6166
|
-
models:
|
|
6299
|
+
kt();
|
|
6300
|
+
wt();
|
|
6301
|
+
Ee();
|
|
6302
|
+
((Pt = {
|
|
6303
|
+
...pe,
|
|
6304
|
+
families: pe.families.map((e) => ({ ...e, models: e.models.filter((t) => !le(t)) })),
|
|
6305
|
+
models: pe.models.filter((e) => !le(e.slug)),
|
|
6167
6306
|
}),
|
|
6168
|
-
(
|
|
6169
|
-
(
|
|
6170
|
-
(
|
|
6171
|
-
...
|
|
6172
|
-
...
|
|
6173
|
-
.map((e) => ({ ...e, models:
|
|
6307
|
+
(It = de.filter((e) => !le(e.slug))),
|
|
6308
|
+
(vt = [...Pt.models, ...It]),
|
|
6309
|
+
(ti = [
|
|
6310
|
+
...Pt.families,
|
|
6311
|
+
...xt
|
|
6312
|
+
.map((e) => ({ ...e, models: It.filter((t) => t.family === e.slug).map((t) => t.slug) }))
|
|
6174
6313
|
.filter((e) => e.models.length > 0),
|
|
6175
6314
|
]),
|
|
6176
|
-
(
|
|
6177
|
-
(
|
|
6178
|
-
(
|
|
6179
|
-
(
|
|
6180
|
-
(
|
|
6181
|
-
for (let e of
|
|
6182
|
-
(
|
|
6183
|
-
for (let t of e.variants)
|
|
6315
|
+
(ce = new Map()),
|
|
6316
|
+
($e = new Map()),
|
|
6317
|
+
(_t = new Map()),
|
|
6318
|
+
(ai = new Map()),
|
|
6319
|
+
(Ae = new Map()));
|
|
6320
|
+
for (let e of vt) {
|
|
6321
|
+
(ce.set(e.slug, e), $e.set(qe(e.api.model, e.api.quality), e));
|
|
6322
|
+
for (let t of e.variants) _t.set(`${e.slug}/${t.id}`, { model: e, variant: t, edit: !1 });
|
|
6184
6323
|
for (let t of e.editVariants ?? [])
|
|
6185
|
-
|
|
6186
|
-
for (let t of e.addons ?? [])
|
|
6187
|
-
|
|
6324
|
+
_t.set(`${e.slug}/edit/${t.id}`, { model: e, variant: t, edit: !0 });
|
|
6325
|
+
for (let t of e.addons ?? []) ai.set(`${e.slug}/addon/${t.id}`, { model: e, addon: t });
|
|
6326
|
+
Ae.set(e.slug, e.family);
|
|
6188
6327
|
}
|
|
6189
|
-
for (let e of
|
|
6190
|
-
|
|
6328
|
+
for (let e of ti) for (let t of e.models) Ae.has(t) || Ae.set(t, e.slug);
|
|
6329
|
+
ni = new Set(['seedance-2']);
|
|
6191
6330
|
});
|
|
6192
|
-
function
|
|
6331
|
+
function me(e) {
|
|
6193
6332
|
let t = e.from?.variant;
|
|
6194
|
-
return (t && e.variants.find((
|
|
6333
|
+
return (t && e.variants.find((a) => a.id === t)) || e.variants[0];
|
|
6195
6334
|
}
|
|
6196
|
-
function
|
|
6335
|
+
function Oe(e) {
|
|
6197
6336
|
if (e.endpoints?.length)
|
|
6198
|
-
return e.editVariants?.length && e.endpoints.some((t) => t.id ===
|
|
6199
|
-
?
|
|
6337
|
+
return e.editVariants?.length && e.endpoints.some((t) => t.id === Tt)
|
|
6338
|
+
? Tt
|
|
6200
6339
|
: (e.defaultEndpoint ?? e.endpoints[0].id);
|
|
6201
6340
|
}
|
|
6202
|
-
var
|
|
6203
|
-
|
|
6341
|
+
var Tt,
|
|
6342
|
+
Re = h(() => {
|
|
6204
6343
|
'use strict';
|
|
6205
|
-
|
|
6206
|
-
|
|
6344
|
+
G();
|
|
6345
|
+
Tt = 'dynamic';
|
|
6207
6346
|
});
|
|
6208
|
-
var
|
|
6209
|
-
|
|
6347
|
+
var fe,
|
|
6348
|
+
Le = h(() => {
|
|
6210
6349
|
'use strict';
|
|
6211
|
-
|
|
6350
|
+
fe = {
|
|
6212
6351
|
'gemini-3-8-flash': 'gemini-3.8-flash',
|
|
6213
6352
|
'gemini-3-7-flash': 'gemini-3.7-flash',
|
|
6214
6353
|
'gemini-3-1-pro-preview': 'gemini-3.1-pro-preview',
|
|
@@ -6218,29 +6357,29 @@ var ue,
|
|
|
6218
6357
|
'gpt-image-2-6-sunburst': 'gpt-image-2.6-sunburst',
|
|
6219
6358
|
};
|
|
6220
6359
|
});
|
|
6221
|
-
var
|
|
6360
|
+
var Mt = h(() => {
|
|
6222
6361
|
'use strict';
|
|
6223
6362
|
});
|
|
6224
|
-
function
|
|
6225
|
-
return typeof t == 'string' && (
|
|
6363
|
+
function Kt(e, t) {
|
|
6364
|
+
return typeof t == 'string' && (oi[e]?.includes(t) ?? !1);
|
|
6226
6365
|
}
|
|
6227
|
-
var
|
|
6228
|
-
|
|
6366
|
+
var oi,
|
|
6367
|
+
St = h(() => {
|
|
6229
6368
|
'use strict';
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6369
|
+
G();
|
|
6370
|
+
Re();
|
|
6371
|
+
Mt();
|
|
6372
|
+
oi = {};
|
|
6234
6373
|
});
|
|
6235
|
-
function
|
|
6236
|
-
return e === 'nano-banana-pro' ?
|
|
6374
|
+
function Ct(e) {
|
|
6375
|
+
return e === 'nano-banana-pro' ? li : pi;
|
|
6237
6376
|
}
|
|
6238
|
-
var
|
|
6239
|
-
|
|
6240
|
-
|
|
6377
|
+
var li,
|
|
6378
|
+
pi,
|
|
6379
|
+
Et = h(() => {
|
|
6241
6380
|
'use strict';
|
|
6242
|
-
((
|
|
6243
|
-
(
|
|
6381
|
+
((li = ['auto', '1:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9']),
|
|
6382
|
+
(pi = [
|
|
6244
6383
|
'auto',
|
|
6245
6384
|
'1:1',
|
|
6246
6385
|
'1:4',
|
|
@@ -6258,10 +6397,10 @@ var Hr,
|
|
|
6258
6397
|
'21:9',
|
|
6259
6398
|
]));
|
|
6260
6399
|
});
|
|
6261
|
-
var
|
|
6262
|
-
|
|
6400
|
+
var $t,
|
|
6401
|
+
At = h(() => {
|
|
6263
6402
|
'use strict';
|
|
6264
|
-
|
|
6403
|
+
$t = [
|
|
6265
6404
|
'prompt',
|
|
6266
6405
|
'system',
|
|
6267
6406
|
'messages',
|
|
@@ -6275,10 +6414,10 @@ var Mt,
|
|
|
6275
6414
|
'endpoint',
|
|
6276
6415
|
];
|
|
6277
6416
|
});
|
|
6278
|
-
var
|
|
6279
|
-
|
|
6417
|
+
var qt,
|
|
6418
|
+
Ot = h(() => {
|
|
6280
6419
|
'use strict';
|
|
6281
|
-
|
|
6420
|
+
qt = [
|
|
6282
6421
|
{
|
|
6283
6422
|
slug: 'claude-fable-5-1',
|
|
6284
6423
|
family: 'fable-5-1',
|
|
@@ -6347,13 +6486,13 @@ var St,
|
|
|
6347
6486
|
},
|
|
6348
6487
|
];
|
|
6349
6488
|
});
|
|
6350
|
-
function
|
|
6489
|
+
function Rt(e) {
|
|
6351
6490
|
return `$${e}`;
|
|
6352
6491
|
}
|
|
6353
|
-
function
|
|
6354
|
-
return
|
|
6492
|
+
function De(e, t, a) {
|
|
6493
|
+
return W(e)?.variants.find((n) => n.endpoint === t && n.component === a)?.price.starter ?? null;
|
|
6355
6494
|
}
|
|
6356
|
-
function
|
|
6495
|
+
function di(e) {
|
|
6357
6496
|
return [
|
|
6358
6497
|
{
|
|
6359
6498
|
name: 'prompt',
|
|
@@ -6419,13 +6558,13 @@ function Jr(e) {
|
|
|
6419
6558
|
},
|
|
6420
6559
|
];
|
|
6421
6560
|
}
|
|
6422
|
-
function
|
|
6561
|
+
function Lt() {
|
|
6423
6562
|
return Object.fromEntries(
|
|
6424
|
-
|
|
6425
|
-
let t =
|
|
6426
|
-
|
|
6427
|
-
i =
|
|
6428
|
-
n = t != null &&
|
|
6563
|
+
qt.map((e) => {
|
|
6564
|
+
let t = De(e.slug, 'cheap', 'input'),
|
|
6565
|
+
a = De(e.slug, 'cheap', 'output'),
|
|
6566
|
+
i = De(e.slug, 'stable', 'input') != null,
|
|
6567
|
+
n = t != null && a != null ? `${Rt(t)}/M in \xB7 ${Rt(a)}/M out` : '',
|
|
6429
6568
|
s = {
|
|
6430
6569
|
slug: e.slug,
|
|
6431
6570
|
name: e.name,
|
|
@@ -6436,50 +6575,50 @@ function $t() {
|
|
|
6436
6575
|
priceFormatted: n,
|
|
6437
6576
|
unit: '/M tokens',
|
|
6438
6577
|
primaryToolName: 'run_task',
|
|
6439
|
-
parameters:
|
|
6578
|
+
parameters: di(i),
|
|
6440
6579
|
};
|
|
6441
6580
|
return [e.slug, s];
|
|
6442
6581
|
}),
|
|
6443
6582
|
);
|
|
6444
6583
|
}
|
|
6445
|
-
var
|
|
6584
|
+
var Dt = h(() => {
|
|
6446
6585
|
'use strict';
|
|
6447
|
-
|
|
6448
|
-
|
|
6586
|
+
Ot();
|
|
6587
|
+
G();
|
|
6449
6588
|
});
|
|
6450
|
-
function
|
|
6451
|
-
return e ?
|
|
6589
|
+
function ge(e) {
|
|
6590
|
+
return e ? mi.get(e) : void 0;
|
|
6452
6591
|
}
|
|
6453
|
-
function
|
|
6592
|
+
function Ut(e, t) {
|
|
6454
6593
|
return !e.aspects?.length || e.sourceFramedModes?.includes(t)
|
|
6455
6594
|
? null
|
|
6456
6595
|
: e.adaptiveModes?.includes(t)
|
|
6457
6596
|
? [...e.aspects, 'adaptive']
|
|
6458
6597
|
: [...e.aspects];
|
|
6459
6598
|
}
|
|
6460
|
-
function
|
|
6599
|
+
function Ft(e, t, a) {
|
|
6461
6600
|
return e.modes.includes('motion_control')
|
|
6462
6601
|
? t === 'motion_control'
|
|
6463
|
-
? !
|
|
6464
|
-
: !
|
|
6602
|
+
? !gi.includes(a)
|
|
6603
|
+
: !fi.includes(a)
|
|
6465
6604
|
: !0;
|
|
6466
6605
|
}
|
|
6467
|
-
var
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6606
|
+
var ci,
|
|
6607
|
+
ui,
|
|
6608
|
+
Vt,
|
|
6609
|
+
bn,
|
|
6610
|
+
mi,
|
|
6611
|
+
Nt,
|
|
6612
|
+
Ve,
|
|
6613
|
+
kn,
|
|
6614
|
+
Ne,
|
|
6615
|
+
fi,
|
|
6616
|
+
gi,
|
|
6617
|
+
Ue = h(() => {
|
|
6479
6618
|
'use strict';
|
|
6480
|
-
((
|
|
6481
|
-
(
|
|
6482
|
-
(
|
|
6619
|
+
((ci = ['16:9', '9:16', '1:1', '21:9']),
|
|
6620
|
+
(ui = ['16:9', '9:16', '1:1', '4:3', '3:4', '21:9']),
|
|
6621
|
+
(Vt = [
|
|
6483
6622
|
{
|
|
6484
6623
|
slug: 'kling-v4',
|
|
6485
6624
|
kind: 'video',
|
|
@@ -6487,7 +6626,7 @@ var Wr,
|
|
|
6487
6626
|
promptMax: 26e3,
|
|
6488
6627
|
duration: { min: 3, max: 30, default: 5 },
|
|
6489
6628
|
heights: { '720p': 720, '1080p': 1080 },
|
|
6490
|
-
aspects:
|
|
6629
|
+
aspects: ci,
|
|
6491
6630
|
sourceFramedModes: ['image_to_video'],
|
|
6492
6631
|
adaptiveModes: ['multi_reference'],
|
|
6493
6632
|
fps: 24,
|
|
@@ -6526,7 +6665,7 @@ var Wr,
|
|
|
6526
6665
|
promptMax: 65535,
|
|
6527
6666
|
duration: { min: 5, max: 15, default: 5 },
|
|
6528
6667
|
heights: { '480p': 480, '768p': 768 },
|
|
6529
|
-
aspects:
|
|
6668
|
+
aspects: ui,
|
|
6530
6669
|
fps: 24,
|
|
6531
6670
|
audio: 'free',
|
|
6532
6671
|
seed: !0,
|
|
@@ -6601,10 +6740,10 @@ var Wr,
|
|
|
6601
6740
|
seed: !0,
|
|
6602
6741
|
},
|
|
6603
6742
|
]),
|
|
6604
|
-
(
|
|
6605
|
-
(
|
|
6606
|
-
((
|
|
6607
|
-
(
|
|
6743
|
+
(bn = Vt.map((e) => e.slug)),
|
|
6744
|
+
(mi = new Map(Vt.map((e) => [e.slug, e]))));
|
|
6745
|
+
((Nt = 'EXAVITQu4vr4xnSDxMaL'),
|
|
6746
|
+
(Ve = {
|
|
6608
6747
|
hpp4J3VqNfWAUOO0d1Us: 'Bella',
|
|
6609
6748
|
CwhRBWXzGAHq8TQ4Fs17: 'Roger',
|
|
6610
6749
|
EXAVITQu4vr4xnSDxMaL: 'Sarah',
|
|
@@ -6626,8 +6765,8 @@ var Wr,
|
|
|
6626
6765
|
pqHfZKP75CvOlQylNhV4: 'Bill',
|
|
6627
6766
|
pNInz6obpgDQGcFmaJgB: 'Adam',
|
|
6628
6767
|
}),
|
|
6629
|
-
(
|
|
6630
|
-
(
|
|
6768
|
+
(kn = Object.keys(Ve)),
|
|
6769
|
+
(Ne = [
|
|
6631
6770
|
'mp3_44100_128',
|
|
6632
6771
|
'mp3_22050_32',
|
|
6633
6772
|
'mp3_24000_48',
|
|
@@ -6641,8 +6780,8 @@ var Wr,
|
|
|
6641
6780
|
'opus_48000_128',
|
|
6642
6781
|
'opus_48000_192',
|
|
6643
6782
|
]));
|
|
6644
|
-
((
|
|
6645
|
-
(
|
|
6783
|
+
((fi = ['image_url', 'video_url', 'character_orientation', 'keep_original_sound']),
|
|
6784
|
+
(gi = [
|
|
6646
6785
|
'duration',
|
|
6647
6786
|
'aspect_ratio',
|
|
6648
6787
|
'generate_audio',
|
|
@@ -6654,17 +6793,17 @@ var Wr,
|
|
|
6654
6793
|
'audios',
|
|
6655
6794
|
]));
|
|
6656
6795
|
});
|
|
6657
|
-
function
|
|
6796
|
+
function yi() {
|
|
6658
6797
|
return [
|
|
6659
6798
|
{
|
|
6660
6799
|
name: 'image_url',
|
|
6661
6800
|
type: 'string',
|
|
6662
|
-
description: `motion_control: 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, ${
|
|
6801
|
+
description: `motion_control: 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, ${L}`,
|
|
6663
6802
|
},
|
|
6664
6803
|
{
|
|
6665
6804
|
name: 'video_url',
|
|
6666
6805
|
type: 'string',
|
|
6667
|
-
description: `motion_control: 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, ${
|
|
6806
|
+
description: `motion_control: 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, ${L}`,
|
|
6668
6807
|
},
|
|
6669
6808
|
{
|
|
6670
6809
|
name: 'character_orientation',
|
|
@@ -6682,13 +6821,15 @@ function ti() {
|
|
|
6682
6821
|
},
|
|
6683
6822
|
];
|
|
6684
6823
|
}
|
|
6685
|
-
function
|
|
6824
|
+
function bi(e) {
|
|
6686
6825
|
let t = e.duration,
|
|
6687
|
-
|
|
6826
|
+
a = Object.keys(e.heights),
|
|
6688
6827
|
i = e.sourceFramedModes?.length
|
|
6689
6828
|
? ` Not taken by ${e.sourceFramedModes.join(', ')}: the source image sets the frame.`
|
|
6690
6829
|
: '',
|
|
6691
|
-
n = [
|
|
6830
|
+
n = e.modeRequired ? void 0 : e.modes[0],
|
|
6831
|
+
s = n != null && e.sourceFramedModes?.includes(n),
|
|
6832
|
+
o = [
|
|
6692
6833
|
{
|
|
6693
6834
|
name: 'duration',
|
|
6694
6835
|
type: t.allowed ? 'select' : 'slider',
|
|
@@ -6701,79 +6842,79 @@ function ri(e) {
|
|
|
6701
6842
|
{
|
|
6702
6843
|
name: 'resolution',
|
|
6703
6844
|
type: 'select',
|
|
6704
|
-
default:
|
|
6705
|
-
options:
|
|
6845
|
+
default: a[0],
|
|
6846
|
+
options: a,
|
|
6706
6847
|
description: `Output resolution. Higher resolutions cost more per second.${e.modes.includes('motion_control') ? ' motion_control: 720p or 1080p.' : ''}`,
|
|
6707
6848
|
},
|
|
6708
6849
|
{
|
|
6709
6850
|
name: 'aspect_ratio',
|
|
6710
6851
|
type: 'select',
|
|
6711
|
-
default: e.aspects[0],
|
|
6852
|
+
...(s ? {} : { default: e.aspects[0] }),
|
|
6712
6853
|
options: [...e.aspects, ...(e.adaptiveModes?.length ? ['adaptive'] : [])],
|
|
6713
6854
|
description: `The frame.${e.adaptiveModes?.length ? ` adaptive: ${e.adaptiveModes.join(', ')} only.` : ''}${i}`,
|
|
6714
6855
|
},
|
|
6715
6856
|
];
|
|
6716
6857
|
if (
|
|
6717
6858
|
(e.audio === 'priced'
|
|
6718
|
-
?
|
|
6859
|
+
? o.push({
|
|
6719
6860
|
name: 'generate_audio',
|
|
6720
6861
|
type: 'boolean',
|
|
6721
6862
|
default: !1,
|
|
6722
6863
|
description: 'Add sound. Clips with sound are billed at the higher rate.',
|
|
6723
6864
|
})
|
|
6724
6865
|
: e.audio === 'free' &&
|
|
6725
|
-
|
|
6866
|
+
o.push({
|
|
6726
6867
|
name: 'generate_audio',
|
|
6727
6868
|
type: 'boolean',
|
|
6728
6869
|
default: !0,
|
|
6729
6870
|
description: 'Add sound. Same price on or off.',
|
|
6730
6871
|
}),
|
|
6731
6872
|
e.reference?.maxImages &&
|
|
6732
|
-
|
|
6873
|
+
o.push({
|
|
6733
6874
|
name: 'images',
|
|
6734
6875
|
type: 'string[]',
|
|
6735
|
-
description: `multi_reference: up to ${e.reference.maxImages} reference images.${e.referenceHandles ? ' In the prompt, name them @Image1, @Image2, ... in this order.' : ''} ${
|
|
6876
|
+
description: `multi_reference: up to ${e.reference.maxImages} reference images.${e.referenceHandles ? ' In the prompt, name them @Image1, @Image2, ... in this order.' : ''} ${L}`,
|
|
6736
6877
|
}),
|
|
6737
6878
|
(e.modes.includes('image_to_video') || e.modes.includes('first_n_last_frames')) &&
|
|
6738
|
-
|
|
6879
|
+
o.push({
|
|
6739
6880
|
name: 'first_frame_image',
|
|
6740
6881
|
type: 'string',
|
|
6741
|
-
description: `The start frame (image_to_video, first_n_last_frames), ${
|
|
6882
|
+
description: `The start frame (image_to_video, first_n_last_frames), ${L}`,
|
|
6742
6883
|
}),
|
|
6743
6884
|
(e.lastFrameOnImageToVideo || e.modes.includes('first_n_last_frames')) &&
|
|
6744
|
-
|
|
6885
|
+
o.push({
|
|
6745
6886
|
name: 'last_frame_image',
|
|
6746
6887
|
type: 'string',
|
|
6747
|
-
description: `Last frame (optional on image_to_video), ${
|
|
6888
|
+
description: `Last frame (optional on image_to_video), ${L}`,
|
|
6748
6889
|
}),
|
|
6749
6890
|
e.reference?.maxVideos)
|
|
6750
6891
|
) {
|
|
6751
|
-
let
|
|
6752
|
-
|
|
6892
|
+
let u = e.reference,
|
|
6893
|
+
l = e.videoInputBilling
|
|
6753
6894
|
? ` Billed as input plus output seconds${e.videoInputBilling.minOutputMultiple > 1 ? `, at least ${e.videoInputBilling.minOutputMultiple}x the output` : ''}.`
|
|
6754
6895
|
: '';
|
|
6755
|
-
|
|
6896
|
+
o.push({
|
|
6756
6897
|
name: 'videos',
|
|
6757
6898
|
type: 'string[]',
|
|
6758
|
-
description: `multi_reference: up to ${
|
|
6899
|
+
description: `multi_reference: up to ${u.maxVideos} reference videos${u.maxVideoSeconds ? `, ${u.maxVideoSeconds} s in all` : ''}.${e.referenceHandles ? ' In the prompt, name them @Video1, @Video2, ... in this order.' : ''}${l} ${L}`,
|
|
6759
6900
|
});
|
|
6760
6901
|
}
|
|
6761
6902
|
if (e.reference?.maxAudios) {
|
|
6762
|
-
let
|
|
6763
|
-
|
|
6764
|
-
? `, each ${
|
|
6765
|
-
:
|
|
6766
|
-
? `, ${
|
|
6903
|
+
let u = e.reference,
|
|
6904
|
+
l = u.audioClipSeconds
|
|
6905
|
+
? `, each ${u.audioClipSeconds.min} to ${u.audioClipSeconds.max} s`
|
|
6906
|
+
: u.maxAudioSeconds
|
|
6907
|
+
? `, ${u.maxAudioSeconds} s in all`
|
|
6767
6908
|
: '';
|
|
6768
|
-
|
|
6909
|
+
o.push({
|
|
6769
6910
|
name: 'audios',
|
|
6770
6911
|
type: 'string[]',
|
|
6771
|
-
description: `multi_reference: up to ${
|
|
6912
|
+
description: `multi_reference: up to ${u.maxAudios} reference audios${l}, with at least one image or video. ${L}`,
|
|
6772
6913
|
});
|
|
6773
6914
|
}
|
|
6774
|
-
return
|
|
6915
|
+
return o;
|
|
6775
6916
|
}
|
|
6776
|
-
function
|
|
6917
|
+
function ki(e) {
|
|
6777
6918
|
let t = Object.keys(e.sizes);
|
|
6778
6919
|
return [
|
|
6779
6920
|
{
|
|
@@ -6786,17 +6927,17 @@ function ii(e) {
|
|
|
6786
6927
|
{
|
|
6787
6928
|
name: 'images',
|
|
6788
6929
|
type: 'string[]',
|
|
6789
|
-
description: `image_to_image: up to ${e.maxEditImages} images to edit, ${
|
|
6930
|
+
description: `image_to_image: up to ${e.maxEditImages} images to edit, ${L}`,
|
|
6790
6931
|
},
|
|
6791
6932
|
];
|
|
6792
6933
|
}
|
|
6793
|
-
function
|
|
6934
|
+
function xi() {
|
|
6794
6935
|
return [
|
|
6795
6936
|
{
|
|
6796
6937
|
name: 'voice_id',
|
|
6797
6938
|
type: 'string',
|
|
6798
|
-
default:
|
|
6799
|
-
description: `text_to_speech: the ElevenLabs voice id, one of: ${
|
|
6939
|
+
default: Nt,
|
|
6940
|
+
description: `text_to_speech: the ElevenLabs voice id, one of: ${wi}.`,
|
|
6800
6941
|
},
|
|
6801
6942
|
{
|
|
6802
6943
|
name: 'turns',
|
|
@@ -6804,7 +6945,7 @@ function ni() {
|
|
|
6804
6945
|
description:
|
|
6805
6946
|
'dialogue: a JSON list of {voice_id, text}, up to 20 turns, 10 voices and 2000 characters in all; plain text is refused. Each voice_id is one of the voice_id voices. Leave prompt out.',
|
|
6806
6947
|
},
|
|
6807
|
-
{ name: 'output_format', type: 'select', default:
|
|
6948
|
+
{ name: 'output_format', type: 'select', default: Ne[0], options: [...Ne] },
|
|
6808
6949
|
{ name: 'stability', type: 'number', min: 0, max: 1, description: 'Voice stability, 0 to 1.' },
|
|
6809
6950
|
{
|
|
6810
6951
|
name: 'similarity_boost',
|
|
@@ -6815,9 +6956,9 @@ function ni() {
|
|
|
6815
6956
|
},
|
|
6816
6957
|
];
|
|
6817
6958
|
}
|
|
6818
|
-
function
|
|
6959
|
+
function Bt(e) {
|
|
6819
6960
|
let t = e.promptOptionalModes?.length ? ` Optional on ${e.promptOptionalModes.join(', ')}.` : '',
|
|
6820
|
-
|
|
6961
|
+
a = [
|
|
6821
6962
|
{
|
|
6822
6963
|
name: 'prompt',
|
|
6823
6964
|
type: 'string',
|
|
@@ -6828,28 +6969,28 @@ function Lt(e) {
|
|
|
6828
6969
|
name: 'mode',
|
|
6829
6970
|
type: 'select',
|
|
6830
6971
|
required: !0,
|
|
6831
|
-
default: e.modes[0],
|
|
6972
|
+
...(e.modeRequired ? {} : { default: e.modes[0] }),
|
|
6832
6973
|
options: [...e.modes],
|
|
6833
|
-
description: e.modes.map((i) =>
|
|
6974
|
+
description: `${e.modeRequired ? 'Required. ' : ''}${e.modes.map((i) => hi[i]).join(' ')}`,
|
|
6834
6975
|
},
|
|
6835
6976
|
];
|
|
6836
6977
|
return (
|
|
6837
|
-
e.kind === 'video' ?
|
|
6838
|
-
e.modes.includes('motion_control') &&
|
|
6978
|
+
e.kind === 'video' ? a.push(...bi(e)) : e.kind === 'image' ? a.push(...ki(e)) : a.push(...xi()),
|
|
6979
|
+
e.modes.includes('motion_control') && a.push(...yi()),
|
|
6839
6980
|
e.seed &&
|
|
6840
|
-
|
|
6841
|
-
|
|
6981
|
+
a.push({ name: 'seed', type: 'number', min: 0, description: 'Seed for repeatable runs.' }),
|
|
6982
|
+
a
|
|
6842
6983
|
);
|
|
6843
6984
|
}
|
|
6844
|
-
var
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6985
|
+
var L,
|
|
6986
|
+
hi,
|
|
6987
|
+
wi,
|
|
6988
|
+
jt = h(() => {
|
|
6848
6989
|
'use strict';
|
|
6849
|
-
|
|
6850
|
-
((
|
|
6990
|
+
Ue();
|
|
6991
|
+
((L =
|
|
6851
6992
|
'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.'),
|
|
6852
|
-
(
|
|
6993
|
+
(hi = {
|
|
6853
6994
|
text_to_video: 'text_to_video: from the prompt alone.',
|
|
6854
6995
|
image_to_video: 'image_to_video: a start image in first_frame_image.',
|
|
6855
6996
|
first_n_last_frames: 'first_n_last_frames: first_frame_image and last_frame_image.',
|
|
@@ -6861,34 +7002,34 @@ var O,
|
|
|
6861
7002
|
motion_control:
|
|
6862
7003
|
'motion_control: the character in image_url performs the motion of video_url; length and frame follow the video.',
|
|
6863
7004
|
}));
|
|
6864
|
-
|
|
7005
|
+
wi = Object.entries(Ve)
|
|
6865
7006
|
.map(([e, t]) => `${e} (${t})`)
|
|
6866
7007
|
.join(', ');
|
|
6867
7008
|
});
|
|
6868
|
-
var
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
7009
|
+
var he,
|
|
7010
|
+
Gt,
|
|
7011
|
+
Y,
|
|
7012
|
+
Ht,
|
|
7013
|
+
Pn,
|
|
7014
|
+
In,
|
|
7015
|
+
vn,
|
|
7016
|
+
Tn,
|
|
7017
|
+
zt = h(() => {
|
|
6877
7018
|
'use strict';
|
|
6878
|
-
((
|
|
6879
|
-
(
|
|
6880
|
-
(
|
|
6881
|
-
(
|
|
6882
|
-
(
|
|
6883
|
-
(
|
|
6884
|
-
(
|
|
6885
|
-
(
|
|
7019
|
+
((he = 'enhancor-ultrafine'),
|
|
7020
|
+
(Gt = 'Enhancor Ultrafine'),
|
|
7021
|
+
(Y = { skin: [2, 3, 4], noSkin: [2, 3, 4, 8, 16] }),
|
|
7022
|
+
(Ht = 2),
|
|
7023
|
+
(Pn = 24 * 1024 * 1024),
|
|
7024
|
+
(In = 4096 * 4096),
|
|
7025
|
+
(vn = 30 * 6e4),
|
|
7026
|
+
(Tn = 120 * 6e4));
|
|
6886
7027
|
});
|
|
6887
|
-
var
|
|
6888
|
-
|
|
6889
|
-
|
|
7028
|
+
var X,
|
|
7029
|
+
ye,
|
|
7030
|
+
Fe = h(() => {
|
|
6890
7031
|
'use strict';
|
|
6891
|
-
((
|
|
7032
|
+
((X = [
|
|
6892
7033
|
'seedance-2-5',
|
|
6893
7034
|
'seedance-2-5-flash',
|
|
6894
7035
|
'seedance-2',
|
|
@@ -6897,84 +7038,85 @@ var W,
|
|
|
6897
7038
|
'seedream-5-5',
|
|
6898
7039
|
'wan-3-0',
|
|
6899
7040
|
'z-image-pro',
|
|
7041
|
+
'wan-2-5-image',
|
|
6900
7042
|
'doppel',
|
|
6901
7043
|
]),
|
|
6902
|
-
(
|
|
7044
|
+
(ye =
|
|
6903
7045
|
'a request with creative_mode: true answers 503 checkpoint_unavailable and nothing is charged'));
|
|
6904
7046
|
});
|
|
6905
|
-
function
|
|
7047
|
+
function Q(e) {
|
|
6906
7048
|
return `$${Number(e.toFixed(5))}`;
|
|
6907
7049
|
}
|
|
6908
|
-
function
|
|
7050
|
+
function Ii(e) {
|
|
6909
7051
|
if (e.kind === 'llm') {
|
|
6910
7052
|
let t = e.defaultEndpoint,
|
|
6911
|
-
|
|
7053
|
+
a = (s) =>
|
|
6912
7054
|
e.variants.find(
|
|
6913
7055
|
(o) =>
|
|
6914
7056
|
o.component === s &&
|
|
6915
7057
|
(!t || !o.endpoint || o.endpoint === t) &&
|
|
6916
7058
|
(!o.context || o.context === '0\u201332K'),
|
|
6917
7059
|
),
|
|
6918
|
-
i =
|
|
6919
|
-
n =
|
|
7060
|
+
i = a('input'),
|
|
7061
|
+
n = a('output');
|
|
6920
7062
|
return i && n
|
|
6921
|
-
? `${
|
|
6922
|
-
: `from ${
|
|
7063
|
+
? `${Q(i.price.starter)}/M in \xB7 ${Q(n.price.starter)}/M out`
|
|
7064
|
+
: `from ${Q(me(e).price.starter)}/M tokens`;
|
|
6923
7065
|
}
|
|
6924
|
-
return `from ${
|
|
7066
|
+
return `from ${Q(me(e).price.starter)}${e.unit}`;
|
|
6925
7067
|
}
|
|
6926
|
-
function
|
|
6927
|
-
let
|
|
6928
|
-
return
|
|
7068
|
+
function vi(e, t) {
|
|
7069
|
+
let a = t.filter((i) => Number.isFinite(i) && i > 0);
|
|
7070
|
+
return a.length ? `from ${Q(Math.min(...a))}${e}` : null;
|
|
6929
7071
|
}
|
|
6930
|
-
function
|
|
6931
|
-
for (let t of
|
|
6932
|
-
let
|
|
6933
|
-
i =
|
|
6934
|
-
|
|
7072
|
+
function Qt(e) {
|
|
7073
|
+
for (let t of J) {
|
|
7074
|
+
let a = ke[t],
|
|
7075
|
+
i = a ? vi(a.unit, e[t] ?? []) : null;
|
|
7076
|
+
a && i && (a.priceFormatted = i);
|
|
6935
7077
|
}
|
|
6936
7078
|
}
|
|
6937
|
-
function
|
|
6938
|
-
let
|
|
7079
|
+
function A(e, t) {
|
|
7080
|
+
let a = e.axes?.resolution ?? [
|
|
6939
7081
|
...new Set(e.variants.map((i) => i.resolution).filter((i) => !!i)),
|
|
6940
7082
|
];
|
|
6941
7083
|
return {
|
|
6942
7084
|
name: 'resolution',
|
|
6943
7085
|
type: 'select',
|
|
6944
|
-
default:
|
|
6945
|
-
options:
|
|
7086
|
+
default: me(e).resolution ?? a[0],
|
|
7087
|
+
options: a,
|
|
6946
7088
|
...(t ? { description: t } : {}),
|
|
6947
7089
|
};
|
|
6948
7090
|
}
|
|
6949
|
-
function
|
|
7091
|
+
function Zt(e) {
|
|
6950
7092
|
if (!e.endpoints?.length) return null;
|
|
6951
|
-
let t = e.endpoints.filter((
|
|
7093
|
+
let t = e.endpoints.filter((a) => Kt(e.slug, a.id));
|
|
6952
7094
|
return {
|
|
6953
7095
|
name: 'endpoint',
|
|
6954
7096
|
type: 'select',
|
|
6955
|
-
default:
|
|
6956
|
-
options: e.endpoints.filter((
|
|
7097
|
+
default: Oe(e),
|
|
7098
|
+
options: e.endpoints.filter((a) => !t.includes(a)).map((a) => a.id),
|
|
6957
7099
|
description:
|
|
6958
7100
|
(e.slug === 'gemini-3.1-pro-preview'
|
|
6959
7101
|
? 'Where the request is served; a missing endpoint is the default, the lowest price, and an unknown one is refused.'
|
|
6960
7102
|
: 'Where the request is served; a missing or unknown endpoint is the default, the lowest price.') +
|
|
6961
|
-
(t.length ? ` ${t.map((
|
|
7103
|
+
(t.length ? ` ${t.map((a) => a.label).join(' and ')}: coming soon.` : ''),
|
|
6962
7104
|
};
|
|
6963
7105
|
}
|
|
6964
|
-
function
|
|
7106
|
+
function Mi(e, t) {
|
|
6965
7107
|
if (e.unfiltered == null || t.some((i) => i.name === 'creative_mode')) return t;
|
|
6966
|
-
let
|
|
6967
|
-
return [...t.filter((i) => !
|
|
7108
|
+
let a = X.includes(e.api.model);
|
|
7109
|
+
return [...t.filter((i) => !be.has(i.name)), a ? Je : Ti];
|
|
6968
7110
|
}
|
|
6969
|
-
function
|
|
6970
|
-
let
|
|
6971
|
-
i = [
|
|
6972
|
-
return (i.push(
|
|
7111
|
+
function Be(e, t) {
|
|
7112
|
+
let a = e.filter((n) => !be.has(n.name)),
|
|
7113
|
+
i = [Je, ea];
|
|
7114
|
+
return (i.push(We, Ye), [...a, ...i]);
|
|
6973
7115
|
}
|
|
6974
|
-
function
|
|
7116
|
+
function Ei(e) {
|
|
6975
7117
|
return [
|
|
6976
7118
|
...e
|
|
6977
|
-
.filter((t) => !
|
|
7119
|
+
.filter((t) => !Si.has(t.name) && !be.has(t.name))
|
|
6978
7120
|
.map((t) => {
|
|
6979
7121
|
if (t.name === 'resolution')
|
|
6980
7122
|
return {
|
|
@@ -6986,42 +7128,42 @@ function gi(e) {
|
|
|
6986
7128
|
),
|
|
6987
7129
|
}
|
|
6988
7130
|
: {}),
|
|
6989
|
-
description: `Output resolution: 480p or 720p (8-bit). This tier has no 1080p or 4k. ${
|
|
7131
|
+
description: `Output resolution: 480p or 720p (8-bit). This tier has no 1080p or 4k. ${Z}`,
|
|
6990
7132
|
};
|
|
6991
|
-
let
|
|
6992
|
-
return
|
|
6993
|
-
? { ...t, description: t.description.replace(/\(up to [^)]*\)/, `(${
|
|
7133
|
+
let a = Ci[t.name];
|
|
7134
|
+
return a && typeof t.description == 'string'
|
|
7135
|
+
? { ...t, description: t.description.replace(/\(up to [^)]*\)/, `(${a})`) }
|
|
6994
7136
|
: t;
|
|
6995
7137
|
}),
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7138
|
+
Je,
|
|
7139
|
+
ea,
|
|
7140
|
+
We,
|
|
7141
|
+
Ye,
|
|
7000
7142
|
];
|
|
7001
7143
|
}
|
|
7002
|
-
function
|
|
7144
|
+
function ta(e) {
|
|
7003
7145
|
return (
|
|
7004
7146
|
e.startsWith('seedance-2-5-') &&
|
|
7005
7147
|
e !== 'seedance-2-5-lite' &&
|
|
7006
7148
|
!/-(creative-mode|unfiltered|uncensored)$/.test(e)
|
|
7007
7149
|
);
|
|
7008
7150
|
}
|
|
7009
|
-
function
|
|
7151
|
+
function Jt(e, t = {}) {
|
|
7010
7152
|
return [
|
|
7011
7153
|
...e
|
|
7012
|
-
.filter((
|
|
7013
|
-
.map((
|
|
7014
|
-
|
|
7015
|
-
? { ...
|
|
7016
|
-
:
|
|
7154
|
+
.filter((a) => !Ki.has(a.name) && !be.has(a.name))
|
|
7155
|
+
.map((a) =>
|
|
7156
|
+
a.name === 'prompt'
|
|
7157
|
+
? { ...a, required: !0 }
|
|
7158
|
+
: a.name === 'resolution'
|
|
7017
7159
|
? {
|
|
7018
|
-
...
|
|
7019
|
-
...(t.no4k &&
|
|
7020
|
-
? { options:
|
|
7160
|
+
...a,
|
|
7161
|
+
...(t.no4k && a.options
|
|
7162
|
+
? { options: a.options.filter((i) => String(i).toLowerCase() !== '4k') }
|
|
7021
7163
|
: {}),
|
|
7022
|
-
description: `Output resolution. TEIN LITE is the lower-priced endpoint for getting started. Stability and reliability are not guaranteed. ${
|
|
7164
|
+
description: `Output resolution. TEIN LITE is the lower-priced endpoint for getting started. Stability and reliability are not guaranteed. ${Z}`,
|
|
7023
7165
|
}
|
|
7024
|
-
:
|
|
7166
|
+
: a,
|
|
7025
7167
|
),
|
|
7026
7168
|
{
|
|
7027
7169
|
name: 'bitrate_mode',
|
|
@@ -7030,13 +7172,13 @@ function Bt(e, t = {}) {
|
|
|
7030
7172
|
options: ['standard'],
|
|
7031
7173
|
description: 'LITE uses standard bitrate. High bitrate is on the standard endpoint.',
|
|
7032
7174
|
},
|
|
7033
|
-
|
|
7034
|
-
|
|
7175
|
+
We,
|
|
7176
|
+
Ye,
|
|
7035
7177
|
];
|
|
7036
7178
|
}
|
|
7037
|
-
function
|
|
7179
|
+
function je(e, t) {
|
|
7038
7180
|
return [
|
|
7039
|
-
|
|
7181
|
+
C('Text prompt describing the video.'),
|
|
7040
7182
|
{ name: 'mode', type: 'select', required: !0, default: t.modes[0], options: t.modes },
|
|
7041
7183
|
{
|
|
7042
7184
|
name: 'duration',
|
|
@@ -7046,27 +7188,27 @@ function Ue(e, t) {
|
|
|
7046
7188
|
max: t.maxSec,
|
|
7047
7189
|
description: `Video length in seconds (${t.minSec} to ${t.maxSec}).`,
|
|
7048
7190
|
},
|
|
7049
|
-
|
|
7191
|
+
A(e),
|
|
7050
7192
|
{ name: 'aspect_ratio', type: 'select', default: t.aspects[0], options: t.aspects },
|
|
7051
|
-
...t.references.map((
|
|
7052
|
-
|
|
7193
|
+
...t.references.map((a) =>
|
|
7194
|
+
a.endsWith('s')
|
|
7053
7195
|
? {
|
|
7054
|
-
name:
|
|
7196
|
+
name: a,
|
|
7055
7197
|
type: 'string[]',
|
|
7056
|
-
description: `${
|
|
7198
|
+
description: `${a} 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.`,
|
|
7057
7199
|
}
|
|
7058
7200
|
: {
|
|
7059
|
-
name:
|
|
7201
|
+
name: a,
|
|
7060
7202
|
type: 'string',
|
|
7061
|
-
description: `${
|
|
7203
|
+
description: `${a} 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.`,
|
|
7062
7204
|
},
|
|
7063
7205
|
),
|
|
7064
7206
|
];
|
|
7065
7207
|
}
|
|
7066
|
-
function
|
|
7067
|
-
let t =
|
|
7208
|
+
function $i(e) {
|
|
7209
|
+
let t = Zt(e);
|
|
7068
7210
|
return [
|
|
7069
|
-
|
|
7211
|
+
C('Image prompt text. Supports complex composition and text instructions.'),
|
|
7070
7212
|
...(t ? [t] : []),
|
|
7071
7213
|
{
|
|
7072
7214
|
name: 'quality',
|
|
@@ -7074,17 +7216,17 @@ function hi(e) {
|
|
|
7074
7216
|
default: 'low',
|
|
7075
7217
|
options: e.axes?.quality ?? ['low', 'medium', 'high'],
|
|
7076
7218
|
},
|
|
7077
|
-
|
|
7219
|
+
A(
|
|
7078
7220
|
e,
|
|
7079
7221
|
e.slug === 'gpt-image-2'
|
|
7080
|
-
? `1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count. ${
|
|
7222
|
+
? `1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count. ${yt}`
|
|
7081
7223
|
: '1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count.',
|
|
7082
7224
|
),
|
|
7083
7225
|
{
|
|
7084
7226
|
name: 'aspect_ratio',
|
|
7085
7227
|
type: 'select',
|
|
7086
7228
|
default: 'auto',
|
|
7087
|
-
options: [...
|
|
7229
|
+
options: [...ht],
|
|
7088
7230
|
description:
|
|
7089
7231
|
"The frame. auto: an edit keeps its first input image's ratio (the nearest listed one), text to image is 1:1. The image is delivered at exactly the size for the ratio and resolution.",
|
|
7090
7232
|
},
|
|
@@ -7131,16 +7273,16 @@ function hi(e) {
|
|
|
7131
7273
|
},
|
|
7132
7274
|
];
|
|
7133
7275
|
}
|
|
7134
|
-
function
|
|
7276
|
+
function Ai(e) {
|
|
7135
7277
|
return [
|
|
7136
|
-
|
|
7278
|
+
C('Image prompt text.'),
|
|
7137
7279
|
{
|
|
7138
7280
|
name: 'input_images',
|
|
7139
7281
|
type: 'string[]',
|
|
7140
7282
|
description: 'Images to edit or use as reference (up to 14).',
|
|
7141
7283
|
},
|
|
7142
|
-
{ name: 'aspect_ratio', type: 'select', default: '1:1', options: [...
|
|
7143
|
-
|
|
7284
|
+
{ name: 'aspect_ratio', type: 'select', default: '1:1', options: [...Ct(e.slug)] },
|
|
7285
|
+
A(e),
|
|
7144
7286
|
{
|
|
7145
7287
|
name: 'n',
|
|
7146
7288
|
type: 'slider',
|
|
@@ -7165,22 +7307,22 @@ function yi(e) {
|
|
|
7165
7307
|
},
|
|
7166
7308
|
];
|
|
7167
7309
|
}
|
|
7168
|
-
function
|
|
7169
|
-
let e =
|
|
7310
|
+
function Li() {
|
|
7311
|
+
let e = $t,
|
|
7170
7312
|
t = [];
|
|
7171
|
-
for (let
|
|
7172
|
-
e.includes(
|
|
7313
|
+
for (let a of Xe(!0))
|
|
7314
|
+
e.includes(a.name) &&
|
|
7173
7315
|
(t.push({
|
|
7174
|
-
...
|
|
7175
|
-
...(
|
|
7176
|
-
...(
|
|
7316
|
+
...a,
|
|
7317
|
+
...(a.name === 'max_tokens' ? { min: 64 } : {}),
|
|
7318
|
+
...(a.name === 'messages'
|
|
7177
7319
|
? {
|
|
7178
7320
|
description:
|
|
7179
7321
|
'Chat history: system, developer, user (text and image_url parts) and assistant turns; no tool turns.',
|
|
7180
7322
|
}
|
|
7181
7323
|
: {}),
|
|
7182
7324
|
}),
|
|
7183
|
-
|
|
7325
|
+
a.name === 'top_p' &&
|
|
7184
7326
|
t.push({
|
|
7185
7327
|
name: 'top_k',
|
|
7186
7328
|
type: 'number',
|
|
@@ -7190,14 +7332,14 @@ function xi() {
|
|
|
7190
7332
|
}));
|
|
7191
7333
|
return t;
|
|
7192
7334
|
}
|
|
7193
|
-
function
|
|
7194
|
-
return
|
|
7335
|
+
function Di() {
|
|
7336
|
+
return Xe(!0).map((e) =>
|
|
7195
7337
|
e.name === 'max_tokens' || e.name === 'max_completion_tokens' ? { ...e, min: 128 } : e,
|
|
7196
7338
|
);
|
|
7197
7339
|
}
|
|
7198
|
-
function
|
|
7340
|
+
function Xe(e) {
|
|
7199
7341
|
return [
|
|
7200
|
-
|
|
7342
|
+
C('The user message or task.'),
|
|
7201
7343
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
7202
7344
|
{
|
|
7203
7345
|
name: 'messages',
|
|
@@ -7290,21 +7432,21 @@ function Je(e) {
|
|
|
7290
7432
|
},
|
|
7291
7433
|
];
|
|
7292
7434
|
}
|
|
7293
|
-
function
|
|
7294
|
-
if (e.slug === 'seed-2-1-turbo') return
|
|
7295
|
-
let t =
|
|
7435
|
+
function Vi(e) {
|
|
7436
|
+
if (e.slug === 'seed-2-1-turbo') return Oi;
|
|
7437
|
+
let t = Zt(e);
|
|
7296
7438
|
return [
|
|
7297
7439
|
...(e.slug === 'gemini-3.1-pro-preview'
|
|
7298
|
-
?
|
|
7440
|
+
? Li()
|
|
7299
7441
|
: e.slug === 'gemini-3.7-flash'
|
|
7300
|
-
?
|
|
7301
|
-
: e.slug === 'gpt-6-astra' ||
|
|
7302
|
-
?
|
|
7303
|
-
:
|
|
7442
|
+
? Di()
|
|
7443
|
+
: e.slug === 'gpt-6-astra' || Ri.includes(e.slug)
|
|
7444
|
+
? Xe(e.slug !== 'gpt-6-astra')
|
|
7445
|
+
: qi),
|
|
7304
7446
|
...(t ? [t] : []),
|
|
7305
7447
|
];
|
|
7306
7448
|
}
|
|
7307
|
-
function
|
|
7449
|
+
function Ge() {
|
|
7308
7450
|
return {
|
|
7309
7451
|
name: 'image',
|
|
7310
7452
|
type: 'string',
|
|
@@ -7312,7 +7454,7 @@ function Fe() {
|
|
|
7312
7454
|
description: 'The photo to fix: one JPEG or PNG URL.',
|
|
7313
7455
|
};
|
|
7314
7456
|
}
|
|
7315
|
-
function
|
|
7457
|
+
function Ui(e) {
|
|
7316
7458
|
return [
|
|
7317
7459
|
{
|
|
7318
7460
|
name: 'video_url',
|
|
@@ -7321,7 +7463,7 @@ function vi(e) {
|
|
|
7321
7463
|
description:
|
|
7322
7464
|
'The video to upscale (up to 30 seconds): a Tein upload link, or any public https link.',
|
|
7323
7465
|
},
|
|
7324
|
-
|
|
7466
|
+
A(
|
|
7325
7467
|
e,
|
|
7326
7468
|
'Size of the result: 1080p, 2k or 4k. A video already near a size cannot be upscaled to it.',
|
|
7327
7469
|
),
|
|
@@ -7334,7 +7476,7 @@ function vi(e) {
|
|
|
7334
7476
|
},
|
|
7335
7477
|
];
|
|
7336
7478
|
}
|
|
7337
|
-
function
|
|
7479
|
+
function Fi() {
|
|
7338
7480
|
return [
|
|
7339
7481
|
{
|
|
7340
7482
|
name: 'mode',
|
|
@@ -7405,35 +7547,35 @@ function Ti() {
|
|
|
7405
7547
|
},
|
|
7406
7548
|
];
|
|
7407
7549
|
}
|
|
7408
|
-
function
|
|
7550
|
+
function Bi(e) {
|
|
7409
7551
|
let t = e.slug;
|
|
7410
|
-
if (e.family === 'tein-labs' && e.kind === 'image') return
|
|
7411
|
-
if (
|
|
7412
|
-
if (e.kind === 'llm') return
|
|
7413
|
-
if (e.editVariants?.length) return
|
|
7414
|
-
let
|
|
7415
|
-
if (
|
|
7416
|
-
if (
|
|
7552
|
+
if (e.family === 'tein-labs' && e.kind === 'image') return Fi();
|
|
7553
|
+
if (de.some((i) => i.slug === t)) return Ui(e);
|
|
7554
|
+
if (e.kind === 'llm') return Vi(e);
|
|
7555
|
+
if (e.editVariants?.length) return $i(e);
|
|
7556
|
+
let a = ge(t);
|
|
7557
|
+
if (a) return Bt(a);
|
|
7558
|
+
if (ta(t)) return Ei(He);
|
|
7417
7559
|
switch (t) {
|
|
7418
7560
|
case 'seedance-2-5':
|
|
7419
|
-
return
|
|
7561
|
+
return Be(He, t);
|
|
7420
7562
|
case 'seedance-2-5-lite':
|
|
7421
|
-
return
|
|
7563
|
+
return Jt(He, { no4k: !0 });
|
|
7422
7564
|
case 'seedance-2':
|
|
7423
|
-
return
|
|
7565
|
+
return Be(Wt, t);
|
|
7424
7566
|
case 'seedance-2-lite':
|
|
7425
|
-
return
|
|
7567
|
+
return Jt(Wt);
|
|
7426
7568
|
case 'seedance-2-mini':
|
|
7427
|
-
return
|
|
7569
|
+
return Be(ji, t);
|
|
7428
7570
|
case 'nano-banana-2':
|
|
7429
7571
|
case 'nano-banana-2.1':
|
|
7430
7572
|
case 'nano-banana-pro':
|
|
7431
|
-
return
|
|
7573
|
+
return Ai(e);
|
|
7432
7574
|
case 'seedream-5-pro':
|
|
7433
7575
|
return [
|
|
7434
|
-
|
|
7576
|
+
C('Detailed description of the image to generate.'),
|
|
7435
7577
|
{ name: 'images', type: 'string[]', description: 'Reference images (the first is free).' },
|
|
7436
|
-
|
|
7578
|
+
A(e),
|
|
7437
7579
|
{
|
|
7438
7580
|
name: 'aspect_ratio',
|
|
7439
7581
|
type: 'select',
|
|
@@ -7442,6 +7584,45 @@ function Mi(e) {
|
|
|
7442
7584
|
},
|
|
7443
7585
|
{ name: 'output_format', type: 'select', default: 'jpeg', options: ['jpeg', 'png'] },
|
|
7444
7586
|
];
|
|
7587
|
+
case 'minimax-h3-image':
|
|
7588
|
+
case 'minimax-h3-image-highspeed':
|
|
7589
|
+
return [
|
|
7590
|
+
C('What to make, or how to change the reference images.'),
|
|
7591
|
+
{
|
|
7592
|
+
name: 'images',
|
|
7593
|
+
type: 'string[]',
|
|
7594
|
+
description:
|
|
7595
|
+
'Reference images to edit or combine (up to 16). Leave empty for text to image. Each reference image is billed.',
|
|
7596
|
+
},
|
|
7597
|
+
{ ...A(e, '1K, 2K or 4K (about 16 megapixels).'), default: '2K' },
|
|
7598
|
+
{
|
|
7599
|
+
name: 'aspect_ratio',
|
|
7600
|
+
type: 'select',
|
|
7601
|
+
default: 'auto',
|
|
7602
|
+
options: [
|
|
7603
|
+
'auto',
|
|
7604
|
+
'1:1',
|
|
7605
|
+
'5:4',
|
|
7606
|
+
'4:5',
|
|
7607
|
+
'4:3',
|
|
7608
|
+
'3:4',
|
|
7609
|
+
'3:2',
|
|
7610
|
+
'2:3',
|
|
7611
|
+
'16:9',
|
|
7612
|
+
'9:16',
|
|
7613
|
+
'21:9',
|
|
7614
|
+
],
|
|
7615
|
+
description: 'auto lets the model pick the shape, or follows the first reference image.',
|
|
7616
|
+
},
|
|
7617
|
+
{ name: 'n', type: 'slider', default: 1, min: 1, max: 4, description: 'Images to make.' },
|
|
7618
|
+
{ name: 'output_format', type: 'select', default: 'jpeg', options: ['jpeg', 'png'] },
|
|
7619
|
+
{
|
|
7620
|
+
name: 'enhance_prompt',
|
|
7621
|
+
type: 'boolean',
|
|
7622
|
+
default: !0,
|
|
7623
|
+
description: 'Let the model expand the prompt before generating (recommended).',
|
|
7624
|
+
},
|
|
7625
|
+
];
|
|
7445
7626
|
case 'seedream-5-5':
|
|
7446
7627
|
return [
|
|
7447
7628
|
{
|
|
@@ -7452,7 +7633,7 @@ function Mi(e) {
|
|
|
7452
7633
|
description:
|
|
7453
7634
|
'text_to_image, image_to_image (up to 10 reference images) or layer_decomposition (split one image into a base image and editable transparent layers).',
|
|
7454
7635
|
},
|
|
7455
|
-
|
|
7636
|
+
C(
|
|
7456
7637
|
'What to make or change. Optional for layer_decomposition, where it can say how to split the image (for example "keep the logo as one layer").',
|
|
7457
7638
|
),
|
|
7458
7639
|
{
|
|
@@ -7461,7 +7642,7 @@ function Mi(e) {
|
|
|
7461
7642
|
description:
|
|
7462
7643
|
'Reference images (up to 10), or for layer_decomposition the one JPEG or PNG to split (at least 512x512). Each input image is billed.',
|
|
7463
7644
|
},
|
|
7464
|
-
|
|
7645
|
+
A(
|
|
7465
7646
|
e,
|
|
7466
7647
|
'1K and 1.5K are one price, 2K the next. layer_decomposition also takes auto (keep the input size), billed at the 2K price.',
|
|
7467
7648
|
),
|
|
@@ -7501,13 +7682,13 @@ function Mi(e) {
|
|
|
7501
7682
|
case 'qwen-3':
|
|
7502
7683
|
case 'qwen-3-pro':
|
|
7503
7684
|
return [
|
|
7504
|
-
|
|
7685
|
+
C('Image prompt text; dense layouts and multilingual text work well.'),
|
|
7505
7686
|
{
|
|
7506
7687
|
name: 'images',
|
|
7507
7688
|
type: 'string[]',
|
|
7508
7689
|
description: 'Up to 3 reference images, each billed at the published add-on price.',
|
|
7509
7690
|
},
|
|
7510
|
-
|
|
7691
|
+
A(e),
|
|
7511
7692
|
{
|
|
7512
7693
|
name: 'aspect_ratio',
|
|
7513
7694
|
type: 'select',
|
|
@@ -7525,8 +7706,8 @@ function Mi(e) {
|
|
|
7525
7706
|
];
|
|
7526
7707
|
case 'z-image-pro':
|
|
7527
7708
|
return [
|
|
7528
|
-
|
|
7529
|
-
|
|
7709
|
+
C('Image prompt text: subject, scene, style, composition and lighting.'),
|
|
7710
|
+
A(e, 'Long edge: 1K is 1024 px, 2K is 2048 px. Same price.'),
|
|
7530
7711
|
{
|
|
7531
7712
|
name: 'aspect_ratio',
|
|
7532
7713
|
type: 'select',
|
|
@@ -7555,6 +7736,50 @@ function Mi(e) {
|
|
|
7555
7736
|
description: 'Let the model expand and refine the prompt before generating.',
|
|
7556
7737
|
},
|
|
7557
7738
|
];
|
|
7739
|
+
case 'wan-2-5-image':
|
|
7740
|
+
return [
|
|
7741
|
+
C('Image prompt, or for an edit the change to make (up to 2000 characters).'),
|
|
7742
|
+
{
|
|
7743
|
+
name: 'images',
|
|
7744
|
+
type: 'string[]',
|
|
7745
|
+
description:
|
|
7746
|
+
'Optional: 1 or 2 input images to edit (JPEG, PNG or WebP, 384-5000 px a side, up to 10 MB). Same price as text to image.',
|
|
7747
|
+
},
|
|
7748
|
+
{
|
|
7749
|
+
name: 'aspect_ratio',
|
|
7750
|
+
type: 'select',
|
|
7751
|
+
default: '1:1',
|
|
7752
|
+
options: ['1:1', '16:9', '9:16', '4:3', '3:4', '3:2', '2:3', '21:9', '9:21', 'auto'],
|
|
7753
|
+
description:
|
|
7754
|
+
'Output shape, about 1.6 MP. auto (edits only, their default) follows the first input image.',
|
|
7755
|
+
},
|
|
7756
|
+
{
|
|
7757
|
+
name: 'n',
|
|
7758
|
+
type: 'slider',
|
|
7759
|
+
default: 1,
|
|
7760
|
+
min: 1,
|
|
7761
|
+
max: 4,
|
|
7762
|
+
description: 'Number of images (1-4). Each image is billed.',
|
|
7763
|
+
},
|
|
7764
|
+
{
|
|
7765
|
+
name: 'negative_prompt',
|
|
7766
|
+
type: 'string',
|
|
7767
|
+
description: 'What to keep out of the image (up to 500 characters).',
|
|
7768
|
+
},
|
|
7769
|
+
{
|
|
7770
|
+
name: 'seed',
|
|
7771
|
+
type: 'number',
|
|
7772
|
+
min: 0,
|
|
7773
|
+
max: 2147483647,
|
|
7774
|
+
description: 'Random seed. The same seed does not guarantee identical results.',
|
|
7775
|
+
},
|
|
7776
|
+
{
|
|
7777
|
+
name: 'prompt_expansion',
|
|
7778
|
+
type: 'boolean',
|
|
7779
|
+
default: !1,
|
|
7780
|
+
description: 'Let the model expand and refine the prompt before generating.',
|
|
7781
|
+
},
|
|
7782
|
+
];
|
|
7558
7783
|
case 'seed-audio-1-0':
|
|
7559
7784
|
return [
|
|
7560
7785
|
{
|
|
@@ -7579,7 +7804,7 @@ function Mi(e) {
|
|
|
7579
7804
|
];
|
|
7580
7805
|
case 'enhancor-skin-fix-v1':
|
|
7581
7806
|
return [
|
|
7582
|
-
|
|
7807
|
+
Ge(),
|
|
7583
7808
|
{
|
|
7584
7809
|
name: 'mode',
|
|
7585
7810
|
type: 'select',
|
|
@@ -7612,11 +7837,11 @@ function Mi(e) {
|
|
|
7612
7837
|
max: 0.4,
|
|
7613
7838
|
description: 'Portrait depth. Heavy only.',
|
|
7614
7839
|
},
|
|
7615
|
-
...
|
|
7840
|
+
...Ni,
|
|
7616
7841
|
];
|
|
7617
7842
|
case 'enhancor-skin-fix-v3':
|
|
7618
7843
|
return [
|
|
7619
|
-
|
|
7844
|
+
Ge(),
|
|
7620
7845
|
{
|
|
7621
7846
|
name: 'mask_image',
|
|
7622
7847
|
type: 'string',
|
|
@@ -7656,7 +7881,7 @@ function Mi(e) {
|
|
|
7656
7881
|
];
|
|
7657
7882
|
case 'enhancor-skin-fix-v4':
|
|
7658
7883
|
return [
|
|
7659
|
-
|
|
7884
|
+
Ge(),
|
|
7660
7885
|
{
|
|
7661
7886
|
name: 'mode',
|
|
7662
7887
|
type: 'select',
|
|
@@ -7687,7 +7912,7 @@ function Mi(e) {
|
|
|
7687
7912
|
];
|
|
7688
7913
|
case 'wan-3-0':
|
|
7689
7914
|
case 'wan-3-0-prime':
|
|
7690
|
-
return
|
|
7915
|
+
return je(e, {
|
|
7691
7916
|
modes: ['text_to_video', 'first_n_last_frames', 'multi_reference'],
|
|
7692
7917
|
aspects: ['16:9', '9:16', '4:3', '3:4', '1:1', 'adaptive'],
|
|
7693
7918
|
minSec: 2,
|
|
@@ -7697,7 +7922,7 @@ function Mi(e) {
|
|
|
7697
7922
|
});
|
|
7698
7923
|
case 'happy-horse-1-1':
|
|
7699
7924
|
case 'happy-horse-1-0':
|
|
7700
|
-
return
|
|
7925
|
+
return je(e, {
|
|
7701
7926
|
modes:
|
|
7702
7927
|
t === 'happy-horse-1-0'
|
|
7703
7928
|
? ['text-to-video', 'single-image', 'multi-reference', 'video-editing']
|
|
@@ -7708,7 +7933,7 @@ function Mi(e) {
|
|
|
7708
7933
|
references: t === 'happy-horse-1-0' ? ['images', 'videos'] : ['images'],
|
|
7709
7934
|
});
|
|
7710
7935
|
case 'minimax-h3':
|
|
7711
|
-
return
|
|
7936
|
+
return je(e, {
|
|
7712
7937
|
modes: ['text_to_video', 'first_n_last_frames', 'multi_reference'],
|
|
7713
7938
|
aspects: ['16:9', '21:9', '4:3', '1:1', '3:4', '9:16', 'adaptive'],
|
|
7714
7939
|
minSec: 4,
|
|
@@ -7716,13 +7941,13 @@ function Mi(e) {
|
|
|
7716
7941
|
references: ['images', 'videos', 'audios', 'first_frame_image', 'last_frame_image'],
|
|
7717
7942
|
});
|
|
7718
7943
|
default:
|
|
7719
|
-
return [
|
|
7944
|
+
return [C('Prompt text.')];
|
|
7720
7945
|
}
|
|
7721
7946
|
}
|
|
7722
|
-
function
|
|
7947
|
+
function Gi() {
|
|
7723
7948
|
return {
|
|
7724
|
-
slug:
|
|
7725
|
-
name:
|
|
7949
|
+
slug: he,
|
|
7950
|
+
name: Gt,
|
|
7726
7951
|
category: 'Image',
|
|
7727
7952
|
kind: 'Image-to-Image',
|
|
7728
7953
|
vendor: 'Enhancor',
|
|
@@ -7730,7 +7955,7 @@ function Si() {
|
|
|
7730
7955
|
'Upscales a photo, with an optional skin fix. Full makes the photo its size times the scale; Fast makes a fixed size (long side 2432 px).',
|
|
7731
7956
|
priceFormatted: '',
|
|
7732
7957
|
unit: '/img',
|
|
7733
|
-
primaryToolName:
|
|
7958
|
+
primaryToolName: Xt.image,
|
|
7734
7959
|
parameters: [
|
|
7735
7960
|
{
|
|
7736
7961
|
name: 'image',
|
|
@@ -7756,189 +7981,188 @@ function Si() {
|
|
|
7756
7981
|
{
|
|
7757
7982
|
name: 'scale',
|
|
7758
7983
|
type: 'select',
|
|
7759
|
-
default: String(
|
|
7760
|
-
options:
|
|
7761
|
-
description: `Full only. ${
|
|
7984
|
+
default: String(Ht),
|
|
7985
|
+
options: Y.noSkin.map(String),
|
|
7986
|
+
description: `Full only. ${Y.skin.join(', ')} with skin_fix on; also ${Y.noSkin.filter((e) => !Y.skin.includes(e)).join(' and ')} with it off. The output is at most 48 megapixels.`,
|
|
7762
7987
|
},
|
|
7763
7988
|
],
|
|
7764
7989
|
};
|
|
7765
7990
|
}
|
|
7766
|
-
function
|
|
7991
|
+
function ze(e, t = e.api.model) {
|
|
7767
7992
|
return {
|
|
7768
7993
|
slug: t,
|
|
7769
7994
|
name: e.name,
|
|
7770
|
-
category:
|
|
7771
|
-
kind: t.startsWith('enhancor-skin-fix-') ? 'Image-to-Image' :
|
|
7995
|
+
category: _i[e.kind],
|
|
7996
|
+
kind: t.startsWith('enhancor-skin-fix-') ? 'Image-to-Image' : Pi[e.kind],
|
|
7772
7997
|
vendor: e.vendor ?? '',
|
|
7773
7998
|
description: e.desc ?? e.name,
|
|
7774
|
-
priceFormatted:
|
|
7999
|
+
priceFormatted: Ii(e),
|
|
7775
8000
|
unit: e.unit,
|
|
7776
|
-
primaryToolName:
|
|
7777
|
-
parameters:
|
|
8001
|
+
primaryToolName: Xt[e.kind],
|
|
8002
|
+
parameters: Mi(e, Bi(e)),
|
|
7778
8003
|
};
|
|
7779
8004
|
}
|
|
7780
|
-
function
|
|
8005
|
+
function Hi() {
|
|
7781
8006
|
let e = {};
|
|
7782
|
-
for (let t of
|
|
8007
|
+
for (let t of ue())
|
|
7783
8008
|
if (t.slug !== 'seedance-2-fast') {
|
|
7784
8009
|
if (t.slug === 'seedance-2-mini') {
|
|
7785
|
-
e['seedance-2-mini'] =
|
|
8010
|
+
e['seedance-2-mini'] = ze(t, 'seedance-2-mini');
|
|
7786
8011
|
continue;
|
|
7787
8012
|
}
|
|
7788
8013
|
if (t.slug === 'seedance-2') {
|
|
7789
|
-
let
|
|
7790
|
-
((
|
|
7791
|
-
(e['seedance-2'] =
|
|
8014
|
+
let a = ze(t);
|
|
8015
|
+
((a.description = `${t.desc ?? t.name} Send quality fast or mini for Seedance 2.0 Fast or Mini.`),
|
|
8016
|
+
(e['seedance-2'] = a));
|
|
7792
8017
|
continue;
|
|
7793
8018
|
}
|
|
7794
|
-
t.slug.startsWith('claude-') || (e[t.api.model] =
|
|
8019
|
+
t.slug.startsWith('claude-') || (e[t.api.model] = ze(t));
|
|
7795
8020
|
}
|
|
7796
|
-
(Object.assign(e,
|
|
7797
|
-
for (let [t,
|
|
7798
|
-
e[
|
|
8021
|
+
(Object.assign(e, Lt()), (e[he] = Gi()));
|
|
8022
|
+
for (let [t, a] of Object.entries(fe))
|
|
8023
|
+
e[a] && Object.defineProperty(e, t, { value: e[a], enumerable: !1 });
|
|
7799
8024
|
return e;
|
|
7800
8025
|
}
|
|
7801
|
-
function
|
|
8026
|
+
function we(e) {
|
|
7802
8027
|
return !!e?.parameters.some((t) => t.name === 'image');
|
|
7803
8028
|
}
|
|
7804
|
-
function
|
|
7805
|
-
return
|
|
8029
|
+
function H(e) {
|
|
8030
|
+
return ke[e] ?? null;
|
|
7806
8031
|
}
|
|
7807
|
-
function
|
|
7808
|
-
if (e.startsWith('enhancor-skin-fix-') || e ===
|
|
7809
|
-
if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite' ||
|
|
8032
|
+
function zi(e, t, a) {
|
|
8033
|
+
if (e.startsWith('enhancor-skin-fix-') || e === he) return !1;
|
|
8034
|
+
if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite' || ta(e)) && t === 'duration') {
|
|
7810
8035
|
let n = (s) => (typeof s == 'string' ? s.trim().toLowerCase() : '');
|
|
7811
|
-
if (n(
|
|
8036
|
+
if (n(a.mode) === 'edit' || n(a.omni_reference_task_type) === 'edit') return !1;
|
|
7812
8037
|
}
|
|
7813
8038
|
if (
|
|
7814
|
-
(t === 'max_tokens' &&
|
|
7815
|
-
(t === 'max_completion_tokens' &&
|
|
8039
|
+
(t === 'max_tokens' && Yt(a.max_completion_tokens)) ||
|
|
8040
|
+
(t === 'max_completion_tokens' && Yt(a.max_tokens))
|
|
7816
8041
|
)
|
|
7817
8042
|
return !1;
|
|
7818
8043
|
if (t === 'aspect_ratio') {
|
|
7819
|
-
let n =
|
|
8044
|
+
let n = ge(e);
|
|
7820
8045
|
if (n) {
|
|
7821
|
-
let s = typeof
|
|
8046
|
+
let s = typeof a.mode == 'string' ? a.mode.trim().toLowerCase() : '',
|
|
7822
8047
|
o = s ? s.replace(/-/g, '_') : n.modes[0];
|
|
7823
|
-
if (n.modes.includes(o) && !
|
|
8048
|
+
if (n.modes.includes(o) && !Ut(n, o)) return !1;
|
|
7824
8049
|
}
|
|
7825
8050
|
}
|
|
7826
|
-
let i =
|
|
8051
|
+
let i = ge(e);
|
|
7827
8052
|
if (i) {
|
|
7828
|
-
let n = typeof
|
|
8053
|
+
let n = typeof a.mode == 'string' ? a.mode.trim().toLowerCase() : '',
|
|
7829
8054
|
s = n ? n.replace(/-/g, '_') : i.modes[0];
|
|
7830
|
-
if (i.modes.includes(s) && !
|
|
8055
|
+
if (i.modes.includes(s) && !Ft(i, s, t)) return !1;
|
|
7831
8056
|
}
|
|
7832
8057
|
return !0;
|
|
7833
8058
|
}
|
|
7834
|
-
function
|
|
8059
|
+
function Yt(e) {
|
|
7835
8060
|
return e != null && e !== '';
|
|
7836
8061
|
}
|
|
7837
|
-
function
|
|
7838
|
-
let
|
|
8062
|
+
function ra(e, t) {
|
|
8063
|
+
let a = { ...t };
|
|
7839
8064
|
if (e?.slug === 'seedance-2-5') {
|
|
7840
8065
|
let i = (n) => typeof n != 'string' || !n.trim();
|
|
7841
|
-
for (let n of
|
|
7842
|
-
if (!i(
|
|
8066
|
+
for (let n of Ji) (i(a.finalize) && !i(a[n]) && (a.finalize = a[n]), delete a[n]);
|
|
8067
|
+
if (!i(a.finalize)) return a;
|
|
7843
8068
|
}
|
|
7844
8069
|
for (let i of e?.parameters ?? [])
|
|
7845
8070
|
i.default !== void 0 &&
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
(
|
|
7849
|
-
return
|
|
8071
|
+
a[i.name] === void 0 &&
|
|
8072
|
+
zi(e.slug, i.name, t) &&
|
|
8073
|
+
(a[i.name] = i.default);
|
|
8074
|
+
return a;
|
|
7850
8075
|
}
|
|
7851
8076
|
function D() {
|
|
7852
|
-
return Object.values(
|
|
8077
|
+
return Object.values(ke);
|
|
7853
8078
|
}
|
|
7854
|
-
var
|
|
7855
|
-
Ht,
|
|
7856
|
-
oi,
|
|
7857
|
-
M,
|
|
7858
|
-
Ge,
|
|
7859
|
-
di,
|
|
7860
|
-
Wt,
|
|
7861
|
-
He,
|
|
7862
|
-
ze,
|
|
7863
|
-
he,
|
|
7864
|
-
ui,
|
|
7865
|
-
mi,
|
|
7866
|
-
fi,
|
|
7867
|
-
bi,
|
|
7868
|
-
ki,
|
|
7869
|
-
wi,
|
|
7870
|
-
Ii,
|
|
7871
|
-
X,
|
|
7872
|
-
Be,
|
|
8079
|
+
var _i,
|
|
7873
8080
|
Xt,
|
|
7874
|
-
|
|
7875
|
-
|
|
8081
|
+
Pi,
|
|
8082
|
+
C,
|
|
8083
|
+
Je,
|
|
8084
|
+
Ti,
|
|
8085
|
+
ea,
|
|
8086
|
+
We,
|
|
8087
|
+
Ye,
|
|
8088
|
+
be,
|
|
7876
8089
|
Ki,
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
8090
|
+
Si,
|
|
8091
|
+
Ci,
|
|
8092
|
+
qi,
|
|
8093
|
+
Oi,
|
|
8094
|
+
Ri,
|
|
8095
|
+
Ni,
|
|
8096
|
+
Z,
|
|
8097
|
+
He,
|
|
8098
|
+
aa,
|
|
8099
|
+
ia,
|
|
8100
|
+
Wt,
|
|
8101
|
+
ji,
|
|
8102
|
+
ke,
|
|
8103
|
+
Ji,
|
|
8104
|
+
ee = h(() => {
|
|
7880
8105
|
'use strict';
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
Ae();
|
|
7887
|
-
It();
|
|
7888
|
-
Tt();
|
|
7889
|
-
Kt();
|
|
7890
|
-
qt();
|
|
8106
|
+
bt();
|
|
8107
|
+
Ce();
|
|
8108
|
+
G();
|
|
8109
|
+
Re();
|
|
8110
|
+
Ee();
|
|
7891
8111
|
Le();
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
(
|
|
7896
|
-
|
|
8112
|
+
St();
|
|
8113
|
+
Et();
|
|
8114
|
+
At();
|
|
8115
|
+
Dt();
|
|
8116
|
+
Ue();
|
|
8117
|
+
jt();
|
|
8118
|
+
zt();
|
|
8119
|
+
Fe();
|
|
8120
|
+
((_i = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
|
|
8121
|
+
(Xt = {
|
|
7897
8122
|
video: 'generate_video',
|
|
7898
8123
|
image: 'generate_image',
|
|
7899
8124
|
audio: 'generate_audio',
|
|
7900
8125
|
llm: 'run_task',
|
|
7901
8126
|
}),
|
|
7902
|
-
(
|
|
8127
|
+
(Pi = {
|
|
7903
8128
|
video: 'Text-to-Video',
|
|
7904
8129
|
image: 'Text-to-Image',
|
|
7905
8130
|
audio: 'Text-to-Audio',
|
|
7906
8131
|
llm: 'Reasoning (LLM)',
|
|
7907
8132
|
}));
|
|
7908
|
-
|
|
7909
|
-
((
|
|
8133
|
+
C = (e) => ({ name: 'prompt', type: 'string', required: !0, description: e });
|
|
8134
|
+
((Je = {
|
|
7910
8135
|
name: 'creative_mode',
|
|
7911
8136
|
type: 'boolean',
|
|
7912
8137
|
default: !1,
|
|
7913
8138
|
description:
|
|
7914
8139
|
'Runs the Creative mode checkpoint at its published price (+5%). The Acceptable Use Policy applies.',
|
|
7915
8140
|
}),
|
|
7916
|
-
(
|
|
8141
|
+
(Ti = {
|
|
7917
8142
|
name: 'creative_mode',
|
|
7918
8143
|
type: 'boolean',
|
|
7919
8144
|
default: !1,
|
|
7920
|
-
description: `Not available yet on this model: ${
|
|
8145
|
+
description: `Not available yet on this model: ${ye}.`,
|
|
7921
8146
|
}),
|
|
7922
|
-
(
|
|
8147
|
+
(ea = {
|
|
7923
8148
|
name: 'priority',
|
|
7924
8149
|
type: 'boolean',
|
|
7925
8150
|
default: !1,
|
|
7926
8151
|
description: 'Guaranteed speed and no queue, at the published Priority price (+6%).',
|
|
7927
8152
|
}),
|
|
7928
|
-
(
|
|
8153
|
+
(We = {
|
|
7929
8154
|
name: 'reference_roles',
|
|
7930
8155
|
type: 'json',
|
|
7931
8156
|
description: `Omni Reference only. Role of each reference, by tag { "@Image1": "prop" } or by kind { "image": ["prop"] }. Image: appearance, clothing, prop, scene_layout, lighting, first_frame, last_frame; Seedance 2.5 also keyframe, storyboard. Video: motion, camera, style; Seedance 2.5 also blockout_coarse, blockout_fine. Audio: voice, ambience, music, sound_effect. On a tag, the value image, video or audio uses that kind's default (appearance, motion, voice).`,
|
|
7932
8157
|
}),
|
|
7933
|
-
(
|
|
8158
|
+
(Ye = {
|
|
7934
8159
|
name: 'auto_fit_images',
|
|
7935
8160
|
type: 'boolean',
|
|
7936
|
-
default: !1,
|
|
7937
8161
|
description:
|
|
7938
8162
|
'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.',
|
|
7939
8163
|
}),
|
|
7940
|
-
(
|
|
7941
|
-
((
|
|
8164
|
+
(be = new Set(['full_access', 'is_uncensored', 'unfiltered', 'verificationSignature'])));
|
|
8165
|
+
((Ki = new Set([
|
|
7942
8166
|
'quality',
|
|
7943
8167
|
'bitrate_mode',
|
|
7944
8168
|
'draft',
|
|
@@ -7947,7 +8171,7 @@ var si,
|
|
|
7947
8171
|
'draft_generation_id',
|
|
7948
8172
|
'pass_faces',
|
|
7949
8173
|
])),
|
|
7950
|
-
(
|
|
8174
|
+
(Si = new Set([
|
|
7951
8175
|
'quality',
|
|
7952
8176
|
'bitrate_mode',
|
|
7953
8177
|
'draft',
|
|
@@ -7955,13 +8179,13 @@ var si,
|
|
|
7955
8179
|
'draft_task_id',
|
|
7956
8180
|
'draft_generation_id',
|
|
7957
8181
|
])),
|
|
7958
|
-
(
|
|
8182
|
+
(Ci = {
|
|
7959
8183
|
images: 'up to 10',
|
|
7960
8184
|
videos: 'up to 5; combined duration < 30s',
|
|
7961
8185
|
audios: 'up to 5; combined duration < 30s',
|
|
7962
8186
|
}));
|
|
7963
|
-
((
|
|
7964
|
-
|
|
8187
|
+
((qi = [
|
|
8188
|
+
C('The user message or task.'),
|
|
7965
8189
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
7966
8190
|
{
|
|
7967
8191
|
name: 'messages',
|
|
@@ -7978,8 +8202,8 @@ var si,
|
|
|
7978
8202
|
{ name: 'temperature', type: 'slider', min: 0, max: 1, step: 0.1 },
|
|
7979
8203
|
{ name: 'top_p', type: 'slider', min: 0, max: 1, step: 0.05 },
|
|
7980
8204
|
]),
|
|
7981
|
-
(
|
|
7982
|
-
|
|
8205
|
+
(Oi = [
|
|
8206
|
+
C('The user message or task.'),
|
|
7983
8207
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
7984
8208
|
{
|
|
7985
8209
|
name: 'messages',
|
|
@@ -8060,8 +8284,8 @@ var si,
|
|
|
8060
8284
|
description: 'Video frames read a second.',
|
|
8061
8285
|
},
|
|
8062
8286
|
]),
|
|
8063
|
-
(
|
|
8064
|
-
|
|
8287
|
+
(Ri = ['gemini-3.8-flash', 'gemini-3.7-flash']));
|
|
8288
|
+
Ni = Object.entries({
|
|
8065
8289
|
background: !1,
|
|
8066
8290
|
skin: !1,
|
|
8067
8291
|
nose: !1,
|
|
@@ -8087,8 +8311,8 @@ var si,
|
|
|
8087
8311
|
default: t,
|
|
8088
8312
|
description: 'Keep this part out of the fix. Standard only.',
|
|
8089
8313
|
}));
|
|
8090
|
-
((
|
|
8091
|
-
(
|
|
8314
|
+
((Z = 'Left out: 480p, the same default as the API, the playground and workflow steps.'),
|
|
8315
|
+
(He = [
|
|
8092
8316
|
{
|
|
8093
8317
|
name: 'prompt',
|
|
8094
8318
|
type: 'string',
|
|
@@ -8126,7 +8350,7 @@ var si,
|
|
|
8126
8350
|
type: 'select',
|
|
8127
8351
|
default: '480p',
|
|
8128
8352
|
options: ['480p', '720p', '1080p', '4k'],
|
|
8129
|
-
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. ${
|
|
8353
|
+
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. ${Z}`,
|
|
8130
8354
|
},
|
|
8131
8355
|
{
|
|
8132
8356
|
name: 'aspect_ratio',
|
|
@@ -8237,19 +8461,19 @@ var si,
|
|
|
8237
8461
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
8238
8462
|
},
|
|
8239
8463
|
]),
|
|
8240
|
-
(
|
|
8464
|
+
(aa = {
|
|
8241
8465
|
name: 'images',
|
|
8242
8466
|
type: 'string[]',
|
|
8243
8467
|
description:
|
|
8244
8468
|
'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.',
|
|
8245
8469
|
}),
|
|
8246
|
-
(
|
|
8470
|
+
(ia = {
|
|
8247
8471
|
name: 'audios',
|
|
8248
8472
|
type: 'string[]',
|
|
8249
8473
|
description:
|
|
8250
8474
|
'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.',
|
|
8251
8475
|
}),
|
|
8252
|
-
(
|
|
8476
|
+
(Wt = [
|
|
8253
8477
|
{
|
|
8254
8478
|
name: 'prompt',
|
|
8255
8479
|
type: 'string',
|
|
@@ -8293,7 +8517,7 @@ var si,
|
|
|
8293
8517
|
type: 'select',
|
|
8294
8518
|
default: '480p',
|
|
8295
8519
|
options: ['480p', '720p', '1080p', '4k'],
|
|
8296
|
-
description: `Standard: 480p, 720p, 1080p (8-bit) and 4k (10-bit H.265). Fast and Mini: 480p and 720p only. ${
|
|
8520
|
+
description: `Standard: 480p, 720p, 1080p (8-bit) and 4k (10-bit H.265). Fast and Mini: 480p and 720p only. ${Z}`,
|
|
8297
8521
|
},
|
|
8298
8522
|
{
|
|
8299
8523
|
name: 'bitrate_mode',
|
|
@@ -8327,8 +8551,8 @@ var si,
|
|
|
8327
8551
|
description:
|
|
8328
8552
|
'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
|
|
8329
8553
|
},
|
|
8330
|
-
|
|
8331
|
-
|
|
8554
|
+
aa,
|
|
8555
|
+
ia,
|
|
8332
8556
|
{
|
|
8333
8557
|
name: 'first_frame_image',
|
|
8334
8558
|
type: 'string',
|
|
@@ -8349,7 +8573,7 @@ var si,
|
|
|
8349
8573
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
8350
8574
|
},
|
|
8351
8575
|
]),
|
|
8352
|
-
(
|
|
8576
|
+
(ji = [
|
|
8353
8577
|
{
|
|
8354
8578
|
name: 'prompt',
|
|
8355
8579
|
type: 'string',
|
|
@@ -8370,7 +8594,7 @@ var si,
|
|
|
8370
8594
|
type: 'select',
|
|
8371
8595
|
default: '480p',
|
|
8372
8596
|
options: ['480p', '720p'],
|
|
8373
|
-
description: `480p and 720p, both 8-bit. Mini does not serve 1080p or 4k. ${
|
|
8597
|
+
description: `480p and 720p, both 8-bit. Mini does not serve 1080p or 4k. ${Z}`,
|
|
8374
8598
|
},
|
|
8375
8599
|
{
|
|
8376
8600
|
name: 'bitrate_mode',
|
|
@@ -8404,8 +8628,8 @@ var si,
|
|
|
8404
8628
|
description:
|
|
8405
8629
|
'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
|
|
8406
8630
|
},
|
|
8407
|
-
|
|
8408
|
-
|
|
8631
|
+
aa,
|
|
8632
|
+
ia,
|
|
8409
8633
|
{
|
|
8410
8634
|
name: 'first_frame_image',
|
|
8411
8635
|
type: 'string',
|
|
@@ -8420,53 +8644,53 @@ var si,
|
|
|
8420
8644
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
8421
8645
|
},
|
|
8422
8646
|
]));
|
|
8423
|
-
|
|
8424
|
-
|
|
8647
|
+
ke = Hi();
|
|
8648
|
+
Ji = ['draft_task_id', 'draft_generation_id'];
|
|
8425
8649
|
});
|
|
8426
|
-
function
|
|
8650
|
+
function xe(e) {
|
|
8427
8651
|
let t = '/v1/pricing/models',
|
|
8428
|
-
|
|
8429
|
-
return
|
|
8652
|
+
a = e?.trim();
|
|
8653
|
+
return a ? `${t}?model=${encodeURIComponent(a)}` : t;
|
|
8430
8654
|
}
|
|
8431
|
-
var
|
|
8655
|
+
var et = h(() => {
|
|
8432
8656
|
'use strict';
|
|
8433
8657
|
});
|
|
8434
|
-
function
|
|
8658
|
+
function _a(e) {
|
|
8435
8659
|
return e.length <= 1 ? (e[0] ?? '') : `${e.slice(0, -1).join(', ')} and ${e[e.length - 1]}`;
|
|
8436
8660
|
}
|
|
8437
|
-
function
|
|
8438
|
-
let t =
|
|
8439
|
-
|
|
8440
|
-
i = t.filter((s) => !
|
|
8661
|
+
function Pa(e) {
|
|
8662
|
+
let t = ue().filter((s) => s.kind === e && s.unfiltered != null),
|
|
8663
|
+
a = t.filter((s) => X.includes(s.api.model)).map((s) => s.name),
|
|
8664
|
+
i = t.filter((s) => !X.includes(s.api.model)).map((s) => s.name);
|
|
8441
8665
|
return [
|
|
8442
|
-
...(
|
|
8443
|
-
? [`${
|
|
8666
|
+
...(a.length
|
|
8667
|
+
? [`${_a(a)}: runs the Creative mode checkpoint at its published price (+5%).`]
|
|
8444
8668
|
: []),
|
|
8445
|
-
...(i.length ? [`Not available yet on ${
|
|
8669
|
+
...(i.length ? [`Not available yet on ${_a(i)}: ${ye}.`] : []),
|
|
8446
8670
|
'The Acceptable Use Policy applies.',
|
|
8447
8671
|
].join(' ');
|
|
8448
8672
|
}
|
|
8449
|
-
function
|
|
8450
|
-
if (
|
|
8673
|
+
function Ir(e) {
|
|
8674
|
+
if (kr.has(e.name)) return e;
|
|
8451
8675
|
let t = e.inputSchema.properties;
|
|
8452
8676
|
return !t || t.callback_url
|
|
8453
8677
|
? e
|
|
8454
|
-
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url:
|
|
8678
|
+
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url: br } } };
|
|
8455
8679
|
}
|
|
8456
|
-
function
|
|
8680
|
+
function vr(e) {
|
|
8457
8681
|
let t = e.inputSchema.properties;
|
|
8458
8682
|
if (!t) return e;
|
|
8459
|
-
let
|
|
8683
|
+
let a = !1,
|
|
8460
8684
|
i = {};
|
|
8461
8685
|
for (let [n, s] of Object.entries(t))
|
|
8462
|
-
|
|
8463
|
-
? ((i[n] = { ...s, format: 'uri' }), (
|
|
8464
|
-
:
|
|
8465
|
-
? ((i[n] = { ...s, items: { ...s.items, format: 'uri' } }), (
|
|
8686
|
+
Ia.has(n) && s.type === 'string' && !s.format
|
|
8687
|
+
? ((i[n] = { ...s, format: 'uri' }), (a = !0))
|
|
8688
|
+
: Ia.has(n) && s.type === 'array' && s.items?.type === 'string' && !s.items.format
|
|
8689
|
+
? ((i[n] = { ...s, items: { ...s.items, format: 'uri' } }), (a = !0))
|
|
8466
8690
|
: (i[n] = s);
|
|
8467
|
-
return
|
|
8691
|
+
return a ? { ...e, inputSchema: { ...e.inputSchema, properties: i } } : e;
|
|
8468
8692
|
}
|
|
8469
|
-
function
|
|
8693
|
+
function Tr(e) {
|
|
8470
8694
|
switch (e.type) {
|
|
8471
8695
|
case 'string':
|
|
8472
8696
|
return {
|
|
@@ -8521,11 +8745,11 @@ function aa(e) {
|
|
|
8521
8745
|
return { type: 'string', description: e.description };
|
|
8522
8746
|
}
|
|
8523
8747
|
}
|
|
8524
|
-
function
|
|
8525
|
-
let
|
|
8748
|
+
function Mr(e, t) {
|
|
8749
|
+
let a = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
|
|
8526
8750
|
i = {},
|
|
8527
8751
|
n = [];
|
|
8528
|
-
for (let o of e.parameters) ((i[o.name] =
|
|
8752
|
+
for (let o of e.parameters) ((i[o.name] = Tr(o)), o.required && n.push(o.name));
|
|
8529
8753
|
let s = {
|
|
8530
8754
|
type: 'object',
|
|
8531
8755
|
properties: i,
|
|
@@ -8533,20 +8757,20 @@ function na(e, t) {
|
|
|
8533
8757
|
additionalProperties: !0,
|
|
8534
8758
|
};
|
|
8535
8759
|
return {
|
|
8536
|
-
name:
|
|
8760
|
+
name: a,
|
|
8537
8761
|
description: `[Tein AI - ${e.name} (${e.category})] ${e.description} (Pricing: ${e.priceFormatted})`,
|
|
8538
8762
|
inputSchema: s,
|
|
8539
8763
|
};
|
|
8540
8764
|
}
|
|
8541
|
-
function
|
|
8542
|
-
let e = D().filter((d) => d.category === 'Image' && !
|
|
8765
|
+
function Kr() {
|
|
8766
|
+
let e = D().filter((d) => d.category === 'Image' && !we(d)),
|
|
8543
8767
|
t = D().filter((d) => d.category === 'Video'),
|
|
8544
|
-
|
|
8768
|
+
a = D().filter((d) => d.category === 'Text'),
|
|
8545
8769
|
i = D().filter((d) => d.category === 'Audio'),
|
|
8546
8770
|
n = {
|
|
8547
8771
|
name: 'generate_image',
|
|
8548
8772
|
description:
|
|
8549
|
-
|
|
8773
|
+
"Generate or edit images with Tein AI image models (GPT Image 2 and 2.5, Nano Banana 2 and Pro, Seedream 5.5 and 5.0 Pro, Qwen Image 3.0, Hailuo 3 Image). Billed per image at the published price. A field left out takes the chosen model's own default (see its own tool); send only the fields that model takes.",
|
|
8550
8774
|
inputSchema: {
|
|
8551
8775
|
type: 'object',
|
|
8552
8776
|
properties: {
|
|
@@ -8568,8 +8792,8 @@ function sa() {
|
|
|
8568
8792
|
resolution: {
|
|
8569
8793
|
type: 'string',
|
|
8570
8794
|
enum: ['1K', '2K', '4K'],
|
|
8571
|
-
|
|
8572
|
-
|
|
8795
|
+
description:
|
|
8796
|
+
"Output resolution (1K, 2K, or 4K where supported). Left out: the model's own default.",
|
|
8573
8797
|
},
|
|
8574
8798
|
images: {
|
|
8575
8799
|
type: 'array',
|
|
@@ -8580,20 +8804,17 @@ function sa() {
|
|
|
8580
8804
|
endpoint: {
|
|
8581
8805
|
type: 'string',
|
|
8582
8806
|
enum: ['dynamic', 'token', 'flat', 'medium'],
|
|
8583
|
-
default: 'dynamic',
|
|
8584
8807
|
description:
|
|
8585
8808
|
'GPT Image models only. dynamic: lowest price for this request; token: billed by tokens within published limits; flat: one price at any quality or prompt length; medium: gpt-image-2 only, medium quality at one price for any resolution (non-square ratios at 1K only).',
|
|
8586
8809
|
},
|
|
8587
8810
|
quality: {
|
|
8588
8811
|
type: 'string',
|
|
8589
8812
|
enum: ['low', 'medium', 'high', 'xhigh', 'max'],
|
|
8590
|
-
default: 'low',
|
|
8591
8813
|
description:
|
|
8592
8814
|
'GPT Image models only. gpt-image-2 supports low, medium and high; the 2.5 models also xhigh and max.',
|
|
8593
8815
|
},
|
|
8594
8816
|
n: {
|
|
8595
8817
|
type: 'number',
|
|
8596
|
-
default: 1,
|
|
8597
8818
|
minimum: 1,
|
|
8598
8819
|
maximum: 10,
|
|
8599
8820
|
description:
|
|
@@ -8602,7 +8823,6 @@ function sa() {
|
|
|
8602
8823
|
output_format: {
|
|
8603
8824
|
type: 'string',
|
|
8604
8825
|
enum: ['png', 'jpeg', 'webp'],
|
|
8605
|
-
default: 'png',
|
|
8606
8826
|
description:
|
|
8607
8827
|
'GPT Image 2 and Nano Banana. jpeg and webp on GPT Image take output_compression.',
|
|
8608
8828
|
},
|
|
@@ -8615,7 +8835,6 @@ function sa() {
|
|
|
8615
8835
|
background: {
|
|
8616
8836
|
type: 'string',
|
|
8617
8837
|
enum: ['auto', 'opaque', 'transparent'],
|
|
8618
|
-
default: 'auto',
|
|
8619
8838
|
description: 'GPT Image 2 only. transparent asks for no backdrop.',
|
|
8620
8839
|
},
|
|
8621
8840
|
input_fidelity: {
|
|
@@ -8634,7 +8853,7 @@ function sa() {
|
|
|
8634
8853
|
maximum: 2147483647,
|
|
8635
8854
|
description: 'Nano Banana 2 and Nano Banana Pro. Omit it for a new image each time.',
|
|
8636
8855
|
},
|
|
8637
|
-
creative_mode: { type: 'boolean',
|
|
8856
|
+
creative_mode: { type: 'boolean', description: Pa('image') },
|
|
8638
8857
|
},
|
|
8639
8858
|
required: ['prompt'],
|
|
8640
8859
|
additionalProperties: !0,
|
|
@@ -8643,14 +8862,14 @@ function sa() {
|
|
|
8643
8862
|
s = {
|
|
8644
8863
|
name: 'generate_video',
|
|
8645
8864
|
description:
|
|
8646
|
-
|
|
8865
|
+
"Generate video with Tein AI video models (Seedance 2.5, Seedance 2.0 with quality standard, fast or mini, Wan 3.0, HappyHorse, Hailuo 3). Seedance and Wan take creative_mode; Seedance takes priority. A field left out takes the chosen model's own default (see its own tool); send only the fields that model takes. A model that takes no prompt (Tein Video Upscaler) is called without one.",
|
|
8647
8866
|
inputSchema: {
|
|
8648
8867
|
type: 'object',
|
|
8649
8868
|
properties: {
|
|
8650
8869
|
prompt: {
|
|
8651
8870
|
type: 'string',
|
|
8652
8871
|
description:
|
|
8653
|
-
'Detailed description of the video scene, character motion, lighting, and camera movement.',
|
|
8872
|
+
'Detailed description of the video scene, character motion, lighting, and camera movement. Required by every model that takes a prompt; leave it out for a model that takes none.',
|
|
8654
8873
|
},
|
|
8655
8874
|
model: {
|
|
8656
8875
|
type: 'string',
|
|
@@ -8660,29 +8879,28 @@ function sa() {
|
|
|
8660
8879
|
},
|
|
8661
8880
|
duration: {
|
|
8662
8881
|
type: 'number',
|
|
8663
|
-
default: 5,
|
|
8664
8882
|
minimum: 4,
|
|
8665
8883
|
maximum: 30,
|
|
8666
|
-
description:
|
|
8884
|
+
description:
|
|
8885
|
+
"Duration in seconds (4 to 30 depending on model). Left out: the model's own default.",
|
|
8667
8886
|
},
|
|
8668
8887
|
resolution: {
|
|
8669
8888
|
type: 'string',
|
|
8670
8889
|
enum: ['480p', '720p', '768p', '1080p', '2k', '4k'],
|
|
8671
|
-
|
|
8672
|
-
|
|
8890
|
+
description:
|
|
8891
|
+
"Video resolution, where the model takes it (see each model tool). Left out: the model's own default, its lowest price.",
|
|
8673
8892
|
},
|
|
8674
|
-
creative_mode: { type: 'boolean',
|
|
8893
|
+
creative_mode: { type: 'boolean', description: Pa('video') },
|
|
8675
8894
|
priority: {
|
|
8676
8895
|
type: 'boolean',
|
|
8677
|
-
default: !1,
|
|
8678
8896
|
description:
|
|
8679
8897
|
'Seedance models only: guaranteed speed and no queue, at the published Priority price (+6%).',
|
|
8680
8898
|
},
|
|
8681
8899
|
aspect_ratio: {
|
|
8682
8900
|
type: 'string',
|
|
8683
8901
|
enum: ['16:9', '9:16', '1:1', '4:3', '3:4', '21:9', 'adaptive'],
|
|
8684
|
-
|
|
8685
|
-
|
|
8902
|
+
description:
|
|
8903
|
+
"Aspect ratio of the video, where the model takes one. Left out: the model's own default.",
|
|
8686
8904
|
},
|
|
8687
8905
|
first_frame_image: {
|
|
8688
8906
|
type: 'string',
|
|
@@ -8691,8 +8909,8 @@ function sa() {
|
|
|
8691
8909
|
},
|
|
8692
8910
|
generate_audio: {
|
|
8693
8911
|
type: 'boolean',
|
|
8694
|
-
|
|
8695
|
-
|
|
8912
|
+
description:
|
|
8913
|
+
"Generate synchronized sound, on the models that take it (see each model tool). Left out: the model's own default.",
|
|
8696
8914
|
},
|
|
8697
8915
|
images: {
|
|
8698
8916
|
type: 'array',
|
|
@@ -8701,7 +8919,6 @@ function sa() {
|
|
|
8701
8919
|
'Optional reference images 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.',
|
|
8702
8920
|
},
|
|
8703
8921
|
},
|
|
8704
|
-
required: ['prompt'],
|
|
8705
8922
|
additionalProperties: !0,
|
|
8706
8923
|
},
|
|
8707
8924
|
},
|
|
@@ -8739,7 +8956,7 @@ function sa() {
|
|
|
8739
8956
|
prompt: { type: 'string', description: 'The reasoning task or query to execute.' },
|
|
8740
8957
|
model: {
|
|
8741
8958
|
type: 'string',
|
|
8742
|
-
enum:
|
|
8959
|
+
enum: a.map((d) => d.slug),
|
|
8743
8960
|
default: 'gpt-6-astra',
|
|
8744
8961
|
description: 'The reasoning model to use (default: gpt-6-astra).',
|
|
8745
8962
|
},
|
|
@@ -8809,10 +9026,10 @@ function sa() {
|
|
|
8809
9026
|
additionalProperties: !0,
|
|
8810
9027
|
},
|
|
8811
9028
|
},
|
|
8812
|
-
p =
|
|
8813
|
-
return [n, s, o, u, l, p, c,
|
|
9029
|
+
p = Sr();
|
|
9030
|
+
return [n, s, o, u, l, p, c, wr, ...va];
|
|
8814
9031
|
}
|
|
8815
|
-
function
|
|
9032
|
+
function Sr() {
|
|
8816
9033
|
return {
|
|
8817
9034
|
name: 'upload_asset',
|
|
8818
9035
|
description:
|
|
@@ -8859,34 +9076,42 @@ function oa() {
|
|
|
8859
9076
|
},
|
|
8860
9077
|
};
|
|
8861
9078
|
}
|
|
8862
|
-
function
|
|
8863
|
-
let e =
|
|
8864
|
-
t = D().map((
|
|
8865
|
-
return [...e, ...t].map(
|
|
9079
|
+
function st() {
|
|
9080
|
+
let e = Kr(),
|
|
9081
|
+
t = D().map((a) => Mr(a));
|
|
9082
|
+
return [...e, ...t].map(Ir).map(vr);
|
|
8866
9083
|
}
|
|
8867
|
-
var
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
|
|
9084
|
+
var br,
|
|
9085
|
+
kr,
|
|
9086
|
+
wr,
|
|
9087
|
+
xr,
|
|
9088
|
+
_r,
|
|
9089
|
+
Pr,
|
|
9090
|
+
va,
|
|
9091
|
+
Cs,
|
|
9092
|
+
Ia,
|
|
9093
|
+
Ta = h(() => {
|
|
8872
9094
|
'use strict';
|
|
8873
|
-
|
|
8874
|
-
|
|
8875
|
-
|
|
8876
|
-
((
|
|
9095
|
+
G();
|
|
9096
|
+
Fe();
|
|
9097
|
+
ee();
|
|
9098
|
+
((br = {
|
|
8877
9099
|
type: 'string',
|
|
8878
9100
|
description:
|
|
8879
9101
|
'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.',
|
|
8880
9102
|
}),
|
|
8881
|
-
(
|
|
9103
|
+
(kr = new Set([
|
|
8882
9104
|
'upload_asset',
|
|
8883
9105
|
'upload_media',
|
|
8884
9106
|
'upload_image',
|
|
8885
9107
|
'get_generation_status',
|
|
8886
9108
|
'check_status',
|
|
8887
9109
|
'get_pricing',
|
|
9110
|
+
'get_balance',
|
|
9111
|
+
'get_usage',
|
|
9112
|
+
'get_balance_history',
|
|
8888
9113
|
])),
|
|
8889
|
-
(
|
|
9114
|
+
(wr = {
|
|
8890
9115
|
name: 'get_pricing',
|
|
8891
9116
|
description:
|
|
8892
9117
|
'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. No API key is required. Pass model to keep one catalog slug or API model id (for example seedance-2-5). The same payload as GET /v1/pricing/models.',
|
|
@@ -8900,8 +9125,65 @@ var Zi,
|
|
|
8900
9125
|
},
|
|
8901
9126
|
additionalProperties: !1,
|
|
8902
9127
|
},
|
|
8903
|
-
})
|
|
8904
|
-
|
|
9128
|
+
}),
|
|
9129
|
+
(xr = {
|
|
9130
|
+
name: 'get_balance',
|
|
9131
|
+
description:
|
|
9132
|
+
"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.",
|
|
9133
|
+
inputSchema: { type: 'object', properties: {}, additionalProperties: !1 },
|
|
9134
|
+
}),
|
|
9135
|
+
(_r = {
|
|
9136
|
+
name: 'get_usage',
|
|
9137
|
+
description:
|
|
9138
|
+
"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.",
|
|
9139
|
+
inputSchema: {
|
|
9140
|
+
type: 'object',
|
|
9141
|
+
properties: {
|
|
9142
|
+
range: {
|
|
9143
|
+
type: 'string',
|
|
9144
|
+
enum: ['hour', 'day', 'week', 'month', 'custom'],
|
|
9145
|
+
description:
|
|
9146
|
+
'hour: the last 24 hours by hour. day (default): the last 30 days by day. week: the last 12 weeks. month: the last 12 months. custom: from..to by day, both days included, at most 366 days.',
|
|
9147
|
+
},
|
|
9148
|
+
from: {
|
|
9149
|
+
type: 'string',
|
|
9150
|
+
description: 'range=custom only: first day, YYYY-MM-DD (UTC).',
|
|
9151
|
+
},
|
|
9152
|
+
to: { type: 'string', description: 'range=custom only: last day, YYYY-MM-DD (UTC).' },
|
|
9153
|
+
model: {
|
|
9154
|
+
type: 'string',
|
|
9155
|
+
description: 'Optional: count only this model id (e.g. seedance-2-5).',
|
|
9156
|
+
},
|
|
9157
|
+
channel: {
|
|
9158
|
+
type: 'string',
|
|
9159
|
+
enum: ['website', 'api', 'mcp', 'cli'],
|
|
9160
|
+
description: 'Optional: count only runs started there.',
|
|
9161
|
+
},
|
|
9162
|
+
},
|
|
9163
|
+
additionalProperties: !1,
|
|
9164
|
+
},
|
|
9165
|
+
}),
|
|
9166
|
+
(Pr = {
|
|
9167
|
+
name: 'get_balance_history',
|
|
9168
|
+
description:
|
|
9169
|
+
"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.",
|
|
9170
|
+
inputSchema: {
|
|
9171
|
+
type: 'object',
|
|
9172
|
+
properties: {
|
|
9173
|
+
limit: { type: 'integer', description: 'How many (1-100, default 50).' },
|
|
9174
|
+
after: { type: 'string', description: 'next_cursor of the previous page.' },
|
|
9175
|
+
type: {
|
|
9176
|
+
type: 'string',
|
|
9177
|
+
description:
|
|
9178
|
+
'Optional, comma separated: topup, auto_topup, usage (charges), refund, credit_grant, adjustment, referral, referral_cash, forfeit, starter, subscription.',
|
|
9179
|
+
},
|
|
9180
|
+
},
|
|
9181
|
+
additionalProperties: !1,
|
|
9182
|
+
},
|
|
9183
|
+
}),
|
|
9184
|
+
(va = [xr, _r, Pr]),
|
|
9185
|
+
(Cs = new Set(va.map((e) => e.name))));
|
|
9186
|
+
Ia = new Set([
|
|
8905
9187
|
'image',
|
|
8906
9188
|
'images',
|
|
8907
9189
|
'image_url',
|
|
@@ -8918,30 +9200,30 @@ var Zi,
|
|
|
8918
9200
|
'lipsyncing_audio',
|
|
8919
9201
|
]);
|
|
8920
9202
|
});
|
|
8921
|
-
var
|
|
8922
|
-
|
|
8923
|
-
forgetToolSchemas: () =>
|
|
8924
|
-
jsonRpcAnswer: () =>
|
|
8925
|
-
preprocessLocalFiles: () =>
|
|
8926
|
-
startStdioServer: () =>
|
|
9203
|
+
var Ra = {};
|
|
9204
|
+
ja(Ra, {
|
|
9205
|
+
forgetToolSchemas: () => qr,
|
|
9206
|
+
jsonRpcAnswer: () => Ca,
|
|
9207
|
+
preprocessLocalFiles: () => qa,
|
|
9208
|
+
startStdioServer: () => Oa,
|
|
8927
9209
|
});
|
|
8928
|
-
function
|
|
8929
|
-
let t = (
|
|
8930
|
-
!!
|
|
9210
|
+
function Cr(e) {
|
|
9211
|
+
let t = (a) =>
|
|
9212
|
+
!!a && typeof a == 'object' && a.jsonrpc === '2.0' && ('result' in a || 'error' in a);
|
|
8931
9213
|
return Array.isArray(e) ? e.length > 0 && e.every(t) : t(e);
|
|
8932
9214
|
}
|
|
8933
|
-
function
|
|
9215
|
+
function Ca(e, t, a) {
|
|
8934
9216
|
let i = e?.id,
|
|
8935
9217
|
n = i == null,
|
|
8936
9218
|
s = null;
|
|
8937
9219
|
try {
|
|
8938
|
-
s =
|
|
9220
|
+
s = a ? JSON.parse(a) : null;
|
|
8939
9221
|
} catch {
|
|
8940
9222
|
s = null;
|
|
8941
9223
|
}
|
|
8942
|
-
if (s !== null &&
|
|
9224
|
+
if (s !== null && Cr(s)) return n ? null : s;
|
|
8943
9225
|
if (n) return null;
|
|
8944
|
-
if (!
|
|
9226
|
+
if (!a && t >= 200 && t < 300) return;
|
|
8945
9227
|
let o = s?.error,
|
|
8946
9228
|
u =
|
|
8947
9229
|
typeof o == 'string'
|
|
@@ -8960,19 +9242,19 @@ function yr(e, t, r) {
|
|
|
8960
9242
|
},
|
|
8961
9243
|
};
|
|
8962
9244
|
}
|
|
8963
|
-
function
|
|
9245
|
+
function Er() {
|
|
8964
9246
|
let e = process.argv.slice(2),
|
|
8965
9247
|
t = e.indexOf('--api-key');
|
|
8966
|
-
return
|
|
9248
|
+
return S(t >= 0 ? e[t + 1] : void 0);
|
|
8967
9249
|
}
|
|
8968
|
-
async function
|
|
8969
|
-
let i =
|
|
8970
|
-
if (!
|
|
9250
|
+
async function Ea(e, t, a) {
|
|
9251
|
+
let i = z.default.resolve(e);
|
|
9252
|
+
if (!V.default.existsSync(i) || !V.default.statSync(i).isFile())
|
|
8971
9253
|
throw new Error(`File not found: ${e}`);
|
|
8972
|
-
let n =
|
|
9254
|
+
let n = V.default.readFileSync(i),
|
|
8973
9255
|
s = n.toString('base64'),
|
|
8974
9256
|
o = n.length,
|
|
8975
|
-
u = `${
|
|
9257
|
+
u = `${a.replace(/\/$/, '')}/v1/upload`,
|
|
8976
9258
|
l = await fetch(u, {
|
|
8977
9259
|
method: 'POST',
|
|
8978
9260
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${t}` },
|
|
@@ -8994,15 +9276,15 @@ async function br(e, t, r) {
|
|
|
8994
9276
|
mimeType: c.mime_type || c.mimeType || 'image/png',
|
|
8995
9277
|
};
|
|
8996
9278
|
}
|
|
8997
|
-
function
|
|
8998
|
-
return
|
|
9279
|
+
function $a(e) {
|
|
9280
|
+
return $r.has(z.default.extname(e).toLowerCase());
|
|
8999
9281
|
}
|
|
9000
|
-
function
|
|
9282
|
+
function Aa(e) {
|
|
9001
9283
|
return new Error(
|
|
9002
|
-
`Tein uploads image, video and audio files only, and ${
|
|
9284
|
+
`Tein uploads image, video and audio files only, and ${z.default.basename(e)} is not one.`,
|
|
9003
9285
|
);
|
|
9004
9286
|
}
|
|
9005
|
-
function
|
|
9287
|
+
function Ar(e) {
|
|
9006
9288
|
let t = e.trim();
|
|
9007
9289
|
if (
|
|
9008
9290
|
!t ||
|
|
@@ -9012,25 +9294,25 @@ function ca(e) {
|
|
|
9012
9294
|
`)
|
|
9013
9295
|
)
|
|
9014
9296
|
return null;
|
|
9015
|
-
let
|
|
9016
|
-
return
|
|
9297
|
+
let a = z.default.resolve(t);
|
|
9298
|
+
return V.default.existsSync(a) && V.default.statSync(a).isFile() ? a : null;
|
|
9017
9299
|
}
|
|
9018
|
-
function
|
|
9300
|
+
function lt(e) {
|
|
9019
9301
|
if (Array.isArray(e))
|
|
9020
9302
|
for (let t of e) {
|
|
9021
|
-
let
|
|
9022
|
-
typeof
|
|
9023
|
-
|
|
9024
|
-
typeof
|
|
9025
|
-
|
|
9303
|
+
let a = t;
|
|
9304
|
+
typeof a.name == 'string' &&
|
|
9305
|
+
a.inputSchema &&
|
|
9306
|
+
typeof a.inputSchema == 'object' &&
|
|
9307
|
+
ie.set(a.name, a.inputSchema);
|
|
9026
9308
|
}
|
|
9027
9309
|
}
|
|
9028
|
-
function
|
|
9029
|
-
(
|
|
9310
|
+
function qr() {
|
|
9311
|
+
(ie.clear(), (ot = 0));
|
|
9030
9312
|
}
|
|
9031
|
-
async function
|
|
9032
|
-
if (!(Date.now() -
|
|
9033
|
-
|
|
9313
|
+
async function Or(e, t) {
|
|
9314
|
+
if (!(Date.now() - ot < 6e4)) {
|
|
9315
|
+
ot = Date.now();
|
|
9034
9316
|
try {
|
|
9035
9317
|
let i = await (
|
|
9036
9318
|
await fetch(e, {
|
|
@@ -9040,39 +9322,39 @@ async function ma(e, t) {
|
|
|
9040
9322
|
signal: AbortSignal.timeout(1e4),
|
|
9041
9323
|
})
|
|
9042
9324
|
).json();
|
|
9043
|
-
|
|
9325
|
+
lt(i.result?.tools);
|
|
9044
9326
|
} catch {}
|
|
9045
9327
|
}
|
|
9046
9328
|
}
|
|
9047
|
-
function
|
|
9329
|
+
function Rr(e) {
|
|
9048
9330
|
return e
|
|
9049
9331
|
? e.type === 'string'
|
|
9050
9332
|
? e.format === 'uri'
|
|
9051
9333
|
: e.type === 'array' && e.items?.format === 'uri'
|
|
9052
9334
|
: !1;
|
|
9053
9335
|
}
|
|
9054
|
-
async function
|
|
9336
|
+
async function Ma(e, t, a) {
|
|
9055
9337
|
if (typeof e != 'string') return e;
|
|
9056
|
-
let i =
|
|
9338
|
+
let i = Ar(e);
|
|
9057
9339
|
if (!i) return e;
|
|
9058
|
-
if (
|
|
9059
|
-
return (await
|
|
9340
|
+
if (!$a(i)) throw Aa(i);
|
|
9341
|
+
return (await Ea(i, t, a)).url;
|
|
9060
9342
|
}
|
|
9061
|
-
async function
|
|
9062
|
-
(
|
|
9063
|
-
let s =
|
|
9343
|
+
async function qa(e, t, a, i, n) {
|
|
9344
|
+
(ie.size === 0 && lt(st()), ie.has(e) || (await Or(n, a)));
|
|
9345
|
+
let s = ie.get(e)?.properties;
|
|
9064
9346
|
if (!s) return t;
|
|
9065
9347
|
let o = { ...t };
|
|
9066
9348
|
for (let [u, l] of Object.entries(t))
|
|
9067
|
-
if (
|
|
9349
|
+
if (Rr(s[u]))
|
|
9068
9350
|
if (Array.isArray(l)) {
|
|
9069
9351
|
let c = [];
|
|
9070
|
-
for (let p of l) c.push(await
|
|
9352
|
+
for (let p of l) c.push(await Ma(p, a, i));
|
|
9071
9353
|
o[u] = c;
|
|
9072
|
-
} else o[u] = await
|
|
9354
|
+
} else o[u] = await Ma(l, a, i);
|
|
9073
9355
|
return o;
|
|
9074
9356
|
}
|
|
9075
|
-
function
|
|
9357
|
+
function Lr(e) {
|
|
9076
9358
|
let t = e.id ?? null;
|
|
9077
9359
|
switch (e.method) {
|
|
9078
9360
|
case 'initialize':
|
|
@@ -9082,7 +9364,7 @@ function ga(e) {
|
|
|
9082
9364
|
result: {
|
|
9083
9365
|
protocolVersion: '2024-11-05',
|
|
9084
9366
|
capabilities: { tools: { listChanged: !1 } },
|
|
9085
|
-
serverInfo: { name: 'tein-mcp', version:
|
|
9367
|
+
serverInfo: { name: 'tein-mcp', version: F },
|
|
9086
9368
|
},
|
|
9087
9369
|
};
|
|
9088
9370
|
case 'notifications/initialized':
|
|
@@ -9090,7 +9372,7 @@ function ga(e) {
|
|
|
9090
9372
|
case 'ping':
|
|
9091
9373
|
return { jsonrpc: '2.0', id: t, result: {} };
|
|
9092
9374
|
case 'tools/list':
|
|
9093
|
-
return { jsonrpc: '2.0', id: t, result: { tools:
|
|
9375
|
+
return { jsonrpc: '2.0', id: t, result: { tools: st() } };
|
|
9094
9376
|
case 'tools/call':
|
|
9095
9377
|
return {
|
|
9096
9378
|
jsonrpc: '2.0',
|
|
@@ -9113,13 +9395,13 @@ function ga(e) {
|
|
|
9113
9395
|
};
|
|
9114
9396
|
}
|
|
9115
9397
|
}
|
|
9116
|
-
async function
|
|
9117
|
-
if (
|
|
9118
|
-
|
|
9119
|
-
let e =
|
|
9120
|
-
t =
|
|
9121
|
-
|
|
9122
|
-
(
|
|
9398
|
+
async function Oa() {
|
|
9399
|
+
if (Ka) return;
|
|
9400
|
+
Ka = !0;
|
|
9401
|
+
let e = Er(),
|
|
9402
|
+
t = w(),
|
|
9403
|
+
a = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
|
|
9404
|
+
(Sa.default
|
|
9123
9405
|
.createInterface({ input: process.stdin, output: process.stdout, terminal: !1 })
|
|
9124
9406
|
.on('line', async (n) => {
|
|
9125
9407
|
let s = n.trim();
|
|
@@ -9131,10 +9413,10 @@ async function _r() {
|
|
|
9131
9413
|
c = o.params.arguments || {};
|
|
9132
9414
|
if (l === 'get_pricing') {
|
|
9133
9415
|
let p = typeof c.model == 'string' ? c.model.trim() : '',
|
|
9134
|
-
d = `${t.replace(/\/+$/, '')}${
|
|
9416
|
+
d = `${t.replace(/\/+$/, '')}${xe(p)}`;
|
|
9135
9417
|
try {
|
|
9136
9418
|
let m = await fetch(d, { signal: AbortSignal.timeout(1e4) }),
|
|
9137
|
-
|
|
9419
|
+
y = await m.text();
|
|
9138
9420
|
process.stdout.write(
|
|
9139
9421
|
JSON.stringify({
|
|
9140
9422
|
jsonrpc: '2.0',
|
|
@@ -9143,7 +9425,7 @@ async function _r() {
|
|
|
9143
9425
|
content: [
|
|
9144
9426
|
{
|
|
9145
9427
|
type: 'text',
|
|
9146
|
-
text: m.ok ?
|
|
9428
|
+
text: m.ok ? y : `Pricing request failed (${m.status}). ${y}`,
|
|
9147
9429
|
},
|
|
9148
9430
|
],
|
|
9149
9431
|
isError: !m.ok,
|
|
@@ -9153,13 +9435,13 @@ async function _r() {
|
|
|
9153
9435
|
`,
|
|
9154
9436
|
);
|
|
9155
9437
|
} catch (m) {
|
|
9156
|
-
let
|
|
9438
|
+
let y = m instanceof Error ? m.message : String(m);
|
|
9157
9439
|
process.stdout.write(
|
|
9158
9440
|
JSON.stringify({
|
|
9159
9441
|
jsonrpc: '2.0',
|
|
9160
9442
|
id: o.id,
|
|
9161
9443
|
result: {
|
|
9162
|
-
content: [{ type: 'text', text: `Could not reach Tein prices: ${
|
|
9444
|
+
content: [{ type: 'text', text: `Could not reach Tein prices: ${y}` }],
|
|
9163
9445
|
isError: !0,
|
|
9164
9446
|
},
|
|
9165
9447
|
}) +
|
|
@@ -9178,19 +9460,19 @@ async function _r() {
|
|
|
9178
9460
|
!p.startsWith('data:')
|
|
9179
9461
|
)
|
|
9180
9462
|
try {
|
|
9181
|
-
let d =
|
|
9182
|
-
if (
|
|
9183
|
-
if (
|
|
9184
|
-
let m = await
|
|
9185
|
-
|
|
9186
|
-
|
|
9463
|
+
let d = z.default.resolve(p.trim());
|
|
9464
|
+
if (V.default.existsSync(d) && V.default.statSync(d).isFile() && e) {
|
|
9465
|
+
if (!$a(d)) throw Aa(d);
|
|
9466
|
+
let m = await Ea(d, e, t),
|
|
9467
|
+
y = (m.sizeBytes / 1024).toFixed(1),
|
|
9468
|
+
_e =
|
|
9187
9469
|
m.mimeType.startsWith('image/') ||
|
|
9188
9470
|
/\.(png|jpe?g|webp|gif|svg)$/i.test(m.url)
|
|
9189
9471
|
? `
|
|
9190
9472
|
|
|
9191
9473
|
`
|
|
9192
9474
|
: '',
|
|
9193
|
-
|
|
9475
|
+
Pe = {
|
|
9194
9476
|
jsonrpc: '2.0',
|
|
9195
9477
|
id: o.id,
|
|
9196
9478
|
result: {
|
|
@@ -9201,7 +9483,7 @@ async function _r() {
|
|
|
9201
9483
|
|
|
9202
9484
|
- **URL:** ${m.url}
|
|
9203
9485
|
- **Type:** \`${m.mimeType}\`
|
|
9204
|
-
- **Size:** ${
|
|
9486
|
+
- **Size:** ${y} KB${_e}
|
|
9205
9487
|
|
|
9206
9488
|
Pass this URL to any Tein generation tool.`,
|
|
9207
9489
|
},
|
|
@@ -9210,7 +9492,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9210
9492
|
},
|
|
9211
9493
|
};
|
|
9212
9494
|
process.stdout.write(
|
|
9213
|
-
JSON.stringify(
|
|
9495
|
+
JSON.stringify(Pe) +
|
|
9214
9496
|
`
|
|
9215
9497
|
`,
|
|
9216
9498
|
);
|
|
@@ -9237,7 +9519,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9237
9519
|
}
|
|
9238
9520
|
if (e)
|
|
9239
9521
|
try {
|
|
9240
|
-
o.params.arguments = await
|
|
9522
|
+
o.params.arguments = await qa(String(l), c, e, t, a);
|
|
9241
9523
|
} catch (p) {
|
|
9242
9524
|
let d = p instanceof Error ? p.message : String(p);
|
|
9243
9525
|
process.stdout.write(
|
|
@@ -9262,16 +9544,16 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9262
9544
|
}
|
|
9263
9545
|
if (e)
|
|
9264
9546
|
try {
|
|
9265
|
-
let l = await fetch(
|
|
9547
|
+
let l = await fetch(a, {
|
|
9266
9548
|
method: 'POST',
|
|
9267
9549
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${e}` },
|
|
9268
9550
|
body: JSON.stringify(o),
|
|
9269
9551
|
}),
|
|
9270
9552
|
c = await l.text(),
|
|
9271
|
-
p =
|
|
9553
|
+
p = Ca(o, l.status, c);
|
|
9272
9554
|
if (p === null) return;
|
|
9273
9555
|
if (p) {
|
|
9274
|
-
(o?.method === 'tools/list' &&
|
|
9556
|
+
(o?.method === 'tools/list' && lt(p.result?.tools),
|
|
9275
9557
|
process.stdout.write(
|
|
9276
9558
|
JSON.stringify(p) +
|
|
9277
9559
|
`
|
|
@@ -9280,7 +9562,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9280
9562
|
return;
|
|
9281
9563
|
}
|
|
9282
9564
|
} catch {}
|
|
9283
|
-
let u =
|
|
9565
|
+
let u = Lr(o);
|
|
9284
9566
|
u !== null &&
|
|
9285
9567
|
process.stdout.write(
|
|
9286
9568
|
JSON.stringify(u) +
|
|
@@ -9303,22 +9585,23 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9303
9585
|
process.stderr.write(`Tein AI MCP Server running on stdio transport.
|
|
9304
9586
|
`));
|
|
9305
9587
|
}
|
|
9306
|
-
var
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
|
|
9588
|
+
var V,
|
|
9589
|
+
z,
|
|
9590
|
+
Sa,
|
|
9591
|
+
$r,
|
|
9592
|
+
ie,
|
|
9593
|
+
ot,
|
|
9594
|
+
Ka,
|
|
9595
|
+
La = h(() => {
|
|
9314
9596
|
'use strict';
|
|
9315
|
-
((
|
|
9316
|
-
(
|
|
9317
|
-
(
|
|
9318
|
-
|
|
9319
|
-
|
|
9320
|
-
|
|
9321
|
-
|
|
9597
|
+
((V = T(require('node:fs'))),
|
|
9598
|
+
(z = T(require('node:path'))),
|
|
9599
|
+
(Sa = T(require('node:readline'))));
|
|
9600
|
+
et();
|
|
9601
|
+
Ta();
|
|
9602
|
+
$();
|
|
9603
|
+
re();
|
|
9604
|
+
$r = new Set([
|
|
9322
9605
|
'.png',
|
|
9323
9606
|
'.jpg',
|
|
9324
9607
|
'.jpeg',
|
|
@@ -9344,42 +9627,42 @@ var L,
|
|
|
9344
9627
|
'.flac',
|
|
9345
9628
|
'.opus',
|
|
9346
9629
|
]);
|
|
9347
|
-
((
|
|
9348
|
-
|
|
9630
|
+
((ie = new Map()), (ot = 0));
|
|
9631
|
+
Ka = !1;
|
|
9349
9632
|
require.main === module &&
|
|
9350
|
-
|
|
9633
|
+
Oa().catch((e) => {
|
|
9351
9634
|
(process.stderr.write(`Fatal error in Tein MCP CLI: ${e}
|
|
9352
9635
|
`),
|
|
9353
9636
|
process.exit(1));
|
|
9354
9637
|
});
|
|
9355
9638
|
});
|
|
9356
|
-
var
|
|
9639
|
+
var Ha =
|
|
9357
9640
|
!process.env.NO_COLOR &&
|
|
9358
9641
|
(process.stdout.isTTY || process.env.FORCE_COLOR === '1' || process.env.TERM !== 'dumb');
|
|
9359
|
-
function
|
|
9360
|
-
return (
|
|
9361
|
-
}
|
|
9362
|
-
var
|
|
9363
|
-
bold:
|
|
9364
|
-
dim:
|
|
9365
|
-
italic:
|
|
9366
|
-
underline:
|
|
9367
|
-
inverse:
|
|
9368
|
-
black:
|
|
9369
|
-
red:
|
|
9370
|
-
green:
|
|
9371
|
-
yellow:
|
|
9372
|
-
blue:
|
|
9373
|
-
magenta:
|
|
9374
|
-
cyan:
|
|
9375
|
-
white:
|
|
9376
|
-
gray:
|
|
9377
|
-
bgBlue:
|
|
9378
|
-
bgMagenta:
|
|
9379
|
-
bgCyan:
|
|
9380
|
-
bgGreen:
|
|
9642
|
+
function x(e, t) {
|
|
9643
|
+
return (a) => (Ha ? `\x1B[${e}m${a}\x1B[${t}m` : String(a));
|
|
9644
|
+
}
|
|
9645
|
+
var r = {
|
|
9646
|
+
bold: x(1, 22),
|
|
9647
|
+
dim: x(2, 22),
|
|
9648
|
+
italic: x(3, 23),
|
|
9649
|
+
underline: x(4, 24),
|
|
9650
|
+
inverse: x(7, 27),
|
|
9651
|
+
black: x(30, 39),
|
|
9652
|
+
red: x(31, 39),
|
|
9653
|
+
green: x(32, 39),
|
|
9654
|
+
yellow: x(33, 39),
|
|
9655
|
+
blue: x(34, 39),
|
|
9656
|
+
magenta: x(35, 39),
|
|
9657
|
+
cyan: x(36, 39),
|
|
9658
|
+
white: x(37, 39),
|
|
9659
|
+
gray: x(90, 39),
|
|
9660
|
+
bgBlue: x(44, 49),
|
|
9661
|
+
bgMagenta: x(45, 49),
|
|
9662
|
+
bgCyan: x(46, 49),
|
|
9663
|
+
bgGreen: x(42, 49),
|
|
9381
9664
|
},
|
|
9382
|
-
|
|
9665
|
+
E = class {
|
|
9383
9666
|
constructor(t = '') {
|
|
9384
9667
|
this.frames = [
|
|
9385
9668
|
'\u280B',
|
|
@@ -9403,8 +9686,8 @@ var a = {
|
|
|
9403
9686
|
process.stdout.isTTY
|
|
9404
9687
|
? (this.stop(),
|
|
9405
9688
|
(this.timer = setInterval(() => {
|
|
9406
|
-
let
|
|
9407
|
-
(process.stdout.write(`\r${
|
|
9689
|
+
let a = r.cyan(this.frames[this.current]);
|
|
9690
|
+
(process.stdout.write(`\r${a} ${this.text} `),
|
|
9408
9691
|
(this.current = (this.current + 1) % this.frames.length));
|
|
9409
9692
|
}, 80)),
|
|
9410
9693
|
this)
|
|
@@ -9418,20 +9701,20 @@ var a = {
|
|
|
9418
9701
|
}
|
|
9419
9702
|
succeed(t) {
|
|
9420
9703
|
this.stop();
|
|
9421
|
-
let
|
|
9704
|
+
let a = t || this.text;
|
|
9422
9705
|
process.stdout.isTTY
|
|
9423
|
-
? process.stdout.write(`\r${
|
|
9706
|
+
? process.stdout.write(`\r${r.green('\u2713')} ${a}
|
|
9424
9707
|
`)
|
|
9425
|
-
: process.stdout.write(`[\u2713] ${
|
|
9708
|
+
: process.stdout.write(`[\u2713] ${a}
|
|
9426
9709
|
`);
|
|
9427
9710
|
}
|
|
9428
9711
|
fail(t) {
|
|
9429
9712
|
this.stop();
|
|
9430
|
-
let
|
|
9713
|
+
let a = t || this.text;
|
|
9431
9714
|
process.stdout.isTTY
|
|
9432
|
-
? process.stdout.write(`\r${
|
|
9715
|
+
? process.stdout.write(`\r${r.red('\u2717')} ${a}
|
|
9433
9716
|
`)
|
|
9434
|
-
: process.stdout.write(`[\u2717] ${
|
|
9717
|
+
: process.stdout.write(`[\u2717] ${a}
|
|
9435
9718
|
`);
|
|
9436
9719
|
}
|
|
9437
9720
|
stop() {
|
|
@@ -9441,13 +9724,13 @@ var a = {
|
|
|
9441
9724
|
process.stdout.isTTY && process.stdout.write('\r\x1B[K'));
|
|
9442
9725
|
}
|
|
9443
9726
|
};
|
|
9444
|
-
var
|
|
9445
|
-
|
|
9446
|
-
var
|
|
9447
|
-
|
|
9448
|
-
|
|
9449
|
-
|
|
9450
|
-
var
|
|
9727
|
+
var U = T(require('node:fs')),
|
|
9728
|
+
q = T(require('node:path'));
|
|
9729
|
+
var ne = T(require('node:fs')),
|
|
9730
|
+
mt = T(require('node:path')),
|
|
9731
|
+
ft = require('node:stream/promises');
|
|
9732
|
+
re();
|
|
9733
|
+
var Ya = new Set([
|
|
9451
9734
|
'account_suspended',
|
|
9452
9735
|
'account_terminated',
|
|
9453
9736
|
'creative_mode_restricted',
|
|
@@ -9455,75 +9738,75 @@ var Ar = new Set([
|
|
|
9455
9738
|
'workspace_paused',
|
|
9456
9739
|
]),
|
|
9457
9740
|
v = 1,
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
constructor(t,
|
|
9461
|
-
(super(
|
|
9741
|
+
Xa = 3,
|
|
9742
|
+
b = class extends Error {
|
|
9743
|
+
constructor(t, a, i, n = {}) {
|
|
9744
|
+
(super(a),
|
|
9462
9745
|
(this.name = 'TeinApiError'),
|
|
9463
9746
|
(this.status = t),
|
|
9464
9747
|
i && (this.code = i),
|
|
9465
9748
|
(this.fields = n));
|
|
9466
9749
|
}
|
|
9467
9750
|
get exitCode() {
|
|
9468
|
-
return this.code &&
|
|
9751
|
+
return this.code && Ya.has(this.code) ? Xa : v;
|
|
9469
9752
|
}
|
|
9470
9753
|
};
|
|
9471
|
-
function
|
|
9754
|
+
function Qa(e, t, a) {
|
|
9472
9755
|
let i = `HTTP ${e}${t ? ` ${t}` : ''}`;
|
|
9473
|
-
if (!
|
|
9474
|
-
let n =
|
|
9756
|
+
if (!a || typeof a != 'object') return new b(e, i);
|
|
9757
|
+
let n = a;
|
|
9475
9758
|
if (n.error && typeof n.error == 'object' && !Array.isArray(n.error)) {
|
|
9476
9759
|
let p = n.error,
|
|
9477
|
-
{ code: d, message: m, ...
|
|
9478
|
-
return new
|
|
9760
|
+
{ code: d, message: m, ...y } = p;
|
|
9761
|
+
return new b(e, typeof m == 'string' && m ? m : i, typeof d == 'string' ? d : void 0, y);
|
|
9479
9762
|
}
|
|
9480
9763
|
let { error: s, code: o, message: u, ...l } = n,
|
|
9481
9764
|
c = (typeof s == 'string' && s) || (typeof u == 'string' && u) || i;
|
|
9482
|
-
return new
|
|
9765
|
+
return new b(e, c, typeof o == 'string' ? o : void 0, l);
|
|
9483
9766
|
}
|
|
9484
|
-
function
|
|
9767
|
+
function ct(e) {
|
|
9485
9768
|
return typeof e == 'number' && Number.isFinite(e) ? `$${e.toFixed(4)}` : null;
|
|
9486
9769
|
}
|
|
9487
|
-
function
|
|
9770
|
+
function K(e) {
|
|
9488
9771
|
let t = [e.message],
|
|
9489
|
-
|
|
9490
|
-
i =
|
|
9491
|
-
(
|
|
9492
|
-
t.push([
|
|
9772
|
+
a = ct(e.fields.required),
|
|
9773
|
+
i = ct(e.fields.balance);
|
|
9774
|
+
(a || i) &&
|
|
9775
|
+
t.push([a ? `Required: ${a}` : '', i ? `Balance: ${i}` : ''].filter(Boolean).join(' '));
|
|
9493
9776
|
let n = e.fields.org_name ?? e.fields.orgName;
|
|
9494
9777
|
typeof n == 'string' && n && t.push(`Workspace: ${n}`);
|
|
9495
9778
|
let s = e.fields.url ?? e.fields.appeal_url ?? e.fields.top_up_url;
|
|
9496
9779
|
return (typeof s == 'string' && s && t.push(s), e.code && t.push(`(${e.code})`), t);
|
|
9497
9780
|
}
|
|
9498
|
-
function
|
|
9781
|
+
function Za(e) {
|
|
9499
9782
|
return /\.(mp4|webm|mov)(\?|$)/i.test(e)
|
|
9500
9783
|
? 'video'
|
|
9501
9784
|
: /\.(mp3|wav|ogg|flac)(\?|$)/i.test(e)
|
|
9502
9785
|
? 'audio'
|
|
9503
9786
|
: 'image';
|
|
9504
9787
|
}
|
|
9505
|
-
function
|
|
9788
|
+
function ut(e) {
|
|
9506
9789
|
let t = [];
|
|
9507
|
-
for (let
|
|
9508
|
-
typeof
|
|
9509
|
-
? t.push({ type: 'text', text:
|
|
9510
|
-
:
|
|
9790
|
+
for (let a of e.data ?? [])
|
|
9791
|
+
typeof a.message?.content == 'string'
|
|
9792
|
+
? t.push({ type: 'text', text: a.message.content })
|
|
9793
|
+
: a.url && t.push({ type: Za(a.url), url: a.url, ...(a.layer ? { layer: a.layer } : {}) });
|
|
9511
9794
|
return t;
|
|
9512
9795
|
}
|
|
9513
|
-
var
|
|
9514
|
-
constructor(t,
|
|
9515
|
-
((this.apiKey = t), (this.baseUrl =
|
|
9796
|
+
var M = class {
|
|
9797
|
+
constructor(t, a) {
|
|
9798
|
+
((this.apiKey = t), (this.baseUrl = a.replace(/\/+$/, '')));
|
|
9516
9799
|
}
|
|
9517
9800
|
getHeaders() {
|
|
9518
9801
|
return {
|
|
9519
9802
|
'Content-Type': 'application/json',
|
|
9520
9803
|
Authorization: `Bearer ${this.apiKey}`,
|
|
9521
|
-
'User-Agent': `Tein-CLI/${
|
|
9804
|
+
'User-Agent': `Tein-CLI/${F}`,
|
|
9522
9805
|
'X-Tein-Client': 'cli',
|
|
9523
9806
|
};
|
|
9524
9807
|
}
|
|
9525
|
-
async send(t,
|
|
9526
|
-
let n = await fetch(`${this.baseUrl}${
|
|
9808
|
+
async send(t, a, i) {
|
|
9809
|
+
let n = await fetch(`${this.baseUrl}${a}`, {
|
|
9527
9810
|
method: t,
|
|
9528
9811
|
headers: this.getHeaders(),
|
|
9529
9812
|
...(i === void 0 ? {} : { body: JSON.stringify(i) }),
|
|
@@ -9533,21 +9816,21 @@ var K = class {
|
|
|
9533
9816
|
try {
|
|
9534
9817
|
s = await n.json();
|
|
9535
9818
|
} catch {}
|
|
9536
|
-
throw
|
|
9819
|
+
throw Qa(n.status, n.statusText, s);
|
|
9537
9820
|
}
|
|
9538
9821
|
return await n.json();
|
|
9539
9822
|
}
|
|
9540
9823
|
async checkKey() {
|
|
9541
9824
|
await this.send('GET', '/v1/jobs?limit=1');
|
|
9542
9825
|
}
|
|
9543
|
-
queueJob(t,
|
|
9544
|
-
return this.send('POST', '/v1/generate', { model: t, ...
|
|
9826
|
+
queueJob(t, a) {
|
|
9827
|
+
return this.send('POST', '/v1/generate', { model: t, ...a }).then((i) => {
|
|
9545
9828
|
let n = i.status,
|
|
9546
9829
|
s =
|
|
9547
9830
|
n === 'succeeded' || n === 'failed' || n === 'expired' || n === 'cancelled'
|
|
9548
9831
|
? n
|
|
9549
9832
|
: 'processing',
|
|
9550
|
-
o =
|
|
9833
|
+
o = ut(i);
|
|
9551
9834
|
return {
|
|
9552
9835
|
request_id: i.request_id || i.id || '',
|
|
9553
9836
|
model: i.model,
|
|
@@ -9559,89 +9842,100 @@ var K = class {
|
|
|
9559
9842
|
});
|
|
9560
9843
|
}
|
|
9561
9844
|
getStatus(t) {
|
|
9562
|
-
return this.send('GET', `/v1/jobs/${encodeURIComponent(t)}`).then((
|
|
9563
|
-
let i =
|
|
9845
|
+
return this.send('GET', `/v1/jobs/${encodeURIComponent(t)}`).then((a) => {
|
|
9846
|
+
let i = a.status,
|
|
9564
9847
|
n =
|
|
9565
9848
|
i === 'succeeded' || i === 'failed' || i === 'expired' || i === 'cancelled'
|
|
9566
9849
|
? i
|
|
9567
9850
|
: 'processing',
|
|
9568
|
-
s =
|
|
9569
|
-
o =
|
|
9851
|
+
s = ut(a),
|
|
9852
|
+
o = a.error && typeof a.error.message == 'string' ? a.error.message : null;
|
|
9570
9853
|
return {
|
|
9571
|
-
request_id:
|
|
9572
|
-
model:
|
|
9854
|
+
request_id: a.id || t,
|
|
9855
|
+
model: a.model,
|
|
9573
9856
|
status: n,
|
|
9574
9857
|
...(s.length ? { output: s } : {}),
|
|
9575
9858
|
error: o,
|
|
9576
|
-
...(
|
|
9859
|
+
...(a.usage ? { usage: a.usage } : {}),
|
|
9577
9860
|
};
|
|
9578
9861
|
});
|
|
9579
9862
|
}
|
|
9863
|
+
getBalance() {
|
|
9864
|
+
return this.send('GET', '/v1/balance');
|
|
9865
|
+
}
|
|
9866
|
+
getUsage(t) {
|
|
9867
|
+
let a = new URLSearchParams(t).toString();
|
|
9868
|
+
return this.send('GET', `/v1/usage${a ? `?${a}` : ''}`);
|
|
9869
|
+
}
|
|
9870
|
+
getTransactions(t) {
|
|
9871
|
+
let a = new URLSearchParams(t).toString();
|
|
9872
|
+
return this.send('GET', `/v1/balance/transactions${a ? `?${a}` : ''}`);
|
|
9873
|
+
}
|
|
9580
9874
|
uploadAsset(t) {
|
|
9581
9875
|
return this.send('POST', '/v1/upload', { data: t });
|
|
9582
9876
|
}
|
|
9583
|
-
async downloadOutput(t,
|
|
9877
|
+
async downloadOutput(t, a) {
|
|
9584
9878
|
let i = await fetch(t);
|
|
9585
9879
|
if (!i.ok) throw new Error(`The file could not be downloaded (HTTP ${i.status})`);
|
|
9586
|
-
let n =
|
|
9587
|
-
|
|
9588
|
-
let s =
|
|
9589
|
-
return (await (0,
|
|
9880
|
+
let n = mt.default.dirname(a);
|
|
9881
|
+
ne.default.existsSync(n) || ne.default.mkdirSync(n, { recursive: !0 });
|
|
9882
|
+
let s = ne.default.createWriteStream(a);
|
|
9883
|
+
return (await (0, ft.pipeline)(i.body, s), a);
|
|
9590
9884
|
}
|
|
9591
9885
|
};
|
|
9592
|
-
|
|
9593
|
-
function
|
|
9886
|
+
$();
|
|
9887
|
+
function Se(e) {
|
|
9594
9888
|
if (typeof e != 'number' || !Number.isFinite(e)) return '';
|
|
9595
9889
|
if (Math.abs(e) >= 1 || Math.abs(Number(e.toFixed(4)) - e) < 1e-12) return `$${e.toFixed(4)}`;
|
|
9596
9890
|
let t = Math.max(0, 3 - Number(e.toExponential(3).split('e')[1])),
|
|
9597
|
-
|
|
9598
|
-
i = Math.round(Number((e *
|
|
9891
|
+
a = 10 ** t,
|
|
9892
|
+
i = Math.round(Number((e * a).toFixed(6))) / a;
|
|
9599
9893
|
return i >= 1 ? `$${i.toFixed(4)}` : `$${i.toFixed(t).replace(/0+$/, '')}`;
|
|
9600
9894
|
}
|
|
9601
|
-
|
|
9602
|
-
var
|
|
9603
|
-
function
|
|
9604
|
-
for (let t of
|
|
9895
|
+
ee();
|
|
9896
|
+
var na = ['images', 'input_images', 'videos', 'audios'];
|
|
9897
|
+
function Wi(e) {
|
|
9898
|
+
for (let t of na) typeof e[t] == 'string' && (e[t] = [e[t]]);
|
|
9605
9899
|
}
|
|
9606
|
-
function
|
|
9900
|
+
function Yi(e) {
|
|
9607
9901
|
if (e.startsWith('http://') || e.startsWith('https://')) return null;
|
|
9608
|
-
let t =
|
|
9609
|
-
return
|
|
9902
|
+
let t = q.default.resolve(e);
|
|
9903
|
+
return U.default.existsSync(t) && U.default.statSync(t).isFile() ? t : null;
|
|
9610
9904
|
}
|
|
9611
|
-
async function
|
|
9612
|
-
for (let
|
|
9613
|
-
if (!Array.isArray(e[
|
|
9905
|
+
async function Xi(e, t) {
|
|
9906
|
+
for (let a of na) {
|
|
9907
|
+
if (!Array.isArray(e[a])) continue;
|
|
9614
9908
|
let i = [];
|
|
9615
|
-
for (let n of e[
|
|
9909
|
+
for (let n of e[a]) {
|
|
9616
9910
|
if (typeof n != 'string') continue;
|
|
9617
|
-
let s =
|
|
9911
|
+
let s = Yi(n);
|
|
9618
9912
|
i.push(s ? await t(s) : n);
|
|
9619
9913
|
}
|
|
9620
|
-
e[
|
|
9914
|
+
e[a] = i;
|
|
9621
9915
|
}
|
|
9622
9916
|
}
|
|
9623
|
-
var
|
|
9624
|
-
function
|
|
9917
|
+
var te = { starter: 10, plus: 25, scale: 40, enterprise: 200 };
|
|
9918
|
+
function Qi(e) {
|
|
9625
9919
|
if (e.count === void 0 || e.count === !0) return 1;
|
|
9626
9920
|
let t = typeof e.count == 'number' ? e.count : Number(e.count),
|
|
9627
|
-
|
|
9921
|
+
a = te.enterprise;
|
|
9628
9922
|
return (
|
|
9629
|
-
(!Number.isInteger(t) || t < 1 || t >
|
|
9923
|
+
(!Number.isInteger(t) || t < 1 || t > a) &&
|
|
9630
9924
|
(process.stderr
|
|
9631
|
-
.write(`${
|
|
9925
|
+
.write(`${r.red('Error:')} --count must be a whole number from 1 to ${a}. The API allows Starter ${te.starter}, Plus ${te.plus}, Scale ${te.scale}, Enterprise ${te.enterprise} at once, including polling.
|
|
9632
9926
|
`),
|
|
9633
9927
|
process.exit(1)),
|
|
9634
9928
|
t
|
|
9635
9929
|
);
|
|
9636
9930
|
}
|
|
9637
|
-
async function
|
|
9931
|
+
async function Zi(e, t, a, i, n) {
|
|
9638
9932
|
n.isJson ||
|
|
9639
9933
|
process.stderr.write(`Starting ${i} ${t} jobs together...
|
|
9640
9934
|
`);
|
|
9641
9935
|
let s = await Promise.all(
|
|
9642
9936
|
Array.from({ length: i }, async () => {
|
|
9643
9937
|
try {
|
|
9644
|
-
return { job: await e.queueJob(t,
|
|
9938
|
+
return { job: await e.queueJob(t, a) };
|
|
9645
9939
|
} catch (l) {
|
|
9646
9940
|
return { err: l };
|
|
9647
9941
|
}
|
|
@@ -9654,9 +9948,9 @@ async function Di(e, t, r, i, n) {
|
|
|
9654
9948
|
? o.push(l.job)
|
|
9655
9949
|
: 'err' in l &&
|
|
9656
9950
|
u.push(
|
|
9657
|
-
l.err instanceof
|
|
9951
|
+
l.err instanceof b
|
|
9658
9952
|
? l.err
|
|
9659
|
-
: new
|
|
9953
|
+
: new b(0, l.err instanceof Error ? l.err.message : String(l.err)),
|
|
9660
9954
|
);
|
|
9661
9955
|
if (!n.isAsync) {
|
|
9662
9956
|
let l = Date.now(),
|
|
@@ -9677,7 +9971,7 @@ async function Di(e, t, r, i, n) {
|
|
|
9677
9971
|
}),
|
|
9678
9972
|
);
|
|
9679
9973
|
for (let d of p) {
|
|
9680
|
-
let m = o.findIndex((
|
|
9974
|
+
let m = o.findIndex((y) => y.request_id === d.request_id);
|
|
9681
9975
|
m >= 0 && (o[m] = d);
|
|
9682
9976
|
}
|
|
9683
9977
|
c = o.filter((d) => d.status === 'processing' && d.request_id);
|
|
@@ -9696,12 +9990,12 @@ async function Di(e, t, r, i, n) {
|
|
|
9696
9990
|
else {
|
|
9697
9991
|
for (let l of o)
|
|
9698
9992
|
(process.stdout.write(`${l.request_id} ${l.status}`),
|
|
9699
|
-
l.usage?.cost !== void 0 && process.stdout.write(` ${
|
|
9993
|
+
l.usage?.cost !== void 0 && process.stdout.write(` ${Se(l.usage.cost)}`),
|
|
9700
9994
|
l.error && process.stdout.write(` ${l.error}`),
|
|
9701
9995
|
process.stdout.write(`
|
|
9702
9996
|
`));
|
|
9703
9997
|
for (let l of u)
|
|
9704
|
-
process.stderr.write(`${
|
|
9998
|
+
process.stderr.write(`${K(l).join(`
|
|
9705
9999
|
`)}
|
|
9706
10000
|
`);
|
|
9707
10001
|
}
|
|
@@ -9709,14 +10003,14 @@ async function Di(e, t, r, i, n) {
|
|
|
9709
10003
|
o.some((l) => l.status === 'failed' || l.status === 'expired' || l.status === 'cancelled')) &&
|
|
9710
10004
|
process.exit(v);
|
|
9711
10005
|
}
|
|
9712
|
-
function
|
|
9713
|
-
if (
|
|
9714
|
-
let i =
|
|
10006
|
+
function er(e, t, a) {
|
|
10007
|
+
if (a <= 1) return e;
|
|
10008
|
+
let i = q.default.extname(e);
|
|
9715
10009
|
return `${e.slice(0, e.length - i.length)}-${t + 1}${i}`;
|
|
9716
10010
|
}
|
|
9717
|
-
function
|
|
10011
|
+
function sa(e) {
|
|
9718
10012
|
let t = {},
|
|
9719
|
-
|
|
10013
|
+
a = new Set(),
|
|
9720
10014
|
i = [];
|
|
9721
10015
|
for (let n = 0; n < e.length; n++) {
|
|
9722
10016
|
let s = e[n];
|
|
@@ -9735,7 +10029,7 @@ function tr(e) {
|
|
|
9735
10029
|
? (t[o.replace(/-/g, '_')] = Number(u))
|
|
9736
10030
|
: (t[o.replace(/-/g, '_')] = u),
|
|
9737
10031
|
n++);
|
|
9738
|
-
} else ((t[o.replace(/-/g, '_')] = !0),
|
|
10032
|
+
} else ((t[o.replace(/-/g, '_')] = !0), a.add(o));
|
|
9739
10033
|
} else if (s.startsWith('-') && s.length === 2) {
|
|
9740
10034
|
let o = s[1],
|
|
9741
10035
|
l =
|
|
@@ -9751,37 +10045,37 @@ function tr(e) {
|
|
|
9751
10045
|
v: 'version',
|
|
9752
10046
|
}[o] || o;
|
|
9753
10047
|
o === 'j' || o === 'h' || o === 'v'
|
|
9754
|
-
? ((t[l] = !0),
|
|
10048
|
+
? ((t[l] = !0), a.add(l))
|
|
9755
10049
|
: n + 1 < e.length && !e[n + 1].startsWith('-')
|
|
9756
10050
|
? ((t[l] = e[n + 1]), n++)
|
|
9757
10051
|
: (t[l] = !0);
|
|
9758
10052
|
} else i.push(s);
|
|
9759
10053
|
}
|
|
9760
|
-
return { command: i[0] || '', subcommand: i[1], modelSlug: i[1] || i[0], options: t, flags:
|
|
10054
|
+
return { command: i[0] || '', subcommand: i[1], modelSlug: i[1] || i[0], options: t, flags: a };
|
|
9761
10055
|
}
|
|
9762
|
-
async function
|
|
9763
|
-
let
|
|
9764
|
-
i =
|
|
9765
|
-
(
|
|
9766
|
-
(process.stderr.write(`${
|
|
10056
|
+
async function Qe(e, t) {
|
|
10057
|
+
let a = S(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
10058
|
+
i = w(typeof t.api_url == 'string' ? t.api_url : void 0);
|
|
10059
|
+
(a ||
|
|
10060
|
+
(process.stderr.write(`${r.red('Error:')} Authentication required.
|
|
9767
10061
|
`),
|
|
9768
10062
|
process.stderr
|
|
9769
|
-
.write(`Please run ${
|
|
10063
|
+
.write(`Please run ${r.cyan('tein auth login')} or set ${r.cyan('TEIN_API_KEY')} environment variable.
|
|
9770
10064
|
`),
|
|
9771
10065
|
process.exit(1)),
|
|
9772
10066
|
e ||
|
|
9773
|
-
(process.stderr.write(`${
|
|
10067
|
+
(process.stderr.write(`${r.red('Error:')} Missing model slug.
|
|
9774
10068
|
`),
|
|
9775
|
-
process.stderr.write(`Usage: ${
|
|
10069
|
+
process.stderr.write(`Usage: ${r.cyan('tein run <model-slug> --prompt "..."')}
|
|
9776
10070
|
`),
|
|
9777
|
-
process.stderr.write(`Run ${
|
|
10071
|
+
process.stderr.write(`Run ${r.cyan('tein models')} to list all available models.
|
|
9778
10072
|
`),
|
|
9779
10073
|
process.exit(1)));
|
|
9780
|
-
let n =
|
|
10074
|
+
let n = H(e),
|
|
9781
10075
|
s = !!t.json,
|
|
9782
10076
|
o = !!(t.async || t.no_wait),
|
|
9783
10077
|
u = typeof t.output == 'string' ? t.output : void 0,
|
|
9784
|
-
l =
|
|
10078
|
+
l = Qi(t),
|
|
9785
10079
|
c = { ...t };
|
|
9786
10080
|
(delete c.json,
|
|
9787
10081
|
delete c.async,
|
|
@@ -9790,14 +10084,14 @@ async function We(e, t) {
|
|
|
9790
10084
|
delete c.api_key,
|
|
9791
10085
|
delete c.api_url,
|
|
9792
10086
|
delete c.count);
|
|
9793
|
-
let p =
|
|
9794
|
-
(
|
|
9795
|
-
typeof p.image == 'string' && !p.images && !
|
|
10087
|
+
let p = ra(n, c);
|
|
10088
|
+
(Wi(p),
|
|
10089
|
+
typeof p.image == 'string' && !p.images && !we(n) && ((p.images = [p.image]), delete p.image),
|
|
9796
10090
|
p.image_url &&
|
|
9797
10091
|
!p.first_frame_image &&
|
|
9798
10092
|
(e.startsWith('seedance') || e.startsWith('happy-horse')) &&
|
|
9799
10093
|
(p.first_frame_image = p.image_url));
|
|
9800
|
-
let d = new
|
|
10094
|
+
let d = new M(a, i),
|
|
9801
10095
|
m = [
|
|
9802
10096
|
'image',
|
|
9803
10097
|
'mask_image',
|
|
@@ -9809,78 +10103,78 @@ async function We(e, t) {
|
|
|
9809
10103
|
'image_url',
|
|
9810
10104
|
'video_url',
|
|
9811
10105
|
];
|
|
9812
|
-
for (let
|
|
9813
|
-
let g = p[
|
|
10106
|
+
for (let k of m) {
|
|
10107
|
+
let g = p[k];
|
|
9814
10108
|
if (typeof g == 'string' && !g.startsWith('http://') && !g.startsWith('https://')) {
|
|
9815
|
-
let
|
|
9816
|
-
if (
|
|
9817
|
-
let
|
|
9818
|
-
s ||
|
|
10109
|
+
let P = q.default.resolve(g);
|
|
10110
|
+
if (U.default.existsSync(P) && U.default.statSync(P).isFile()) {
|
|
10111
|
+
let I = new E(`Uploading local file ${q.default.basename(P)} to CDN...`);
|
|
10112
|
+
s || I.start();
|
|
9819
10113
|
try {
|
|
9820
|
-
let
|
|
9821
|
-
|
|
9822
|
-
((p[
|
|
9823
|
-
} catch (
|
|
9824
|
-
let
|
|
10114
|
+
let N = U.default.readFileSync(P),
|
|
10115
|
+
O = await d.uploadAsset(N.toString('base64'));
|
|
10116
|
+
((p[k] = O.url), s || I.succeed(`Uploaded ${q.default.basename(P)} to CDN`));
|
|
10117
|
+
} catch (N) {
|
|
10118
|
+
let O = N instanceof Error ? N.message : String(N);
|
|
9825
10119
|
(s
|
|
9826
10120
|
? process.stdout.write(
|
|
9827
|
-
JSON.stringify({ error:
|
|
10121
|
+
JSON.stringify({ error: O }) +
|
|
9828
10122
|
`
|
|
9829
10123
|
`,
|
|
9830
10124
|
)
|
|
9831
|
-
:
|
|
10125
|
+
: I.fail(`Upload failed: ${O}`),
|
|
9832
10126
|
process.exit(1));
|
|
9833
10127
|
}
|
|
9834
10128
|
}
|
|
9835
10129
|
}
|
|
9836
10130
|
}
|
|
9837
|
-
await
|
|
9838
|
-
let g = new
|
|
10131
|
+
await Xi(p, async (k) => {
|
|
10132
|
+
let g = new E(`Uploading local file ${q.default.basename(k)} to CDN...`);
|
|
9839
10133
|
s || g.start();
|
|
9840
10134
|
try {
|
|
9841
|
-
let
|
|
9842
|
-
|
|
9843
|
-
return (s || g.succeed(`Uploaded ${
|
|
9844
|
-
} catch (
|
|
9845
|
-
let
|
|
10135
|
+
let P = U.default.readFileSync(k),
|
|
10136
|
+
I = await d.uploadAsset(P.toString('base64'));
|
|
10137
|
+
return (s || g.succeed(`Uploaded ${q.default.basename(k)} to CDN`), I.url);
|
|
10138
|
+
} catch (P) {
|
|
10139
|
+
let I = P instanceof Error ? P.message : String(P);
|
|
9846
10140
|
(s
|
|
9847
10141
|
? process.stdout.write(
|
|
9848
|
-
JSON.stringify({ error:
|
|
10142
|
+
JSON.stringify({ error: I }) +
|
|
9849
10143
|
`
|
|
9850
10144
|
`,
|
|
9851
10145
|
)
|
|
9852
|
-
: g.fail(`Upload failed: ${
|
|
10146
|
+
: g.fail(`Upload failed: ${I}`),
|
|
9853
10147
|
process.exit(1));
|
|
9854
10148
|
}
|
|
9855
10149
|
});
|
|
9856
|
-
let
|
|
9857
|
-
s ||
|
|
10150
|
+
let y = new E(`Submitting task for ${r.bold(e)}...`);
|
|
10151
|
+
s || y.start();
|
|
9858
10152
|
let f;
|
|
9859
10153
|
try {
|
|
9860
10154
|
if (l > 1) {
|
|
9861
|
-
await
|
|
10155
|
+
await Zi(d, e, p, l, { isJson: s, isAsync: o });
|
|
9862
10156
|
return;
|
|
9863
10157
|
}
|
|
9864
10158
|
f = await d.queueJob(e, p);
|
|
9865
|
-
} catch (
|
|
9866
|
-
let g =
|
|
10159
|
+
} catch (k) {
|
|
10160
|
+
let g = k instanceof b ? k : null;
|
|
9867
10161
|
(s
|
|
9868
10162
|
? process.stdout.write(
|
|
9869
10163
|
JSON.stringify(
|
|
9870
10164
|
g
|
|
9871
10165
|
? { error: { code: g.code ?? null, message: g.message, ...g.fields } }
|
|
9872
|
-
: { error: { code: null, message:
|
|
10166
|
+
: { error: { code: null, message: k instanceof Error ? k.message : String(k) } },
|
|
9873
10167
|
null,
|
|
9874
10168
|
2,
|
|
9875
10169
|
) +
|
|
9876
10170
|
`
|
|
9877
10171
|
`,
|
|
9878
10172
|
)
|
|
9879
|
-
:
|
|
10173
|
+
: y.fail(
|
|
9880
10174
|
g
|
|
9881
|
-
?
|
|
10175
|
+
? K(g).join(`
|
|
9882
10176
|
`)
|
|
9883
|
-
: `Failed to start generation: ${
|
|
10177
|
+
: `Failed to start generation: ${k instanceof Error ? k.message : k}`,
|
|
9884
10178
|
),
|
|
9885
10179
|
process.exit(g ? g.exitCode : v));
|
|
9886
10180
|
}
|
|
@@ -9891,25 +10185,25 @@ async function We(e, t) {
|
|
|
9891
10185
|
`
|
|
9892
10186
|
`,
|
|
9893
10187
|
)
|
|
9894
|
-
: (
|
|
9895
|
-
process.stdout.write(`Check status anytime with: ${
|
|
10188
|
+
: (y.succeed(`Queued successfully! Request ID: ${r.bold(f.request_id)}`),
|
|
10189
|
+
process.stdout.write(`Check status anytime with: ${r.cyan(`tein status ${f.request_id}`)}
|
|
9896
10190
|
`));
|
|
9897
10191
|
return;
|
|
9898
10192
|
}
|
|
9899
|
-
let
|
|
9900
|
-
|
|
10193
|
+
let _e = Date.now(),
|
|
10194
|
+
Pe = 1500;
|
|
9901
10195
|
for (; f.status === 'processing';) {
|
|
9902
|
-
let
|
|
9903
|
-
(s ||
|
|
9904
|
-
await new Promise((g) => setTimeout(g,
|
|
10196
|
+
let k = Math.round((Date.now() - _e) / 1e3);
|
|
10197
|
+
(s || y.update(`Rendering ${r.bold(e)} (${k}s elapsed)... [ID: ${f.request_id}]`),
|
|
10198
|
+
await new Promise((g) => setTimeout(g, Pe)));
|
|
9905
10199
|
try {
|
|
9906
10200
|
f = await d.getStatus(f.request_id);
|
|
9907
10201
|
} catch (g) {
|
|
9908
|
-
g instanceof
|
|
10202
|
+
g instanceof b &&
|
|
9909
10203
|
g.exitCode !== v &&
|
|
9910
10204
|
(s ||
|
|
9911
|
-
|
|
9912
|
-
|
|
10205
|
+
y.fail(
|
|
10206
|
+
K(g).join(`
|
|
9913
10207
|
`),
|
|
9914
10208
|
),
|
|
9915
10209
|
process.exit(g.exitCode));
|
|
@@ -9923,9 +10217,9 @@ async function We(e, t) {
|
|
|
9923
10217
|
`
|
|
9924
10218
|
`,
|
|
9925
10219
|
)
|
|
9926
|
-
:
|
|
10220
|
+
: y.fail(`Generation ${f.status}: ${f.error || 'Something failed on our side.'}`),
|
|
9927
10221
|
process.exit(v)),
|
|
9928
|
-
s ||
|
|
10222
|
+
s || y.succeed(`Generation completed for ${r.bold(n?.name || e)}!`),
|
|
9929
10223
|
s)
|
|
9930
10224
|
) {
|
|
9931
10225
|
process.stdout.write(
|
|
@@ -9938,150 +10232,150 @@ async function We(e, t) {
|
|
|
9938
10232
|
if (
|
|
9939
10233
|
(process.stdout.write(`
|
|
9940
10234
|
`),
|
|
9941
|
-
process.stdout.write(` ${
|
|
10235
|
+
process.stdout.write(` ${r.bold('Status:')} ${r.green('Succeeded')}
|
|
9942
10236
|
`),
|
|
9943
|
-
process.stdout.write(` ${
|
|
10237
|
+
process.stdout.write(` ${r.bold('Request ID:')} ${f.request_id}
|
|
9944
10238
|
`),
|
|
9945
10239
|
f.usage?.cost !== void 0 &&
|
|
9946
|
-
process.stdout.write(` ${
|
|
10240
|
+
process.stdout.write(` ${r.bold('Cost:')} ${Se(f.usage.cost)}
|
|
9947
10241
|
`),
|
|
9948
10242
|
f.output && f.output.length > 0)
|
|
9949
10243
|
) {
|
|
9950
10244
|
process.stdout.write(`
|
|
9951
|
-
${
|
|
10245
|
+
${r.bold('Outputs:')}
|
|
9952
10246
|
`);
|
|
9953
|
-
let
|
|
10247
|
+
let k = f.output.filter((P) => P.url).length,
|
|
9954
10248
|
g = 0;
|
|
9955
|
-
for (let
|
|
9956
|
-
let
|
|
9957
|
-
if (
|
|
9958
|
-
let
|
|
10249
|
+
for (let P = 0; P < f.output.length; P++) {
|
|
10250
|
+
let I = f.output[P];
|
|
10251
|
+
if (I.url) {
|
|
10252
|
+
let N = I.layer?.name ? ` ${r.bold(I.layer.name)}` : '';
|
|
9959
10253
|
if (
|
|
9960
|
-
(process.stdout.write(` [${
|
|
10254
|
+
(process.stdout.write(` [${I.type.toUpperCase()}]${N} ${r.cyan(r.underline(I.url))}
|
|
9961
10255
|
`),
|
|
9962
10256
|
u)
|
|
9963
10257
|
) {
|
|
9964
|
-
let
|
|
9965
|
-
|
|
10258
|
+
let O = er(u, g++, k),
|
|
10259
|
+
pt = new E(`Downloading output to ${O}...`).start();
|
|
9966
10260
|
try {
|
|
9967
|
-
(await d.downloadOutput(
|
|
9968
|
-
|
|
9969
|
-
} catch (
|
|
9970
|
-
|
|
10261
|
+
(await d.downloadOutput(I.url, q.default.resolve(process.cwd(), O)),
|
|
10262
|
+
pt.succeed(`Saved to ${r.bold(O)}`));
|
|
10263
|
+
} catch (Ie) {
|
|
10264
|
+
pt.fail(`Failed to download: ${Ie instanceof Error ? Ie.message : Ie}`);
|
|
9971
10265
|
}
|
|
9972
10266
|
}
|
|
9973
10267
|
} else
|
|
9974
|
-
|
|
10268
|
+
I.text &&
|
|
9975
10269
|
process.stdout.write(`
|
|
9976
|
-
${
|
|
10270
|
+
${I.text}
|
|
9977
10271
|
`);
|
|
9978
10272
|
}
|
|
9979
10273
|
}
|
|
9980
10274
|
process.stdout.write(`
|
|
9981
10275
|
`);
|
|
9982
10276
|
}
|
|
9983
|
-
var
|
|
9984
|
-
|
|
9985
|
-
async function
|
|
10277
|
+
var oa = T(require('node:readline'));
|
|
10278
|
+
$();
|
|
10279
|
+
async function tr(e) {
|
|
9986
10280
|
try {
|
|
9987
|
-
return (await new
|
|
10281
|
+
return (await new M(e, w()).checkKey(), 'ok');
|
|
9988
10282
|
} catch (t) {
|
|
9989
|
-
if (t instanceof
|
|
10283
|
+
if (t instanceof b) {
|
|
9990
10284
|
if (t.status === 401) return 'invalid';
|
|
9991
10285
|
if (t.status === 403) return 'blocked';
|
|
9992
10286
|
}
|
|
9993
10287
|
return 'unchecked';
|
|
9994
10288
|
}
|
|
9995
10289
|
}
|
|
9996
|
-
function
|
|
9997
|
-
let t =
|
|
9998
|
-
return new Promise((
|
|
10290
|
+
function ar(e) {
|
|
10291
|
+
let t = oa.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
10292
|
+
return new Promise((a) => {
|
|
9999
10293
|
t.question(e, (i) => {
|
|
10000
|
-
(t.close(),
|
|
10294
|
+
(t.close(), a(i.trim()));
|
|
10001
10295
|
});
|
|
10002
10296
|
});
|
|
10003
10297
|
}
|
|
10004
|
-
async function
|
|
10298
|
+
async function ae(e, t) {
|
|
10005
10299
|
switch (e) {
|
|
10006
10300
|
case 'login':
|
|
10007
10301
|
case 'set-key': {
|
|
10008
|
-
let
|
|
10009
|
-
(
|
|
10302
|
+
let a = t?.trim() || '';
|
|
10303
|
+
(a ||
|
|
10010
10304
|
(process.stdout.write(`
|
|
10011
|
-
${
|
|
10305
|
+
${r.bold('Tein AI Authentication')}
|
|
10012
10306
|
`),
|
|
10013
|
-
process.stdout.write(`Get your API key at: ${
|
|
10307
|
+
process.stdout.write(`Get your API key at: ${r.cyan('https://tein.ai/dashboard/keys')}
|
|
10014
10308
|
|
|
10015
10309
|
`),
|
|
10016
|
-
(
|
|
10017
|
-
!
|
|
10018
|
-
!
|
|
10310
|
+
(a = await ar('Enter your Tein API Key (sk_live_...): '))),
|
|
10311
|
+
!a.startsWith('sk_live_') &&
|
|
10312
|
+
!a.startsWith('sk_test_') &&
|
|
10019
10313
|
(process.stderr
|
|
10020
|
-
.write(`${
|
|
10314
|
+
.write(`${r.red('Error:')} Invalid key format. Tein API keys start with 'sk_live_' or 'sk_test_'.
|
|
10021
10315
|
`),
|
|
10022
10316
|
process.exit(1)));
|
|
10023
|
-
let i = await
|
|
10317
|
+
let i = await tr(a);
|
|
10024
10318
|
(i === 'invalid' &&
|
|
10025
10319
|
(process.stderr
|
|
10026
|
-
.write(`${
|
|
10320
|
+
.write(`${r.red('Error:')} Tein did not accept this key. Copy it again from ${r.cyan('https://tein.ai/dashboard/keys')}. Nothing was saved.
|
|
10027
10321
|
`),
|
|
10028
10322
|
process.exit(1)),
|
|
10029
|
-
|
|
10323
|
+
Ke({ apiKey: a }),
|
|
10030
10324
|
process.stdout.write(`
|
|
10031
|
-
${
|
|
10325
|
+
${r.green('\u2713')} API key saved to ${r.dim(oe())}
|
|
10032
10326
|
`),
|
|
10033
10327
|
i === 'blocked'
|
|
10034
10328
|
? process.stdout
|
|
10035
|
-
.write(`${
|
|
10329
|
+
.write(`${r.yellow('\u2139')} The key is valid, but this account cannot run requests right now. Check your dashboard.
|
|
10036
10330
|
`)
|
|
10037
10331
|
: i === 'unchecked' &&
|
|
10038
10332
|
process.stdout
|
|
10039
|
-
.write(`${
|
|
10333
|
+
.write(`${r.yellow('\u2139')} Could not reach Tein to check the key. It is saved; run ${r.cyan('tein auth set-key')} again once you are online to check it.
|
|
10040
10334
|
`),
|
|
10041
10335
|
process.stdout
|
|
10042
|
-
.write(`You can now run models directly using: ${
|
|
10336
|
+
.write(`You can now run models directly using: ${r.cyan('tein run <model-slug> --prompt "..."')}
|
|
10043
10337
|
|
|
10044
10338
|
`));
|
|
10045
10339
|
break;
|
|
10046
10340
|
}
|
|
10047
10341
|
case 'logout': {
|
|
10048
|
-
if (!
|
|
10342
|
+
if (!j().apiKey) {
|
|
10049
10343
|
process.stdout
|
|
10050
|
-
.write(`${
|
|
10344
|
+
.write(`${r.yellow('\u2139')} No active API key found. You are already logged out.
|
|
10051
10345
|
`);
|
|
10052
10346
|
break;
|
|
10053
10347
|
}
|
|
10054
|
-
(
|
|
10348
|
+
(Ke({ apiKey: '' }),
|
|
10055
10349
|
process.stdout
|
|
10056
|
-
.write(`${
|
|
10350
|
+
.write(`${r.green('\u2713')} Logged out successfully. Stored API key has been cleared from ${r.dim(oe())}
|
|
10057
10351
|
`));
|
|
10058
10352
|
break;
|
|
10059
10353
|
}
|
|
10060
10354
|
default: {
|
|
10061
|
-
let
|
|
10062
|
-
i =
|
|
10063
|
-
n =
|
|
10355
|
+
let a = S(),
|
|
10356
|
+
i = w(),
|
|
10357
|
+
n = j();
|
|
10064
10358
|
if (
|
|
10065
10359
|
(process.stdout.write(`
|
|
10066
|
-
${
|
|
10360
|
+
${r.bold('Tein AI CLI Configuration')}
|
|
10067
10361
|
`),
|
|
10068
|
-
process.stdout.write(` Config file: ${
|
|
10362
|
+
process.stdout.write(` Config file: ${r.dim(oe())}
|
|
10069
10363
|
`),
|
|
10070
|
-
process.stdout.write(` API URL: ${
|
|
10364
|
+
process.stdout.write(` API URL: ${r.cyan(i)}
|
|
10071
10365
|
`),
|
|
10072
|
-
!
|
|
10366
|
+
!a)
|
|
10073
10367
|
)
|
|
10074
|
-
(process.stdout.write(` API Key: ${
|
|
10368
|
+
(process.stdout.write(` API Key: ${r.red('Not configured')}
|
|
10075
10369
|
|
|
10076
10370
|
`),
|
|
10077
10371
|
process.stdout
|
|
10078
|
-
.write(`Run ${
|
|
10372
|
+
.write(`Run ${r.cyan('tein auth login')} or set ${r.cyan('TEIN_API_KEY')} environment variable.
|
|
10079
10373
|
|
|
10080
10374
|
`));
|
|
10081
10375
|
else {
|
|
10082
|
-
let s = `${
|
|
10376
|
+
let s = `${a.slice(0, 10)}...${a.slice(-4)}`;
|
|
10083
10377
|
process.stdout
|
|
10084
|
-
.write(` API Key: ${
|
|
10378
|
+
.write(` API Key: ${r.green(s)} (${a.startsWith('sk_live_') ? 'Live Key' : 'Test Key'})
|
|
10085
10379
|
|
|
10086
10380
|
`);
|
|
10087
10381
|
}
|
|
@@ -10089,44 +10383,278 @@ ${a.bold('Tein AI CLI Configuration')}
|
|
|
10089
10383
|
}
|
|
10090
10384
|
}
|
|
10091
10385
|
}
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10386
|
+
$();
|
|
10387
|
+
function _(e) {
|
|
10388
|
+
return e !== 0 && Math.abs(e) < 0.01
|
|
10389
|
+
? `$${e.toFixed(6).replace(/0+$/, '').replace(/\.$/, '')}`
|
|
10390
|
+
: `$${e.toFixed(2)}`;
|
|
10391
|
+
}
|
|
10392
|
+
function la(e) {
|
|
10393
|
+
return `${e} ${e === 1 ? 'request' : 'requests'}`;
|
|
10394
|
+
}
|
|
10395
|
+
function ir(e) {
|
|
10396
|
+
let t = [
|
|
10397
|
+
['Balance', _(e.balance)],
|
|
10398
|
+
['Available to this key', _(e.available)],
|
|
10399
|
+
];
|
|
10400
|
+
if (
|
|
10401
|
+
(e.on_hold > 0 && t.push(['On hold', `${_(e.on_hold)} (not spendable)`]), e.credits_from_tein)
|
|
10402
|
+
) {
|
|
10403
|
+
let n = e.credits_from_tein.next_expires_at
|
|
10404
|
+
? `, next expire ${e.credits_from_tein.next_expires_at.slice(0, 10)}`
|
|
10405
|
+
: '';
|
|
10406
|
+
t.push(['Credits from Tein', `${_(e.credits_from_tein.amount)}${n}`]);
|
|
10407
|
+
}
|
|
10408
|
+
let a = e.key.spending_limit;
|
|
10409
|
+
(a &&
|
|
10410
|
+
t.push([
|
|
10411
|
+
`Key limit (${a.period})`,
|
|
10412
|
+
`${_(a.remaining)} left of ${_(a.amount)}${a.resets_at ? `, resets ${a.resets_at.slice(0, 10)}` : ''}`,
|
|
10413
|
+
]),
|
|
10414
|
+
t.push(
|
|
10415
|
+
['This month', `${_(e.usage.this_month.spend)} on ${la(e.usage.this_month.requests)}`],
|
|
10416
|
+
['Last 30 days', `${_(e.usage.last_30_days.spend)} on ${la(e.usage.last_30_days.requests)}`],
|
|
10417
|
+
[
|
|
10418
|
+
'Auto top up',
|
|
10419
|
+
e.auto_top_up.enabled
|
|
10420
|
+
? `on, adds ${_(e.auto_top_up.amount)} below ${_(e.auto_top_up.threshold)}`
|
|
10421
|
+
: 'off',
|
|
10422
|
+
],
|
|
10423
|
+
['Workspace', `${e.workspace.name} (${e.workspace.plan.name})`],
|
|
10424
|
+
['Key', `${e.key.name} (${e.key.env})`],
|
|
10425
|
+
));
|
|
10426
|
+
let i = Math.max(...t.map(([n]) => n.length));
|
|
10427
|
+
return t.map(([n, s]) => ` ${n.padEnd(i)} ${s}`);
|
|
10428
|
+
}
|
|
10429
|
+
async function pa(e) {
|
|
10430
|
+
let t = S(typeof e.api_key == 'string' ? e.api_key : void 0),
|
|
10431
|
+
a = w(typeof e.api_url == 'string' ? e.api_url : void 0),
|
|
10432
|
+
i = !!e.json;
|
|
10433
|
+
t ||
|
|
10434
|
+
(process.stderr.write(`${r.red('Error:')} Authentication required.
|
|
10435
|
+
`),
|
|
10436
|
+
process.stderr
|
|
10437
|
+
.write(`Please run ${r.cyan('tein auth login')} or set ${r.cyan('TEIN_API_KEY')} environment variable.
|
|
10438
|
+
`),
|
|
10439
|
+
process.exit(1));
|
|
10440
|
+
let n;
|
|
10441
|
+
try {
|
|
10442
|
+
n = await new M(t, a).getBalance();
|
|
10443
|
+
} catch (s) {
|
|
10444
|
+
(s instanceof b &&
|
|
10445
|
+
(i
|
|
10446
|
+
? process.stdout.write(
|
|
10447
|
+
JSON.stringify(
|
|
10448
|
+
{ error: { code: s.code ?? null, message: s.message, ...s.fields } },
|
|
10449
|
+
null,
|
|
10450
|
+
2,
|
|
10451
|
+
) +
|
|
10452
|
+
`
|
|
10453
|
+
`,
|
|
10454
|
+
)
|
|
10455
|
+
: process.stderr.write(`${r.red('Error:')} ${K(s).join(`
|
|
10456
|
+
`)}
|
|
10457
|
+
`),
|
|
10458
|
+
process.exit(s.exitCode)),
|
|
10459
|
+
process.stderr.write(`${r.red('Error:')} ${s instanceof Error ? s.message : String(s)}
|
|
10460
|
+
`),
|
|
10461
|
+
process.exit(v));
|
|
10462
|
+
}
|
|
10463
|
+
if (i) {
|
|
10464
|
+
process.stdout.write(
|
|
10465
|
+
JSON.stringify(n, null, 2) +
|
|
10466
|
+
`
|
|
10467
|
+
`,
|
|
10468
|
+
);
|
|
10469
|
+
return;
|
|
10470
|
+
}
|
|
10471
|
+
process.stdout.write(`
|
|
10472
|
+
${r.bold('Tein balance')}
|
|
10473
|
+
${ir(n).join(`
|
|
10474
|
+
`)}
|
|
10475
|
+
|
|
10476
|
+
`);
|
|
10477
|
+
}
|
|
10478
|
+
$();
|
|
10479
|
+
function da(e) {
|
|
10480
|
+
let t = S(typeof e.api_key == 'string' ? e.api_key : void 0),
|
|
10481
|
+
a = w(typeof e.api_url == 'string' ? e.api_url : void 0);
|
|
10482
|
+
return (
|
|
10483
|
+
t ||
|
|
10484
|
+
(process.stderr.write(`${r.red('Error:')} Authentication required.
|
|
10485
|
+
`),
|
|
10486
|
+
process.stderr
|
|
10487
|
+
.write(`Please run ${r.cyan('tein auth login')} or set ${r.cyan('TEIN_API_KEY')} environment variable.
|
|
10488
|
+
`),
|
|
10489
|
+
process.exit(1)),
|
|
10490
|
+
new M(t, a)
|
|
10491
|
+
);
|
|
10492
|
+
}
|
|
10493
|
+
function ca(e, t) {
|
|
10494
|
+
let a = {};
|
|
10495
|
+
for (let i of t) {
|
|
10496
|
+
let n = e[i];
|
|
10497
|
+
(typeof n == 'string' || typeof n == 'number') && (a[i] = String(n));
|
|
10498
|
+
}
|
|
10499
|
+
return a;
|
|
10500
|
+
}
|
|
10501
|
+
async function ua(e, t) {
|
|
10097
10502
|
try {
|
|
10098
|
-
|
|
10503
|
+
return await t();
|
|
10504
|
+
} catch (a) {
|
|
10505
|
+
(a instanceof b &&
|
|
10506
|
+
(e
|
|
10507
|
+
? process.stdout.write(
|
|
10508
|
+
JSON.stringify(
|
|
10509
|
+
{ error: { code: a.code ?? null, message: a.message, ...a.fields } },
|
|
10510
|
+
null,
|
|
10511
|
+
2,
|
|
10512
|
+
) +
|
|
10513
|
+
`
|
|
10514
|
+
`,
|
|
10515
|
+
)
|
|
10516
|
+
: process.stderr.write(`${r.red('Error:')} ${K(a).join(`
|
|
10517
|
+
`)}
|
|
10518
|
+
`),
|
|
10519
|
+
process.exit(a.exitCode)),
|
|
10520
|
+
process.stderr.write(`${r.red('Error:')} ${a instanceof Error ? a.message : String(a)}
|
|
10521
|
+
`),
|
|
10522
|
+
process.exit(v));
|
|
10523
|
+
}
|
|
10524
|
+
}
|
|
10525
|
+
function Ze(e) {
|
|
10526
|
+
let t = e[0].map((i, n) => Math.max(...e.map((s) => s[n].length))),
|
|
10527
|
+
a = (i) => e.slice(1).every((n) => /^[-+$\d]/.test(n[i]));
|
|
10528
|
+
return e.map(
|
|
10529
|
+
(i) =>
|
|
10530
|
+
` ${i
|
|
10531
|
+
.map((n, s) => (s > 0 && a(s) ? n.padStart(t[s]) : n.padEnd(t[s])))
|
|
10532
|
+
.join(' ')
|
|
10533
|
+
.trimEnd()}`,
|
|
10534
|
+
);
|
|
10535
|
+
}
|
|
10536
|
+
function rr(e) {
|
|
10537
|
+
let t = e.summary,
|
|
10538
|
+
a = [
|
|
10539
|
+
` Window ${e.from.slice(0, 10)} to ${e.to.slice(0, 10)} (${e.range})${e.filters.model ? `, model ${e.filters.model}` : ''}${e.filters.channel ? `, channel ${e.filters.channel}` : ''}`,
|
|
10540
|
+
` Spent ${_(t.spend)} on ${t.requests} requests (${t.succeeded} succeeded, ${t.failed} failed${t.running ? `, ${t.running} running` : ''})`,
|
|
10541
|
+
` Daily burn ${_(t.daily_burn)}`,
|
|
10542
|
+
` This key ${_(e.this_key.spend)} on ${e.this_key.requests} requests`,
|
|
10543
|
+
];
|
|
10544
|
+
return (
|
|
10545
|
+
e.by_channel.length &&
|
|
10546
|
+
(a.push('', r.bold('By channel')),
|
|
10547
|
+
a.push(
|
|
10548
|
+
...Ze([
|
|
10549
|
+
['Channel', 'Spend', 'Requests'],
|
|
10550
|
+
...e.by_channel.map((i) => [i.channel, _(i.spend), String(i.requests)]),
|
|
10551
|
+
]),
|
|
10552
|
+
)),
|
|
10553
|
+
e.by_model.length &&
|
|
10554
|
+
(a.push('', r.bold('By model')),
|
|
10555
|
+
a.push(
|
|
10556
|
+
...Ze([
|
|
10557
|
+
['Model', 'Spend', 'Requests', 'Failed'],
|
|
10558
|
+
...e.by_model.map((i) => [i.name, _(i.spend), String(i.requests), String(i.failed)]),
|
|
10559
|
+
]),
|
|
10560
|
+
)),
|
|
10561
|
+
a
|
|
10562
|
+
);
|
|
10563
|
+
}
|
|
10564
|
+
async function ma(e) {
|
|
10565
|
+
let t = !!e.json,
|
|
10566
|
+
a = da(e),
|
|
10567
|
+
i = await ua(t, () => a.getUsage(ca(e, ['range', 'from', 'to', 'model', 'channel'])));
|
|
10568
|
+
if (t) {
|
|
10569
|
+
process.stdout.write(
|
|
10570
|
+
JSON.stringify(i, null, 2) +
|
|
10571
|
+
`
|
|
10572
|
+
`,
|
|
10573
|
+
);
|
|
10574
|
+
return;
|
|
10575
|
+
}
|
|
10576
|
+
process.stdout.write(`
|
|
10577
|
+
${r.bold('Tein usage')}
|
|
10578
|
+
${rr(i).join(`
|
|
10579
|
+
`)}
|
|
10580
|
+
|
|
10581
|
+
`);
|
|
10582
|
+
}
|
|
10583
|
+
function nr(e) {
|
|
10584
|
+
return e.data.length
|
|
10585
|
+
? Ze([
|
|
10586
|
+
['When (UTC)', 'Amount', 'Balance after', 'What'],
|
|
10587
|
+
...e.data.map((t) => [
|
|
10588
|
+
t.created_at.slice(0, 16).replace('T', ' '),
|
|
10589
|
+
`${t.amount >= 0 ? '+' : '-'}${_(Math.abs(t.amount))}`,
|
|
10590
|
+
_(t.balance_after),
|
|
10591
|
+
`${t.description}${t.job_id ? ` (${t.job_id})` : ''}`,
|
|
10592
|
+
]),
|
|
10593
|
+
])
|
|
10594
|
+
: [' No transactions yet.'];
|
|
10595
|
+
}
|
|
10596
|
+
async function fa(e) {
|
|
10597
|
+
let t = !!e.json,
|
|
10598
|
+
a = da(e),
|
|
10599
|
+
i = await ua(t, () => a.getTransactions(ca(e, ['limit', 'type', 'after'])));
|
|
10600
|
+
if (t) {
|
|
10601
|
+
process.stdout.write(
|
|
10602
|
+
JSON.stringify(i, null, 2) +
|
|
10603
|
+
`
|
|
10604
|
+
`,
|
|
10605
|
+
);
|
|
10606
|
+
return;
|
|
10607
|
+
}
|
|
10608
|
+
let n =
|
|
10609
|
+
i.has_more && i.next_cursor
|
|
10610
|
+
? `
|
|
10611
|
+
More: tein transactions --after ${i.next_cursor}`
|
|
10612
|
+
: '';
|
|
10613
|
+
process.stdout.write(`
|
|
10614
|
+
${r.bold('Tein balance history')}
|
|
10615
|
+
${nr(i).join(`
|
|
10616
|
+
`)}${n}
|
|
10617
|
+
|
|
10618
|
+
`);
|
|
10619
|
+
}
|
|
10620
|
+
$();
|
|
10621
|
+
Ce();
|
|
10622
|
+
ee();
|
|
10623
|
+
var sr = 3e3;
|
|
10624
|
+
async function ga(e) {
|
|
10625
|
+
try {
|
|
10626
|
+
let t = await fetch(`${w(e)}/v1/pricing`, { signal: AbortSignal.timeout(sr) });
|
|
10099
10627
|
if (!t.ok) return;
|
|
10100
|
-
let
|
|
10628
|
+
let a = await t.json(),
|
|
10101
10629
|
i = {};
|
|
10102
|
-
for (let n of
|
|
10630
|
+
for (let n of a.configs ?? []) {
|
|
10103
10631
|
let s = String(n.modelSlug ?? '');
|
|
10104
|
-
|
|
10632
|
+
J.has(s) && (i[s] ??= []).push(Number(n.starterPrice));
|
|
10105
10633
|
}
|
|
10106
|
-
|
|
10634
|
+
Qt(i);
|
|
10107
10635
|
} catch {}
|
|
10108
10636
|
}
|
|
10109
|
-
var
|
|
10110
|
-
|
|
10111
|
-
async function
|
|
10112
|
-
await
|
|
10113
|
-
let
|
|
10637
|
+
var or = new Set(['video', 'image', 'text', 'audio', '3d']),
|
|
10638
|
+
lr = { llm: 'text', chat: 'text', reasoning: 'text' };
|
|
10639
|
+
async function ha(e, t) {
|
|
10640
|
+
await ga(t);
|
|
10641
|
+
let a = D();
|
|
10114
10642
|
if (e) {
|
|
10115
10643
|
let s = e.toLowerCase(),
|
|
10116
|
-
o =
|
|
10117
|
-
|
|
10118
|
-
?
|
|
10119
|
-
:
|
|
10644
|
+
o = lr[s] ?? s;
|
|
10645
|
+
a = or.has(o)
|
|
10646
|
+
? a.filter((u) => u.category.toLowerCase() === o)
|
|
10647
|
+
: a.filter((u) => u.kind.toLowerCase().includes(s) || u.slug.toLowerCase().includes(s));
|
|
10120
10648
|
}
|
|
10121
10649
|
(process.stdout.write(`
|
|
10122
|
-
${
|
|
10650
|
+
${r.bold('Tein AI Models Catalog')} (${a.length} available)
|
|
10123
10651
|
`),
|
|
10124
10652
|
process.stdout
|
|
10125
|
-
.write(`${
|
|
10653
|
+
.write(`${r.dim('Run `tein info <model-slug>` to see detailed parameters and options.')}
|
|
10126
10654
|
|
|
10127
10655
|
`));
|
|
10128
10656
|
let i = {};
|
|
10129
|
-
for (let s of
|
|
10657
|
+
for (let s of a) {
|
|
10130
10658
|
let o = s.category;
|
|
10131
10659
|
(i[o] || (i[o] = []), i[o].push(s));
|
|
10132
10660
|
}
|
|
@@ -10134,13 +10662,13 @@ ${a.bold('Tein AI Models Catalog')} (${r.length} available)
|
|
|
10134
10662
|
for (let s of n) {
|
|
10135
10663
|
let o = i[s];
|
|
10136
10664
|
if (!(!o || o.length === 0)) {
|
|
10137
|
-
process.stdout.write(`${
|
|
10665
|
+
process.stdout.write(`${r.bold(r.cyan(`\u2500\u2500 ${s} Models \u2500\u2500`))}
|
|
10138
10666
|
`);
|
|
10139
10667
|
for (let u of o) {
|
|
10140
10668
|
let l = u.slug.padEnd(24),
|
|
10141
10669
|
c = u.name.padEnd(22),
|
|
10142
10670
|
p = u.priceFormatted.padEnd(22);
|
|
10143
|
-
process.stdout.write(` ${
|
|
10671
|
+
process.stdout.write(` ${r.bold(l)} ${r.gray(c)} ${r.green(p)} ${r.dim(u.vendor)}
|
|
10144
10672
|
`);
|
|
10145
10673
|
}
|
|
10146
10674
|
process.stdout.write(`
|
|
@@ -10148,50 +10676,50 @@ ${a.bold('Tein AI Models Catalog')} (${r.length} available)
|
|
|
10148
10676
|
}
|
|
10149
10677
|
}
|
|
10150
10678
|
process.stdout
|
|
10151
|
-
.write(`${
|
|
10679
|
+
.write(`${r.dim('Tip:')} Generate directly with ${r.cyan('tein run <model-slug> --prompt "..."')}
|
|
10152
10680
|
|
|
10153
10681
|
`);
|
|
10154
10682
|
}
|
|
10155
|
-
async function
|
|
10156
|
-
|
|
10157
|
-
let
|
|
10158
|
-
(
|
|
10159
|
-
(process.stderr.write(`${
|
|
10683
|
+
async function ya(e, t) {
|
|
10684
|
+
J.has(e) && (await ga(t));
|
|
10685
|
+
let a = H(e);
|
|
10686
|
+
(a ||
|
|
10687
|
+
(process.stderr.write(`${r.red('Error:')} Model "${e}" not found in Tein AI registry.
|
|
10160
10688
|
`),
|
|
10161
|
-
process.stderr.write(`Run ${
|
|
10689
|
+
process.stderr.write(`Run ${r.cyan('tein models')} to see all available model slugs.
|
|
10162
10690
|
`),
|
|
10163
10691
|
process.exit(1)),
|
|
10164
10692
|
process.stdout.write(`
|
|
10165
|
-
${
|
|
10693
|
+
${r.bold(r.cyan(a.name))} (${r.bold(a.slug)})
|
|
10166
10694
|
`),
|
|
10167
|
-
process.stdout.write(` ${
|
|
10695
|
+
process.stdout.write(` ${r.gray(a.description)}
|
|
10168
10696
|
|
|
10169
10697
|
`),
|
|
10170
|
-
process.stdout.write(`${
|
|
10698
|
+
process.stdout.write(`${r.bold('Metadata:')}
|
|
10171
10699
|
`),
|
|
10172
|
-
process.stdout.write(` Category: ${
|
|
10700
|
+
process.stdout.write(` Category: ${r.yellow(a.category)}
|
|
10173
10701
|
`),
|
|
10174
|
-
process.stdout.write(` Kind: ${
|
|
10702
|
+
process.stdout.write(` Kind: ${a.kind}
|
|
10175
10703
|
`),
|
|
10176
|
-
process.stdout.write(` Vendor: ${
|
|
10704
|
+
process.stdout.write(` Vendor: ${a.vendor}
|
|
10177
10705
|
`),
|
|
10178
|
-
process.stdout.write(` Pricing: ${
|
|
10706
|
+
process.stdout.write(` Pricing: ${r.green(a.priceFormatted)}
|
|
10179
10707
|
|
|
10180
10708
|
`),
|
|
10181
|
-
process.stdout.write(`${
|
|
10709
|
+
process.stdout.write(`${r.bold('Parameters:')}
|
|
10182
10710
|
`));
|
|
10183
|
-
for (let i of
|
|
10184
|
-
let n = i.required ?
|
|
10185
|
-
s = i.default !== void 0 ?
|
|
10711
|
+
for (let i of a.parameters) {
|
|
10712
|
+
let n = i.required ? r.red('(required)') : r.dim('(optional)'),
|
|
10713
|
+
s = i.default !== void 0 ? r.dim(` [default: ${i.default}]`) : '';
|
|
10186
10714
|
(process.stdout
|
|
10187
|
-
.write(` ${
|
|
10715
|
+
.write(` ${r.bold(`--${i.name.replace(/_/g, '-')}`)} ${r.yellow(`<${i.type}>`)} ${n}${s}
|
|
10188
10716
|
`),
|
|
10189
10717
|
i.description &&
|
|
10190
|
-
process.stdout.write(` ${
|
|
10718
|
+
process.stdout.write(` ${r.gray(i.description)}
|
|
10191
10719
|
`),
|
|
10192
10720
|
i.options &&
|
|
10193
10721
|
i.options.length > 0 &&
|
|
10194
|
-
process.stdout.write(` Allowed values: ${
|
|
10722
|
+
process.stdout.write(` Allowed values: ${r.dim(i.options.join(', '))}
|
|
10195
10723
|
`),
|
|
10196
10724
|
(i.min !== void 0 || i.max !== void 0) &&
|
|
10197
10725
|
process.stdout.write(` Range: ${i.min ?? ''} to ${i.max ?? ''}
|
|
@@ -10200,43 +10728,43 @@ ${a.bold(a.cyan(r.name))} (${a.bold(r.slug)})
|
|
|
10200
10728
|
`));
|
|
10201
10729
|
}
|
|
10202
10730
|
if (
|
|
10203
|
-
(
|
|
10731
|
+
(a.parameters.some((i) => i.name === 'callback_url') ||
|
|
10204
10732
|
(process.stdout
|
|
10205
|
-
.write(` ${
|
|
10733
|
+
.write(` ${r.bold('--callback-url')} ${r.yellow('<string>')} ${r.dim('(optional)')}
|
|
10206
10734
|
`),
|
|
10207
10735
|
process.stdout
|
|
10208
|
-
.write(` ${
|
|
10736
|
+
.write(` ${r.gray('HTTPS URL. Tein POSTs the finished job here when it succeeds, fails, expires, or is cancelled.')}
|
|
10209
10737
|
|
|
10210
10738
|
`)),
|
|
10211
|
-
process.stdout.write(`${
|
|
10739
|
+
process.stdout.write(`${r.bold('Sample CLI Usage:')}
|
|
10212
10740
|
`),
|
|
10213
|
-
|
|
10741
|
+
a.category === 'Video')
|
|
10214
10742
|
)
|
|
10215
10743
|
process.stdout
|
|
10216
|
-
.write(` ${
|
|
10744
|
+
.write(` ${r.cyan(`tein run ${a.slug} --prompt "Cinematic camera drone shot of a coastline" --aspect-ratio 16:9 --duration 5 -o output.mp4`)}
|
|
10217
10745
|
|
|
10218
10746
|
`);
|
|
10219
|
-
else if (
|
|
10220
|
-
let i =
|
|
10747
|
+
else if (a.category === 'Image') {
|
|
10748
|
+
let i = a.parameters.some((n) => n.name === 'aspect_ratio') ? ' --aspect-ratio 16:9' : '';
|
|
10221
10749
|
process.stdout
|
|
10222
|
-
.write(` ${
|
|
10750
|
+
.write(` ${r.cyan(`tein run ${a.slug} --prompt "Cyberpunk city in the rain, 8k render"${i} -o output.png`)}
|
|
10223
10751
|
|
|
10224
10752
|
`);
|
|
10225
10753
|
} else
|
|
10226
|
-
|
|
10754
|
+
a.category === 'Audio'
|
|
10227
10755
|
? process.stdout
|
|
10228
|
-
.write(` ${
|
|
10756
|
+
.write(` ${r.cyan(`tein run ${a.slug} --prompt "Hello world from Tein AI" --speaker en_female_warm -o speech.wav`)}
|
|
10229
10757
|
|
|
10230
10758
|
`)
|
|
10231
10759
|
: process.stdout
|
|
10232
|
-
.write(` ${
|
|
10760
|
+
.write(` ${r.cyan(`tein run ${a.slug} --prompt "Explain quantum computing in simple terms"`)}
|
|
10233
10761
|
|
|
10234
10762
|
`);
|
|
10235
10763
|
}
|
|
10236
|
-
|
|
10237
|
-
|
|
10238
|
-
var
|
|
10239
|
-
|
|
10764
|
+
$();
|
|
10765
|
+
et();
|
|
10766
|
+
var pr = 1e4,
|
|
10767
|
+
at = {
|
|
10240
10768
|
price: '',
|
|
10241
10769
|
creativeMode: 'Creative mode',
|
|
10242
10770
|
priority: 'Priority',
|
|
@@ -10246,24 +10774,24 @@ var ji = 1e4,
|
|
|
10246
10774
|
priorityDraft: 'Priority + Draft',
|
|
10247
10775
|
creativeModePriorityDraft: 'Creative mode + Priority + Draft',
|
|
10248
10776
|
},
|
|
10249
|
-
|
|
10250
|
-
|
|
10777
|
+
dr = Object.keys(at),
|
|
10778
|
+
cr = {
|
|
10251
10779
|
creativeMode: 'unfiltered',
|
|
10252
10780
|
creativeModePriority: 'unfilteredPriority',
|
|
10253
10781
|
creativeModeDraft: 'unfilteredDraft',
|
|
10254
10782
|
creativeModePriorityDraft: 'unfilteredPriorityDraft',
|
|
10255
10783
|
};
|
|
10256
|
-
function
|
|
10257
|
-
let
|
|
10258
|
-
return e[t] ?? (
|
|
10784
|
+
function ur(e, t) {
|
|
10785
|
+
let a = cr[t];
|
|
10786
|
+
return e[t] ?? (a ? e[a] : void 0);
|
|
10259
10787
|
}
|
|
10260
|
-
async function
|
|
10261
|
-
let
|
|
10788
|
+
async function mr(e, t) {
|
|
10789
|
+
let a = `${w(e)}${xe(t)}`,
|
|
10262
10790
|
i;
|
|
10263
10791
|
try {
|
|
10264
|
-
i = await fetch(
|
|
10792
|
+
i = await fetch(a, { signal: AbortSignal.timeout(pr) });
|
|
10265
10793
|
} catch {
|
|
10266
|
-
throw new Error(`Could not reach ${
|
|
10794
|
+
throw new Error(`Could not reach ${a}`);
|
|
10267
10795
|
}
|
|
10268
10796
|
let n = await i.json().catch(() => null);
|
|
10269
10797
|
if (!i.ok || !n || n.object !== 'list' || !n.board) {
|
|
@@ -10277,22 +10805,22 @@ async function Ji(e, t) {
|
|
|
10277
10805
|
}
|
|
10278
10806
|
return n;
|
|
10279
10807
|
}
|
|
10280
|
-
function
|
|
10808
|
+
function tt(e) {
|
|
10281
10809
|
let t = e.toFixed(4).replace(/0+$/, '').replace(/\.$/, ''),
|
|
10282
|
-
[
|
|
10283
|
-
return `$${
|
|
10810
|
+
[a, i = ''] = t.split('.');
|
|
10811
|
+
return `$${a}.${i.padEnd(2, '0')}`;
|
|
10284
10812
|
}
|
|
10285
|
-
function
|
|
10813
|
+
function it(e) {
|
|
10286
10814
|
if (!e || typeof e.starter != 'number') return null;
|
|
10287
10815
|
let t = typeof e.plus == 'number' ? e.plus : e.starter,
|
|
10288
|
-
|
|
10289
|
-
return `Starter ${
|
|
10816
|
+
a = typeof e.scale == 'number' ? e.scale : t;
|
|
10817
|
+
return `Starter ${tt(e.starter)} Plus ${tt(t)} Scale ${tt(a)}`;
|
|
10290
10818
|
}
|
|
10291
|
-
function
|
|
10819
|
+
function fr(e) {
|
|
10292
10820
|
if (typeof e.label == 'string' && e.label.trim()) return e.label.trim();
|
|
10293
10821
|
let t = [];
|
|
10294
|
-
for (let
|
|
10295
|
-
let i = e[
|
|
10822
|
+
for (let a of ['endpoint', 'resolution', 'quality', 'mode', 'task', 'component', 'token']) {
|
|
10823
|
+
let i = e[a];
|
|
10296
10824
|
i != null && i !== '' && t.push(String(i));
|
|
10297
10825
|
}
|
|
10298
10826
|
return (
|
|
@@ -10300,38 +10828,38 @@ function Wi(e) {
|
|
|
10300
10828
|
t.length ? t.join(' \xB7 ') : String(e.id ?? 'default')
|
|
10301
10829
|
);
|
|
10302
10830
|
}
|
|
10303
|
-
function
|
|
10304
|
-
let
|
|
10305
|
-
for (let i of
|
|
10306
|
-
let n =
|
|
10831
|
+
function gr(e, t) {
|
|
10832
|
+
let a = fr(e);
|
|
10833
|
+
for (let i of dr) {
|
|
10834
|
+
let n = it(ur(e, i));
|
|
10307
10835
|
if (!n) continue;
|
|
10308
|
-
let s =
|
|
10309
|
-
t.push(` ${
|
|
10836
|
+
let s = at[i] ? ` (${at[i]})` : '';
|
|
10837
|
+
t.push(` ${a}${s} ${n}`);
|
|
10310
10838
|
}
|
|
10311
10839
|
}
|
|
10312
|
-
function
|
|
10313
|
-
let
|
|
10840
|
+
function hr(e, t) {
|
|
10841
|
+
let a = e.quality ? ` quality=${e.quality}` : '';
|
|
10314
10842
|
t.push(
|
|
10315
|
-
` ${
|
|
10843
|
+
` ${r.bold(e.slug.padEnd(26))} ${r.gray(e.name)} ${r.dim(`${e.kind} ${e.unit} model=${e.model}${a}`)}`,
|
|
10316
10844
|
);
|
|
10317
|
-
for (let n of e.variants ?? [])
|
|
10845
|
+
for (let n of e.variants ?? []) gr(n, t);
|
|
10318
10846
|
let i = e.addons;
|
|
10319
10847
|
if (Array.isArray(i))
|
|
10320
10848
|
for (let n of i) {
|
|
10321
10849
|
if (!n || typeof n != 'object') continue;
|
|
10322
10850
|
let s = n,
|
|
10323
10851
|
o = typeof s.label == 'string' ? s.label : String(s.id ?? 'add-on'),
|
|
10324
|
-
u =
|
|
10852
|
+
u = it(s.price);
|
|
10325
10853
|
u && t.push(` ${o} (add-on) ${u}`);
|
|
10326
10854
|
}
|
|
10327
10855
|
t.push('');
|
|
10328
10856
|
}
|
|
10329
|
-
function
|
|
10857
|
+
function yr(e) {
|
|
10330
10858
|
let t = [],
|
|
10331
|
-
|
|
10332
|
-
(t.push(`${
|
|
10859
|
+
a = e.board.checked ? ` \xB7 checked ${e.board.checked}` : '';
|
|
10860
|
+
(t.push(`${r.bold('Tein prices')} ${r.green(e.currency)} ${e.count} models${a}`),
|
|
10333
10861
|
t.push(
|
|
10334
|
-
`${
|
|
10862
|
+
`${r.dim('Starter, Plus and Scale. Creative mode, Priority and draft show only where published.')}`,
|
|
10335
10863
|
),
|
|
10336
10864
|
t.push(''));
|
|
10337
10865
|
let i = new Map();
|
|
@@ -10347,13 +10875,13 @@ function Qi(e) {
|
|
|
10347
10875
|
return (p === -1 ? 99 : p) - (d === -1 ? 99 : d);
|
|
10348
10876
|
});
|
|
10349
10877
|
for (let l of s) {
|
|
10350
|
-
t.push(`${
|
|
10351
|
-
for (let c of i.get(l) ?? [])
|
|
10878
|
+
t.push(`${r.bold(r.cyan(`\u2500\u2500 ${l} \u2500\u2500`))}`);
|
|
10879
|
+
for (let c of i.get(l) ?? []) hr(c, t);
|
|
10352
10880
|
}
|
|
10353
10881
|
let o = new Set(e.board.models.map((l) => l.slug.toLowerCase())),
|
|
10354
10882
|
u = (e.configs ?? []).filter((l) => !o.has(String(l.modelSlug ?? '').toLowerCase()));
|
|
10355
10883
|
if (u.length) {
|
|
10356
|
-
t.push(`${
|
|
10884
|
+
t.push(`${r.bold(r.cyan('\u2500\u2500 other prices \u2500\u2500'))}`);
|
|
10357
10885
|
let l = new Map();
|
|
10358
10886
|
for (let c of u) {
|
|
10359
10887
|
let p = String(c.modelSlug ?? ''),
|
|
@@ -10362,29 +10890,29 @@ function Qi(e) {
|
|
|
10362
10890
|
}
|
|
10363
10891
|
for (let [c, p] of l) {
|
|
10364
10892
|
let d = String(p[0]?.modelName ?? c);
|
|
10365
|
-
t.push(` ${
|
|
10893
|
+
t.push(` ${r.bold(c.padEnd(26))} ${r.gray(d)}`);
|
|
10366
10894
|
for (let m of p) {
|
|
10367
|
-
let
|
|
10368
|
-
f =
|
|
10369
|
-
f && t.push(` ${
|
|
10895
|
+
let y = String(m.displayLabel ?? m.billingUnit ?? 'price'),
|
|
10896
|
+
f = it(m.prices);
|
|
10897
|
+
f && t.push(` ${y} ${f}`);
|
|
10370
10898
|
}
|
|
10371
10899
|
t.push('');
|
|
10372
10900
|
}
|
|
10373
10901
|
}
|
|
10374
10902
|
return (
|
|
10375
|
-
t.push(`${
|
|
10903
|
+
t.push(`${r.dim('JSON:')} ${r.cyan('tein pricing --json')}`),
|
|
10376
10904
|
`${t.join(`
|
|
10377
10905
|
`)}
|
|
10378
10906
|
`
|
|
10379
10907
|
);
|
|
10380
10908
|
}
|
|
10381
|
-
async function
|
|
10909
|
+
async function ba(e) {
|
|
10382
10910
|
let t;
|
|
10383
10911
|
try {
|
|
10384
|
-
t = await
|
|
10385
|
-
} catch (
|
|
10386
|
-
let i =
|
|
10387
|
-
(process.stderr.write(`${
|
|
10912
|
+
t = await mr(e.apiUrl, e.model);
|
|
10913
|
+
} catch (a) {
|
|
10914
|
+
let i = a instanceof Error ? a.message : String(a);
|
|
10915
|
+
(process.stderr.write(`${r.red('Error:')} ${i}
|
|
10388
10916
|
`),
|
|
10389
10917
|
process.exit(1));
|
|
10390
10918
|
}
|
|
@@ -10392,38 +10920,38 @@ async function sr(e) {
|
|
|
10392
10920
|
e.json
|
|
10393
10921
|
? `${JSON.stringify(t, null, 2)}
|
|
10394
10922
|
`
|
|
10395
|
-
:
|
|
10923
|
+
: yr(t),
|
|
10396
10924
|
);
|
|
10397
10925
|
}
|
|
10398
|
-
var
|
|
10399
|
-
|
|
10400
|
-
async function
|
|
10401
|
-
let
|
|
10402
|
-
i =
|
|
10403
|
-
(
|
|
10404
|
-
(process.stderr.write(`${
|
|
10926
|
+
var ka = T(require('node:path'));
|
|
10927
|
+
$();
|
|
10928
|
+
async function wa(e, t) {
|
|
10929
|
+
let a = S(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
10930
|
+
i = w(typeof t.api_url == 'string' ? t.api_url : void 0);
|
|
10931
|
+
(a ||
|
|
10932
|
+
(process.stderr.write(`${r.red('Error:')} Authentication required.
|
|
10405
10933
|
`),
|
|
10406
10934
|
process.stderr
|
|
10407
|
-
.write(`Please run ${
|
|
10935
|
+
.write(`Please run ${r.cyan('tein auth login')} or set ${r.cyan('TEIN_API_KEY')} environment variable.
|
|
10408
10936
|
`),
|
|
10409
10937
|
process.exit(1)),
|
|
10410
10938
|
e ||
|
|
10411
|
-
(process.stderr.write(`${
|
|
10939
|
+
(process.stderr.write(`${r.red('Error:')} Missing request ID.
|
|
10412
10940
|
`),
|
|
10413
|
-
process.stderr.write(`Usage: ${
|
|
10941
|
+
process.stderr.write(`Usage: ${r.cyan('tein status <request-id> [--wait] [-o output.mp4]')}
|
|
10414
10942
|
`),
|
|
10415
10943
|
process.exit(1)));
|
|
10416
10944
|
let n = !!t.json,
|
|
10417
10945
|
s = !!t.wait,
|
|
10418
10946
|
o = typeof t.output == 'string' ? t.output : void 0,
|
|
10419
|
-
u = new
|
|
10420
|
-
l = new
|
|
10947
|
+
u = new M(a, i),
|
|
10948
|
+
l = new E(`Checking status of ${r.bold(e)}...`);
|
|
10421
10949
|
n || l.start();
|
|
10422
10950
|
let c;
|
|
10423
10951
|
try {
|
|
10424
10952
|
c = await u.getStatus(e);
|
|
10425
10953
|
} catch (p) {
|
|
10426
|
-
(p instanceof
|
|
10954
|
+
(p instanceof b &&
|
|
10427
10955
|
(n
|
|
10428
10956
|
? process.stdout.write(
|
|
10429
10957
|
JSON.stringify(
|
|
@@ -10435,7 +10963,7 @@ async function lr(e, t) {
|
|
|
10435
10963
|
`,
|
|
10436
10964
|
)
|
|
10437
10965
|
: l.fail(
|
|
10438
|
-
|
|
10966
|
+
K(p).join(`
|
|
10439
10967
|
`),
|
|
10440
10968
|
),
|
|
10441
10969
|
process.exit(p.exitCode)),
|
|
@@ -10446,7 +10974,7 @@ async function lr(e, t) {
|
|
|
10446
10974
|
let p = Date.now();
|
|
10447
10975
|
for (; c.status === 'processing';) {
|
|
10448
10976
|
let d = Math.round((Date.now() - p) / 1e3);
|
|
10449
|
-
(n || l.update(`Waiting for ${
|
|
10977
|
+
(n || l.update(`Waiting for ${r.bold(c.model)} (${d}s elapsed)...`),
|
|
10450
10978
|
await new Promise((m) => setTimeout(m, 1500)));
|
|
10451
10979
|
try {
|
|
10452
10980
|
c = await u.getStatus(e);
|
|
@@ -10471,29 +10999,29 @@ async function lr(e, t) {
|
|
|
10471
10999
|
}
|
|
10472
11000
|
if (
|
|
10473
11001
|
(process.stdout.write(`
|
|
10474
|
-
${
|
|
11002
|
+
${r.bold('Model:')} ${c.model}
|
|
10475
11003
|
`),
|
|
10476
11004
|
process.stdout
|
|
10477
|
-
.write(` ${
|
|
11005
|
+
.write(` ${r.bold('Status:')} ${c.status === 'succeeded' ? r.green(c.status) : c.status === 'processing' ? r.yellow(c.status) : r.red(c.status)}
|
|
10478
11006
|
`),
|
|
10479
|
-
process.stdout.write(` ${
|
|
11007
|
+
process.stdout.write(` ${r.bold('Request ID:')} ${c.request_id}
|
|
10480
11008
|
`),
|
|
10481
11009
|
c.output && c.output.length > 0)
|
|
10482
11010
|
) {
|
|
10483
11011
|
process.stdout.write(`
|
|
10484
|
-
${
|
|
11012
|
+
${r.bold('Outputs:')}
|
|
10485
11013
|
`);
|
|
10486
11014
|
for (let p of c.output)
|
|
10487
11015
|
if (p.url) {
|
|
10488
11016
|
if (
|
|
10489
|
-
(process.stdout.write(` [${p.type.toUpperCase()}] ${
|
|
11017
|
+
(process.stdout.write(` [${p.type.toUpperCase()}] ${r.cyan(r.underline(p.url))}
|
|
10490
11018
|
`),
|
|
10491
11019
|
o)
|
|
10492
11020
|
) {
|
|
10493
|
-
let d = new
|
|
11021
|
+
let d = new E(`Downloading output to ${o}...`).start();
|
|
10494
11022
|
try {
|
|
10495
|
-
(await u.downloadOutput(p.url,
|
|
10496
|
-
d.succeed(`Saved to ${
|
|
11023
|
+
(await u.downloadOutput(p.url, ka.default.resolve(process.cwd(), o)),
|
|
11024
|
+
d.succeed(`Saved to ${r.bold(o)}`));
|
|
10497
11025
|
} catch (m) {
|
|
10498
11026
|
d.fail(`Failed to download: ${m instanceof Error ? m.message : m}`);
|
|
10499
11027
|
}
|
|
@@ -10507,35 +11035,35 @@ ${p.text}
|
|
|
10507
11035
|
process.stdout.write(`
|
|
10508
11036
|
`);
|
|
10509
11037
|
}
|
|
10510
|
-
var
|
|
10511
|
-
|
|
10512
|
-
|
|
10513
|
-
async function
|
|
10514
|
-
let
|
|
10515
|
-
i =
|
|
11038
|
+
var rt = T(require('node:fs')),
|
|
11039
|
+
nt = T(require('node:path'));
|
|
11040
|
+
$();
|
|
11041
|
+
async function xa(e, t = {}) {
|
|
11042
|
+
let a = S(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
11043
|
+
i = w(typeof t.api_url == 'string' ? t.api_url : void 0),
|
|
10516
11044
|
n = !!t.json;
|
|
10517
|
-
(
|
|
10518
|
-
(process.stderr.write(`${
|
|
11045
|
+
(a ||
|
|
11046
|
+
(process.stderr.write(`${r.red('Error:')} Authentication required.
|
|
10519
11047
|
`),
|
|
10520
11048
|
process.stderr
|
|
10521
|
-
.write(`Please run ${
|
|
11049
|
+
.write(`Please run ${r.cyan('tein auth login')} or set ${r.cyan('TEIN_API_KEY')} environment variable.
|
|
10522
11050
|
`),
|
|
10523
11051
|
process.exit(1)),
|
|
10524
11052
|
e ||
|
|
10525
|
-
(process.stderr.write(`${
|
|
11053
|
+
(process.stderr.write(`${r.red('Error:')} Missing file path.
|
|
10526
11054
|
`),
|
|
10527
|
-
process.stderr.write(`Usage: ${
|
|
11055
|
+
process.stderr.write(`Usage: ${r.cyan('tein upload <image.png|video.mp4>')}
|
|
10528
11056
|
`),
|
|
10529
11057
|
process.exit(1)));
|
|
10530
|
-
let s =
|
|
10531
|
-
|
|
10532
|
-
(process.stderr.write(`${
|
|
11058
|
+
let s = nt.default.resolve(e);
|
|
11059
|
+
rt.default.existsSync(s) ||
|
|
11060
|
+
(process.stderr.write(`${r.red('Error:')} File not found: ${s}
|
|
10533
11061
|
`),
|
|
10534
11062
|
process.exit(1));
|
|
10535
|
-
let o =
|
|
10536
|
-
l =
|
|
10537
|
-
c = new
|
|
10538
|
-
p = new
|
|
11063
|
+
let o = nt.default.basename(s),
|
|
11064
|
+
l = rt.default.readFileSync(s).toString('base64'),
|
|
11065
|
+
c = new M(a, i),
|
|
11066
|
+
p = new E(`Uploading ${r.bold(o)} to Tein AI CDN...`);
|
|
10539
11067
|
n || p.start();
|
|
10540
11068
|
try {
|
|
10541
11069
|
let d = await c.uploadAsset(l);
|
|
@@ -10547,134 +11075,157 @@ async function pr(e, t = {}) {
|
|
|
10547
11075
|
)
|
|
10548
11076
|
: (p.succeed('Upload successful!'),
|
|
10549
11077
|
process.stdout.write(`
|
|
10550
|
-
${
|
|
11078
|
+
${r.bold('CDN URL:')} ${r.green(d.url)}
|
|
10551
11079
|
`),
|
|
10552
|
-
process.stdout.write(`${
|
|
11080
|
+
process.stdout.write(`${r.dim(`Key: ${d.key}`)}
|
|
10553
11081
|
|
|
10554
11082
|
`),
|
|
10555
11083
|
process.stdout.write(`Use this CDN URL directly in your CLI runs:
|
|
10556
|
-
${
|
|
11084
|
+
${r.cyan(`tein run seedance-2-5 --prompt "Animate this scene" --image "${d.url}"`)}
|
|
10557
11085
|
|
|
10558
11086
|
`));
|
|
10559
11087
|
} catch (d) {
|
|
10560
|
-
let m = d instanceof
|
|
10561
|
-
|
|
10562
|
-
?
|
|
11088
|
+
let m = d instanceof b ? d : null,
|
|
11089
|
+
y = m
|
|
11090
|
+
? K(m).join(`
|
|
10563
11091
|
`)
|
|
10564
11092
|
: d instanceof Error
|
|
10565
11093
|
? d.message
|
|
10566
11094
|
: String(d);
|
|
10567
11095
|
(n
|
|
10568
11096
|
? process.stdout.write(
|
|
10569
|
-
JSON.stringify({ error: { code: m?.code ?? null, message: m?.message ??
|
|
11097
|
+
JSON.stringify({ error: { code: m?.code ?? null, message: m?.message ?? y } }, null, 2) +
|
|
10570
11098
|
`
|
|
10571
11099
|
`,
|
|
10572
11100
|
)
|
|
10573
|
-
: p.fail(`Upload failed: ${
|
|
11101
|
+
: p.fail(`Upload failed: ${y}`),
|
|
10574
11102
|
process.exit(m ? m.exitCode : v));
|
|
10575
11103
|
}
|
|
10576
11104
|
}
|
|
10577
|
-
|
|
10578
|
-
|
|
10579
|
-
|
|
11105
|
+
re();
|
|
11106
|
+
ee();
|
|
11107
|
+
Le();
|
|
11108
|
+
function Da() {
|
|
10580
11109
|
process.stdout.write(`
|
|
10581
|
-
${
|
|
11110
|
+
${r.bold(r.cyan('Tein AI CLI'))} - Official Command-Line Interface for Tein AI models
|
|
11111
|
+
|
|
11112
|
+
${r.bold('USAGE:')}
|
|
11113
|
+
${r.cyan('tein')} <command> [arguments] [options]
|
|
10582
11114
|
|
|
10583
|
-
${
|
|
10584
|
-
${
|
|
11115
|
+
${r.bold('COMMANDS:')}
|
|
11116
|
+
${r.bold('auth')} <login|set-key|logout|status> Manage Tein API key and authentication
|
|
11117
|
+
${r.bold('models')} [category] List all 25+ models (Video, Image, Audio, Text, 3D)
|
|
11118
|
+
${r.bold('pricing')} [model-slug] Every published price (Starter, Plus, Scale)
|
|
11119
|
+
${r.bold('info')} <model-slug> View parameter schemas, pricing, and options
|
|
11120
|
+
${r.bold('upload')} <filepath> Upload local image/video directly to Tein CDN
|
|
11121
|
+
${r.bold('run')} <model-slug> [options] Generate video, image, audio, or reasoning outputs
|
|
11122
|
+
${r.bold('status')} <request-id> [options] Check generation progress and retrieve output files
|
|
11123
|
+
${r.bold('balance')} [--json] Workspace balance, this key's limit and usage
|
|
11124
|
+
${r.bold('usage')} [options] [--json] Spend by model, channel, key and time (Usage page)
|
|
11125
|
+
${r.bold('transactions')} [options] [--json] Balance history: top ups, charges, refunds (alias: history)
|
|
11126
|
+
${r.bold('mcp')} Launch stdio MCP server for Claude Desktop / Code
|
|
11127
|
+
${r.bold('--version')}, ${r.bold('-v')} Print the installed CLI version
|
|
10585
11128
|
|
|
10586
|
-
${
|
|
10587
|
-
${
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
${
|
|
10591
|
-
${
|
|
10592
|
-
${
|
|
10593
|
-
${
|
|
10594
|
-
${
|
|
11129
|
+
${r.bold('ACCOUNT OPTIONS (read only, nothing is charged; the same JSON as GET /v1/balance, /v1/usage, /v1/balance/transactions):')}
|
|
11130
|
+
${r.cyan('--range')} hour|day|week|month|custom tein usage: the row size, over a fixed period ending now:
|
|
11131
|
+
hour = last 24 h, day = last 30 days (default),
|
|
11132
|
+
week = last 12 weeks, month = last 12 months
|
|
11133
|
+
${r.cyan('--from, --to')} <YYYY-MM-DD> tein usage --range custom: first and last day (UTC), at most 366 days
|
|
11134
|
+
${r.cyan('--model')} <model-id> tein usage: only this model
|
|
11135
|
+
${r.cyan('--channel')} website|api|mcp|cli tein usage: only runs started there
|
|
11136
|
+
${r.cyan('--limit')} <1-100> tein transactions: rows per page (default 50)
|
|
11137
|
+
${r.cyan('--type')} <types> tein transactions: e.g. usage,refund or topup,auto_topup
|
|
11138
|
+
${r.cyan('--after')} <cursor> tein transactions: the next page (printed under each page)
|
|
11139
|
+
${r.cyan('--json')} Print the API's JSON as is
|
|
10595
11140
|
|
|
10596
|
-
${
|
|
10597
|
-
${
|
|
10598
|
-
${
|
|
10599
|
-
${
|
|
10600
|
-
${
|
|
10601
|
-
${
|
|
10602
|
-
${
|
|
10603
|
-
${
|
|
10604
|
-
${
|
|
10605
|
-
${
|
|
10606
|
-
${
|
|
10607
|
-
${
|
|
10608
|
-
${
|
|
10609
|
-
${
|
|
10610
|
-
${
|
|
11141
|
+
${r.bold('GENERATION OPTIONS (for `tein run`):')}
|
|
11142
|
+
${r.cyan('-p, --prompt')} <text> Text prompt for generation ${r.red('(required)')}
|
|
11143
|
+
${r.cyan('-o, --output')} <filepath> Download output file locally (e.g. video.mp4, image.png)
|
|
11144
|
+
${r.cyan('--aspect-ratio')} <ratio> Aspect ratio, per model (see tein info <model-slug>)
|
|
11145
|
+
${r.cyan('-d, --duration')} <seconds> Video duration in seconds (4-30s depending on model)
|
|
11146
|
+
${r.cyan('-r, --resolution')} <res> Resolution (720p, 1080p, 1K, 2K, 4K)
|
|
11147
|
+
${r.cyan('-q, --quality')} <quality> Quality tier (standard, fast, mini, high)
|
|
11148
|
+
${r.cyan('-s, --speaker')} <speaker_id> Voice speaker ID for audio TTS models
|
|
11149
|
+
${r.cyan('--image')} <url> Input image URL for image-to-video or image-to-image
|
|
11150
|
+
${r.cyan('--generate-audio')} Enable native synchronized audio (Seedance 2.5)
|
|
11151
|
+
${r.cyan('--finalize')} <job-id> Render a Seedance 2.5 draft at 1080p, or 4K with -r 4k (no prompt)
|
|
11152
|
+
${r.cyan('--callback-url')} <url> HTTPS URL that receives the finished job
|
|
11153
|
+
${r.cyan('--async, --no-wait')} Queue task and return request ID immediately
|
|
11154
|
+
${r.cyan('--json')} Output response in raw JSON format
|
|
11155
|
+
${r.cyan('--api-key')} <key> Override API key for this request
|
|
10611
11156
|
|
|
10612
|
-
${
|
|
10613
|
-
${
|
|
10614
|
-
${
|
|
11157
|
+
${r.bold('EXAMPLES:')}
|
|
11158
|
+
${r.dim('# 1. Authenticate with your Tein API key')}
|
|
11159
|
+
${r.cyan('tein auth login')}
|
|
10615
11160
|
|
|
10616
|
-
${
|
|
10617
|
-
${
|
|
11161
|
+
${r.dim('# 2. List all Video models')}
|
|
11162
|
+
${r.cyan('tein models video')}
|
|
10618
11163
|
|
|
10619
|
-
${
|
|
10620
|
-
${
|
|
10621
|
-
${
|
|
11164
|
+
${r.dim('# 3. Every published price, or one model as JSON')}
|
|
11165
|
+
${r.cyan('tein pricing')}
|
|
11166
|
+
${r.cyan('tein pricing seedance-2-5 --json')}
|
|
10622
11167
|
|
|
10623
|
-
${
|
|
10624
|
-
${
|
|
11168
|
+
${r.dim('# 4. Generate a high-quality 2K image and download it')}
|
|
11169
|
+
${r.cyan('tein run gpt-image-2 --prompt "Neon Tokyo street in rain" --quality high -r 2K -o tokyo.png')}
|
|
10625
11170
|
|
|
10626
|
-
${
|
|
10627
|
-
${
|
|
10628
|
-
${
|
|
10629
|
-
${
|
|
11171
|
+
${r.dim('# 5. Generate a video using Seedance 2.5 with audio')}
|
|
11172
|
+
${r.cyan('tein run seedance-2-5 --prompt "Drone shot of ocean waves at sunrise" --duration 5 -o ocean.mp4')}
|
|
11173
|
+
${r.dim('# The same at 4K (10-bit H.265; add --creative-mode true for Creative mode)')}
|
|
11174
|
+
${r.cyan('tein run seedance-2-5 --prompt "Drone shot of ocean waves at sunrise" --duration 5 -r 4k -o ocean-4k.mp4')}
|
|
10630
11175
|
|
|
10631
|
-
${
|
|
10632
|
-
${
|
|
11176
|
+
${r.dim('# 6. Generate speech with Seed Audio 1.0')}
|
|
11177
|
+
${r.cyan('tein run seed-audio-1-0 --prompt "Welcome to Tein AI CLI" -o welcome.wav')}
|
|
10633
11178
|
|
|
10634
|
-
${
|
|
10635
|
-
${
|
|
11179
|
+
${r.dim('# 7. Run deep reasoning task with GPT-6 Astra')}
|
|
11180
|
+
${r.cyan('tein run gpt-6-astra --prompt "Write a TypeScript binary search tree implementation"')}
|
|
11181
|
+
|
|
11182
|
+
${r.dim('# 8. Balance, API usage week by week, a custom period as JSON, the latest charges')}
|
|
11183
|
+
${r.cyan('tein balance')}
|
|
11184
|
+
${r.cyan('tein usage --range week --channel api')}
|
|
11185
|
+
${r.cyan('tein usage --range custom --from 2026-11-01 --to 2026-11-19 --json')}
|
|
11186
|
+
${r.cyan('tein transactions --limit 20 --type usage,refund')}
|
|
10636
11187
|
|
|
10637
11188
|
`);
|
|
10638
11189
|
}
|
|
10639
|
-
async function
|
|
11190
|
+
async function Dr() {
|
|
10640
11191
|
let e = process.argv.slice(2),
|
|
10641
|
-
t =
|
|
11192
|
+
t = sa(e);
|
|
10642
11193
|
if (t.flags.has('help') || t.options.help || t.command === 'help') {
|
|
10643
|
-
|
|
11194
|
+
Da();
|
|
10644
11195
|
return;
|
|
10645
11196
|
}
|
|
10646
11197
|
if (t.flags.has('version') || t.options.version || t.command === 'version') {
|
|
10647
|
-
process.stdout.write(`tein version ${
|
|
11198
|
+
process.stdout.write(`tein version ${F}
|
|
10648
11199
|
`);
|
|
10649
11200
|
return;
|
|
10650
11201
|
}
|
|
10651
11202
|
switch (t.command) {
|
|
10652
11203
|
case 'auth': {
|
|
10653
|
-
await
|
|
11204
|
+
await ae(t.subcommand, t.options.key);
|
|
10654
11205
|
break;
|
|
10655
11206
|
}
|
|
10656
11207
|
case 'login': {
|
|
10657
|
-
await
|
|
11208
|
+
await ae('login', t.options.key);
|
|
10658
11209
|
break;
|
|
10659
11210
|
}
|
|
10660
11211
|
case 'logout': {
|
|
10661
|
-
await
|
|
11212
|
+
await ae('logout');
|
|
10662
11213
|
break;
|
|
10663
11214
|
}
|
|
10664
11215
|
case 'whoami': {
|
|
10665
|
-
await
|
|
11216
|
+
await ae('status');
|
|
10666
11217
|
break;
|
|
10667
11218
|
}
|
|
10668
11219
|
case 'models':
|
|
10669
11220
|
case 'list': {
|
|
10670
|
-
await
|
|
11221
|
+
await ha(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0);
|
|
10671
11222
|
break;
|
|
10672
11223
|
}
|
|
10673
11224
|
case 'pricing':
|
|
10674
11225
|
case 'prices': {
|
|
10675
|
-
let
|
|
10676
|
-
i = t.subcommand || (typeof
|
|
10677
|
-
await
|
|
11226
|
+
let a = t.options.model,
|
|
11227
|
+
i = t.subcommand || (typeof a == 'string' ? a : void 0);
|
|
11228
|
+
await ba({
|
|
10678
11229
|
model: i,
|
|
10679
11230
|
json: !!t.options.json,
|
|
10680
11231
|
apiUrl: typeof t.options.api_url == 'string' ? t.options.api_url : void 0,
|
|
@@ -10684,61 +11235,74 @@ async function ha() {
|
|
|
10684
11235
|
case 'info':
|
|
10685
11236
|
case 'show': {
|
|
10686
11237
|
(t.subcommand ||
|
|
10687
|
-
(process.stderr.write(`${
|
|
11238
|
+
(process.stderr.write(`${r.red('Error:')} Missing model slug.
|
|
10688
11239
|
`),
|
|
10689
|
-
process.stderr.write(`Usage: ${
|
|
11240
|
+
process.stderr.write(`Usage: ${r.cyan('tein info <model-slug>')}
|
|
10690
11241
|
`),
|
|
10691
11242
|
process.exit(1)),
|
|
10692
|
-
await
|
|
11243
|
+
await ya(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0));
|
|
10693
11244
|
break;
|
|
10694
11245
|
}
|
|
10695
11246
|
case 'upload': {
|
|
10696
|
-
let
|
|
10697
|
-
await
|
|
11247
|
+
let a = t.subcommand || '';
|
|
11248
|
+
await xa(a, t.options);
|
|
10698
11249
|
break;
|
|
10699
11250
|
}
|
|
10700
11251
|
case 'run':
|
|
10701
11252
|
case 'generate': {
|
|
10702
|
-
let
|
|
10703
|
-
await
|
|
11253
|
+
let a = t.subcommand || '';
|
|
11254
|
+
await Qe(a, t.options);
|
|
10704
11255
|
break;
|
|
10705
11256
|
}
|
|
10706
11257
|
case 'status': {
|
|
10707
|
-
let
|
|
10708
|
-
await
|
|
11258
|
+
let a = t.subcommand || '';
|
|
11259
|
+
await wa(a, t.options);
|
|
11260
|
+
break;
|
|
11261
|
+
}
|
|
11262
|
+
case 'balance': {
|
|
11263
|
+
await pa(t.options);
|
|
11264
|
+
break;
|
|
11265
|
+
}
|
|
11266
|
+
case 'usage': {
|
|
11267
|
+
await ma(t.options);
|
|
11268
|
+
break;
|
|
11269
|
+
}
|
|
11270
|
+
case 'transactions':
|
|
11271
|
+
case 'history': {
|
|
11272
|
+
await fa(t.options);
|
|
10709
11273
|
break;
|
|
10710
11274
|
}
|
|
10711
11275
|
case 'mcp': {
|
|
10712
|
-
let { startStdioServer:
|
|
10713
|
-
await
|
|
11276
|
+
let { startStdioServer: a } = await Promise.resolve().then(() => (La(), Ra));
|
|
11277
|
+
await a();
|
|
10714
11278
|
break;
|
|
10715
11279
|
}
|
|
10716
11280
|
default: {
|
|
10717
11281
|
if (t.command && !t.command.startsWith('-')) {
|
|
10718
|
-
(!
|
|
10719
|
-
!
|
|
11282
|
+
(!H(t.command) &&
|
|
11283
|
+
!fe[t.command] &&
|
|
10720
11284
|
(process.stderr.write(`
|
|
10721
|
-
${
|
|
10722
|
-
Run ${
|
|
11285
|
+
${r.red('Error:')} Unknown command or model "${t.command}".
|
|
11286
|
+
Run ${r.cyan('tein --help')} for the commands, or ${r.cyan('tein models')} for the model slugs.
|
|
10723
11287
|
`),
|
|
10724
11288
|
process.exit(v)),
|
|
10725
|
-
await
|
|
11289
|
+
await Qe(t.command, t.options));
|
|
10726
11290
|
return;
|
|
10727
11291
|
}
|
|
10728
|
-
|
|
11292
|
+
Da();
|
|
10729
11293
|
break;
|
|
10730
11294
|
}
|
|
10731
11295
|
}
|
|
10732
11296
|
}
|
|
10733
|
-
|
|
10734
|
-
(e instanceof
|
|
11297
|
+
Dr().catch((e) => {
|
|
11298
|
+
(e instanceof b &&
|
|
10735
11299
|
(process.stderr.write(`
|
|
10736
|
-
${
|
|
11300
|
+
${r.red('Error:')} ${K(e).join(`
|
|
10737
11301
|
`)}
|
|
10738
11302
|
`),
|
|
10739
11303
|
process.exit(e.exitCode)),
|
|
10740
11304
|
process.stderr.write(`
|
|
10741
|
-
${
|
|
11305
|
+
${r.red('Fatal error:')} ${e instanceof Error ? e.message : e}
|
|
10742
11306
|
`),
|
|
10743
11307
|
process.exit(v));
|
|
10744
11308
|
});
|