@teinai/cli 1.1.31 → 1.1.32
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 +1706 -1136
- 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,9 +6821,9 @@ 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
|
: '',
|
|
@@ -6701,8 +6840,8 @@ function ri(e) {
|
|
|
6701
6840
|
{
|
|
6702
6841
|
name: 'resolution',
|
|
6703
6842
|
type: 'select',
|
|
6704
|
-
default:
|
|
6705
|
-
options:
|
|
6843
|
+
default: a[0],
|
|
6844
|
+
options: a,
|
|
6706
6845
|
description: `Output resolution. Higher resolutions cost more per second.${e.modes.includes('motion_control') ? ' motion_control: 720p or 1080p.' : ''}`,
|
|
6707
6846
|
},
|
|
6708
6847
|
{
|
|
@@ -6732,19 +6871,19 @@ function ri(e) {
|
|
|
6732
6871
|
n.push({
|
|
6733
6872
|
name: 'images',
|
|
6734
6873
|
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.' : ''} ${
|
|
6874
|
+
description: `multi_reference: up to ${e.reference.maxImages} reference images.${e.referenceHandles ? ' In the prompt, name them @Image1, @Image2, ... in this order.' : ''} ${L}`,
|
|
6736
6875
|
}),
|
|
6737
6876
|
(e.modes.includes('image_to_video') || e.modes.includes('first_n_last_frames')) &&
|
|
6738
6877
|
n.push({
|
|
6739
6878
|
name: 'first_frame_image',
|
|
6740
6879
|
type: 'string',
|
|
6741
|
-
description: `The start frame (image_to_video, first_n_last_frames), ${
|
|
6880
|
+
description: `The start frame (image_to_video, first_n_last_frames), ${L}`,
|
|
6742
6881
|
}),
|
|
6743
6882
|
(e.lastFrameOnImageToVideo || e.modes.includes('first_n_last_frames')) &&
|
|
6744
6883
|
n.push({
|
|
6745
6884
|
name: 'last_frame_image',
|
|
6746
6885
|
type: 'string',
|
|
6747
|
-
description: `Last frame (optional on image_to_video), ${
|
|
6886
|
+
description: `Last frame (optional on image_to_video), ${L}`,
|
|
6748
6887
|
}),
|
|
6749
6888
|
e.reference?.maxVideos)
|
|
6750
6889
|
) {
|
|
@@ -6755,7 +6894,7 @@ function ri(e) {
|
|
|
6755
6894
|
n.push({
|
|
6756
6895
|
name: 'videos',
|
|
6757
6896
|
type: 'string[]',
|
|
6758
|
-
description: `multi_reference: up to ${s.maxVideos} reference videos${s.maxVideoSeconds ? `, ${s.maxVideoSeconds} s in all` : ''}.${e.referenceHandles ? ' In the prompt, name them @Video1, @Video2, ... in this order.' : ''}${o} ${
|
|
6897
|
+
description: `multi_reference: up to ${s.maxVideos} reference videos${s.maxVideoSeconds ? `, ${s.maxVideoSeconds} s in all` : ''}.${e.referenceHandles ? ' In the prompt, name them @Video1, @Video2, ... in this order.' : ''}${o} ${L}`,
|
|
6759
6898
|
});
|
|
6760
6899
|
}
|
|
6761
6900
|
if (e.reference?.maxAudios) {
|
|
@@ -6768,12 +6907,12 @@ function ri(e) {
|
|
|
6768
6907
|
n.push({
|
|
6769
6908
|
name: 'audios',
|
|
6770
6909
|
type: 'string[]',
|
|
6771
|
-
description: `multi_reference: up to ${s.maxAudios} reference audios${o}, with at least one image or video. ${
|
|
6910
|
+
description: `multi_reference: up to ${s.maxAudios} reference audios${o}, with at least one image or video. ${L}`,
|
|
6772
6911
|
});
|
|
6773
6912
|
}
|
|
6774
6913
|
return n;
|
|
6775
6914
|
}
|
|
6776
|
-
function
|
|
6915
|
+
function ki(e) {
|
|
6777
6916
|
let t = Object.keys(e.sizes);
|
|
6778
6917
|
return [
|
|
6779
6918
|
{
|
|
@@ -6786,17 +6925,17 @@ function ii(e) {
|
|
|
6786
6925
|
{
|
|
6787
6926
|
name: 'images',
|
|
6788
6927
|
type: 'string[]',
|
|
6789
|
-
description: `image_to_image: up to ${e.maxEditImages} images to edit, ${
|
|
6928
|
+
description: `image_to_image: up to ${e.maxEditImages} images to edit, ${L}`,
|
|
6790
6929
|
},
|
|
6791
6930
|
];
|
|
6792
6931
|
}
|
|
6793
|
-
function
|
|
6932
|
+
function xi() {
|
|
6794
6933
|
return [
|
|
6795
6934
|
{
|
|
6796
6935
|
name: 'voice_id',
|
|
6797
6936
|
type: 'string',
|
|
6798
|
-
default:
|
|
6799
|
-
description: `text_to_speech: the ElevenLabs voice id, one of: ${
|
|
6937
|
+
default: Nt,
|
|
6938
|
+
description: `text_to_speech: the ElevenLabs voice id, one of: ${wi}.`,
|
|
6800
6939
|
},
|
|
6801
6940
|
{
|
|
6802
6941
|
name: 'turns',
|
|
@@ -6804,7 +6943,7 @@ function ni() {
|
|
|
6804
6943
|
description:
|
|
6805
6944
|
'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
6945
|
},
|
|
6807
|
-
{ name: 'output_format', type: 'select', default:
|
|
6946
|
+
{ name: 'output_format', type: 'select', default: Ne[0], options: [...Ne] },
|
|
6808
6947
|
{ name: 'stability', type: 'number', min: 0, max: 1, description: 'Voice stability, 0 to 1.' },
|
|
6809
6948
|
{
|
|
6810
6949
|
name: 'similarity_boost',
|
|
@@ -6815,9 +6954,9 @@ function ni() {
|
|
|
6815
6954
|
},
|
|
6816
6955
|
];
|
|
6817
6956
|
}
|
|
6818
|
-
function
|
|
6957
|
+
function Bt(e) {
|
|
6819
6958
|
let t = e.promptOptionalModes?.length ? ` Optional on ${e.promptOptionalModes.join(', ')}.` : '',
|
|
6820
|
-
|
|
6959
|
+
a = [
|
|
6821
6960
|
{
|
|
6822
6961
|
name: 'prompt',
|
|
6823
6962
|
type: 'string',
|
|
@@ -6828,28 +6967,28 @@ function Lt(e) {
|
|
|
6828
6967
|
name: 'mode',
|
|
6829
6968
|
type: 'select',
|
|
6830
6969
|
required: !0,
|
|
6831
|
-
default: e.modes[0],
|
|
6970
|
+
...(e.modeRequired ? {} : { default: e.modes[0] }),
|
|
6832
6971
|
options: [...e.modes],
|
|
6833
|
-
description: e.modes.map((i) =>
|
|
6972
|
+
description: `${e.modeRequired ? 'Required. ' : ''}${e.modes.map((i) => hi[i]).join(' ')}`,
|
|
6834
6973
|
},
|
|
6835
6974
|
];
|
|
6836
6975
|
return (
|
|
6837
|
-
e.kind === 'video' ?
|
|
6838
|
-
e.modes.includes('motion_control') &&
|
|
6976
|
+
e.kind === 'video' ? a.push(...bi(e)) : e.kind === 'image' ? a.push(...ki(e)) : a.push(...xi()),
|
|
6977
|
+
e.modes.includes('motion_control') && a.push(...yi()),
|
|
6839
6978
|
e.seed &&
|
|
6840
|
-
|
|
6841
|
-
|
|
6979
|
+
a.push({ name: 'seed', type: 'number', min: 0, description: 'Seed for repeatable runs.' }),
|
|
6980
|
+
a
|
|
6842
6981
|
);
|
|
6843
6982
|
}
|
|
6844
|
-
var
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6983
|
+
var L,
|
|
6984
|
+
hi,
|
|
6985
|
+
wi,
|
|
6986
|
+
jt = h(() => {
|
|
6848
6987
|
'use strict';
|
|
6849
|
-
|
|
6850
|
-
((
|
|
6988
|
+
Ue();
|
|
6989
|
+
((L =
|
|
6851
6990
|
'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
|
-
(
|
|
6991
|
+
(hi = {
|
|
6853
6992
|
text_to_video: 'text_to_video: from the prompt alone.',
|
|
6854
6993
|
image_to_video: 'image_to_video: a start image in first_frame_image.',
|
|
6855
6994
|
first_n_last_frames: 'first_n_last_frames: first_frame_image and last_frame_image.',
|
|
@@ -6861,34 +7000,34 @@ var O,
|
|
|
6861
7000
|
motion_control:
|
|
6862
7001
|
'motion_control: the character in image_url performs the motion of video_url; length and frame follow the video.',
|
|
6863
7002
|
}));
|
|
6864
|
-
|
|
7003
|
+
wi = Object.entries(Ve)
|
|
6865
7004
|
.map(([e, t]) => `${e} (${t})`)
|
|
6866
7005
|
.join(', ');
|
|
6867
7006
|
});
|
|
6868
|
-
var
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
7007
|
+
var he,
|
|
7008
|
+
Gt,
|
|
7009
|
+
Y,
|
|
7010
|
+
Ht,
|
|
7011
|
+
Pn,
|
|
7012
|
+
In,
|
|
7013
|
+
vn,
|
|
7014
|
+
Tn,
|
|
7015
|
+
zt = h(() => {
|
|
6877
7016
|
'use strict';
|
|
6878
|
-
((
|
|
6879
|
-
(
|
|
6880
|
-
(
|
|
6881
|
-
(
|
|
6882
|
-
(
|
|
6883
|
-
(
|
|
6884
|
-
(
|
|
6885
|
-
(
|
|
7017
|
+
((he = 'enhancor-ultrafine'),
|
|
7018
|
+
(Gt = 'Enhancor Ultrafine'),
|
|
7019
|
+
(Y = { skin: [2, 3, 4], noSkin: [2, 3, 4, 8, 16] }),
|
|
7020
|
+
(Ht = 2),
|
|
7021
|
+
(Pn = 24 * 1024 * 1024),
|
|
7022
|
+
(In = 4096 * 4096),
|
|
7023
|
+
(vn = 30 * 6e4),
|
|
7024
|
+
(Tn = 120 * 6e4));
|
|
6886
7025
|
});
|
|
6887
|
-
var
|
|
6888
|
-
|
|
6889
|
-
|
|
7026
|
+
var X,
|
|
7027
|
+
ye,
|
|
7028
|
+
Fe = h(() => {
|
|
6890
7029
|
'use strict';
|
|
6891
|
-
((
|
|
7030
|
+
((X = [
|
|
6892
7031
|
'seedance-2-5',
|
|
6893
7032
|
'seedance-2-5-flash',
|
|
6894
7033
|
'seedance-2',
|
|
@@ -6897,84 +7036,85 @@ var W,
|
|
|
6897
7036
|
'seedream-5-5',
|
|
6898
7037
|
'wan-3-0',
|
|
6899
7038
|
'z-image-pro',
|
|
7039
|
+
'wan-2-5-image',
|
|
6900
7040
|
'doppel',
|
|
6901
7041
|
]),
|
|
6902
|
-
(
|
|
7042
|
+
(ye =
|
|
6903
7043
|
'a request with creative_mode: true answers 503 checkpoint_unavailable and nothing is charged'));
|
|
6904
7044
|
});
|
|
6905
|
-
function
|
|
7045
|
+
function Q(e) {
|
|
6906
7046
|
return `$${Number(e.toFixed(5))}`;
|
|
6907
7047
|
}
|
|
6908
|
-
function
|
|
7048
|
+
function Ii(e) {
|
|
6909
7049
|
if (e.kind === 'llm') {
|
|
6910
7050
|
let t = e.defaultEndpoint,
|
|
6911
|
-
|
|
7051
|
+
a = (s) =>
|
|
6912
7052
|
e.variants.find(
|
|
6913
7053
|
(o) =>
|
|
6914
7054
|
o.component === s &&
|
|
6915
7055
|
(!t || !o.endpoint || o.endpoint === t) &&
|
|
6916
7056
|
(!o.context || o.context === '0\u201332K'),
|
|
6917
7057
|
),
|
|
6918
|
-
i =
|
|
6919
|
-
n =
|
|
7058
|
+
i = a('input'),
|
|
7059
|
+
n = a('output');
|
|
6920
7060
|
return i && n
|
|
6921
|
-
? `${
|
|
6922
|
-
: `from ${
|
|
7061
|
+
? `${Q(i.price.starter)}/M in \xB7 ${Q(n.price.starter)}/M out`
|
|
7062
|
+
: `from ${Q(me(e).price.starter)}/M tokens`;
|
|
6923
7063
|
}
|
|
6924
|
-
return `from ${
|
|
7064
|
+
return `from ${Q(me(e).price.starter)}${e.unit}`;
|
|
6925
7065
|
}
|
|
6926
|
-
function
|
|
6927
|
-
let
|
|
6928
|
-
return
|
|
7066
|
+
function vi(e, t) {
|
|
7067
|
+
let a = t.filter((i) => Number.isFinite(i) && i > 0);
|
|
7068
|
+
return a.length ? `from ${Q(Math.min(...a))}${e}` : null;
|
|
6929
7069
|
}
|
|
6930
|
-
function
|
|
6931
|
-
for (let t of
|
|
6932
|
-
let
|
|
6933
|
-
i =
|
|
6934
|
-
|
|
7070
|
+
function Qt(e) {
|
|
7071
|
+
for (let t of J) {
|
|
7072
|
+
let a = ke[t],
|
|
7073
|
+
i = a ? vi(a.unit, e[t] ?? []) : null;
|
|
7074
|
+
a && i && (a.priceFormatted = i);
|
|
6935
7075
|
}
|
|
6936
7076
|
}
|
|
6937
|
-
function
|
|
6938
|
-
let
|
|
7077
|
+
function A(e, t) {
|
|
7078
|
+
let a = e.axes?.resolution ?? [
|
|
6939
7079
|
...new Set(e.variants.map((i) => i.resolution).filter((i) => !!i)),
|
|
6940
7080
|
];
|
|
6941
7081
|
return {
|
|
6942
7082
|
name: 'resolution',
|
|
6943
7083
|
type: 'select',
|
|
6944
|
-
default:
|
|
6945
|
-
options:
|
|
7084
|
+
default: me(e).resolution ?? a[0],
|
|
7085
|
+
options: a,
|
|
6946
7086
|
...(t ? { description: t } : {}),
|
|
6947
7087
|
};
|
|
6948
7088
|
}
|
|
6949
|
-
function
|
|
7089
|
+
function Zt(e) {
|
|
6950
7090
|
if (!e.endpoints?.length) return null;
|
|
6951
|
-
let t = e.endpoints.filter((
|
|
7091
|
+
let t = e.endpoints.filter((a) => Kt(e.slug, a.id));
|
|
6952
7092
|
return {
|
|
6953
7093
|
name: 'endpoint',
|
|
6954
7094
|
type: 'select',
|
|
6955
|
-
default:
|
|
6956
|
-
options: e.endpoints.filter((
|
|
7095
|
+
default: Oe(e),
|
|
7096
|
+
options: e.endpoints.filter((a) => !t.includes(a)).map((a) => a.id),
|
|
6957
7097
|
description:
|
|
6958
7098
|
(e.slug === 'gemini-3.1-pro-preview'
|
|
6959
7099
|
? 'Where the request is served; a missing endpoint is the default, the lowest price, and an unknown one is refused.'
|
|
6960
7100
|
: 'Where the request is served; a missing or unknown endpoint is the default, the lowest price.') +
|
|
6961
|
-
(t.length ? ` ${t.map((
|
|
7101
|
+
(t.length ? ` ${t.map((a) => a.label).join(' and ')}: coming soon.` : ''),
|
|
6962
7102
|
};
|
|
6963
7103
|
}
|
|
6964
|
-
function
|
|
7104
|
+
function Mi(e, t) {
|
|
6965
7105
|
if (e.unfiltered == null || t.some((i) => i.name === 'creative_mode')) return t;
|
|
6966
|
-
let
|
|
6967
|
-
return [...t.filter((i) => !
|
|
7106
|
+
let a = X.includes(e.api.model);
|
|
7107
|
+
return [...t.filter((i) => !be.has(i.name)), a ? Je : Ti];
|
|
6968
7108
|
}
|
|
6969
|
-
function
|
|
6970
|
-
let
|
|
6971
|
-
i = [
|
|
6972
|
-
return (i.push(
|
|
7109
|
+
function Be(e, t) {
|
|
7110
|
+
let a = e.filter((n) => !be.has(n.name)),
|
|
7111
|
+
i = [Je, ea];
|
|
7112
|
+
return (i.push(We, Ye), [...a, ...i]);
|
|
6973
7113
|
}
|
|
6974
|
-
function
|
|
7114
|
+
function Ei(e) {
|
|
6975
7115
|
return [
|
|
6976
7116
|
...e
|
|
6977
|
-
.filter((t) => !
|
|
7117
|
+
.filter((t) => !Si.has(t.name) && !be.has(t.name))
|
|
6978
7118
|
.map((t) => {
|
|
6979
7119
|
if (t.name === 'resolution')
|
|
6980
7120
|
return {
|
|
@@ -6986,42 +7126,42 @@ function gi(e) {
|
|
|
6986
7126
|
),
|
|
6987
7127
|
}
|
|
6988
7128
|
: {}),
|
|
6989
|
-
description: `Output resolution: 480p or 720p (8-bit). This tier has no 1080p or 4k. ${
|
|
7129
|
+
description: `Output resolution: 480p or 720p (8-bit). This tier has no 1080p or 4k. ${Z}`,
|
|
6990
7130
|
};
|
|
6991
|
-
let
|
|
6992
|
-
return
|
|
6993
|
-
? { ...t, description: t.description.replace(/\(up to [^)]*\)/, `(${
|
|
7131
|
+
let a = Ci[t.name];
|
|
7132
|
+
return a && typeof t.description == 'string'
|
|
7133
|
+
? { ...t, description: t.description.replace(/\(up to [^)]*\)/, `(${a})`) }
|
|
6994
7134
|
: t;
|
|
6995
7135
|
}),
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7136
|
+
Je,
|
|
7137
|
+
ea,
|
|
7138
|
+
We,
|
|
7139
|
+
Ye,
|
|
7000
7140
|
];
|
|
7001
7141
|
}
|
|
7002
|
-
function
|
|
7142
|
+
function ta(e) {
|
|
7003
7143
|
return (
|
|
7004
7144
|
e.startsWith('seedance-2-5-') &&
|
|
7005
7145
|
e !== 'seedance-2-5-lite' &&
|
|
7006
7146
|
!/-(creative-mode|unfiltered|uncensored)$/.test(e)
|
|
7007
7147
|
);
|
|
7008
7148
|
}
|
|
7009
|
-
function
|
|
7149
|
+
function Jt(e, t = {}) {
|
|
7010
7150
|
return [
|
|
7011
7151
|
...e
|
|
7012
|
-
.filter((
|
|
7013
|
-
.map((
|
|
7014
|
-
|
|
7015
|
-
? { ...
|
|
7016
|
-
:
|
|
7152
|
+
.filter((a) => !Ki.has(a.name) && !be.has(a.name))
|
|
7153
|
+
.map((a) =>
|
|
7154
|
+
a.name === 'prompt'
|
|
7155
|
+
? { ...a, required: !0 }
|
|
7156
|
+
: a.name === 'resolution'
|
|
7017
7157
|
? {
|
|
7018
|
-
...
|
|
7019
|
-
...(t.no4k &&
|
|
7020
|
-
? { options:
|
|
7158
|
+
...a,
|
|
7159
|
+
...(t.no4k && a.options
|
|
7160
|
+
? { options: a.options.filter((i) => String(i).toLowerCase() !== '4k') }
|
|
7021
7161
|
: {}),
|
|
7022
|
-
description: `Output resolution. TEIN LITE is the lower-priced endpoint for getting started. Stability and reliability are not guaranteed. ${
|
|
7162
|
+
description: `Output resolution. TEIN LITE is the lower-priced endpoint for getting started. Stability and reliability are not guaranteed. ${Z}`,
|
|
7023
7163
|
}
|
|
7024
|
-
:
|
|
7164
|
+
: a,
|
|
7025
7165
|
),
|
|
7026
7166
|
{
|
|
7027
7167
|
name: 'bitrate_mode',
|
|
@@ -7030,13 +7170,13 @@ function Bt(e, t = {}) {
|
|
|
7030
7170
|
options: ['standard'],
|
|
7031
7171
|
description: 'LITE uses standard bitrate. High bitrate is on the standard endpoint.',
|
|
7032
7172
|
},
|
|
7033
|
-
|
|
7034
|
-
|
|
7173
|
+
We,
|
|
7174
|
+
Ye,
|
|
7035
7175
|
];
|
|
7036
7176
|
}
|
|
7037
|
-
function
|
|
7177
|
+
function je(e, t) {
|
|
7038
7178
|
return [
|
|
7039
|
-
|
|
7179
|
+
C('Text prompt describing the video.'),
|
|
7040
7180
|
{ name: 'mode', type: 'select', required: !0, default: t.modes[0], options: t.modes },
|
|
7041
7181
|
{
|
|
7042
7182
|
name: 'duration',
|
|
@@ -7046,27 +7186,27 @@ function Ue(e, t) {
|
|
|
7046
7186
|
max: t.maxSec,
|
|
7047
7187
|
description: `Video length in seconds (${t.minSec} to ${t.maxSec}).`,
|
|
7048
7188
|
},
|
|
7049
|
-
|
|
7189
|
+
A(e),
|
|
7050
7190
|
{ name: 'aspect_ratio', type: 'select', default: t.aspects[0], options: t.aspects },
|
|
7051
|
-
...t.references.map((
|
|
7052
|
-
|
|
7191
|
+
...t.references.map((a) =>
|
|
7192
|
+
a.endsWith('s')
|
|
7053
7193
|
? {
|
|
7054
|
-
name:
|
|
7194
|
+
name: a,
|
|
7055
7195
|
type: 'string[]',
|
|
7056
|
-
description: `${
|
|
7196
|
+
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
7197
|
}
|
|
7058
7198
|
: {
|
|
7059
|
-
name:
|
|
7199
|
+
name: a,
|
|
7060
7200
|
type: 'string',
|
|
7061
|
-
description: `${
|
|
7201
|
+
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
7202
|
},
|
|
7063
7203
|
),
|
|
7064
7204
|
];
|
|
7065
7205
|
}
|
|
7066
|
-
function
|
|
7067
|
-
let t =
|
|
7206
|
+
function $i(e) {
|
|
7207
|
+
let t = Zt(e);
|
|
7068
7208
|
return [
|
|
7069
|
-
|
|
7209
|
+
C('Image prompt text. Supports complex composition and text instructions.'),
|
|
7070
7210
|
...(t ? [t] : []),
|
|
7071
7211
|
{
|
|
7072
7212
|
name: 'quality',
|
|
@@ -7074,17 +7214,17 @@ function hi(e) {
|
|
|
7074
7214
|
default: 'low',
|
|
7075
7215
|
options: e.axes?.quality ?? ['low', 'medium', 'high'],
|
|
7076
7216
|
},
|
|
7077
|
-
|
|
7217
|
+
A(
|
|
7078
7218
|
e,
|
|
7079
7219
|
e.slug === 'gpt-image-2'
|
|
7080
|
-
? `1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count. ${
|
|
7220
|
+
? `1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count. ${yt}`
|
|
7081
7221
|
: '1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count.',
|
|
7082
7222
|
),
|
|
7083
7223
|
{
|
|
7084
7224
|
name: 'aspect_ratio',
|
|
7085
7225
|
type: 'select',
|
|
7086
7226
|
default: 'auto',
|
|
7087
|
-
options: [...
|
|
7227
|
+
options: [...ht],
|
|
7088
7228
|
description:
|
|
7089
7229
|
"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
7230
|
},
|
|
@@ -7131,16 +7271,16 @@ function hi(e) {
|
|
|
7131
7271
|
},
|
|
7132
7272
|
];
|
|
7133
7273
|
}
|
|
7134
|
-
function
|
|
7274
|
+
function Ai(e) {
|
|
7135
7275
|
return [
|
|
7136
|
-
|
|
7276
|
+
C('Image prompt text.'),
|
|
7137
7277
|
{
|
|
7138
7278
|
name: 'input_images',
|
|
7139
7279
|
type: 'string[]',
|
|
7140
7280
|
description: 'Images to edit or use as reference (up to 14).',
|
|
7141
7281
|
},
|
|
7142
|
-
{ name: 'aspect_ratio', type: 'select', default: '1:1', options: [...
|
|
7143
|
-
|
|
7282
|
+
{ name: 'aspect_ratio', type: 'select', default: '1:1', options: [...Ct(e.slug)] },
|
|
7283
|
+
A(e),
|
|
7144
7284
|
{
|
|
7145
7285
|
name: 'n',
|
|
7146
7286
|
type: 'slider',
|
|
@@ -7165,22 +7305,22 @@ function yi(e) {
|
|
|
7165
7305
|
},
|
|
7166
7306
|
];
|
|
7167
7307
|
}
|
|
7168
|
-
function
|
|
7169
|
-
let e =
|
|
7308
|
+
function Li() {
|
|
7309
|
+
let e = $t,
|
|
7170
7310
|
t = [];
|
|
7171
|
-
for (let
|
|
7172
|
-
e.includes(
|
|
7311
|
+
for (let a of Xe(!0))
|
|
7312
|
+
e.includes(a.name) &&
|
|
7173
7313
|
(t.push({
|
|
7174
|
-
...
|
|
7175
|
-
...(
|
|
7176
|
-
...(
|
|
7314
|
+
...a,
|
|
7315
|
+
...(a.name === 'max_tokens' ? { min: 64 } : {}),
|
|
7316
|
+
...(a.name === 'messages'
|
|
7177
7317
|
? {
|
|
7178
7318
|
description:
|
|
7179
7319
|
'Chat history: system, developer, user (text and image_url parts) and assistant turns; no tool turns.',
|
|
7180
7320
|
}
|
|
7181
7321
|
: {}),
|
|
7182
7322
|
}),
|
|
7183
|
-
|
|
7323
|
+
a.name === 'top_p' &&
|
|
7184
7324
|
t.push({
|
|
7185
7325
|
name: 'top_k',
|
|
7186
7326
|
type: 'number',
|
|
@@ -7190,14 +7330,14 @@ function xi() {
|
|
|
7190
7330
|
}));
|
|
7191
7331
|
return t;
|
|
7192
7332
|
}
|
|
7193
|
-
function
|
|
7194
|
-
return
|
|
7333
|
+
function Di() {
|
|
7334
|
+
return Xe(!0).map((e) =>
|
|
7195
7335
|
e.name === 'max_tokens' || e.name === 'max_completion_tokens' ? { ...e, min: 128 } : e,
|
|
7196
7336
|
);
|
|
7197
7337
|
}
|
|
7198
|
-
function
|
|
7338
|
+
function Xe(e) {
|
|
7199
7339
|
return [
|
|
7200
|
-
|
|
7340
|
+
C('The user message or task.'),
|
|
7201
7341
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
7202
7342
|
{
|
|
7203
7343
|
name: 'messages',
|
|
@@ -7290,21 +7430,21 @@ function Je(e) {
|
|
|
7290
7430
|
},
|
|
7291
7431
|
];
|
|
7292
7432
|
}
|
|
7293
|
-
function
|
|
7294
|
-
if (e.slug === 'seed-2-1-turbo') return
|
|
7295
|
-
let t =
|
|
7433
|
+
function Vi(e) {
|
|
7434
|
+
if (e.slug === 'seed-2-1-turbo') return Oi;
|
|
7435
|
+
let t = Zt(e);
|
|
7296
7436
|
return [
|
|
7297
7437
|
...(e.slug === 'gemini-3.1-pro-preview'
|
|
7298
|
-
?
|
|
7438
|
+
? Li()
|
|
7299
7439
|
: e.slug === 'gemini-3.7-flash'
|
|
7300
|
-
?
|
|
7301
|
-
: e.slug === 'gpt-6-astra' ||
|
|
7302
|
-
?
|
|
7303
|
-
:
|
|
7440
|
+
? Di()
|
|
7441
|
+
: e.slug === 'gpt-6-astra' || Ri.includes(e.slug)
|
|
7442
|
+
? Xe(e.slug !== 'gpt-6-astra')
|
|
7443
|
+
: qi),
|
|
7304
7444
|
...(t ? [t] : []),
|
|
7305
7445
|
];
|
|
7306
7446
|
}
|
|
7307
|
-
function
|
|
7447
|
+
function Ge() {
|
|
7308
7448
|
return {
|
|
7309
7449
|
name: 'image',
|
|
7310
7450
|
type: 'string',
|
|
@@ -7312,7 +7452,7 @@ function Fe() {
|
|
|
7312
7452
|
description: 'The photo to fix: one JPEG or PNG URL.',
|
|
7313
7453
|
};
|
|
7314
7454
|
}
|
|
7315
|
-
function
|
|
7455
|
+
function Ui(e) {
|
|
7316
7456
|
return [
|
|
7317
7457
|
{
|
|
7318
7458
|
name: 'video_url',
|
|
@@ -7321,7 +7461,7 @@ function vi(e) {
|
|
|
7321
7461
|
description:
|
|
7322
7462
|
'The video to upscale (up to 30 seconds): a Tein upload link, or any public https link.',
|
|
7323
7463
|
},
|
|
7324
|
-
|
|
7464
|
+
A(
|
|
7325
7465
|
e,
|
|
7326
7466
|
'Size of the result: 1080p, 2k or 4k. A video already near a size cannot be upscaled to it.',
|
|
7327
7467
|
),
|
|
@@ -7334,7 +7474,7 @@ function vi(e) {
|
|
|
7334
7474
|
},
|
|
7335
7475
|
];
|
|
7336
7476
|
}
|
|
7337
|
-
function
|
|
7477
|
+
function Fi() {
|
|
7338
7478
|
return [
|
|
7339
7479
|
{
|
|
7340
7480
|
name: 'mode',
|
|
@@ -7405,35 +7545,35 @@ function Ti() {
|
|
|
7405
7545
|
},
|
|
7406
7546
|
];
|
|
7407
7547
|
}
|
|
7408
|
-
function
|
|
7548
|
+
function Bi(e) {
|
|
7409
7549
|
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 (
|
|
7550
|
+
if (e.family === 'tein-labs' && e.kind === 'image') return Fi();
|
|
7551
|
+
if (de.some((i) => i.slug === t)) return Ui(e);
|
|
7552
|
+
if (e.kind === 'llm') return Vi(e);
|
|
7553
|
+
if (e.editVariants?.length) return $i(e);
|
|
7554
|
+
let a = ge(t);
|
|
7555
|
+
if (a) return Bt(a);
|
|
7556
|
+
if (ta(t)) return Ei(He);
|
|
7417
7557
|
switch (t) {
|
|
7418
7558
|
case 'seedance-2-5':
|
|
7419
|
-
return
|
|
7559
|
+
return Be(He, t);
|
|
7420
7560
|
case 'seedance-2-5-lite':
|
|
7421
|
-
return
|
|
7561
|
+
return Jt(He, { no4k: !0 });
|
|
7422
7562
|
case 'seedance-2':
|
|
7423
|
-
return
|
|
7563
|
+
return Be(Wt, t);
|
|
7424
7564
|
case 'seedance-2-lite':
|
|
7425
|
-
return
|
|
7565
|
+
return Jt(Wt);
|
|
7426
7566
|
case 'seedance-2-mini':
|
|
7427
|
-
return
|
|
7567
|
+
return Be(ji, t);
|
|
7428
7568
|
case 'nano-banana-2':
|
|
7429
7569
|
case 'nano-banana-2.1':
|
|
7430
7570
|
case 'nano-banana-pro':
|
|
7431
|
-
return
|
|
7571
|
+
return Ai(e);
|
|
7432
7572
|
case 'seedream-5-pro':
|
|
7433
7573
|
return [
|
|
7434
|
-
|
|
7574
|
+
C('Detailed description of the image to generate.'),
|
|
7435
7575
|
{ name: 'images', type: 'string[]', description: 'Reference images (the first is free).' },
|
|
7436
|
-
|
|
7576
|
+
A(e),
|
|
7437
7577
|
{
|
|
7438
7578
|
name: 'aspect_ratio',
|
|
7439
7579
|
type: 'select',
|
|
@@ -7442,6 +7582,45 @@ function Mi(e) {
|
|
|
7442
7582
|
},
|
|
7443
7583
|
{ name: 'output_format', type: 'select', default: 'jpeg', options: ['jpeg', 'png'] },
|
|
7444
7584
|
];
|
|
7585
|
+
case 'minimax-h3-image':
|
|
7586
|
+
case 'minimax-h3-image-highspeed':
|
|
7587
|
+
return [
|
|
7588
|
+
C('What to make, or how to change the reference images.'),
|
|
7589
|
+
{
|
|
7590
|
+
name: 'images',
|
|
7591
|
+
type: 'string[]',
|
|
7592
|
+
description:
|
|
7593
|
+
'Reference images to edit or combine (up to 16). Leave empty for text to image. Each reference image is billed.',
|
|
7594
|
+
},
|
|
7595
|
+
{ ...A(e, '1K, 2K or 4K (about 16 megapixels).'), default: '2K' },
|
|
7596
|
+
{
|
|
7597
|
+
name: 'aspect_ratio',
|
|
7598
|
+
type: 'select',
|
|
7599
|
+
default: 'auto',
|
|
7600
|
+
options: [
|
|
7601
|
+
'auto',
|
|
7602
|
+
'1:1',
|
|
7603
|
+
'5:4',
|
|
7604
|
+
'4:5',
|
|
7605
|
+
'4:3',
|
|
7606
|
+
'3:4',
|
|
7607
|
+
'3:2',
|
|
7608
|
+
'2:3',
|
|
7609
|
+
'16:9',
|
|
7610
|
+
'9:16',
|
|
7611
|
+
'21:9',
|
|
7612
|
+
],
|
|
7613
|
+
description: 'auto lets the model pick the shape, or follows the first reference image.',
|
|
7614
|
+
},
|
|
7615
|
+
{ name: 'n', type: 'slider', default: 1, min: 1, max: 4, description: 'Images to make.' },
|
|
7616
|
+
{ name: 'output_format', type: 'select', default: 'jpeg', options: ['jpeg', 'png'] },
|
|
7617
|
+
{
|
|
7618
|
+
name: 'enhance_prompt',
|
|
7619
|
+
type: 'boolean',
|
|
7620
|
+
default: !0,
|
|
7621
|
+
description: 'Let the model expand the prompt before generating (recommended).',
|
|
7622
|
+
},
|
|
7623
|
+
];
|
|
7445
7624
|
case 'seedream-5-5':
|
|
7446
7625
|
return [
|
|
7447
7626
|
{
|
|
@@ -7452,7 +7631,7 @@ function Mi(e) {
|
|
|
7452
7631
|
description:
|
|
7453
7632
|
'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
7633
|
},
|
|
7455
|
-
|
|
7634
|
+
C(
|
|
7456
7635
|
'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
7636
|
),
|
|
7458
7637
|
{
|
|
@@ -7461,7 +7640,7 @@ function Mi(e) {
|
|
|
7461
7640
|
description:
|
|
7462
7641
|
'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
7642
|
},
|
|
7464
|
-
|
|
7643
|
+
A(
|
|
7465
7644
|
e,
|
|
7466
7645
|
'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
7646
|
),
|
|
@@ -7501,13 +7680,13 @@ function Mi(e) {
|
|
|
7501
7680
|
case 'qwen-3':
|
|
7502
7681
|
case 'qwen-3-pro':
|
|
7503
7682
|
return [
|
|
7504
|
-
|
|
7683
|
+
C('Image prompt text; dense layouts and multilingual text work well.'),
|
|
7505
7684
|
{
|
|
7506
7685
|
name: 'images',
|
|
7507
7686
|
type: 'string[]',
|
|
7508
7687
|
description: 'Up to 3 reference images, each billed at the published add-on price.',
|
|
7509
7688
|
},
|
|
7510
|
-
|
|
7689
|
+
A(e),
|
|
7511
7690
|
{
|
|
7512
7691
|
name: 'aspect_ratio',
|
|
7513
7692
|
type: 'select',
|
|
@@ -7525,8 +7704,8 @@ function Mi(e) {
|
|
|
7525
7704
|
];
|
|
7526
7705
|
case 'z-image-pro':
|
|
7527
7706
|
return [
|
|
7528
|
-
|
|
7529
|
-
|
|
7707
|
+
C('Image prompt text: subject, scene, style, composition and lighting.'),
|
|
7708
|
+
A(e, 'Long edge: 1K is 1024 px, 2K is 2048 px. Same price.'),
|
|
7530
7709
|
{
|
|
7531
7710
|
name: 'aspect_ratio',
|
|
7532
7711
|
type: 'select',
|
|
@@ -7555,6 +7734,50 @@ function Mi(e) {
|
|
|
7555
7734
|
description: 'Let the model expand and refine the prompt before generating.',
|
|
7556
7735
|
},
|
|
7557
7736
|
];
|
|
7737
|
+
case 'wan-2-5-image':
|
|
7738
|
+
return [
|
|
7739
|
+
C('Image prompt, or for an edit the change to make (up to 2000 characters).'),
|
|
7740
|
+
{
|
|
7741
|
+
name: 'images',
|
|
7742
|
+
type: 'string[]',
|
|
7743
|
+
description:
|
|
7744
|
+
'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.',
|
|
7745
|
+
},
|
|
7746
|
+
{
|
|
7747
|
+
name: 'aspect_ratio',
|
|
7748
|
+
type: 'select',
|
|
7749
|
+
default: '1:1',
|
|
7750
|
+
options: ['1:1', '16:9', '9:16', '4:3', '3:4', '3:2', '2:3', '21:9', '9:21', 'auto'],
|
|
7751
|
+
description:
|
|
7752
|
+
'Output shape, about 1.6 MP. auto (edits only, their default) follows the first input image.',
|
|
7753
|
+
},
|
|
7754
|
+
{
|
|
7755
|
+
name: 'n',
|
|
7756
|
+
type: 'slider',
|
|
7757
|
+
default: 1,
|
|
7758
|
+
min: 1,
|
|
7759
|
+
max: 4,
|
|
7760
|
+
description: 'Number of images (1-4). Each image is billed.',
|
|
7761
|
+
},
|
|
7762
|
+
{
|
|
7763
|
+
name: 'negative_prompt',
|
|
7764
|
+
type: 'string',
|
|
7765
|
+
description: 'What to keep out of the image (up to 500 characters).',
|
|
7766
|
+
},
|
|
7767
|
+
{
|
|
7768
|
+
name: 'seed',
|
|
7769
|
+
type: 'number',
|
|
7770
|
+
min: 0,
|
|
7771
|
+
max: 2147483647,
|
|
7772
|
+
description: 'Random seed. The same seed does not guarantee identical results.',
|
|
7773
|
+
},
|
|
7774
|
+
{
|
|
7775
|
+
name: 'prompt_expansion',
|
|
7776
|
+
type: 'boolean',
|
|
7777
|
+
default: !1,
|
|
7778
|
+
description: 'Let the model expand and refine the prompt before generating.',
|
|
7779
|
+
},
|
|
7780
|
+
];
|
|
7558
7781
|
case 'seed-audio-1-0':
|
|
7559
7782
|
return [
|
|
7560
7783
|
{
|
|
@@ -7579,7 +7802,7 @@ function Mi(e) {
|
|
|
7579
7802
|
];
|
|
7580
7803
|
case 'enhancor-skin-fix-v1':
|
|
7581
7804
|
return [
|
|
7582
|
-
|
|
7805
|
+
Ge(),
|
|
7583
7806
|
{
|
|
7584
7807
|
name: 'mode',
|
|
7585
7808
|
type: 'select',
|
|
@@ -7612,11 +7835,11 @@ function Mi(e) {
|
|
|
7612
7835
|
max: 0.4,
|
|
7613
7836
|
description: 'Portrait depth. Heavy only.',
|
|
7614
7837
|
},
|
|
7615
|
-
...
|
|
7838
|
+
...Ni,
|
|
7616
7839
|
];
|
|
7617
7840
|
case 'enhancor-skin-fix-v3':
|
|
7618
7841
|
return [
|
|
7619
|
-
|
|
7842
|
+
Ge(),
|
|
7620
7843
|
{
|
|
7621
7844
|
name: 'mask_image',
|
|
7622
7845
|
type: 'string',
|
|
@@ -7656,7 +7879,7 @@ function Mi(e) {
|
|
|
7656
7879
|
];
|
|
7657
7880
|
case 'enhancor-skin-fix-v4':
|
|
7658
7881
|
return [
|
|
7659
|
-
|
|
7882
|
+
Ge(),
|
|
7660
7883
|
{
|
|
7661
7884
|
name: 'mode',
|
|
7662
7885
|
type: 'select',
|
|
@@ -7687,7 +7910,7 @@ function Mi(e) {
|
|
|
7687
7910
|
];
|
|
7688
7911
|
case 'wan-3-0':
|
|
7689
7912
|
case 'wan-3-0-prime':
|
|
7690
|
-
return
|
|
7913
|
+
return je(e, {
|
|
7691
7914
|
modes: ['text_to_video', 'first_n_last_frames', 'multi_reference'],
|
|
7692
7915
|
aspects: ['16:9', '9:16', '4:3', '3:4', '1:1', 'adaptive'],
|
|
7693
7916
|
minSec: 2,
|
|
@@ -7697,7 +7920,7 @@ function Mi(e) {
|
|
|
7697
7920
|
});
|
|
7698
7921
|
case 'happy-horse-1-1':
|
|
7699
7922
|
case 'happy-horse-1-0':
|
|
7700
|
-
return
|
|
7923
|
+
return je(e, {
|
|
7701
7924
|
modes:
|
|
7702
7925
|
t === 'happy-horse-1-0'
|
|
7703
7926
|
? ['text-to-video', 'single-image', 'multi-reference', 'video-editing']
|
|
@@ -7708,7 +7931,7 @@ function Mi(e) {
|
|
|
7708
7931
|
references: t === 'happy-horse-1-0' ? ['images', 'videos'] : ['images'],
|
|
7709
7932
|
});
|
|
7710
7933
|
case 'minimax-h3':
|
|
7711
|
-
return
|
|
7934
|
+
return je(e, {
|
|
7712
7935
|
modes: ['text_to_video', 'first_n_last_frames', 'multi_reference'],
|
|
7713
7936
|
aspects: ['16:9', '21:9', '4:3', '1:1', '3:4', '9:16', 'adaptive'],
|
|
7714
7937
|
minSec: 4,
|
|
@@ -7716,13 +7939,13 @@ function Mi(e) {
|
|
|
7716
7939
|
references: ['images', 'videos', 'audios', 'first_frame_image', 'last_frame_image'],
|
|
7717
7940
|
});
|
|
7718
7941
|
default:
|
|
7719
|
-
return [
|
|
7942
|
+
return [C('Prompt text.')];
|
|
7720
7943
|
}
|
|
7721
7944
|
}
|
|
7722
|
-
function
|
|
7945
|
+
function Gi() {
|
|
7723
7946
|
return {
|
|
7724
|
-
slug:
|
|
7725
|
-
name:
|
|
7947
|
+
slug: he,
|
|
7948
|
+
name: Gt,
|
|
7726
7949
|
category: 'Image',
|
|
7727
7950
|
kind: 'Image-to-Image',
|
|
7728
7951
|
vendor: 'Enhancor',
|
|
@@ -7730,7 +7953,7 @@ function Si() {
|
|
|
7730
7953
|
'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
7954
|
priceFormatted: '',
|
|
7732
7955
|
unit: '/img',
|
|
7733
|
-
primaryToolName:
|
|
7956
|
+
primaryToolName: Xt.image,
|
|
7734
7957
|
parameters: [
|
|
7735
7958
|
{
|
|
7736
7959
|
name: 'image',
|
|
@@ -7756,189 +7979,189 @@ function Si() {
|
|
|
7756
7979
|
{
|
|
7757
7980
|
name: 'scale',
|
|
7758
7981
|
type: 'select',
|
|
7759
|
-
default: String(
|
|
7760
|
-
options:
|
|
7761
|
-
description: `Full only. ${
|
|
7982
|
+
default: String(Ht),
|
|
7983
|
+
options: Y.noSkin.map(String),
|
|
7984
|
+
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
7985
|
},
|
|
7763
7986
|
],
|
|
7764
7987
|
};
|
|
7765
7988
|
}
|
|
7766
|
-
function
|
|
7989
|
+
function ze(e, t = e.api.model) {
|
|
7767
7990
|
return {
|
|
7768
7991
|
slug: t,
|
|
7769
7992
|
name: e.name,
|
|
7770
|
-
category:
|
|
7771
|
-
kind: t.startsWith('enhancor-skin-fix-') ? 'Image-to-Image' :
|
|
7993
|
+
category: _i[e.kind],
|
|
7994
|
+
kind: t.startsWith('enhancor-skin-fix-') ? 'Image-to-Image' : Pi[e.kind],
|
|
7772
7995
|
vendor: e.vendor ?? '',
|
|
7773
7996
|
description: e.desc ?? e.name,
|
|
7774
|
-
priceFormatted:
|
|
7997
|
+
priceFormatted: Ii(e),
|
|
7775
7998
|
unit: e.unit,
|
|
7776
|
-
primaryToolName:
|
|
7777
|
-
parameters:
|
|
7999
|
+
primaryToolName: Xt[e.kind],
|
|
8000
|
+
parameters: Mi(e, Bi(e)),
|
|
7778
8001
|
};
|
|
7779
8002
|
}
|
|
7780
|
-
function
|
|
8003
|
+
function Hi() {
|
|
7781
8004
|
let e = {};
|
|
7782
|
-
for (let t of
|
|
8005
|
+
for (let t of ue())
|
|
7783
8006
|
if (t.slug !== 'seedance-2-fast') {
|
|
7784
8007
|
if (t.slug === 'seedance-2-mini') {
|
|
7785
|
-
e['seedance-2-mini'] =
|
|
8008
|
+
e['seedance-2-mini'] = ze(t, 'seedance-2-mini');
|
|
7786
8009
|
continue;
|
|
7787
8010
|
}
|
|
7788
8011
|
if (t.slug === 'seedance-2') {
|
|
7789
|
-
let
|
|
7790
|
-
((
|
|
7791
|
-
(e['seedance-2'] =
|
|
8012
|
+
let a = ze(t);
|
|
8013
|
+
((a.description = `${t.desc ?? t.name} Send quality fast or mini for Seedance 2.0 Fast or Mini.`),
|
|
8014
|
+
(e['seedance-2'] = a));
|
|
7792
8015
|
continue;
|
|
7793
8016
|
}
|
|
7794
|
-
t.slug.startsWith('claude-') || (e[t.api.model] =
|
|
8017
|
+
t.slug.startsWith('claude-') || (e[t.api.model] = ze(t));
|
|
7795
8018
|
}
|
|
7796
|
-
(Object.assign(e,
|
|
7797
|
-
for (let [t,
|
|
7798
|
-
e[
|
|
8019
|
+
(Object.assign(e, Lt()), (e[he] = Gi()));
|
|
8020
|
+
for (let [t, a] of Object.entries(fe))
|
|
8021
|
+
e[a] && Object.defineProperty(e, t, { value: e[a], enumerable: !1 });
|
|
7799
8022
|
return e;
|
|
7800
8023
|
}
|
|
7801
|
-
function
|
|
8024
|
+
function we(e) {
|
|
7802
8025
|
return !!e?.parameters.some((t) => t.name === 'image');
|
|
7803
8026
|
}
|
|
7804
|
-
function
|
|
7805
|
-
return
|
|
8027
|
+
function H(e) {
|
|
8028
|
+
return ke[e] ?? null;
|
|
7806
8029
|
}
|
|
7807
|
-
function
|
|
7808
|
-
if (e.startsWith('enhancor-skin-fix-') || e ===
|
|
7809
|
-
if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite' ||
|
|
8030
|
+
function zi(e, t, a) {
|
|
8031
|
+
if (e.startsWith('enhancor-skin-fix-') || e === he) return !1;
|
|
8032
|
+
if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite' || ta(e)) && t === 'duration') {
|
|
7810
8033
|
let n = (s) => (typeof s == 'string' ? s.trim().toLowerCase() : '');
|
|
7811
|
-
if (n(
|
|
8034
|
+
if (n(a.mode) === 'edit' || n(a.omni_reference_task_type) === 'edit') return !1;
|
|
7812
8035
|
}
|
|
7813
8036
|
if (
|
|
7814
|
-
(t === 'max_tokens' &&
|
|
7815
|
-
(t === 'max_completion_tokens' &&
|
|
8037
|
+
(t === 'max_tokens' && Yt(a.max_completion_tokens)) ||
|
|
8038
|
+
(t === 'max_completion_tokens' && Yt(a.max_tokens))
|
|
7816
8039
|
)
|
|
7817
8040
|
return !1;
|
|
7818
8041
|
if (t === 'aspect_ratio') {
|
|
7819
|
-
let n =
|
|
8042
|
+
let n = ge(e);
|
|
7820
8043
|
if (n) {
|
|
7821
|
-
let s = typeof
|
|
8044
|
+
let s = typeof a.mode == 'string' ? a.mode.trim().toLowerCase() : '',
|
|
7822
8045
|
o = s ? s.replace(/-/g, '_') : n.modes[0];
|
|
7823
|
-
if (n.modes.includes(o) && !
|
|
8046
|
+
if (n.modes.includes(o) && !Ut(n, o)) return !1;
|
|
7824
8047
|
}
|
|
7825
8048
|
}
|
|
7826
|
-
let i =
|
|
8049
|
+
let i = ge(e);
|
|
7827
8050
|
if (i) {
|
|
7828
|
-
let n = typeof
|
|
8051
|
+
let n = typeof a.mode == 'string' ? a.mode.trim().toLowerCase() : '',
|
|
7829
8052
|
s = n ? n.replace(/-/g, '_') : i.modes[0];
|
|
7830
|
-
if (i.modes.includes(s) && !
|
|
8053
|
+
if (i.modes.includes(s) && !Ft(i, s, t)) return !1;
|
|
7831
8054
|
}
|
|
7832
8055
|
return !0;
|
|
7833
8056
|
}
|
|
7834
|
-
function
|
|
8057
|
+
function Yt(e) {
|
|
7835
8058
|
return e != null && e !== '';
|
|
7836
8059
|
}
|
|
7837
|
-
function
|
|
7838
|
-
let
|
|
8060
|
+
function ra(e, t) {
|
|
8061
|
+
let a = { ...t };
|
|
7839
8062
|
if (e?.slug === 'seedance-2-5') {
|
|
7840
8063
|
let i = (n) => typeof n != 'string' || !n.trim();
|
|
7841
|
-
for (let n of
|
|
7842
|
-
if (!i(
|
|
8064
|
+
for (let n of Ji) (i(a.finalize) && !i(a[n]) && (a.finalize = a[n]), delete a[n]);
|
|
8065
|
+
if (!i(a.finalize)) return a;
|
|
7843
8066
|
}
|
|
7844
8067
|
for (let i of e?.parameters ?? [])
|
|
7845
8068
|
i.default !== void 0 &&
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
(
|
|
7849
|
-
return
|
|
8069
|
+
a[i.name] === void 0 &&
|
|
8070
|
+
zi(e.slug, i.name, t) &&
|
|
8071
|
+
(a[i.name] = i.default);
|
|
8072
|
+
return a;
|
|
7850
8073
|
}
|
|
7851
8074
|
function D() {
|
|
7852
|
-
return Object.values(
|
|
8075
|
+
return Object.values(ke);
|
|
7853
8076
|
}
|
|
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,
|
|
8077
|
+
var _i,
|
|
7873
8078
|
Xt,
|
|
7874
|
-
|
|
7875
|
-
|
|
8079
|
+
Pi,
|
|
8080
|
+
C,
|
|
8081
|
+
Je,
|
|
8082
|
+
Ti,
|
|
8083
|
+
ea,
|
|
8084
|
+
We,
|
|
8085
|
+
Ye,
|
|
8086
|
+
be,
|
|
7876
8087
|
Ki,
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
8088
|
+
Si,
|
|
8089
|
+
Ci,
|
|
8090
|
+
qi,
|
|
8091
|
+
Oi,
|
|
8092
|
+
Ri,
|
|
8093
|
+
Ni,
|
|
8094
|
+
Z,
|
|
8095
|
+
He,
|
|
8096
|
+
aa,
|
|
8097
|
+
ia,
|
|
8098
|
+
Wt,
|
|
8099
|
+
ji,
|
|
8100
|
+
ke,
|
|
8101
|
+
Ji,
|
|
8102
|
+
ee = h(() => {
|
|
7880
8103
|
'use strict';
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
Ae();
|
|
7887
|
-
It();
|
|
7888
|
-
Tt();
|
|
7889
|
-
Kt();
|
|
7890
|
-
qt();
|
|
8104
|
+
bt();
|
|
8105
|
+
Ce();
|
|
8106
|
+
G();
|
|
8107
|
+
Re();
|
|
8108
|
+
Ee();
|
|
7891
8109
|
Le();
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
(
|
|
7896
|
-
|
|
8110
|
+
St();
|
|
8111
|
+
Et();
|
|
8112
|
+
At();
|
|
8113
|
+
Dt();
|
|
8114
|
+
Ue();
|
|
8115
|
+
jt();
|
|
8116
|
+
zt();
|
|
8117
|
+
Fe();
|
|
8118
|
+
((_i = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
|
|
8119
|
+
(Xt = {
|
|
7897
8120
|
video: 'generate_video',
|
|
7898
8121
|
image: 'generate_image',
|
|
7899
8122
|
audio: 'generate_audio',
|
|
7900
8123
|
llm: 'run_task',
|
|
7901
8124
|
}),
|
|
7902
|
-
(
|
|
8125
|
+
(Pi = {
|
|
7903
8126
|
video: 'Text-to-Video',
|
|
7904
8127
|
image: 'Text-to-Image',
|
|
7905
8128
|
audio: 'Text-to-Audio',
|
|
7906
8129
|
llm: 'Reasoning (LLM)',
|
|
7907
8130
|
}));
|
|
7908
|
-
|
|
7909
|
-
((
|
|
8131
|
+
C = (e) => ({ name: 'prompt', type: 'string', required: !0, description: e });
|
|
8132
|
+
((Je = {
|
|
7910
8133
|
name: 'creative_mode',
|
|
7911
8134
|
type: 'boolean',
|
|
7912
8135
|
default: !1,
|
|
7913
8136
|
description:
|
|
7914
8137
|
'Runs the Creative mode checkpoint at its published price (+5%). The Acceptable Use Policy applies.',
|
|
7915
8138
|
}),
|
|
7916
|
-
(
|
|
8139
|
+
(Ti = {
|
|
7917
8140
|
name: 'creative_mode',
|
|
7918
8141
|
type: 'boolean',
|
|
7919
8142
|
default: !1,
|
|
7920
|
-
description: `Not available yet on this model: ${
|
|
8143
|
+
description: `Not available yet on this model: ${ye}.`,
|
|
7921
8144
|
}),
|
|
7922
|
-
(
|
|
8145
|
+
(ea = {
|
|
7923
8146
|
name: 'priority',
|
|
7924
8147
|
type: 'boolean',
|
|
7925
8148
|
default: !1,
|
|
7926
8149
|
description: 'Guaranteed speed and no queue, at the published Priority price (+6%).',
|
|
7927
8150
|
}),
|
|
7928
|
-
(
|
|
8151
|
+
(We = {
|
|
7929
8152
|
name: 'reference_roles',
|
|
7930
8153
|
type: 'json',
|
|
7931
8154
|
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
8155
|
}),
|
|
7933
|
-
(
|
|
8156
|
+
(Ye = {
|
|
7934
8157
|
name: 'auto_fit_images',
|
|
7935
8158
|
type: 'boolean',
|
|
7936
8159
|
default: !1,
|
|
7937
8160
|
description:
|
|
7938
8161
|
'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
8162
|
}),
|
|
7940
|
-
(
|
|
7941
|
-
((
|
|
8163
|
+
(be = new Set(['full_access', 'is_uncensored', 'unfiltered', 'verificationSignature'])));
|
|
8164
|
+
((Ki = new Set([
|
|
7942
8165
|
'quality',
|
|
7943
8166
|
'bitrate_mode',
|
|
7944
8167
|
'draft',
|
|
@@ -7947,7 +8170,7 @@ var si,
|
|
|
7947
8170
|
'draft_generation_id',
|
|
7948
8171
|
'pass_faces',
|
|
7949
8172
|
])),
|
|
7950
|
-
(
|
|
8173
|
+
(Si = new Set([
|
|
7951
8174
|
'quality',
|
|
7952
8175
|
'bitrate_mode',
|
|
7953
8176
|
'draft',
|
|
@@ -7955,13 +8178,13 @@ var si,
|
|
|
7955
8178
|
'draft_task_id',
|
|
7956
8179
|
'draft_generation_id',
|
|
7957
8180
|
])),
|
|
7958
|
-
(
|
|
8181
|
+
(Ci = {
|
|
7959
8182
|
images: 'up to 10',
|
|
7960
8183
|
videos: 'up to 5; combined duration < 30s',
|
|
7961
8184
|
audios: 'up to 5; combined duration < 30s',
|
|
7962
8185
|
}));
|
|
7963
|
-
((
|
|
7964
|
-
|
|
8186
|
+
((qi = [
|
|
8187
|
+
C('The user message or task.'),
|
|
7965
8188
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
7966
8189
|
{
|
|
7967
8190
|
name: 'messages',
|
|
@@ -7978,8 +8201,8 @@ var si,
|
|
|
7978
8201
|
{ name: 'temperature', type: 'slider', min: 0, max: 1, step: 0.1 },
|
|
7979
8202
|
{ name: 'top_p', type: 'slider', min: 0, max: 1, step: 0.05 },
|
|
7980
8203
|
]),
|
|
7981
|
-
(
|
|
7982
|
-
|
|
8204
|
+
(Oi = [
|
|
8205
|
+
C('The user message or task.'),
|
|
7983
8206
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
7984
8207
|
{
|
|
7985
8208
|
name: 'messages',
|
|
@@ -8060,8 +8283,8 @@ var si,
|
|
|
8060
8283
|
description: 'Video frames read a second.',
|
|
8061
8284
|
},
|
|
8062
8285
|
]),
|
|
8063
|
-
(
|
|
8064
|
-
|
|
8286
|
+
(Ri = ['gemini-3.8-flash', 'gemini-3.7-flash']));
|
|
8287
|
+
Ni = Object.entries({
|
|
8065
8288
|
background: !1,
|
|
8066
8289
|
skin: !1,
|
|
8067
8290
|
nose: !1,
|
|
@@ -8087,8 +8310,8 @@ var si,
|
|
|
8087
8310
|
default: t,
|
|
8088
8311
|
description: 'Keep this part out of the fix. Standard only.',
|
|
8089
8312
|
}));
|
|
8090
|
-
((
|
|
8091
|
-
(
|
|
8313
|
+
((Z = 'Left out: 480p, the same default as the API, the playground and workflow steps.'),
|
|
8314
|
+
(He = [
|
|
8092
8315
|
{
|
|
8093
8316
|
name: 'prompt',
|
|
8094
8317
|
type: 'string',
|
|
@@ -8126,7 +8349,7 @@ var si,
|
|
|
8126
8349
|
type: 'select',
|
|
8127
8350
|
default: '480p',
|
|
8128
8351
|
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. ${
|
|
8352
|
+
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
8353
|
},
|
|
8131
8354
|
{
|
|
8132
8355
|
name: 'aspect_ratio',
|
|
@@ -8237,19 +8460,19 @@ var si,
|
|
|
8237
8460
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
8238
8461
|
},
|
|
8239
8462
|
]),
|
|
8240
|
-
(
|
|
8463
|
+
(aa = {
|
|
8241
8464
|
name: 'images',
|
|
8242
8465
|
type: 'string[]',
|
|
8243
8466
|
description:
|
|
8244
8467
|
'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
8468
|
}),
|
|
8246
|
-
(
|
|
8469
|
+
(ia = {
|
|
8247
8470
|
name: 'audios',
|
|
8248
8471
|
type: 'string[]',
|
|
8249
8472
|
description:
|
|
8250
8473
|
'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
8474
|
}),
|
|
8252
|
-
(
|
|
8475
|
+
(Wt = [
|
|
8253
8476
|
{
|
|
8254
8477
|
name: 'prompt',
|
|
8255
8478
|
type: 'string',
|
|
@@ -8293,7 +8516,7 @@ var si,
|
|
|
8293
8516
|
type: 'select',
|
|
8294
8517
|
default: '480p',
|
|
8295
8518
|
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. ${
|
|
8519
|
+
description: `Standard: 480p, 720p, 1080p (8-bit) and 4k (10-bit H.265). Fast and Mini: 480p and 720p only. ${Z}`,
|
|
8297
8520
|
},
|
|
8298
8521
|
{
|
|
8299
8522
|
name: 'bitrate_mode',
|
|
@@ -8327,8 +8550,8 @@ var si,
|
|
|
8327
8550
|
description:
|
|
8328
8551
|
'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
|
|
8329
8552
|
},
|
|
8330
|
-
|
|
8331
|
-
|
|
8553
|
+
aa,
|
|
8554
|
+
ia,
|
|
8332
8555
|
{
|
|
8333
8556
|
name: 'first_frame_image',
|
|
8334
8557
|
type: 'string',
|
|
@@ -8349,7 +8572,7 @@ var si,
|
|
|
8349
8572
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
8350
8573
|
},
|
|
8351
8574
|
]),
|
|
8352
|
-
(
|
|
8575
|
+
(ji = [
|
|
8353
8576
|
{
|
|
8354
8577
|
name: 'prompt',
|
|
8355
8578
|
type: 'string',
|
|
@@ -8370,7 +8593,7 @@ var si,
|
|
|
8370
8593
|
type: 'select',
|
|
8371
8594
|
default: '480p',
|
|
8372
8595
|
options: ['480p', '720p'],
|
|
8373
|
-
description: `480p and 720p, both 8-bit. Mini does not serve 1080p or 4k. ${
|
|
8596
|
+
description: `480p and 720p, both 8-bit. Mini does not serve 1080p or 4k. ${Z}`,
|
|
8374
8597
|
},
|
|
8375
8598
|
{
|
|
8376
8599
|
name: 'bitrate_mode',
|
|
@@ -8404,8 +8627,8 @@ var si,
|
|
|
8404
8627
|
description:
|
|
8405
8628
|
'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
|
|
8406
8629
|
},
|
|
8407
|
-
|
|
8408
|
-
|
|
8630
|
+
aa,
|
|
8631
|
+
ia,
|
|
8409
8632
|
{
|
|
8410
8633
|
name: 'first_frame_image',
|
|
8411
8634
|
type: 'string',
|
|
@@ -8420,53 +8643,53 @@ var si,
|
|
|
8420
8643
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
8421
8644
|
},
|
|
8422
8645
|
]));
|
|
8423
|
-
|
|
8424
|
-
|
|
8646
|
+
ke = Hi();
|
|
8647
|
+
Ji = ['draft_task_id', 'draft_generation_id'];
|
|
8425
8648
|
});
|
|
8426
|
-
function
|
|
8649
|
+
function xe(e) {
|
|
8427
8650
|
let t = '/v1/pricing/models',
|
|
8428
|
-
|
|
8429
|
-
return
|
|
8651
|
+
a = e?.trim();
|
|
8652
|
+
return a ? `${t}?model=${encodeURIComponent(a)}` : t;
|
|
8430
8653
|
}
|
|
8431
|
-
var
|
|
8654
|
+
var et = h(() => {
|
|
8432
8655
|
'use strict';
|
|
8433
8656
|
});
|
|
8434
|
-
function
|
|
8657
|
+
function _a(e) {
|
|
8435
8658
|
return e.length <= 1 ? (e[0] ?? '') : `${e.slice(0, -1).join(', ')} and ${e[e.length - 1]}`;
|
|
8436
8659
|
}
|
|
8437
|
-
function
|
|
8438
|
-
let t =
|
|
8439
|
-
|
|
8440
|
-
i = t.filter((s) => !
|
|
8660
|
+
function Pa(e) {
|
|
8661
|
+
let t = ue().filter((s) => s.kind === e && s.unfiltered != null),
|
|
8662
|
+
a = t.filter((s) => X.includes(s.api.model)).map((s) => s.name),
|
|
8663
|
+
i = t.filter((s) => !X.includes(s.api.model)).map((s) => s.name);
|
|
8441
8664
|
return [
|
|
8442
|
-
...(
|
|
8443
|
-
? [`${
|
|
8665
|
+
...(a.length
|
|
8666
|
+
? [`${_a(a)}: runs the Creative mode checkpoint at its published price (+5%).`]
|
|
8444
8667
|
: []),
|
|
8445
|
-
...(i.length ? [`Not available yet on ${
|
|
8668
|
+
...(i.length ? [`Not available yet on ${_a(i)}: ${ye}.`] : []),
|
|
8446
8669
|
'The Acceptable Use Policy applies.',
|
|
8447
8670
|
].join(' ');
|
|
8448
8671
|
}
|
|
8449
|
-
function
|
|
8450
|
-
if (
|
|
8672
|
+
function Ir(e) {
|
|
8673
|
+
if (kr.has(e.name)) return e;
|
|
8451
8674
|
let t = e.inputSchema.properties;
|
|
8452
8675
|
return !t || t.callback_url
|
|
8453
8676
|
? e
|
|
8454
|
-
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url:
|
|
8677
|
+
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url: br } } };
|
|
8455
8678
|
}
|
|
8456
|
-
function
|
|
8679
|
+
function vr(e) {
|
|
8457
8680
|
let t = e.inputSchema.properties;
|
|
8458
8681
|
if (!t) return e;
|
|
8459
|
-
let
|
|
8682
|
+
let a = !1,
|
|
8460
8683
|
i = {};
|
|
8461
8684
|
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' } }), (
|
|
8685
|
+
Ia.has(n) && s.type === 'string' && !s.format
|
|
8686
|
+
? ((i[n] = { ...s, format: 'uri' }), (a = !0))
|
|
8687
|
+
: Ia.has(n) && s.type === 'array' && s.items?.type === 'string' && !s.items.format
|
|
8688
|
+
? ((i[n] = { ...s, items: { ...s.items, format: 'uri' } }), (a = !0))
|
|
8466
8689
|
: (i[n] = s);
|
|
8467
|
-
return
|
|
8690
|
+
return a ? { ...e, inputSchema: { ...e.inputSchema, properties: i } } : e;
|
|
8468
8691
|
}
|
|
8469
|
-
function
|
|
8692
|
+
function Tr(e) {
|
|
8470
8693
|
switch (e.type) {
|
|
8471
8694
|
case 'string':
|
|
8472
8695
|
return {
|
|
@@ -8521,11 +8744,11 @@ function aa(e) {
|
|
|
8521
8744
|
return { type: 'string', description: e.description };
|
|
8522
8745
|
}
|
|
8523
8746
|
}
|
|
8524
|
-
function
|
|
8525
|
-
let
|
|
8747
|
+
function Mr(e, t) {
|
|
8748
|
+
let a = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
|
|
8526
8749
|
i = {},
|
|
8527
8750
|
n = [];
|
|
8528
|
-
for (let o of e.parameters) ((i[o.name] =
|
|
8751
|
+
for (let o of e.parameters) ((i[o.name] = Tr(o)), o.required && n.push(o.name));
|
|
8529
8752
|
let s = {
|
|
8530
8753
|
type: 'object',
|
|
8531
8754
|
properties: i,
|
|
@@ -8533,20 +8756,20 @@ function na(e, t) {
|
|
|
8533
8756
|
additionalProperties: !0,
|
|
8534
8757
|
};
|
|
8535
8758
|
return {
|
|
8536
|
-
name:
|
|
8759
|
+
name: a,
|
|
8537
8760
|
description: `[Tein AI - ${e.name} (${e.category})] ${e.description} (Pricing: ${e.priceFormatted})`,
|
|
8538
8761
|
inputSchema: s,
|
|
8539
8762
|
};
|
|
8540
8763
|
}
|
|
8541
|
-
function
|
|
8542
|
-
let e = D().filter((d) => d.category === 'Image' && !
|
|
8764
|
+
function Kr() {
|
|
8765
|
+
let e = D().filter((d) => d.category === 'Image' && !we(d)),
|
|
8543
8766
|
t = D().filter((d) => d.category === 'Video'),
|
|
8544
|
-
|
|
8767
|
+
a = D().filter((d) => d.category === 'Text'),
|
|
8545
8768
|
i = D().filter((d) => d.category === 'Audio'),
|
|
8546
8769
|
n = {
|
|
8547
8770
|
name: 'generate_image',
|
|
8548
8771
|
description:
|
|
8549
|
-
'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). Billed per image at the published price.',
|
|
8772
|
+
'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.',
|
|
8550
8773
|
inputSchema: {
|
|
8551
8774
|
type: 'object',
|
|
8552
8775
|
properties: {
|
|
@@ -8634,7 +8857,7 @@ function sa() {
|
|
|
8634
8857
|
maximum: 2147483647,
|
|
8635
8858
|
description: 'Nano Banana 2 and Nano Banana Pro. Omit it for a new image each time.',
|
|
8636
8859
|
},
|
|
8637
|
-
creative_mode: { type: 'boolean', default: !1, description:
|
|
8860
|
+
creative_mode: { type: 'boolean', default: !1, description: Pa('image') },
|
|
8638
8861
|
},
|
|
8639
8862
|
required: ['prompt'],
|
|
8640
8863
|
additionalProperties: !0,
|
|
@@ -8671,7 +8894,7 @@ function sa() {
|
|
|
8671
8894
|
default: '480p',
|
|
8672
8895
|
description: 'Video resolution (the lowest price is the default; see each model tool).',
|
|
8673
8896
|
},
|
|
8674
|
-
creative_mode: { type: 'boolean', default: !1, description:
|
|
8897
|
+
creative_mode: { type: 'boolean', default: !1, description: Pa('video') },
|
|
8675
8898
|
priority: {
|
|
8676
8899
|
type: 'boolean',
|
|
8677
8900
|
default: !1,
|
|
@@ -8739,7 +8962,7 @@ function sa() {
|
|
|
8739
8962
|
prompt: { type: 'string', description: 'The reasoning task or query to execute.' },
|
|
8740
8963
|
model: {
|
|
8741
8964
|
type: 'string',
|
|
8742
|
-
enum:
|
|
8965
|
+
enum: a.map((d) => d.slug),
|
|
8743
8966
|
default: 'gpt-6-astra',
|
|
8744
8967
|
description: 'The reasoning model to use (default: gpt-6-astra).',
|
|
8745
8968
|
},
|
|
@@ -8809,10 +9032,10 @@ function sa() {
|
|
|
8809
9032
|
additionalProperties: !0,
|
|
8810
9033
|
},
|
|
8811
9034
|
},
|
|
8812
|
-
p =
|
|
8813
|
-
return [n, s, o, u, l, p, c,
|
|
9035
|
+
p = Sr();
|
|
9036
|
+
return [n, s, o, u, l, p, c, wr, ...va];
|
|
8814
9037
|
}
|
|
8815
|
-
function
|
|
9038
|
+
function Sr() {
|
|
8816
9039
|
return {
|
|
8817
9040
|
name: 'upload_asset',
|
|
8818
9041
|
description:
|
|
@@ -8859,34 +9082,42 @@ function oa() {
|
|
|
8859
9082
|
},
|
|
8860
9083
|
};
|
|
8861
9084
|
}
|
|
8862
|
-
function
|
|
8863
|
-
let e =
|
|
8864
|
-
t = D().map((
|
|
8865
|
-
return [...e, ...t].map(
|
|
9085
|
+
function st() {
|
|
9086
|
+
let e = Kr(),
|
|
9087
|
+
t = D().map((a) => Mr(a));
|
|
9088
|
+
return [...e, ...t].map(Ir).map(vr);
|
|
8866
9089
|
}
|
|
8867
|
-
var
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
|
|
9090
|
+
var br,
|
|
9091
|
+
kr,
|
|
9092
|
+
wr,
|
|
9093
|
+
xr,
|
|
9094
|
+
_r,
|
|
9095
|
+
Pr,
|
|
9096
|
+
va,
|
|
9097
|
+
Cs,
|
|
9098
|
+
Ia,
|
|
9099
|
+
Ta = h(() => {
|
|
8872
9100
|
'use strict';
|
|
8873
|
-
|
|
8874
|
-
|
|
8875
|
-
|
|
8876
|
-
((
|
|
9101
|
+
G();
|
|
9102
|
+
Fe();
|
|
9103
|
+
ee();
|
|
9104
|
+
((br = {
|
|
8877
9105
|
type: 'string',
|
|
8878
9106
|
description:
|
|
8879
9107
|
'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
9108
|
}),
|
|
8881
|
-
(
|
|
9109
|
+
(kr = new Set([
|
|
8882
9110
|
'upload_asset',
|
|
8883
9111
|
'upload_media',
|
|
8884
9112
|
'upload_image',
|
|
8885
9113
|
'get_generation_status',
|
|
8886
9114
|
'check_status',
|
|
8887
9115
|
'get_pricing',
|
|
9116
|
+
'get_balance',
|
|
9117
|
+
'get_usage',
|
|
9118
|
+
'get_balance_history',
|
|
8888
9119
|
])),
|
|
8889
|
-
(
|
|
9120
|
+
(wr = {
|
|
8890
9121
|
name: 'get_pricing',
|
|
8891
9122
|
description:
|
|
8892
9123
|
'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 +9131,65 @@ var Zi,
|
|
|
8900
9131
|
},
|
|
8901
9132
|
additionalProperties: !1,
|
|
8902
9133
|
},
|
|
8903
|
-
})
|
|
8904
|
-
|
|
9134
|
+
}),
|
|
9135
|
+
(xr = {
|
|
9136
|
+
name: 'get_balance',
|
|
9137
|
+
description:
|
|
9138
|
+
"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.",
|
|
9139
|
+
inputSchema: { type: 'object', properties: {}, additionalProperties: !1 },
|
|
9140
|
+
}),
|
|
9141
|
+
(_r = {
|
|
9142
|
+
name: 'get_usage',
|
|
9143
|
+
description:
|
|
9144
|
+
"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.",
|
|
9145
|
+
inputSchema: {
|
|
9146
|
+
type: 'object',
|
|
9147
|
+
properties: {
|
|
9148
|
+
range: {
|
|
9149
|
+
type: 'string',
|
|
9150
|
+
enum: ['hour', 'day', 'week', 'month', 'custom'],
|
|
9151
|
+
description:
|
|
9152
|
+
'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.',
|
|
9153
|
+
},
|
|
9154
|
+
from: {
|
|
9155
|
+
type: 'string',
|
|
9156
|
+
description: 'range=custom only: first day, YYYY-MM-DD (UTC).',
|
|
9157
|
+
},
|
|
9158
|
+
to: { type: 'string', description: 'range=custom only: last day, YYYY-MM-DD (UTC).' },
|
|
9159
|
+
model: {
|
|
9160
|
+
type: 'string',
|
|
9161
|
+
description: 'Optional: count only this model id (e.g. seedance-2-5).',
|
|
9162
|
+
},
|
|
9163
|
+
channel: {
|
|
9164
|
+
type: 'string',
|
|
9165
|
+
enum: ['website', 'api', 'mcp', 'cli'],
|
|
9166
|
+
description: 'Optional: count only runs started there.',
|
|
9167
|
+
},
|
|
9168
|
+
},
|
|
9169
|
+
additionalProperties: !1,
|
|
9170
|
+
},
|
|
9171
|
+
}),
|
|
9172
|
+
(Pr = {
|
|
9173
|
+
name: 'get_balance_history',
|
|
9174
|
+
description:
|
|
9175
|
+
"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.",
|
|
9176
|
+
inputSchema: {
|
|
9177
|
+
type: 'object',
|
|
9178
|
+
properties: {
|
|
9179
|
+
limit: { type: 'integer', description: 'How many (1-100, default 50).' },
|
|
9180
|
+
after: { type: 'string', description: 'next_cursor of the previous page.' },
|
|
9181
|
+
type: {
|
|
9182
|
+
type: 'string',
|
|
9183
|
+
description:
|
|
9184
|
+
'Optional, comma separated: topup, auto_topup, usage (charges), refund, credit_grant, adjustment, referral, referral_cash, forfeit, starter, subscription.',
|
|
9185
|
+
},
|
|
9186
|
+
},
|
|
9187
|
+
additionalProperties: !1,
|
|
9188
|
+
},
|
|
9189
|
+
}),
|
|
9190
|
+
(va = [xr, _r, Pr]),
|
|
9191
|
+
(Cs = new Set(va.map((e) => e.name))));
|
|
9192
|
+
Ia = new Set([
|
|
8905
9193
|
'image',
|
|
8906
9194
|
'images',
|
|
8907
9195
|
'image_url',
|
|
@@ -8918,30 +9206,30 @@ var Zi,
|
|
|
8918
9206
|
'lipsyncing_audio',
|
|
8919
9207
|
]);
|
|
8920
9208
|
});
|
|
8921
|
-
var
|
|
8922
|
-
|
|
8923
|
-
forgetToolSchemas: () =>
|
|
8924
|
-
jsonRpcAnswer: () =>
|
|
8925
|
-
preprocessLocalFiles: () =>
|
|
8926
|
-
startStdioServer: () =>
|
|
9209
|
+
var Ra = {};
|
|
9210
|
+
ja(Ra, {
|
|
9211
|
+
forgetToolSchemas: () => qr,
|
|
9212
|
+
jsonRpcAnswer: () => Ca,
|
|
9213
|
+
preprocessLocalFiles: () => qa,
|
|
9214
|
+
startStdioServer: () => Oa,
|
|
8927
9215
|
});
|
|
8928
|
-
function
|
|
8929
|
-
let t = (
|
|
8930
|
-
!!
|
|
9216
|
+
function Cr(e) {
|
|
9217
|
+
let t = (a) =>
|
|
9218
|
+
!!a && typeof a == 'object' && a.jsonrpc === '2.0' && ('result' in a || 'error' in a);
|
|
8931
9219
|
return Array.isArray(e) ? e.length > 0 && e.every(t) : t(e);
|
|
8932
9220
|
}
|
|
8933
|
-
function
|
|
9221
|
+
function Ca(e, t, a) {
|
|
8934
9222
|
let i = e?.id,
|
|
8935
9223
|
n = i == null,
|
|
8936
9224
|
s = null;
|
|
8937
9225
|
try {
|
|
8938
|
-
s =
|
|
9226
|
+
s = a ? JSON.parse(a) : null;
|
|
8939
9227
|
} catch {
|
|
8940
9228
|
s = null;
|
|
8941
9229
|
}
|
|
8942
|
-
if (s !== null &&
|
|
9230
|
+
if (s !== null && Cr(s)) return n ? null : s;
|
|
8943
9231
|
if (n) return null;
|
|
8944
|
-
if (!
|
|
9232
|
+
if (!a && t >= 200 && t < 300) return;
|
|
8945
9233
|
let o = s?.error,
|
|
8946
9234
|
u =
|
|
8947
9235
|
typeof o == 'string'
|
|
@@ -8960,19 +9248,19 @@ function yr(e, t, r) {
|
|
|
8960
9248
|
},
|
|
8961
9249
|
};
|
|
8962
9250
|
}
|
|
8963
|
-
function
|
|
9251
|
+
function Er() {
|
|
8964
9252
|
let e = process.argv.slice(2),
|
|
8965
9253
|
t = e.indexOf('--api-key');
|
|
8966
|
-
return
|
|
9254
|
+
return S(t >= 0 ? e[t + 1] : void 0);
|
|
8967
9255
|
}
|
|
8968
|
-
async function
|
|
8969
|
-
let i =
|
|
8970
|
-
if (!
|
|
9256
|
+
async function Ea(e, t, a) {
|
|
9257
|
+
let i = z.default.resolve(e);
|
|
9258
|
+
if (!V.default.existsSync(i) || !V.default.statSync(i).isFile())
|
|
8971
9259
|
throw new Error(`File not found: ${e}`);
|
|
8972
|
-
let n =
|
|
9260
|
+
let n = V.default.readFileSync(i),
|
|
8973
9261
|
s = n.toString('base64'),
|
|
8974
9262
|
o = n.length,
|
|
8975
|
-
u = `${
|
|
9263
|
+
u = `${a.replace(/\/$/, '')}/v1/upload`,
|
|
8976
9264
|
l = await fetch(u, {
|
|
8977
9265
|
method: 'POST',
|
|
8978
9266
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${t}` },
|
|
@@ -8994,15 +9282,15 @@ async function br(e, t, r) {
|
|
|
8994
9282
|
mimeType: c.mime_type || c.mimeType || 'image/png',
|
|
8995
9283
|
};
|
|
8996
9284
|
}
|
|
8997
|
-
function
|
|
8998
|
-
return
|
|
9285
|
+
function $a(e) {
|
|
9286
|
+
return $r.has(z.default.extname(e).toLowerCase());
|
|
8999
9287
|
}
|
|
9000
|
-
function
|
|
9288
|
+
function Aa(e) {
|
|
9001
9289
|
return new Error(
|
|
9002
|
-
`Tein uploads image, video and audio files only, and ${
|
|
9290
|
+
`Tein uploads image, video and audio files only, and ${z.default.basename(e)} is not one.`,
|
|
9003
9291
|
);
|
|
9004
9292
|
}
|
|
9005
|
-
function
|
|
9293
|
+
function Ar(e) {
|
|
9006
9294
|
let t = e.trim();
|
|
9007
9295
|
if (
|
|
9008
9296
|
!t ||
|
|
@@ -9012,25 +9300,25 @@ function ca(e) {
|
|
|
9012
9300
|
`)
|
|
9013
9301
|
)
|
|
9014
9302
|
return null;
|
|
9015
|
-
let
|
|
9016
|
-
return
|
|
9303
|
+
let a = z.default.resolve(t);
|
|
9304
|
+
return V.default.existsSync(a) && V.default.statSync(a).isFile() ? a : null;
|
|
9017
9305
|
}
|
|
9018
|
-
function
|
|
9306
|
+
function lt(e) {
|
|
9019
9307
|
if (Array.isArray(e))
|
|
9020
9308
|
for (let t of e) {
|
|
9021
|
-
let
|
|
9022
|
-
typeof
|
|
9023
|
-
|
|
9024
|
-
typeof
|
|
9025
|
-
|
|
9309
|
+
let a = t;
|
|
9310
|
+
typeof a.name == 'string' &&
|
|
9311
|
+
a.inputSchema &&
|
|
9312
|
+
typeof a.inputSchema == 'object' &&
|
|
9313
|
+
ie.set(a.name, a.inputSchema);
|
|
9026
9314
|
}
|
|
9027
9315
|
}
|
|
9028
|
-
function
|
|
9029
|
-
(
|
|
9316
|
+
function qr() {
|
|
9317
|
+
(ie.clear(), (ot = 0));
|
|
9030
9318
|
}
|
|
9031
|
-
async function
|
|
9032
|
-
if (!(Date.now() -
|
|
9033
|
-
|
|
9319
|
+
async function Or(e, t) {
|
|
9320
|
+
if (!(Date.now() - ot < 6e4)) {
|
|
9321
|
+
ot = Date.now();
|
|
9034
9322
|
try {
|
|
9035
9323
|
let i = await (
|
|
9036
9324
|
await fetch(e, {
|
|
@@ -9040,39 +9328,39 @@ async function ma(e, t) {
|
|
|
9040
9328
|
signal: AbortSignal.timeout(1e4),
|
|
9041
9329
|
})
|
|
9042
9330
|
).json();
|
|
9043
|
-
|
|
9331
|
+
lt(i.result?.tools);
|
|
9044
9332
|
} catch {}
|
|
9045
9333
|
}
|
|
9046
9334
|
}
|
|
9047
|
-
function
|
|
9335
|
+
function Rr(e) {
|
|
9048
9336
|
return e
|
|
9049
9337
|
? e.type === 'string'
|
|
9050
9338
|
? e.format === 'uri'
|
|
9051
9339
|
: e.type === 'array' && e.items?.format === 'uri'
|
|
9052
9340
|
: !1;
|
|
9053
9341
|
}
|
|
9054
|
-
async function
|
|
9342
|
+
async function Ma(e, t, a) {
|
|
9055
9343
|
if (typeof e != 'string') return e;
|
|
9056
|
-
let i =
|
|
9344
|
+
let i = Ar(e);
|
|
9057
9345
|
if (!i) return e;
|
|
9058
|
-
if (
|
|
9059
|
-
return (await
|
|
9346
|
+
if (!$a(i)) throw Aa(i);
|
|
9347
|
+
return (await Ea(i, t, a)).url;
|
|
9060
9348
|
}
|
|
9061
|
-
async function
|
|
9062
|
-
(
|
|
9063
|
-
let s =
|
|
9349
|
+
async function qa(e, t, a, i, n) {
|
|
9350
|
+
(ie.size === 0 && lt(st()), ie.has(e) || (await Or(n, a)));
|
|
9351
|
+
let s = ie.get(e)?.properties;
|
|
9064
9352
|
if (!s) return t;
|
|
9065
9353
|
let o = { ...t };
|
|
9066
9354
|
for (let [u, l] of Object.entries(t))
|
|
9067
|
-
if (
|
|
9355
|
+
if (Rr(s[u]))
|
|
9068
9356
|
if (Array.isArray(l)) {
|
|
9069
9357
|
let c = [];
|
|
9070
|
-
for (let p of l) c.push(await
|
|
9358
|
+
for (let p of l) c.push(await Ma(p, a, i));
|
|
9071
9359
|
o[u] = c;
|
|
9072
|
-
} else o[u] = await
|
|
9360
|
+
} else o[u] = await Ma(l, a, i);
|
|
9073
9361
|
return o;
|
|
9074
9362
|
}
|
|
9075
|
-
function
|
|
9363
|
+
function Lr(e) {
|
|
9076
9364
|
let t = e.id ?? null;
|
|
9077
9365
|
switch (e.method) {
|
|
9078
9366
|
case 'initialize':
|
|
@@ -9082,7 +9370,7 @@ function ga(e) {
|
|
|
9082
9370
|
result: {
|
|
9083
9371
|
protocolVersion: '2024-11-05',
|
|
9084
9372
|
capabilities: { tools: { listChanged: !1 } },
|
|
9085
|
-
serverInfo: { name: 'tein-mcp', version:
|
|
9373
|
+
serverInfo: { name: 'tein-mcp', version: F },
|
|
9086
9374
|
},
|
|
9087
9375
|
};
|
|
9088
9376
|
case 'notifications/initialized':
|
|
@@ -9090,7 +9378,7 @@ function ga(e) {
|
|
|
9090
9378
|
case 'ping':
|
|
9091
9379
|
return { jsonrpc: '2.0', id: t, result: {} };
|
|
9092
9380
|
case 'tools/list':
|
|
9093
|
-
return { jsonrpc: '2.0', id: t, result: { tools:
|
|
9381
|
+
return { jsonrpc: '2.0', id: t, result: { tools: st() } };
|
|
9094
9382
|
case 'tools/call':
|
|
9095
9383
|
return {
|
|
9096
9384
|
jsonrpc: '2.0',
|
|
@@ -9113,13 +9401,13 @@ function ga(e) {
|
|
|
9113
9401
|
};
|
|
9114
9402
|
}
|
|
9115
9403
|
}
|
|
9116
|
-
async function
|
|
9117
|
-
if (
|
|
9118
|
-
|
|
9119
|
-
let e =
|
|
9120
|
-
t =
|
|
9121
|
-
|
|
9122
|
-
(
|
|
9404
|
+
async function Oa() {
|
|
9405
|
+
if (Ka) return;
|
|
9406
|
+
Ka = !0;
|
|
9407
|
+
let e = Er(),
|
|
9408
|
+
t = w(),
|
|
9409
|
+
a = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
|
|
9410
|
+
(Sa.default
|
|
9123
9411
|
.createInterface({ input: process.stdin, output: process.stdout, terminal: !1 })
|
|
9124
9412
|
.on('line', async (n) => {
|
|
9125
9413
|
let s = n.trim();
|
|
@@ -9131,10 +9419,10 @@ async function _r() {
|
|
|
9131
9419
|
c = o.params.arguments || {};
|
|
9132
9420
|
if (l === 'get_pricing') {
|
|
9133
9421
|
let p = typeof c.model == 'string' ? c.model.trim() : '',
|
|
9134
|
-
d = `${t.replace(/\/+$/, '')}${
|
|
9422
|
+
d = `${t.replace(/\/+$/, '')}${xe(p)}`;
|
|
9135
9423
|
try {
|
|
9136
9424
|
let m = await fetch(d, { signal: AbortSignal.timeout(1e4) }),
|
|
9137
|
-
|
|
9425
|
+
y = await m.text();
|
|
9138
9426
|
process.stdout.write(
|
|
9139
9427
|
JSON.stringify({
|
|
9140
9428
|
jsonrpc: '2.0',
|
|
@@ -9143,7 +9431,7 @@ async function _r() {
|
|
|
9143
9431
|
content: [
|
|
9144
9432
|
{
|
|
9145
9433
|
type: 'text',
|
|
9146
|
-
text: m.ok ?
|
|
9434
|
+
text: m.ok ? y : `Pricing request failed (${m.status}). ${y}`,
|
|
9147
9435
|
},
|
|
9148
9436
|
],
|
|
9149
9437
|
isError: !m.ok,
|
|
@@ -9153,13 +9441,13 @@ async function _r() {
|
|
|
9153
9441
|
`,
|
|
9154
9442
|
);
|
|
9155
9443
|
} catch (m) {
|
|
9156
|
-
let
|
|
9444
|
+
let y = m instanceof Error ? m.message : String(m);
|
|
9157
9445
|
process.stdout.write(
|
|
9158
9446
|
JSON.stringify({
|
|
9159
9447
|
jsonrpc: '2.0',
|
|
9160
9448
|
id: o.id,
|
|
9161
9449
|
result: {
|
|
9162
|
-
content: [{ type: 'text', text: `Could not reach Tein prices: ${
|
|
9450
|
+
content: [{ type: 'text', text: `Could not reach Tein prices: ${y}` }],
|
|
9163
9451
|
isError: !0,
|
|
9164
9452
|
},
|
|
9165
9453
|
}) +
|
|
@@ -9178,19 +9466,19 @@ async function _r() {
|
|
|
9178
9466
|
!p.startsWith('data:')
|
|
9179
9467
|
)
|
|
9180
9468
|
try {
|
|
9181
|
-
let d =
|
|
9182
|
-
if (
|
|
9183
|
-
if (
|
|
9184
|
-
let m = await
|
|
9185
|
-
|
|
9186
|
-
|
|
9469
|
+
let d = z.default.resolve(p.trim());
|
|
9470
|
+
if (V.default.existsSync(d) && V.default.statSync(d).isFile() && e) {
|
|
9471
|
+
if (!$a(d)) throw Aa(d);
|
|
9472
|
+
let m = await Ea(d, e, t),
|
|
9473
|
+
y = (m.sizeBytes / 1024).toFixed(1),
|
|
9474
|
+
_e =
|
|
9187
9475
|
m.mimeType.startsWith('image/') ||
|
|
9188
9476
|
/\.(png|jpe?g|webp|gif|svg)$/i.test(m.url)
|
|
9189
9477
|
? `
|
|
9190
9478
|
|
|
9191
9479
|
`
|
|
9192
9480
|
: '',
|
|
9193
|
-
|
|
9481
|
+
Pe = {
|
|
9194
9482
|
jsonrpc: '2.0',
|
|
9195
9483
|
id: o.id,
|
|
9196
9484
|
result: {
|
|
@@ -9201,7 +9489,7 @@ async function _r() {
|
|
|
9201
9489
|
|
|
9202
9490
|
- **URL:** ${m.url}
|
|
9203
9491
|
- **Type:** \`${m.mimeType}\`
|
|
9204
|
-
- **Size:** ${
|
|
9492
|
+
- **Size:** ${y} KB${_e}
|
|
9205
9493
|
|
|
9206
9494
|
Pass this URL to any Tein generation tool.`,
|
|
9207
9495
|
},
|
|
@@ -9210,7 +9498,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9210
9498
|
},
|
|
9211
9499
|
};
|
|
9212
9500
|
process.stdout.write(
|
|
9213
|
-
JSON.stringify(
|
|
9501
|
+
JSON.stringify(Pe) +
|
|
9214
9502
|
`
|
|
9215
9503
|
`,
|
|
9216
9504
|
);
|
|
@@ -9237,7 +9525,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9237
9525
|
}
|
|
9238
9526
|
if (e)
|
|
9239
9527
|
try {
|
|
9240
|
-
o.params.arguments = await
|
|
9528
|
+
o.params.arguments = await qa(String(l), c, e, t, a);
|
|
9241
9529
|
} catch (p) {
|
|
9242
9530
|
let d = p instanceof Error ? p.message : String(p);
|
|
9243
9531
|
process.stdout.write(
|
|
@@ -9262,16 +9550,16 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9262
9550
|
}
|
|
9263
9551
|
if (e)
|
|
9264
9552
|
try {
|
|
9265
|
-
let l = await fetch(
|
|
9553
|
+
let l = await fetch(a, {
|
|
9266
9554
|
method: 'POST',
|
|
9267
9555
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${e}` },
|
|
9268
9556
|
body: JSON.stringify(o),
|
|
9269
9557
|
}),
|
|
9270
9558
|
c = await l.text(),
|
|
9271
|
-
p =
|
|
9559
|
+
p = Ca(o, l.status, c);
|
|
9272
9560
|
if (p === null) return;
|
|
9273
9561
|
if (p) {
|
|
9274
|
-
(o?.method === 'tools/list' &&
|
|
9562
|
+
(o?.method === 'tools/list' && lt(p.result?.tools),
|
|
9275
9563
|
process.stdout.write(
|
|
9276
9564
|
JSON.stringify(p) +
|
|
9277
9565
|
`
|
|
@@ -9280,7 +9568,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9280
9568
|
return;
|
|
9281
9569
|
}
|
|
9282
9570
|
} catch {}
|
|
9283
|
-
let u =
|
|
9571
|
+
let u = Lr(o);
|
|
9284
9572
|
u !== null &&
|
|
9285
9573
|
process.stdout.write(
|
|
9286
9574
|
JSON.stringify(u) +
|
|
@@ -9303,22 +9591,23 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9303
9591
|
process.stderr.write(`Tein AI MCP Server running on stdio transport.
|
|
9304
9592
|
`));
|
|
9305
9593
|
}
|
|
9306
|
-
var
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
|
|
9594
|
+
var V,
|
|
9595
|
+
z,
|
|
9596
|
+
Sa,
|
|
9597
|
+
$r,
|
|
9598
|
+
ie,
|
|
9599
|
+
ot,
|
|
9600
|
+
Ka,
|
|
9601
|
+
La = h(() => {
|
|
9314
9602
|
'use strict';
|
|
9315
|
-
((
|
|
9316
|
-
(
|
|
9317
|
-
(
|
|
9318
|
-
|
|
9319
|
-
|
|
9320
|
-
|
|
9321
|
-
|
|
9603
|
+
((V = T(require('node:fs'))),
|
|
9604
|
+
(z = T(require('node:path'))),
|
|
9605
|
+
(Sa = T(require('node:readline'))));
|
|
9606
|
+
et();
|
|
9607
|
+
Ta();
|
|
9608
|
+
$();
|
|
9609
|
+
re();
|
|
9610
|
+
$r = new Set([
|
|
9322
9611
|
'.png',
|
|
9323
9612
|
'.jpg',
|
|
9324
9613
|
'.jpeg',
|
|
@@ -9344,42 +9633,42 @@ var L,
|
|
|
9344
9633
|
'.flac',
|
|
9345
9634
|
'.opus',
|
|
9346
9635
|
]);
|
|
9347
|
-
((
|
|
9348
|
-
|
|
9636
|
+
((ie = new Map()), (ot = 0));
|
|
9637
|
+
Ka = !1;
|
|
9349
9638
|
require.main === module &&
|
|
9350
|
-
|
|
9639
|
+
Oa().catch((e) => {
|
|
9351
9640
|
(process.stderr.write(`Fatal error in Tein MCP CLI: ${e}
|
|
9352
9641
|
`),
|
|
9353
9642
|
process.exit(1));
|
|
9354
9643
|
});
|
|
9355
9644
|
});
|
|
9356
|
-
var
|
|
9645
|
+
var Ha =
|
|
9357
9646
|
!process.env.NO_COLOR &&
|
|
9358
9647
|
(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:
|
|
9648
|
+
function x(e, t) {
|
|
9649
|
+
return (a) => (Ha ? `\x1B[${e}m${a}\x1B[${t}m` : String(a));
|
|
9650
|
+
}
|
|
9651
|
+
var r = {
|
|
9652
|
+
bold: x(1, 22),
|
|
9653
|
+
dim: x(2, 22),
|
|
9654
|
+
italic: x(3, 23),
|
|
9655
|
+
underline: x(4, 24),
|
|
9656
|
+
inverse: x(7, 27),
|
|
9657
|
+
black: x(30, 39),
|
|
9658
|
+
red: x(31, 39),
|
|
9659
|
+
green: x(32, 39),
|
|
9660
|
+
yellow: x(33, 39),
|
|
9661
|
+
blue: x(34, 39),
|
|
9662
|
+
magenta: x(35, 39),
|
|
9663
|
+
cyan: x(36, 39),
|
|
9664
|
+
white: x(37, 39),
|
|
9665
|
+
gray: x(90, 39),
|
|
9666
|
+
bgBlue: x(44, 49),
|
|
9667
|
+
bgMagenta: x(45, 49),
|
|
9668
|
+
bgCyan: x(46, 49),
|
|
9669
|
+
bgGreen: x(42, 49),
|
|
9381
9670
|
},
|
|
9382
|
-
|
|
9671
|
+
E = class {
|
|
9383
9672
|
constructor(t = '') {
|
|
9384
9673
|
this.frames = [
|
|
9385
9674
|
'\u280B',
|
|
@@ -9403,8 +9692,8 @@ var a = {
|
|
|
9403
9692
|
process.stdout.isTTY
|
|
9404
9693
|
? (this.stop(),
|
|
9405
9694
|
(this.timer = setInterval(() => {
|
|
9406
|
-
let
|
|
9407
|
-
(process.stdout.write(`\r${
|
|
9695
|
+
let a = r.cyan(this.frames[this.current]);
|
|
9696
|
+
(process.stdout.write(`\r${a} ${this.text} `),
|
|
9408
9697
|
(this.current = (this.current + 1) % this.frames.length));
|
|
9409
9698
|
}, 80)),
|
|
9410
9699
|
this)
|
|
@@ -9418,20 +9707,20 @@ var a = {
|
|
|
9418
9707
|
}
|
|
9419
9708
|
succeed(t) {
|
|
9420
9709
|
this.stop();
|
|
9421
|
-
let
|
|
9710
|
+
let a = t || this.text;
|
|
9422
9711
|
process.stdout.isTTY
|
|
9423
|
-
? process.stdout.write(`\r${
|
|
9712
|
+
? process.stdout.write(`\r${r.green('\u2713')} ${a}
|
|
9424
9713
|
`)
|
|
9425
|
-
: process.stdout.write(`[\u2713] ${
|
|
9714
|
+
: process.stdout.write(`[\u2713] ${a}
|
|
9426
9715
|
`);
|
|
9427
9716
|
}
|
|
9428
9717
|
fail(t) {
|
|
9429
9718
|
this.stop();
|
|
9430
|
-
let
|
|
9719
|
+
let a = t || this.text;
|
|
9431
9720
|
process.stdout.isTTY
|
|
9432
|
-
? process.stdout.write(`\r${
|
|
9721
|
+
? process.stdout.write(`\r${r.red('\u2717')} ${a}
|
|
9433
9722
|
`)
|
|
9434
|
-
: process.stdout.write(`[\u2717] ${
|
|
9723
|
+
: process.stdout.write(`[\u2717] ${a}
|
|
9435
9724
|
`);
|
|
9436
9725
|
}
|
|
9437
9726
|
stop() {
|
|
@@ -9441,13 +9730,13 @@ var a = {
|
|
|
9441
9730
|
process.stdout.isTTY && process.stdout.write('\r\x1B[K'));
|
|
9442
9731
|
}
|
|
9443
9732
|
};
|
|
9444
|
-
var
|
|
9445
|
-
|
|
9446
|
-
var
|
|
9447
|
-
|
|
9448
|
-
|
|
9449
|
-
|
|
9450
|
-
var
|
|
9733
|
+
var U = T(require('node:fs')),
|
|
9734
|
+
q = T(require('node:path'));
|
|
9735
|
+
var ne = T(require('node:fs')),
|
|
9736
|
+
mt = T(require('node:path')),
|
|
9737
|
+
ft = require('node:stream/promises');
|
|
9738
|
+
re();
|
|
9739
|
+
var Ya = new Set([
|
|
9451
9740
|
'account_suspended',
|
|
9452
9741
|
'account_terminated',
|
|
9453
9742
|
'creative_mode_restricted',
|
|
@@ -9455,75 +9744,75 @@ var Ar = new Set([
|
|
|
9455
9744
|
'workspace_paused',
|
|
9456
9745
|
]),
|
|
9457
9746
|
v = 1,
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
constructor(t,
|
|
9461
|
-
(super(
|
|
9747
|
+
Xa = 3,
|
|
9748
|
+
b = class extends Error {
|
|
9749
|
+
constructor(t, a, i, n = {}) {
|
|
9750
|
+
(super(a),
|
|
9462
9751
|
(this.name = 'TeinApiError'),
|
|
9463
9752
|
(this.status = t),
|
|
9464
9753
|
i && (this.code = i),
|
|
9465
9754
|
(this.fields = n));
|
|
9466
9755
|
}
|
|
9467
9756
|
get exitCode() {
|
|
9468
|
-
return this.code &&
|
|
9757
|
+
return this.code && Ya.has(this.code) ? Xa : v;
|
|
9469
9758
|
}
|
|
9470
9759
|
};
|
|
9471
|
-
function
|
|
9760
|
+
function Qa(e, t, a) {
|
|
9472
9761
|
let i = `HTTP ${e}${t ? ` ${t}` : ''}`;
|
|
9473
|
-
if (!
|
|
9474
|
-
let n =
|
|
9762
|
+
if (!a || typeof a != 'object') return new b(e, i);
|
|
9763
|
+
let n = a;
|
|
9475
9764
|
if (n.error && typeof n.error == 'object' && !Array.isArray(n.error)) {
|
|
9476
9765
|
let p = n.error,
|
|
9477
|
-
{ code: d, message: m, ...
|
|
9478
|
-
return new
|
|
9766
|
+
{ code: d, message: m, ...y } = p;
|
|
9767
|
+
return new b(e, typeof m == 'string' && m ? m : i, typeof d == 'string' ? d : void 0, y);
|
|
9479
9768
|
}
|
|
9480
9769
|
let { error: s, code: o, message: u, ...l } = n,
|
|
9481
9770
|
c = (typeof s == 'string' && s) || (typeof u == 'string' && u) || i;
|
|
9482
|
-
return new
|
|
9771
|
+
return new b(e, c, typeof o == 'string' ? o : void 0, l);
|
|
9483
9772
|
}
|
|
9484
|
-
function
|
|
9773
|
+
function ct(e) {
|
|
9485
9774
|
return typeof e == 'number' && Number.isFinite(e) ? `$${e.toFixed(4)}` : null;
|
|
9486
9775
|
}
|
|
9487
|
-
function
|
|
9776
|
+
function K(e) {
|
|
9488
9777
|
let t = [e.message],
|
|
9489
|
-
|
|
9490
|
-
i =
|
|
9491
|
-
(
|
|
9492
|
-
t.push([
|
|
9778
|
+
a = ct(e.fields.required),
|
|
9779
|
+
i = ct(e.fields.balance);
|
|
9780
|
+
(a || i) &&
|
|
9781
|
+
t.push([a ? `Required: ${a}` : '', i ? `Balance: ${i}` : ''].filter(Boolean).join(' '));
|
|
9493
9782
|
let n = e.fields.org_name ?? e.fields.orgName;
|
|
9494
9783
|
typeof n == 'string' && n && t.push(`Workspace: ${n}`);
|
|
9495
9784
|
let s = e.fields.url ?? e.fields.appeal_url ?? e.fields.top_up_url;
|
|
9496
9785
|
return (typeof s == 'string' && s && t.push(s), e.code && t.push(`(${e.code})`), t);
|
|
9497
9786
|
}
|
|
9498
|
-
function
|
|
9787
|
+
function Za(e) {
|
|
9499
9788
|
return /\.(mp4|webm|mov)(\?|$)/i.test(e)
|
|
9500
9789
|
? 'video'
|
|
9501
9790
|
: /\.(mp3|wav|ogg|flac)(\?|$)/i.test(e)
|
|
9502
9791
|
? 'audio'
|
|
9503
9792
|
: 'image';
|
|
9504
9793
|
}
|
|
9505
|
-
function
|
|
9794
|
+
function ut(e) {
|
|
9506
9795
|
let t = [];
|
|
9507
|
-
for (let
|
|
9508
|
-
typeof
|
|
9509
|
-
? t.push({ type: 'text', text:
|
|
9510
|
-
:
|
|
9796
|
+
for (let a of e.data ?? [])
|
|
9797
|
+
typeof a.message?.content == 'string'
|
|
9798
|
+
? t.push({ type: 'text', text: a.message.content })
|
|
9799
|
+
: a.url && t.push({ type: Za(a.url), url: a.url, ...(a.layer ? { layer: a.layer } : {}) });
|
|
9511
9800
|
return t;
|
|
9512
9801
|
}
|
|
9513
|
-
var
|
|
9514
|
-
constructor(t,
|
|
9515
|
-
((this.apiKey = t), (this.baseUrl =
|
|
9802
|
+
var M = class {
|
|
9803
|
+
constructor(t, a) {
|
|
9804
|
+
((this.apiKey = t), (this.baseUrl = a.replace(/\/+$/, '')));
|
|
9516
9805
|
}
|
|
9517
9806
|
getHeaders() {
|
|
9518
9807
|
return {
|
|
9519
9808
|
'Content-Type': 'application/json',
|
|
9520
9809
|
Authorization: `Bearer ${this.apiKey}`,
|
|
9521
|
-
'User-Agent': `Tein-CLI/${
|
|
9810
|
+
'User-Agent': `Tein-CLI/${F}`,
|
|
9522
9811
|
'X-Tein-Client': 'cli',
|
|
9523
9812
|
};
|
|
9524
9813
|
}
|
|
9525
|
-
async send(t,
|
|
9526
|
-
let n = await fetch(`${this.baseUrl}${
|
|
9814
|
+
async send(t, a, i) {
|
|
9815
|
+
let n = await fetch(`${this.baseUrl}${a}`, {
|
|
9527
9816
|
method: t,
|
|
9528
9817
|
headers: this.getHeaders(),
|
|
9529
9818
|
...(i === void 0 ? {} : { body: JSON.stringify(i) }),
|
|
@@ -9533,21 +9822,21 @@ var K = class {
|
|
|
9533
9822
|
try {
|
|
9534
9823
|
s = await n.json();
|
|
9535
9824
|
} catch {}
|
|
9536
|
-
throw
|
|
9825
|
+
throw Qa(n.status, n.statusText, s);
|
|
9537
9826
|
}
|
|
9538
9827
|
return await n.json();
|
|
9539
9828
|
}
|
|
9540
9829
|
async checkKey() {
|
|
9541
9830
|
await this.send('GET', '/v1/jobs?limit=1');
|
|
9542
9831
|
}
|
|
9543
|
-
queueJob(t,
|
|
9544
|
-
return this.send('POST', '/v1/generate', { model: t, ...
|
|
9832
|
+
queueJob(t, a) {
|
|
9833
|
+
return this.send('POST', '/v1/generate', { model: t, ...a }).then((i) => {
|
|
9545
9834
|
let n = i.status,
|
|
9546
9835
|
s =
|
|
9547
9836
|
n === 'succeeded' || n === 'failed' || n === 'expired' || n === 'cancelled'
|
|
9548
9837
|
? n
|
|
9549
9838
|
: 'processing',
|
|
9550
|
-
o =
|
|
9839
|
+
o = ut(i);
|
|
9551
9840
|
return {
|
|
9552
9841
|
request_id: i.request_id || i.id || '',
|
|
9553
9842
|
model: i.model,
|
|
@@ -9559,89 +9848,100 @@ var K = class {
|
|
|
9559
9848
|
});
|
|
9560
9849
|
}
|
|
9561
9850
|
getStatus(t) {
|
|
9562
|
-
return this.send('GET', `/v1/jobs/${encodeURIComponent(t)}`).then((
|
|
9563
|
-
let i =
|
|
9851
|
+
return this.send('GET', `/v1/jobs/${encodeURIComponent(t)}`).then((a) => {
|
|
9852
|
+
let i = a.status,
|
|
9564
9853
|
n =
|
|
9565
9854
|
i === 'succeeded' || i === 'failed' || i === 'expired' || i === 'cancelled'
|
|
9566
9855
|
? i
|
|
9567
9856
|
: 'processing',
|
|
9568
|
-
s =
|
|
9569
|
-
o =
|
|
9857
|
+
s = ut(a),
|
|
9858
|
+
o = a.error && typeof a.error.message == 'string' ? a.error.message : null;
|
|
9570
9859
|
return {
|
|
9571
|
-
request_id:
|
|
9572
|
-
model:
|
|
9860
|
+
request_id: a.id || t,
|
|
9861
|
+
model: a.model,
|
|
9573
9862
|
status: n,
|
|
9574
9863
|
...(s.length ? { output: s } : {}),
|
|
9575
9864
|
error: o,
|
|
9576
|
-
...(
|
|
9865
|
+
...(a.usage ? { usage: a.usage } : {}),
|
|
9577
9866
|
};
|
|
9578
9867
|
});
|
|
9579
9868
|
}
|
|
9869
|
+
getBalance() {
|
|
9870
|
+
return this.send('GET', '/v1/balance');
|
|
9871
|
+
}
|
|
9872
|
+
getUsage(t) {
|
|
9873
|
+
let a = new URLSearchParams(t).toString();
|
|
9874
|
+
return this.send('GET', `/v1/usage${a ? `?${a}` : ''}`);
|
|
9875
|
+
}
|
|
9876
|
+
getTransactions(t) {
|
|
9877
|
+
let a = new URLSearchParams(t).toString();
|
|
9878
|
+
return this.send('GET', `/v1/balance/transactions${a ? `?${a}` : ''}`);
|
|
9879
|
+
}
|
|
9580
9880
|
uploadAsset(t) {
|
|
9581
9881
|
return this.send('POST', '/v1/upload', { data: t });
|
|
9582
9882
|
}
|
|
9583
|
-
async downloadOutput(t,
|
|
9883
|
+
async downloadOutput(t, a) {
|
|
9584
9884
|
let i = await fetch(t);
|
|
9585
9885
|
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,
|
|
9886
|
+
let n = mt.default.dirname(a);
|
|
9887
|
+
ne.default.existsSync(n) || ne.default.mkdirSync(n, { recursive: !0 });
|
|
9888
|
+
let s = ne.default.createWriteStream(a);
|
|
9889
|
+
return (await (0, ft.pipeline)(i.body, s), a);
|
|
9590
9890
|
}
|
|
9591
9891
|
};
|
|
9592
|
-
|
|
9593
|
-
function
|
|
9892
|
+
$();
|
|
9893
|
+
function Se(e) {
|
|
9594
9894
|
if (typeof e != 'number' || !Number.isFinite(e)) return '';
|
|
9595
9895
|
if (Math.abs(e) >= 1 || Math.abs(Number(e.toFixed(4)) - e) < 1e-12) return `$${e.toFixed(4)}`;
|
|
9596
9896
|
let t = Math.max(0, 3 - Number(e.toExponential(3).split('e')[1])),
|
|
9597
|
-
|
|
9598
|
-
i = Math.round(Number((e *
|
|
9897
|
+
a = 10 ** t,
|
|
9898
|
+
i = Math.round(Number((e * a).toFixed(6))) / a;
|
|
9599
9899
|
return i >= 1 ? `$${i.toFixed(4)}` : `$${i.toFixed(t).replace(/0+$/, '')}`;
|
|
9600
9900
|
}
|
|
9601
|
-
|
|
9602
|
-
var
|
|
9603
|
-
function
|
|
9604
|
-
for (let t of
|
|
9901
|
+
ee();
|
|
9902
|
+
var na = ['images', 'input_images', 'videos', 'audios'];
|
|
9903
|
+
function Wi(e) {
|
|
9904
|
+
for (let t of na) typeof e[t] == 'string' && (e[t] = [e[t]]);
|
|
9605
9905
|
}
|
|
9606
|
-
function
|
|
9906
|
+
function Yi(e) {
|
|
9607
9907
|
if (e.startsWith('http://') || e.startsWith('https://')) return null;
|
|
9608
|
-
let t =
|
|
9609
|
-
return
|
|
9908
|
+
let t = q.default.resolve(e);
|
|
9909
|
+
return U.default.existsSync(t) && U.default.statSync(t).isFile() ? t : null;
|
|
9610
9910
|
}
|
|
9611
|
-
async function
|
|
9612
|
-
for (let
|
|
9613
|
-
if (!Array.isArray(e[
|
|
9911
|
+
async function Xi(e, t) {
|
|
9912
|
+
for (let a of na) {
|
|
9913
|
+
if (!Array.isArray(e[a])) continue;
|
|
9614
9914
|
let i = [];
|
|
9615
|
-
for (let n of e[
|
|
9915
|
+
for (let n of e[a]) {
|
|
9616
9916
|
if (typeof n != 'string') continue;
|
|
9617
|
-
let s =
|
|
9917
|
+
let s = Yi(n);
|
|
9618
9918
|
i.push(s ? await t(s) : n);
|
|
9619
9919
|
}
|
|
9620
|
-
e[
|
|
9920
|
+
e[a] = i;
|
|
9621
9921
|
}
|
|
9622
9922
|
}
|
|
9623
|
-
var
|
|
9624
|
-
function
|
|
9923
|
+
var te = { starter: 10, plus: 25, scale: 40, enterprise: 200 };
|
|
9924
|
+
function Qi(e) {
|
|
9625
9925
|
if (e.count === void 0 || e.count === !0) return 1;
|
|
9626
9926
|
let t = typeof e.count == 'number' ? e.count : Number(e.count),
|
|
9627
|
-
|
|
9927
|
+
a = te.enterprise;
|
|
9628
9928
|
return (
|
|
9629
|
-
(!Number.isInteger(t) || t < 1 || t >
|
|
9929
|
+
(!Number.isInteger(t) || t < 1 || t > a) &&
|
|
9630
9930
|
(process.stderr
|
|
9631
|
-
.write(`${
|
|
9931
|
+
.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
9932
|
`),
|
|
9633
9933
|
process.exit(1)),
|
|
9634
9934
|
t
|
|
9635
9935
|
);
|
|
9636
9936
|
}
|
|
9637
|
-
async function
|
|
9937
|
+
async function Zi(e, t, a, i, n) {
|
|
9638
9938
|
n.isJson ||
|
|
9639
9939
|
process.stderr.write(`Starting ${i} ${t} jobs together...
|
|
9640
9940
|
`);
|
|
9641
9941
|
let s = await Promise.all(
|
|
9642
9942
|
Array.from({ length: i }, async () => {
|
|
9643
9943
|
try {
|
|
9644
|
-
return { job: await e.queueJob(t,
|
|
9944
|
+
return { job: await e.queueJob(t, a) };
|
|
9645
9945
|
} catch (l) {
|
|
9646
9946
|
return { err: l };
|
|
9647
9947
|
}
|
|
@@ -9654,9 +9954,9 @@ async function Di(e, t, r, i, n) {
|
|
|
9654
9954
|
? o.push(l.job)
|
|
9655
9955
|
: 'err' in l &&
|
|
9656
9956
|
u.push(
|
|
9657
|
-
l.err instanceof
|
|
9957
|
+
l.err instanceof b
|
|
9658
9958
|
? l.err
|
|
9659
|
-
: new
|
|
9959
|
+
: new b(0, l.err instanceof Error ? l.err.message : String(l.err)),
|
|
9660
9960
|
);
|
|
9661
9961
|
if (!n.isAsync) {
|
|
9662
9962
|
let l = Date.now(),
|
|
@@ -9677,7 +9977,7 @@ async function Di(e, t, r, i, n) {
|
|
|
9677
9977
|
}),
|
|
9678
9978
|
);
|
|
9679
9979
|
for (let d of p) {
|
|
9680
|
-
let m = o.findIndex((
|
|
9980
|
+
let m = o.findIndex((y) => y.request_id === d.request_id);
|
|
9681
9981
|
m >= 0 && (o[m] = d);
|
|
9682
9982
|
}
|
|
9683
9983
|
c = o.filter((d) => d.status === 'processing' && d.request_id);
|
|
@@ -9696,12 +9996,12 @@ async function Di(e, t, r, i, n) {
|
|
|
9696
9996
|
else {
|
|
9697
9997
|
for (let l of o)
|
|
9698
9998
|
(process.stdout.write(`${l.request_id} ${l.status}`),
|
|
9699
|
-
l.usage?.cost !== void 0 && process.stdout.write(` ${
|
|
9999
|
+
l.usage?.cost !== void 0 && process.stdout.write(` ${Se(l.usage.cost)}`),
|
|
9700
10000
|
l.error && process.stdout.write(` ${l.error}`),
|
|
9701
10001
|
process.stdout.write(`
|
|
9702
10002
|
`));
|
|
9703
10003
|
for (let l of u)
|
|
9704
|
-
process.stderr.write(`${
|
|
10004
|
+
process.stderr.write(`${K(l).join(`
|
|
9705
10005
|
`)}
|
|
9706
10006
|
`);
|
|
9707
10007
|
}
|
|
@@ -9709,14 +10009,14 @@ async function Di(e, t, r, i, n) {
|
|
|
9709
10009
|
o.some((l) => l.status === 'failed' || l.status === 'expired' || l.status === 'cancelled')) &&
|
|
9710
10010
|
process.exit(v);
|
|
9711
10011
|
}
|
|
9712
|
-
function
|
|
9713
|
-
if (
|
|
9714
|
-
let i =
|
|
10012
|
+
function er(e, t, a) {
|
|
10013
|
+
if (a <= 1) return e;
|
|
10014
|
+
let i = q.default.extname(e);
|
|
9715
10015
|
return `${e.slice(0, e.length - i.length)}-${t + 1}${i}`;
|
|
9716
10016
|
}
|
|
9717
|
-
function
|
|
10017
|
+
function sa(e) {
|
|
9718
10018
|
let t = {},
|
|
9719
|
-
|
|
10019
|
+
a = new Set(),
|
|
9720
10020
|
i = [];
|
|
9721
10021
|
for (let n = 0; n < e.length; n++) {
|
|
9722
10022
|
let s = e[n];
|
|
@@ -9735,7 +10035,7 @@ function tr(e) {
|
|
|
9735
10035
|
? (t[o.replace(/-/g, '_')] = Number(u))
|
|
9736
10036
|
: (t[o.replace(/-/g, '_')] = u),
|
|
9737
10037
|
n++);
|
|
9738
|
-
} else ((t[o.replace(/-/g, '_')] = !0),
|
|
10038
|
+
} else ((t[o.replace(/-/g, '_')] = !0), a.add(o));
|
|
9739
10039
|
} else if (s.startsWith('-') && s.length === 2) {
|
|
9740
10040
|
let o = s[1],
|
|
9741
10041
|
l =
|
|
@@ -9751,37 +10051,37 @@ function tr(e) {
|
|
|
9751
10051
|
v: 'version',
|
|
9752
10052
|
}[o] || o;
|
|
9753
10053
|
o === 'j' || o === 'h' || o === 'v'
|
|
9754
|
-
? ((t[l] = !0),
|
|
10054
|
+
? ((t[l] = !0), a.add(l))
|
|
9755
10055
|
: n + 1 < e.length && !e[n + 1].startsWith('-')
|
|
9756
10056
|
? ((t[l] = e[n + 1]), n++)
|
|
9757
10057
|
: (t[l] = !0);
|
|
9758
10058
|
} else i.push(s);
|
|
9759
10059
|
}
|
|
9760
|
-
return { command: i[0] || '', subcommand: i[1], modelSlug: i[1] || i[0], options: t, flags:
|
|
10060
|
+
return { command: i[0] || '', subcommand: i[1], modelSlug: i[1] || i[0], options: t, flags: a };
|
|
9761
10061
|
}
|
|
9762
|
-
async function
|
|
9763
|
-
let
|
|
9764
|
-
i =
|
|
9765
|
-
(
|
|
9766
|
-
(process.stderr.write(`${
|
|
10062
|
+
async function Qe(e, t) {
|
|
10063
|
+
let a = S(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
10064
|
+
i = w(typeof t.api_url == 'string' ? t.api_url : void 0);
|
|
10065
|
+
(a ||
|
|
10066
|
+
(process.stderr.write(`${r.red('Error:')} Authentication required.
|
|
9767
10067
|
`),
|
|
9768
10068
|
process.stderr
|
|
9769
|
-
.write(`Please run ${
|
|
10069
|
+
.write(`Please run ${r.cyan('tein auth login')} or set ${r.cyan('TEIN_API_KEY')} environment variable.
|
|
9770
10070
|
`),
|
|
9771
10071
|
process.exit(1)),
|
|
9772
10072
|
e ||
|
|
9773
|
-
(process.stderr.write(`${
|
|
10073
|
+
(process.stderr.write(`${r.red('Error:')} Missing model slug.
|
|
9774
10074
|
`),
|
|
9775
|
-
process.stderr.write(`Usage: ${
|
|
10075
|
+
process.stderr.write(`Usage: ${r.cyan('tein run <model-slug> --prompt "..."')}
|
|
9776
10076
|
`),
|
|
9777
|
-
process.stderr.write(`Run ${
|
|
10077
|
+
process.stderr.write(`Run ${r.cyan('tein models')} to list all available models.
|
|
9778
10078
|
`),
|
|
9779
10079
|
process.exit(1)));
|
|
9780
|
-
let n =
|
|
10080
|
+
let n = H(e),
|
|
9781
10081
|
s = !!t.json,
|
|
9782
10082
|
o = !!(t.async || t.no_wait),
|
|
9783
10083
|
u = typeof t.output == 'string' ? t.output : void 0,
|
|
9784
|
-
l =
|
|
10084
|
+
l = Qi(t),
|
|
9785
10085
|
c = { ...t };
|
|
9786
10086
|
(delete c.json,
|
|
9787
10087
|
delete c.async,
|
|
@@ -9790,14 +10090,14 @@ async function We(e, t) {
|
|
|
9790
10090
|
delete c.api_key,
|
|
9791
10091
|
delete c.api_url,
|
|
9792
10092
|
delete c.count);
|
|
9793
|
-
let p =
|
|
9794
|
-
(
|
|
9795
|
-
typeof p.image == 'string' && !p.images && !
|
|
10093
|
+
let p = ra(n, c);
|
|
10094
|
+
(Wi(p),
|
|
10095
|
+
typeof p.image == 'string' && !p.images && !we(n) && ((p.images = [p.image]), delete p.image),
|
|
9796
10096
|
p.image_url &&
|
|
9797
10097
|
!p.first_frame_image &&
|
|
9798
10098
|
(e.startsWith('seedance') || e.startsWith('happy-horse')) &&
|
|
9799
10099
|
(p.first_frame_image = p.image_url));
|
|
9800
|
-
let d = new
|
|
10100
|
+
let d = new M(a, i),
|
|
9801
10101
|
m = [
|
|
9802
10102
|
'image',
|
|
9803
10103
|
'mask_image',
|
|
@@ -9809,78 +10109,78 @@ async function We(e, t) {
|
|
|
9809
10109
|
'image_url',
|
|
9810
10110
|
'video_url',
|
|
9811
10111
|
];
|
|
9812
|
-
for (let
|
|
9813
|
-
let g = p[
|
|
10112
|
+
for (let k of m) {
|
|
10113
|
+
let g = p[k];
|
|
9814
10114
|
if (typeof g == 'string' && !g.startsWith('http://') && !g.startsWith('https://')) {
|
|
9815
|
-
let
|
|
9816
|
-
if (
|
|
9817
|
-
let
|
|
9818
|
-
s ||
|
|
10115
|
+
let P = q.default.resolve(g);
|
|
10116
|
+
if (U.default.existsSync(P) && U.default.statSync(P).isFile()) {
|
|
10117
|
+
let I = new E(`Uploading local file ${q.default.basename(P)} to CDN...`);
|
|
10118
|
+
s || I.start();
|
|
9819
10119
|
try {
|
|
9820
|
-
let
|
|
9821
|
-
|
|
9822
|
-
((p[
|
|
9823
|
-
} catch (
|
|
9824
|
-
let
|
|
10120
|
+
let N = U.default.readFileSync(P),
|
|
10121
|
+
O = await d.uploadAsset(N.toString('base64'));
|
|
10122
|
+
((p[k] = O.url), s || I.succeed(`Uploaded ${q.default.basename(P)} to CDN`));
|
|
10123
|
+
} catch (N) {
|
|
10124
|
+
let O = N instanceof Error ? N.message : String(N);
|
|
9825
10125
|
(s
|
|
9826
10126
|
? process.stdout.write(
|
|
9827
|
-
JSON.stringify({ error:
|
|
10127
|
+
JSON.stringify({ error: O }) +
|
|
9828
10128
|
`
|
|
9829
10129
|
`,
|
|
9830
10130
|
)
|
|
9831
|
-
:
|
|
10131
|
+
: I.fail(`Upload failed: ${O}`),
|
|
9832
10132
|
process.exit(1));
|
|
9833
10133
|
}
|
|
9834
10134
|
}
|
|
9835
10135
|
}
|
|
9836
10136
|
}
|
|
9837
|
-
await
|
|
9838
|
-
let g = new
|
|
10137
|
+
await Xi(p, async (k) => {
|
|
10138
|
+
let g = new E(`Uploading local file ${q.default.basename(k)} to CDN...`);
|
|
9839
10139
|
s || g.start();
|
|
9840
10140
|
try {
|
|
9841
|
-
let
|
|
9842
|
-
|
|
9843
|
-
return (s || g.succeed(`Uploaded ${
|
|
9844
|
-
} catch (
|
|
9845
|
-
let
|
|
10141
|
+
let P = U.default.readFileSync(k),
|
|
10142
|
+
I = await d.uploadAsset(P.toString('base64'));
|
|
10143
|
+
return (s || g.succeed(`Uploaded ${q.default.basename(k)} to CDN`), I.url);
|
|
10144
|
+
} catch (P) {
|
|
10145
|
+
let I = P instanceof Error ? P.message : String(P);
|
|
9846
10146
|
(s
|
|
9847
10147
|
? process.stdout.write(
|
|
9848
|
-
JSON.stringify({ error:
|
|
10148
|
+
JSON.stringify({ error: I }) +
|
|
9849
10149
|
`
|
|
9850
10150
|
`,
|
|
9851
10151
|
)
|
|
9852
|
-
: g.fail(`Upload failed: ${
|
|
10152
|
+
: g.fail(`Upload failed: ${I}`),
|
|
9853
10153
|
process.exit(1));
|
|
9854
10154
|
}
|
|
9855
10155
|
});
|
|
9856
|
-
let
|
|
9857
|
-
s ||
|
|
10156
|
+
let y = new E(`Submitting task for ${r.bold(e)}...`);
|
|
10157
|
+
s || y.start();
|
|
9858
10158
|
let f;
|
|
9859
10159
|
try {
|
|
9860
10160
|
if (l > 1) {
|
|
9861
|
-
await
|
|
10161
|
+
await Zi(d, e, p, l, { isJson: s, isAsync: o });
|
|
9862
10162
|
return;
|
|
9863
10163
|
}
|
|
9864
10164
|
f = await d.queueJob(e, p);
|
|
9865
|
-
} catch (
|
|
9866
|
-
let g =
|
|
10165
|
+
} catch (k) {
|
|
10166
|
+
let g = k instanceof b ? k : null;
|
|
9867
10167
|
(s
|
|
9868
10168
|
? process.stdout.write(
|
|
9869
10169
|
JSON.stringify(
|
|
9870
10170
|
g
|
|
9871
10171
|
? { error: { code: g.code ?? null, message: g.message, ...g.fields } }
|
|
9872
|
-
: { error: { code: null, message:
|
|
10172
|
+
: { error: { code: null, message: k instanceof Error ? k.message : String(k) } },
|
|
9873
10173
|
null,
|
|
9874
10174
|
2,
|
|
9875
10175
|
) +
|
|
9876
10176
|
`
|
|
9877
10177
|
`,
|
|
9878
10178
|
)
|
|
9879
|
-
:
|
|
10179
|
+
: y.fail(
|
|
9880
10180
|
g
|
|
9881
|
-
?
|
|
10181
|
+
? K(g).join(`
|
|
9882
10182
|
`)
|
|
9883
|
-
: `Failed to start generation: ${
|
|
10183
|
+
: `Failed to start generation: ${k instanceof Error ? k.message : k}`,
|
|
9884
10184
|
),
|
|
9885
10185
|
process.exit(g ? g.exitCode : v));
|
|
9886
10186
|
}
|
|
@@ -9891,25 +10191,25 @@ async function We(e, t) {
|
|
|
9891
10191
|
`
|
|
9892
10192
|
`,
|
|
9893
10193
|
)
|
|
9894
|
-
: (
|
|
9895
|
-
process.stdout.write(`Check status anytime with: ${
|
|
10194
|
+
: (y.succeed(`Queued successfully! Request ID: ${r.bold(f.request_id)}`),
|
|
10195
|
+
process.stdout.write(`Check status anytime with: ${r.cyan(`tein status ${f.request_id}`)}
|
|
9896
10196
|
`));
|
|
9897
10197
|
return;
|
|
9898
10198
|
}
|
|
9899
|
-
let
|
|
9900
|
-
|
|
10199
|
+
let _e = Date.now(),
|
|
10200
|
+
Pe = 1500;
|
|
9901
10201
|
for (; f.status === 'processing';) {
|
|
9902
|
-
let
|
|
9903
|
-
(s ||
|
|
9904
|
-
await new Promise((g) => setTimeout(g,
|
|
10202
|
+
let k = Math.round((Date.now() - _e) / 1e3);
|
|
10203
|
+
(s || y.update(`Rendering ${r.bold(e)} (${k}s elapsed)... [ID: ${f.request_id}]`),
|
|
10204
|
+
await new Promise((g) => setTimeout(g, Pe)));
|
|
9905
10205
|
try {
|
|
9906
10206
|
f = await d.getStatus(f.request_id);
|
|
9907
10207
|
} catch (g) {
|
|
9908
|
-
g instanceof
|
|
10208
|
+
g instanceof b &&
|
|
9909
10209
|
g.exitCode !== v &&
|
|
9910
10210
|
(s ||
|
|
9911
|
-
|
|
9912
|
-
|
|
10211
|
+
y.fail(
|
|
10212
|
+
K(g).join(`
|
|
9913
10213
|
`),
|
|
9914
10214
|
),
|
|
9915
10215
|
process.exit(g.exitCode));
|
|
@@ -9923,9 +10223,9 @@ async function We(e, t) {
|
|
|
9923
10223
|
`
|
|
9924
10224
|
`,
|
|
9925
10225
|
)
|
|
9926
|
-
:
|
|
10226
|
+
: y.fail(`Generation ${f.status}: ${f.error || 'Something failed on our side.'}`),
|
|
9927
10227
|
process.exit(v)),
|
|
9928
|
-
s ||
|
|
10228
|
+
s || y.succeed(`Generation completed for ${r.bold(n?.name || e)}!`),
|
|
9929
10229
|
s)
|
|
9930
10230
|
) {
|
|
9931
10231
|
process.stdout.write(
|
|
@@ -9938,150 +10238,150 @@ async function We(e, t) {
|
|
|
9938
10238
|
if (
|
|
9939
10239
|
(process.stdout.write(`
|
|
9940
10240
|
`),
|
|
9941
|
-
process.stdout.write(` ${
|
|
10241
|
+
process.stdout.write(` ${r.bold('Status:')} ${r.green('Succeeded')}
|
|
9942
10242
|
`),
|
|
9943
|
-
process.stdout.write(` ${
|
|
10243
|
+
process.stdout.write(` ${r.bold('Request ID:')} ${f.request_id}
|
|
9944
10244
|
`),
|
|
9945
10245
|
f.usage?.cost !== void 0 &&
|
|
9946
|
-
process.stdout.write(` ${
|
|
10246
|
+
process.stdout.write(` ${r.bold('Cost:')} ${Se(f.usage.cost)}
|
|
9947
10247
|
`),
|
|
9948
10248
|
f.output && f.output.length > 0)
|
|
9949
10249
|
) {
|
|
9950
10250
|
process.stdout.write(`
|
|
9951
|
-
${
|
|
10251
|
+
${r.bold('Outputs:')}
|
|
9952
10252
|
`);
|
|
9953
|
-
let
|
|
10253
|
+
let k = f.output.filter((P) => P.url).length,
|
|
9954
10254
|
g = 0;
|
|
9955
|
-
for (let
|
|
9956
|
-
let
|
|
9957
|
-
if (
|
|
9958
|
-
let
|
|
10255
|
+
for (let P = 0; P < f.output.length; P++) {
|
|
10256
|
+
let I = f.output[P];
|
|
10257
|
+
if (I.url) {
|
|
10258
|
+
let N = I.layer?.name ? ` ${r.bold(I.layer.name)}` : '';
|
|
9959
10259
|
if (
|
|
9960
|
-
(process.stdout.write(` [${
|
|
10260
|
+
(process.stdout.write(` [${I.type.toUpperCase()}]${N} ${r.cyan(r.underline(I.url))}
|
|
9961
10261
|
`),
|
|
9962
10262
|
u)
|
|
9963
10263
|
) {
|
|
9964
|
-
let
|
|
9965
|
-
|
|
10264
|
+
let O = er(u, g++, k),
|
|
10265
|
+
pt = new E(`Downloading output to ${O}...`).start();
|
|
9966
10266
|
try {
|
|
9967
|
-
(await d.downloadOutput(
|
|
9968
|
-
|
|
9969
|
-
} catch (
|
|
9970
|
-
|
|
10267
|
+
(await d.downloadOutput(I.url, q.default.resolve(process.cwd(), O)),
|
|
10268
|
+
pt.succeed(`Saved to ${r.bold(O)}`));
|
|
10269
|
+
} catch (Ie) {
|
|
10270
|
+
pt.fail(`Failed to download: ${Ie instanceof Error ? Ie.message : Ie}`);
|
|
9971
10271
|
}
|
|
9972
10272
|
}
|
|
9973
10273
|
} else
|
|
9974
|
-
|
|
10274
|
+
I.text &&
|
|
9975
10275
|
process.stdout.write(`
|
|
9976
|
-
${
|
|
10276
|
+
${I.text}
|
|
9977
10277
|
`);
|
|
9978
10278
|
}
|
|
9979
10279
|
}
|
|
9980
10280
|
process.stdout.write(`
|
|
9981
10281
|
`);
|
|
9982
10282
|
}
|
|
9983
|
-
var
|
|
9984
|
-
|
|
9985
|
-
async function
|
|
10283
|
+
var oa = T(require('node:readline'));
|
|
10284
|
+
$();
|
|
10285
|
+
async function tr(e) {
|
|
9986
10286
|
try {
|
|
9987
|
-
return (await new
|
|
10287
|
+
return (await new M(e, w()).checkKey(), 'ok');
|
|
9988
10288
|
} catch (t) {
|
|
9989
|
-
if (t instanceof
|
|
10289
|
+
if (t instanceof b) {
|
|
9990
10290
|
if (t.status === 401) return 'invalid';
|
|
9991
10291
|
if (t.status === 403) return 'blocked';
|
|
9992
10292
|
}
|
|
9993
10293
|
return 'unchecked';
|
|
9994
10294
|
}
|
|
9995
10295
|
}
|
|
9996
|
-
function
|
|
9997
|
-
let t =
|
|
9998
|
-
return new Promise((
|
|
10296
|
+
function ar(e) {
|
|
10297
|
+
let t = oa.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
10298
|
+
return new Promise((a) => {
|
|
9999
10299
|
t.question(e, (i) => {
|
|
10000
|
-
(t.close(),
|
|
10300
|
+
(t.close(), a(i.trim()));
|
|
10001
10301
|
});
|
|
10002
10302
|
});
|
|
10003
10303
|
}
|
|
10004
|
-
async function
|
|
10304
|
+
async function ae(e, t) {
|
|
10005
10305
|
switch (e) {
|
|
10006
10306
|
case 'login':
|
|
10007
10307
|
case 'set-key': {
|
|
10008
|
-
let
|
|
10009
|
-
(
|
|
10308
|
+
let a = t?.trim() || '';
|
|
10309
|
+
(a ||
|
|
10010
10310
|
(process.stdout.write(`
|
|
10011
|
-
${
|
|
10311
|
+
${r.bold('Tein AI Authentication')}
|
|
10012
10312
|
`),
|
|
10013
|
-
process.stdout.write(`Get your API key at: ${
|
|
10313
|
+
process.stdout.write(`Get your API key at: ${r.cyan('https://tein.ai/dashboard/keys')}
|
|
10014
10314
|
|
|
10015
10315
|
`),
|
|
10016
|
-
(
|
|
10017
|
-
!
|
|
10018
|
-
!
|
|
10316
|
+
(a = await ar('Enter your Tein API Key (sk_live_...): '))),
|
|
10317
|
+
!a.startsWith('sk_live_') &&
|
|
10318
|
+
!a.startsWith('sk_test_') &&
|
|
10019
10319
|
(process.stderr
|
|
10020
|
-
.write(`${
|
|
10320
|
+
.write(`${r.red('Error:')} Invalid key format. Tein API keys start with 'sk_live_' or 'sk_test_'.
|
|
10021
10321
|
`),
|
|
10022
10322
|
process.exit(1)));
|
|
10023
|
-
let i = await
|
|
10323
|
+
let i = await tr(a);
|
|
10024
10324
|
(i === 'invalid' &&
|
|
10025
10325
|
(process.stderr
|
|
10026
|
-
.write(`${
|
|
10326
|
+
.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
10327
|
`),
|
|
10028
10328
|
process.exit(1)),
|
|
10029
|
-
|
|
10329
|
+
Ke({ apiKey: a }),
|
|
10030
10330
|
process.stdout.write(`
|
|
10031
|
-
${
|
|
10331
|
+
${r.green('\u2713')} API key saved to ${r.dim(oe())}
|
|
10032
10332
|
`),
|
|
10033
10333
|
i === 'blocked'
|
|
10034
10334
|
? process.stdout
|
|
10035
|
-
.write(`${
|
|
10335
|
+
.write(`${r.yellow('\u2139')} The key is valid, but this account cannot run requests right now. Check your dashboard.
|
|
10036
10336
|
`)
|
|
10037
10337
|
: i === 'unchecked' &&
|
|
10038
10338
|
process.stdout
|
|
10039
|
-
.write(`${
|
|
10339
|
+
.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
10340
|
`),
|
|
10041
10341
|
process.stdout
|
|
10042
|
-
.write(`You can now run models directly using: ${
|
|
10342
|
+
.write(`You can now run models directly using: ${r.cyan('tein run <model-slug> --prompt "..."')}
|
|
10043
10343
|
|
|
10044
10344
|
`));
|
|
10045
10345
|
break;
|
|
10046
10346
|
}
|
|
10047
10347
|
case 'logout': {
|
|
10048
|
-
if (!
|
|
10348
|
+
if (!j().apiKey) {
|
|
10049
10349
|
process.stdout
|
|
10050
|
-
.write(`${
|
|
10350
|
+
.write(`${r.yellow('\u2139')} No active API key found. You are already logged out.
|
|
10051
10351
|
`);
|
|
10052
10352
|
break;
|
|
10053
10353
|
}
|
|
10054
|
-
(
|
|
10354
|
+
(Ke({ apiKey: '' }),
|
|
10055
10355
|
process.stdout
|
|
10056
|
-
.write(`${
|
|
10356
|
+
.write(`${r.green('\u2713')} Logged out successfully. Stored API key has been cleared from ${r.dim(oe())}
|
|
10057
10357
|
`));
|
|
10058
10358
|
break;
|
|
10059
10359
|
}
|
|
10060
10360
|
default: {
|
|
10061
|
-
let
|
|
10062
|
-
i =
|
|
10063
|
-
n =
|
|
10361
|
+
let a = S(),
|
|
10362
|
+
i = w(),
|
|
10363
|
+
n = j();
|
|
10064
10364
|
if (
|
|
10065
10365
|
(process.stdout.write(`
|
|
10066
|
-
${
|
|
10366
|
+
${r.bold('Tein AI CLI Configuration')}
|
|
10067
10367
|
`),
|
|
10068
|
-
process.stdout.write(` Config file: ${
|
|
10368
|
+
process.stdout.write(` Config file: ${r.dim(oe())}
|
|
10069
10369
|
`),
|
|
10070
|
-
process.stdout.write(` API URL: ${
|
|
10370
|
+
process.stdout.write(` API URL: ${r.cyan(i)}
|
|
10071
10371
|
`),
|
|
10072
|
-
!
|
|
10372
|
+
!a)
|
|
10073
10373
|
)
|
|
10074
|
-
(process.stdout.write(` API Key: ${
|
|
10374
|
+
(process.stdout.write(` API Key: ${r.red('Not configured')}
|
|
10075
10375
|
|
|
10076
10376
|
`),
|
|
10077
10377
|
process.stdout
|
|
10078
|
-
.write(`Run ${
|
|
10378
|
+
.write(`Run ${r.cyan('tein auth login')} or set ${r.cyan('TEIN_API_KEY')} environment variable.
|
|
10079
10379
|
|
|
10080
10380
|
`));
|
|
10081
10381
|
else {
|
|
10082
|
-
let s = `${
|
|
10382
|
+
let s = `${a.slice(0, 10)}...${a.slice(-4)}`;
|
|
10083
10383
|
process.stdout
|
|
10084
|
-
.write(` API Key: ${
|
|
10384
|
+
.write(` API Key: ${r.green(s)} (${a.startsWith('sk_live_') ? 'Live Key' : 'Test Key'})
|
|
10085
10385
|
|
|
10086
10386
|
`);
|
|
10087
10387
|
}
|
|
@@ -10089,44 +10389,278 @@ ${a.bold('Tein AI CLI Configuration')}
|
|
|
10089
10389
|
}
|
|
10090
10390
|
}
|
|
10091
10391
|
}
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10392
|
+
$();
|
|
10393
|
+
function _(e) {
|
|
10394
|
+
return e !== 0 && Math.abs(e) < 0.01
|
|
10395
|
+
? `$${e.toFixed(6).replace(/0+$/, '').replace(/\.$/, '')}`
|
|
10396
|
+
: `$${e.toFixed(2)}`;
|
|
10397
|
+
}
|
|
10398
|
+
function la(e) {
|
|
10399
|
+
return `${e} ${e === 1 ? 'request' : 'requests'}`;
|
|
10400
|
+
}
|
|
10401
|
+
function ir(e) {
|
|
10402
|
+
let t = [
|
|
10403
|
+
['Balance', _(e.balance)],
|
|
10404
|
+
['Available to this key', _(e.available)],
|
|
10405
|
+
];
|
|
10406
|
+
if (
|
|
10407
|
+
(e.on_hold > 0 && t.push(['On hold', `${_(e.on_hold)} (not spendable)`]), e.credits_from_tein)
|
|
10408
|
+
) {
|
|
10409
|
+
let n = e.credits_from_tein.next_expires_at
|
|
10410
|
+
? `, next expire ${e.credits_from_tein.next_expires_at.slice(0, 10)}`
|
|
10411
|
+
: '';
|
|
10412
|
+
t.push(['Credits from Tein', `${_(e.credits_from_tein.amount)}${n}`]);
|
|
10413
|
+
}
|
|
10414
|
+
let a = e.key.spending_limit;
|
|
10415
|
+
(a &&
|
|
10416
|
+
t.push([
|
|
10417
|
+
`Key limit (${a.period})`,
|
|
10418
|
+
`${_(a.remaining)} left of ${_(a.amount)}${a.resets_at ? `, resets ${a.resets_at.slice(0, 10)}` : ''}`,
|
|
10419
|
+
]),
|
|
10420
|
+
t.push(
|
|
10421
|
+
['This month', `${_(e.usage.this_month.spend)} on ${la(e.usage.this_month.requests)}`],
|
|
10422
|
+
['Last 30 days', `${_(e.usage.last_30_days.spend)} on ${la(e.usage.last_30_days.requests)}`],
|
|
10423
|
+
[
|
|
10424
|
+
'Auto top up',
|
|
10425
|
+
e.auto_top_up.enabled
|
|
10426
|
+
? `on, adds ${_(e.auto_top_up.amount)} below ${_(e.auto_top_up.threshold)}`
|
|
10427
|
+
: 'off',
|
|
10428
|
+
],
|
|
10429
|
+
['Workspace', `${e.workspace.name} (${e.workspace.plan.name})`],
|
|
10430
|
+
['Key', `${e.key.name} (${e.key.env})`],
|
|
10431
|
+
));
|
|
10432
|
+
let i = Math.max(...t.map(([n]) => n.length));
|
|
10433
|
+
return t.map(([n, s]) => ` ${n.padEnd(i)} ${s}`);
|
|
10434
|
+
}
|
|
10435
|
+
async function pa(e) {
|
|
10436
|
+
let t = S(typeof e.api_key == 'string' ? e.api_key : void 0),
|
|
10437
|
+
a = w(typeof e.api_url == 'string' ? e.api_url : void 0),
|
|
10438
|
+
i = !!e.json;
|
|
10439
|
+
t ||
|
|
10440
|
+
(process.stderr.write(`${r.red('Error:')} Authentication required.
|
|
10441
|
+
`),
|
|
10442
|
+
process.stderr
|
|
10443
|
+
.write(`Please run ${r.cyan('tein auth login')} or set ${r.cyan('TEIN_API_KEY')} environment variable.
|
|
10444
|
+
`),
|
|
10445
|
+
process.exit(1));
|
|
10446
|
+
let n;
|
|
10447
|
+
try {
|
|
10448
|
+
n = await new M(t, a).getBalance();
|
|
10449
|
+
} catch (s) {
|
|
10450
|
+
(s instanceof b &&
|
|
10451
|
+
(i
|
|
10452
|
+
? process.stdout.write(
|
|
10453
|
+
JSON.stringify(
|
|
10454
|
+
{ error: { code: s.code ?? null, message: s.message, ...s.fields } },
|
|
10455
|
+
null,
|
|
10456
|
+
2,
|
|
10457
|
+
) +
|
|
10458
|
+
`
|
|
10459
|
+
`,
|
|
10460
|
+
)
|
|
10461
|
+
: process.stderr.write(`${r.red('Error:')} ${K(s).join(`
|
|
10462
|
+
`)}
|
|
10463
|
+
`),
|
|
10464
|
+
process.exit(s.exitCode)),
|
|
10465
|
+
process.stderr.write(`${r.red('Error:')} ${s instanceof Error ? s.message : String(s)}
|
|
10466
|
+
`),
|
|
10467
|
+
process.exit(v));
|
|
10468
|
+
}
|
|
10469
|
+
if (i) {
|
|
10470
|
+
process.stdout.write(
|
|
10471
|
+
JSON.stringify(n, null, 2) +
|
|
10472
|
+
`
|
|
10473
|
+
`,
|
|
10474
|
+
);
|
|
10475
|
+
return;
|
|
10476
|
+
}
|
|
10477
|
+
process.stdout.write(`
|
|
10478
|
+
${r.bold('Tein balance')}
|
|
10479
|
+
${ir(n).join(`
|
|
10480
|
+
`)}
|
|
10481
|
+
|
|
10482
|
+
`);
|
|
10483
|
+
}
|
|
10484
|
+
$();
|
|
10485
|
+
function da(e) {
|
|
10486
|
+
let t = S(typeof e.api_key == 'string' ? e.api_key : void 0),
|
|
10487
|
+
a = w(typeof e.api_url == 'string' ? e.api_url : void 0);
|
|
10488
|
+
return (
|
|
10489
|
+
t ||
|
|
10490
|
+
(process.stderr.write(`${r.red('Error:')} Authentication required.
|
|
10491
|
+
`),
|
|
10492
|
+
process.stderr
|
|
10493
|
+
.write(`Please run ${r.cyan('tein auth login')} or set ${r.cyan('TEIN_API_KEY')} environment variable.
|
|
10494
|
+
`),
|
|
10495
|
+
process.exit(1)),
|
|
10496
|
+
new M(t, a)
|
|
10497
|
+
);
|
|
10498
|
+
}
|
|
10499
|
+
function ca(e, t) {
|
|
10500
|
+
let a = {};
|
|
10501
|
+
for (let i of t) {
|
|
10502
|
+
let n = e[i];
|
|
10503
|
+
(typeof n == 'string' || typeof n == 'number') && (a[i] = String(n));
|
|
10504
|
+
}
|
|
10505
|
+
return a;
|
|
10506
|
+
}
|
|
10507
|
+
async function ua(e, t) {
|
|
10097
10508
|
try {
|
|
10098
|
-
|
|
10509
|
+
return await t();
|
|
10510
|
+
} catch (a) {
|
|
10511
|
+
(a instanceof b &&
|
|
10512
|
+
(e
|
|
10513
|
+
? process.stdout.write(
|
|
10514
|
+
JSON.stringify(
|
|
10515
|
+
{ error: { code: a.code ?? null, message: a.message, ...a.fields } },
|
|
10516
|
+
null,
|
|
10517
|
+
2,
|
|
10518
|
+
) +
|
|
10519
|
+
`
|
|
10520
|
+
`,
|
|
10521
|
+
)
|
|
10522
|
+
: process.stderr.write(`${r.red('Error:')} ${K(a).join(`
|
|
10523
|
+
`)}
|
|
10524
|
+
`),
|
|
10525
|
+
process.exit(a.exitCode)),
|
|
10526
|
+
process.stderr.write(`${r.red('Error:')} ${a instanceof Error ? a.message : String(a)}
|
|
10527
|
+
`),
|
|
10528
|
+
process.exit(v));
|
|
10529
|
+
}
|
|
10530
|
+
}
|
|
10531
|
+
function Ze(e) {
|
|
10532
|
+
let t = e[0].map((i, n) => Math.max(...e.map((s) => s[n].length))),
|
|
10533
|
+
a = (i) => e.slice(1).every((n) => /^[-+$\d]/.test(n[i]));
|
|
10534
|
+
return e.map(
|
|
10535
|
+
(i) =>
|
|
10536
|
+
` ${i
|
|
10537
|
+
.map((n, s) => (s > 0 && a(s) ? n.padStart(t[s]) : n.padEnd(t[s])))
|
|
10538
|
+
.join(' ')
|
|
10539
|
+
.trimEnd()}`,
|
|
10540
|
+
);
|
|
10541
|
+
}
|
|
10542
|
+
function rr(e) {
|
|
10543
|
+
let t = e.summary,
|
|
10544
|
+
a = [
|
|
10545
|
+
` 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}` : ''}`,
|
|
10546
|
+
` Spent ${_(t.spend)} on ${t.requests} requests (${t.succeeded} succeeded, ${t.failed} failed${t.running ? `, ${t.running} running` : ''})`,
|
|
10547
|
+
` Daily burn ${_(t.daily_burn)}`,
|
|
10548
|
+
` This key ${_(e.this_key.spend)} on ${e.this_key.requests} requests`,
|
|
10549
|
+
];
|
|
10550
|
+
return (
|
|
10551
|
+
e.by_channel.length &&
|
|
10552
|
+
(a.push('', r.bold('By channel')),
|
|
10553
|
+
a.push(
|
|
10554
|
+
...Ze([
|
|
10555
|
+
['Channel', 'Spend', 'Requests'],
|
|
10556
|
+
...e.by_channel.map((i) => [i.channel, _(i.spend), String(i.requests)]),
|
|
10557
|
+
]),
|
|
10558
|
+
)),
|
|
10559
|
+
e.by_model.length &&
|
|
10560
|
+
(a.push('', r.bold('By model')),
|
|
10561
|
+
a.push(
|
|
10562
|
+
...Ze([
|
|
10563
|
+
['Model', 'Spend', 'Requests', 'Failed'],
|
|
10564
|
+
...e.by_model.map((i) => [i.name, _(i.spend), String(i.requests), String(i.failed)]),
|
|
10565
|
+
]),
|
|
10566
|
+
)),
|
|
10567
|
+
a
|
|
10568
|
+
);
|
|
10569
|
+
}
|
|
10570
|
+
async function ma(e) {
|
|
10571
|
+
let t = !!e.json,
|
|
10572
|
+
a = da(e),
|
|
10573
|
+
i = await ua(t, () => a.getUsage(ca(e, ['range', 'from', 'to', 'model', 'channel'])));
|
|
10574
|
+
if (t) {
|
|
10575
|
+
process.stdout.write(
|
|
10576
|
+
JSON.stringify(i, null, 2) +
|
|
10577
|
+
`
|
|
10578
|
+
`,
|
|
10579
|
+
);
|
|
10580
|
+
return;
|
|
10581
|
+
}
|
|
10582
|
+
process.stdout.write(`
|
|
10583
|
+
${r.bold('Tein usage')}
|
|
10584
|
+
${rr(i).join(`
|
|
10585
|
+
`)}
|
|
10586
|
+
|
|
10587
|
+
`);
|
|
10588
|
+
}
|
|
10589
|
+
function nr(e) {
|
|
10590
|
+
return e.data.length
|
|
10591
|
+
? Ze([
|
|
10592
|
+
['When (UTC)', 'Amount', 'Balance after', 'What'],
|
|
10593
|
+
...e.data.map((t) => [
|
|
10594
|
+
t.created_at.slice(0, 16).replace('T', ' '),
|
|
10595
|
+
`${t.amount >= 0 ? '+' : '-'}${_(Math.abs(t.amount))}`,
|
|
10596
|
+
_(t.balance_after),
|
|
10597
|
+
`${t.description}${t.job_id ? ` (${t.job_id})` : ''}`,
|
|
10598
|
+
]),
|
|
10599
|
+
])
|
|
10600
|
+
: [' No transactions yet.'];
|
|
10601
|
+
}
|
|
10602
|
+
async function fa(e) {
|
|
10603
|
+
let t = !!e.json,
|
|
10604
|
+
a = da(e),
|
|
10605
|
+
i = await ua(t, () => a.getTransactions(ca(e, ['limit', 'type', 'after'])));
|
|
10606
|
+
if (t) {
|
|
10607
|
+
process.stdout.write(
|
|
10608
|
+
JSON.stringify(i, null, 2) +
|
|
10609
|
+
`
|
|
10610
|
+
`,
|
|
10611
|
+
);
|
|
10612
|
+
return;
|
|
10613
|
+
}
|
|
10614
|
+
let n =
|
|
10615
|
+
i.has_more && i.next_cursor
|
|
10616
|
+
? `
|
|
10617
|
+
More: tein transactions --after ${i.next_cursor}`
|
|
10618
|
+
: '';
|
|
10619
|
+
process.stdout.write(`
|
|
10620
|
+
${r.bold('Tein balance history')}
|
|
10621
|
+
${nr(i).join(`
|
|
10622
|
+
`)}${n}
|
|
10623
|
+
|
|
10624
|
+
`);
|
|
10625
|
+
}
|
|
10626
|
+
$();
|
|
10627
|
+
Ce();
|
|
10628
|
+
ee();
|
|
10629
|
+
var sr = 3e3;
|
|
10630
|
+
async function ga(e) {
|
|
10631
|
+
try {
|
|
10632
|
+
let t = await fetch(`${w(e)}/v1/pricing`, { signal: AbortSignal.timeout(sr) });
|
|
10099
10633
|
if (!t.ok) return;
|
|
10100
|
-
let
|
|
10634
|
+
let a = await t.json(),
|
|
10101
10635
|
i = {};
|
|
10102
|
-
for (let n of
|
|
10636
|
+
for (let n of a.configs ?? []) {
|
|
10103
10637
|
let s = String(n.modelSlug ?? '');
|
|
10104
|
-
|
|
10638
|
+
J.has(s) && (i[s] ??= []).push(Number(n.starterPrice));
|
|
10105
10639
|
}
|
|
10106
|
-
|
|
10640
|
+
Qt(i);
|
|
10107
10641
|
} catch {}
|
|
10108
10642
|
}
|
|
10109
|
-
var
|
|
10110
|
-
|
|
10111
|
-
async function
|
|
10112
|
-
await
|
|
10113
|
-
let
|
|
10643
|
+
var or = new Set(['video', 'image', 'text', 'audio', '3d']),
|
|
10644
|
+
lr = { llm: 'text', chat: 'text', reasoning: 'text' };
|
|
10645
|
+
async function ha(e, t) {
|
|
10646
|
+
await ga(t);
|
|
10647
|
+
let a = D();
|
|
10114
10648
|
if (e) {
|
|
10115
10649
|
let s = e.toLowerCase(),
|
|
10116
|
-
o =
|
|
10117
|
-
|
|
10118
|
-
?
|
|
10119
|
-
:
|
|
10650
|
+
o = lr[s] ?? s;
|
|
10651
|
+
a = or.has(o)
|
|
10652
|
+
? a.filter((u) => u.category.toLowerCase() === o)
|
|
10653
|
+
: a.filter((u) => u.kind.toLowerCase().includes(s) || u.slug.toLowerCase().includes(s));
|
|
10120
10654
|
}
|
|
10121
10655
|
(process.stdout.write(`
|
|
10122
|
-
${
|
|
10656
|
+
${r.bold('Tein AI Models Catalog')} (${a.length} available)
|
|
10123
10657
|
`),
|
|
10124
10658
|
process.stdout
|
|
10125
|
-
.write(`${
|
|
10659
|
+
.write(`${r.dim('Run `tein info <model-slug>` to see detailed parameters and options.')}
|
|
10126
10660
|
|
|
10127
10661
|
`));
|
|
10128
10662
|
let i = {};
|
|
10129
|
-
for (let s of
|
|
10663
|
+
for (let s of a) {
|
|
10130
10664
|
let o = s.category;
|
|
10131
10665
|
(i[o] || (i[o] = []), i[o].push(s));
|
|
10132
10666
|
}
|
|
@@ -10134,13 +10668,13 @@ ${a.bold('Tein AI Models Catalog')} (${r.length} available)
|
|
|
10134
10668
|
for (let s of n) {
|
|
10135
10669
|
let o = i[s];
|
|
10136
10670
|
if (!(!o || o.length === 0)) {
|
|
10137
|
-
process.stdout.write(`${
|
|
10671
|
+
process.stdout.write(`${r.bold(r.cyan(`\u2500\u2500 ${s} Models \u2500\u2500`))}
|
|
10138
10672
|
`);
|
|
10139
10673
|
for (let u of o) {
|
|
10140
10674
|
let l = u.slug.padEnd(24),
|
|
10141
10675
|
c = u.name.padEnd(22),
|
|
10142
10676
|
p = u.priceFormatted.padEnd(22);
|
|
10143
|
-
process.stdout.write(` ${
|
|
10677
|
+
process.stdout.write(` ${r.bold(l)} ${r.gray(c)} ${r.green(p)} ${r.dim(u.vendor)}
|
|
10144
10678
|
`);
|
|
10145
10679
|
}
|
|
10146
10680
|
process.stdout.write(`
|
|
@@ -10148,50 +10682,50 @@ ${a.bold('Tein AI Models Catalog')} (${r.length} available)
|
|
|
10148
10682
|
}
|
|
10149
10683
|
}
|
|
10150
10684
|
process.stdout
|
|
10151
|
-
.write(`${
|
|
10685
|
+
.write(`${r.dim('Tip:')} Generate directly with ${r.cyan('tein run <model-slug> --prompt "..."')}
|
|
10152
10686
|
|
|
10153
10687
|
`);
|
|
10154
10688
|
}
|
|
10155
|
-
async function
|
|
10156
|
-
|
|
10157
|
-
let
|
|
10158
|
-
(
|
|
10159
|
-
(process.stderr.write(`${
|
|
10689
|
+
async function ya(e, t) {
|
|
10690
|
+
J.has(e) && (await ga(t));
|
|
10691
|
+
let a = H(e);
|
|
10692
|
+
(a ||
|
|
10693
|
+
(process.stderr.write(`${r.red('Error:')} Model "${e}" not found in Tein AI registry.
|
|
10160
10694
|
`),
|
|
10161
|
-
process.stderr.write(`Run ${
|
|
10695
|
+
process.stderr.write(`Run ${r.cyan('tein models')} to see all available model slugs.
|
|
10162
10696
|
`),
|
|
10163
10697
|
process.exit(1)),
|
|
10164
10698
|
process.stdout.write(`
|
|
10165
|
-
${
|
|
10699
|
+
${r.bold(r.cyan(a.name))} (${r.bold(a.slug)})
|
|
10166
10700
|
`),
|
|
10167
|
-
process.stdout.write(` ${
|
|
10701
|
+
process.stdout.write(` ${r.gray(a.description)}
|
|
10168
10702
|
|
|
10169
10703
|
`),
|
|
10170
|
-
process.stdout.write(`${
|
|
10704
|
+
process.stdout.write(`${r.bold('Metadata:')}
|
|
10171
10705
|
`),
|
|
10172
|
-
process.stdout.write(` Category: ${
|
|
10706
|
+
process.stdout.write(` Category: ${r.yellow(a.category)}
|
|
10173
10707
|
`),
|
|
10174
|
-
process.stdout.write(` Kind: ${
|
|
10708
|
+
process.stdout.write(` Kind: ${a.kind}
|
|
10175
10709
|
`),
|
|
10176
|
-
process.stdout.write(` Vendor: ${
|
|
10710
|
+
process.stdout.write(` Vendor: ${a.vendor}
|
|
10177
10711
|
`),
|
|
10178
|
-
process.stdout.write(` Pricing: ${
|
|
10712
|
+
process.stdout.write(` Pricing: ${r.green(a.priceFormatted)}
|
|
10179
10713
|
|
|
10180
10714
|
`),
|
|
10181
|
-
process.stdout.write(`${
|
|
10715
|
+
process.stdout.write(`${r.bold('Parameters:')}
|
|
10182
10716
|
`));
|
|
10183
|
-
for (let i of
|
|
10184
|
-
let n = i.required ?
|
|
10185
|
-
s = i.default !== void 0 ?
|
|
10717
|
+
for (let i of a.parameters) {
|
|
10718
|
+
let n = i.required ? r.red('(required)') : r.dim('(optional)'),
|
|
10719
|
+
s = i.default !== void 0 ? r.dim(` [default: ${i.default}]`) : '';
|
|
10186
10720
|
(process.stdout
|
|
10187
|
-
.write(` ${
|
|
10721
|
+
.write(` ${r.bold(`--${i.name.replace(/_/g, '-')}`)} ${r.yellow(`<${i.type}>`)} ${n}${s}
|
|
10188
10722
|
`),
|
|
10189
10723
|
i.description &&
|
|
10190
|
-
process.stdout.write(` ${
|
|
10724
|
+
process.stdout.write(` ${r.gray(i.description)}
|
|
10191
10725
|
`),
|
|
10192
10726
|
i.options &&
|
|
10193
10727
|
i.options.length > 0 &&
|
|
10194
|
-
process.stdout.write(` Allowed values: ${
|
|
10728
|
+
process.stdout.write(` Allowed values: ${r.dim(i.options.join(', '))}
|
|
10195
10729
|
`),
|
|
10196
10730
|
(i.min !== void 0 || i.max !== void 0) &&
|
|
10197
10731
|
process.stdout.write(` Range: ${i.min ?? ''} to ${i.max ?? ''}
|
|
@@ -10200,43 +10734,43 @@ ${a.bold(a.cyan(r.name))} (${a.bold(r.slug)})
|
|
|
10200
10734
|
`));
|
|
10201
10735
|
}
|
|
10202
10736
|
if (
|
|
10203
|
-
(
|
|
10737
|
+
(a.parameters.some((i) => i.name === 'callback_url') ||
|
|
10204
10738
|
(process.stdout
|
|
10205
|
-
.write(` ${
|
|
10739
|
+
.write(` ${r.bold('--callback-url')} ${r.yellow('<string>')} ${r.dim('(optional)')}
|
|
10206
10740
|
`),
|
|
10207
10741
|
process.stdout
|
|
10208
|
-
.write(` ${
|
|
10742
|
+
.write(` ${r.gray('HTTPS URL. Tein POSTs the finished job here when it succeeds, fails, expires, or is cancelled.')}
|
|
10209
10743
|
|
|
10210
10744
|
`)),
|
|
10211
|
-
process.stdout.write(`${
|
|
10745
|
+
process.stdout.write(`${r.bold('Sample CLI Usage:')}
|
|
10212
10746
|
`),
|
|
10213
|
-
|
|
10747
|
+
a.category === 'Video')
|
|
10214
10748
|
)
|
|
10215
10749
|
process.stdout
|
|
10216
|
-
.write(` ${
|
|
10750
|
+
.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
10751
|
|
|
10218
10752
|
`);
|
|
10219
|
-
else if (
|
|
10220
|
-
let i =
|
|
10753
|
+
else if (a.category === 'Image') {
|
|
10754
|
+
let i = a.parameters.some((n) => n.name === 'aspect_ratio') ? ' --aspect-ratio 16:9' : '';
|
|
10221
10755
|
process.stdout
|
|
10222
|
-
.write(` ${
|
|
10756
|
+
.write(` ${r.cyan(`tein run ${a.slug} --prompt "Cyberpunk city in the rain, 8k render"${i} -o output.png`)}
|
|
10223
10757
|
|
|
10224
10758
|
`);
|
|
10225
10759
|
} else
|
|
10226
|
-
|
|
10760
|
+
a.category === 'Audio'
|
|
10227
10761
|
? process.stdout
|
|
10228
|
-
.write(` ${
|
|
10762
|
+
.write(` ${r.cyan(`tein run ${a.slug} --prompt "Hello world from Tein AI" --speaker en_female_warm -o speech.wav`)}
|
|
10229
10763
|
|
|
10230
10764
|
`)
|
|
10231
10765
|
: process.stdout
|
|
10232
|
-
.write(` ${
|
|
10766
|
+
.write(` ${r.cyan(`tein run ${a.slug} --prompt "Explain quantum computing in simple terms"`)}
|
|
10233
10767
|
|
|
10234
10768
|
`);
|
|
10235
10769
|
}
|
|
10236
|
-
|
|
10237
|
-
|
|
10238
|
-
var
|
|
10239
|
-
|
|
10770
|
+
$();
|
|
10771
|
+
et();
|
|
10772
|
+
var pr = 1e4,
|
|
10773
|
+
at = {
|
|
10240
10774
|
price: '',
|
|
10241
10775
|
creativeMode: 'Creative mode',
|
|
10242
10776
|
priority: 'Priority',
|
|
@@ -10246,24 +10780,24 @@ var ji = 1e4,
|
|
|
10246
10780
|
priorityDraft: 'Priority + Draft',
|
|
10247
10781
|
creativeModePriorityDraft: 'Creative mode + Priority + Draft',
|
|
10248
10782
|
},
|
|
10249
|
-
|
|
10250
|
-
|
|
10783
|
+
dr = Object.keys(at),
|
|
10784
|
+
cr = {
|
|
10251
10785
|
creativeMode: 'unfiltered',
|
|
10252
10786
|
creativeModePriority: 'unfilteredPriority',
|
|
10253
10787
|
creativeModeDraft: 'unfilteredDraft',
|
|
10254
10788
|
creativeModePriorityDraft: 'unfilteredPriorityDraft',
|
|
10255
10789
|
};
|
|
10256
|
-
function
|
|
10257
|
-
let
|
|
10258
|
-
return e[t] ?? (
|
|
10790
|
+
function ur(e, t) {
|
|
10791
|
+
let a = cr[t];
|
|
10792
|
+
return e[t] ?? (a ? e[a] : void 0);
|
|
10259
10793
|
}
|
|
10260
|
-
async function
|
|
10261
|
-
let
|
|
10794
|
+
async function mr(e, t) {
|
|
10795
|
+
let a = `${w(e)}${xe(t)}`,
|
|
10262
10796
|
i;
|
|
10263
10797
|
try {
|
|
10264
|
-
i = await fetch(
|
|
10798
|
+
i = await fetch(a, { signal: AbortSignal.timeout(pr) });
|
|
10265
10799
|
} catch {
|
|
10266
|
-
throw new Error(`Could not reach ${
|
|
10800
|
+
throw new Error(`Could not reach ${a}`);
|
|
10267
10801
|
}
|
|
10268
10802
|
let n = await i.json().catch(() => null);
|
|
10269
10803
|
if (!i.ok || !n || n.object !== 'list' || !n.board) {
|
|
@@ -10277,22 +10811,22 @@ async function Ji(e, t) {
|
|
|
10277
10811
|
}
|
|
10278
10812
|
return n;
|
|
10279
10813
|
}
|
|
10280
|
-
function
|
|
10814
|
+
function tt(e) {
|
|
10281
10815
|
let t = e.toFixed(4).replace(/0+$/, '').replace(/\.$/, ''),
|
|
10282
|
-
[
|
|
10283
|
-
return `$${
|
|
10816
|
+
[a, i = ''] = t.split('.');
|
|
10817
|
+
return `$${a}.${i.padEnd(2, '0')}`;
|
|
10284
10818
|
}
|
|
10285
|
-
function
|
|
10819
|
+
function it(e) {
|
|
10286
10820
|
if (!e || typeof e.starter != 'number') return null;
|
|
10287
10821
|
let t = typeof e.plus == 'number' ? e.plus : e.starter,
|
|
10288
|
-
|
|
10289
|
-
return `Starter ${
|
|
10822
|
+
a = typeof e.scale == 'number' ? e.scale : t;
|
|
10823
|
+
return `Starter ${tt(e.starter)} Plus ${tt(t)} Scale ${tt(a)}`;
|
|
10290
10824
|
}
|
|
10291
|
-
function
|
|
10825
|
+
function fr(e) {
|
|
10292
10826
|
if (typeof e.label == 'string' && e.label.trim()) return e.label.trim();
|
|
10293
10827
|
let t = [];
|
|
10294
|
-
for (let
|
|
10295
|
-
let i = e[
|
|
10828
|
+
for (let a of ['endpoint', 'resolution', 'quality', 'mode', 'task', 'component', 'token']) {
|
|
10829
|
+
let i = e[a];
|
|
10296
10830
|
i != null && i !== '' && t.push(String(i));
|
|
10297
10831
|
}
|
|
10298
10832
|
return (
|
|
@@ -10300,38 +10834,38 @@ function Wi(e) {
|
|
|
10300
10834
|
t.length ? t.join(' \xB7 ') : String(e.id ?? 'default')
|
|
10301
10835
|
);
|
|
10302
10836
|
}
|
|
10303
|
-
function
|
|
10304
|
-
let
|
|
10305
|
-
for (let i of
|
|
10306
|
-
let n =
|
|
10837
|
+
function gr(e, t) {
|
|
10838
|
+
let a = fr(e);
|
|
10839
|
+
for (let i of dr) {
|
|
10840
|
+
let n = it(ur(e, i));
|
|
10307
10841
|
if (!n) continue;
|
|
10308
|
-
let s =
|
|
10309
|
-
t.push(` ${
|
|
10842
|
+
let s = at[i] ? ` (${at[i]})` : '';
|
|
10843
|
+
t.push(` ${a}${s} ${n}`);
|
|
10310
10844
|
}
|
|
10311
10845
|
}
|
|
10312
|
-
function
|
|
10313
|
-
let
|
|
10846
|
+
function hr(e, t) {
|
|
10847
|
+
let a = e.quality ? ` quality=${e.quality}` : '';
|
|
10314
10848
|
t.push(
|
|
10315
|
-
` ${
|
|
10849
|
+
` ${r.bold(e.slug.padEnd(26))} ${r.gray(e.name)} ${r.dim(`${e.kind} ${e.unit} model=${e.model}${a}`)}`,
|
|
10316
10850
|
);
|
|
10317
|
-
for (let n of e.variants ?? [])
|
|
10851
|
+
for (let n of e.variants ?? []) gr(n, t);
|
|
10318
10852
|
let i = e.addons;
|
|
10319
10853
|
if (Array.isArray(i))
|
|
10320
10854
|
for (let n of i) {
|
|
10321
10855
|
if (!n || typeof n != 'object') continue;
|
|
10322
10856
|
let s = n,
|
|
10323
10857
|
o = typeof s.label == 'string' ? s.label : String(s.id ?? 'add-on'),
|
|
10324
|
-
u =
|
|
10858
|
+
u = it(s.price);
|
|
10325
10859
|
u && t.push(` ${o} (add-on) ${u}`);
|
|
10326
10860
|
}
|
|
10327
10861
|
t.push('');
|
|
10328
10862
|
}
|
|
10329
|
-
function
|
|
10863
|
+
function yr(e) {
|
|
10330
10864
|
let t = [],
|
|
10331
|
-
|
|
10332
|
-
(t.push(`${
|
|
10865
|
+
a = e.board.checked ? ` \xB7 checked ${e.board.checked}` : '';
|
|
10866
|
+
(t.push(`${r.bold('Tein prices')} ${r.green(e.currency)} ${e.count} models${a}`),
|
|
10333
10867
|
t.push(
|
|
10334
|
-
`${
|
|
10868
|
+
`${r.dim('Starter, Plus and Scale. Creative mode, Priority and draft show only where published.')}`,
|
|
10335
10869
|
),
|
|
10336
10870
|
t.push(''));
|
|
10337
10871
|
let i = new Map();
|
|
@@ -10347,13 +10881,13 @@ function Qi(e) {
|
|
|
10347
10881
|
return (p === -1 ? 99 : p) - (d === -1 ? 99 : d);
|
|
10348
10882
|
});
|
|
10349
10883
|
for (let l of s) {
|
|
10350
|
-
t.push(`${
|
|
10351
|
-
for (let c of i.get(l) ?? [])
|
|
10884
|
+
t.push(`${r.bold(r.cyan(`\u2500\u2500 ${l} \u2500\u2500`))}`);
|
|
10885
|
+
for (let c of i.get(l) ?? []) hr(c, t);
|
|
10352
10886
|
}
|
|
10353
10887
|
let o = new Set(e.board.models.map((l) => l.slug.toLowerCase())),
|
|
10354
10888
|
u = (e.configs ?? []).filter((l) => !o.has(String(l.modelSlug ?? '').toLowerCase()));
|
|
10355
10889
|
if (u.length) {
|
|
10356
|
-
t.push(`${
|
|
10890
|
+
t.push(`${r.bold(r.cyan('\u2500\u2500 other prices \u2500\u2500'))}`);
|
|
10357
10891
|
let l = new Map();
|
|
10358
10892
|
for (let c of u) {
|
|
10359
10893
|
let p = String(c.modelSlug ?? ''),
|
|
@@ -10362,29 +10896,29 @@ function Qi(e) {
|
|
|
10362
10896
|
}
|
|
10363
10897
|
for (let [c, p] of l) {
|
|
10364
10898
|
let d = String(p[0]?.modelName ?? c);
|
|
10365
|
-
t.push(` ${
|
|
10899
|
+
t.push(` ${r.bold(c.padEnd(26))} ${r.gray(d)}`);
|
|
10366
10900
|
for (let m of p) {
|
|
10367
|
-
let
|
|
10368
|
-
f =
|
|
10369
|
-
f && t.push(` ${
|
|
10901
|
+
let y = String(m.displayLabel ?? m.billingUnit ?? 'price'),
|
|
10902
|
+
f = it(m.prices);
|
|
10903
|
+
f && t.push(` ${y} ${f}`);
|
|
10370
10904
|
}
|
|
10371
10905
|
t.push('');
|
|
10372
10906
|
}
|
|
10373
10907
|
}
|
|
10374
10908
|
return (
|
|
10375
|
-
t.push(`${
|
|
10909
|
+
t.push(`${r.dim('JSON:')} ${r.cyan('tein pricing --json')}`),
|
|
10376
10910
|
`${t.join(`
|
|
10377
10911
|
`)}
|
|
10378
10912
|
`
|
|
10379
10913
|
);
|
|
10380
10914
|
}
|
|
10381
|
-
async function
|
|
10915
|
+
async function ba(e) {
|
|
10382
10916
|
let t;
|
|
10383
10917
|
try {
|
|
10384
|
-
t = await
|
|
10385
|
-
} catch (
|
|
10386
|
-
let i =
|
|
10387
|
-
(process.stderr.write(`${
|
|
10918
|
+
t = await mr(e.apiUrl, e.model);
|
|
10919
|
+
} catch (a) {
|
|
10920
|
+
let i = a instanceof Error ? a.message : String(a);
|
|
10921
|
+
(process.stderr.write(`${r.red('Error:')} ${i}
|
|
10388
10922
|
`),
|
|
10389
10923
|
process.exit(1));
|
|
10390
10924
|
}
|
|
@@ -10392,38 +10926,38 @@ async function sr(e) {
|
|
|
10392
10926
|
e.json
|
|
10393
10927
|
? `${JSON.stringify(t, null, 2)}
|
|
10394
10928
|
`
|
|
10395
|
-
:
|
|
10929
|
+
: yr(t),
|
|
10396
10930
|
);
|
|
10397
10931
|
}
|
|
10398
|
-
var
|
|
10399
|
-
|
|
10400
|
-
async function
|
|
10401
|
-
let
|
|
10402
|
-
i =
|
|
10403
|
-
(
|
|
10404
|
-
(process.stderr.write(`${
|
|
10932
|
+
var ka = T(require('node:path'));
|
|
10933
|
+
$();
|
|
10934
|
+
async function wa(e, t) {
|
|
10935
|
+
let a = S(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
10936
|
+
i = w(typeof t.api_url == 'string' ? t.api_url : void 0);
|
|
10937
|
+
(a ||
|
|
10938
|
+
(process.stderr.write(`${r.red('Error:')} Authentication required.
|
|
10405
10939
|
`),
|
|
10406
10940
|
process.stderr
|
|
10407
|
-
.write(`Please run ${
|
|
10941
|
+
.write(`Please run ${r.cyan('tein auth login')} or set ${r.cyan('TEIN_API_KEY')} environment variable.
|
|
10408
10942
|
`),
|
|
10409
10943
|
process.exit(1)),
|
|
10410
10944
|
e ||
|
|
10411
|
-
(process.stderr.write(`${
|
|
10945
|
+
(process.stderr.write(`${r.red('Error:')} Missing request ID.
|
|
10412
10946
|
`),
|
|
10413
|
-
process.stderr.write(`Usage: ${
|
|
10947
|
+
process.stderr.write(`Usage: ${r.cyan('tein status <request-id> [--wait] [-o output.mp4]')}
|
|
10414
10948
|
`),
|
|
10415
10949
|
process.exit(1)));
|
|
10416
10950
|
let n = !!t.json,
|
|
10417
10951
|
s = !!t.wait,
|
|
10418
10952
|
o = typeof t.output == 'string' ? t.output : void 0,
|
|
10419
|
-
u = new
|
|
10420
|
-
l = new
|
|
10953
|
+
u = new M(a, i),
|
|
10954
|
+
l = new E(`Checking status of ${r.bold(e)}...`);
|
|
10421
10955
|
n || l.start();
|
|
10422
10956
|
let c;
|
|
10423
10957
|
try {
|
|
10424
10958
|
c = await u.getStatus(e);
|
|
10425
10959
|
} catch (p) {
|
|
10426
|
-
(p instanceof
|
|
10960
|
+
(p instanceof b &&
|
|
10427
10961
|
(n
|
|
10428
10962
|
? process.stdout.write(
|
|
10429
10963
|
JSON.stringify(
|
|
@@ -10435,7 +10969,7 @@ async function lr(e, t) {
|
|
|
10435
10969
|
`,
|
|
10436
10970
|
)
|
|
10437
10971
|
: l.fail(
|
|
10438
|
-
|
|
10972
|
+
K(p).join(`
|
|
10439
10973
|
`),
|
|
10440
10974
|
),
|
|
10441
10975
|
process.exit(p.exitCode)),
|
|
@@ -10446,7 +10980,7 @@ async function lr(e, t) {
|
|
|
10446
10980
|
let p = Date.now();
|
|
10447
10981
|
for (; c.status === 'processing';) {
|
|
10448
10982
|
let d = Math.round((Date.now() - p) / 1e3);
|
|
10449
|
-
(n || l.update(`Waiting for ${
|
|
10983
|
+
(n || l.update(`Waiting for ${r.bold(c.model)} (${d}s elapsed)...`),
|
|
10450
10984
|
await new Promise((m) => setTimeout(m, 1500)));
|
|
10451
10985
|
try {
|
|
10452
10986
|
c = await u.getStatus(e);
|
|
@@ -10471,29 +11005,29 @@ async function lr(e, t) {
|
|
|
10471
11005
|
}
|
|
10472
11006
|
if (
|
|
10473
11007
|
(process.stdout.write(`
|
|
10474
|
-
${
|
|
11008
|
+
${r.bold('Model:')} ${c.model}
|
|
10475
11009
|
`),
|
|
10476
11010
|
process.stdout
|
|
10477
|
-
.write(` ${
|
|
11011
|
+
.write(` ${r.bold('Status:')} ${c.status === 'succeeded' ? r.green(c.status) : c.status === 'processing' ? r.yellow(c.status) : r.red(c.status)}
|
|
10478
11012
|
`),
|
|
10479
|
-
process.stdout.write(` ${
|
|
11013
|
+
process.stdout.write(` ${r.bold('Request ID:')} ${c.request_id}
|
|
10480
11014
|
`),
|
|
10481
11015
|
c.output && c.output.length > 0)
|
|
10482
11016
|
) {
|
|
10483
11017
|
process.stdout.write(`
|
|
10484
|
-
${
|
|
11018
|
+
${r.bold('Outputs:')}
|
|
10485
11019
|
`);
|
|
10486
11020
|
for (let p of c.output)
|
|
10487
11021
|
if (p.url) {
|
|
10488
11022
|
if (
|
|
10489
|
-
(process.stdout.write(` [${p.type.toUpperCase()}] ${
|
|
11023
|
+
(process.stdout.write(` [${p.type.toUpperCase()}] ${r.cyan(r.underline(p.url))}
|
|
10490
11024
|
`),
|
|
10491
11025
|
o)
|
|
10492
11026
|
) {
|
|
10493
|
-
let d = new
|
|
11027
|
+
let d = new E(`Downloading output to ${o}...`).start();
|
|
10494
11028
|
try {
|
|
10495
|
-
(await u.downloadOutput(p.url,
|
|
10496
|
-
d.succeed(`Saved to ${
|
|
11029
|
+
(await u.downloadOutput(p.url, ka.default.resolve(process.cwd(), o)),
|
|
11030
|
+
d.succeed(`Saved to ${r.bold(o)}`));
|
|
10497
11031
|
} catch (m) {
|
|
10498
11032
|
d.fail(`Failed to download: ${m instanceof Error ? m.message : m}`);
|
|
10499
11033
|
}
|
|
@@ -10507,35 +11041,35 @@ ${p.text}
|
|
|
10507
11041
|
process.stdout.write(`
|
|
10508
11042
|
`);
|
|
10509
11043
|
}
|
|
10510
|
-
var
|
|
10511
|
-
|
|
10512
|
-
|
|
10513
|
-
async function
|
|
10514
|
-
let
|
|
10515
|
-
i =
|
|
11044
|
+
var rt = T(require('node:fs')),
|
|
11045
|
+
nt = T(require('node:path'));
|
|
11046
|
+
$();
|
|
11047
|
+
async function xa(e, t = {}) {
|
|
11048
|
+
let a = S(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
11049
|
+
i = w(typeof t.api_url == 'string' ? t.api_url : void 0),
|
|
10516
11050
|
n = !!t.json;
|
|
10517
|
-
(
|
|
10518
|
-
(process.stderr.write(`${
|
|
11051
|
+
(a ||
|
|
11052
|
+
(process.stderr.write(`${r.red('Error:')} Authentication required.
|
|
10519
11053
|
`),
|
|
10520
11054
|
process.stderr
|
|
10521
|
-
.write(`Please run ${
|
|
11055
|
+
.write(`Please run ${r.cyan('tein auth login')} or set ${r.cyan('TEIN_API_KEY')} environment variable.
|
|
10522
11056
|
`),
|
|
10523
11057
|
process.exit(1)),
|
|
10524
11058
|
e ||
|
|
10525
|
-
(process.stderr.write(`${
|
|
11059
|
+
(process.stderr.write(`${r.red('Error:')} Missing file path.
|
|
10526
11060
|
`),
|
|
10527
|
-
process.stderr.write(`Usage: ${
|
|
11061
|
+
process.stderr.write(`Usage: ${r.cyan('tein upload <image.png|video.mp4>')}
|
|
10528
11062
|
`),
|
|
10529
11063
|
process.exit(1)));
|
|
10530
|
-
let s =
|
|
10531
|
-
|
|
10532
|
-
(process.stderr.write(`${
|
|
11064
|
+
let s = nt.default.resolve(e);
|
|
11065
|
+
rt.default.existsSync(s) ||
|
|
11066
|
+
(process.stderr.write(`${r.red('Error:')} File not found: ${s}
|
|
10533
11067
|
`),
|
|
10534
11068
|
process.exit(1));
|
|
10535
|
-
let o =
|
|
10536
|
-
l =
|
|
10537
|
-
c = new
|
|
10538
|
-
p = new
|
|
11069
|
+
let o = nt.default.basename(s),
|
|
11070
|
+
l = rt.default.readFileSync(s).toString('base64'),
|
|
11071
|
+
c = new M(a, i),
|
|
11072
|
+
p = new E(`Uploading ${r.bold(o)} to Tein AI CDN...`);
|
|
10539
11073
|
n || p.start();
|
|
10540
11074
|
try {
|
|
10541
11075
|
let d = await c.uploadAsset(l);
|
|
@@ -10547,134 +11081,157 @@ async function pr(e, t = {}) {
|
|
|
10547
11081
|
)
|
|
10548
11082
|
: (p.succeed('Upload successful!'),
|
|
10549
11083
|
process.stdout.write(`
|
|
10550
|
-
${
|
|
11084
|
+
${r.bold('CDN URL:')} ${r.green(d.url)}
|
|
10551
11085
|
`),
|
|
10552
|
-
process.stdout.write(`${
|
|
11086
|
+
process.stdout.write(`${r.dim(`Key: ${d.key}`)}
|
|
10553
11087
|
|
|
10554
11088
|
`),
|
|
10555
11089
|
process.stdout.write(`Use this CDN URL directly in your CLI runs:
|
|
10556
|
-
${
|
|
11090
|
+
${r.cyan(`tein run seedance-2-5 --prompt "Animate this scene" --image "${d.url}"`)}
|
|
10557
11091
|
|
|
10558
11092
|
`));
|
|
10559
11093
|
} catch (d) {
|
|
10560
|
-
let m = d instanceof
|
|
10561
|
-
|
|
10562
|
-
?
|
|
11094
|
+
let m = d instanceof b ? d : null,
|
|
11095
|
+
y = m
|
|
11096
|
+
? K(m).join(`
|
|
10563
11097
|
`)
|
|
10564
11098
|
: d instanceof Error
|
|
10565
11099
|
? d.message
|
|
10566
11100
|
: String(d);
|
|
10567
11101
|
(n
|
|
10568
11102
|
? process.stdout.write(
|
|
10569
|
-
JSON.stringify({ error: { code: m?.code ?? null, message: m?.message ??
|
|
11103
|
+
JSON.stringify({ error: { code: m?.code ?? null, message: m?.message ?? y } }, null, 2) +
|
|
10570
11104
|
`
|
|
10571
11105
|
`,
|
|
10572
11106
|
)
|
|
10573
|
-
: p.fail(`Upload failed: ${
|
|
11107
|
+
: p.fail(`Upload failed: ${y}`),
|
|
10574
11108
|
process.exit(m ? m.exitCode : v));
|
|
10575
11109
|
}
|
|
10576
11110
|
}
|
|
10577
|
-
|
|
10578
|
-
|
|
10579
|
-
|
|
11111
|
+
re();
|
|
11112
|
+
ee();
|
|
11113
|
+
Le();
|
|
11114
|
+
function Da() {
|
|
10580
11115
|
process.stdout.write(`
|
|
10581
|
-
${
|
|
11116
|
+
${r.bold(r.cyan('Tein AI CLI'))} - Official Command-Line Interface for Tein AI models
|
|
11117
|
+
|
|
11118
|
+
${r.bold('USAGE:')}
|
|
11119
|
+
${r.cyan('tein')} <command> [arguments] [options]
|
|
10582
11120
|
|
|
10583
|
-
${
|
|
10584
|
-
${
|
|
11121
|
+
${r.bold('COMMANDS:')}
|
|
11122
|
+
${r.bold('auth')} <login|set-key|logout|status> Manage Tein API key and authentication
|
|
11123
|
+
${r.bold('models')} [category] List all 25+ models (Video, Image, Audio, Text, 3D)
|
|
11124
|
+
${r.bold('pricing')} [model-slug] Every published price (Starter, Plus, Scale)
|
|
11125
|
+
${r.bold('info')} <model-slug> View parameter schemas, pricing, and options
|
|
11126
|
+
${r.bold('upload')} <filepath> Upload local image/video directly to Tein CDN
|
|
11127
|
+
${r.bold('run')} <model-slug> [options] Generate video, image, audio, or reasoning outputs
|
|
11128
|
+
${r.bold('status')} <request-id> [options] Check generation progress and retrieve output files
|
|
11129
|
+
${r.bold('balance')} [--json] Workspace balance, this key's limit and usage
|
|
11130
|
+
${r.bold('usage')} [options] [--json] Spend by model, channel, key and time (Usage page)
|
|
11131
|
+
${r.bold('transactions')} [options] [--json] Balance history: top ups, charges, refunds (alias: history)
|
|
11132
|
+
${r.bold('mcp')} Launch stdio MCP server for Claude Desktop / Code
|
|
11133
|
+
${r.bold('--version')}, ${r.bold('-v')} Print the installed CLI version
|
|
10585
11134
|
|
|
10586
|
-
${
|
|
10587
|
-
${
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
${
|
|
10591
|
-
${
|
|
10592
|
-
${
|
|
10593
|
-
${
|
|
10594
|
-
${
|
|
11135
|
+
${r.bold('ACCOUNT OPTIONS (read only, nothing is charged; the same JSON as GET /v1/balance, /v1/usage, /v1/balance/transactions):')}
|
|
11136
|
+
${r.cyan('--range')} hour|day|week|month|custom tein usage: the row size, over a fixed period ending now:
|
|
11137
|
+
hour = last 24 h, day = last 30 days (default),
|
|
11138
|
+
week = last 12 weeks, month = last 12 months
|
|
11139
|
+
${r.cyan('--from, --to')} <YYYY-MM-DD> tein usage --range custom: first and last day (UTC), at most 366 days
|
|
11140
|
+
${r.cyan('--model')} <model-id> tein usage: only this model
|
|
11141
|
+
${r.cyan('--channel')} website|api|mcp|cli tein usage: only runs started there
|
|
11142
|
+
${r.cyan('--limit')} <1-100> tein transactions: rows per page (default 50)
|
|
11143
|
+
${r.cyan('--type')} <types> tein transactions: e.g. usage,refund or topup,auto_topup
|
|
11144
|
+
${r.cyan('--after')} <cursor> tein transactions: the next page (printed under each page)
|
|
11145
|
+
${r.cyan('--json')} Print the API's JSON as is
|
|
10595
11146
|
|
|
10596
|
-
${
|
|
10597
|
-
${
|
|
10598
|
-
${
|
|
10599
|
-
${
|
|
10600
|
-
${
|
|
10601
|
-
${
|
|
10602
|
-
${
|
|
10603
|
-
${
|
|
10604
|
-
${
|
|
10605
|
-
${
|
|
10606
|
-
${
|
|
10607
|
-
${
|
|
10608
|
-
${
|
|
10609
|
-
${
|
|
10610
|
-
${
|
|
11147
|
+
${r.bold('GENERATION OPTIONS (for `tein run`):')}
|
|
11148
|
+
${r.cyan('-p, --prompt')} <text> Text prompt for generation ${r.red('(required)')}
|
|
11149
|
+
${r.cyan('-o, --output')} <filepath> Download output file locally (e.g. video.mp4, image.png)
|
|
11150
|
+
${r.cyan('--aspect-ratio')} <ratio> Aspect ratio, per model (see tein info <model-slug>)
|
|
11151
|
+
${r.cyan('-d, --duration')} <seconds> Video duration in seconds (4-30s depending on model)
|
|
11152
|
+
${r.cyan('-r, --resolution')} <res> Resolution (720p, 1080p, 1K, 2K, 4K)
|
|
11153
|
+
${r.cyan('-q, --quality')} <quality> Quality tier (standard, fast, mini, high)
|
|
11154
|
+
${r.cyan('-s, --speaker')} <speaker_id> Voice speaker ID for audio TTS models
|
|
11155
|
+
${r.cyan('--image')} <url> Input image URL for image-to-video or image-to-image
|
|
11156
|
+
${r.cyan('--generate-audio')} Enable native synchronized audio (Seedance 2.5)
|
|
11157
|
+
${r.cyan('--finalize')} <job-id> Render a Seedance 2.5 draft at 1080p, or 4K with -r 4k (no prompt)
|
|
11158
|
+
${r.cyan('--callback-url')} <url> HTTPS URL that receives the finished job
|
|
11159
|
+
${r.cyan('--async, --no-wait')} Queue task and return request ID immediately
|
|
11160
|
+
${r.cyan('--json')} Output response in raw JSON format
|
|
11161
|
+
${r.cyan('--api-key')} <key> Override API key for this request
|
|
10611
11162
|
|
|
10612
|
-
${
|
|
10613
|
-
${
|
|
10614
|
-
${
|
|
11163
|
+
${r.bold('EXAMPLES:')}
|
|
11164
|
+
${r.dim('# 1. Authenticate with your Tein API key')}
|
|
11165
|
+
${r.cyan('tein auth login')}
|
|
10615
11166
|
|
|
10616
|
-
${
|
|
10617
|
-
${
|
|
11167
|
+
${r.dim('# 2. List all Video models')}
|
|
11168
|
+
${r.cyan('tein models video')}
|
|
10618
11169
|
|
|
10619
|
-
${
|
|
10620
|
-
${
|
|
10621
|
-
${
|
|
11170
|
+
${r.dim('# 3. Every published price, or one model as JSON')}
|
|
11171
|
+
${r.cyan('tein pricing')}
|
|
11172
|
+
${r.cyan('tein pricing seedance-2-5 --json')}
|
|
10622
11173
|
|
|
10623
|
-
${
|
|
10624
|
-
${
|
|
11174
|
+
${r.dim('# 4. Generate a high-quality 2K image and download it')}
|
|
11175
|
+
${r.cyan('tein run gpt-image-2 --prompt "Neon Tokyo street in rain" --quality high -r 2K -o tokyo.png')}
|
|
10625
11176
|
|
|
10626
|
-
${
|
|
10627
|
-
${
|
|
10628
|
-
${
|
|
10629
|
-
${
|
|
11177
|
+
${r.dim('# 5. Generate a video using Seedance 2.5 with audio')}
|
|
11178
|
+
${r.cyan('tein run seedance-2-5 --prompt "Drone shot of ocean waves at sunrise" --duration 5 -o ocean.mp4')}
|
|
11179
|
+
${r.dim('# The same at 4K (10-bit H.265; add --creative-mode true for Creative mode)')}
|
|
11180
|
+
${r.cyan('tein run seedance-2-5 --prompt "Drone shot of ocean waves at sunrise" --duration 5 -r 4k -o ocean-4k.mp4')}
|
|
10630
11181
|
|
|
10631
|
-
${
|
|
10632
|
-
${
|
|
11182
|
+
${r.dim('# 6. Generate speech with Seed Audio 1.0')}
|
|
11183
|
+
${r.cyan('tein run seed-audio-1-0 --prompt "Welcome to Tein AI CLI" -o welcome.wav')}
|
|
10633
11184
|
|
|
10634
|
-
${
|
|
10635
|
-
${
|
|
11185
|
+
${r.dim('# 7. Run deep reasoning task with GPT-6 Astra')}
|
|
11186
|
+
${r.cyan('tein run gpt-6-astra --prompt "Write a TypeScript binary search tree implementation"')}
|
|
11187
|
+
|
|
11188
|
+
${r.dim('# 8. Balance, API usage week by week, a custom period as JSON, the latest charges')}
|
|
11189
|
+
${r.cyan('tein balance')}
|
|
11190
|
+
${r.cyan('tein usage --range week --channel api')}
|
|
11191
|
+
${r.cyan('tein usage --range custom --from 2026-11-01 --to 2026-11-19 --json')}
|
|
11192
|
+
${r.cyan('tein transactions --limit 20 --type usage,refund')}
|
|
10636
11193
|
|
|
10637
11194
|
`);
|
|
10638
11195
|
}
|
|
10639
|
-
async function
|
|
11196
|
+
async function Dr() {
|
|
10640
11197
|
let e = process.argv.slice(2),
|
|
10641
|
-
t =
|
|
11198
|
+
t = sa(e);
|
|
10642
11199
|
if (t.flags.has('help') || t.options.help || t.command === 'help') {
|
|
10643
|
-
|
|
11200
|
+
Da();
|
|
10644
11201
|
return;
|
|
10645
11202
|
}
|
|
10646
11203
|
if (t.flags.has('version') || t.options.version || t.command === 'version') {
|
|
10647
|
-
process.stdout.write(`tein version ${
|
|
11204
|
+
process.stdout.write(`tein version ${F}
|
|
10648
11205
|
`);
|
|
10649
11206
|
return;
|
|
10650
11207
|
}
|
|
10651
11208
|
switch (t.command) {
|
|
10652
11209
|
case 'auth': {
|
|
10653
|
-
await
|
|
11210
|
+
await ae(t.subcommand, t.options.key);
|
|
10654
11211
|
break;
|
|
10655
11212
|
}
|
|
10656
11213
|
case 'login': {
|
|
10657
|
-
await
|
|
11214
|
+
await ae('login', t.options.key);
|
|
10658
11215
|
break;
|
|
10659
11216
|
}
|
|
10660
11217
|
case 'logout': {
|
|
10661
|
-
await
|
|
11218
|
+
await ae('logout');
|
|
10662
11219
|
break;
|
|
10663
11220
|
}
|
|
10664
11221
|
case 'whoami': {
|
|
10665
|
-
await
|
|
11222
|
+
await ae('status');
|
|
10666
11223
|
break;
|
|
10667
11224
|
}
|
|
10668
11225
|
case 'models':
|
|
10669
11226
|
case 'list': {
|
|
10670
|
-
await
|
|
11227
|
+
await ha(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0);
|
|
10671
11228
|
break;
|
|
10672
11229
|
}
|
|
10673
11230
|
case 'pricing':
|
|
10674
11231
|
case 'prices': {
|
|
10675
|
-
let
|
|
10676
|
-
i = t.subcommand || (typeof
|
|
10677
|
-
await
|
|
11232
|
+
let a = t.options.model,
|
|
11233
|
+
i = t.subcommand || (typeof a == 'string' ? a : void 0);
|
|
11234
|
+
await ba({
|
|
10678
11235
|
model: i,
|
|
10679
11236
|
json: !!t.options.json,
|
|
10680
11237
|
apiUrl: typeof t.options.api_url == 'string' ? t.options.api_url : void 0,
|
|
@@ -10684,61 +11241,74 @@ async function ha() {
|
|
|
10684
11241
|
case 'info':
|
|
10685
11242
|
case 'show': {
|
|
10686
11243
|
(t.subcommand ||
|
|
10687
|
-
(process.stderr.write(`${
|
|
11244
|
+
(process.stderr.write(`${r.red('Error:')} Missing model slug.
|
|
10688
11245
|
`),
|
|
10689
|
-
process.stderr.write(`Usage: ${
|
|
11246
|
+
process.stderr.write(`Usage: ${r.cyan('tein info <model-slug>')}
|
|
10690
11247
|
`),
|
|
10691
11248
|
process.exit(1)),
|
|
10692
|
-
await
|
|
11249
|
+
await ya(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0));
|
|
10693
11250
|
break;
|
|
10694
11251
|
}
|
|
10695
11252
|
case 'upload': {
|
|
10696
|
-
let
|
|
10697
|
-
await
|
|
11253
|
+
let a = t.subcommand || '';
|
|
11254
|
+
await xa(a, t.options);
|
|
10698
11255
|
break;
|
|
10699
11256
|
}
|
|
10700
11257
|
case 'run':
|
|
10701
11258
|
case 'generate': {
|
|
10702
|
-
let
|
|
10703
|
-
await
|
|
11259
|
+
let a = t.subcommand || '';
|
|
11260
|
+
await Qe(a, t.options);
|
|
10704
11261
|
break;
|
|
10705
11262
|
}
|
|
10706
11263
|
case 'status': {
|
|
10707
|
-
let
|
|
10708
|
-
await
|
|
11264
|
+
let a = t.subcommand || '';
|
|
11265
|
+
await wa(a, t.options);
|
|
11266
|
+
break;
|
|
11267
|
+
}
|
|
11268
|
+
case 'balance': {
|
|
11269
|
+
await pa(t.options);
|
|
11270
|
+
break;
|
|
11271
|
+
}
|
|
11272
|
+
case 'usage': {
|
|
11273
|
+
await ma(t.options);
|
|
11274
|
+
break;
|
|
11275
|
+
}
|
|
11276
|
+
case 'transactions':
|
|
11277
|
+
case 'history': {
|
|
11278
|
+
await fa(t.options);
|
|
10709
11279
|
break;
|
|
10710
11280
|
}
|
|
10711
11281
|
case 'mcp': {
|
|
10712
|
-
let { startStdioServer:
|
|
10713
|
-
await
|
|
11282
|
+
let { startStdioServer: a } = await Promise.resolve().then(() => (La(), Ra));
|
|
11283
|
+
await a();
|
|
10714
11284
|
break;
|
|
10715
11285
|
}
|
|
10716
11286
|
default: {
|
|
10717
11287
|
if (t.command && !t.command.startsWith('-')) {
|
|
10718
|
-
(!
|
|
10719
|
-
!
|
|
11288
|
+
(!H(t.command) &&
|
|
11289
|
+
!fe[t.command] &&
|
|
10720
11290
|
(process.stderr.write(`
|
|
10721
|
-
${
|
|
10722
|
-
Run ${
|
|
11291
|
+
${r.red('Error:')} Unknown command or model "${t.command}".
|
|
11292
|
+
Run ${r.cyan('tein --help')} for the commands, or ${r.cyan('tein models')} for the model slugs.
|
|
10723
11293
|
`),
|
|
10724
11294
|
process.exit(v)),
|
|
10725
|
-
await
|
|
11295
|
+
await Qe(t.command, t.options));
|
|
10726
11296
|
return;
|
|
10727
11297
|
}
|
|
10728
|
-
|
|
11298
|
+
Da();
|
|
10729
11299
|
break;
|
|
10730
11300
|
}
|
|
10731
11301
|
}
|
|
10732
11302
|
}
|
|
10733
|
-
|
|
10734
|
-
(e instanceof
|
|
11303
|
+
Dr().catch((e) => {
|
|
11304
|
+
(e instanceof b &&
|
|
10735
11305
|
(process.stderr.write(`
|
|
10736
|
-
${
|
|
11306
|
+
${r.red('Error:')} ${K(e).join(`
|
|
10737
11307
|
`)}
|
|
10738
11308
|
`),
|
|
10739
11309
|
process.exit(e.exitCode)),
|
|
10740
11310
|
process.stderr.write(`
|
|
10741
|
-
${
|
|
11311
|
+
${r.red('Fatal error:')} ${e instanceof Error ? e.message : e}
|
|
10742
11312
|
`),
|
|
10743
11313
|
process.exit(v));
|
|
10744
11314
|
});
|