@teinai/cli 1.1.5 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +698 -676
- package/package.json +24 -24
package/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
|
-
var
|
|
3
|
+
var Jt = Object.create;
|
|
4
4
|
var me = Object.defineProperty;
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var
|
|
5
|
+
var Ht = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var Wt = Object.getOwnPropertyNames;
|
|
7
|
+
var zt = Object.getPrototypeOf,
|
|
8
|
+
Yt = Object.prototype.hasOwnProperty;
|
|
9
|
+
var y = (e, t, i) => () => {
|
|
10
10
|
if (i) throw i[0];
|
|
11
11
|
try {
|
|
12
12
|
return (e && (t = e((e = 0))), t);
|
|
13
|
-
} catch (
|
|
14
|
-
throw ((i = [
|
|
13
|
+
} catch (r) {
|
|
14
|
+
throw ((i = [r]), r);
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
var
|
|
17
|
+
var Qt = (e, t) => {
|
|
18
18
|
for (var i in t) me(e, i, { get: t[i], enumerable: !0 });
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
Xt = (e, t, i, r) => {
|
|
21
21
|
if ((t && typeof t == 'object') || typeof t == 'function')
|
|
22
|
-
for (let n of
|
|
23
|
-
!
|
|
22
|
+
for (let n of Wt(t))
|
|
23
|
+
!Yt.call(e, n) &&
|
|
24
24
|
n !== i &&
|
|
25
|
-
me(e, n, { get: () => t[n], enumerable: !(
|
|
25
|
+
me(e, n, { get: () => t[n], enumerable: !(r = Ht(t, n)) || r.enumerable });
|
|
26
26
|
return e;
|
|
27
27
|
};
|
|
28
28
|
var x = (e, t, i) => (
|
|
29
|
-
(i = e != null ?
|
|
30
|
-
|
|
29
|
+
(i = e != null ? Jt(zt(e)) : {}),
|
|
30
|
+
Xt(t || !e || !e.__esModule ? me(i, 'default', { value: e, enumerable: !0 }) : i, e)
|
|
31
31
|
);
|
|
32
32
|
function L() {
|
|
33
33
|
try {
|
|
@@ -71,7 +71,7 @@ var C,
|
|
|
71
71
|
fe,
|
|
72
72
|
te,
|
|
73
73
|
D,
|
|
74
|
-
q =
|
|
74
|
+
q = y(() => {
|
|
75
75
|
'use strict';
|
|
76
76
|
((C = x(require('node:fs'))),
|
|
77
77
|
(Ge = x(require('node:os'))),
|
|
@@ -80,18 +80,18 @@ var C,
|
|
|
80
80
|
(D = fe.default.join(te, 'config.json')));
|
|
81
81
|
});
|
|
82
82
|
var B,
|
|
83
|
-
he =
|
|
83
|
+
he = y(() => {
|
|
84
84
|
'use strict';
|
|
85
85
|
B = new Set(['nano-banana-2.1', 'seedance-2-lite', 'seedance-2-5-lite']);
|
|
86
86
|
});
|
|
87
87
|
function ye(e) {
|
|
88
88
|
return !1;
|
|
89
89
|
}
|
|
90
|
-
var Je =
|
|
90
|
+
var Je = y(() => {
|
|
91
91
|
'use strict';
|
|
92
92
|
});
|
|
93
93
|
var re,
|
|
94
|
-
He =
|
|
94
|
+
He = y(() => {
|
|
95
95
|
'use strict';
|
|
96
96
|
re = {
|
|
97
97
|
source: 'TEIN Price Board',
|
|
@@ -1211,24 +1211,21 @@ var re,
|
|
|
1211
1211
|
price: { starter: 0.0289, plus: 0.0275, scale: 0.0257 },
|
|
1212
1212
|
label: '480p',
|
|
1213
1213
|
resolution: '480p',
|
|
1214
|
-
unfiltered: { starter: 0.0303, plus: 0.0288, scale: 0.0269 },
|
|
1215
1214
|
},
|
|
1216
1215
|
{
|
|
1217
1216
|
id: '720p',
|
|
1218
1217
|
price: { starter: 0.0579, plus: 0.055, scale: 0.0514 },
|
|
1219
1218
|
label: '720p',
|
|
1220
1219
|
resolution: '720p',
|
|
1221
|
-
unfiltered: { starter: 0.0607, plus: 0.0577, scale: 0.0539 },
|
|
1222
1220
|
},
|
|
1223
1221
|
{
|
|
1224
1222
|
id: '1080p',
|
|
1225
1223
|
price: { starter: 0.1169, plus: 0.1111, scale: 0.1026 },
|
|
1226
1224
|
label: '1080p',
|
|
1227
1225
|
resolution: '1080p',
|
|
1228
|
-
unfiltered: { starter: 0.1227, plus: 0.1166, scale: 0.1077 },
|
|
1229
1226
|
},
|
|
1230
1227
|
],
|
|
1231
|
-
unfiltered:
|
|
1228
|
+
unfiltered: null,
|
|
1232
1229
|
priority: null,
|
|
1233
1230
|
draft: null,
|
|
1234
1231
|
axes: { resolution: ['480p', '720p', '1080p'] },
|
|
@@ -1249,24 +1246,21 @@ var re,
|
|
|
1249
1246
|
price: { starter: 0.0469, plus: 0.0462, scale: 0.0462 },
|
|
1250
1247
|
label: '480p',
|
|
1251
1248
|
resolution: '480p',
|
|
1252
|
-
unfiltered: { starter: 0.0492, plus: 0.0485, scale: 0.0485 },
|
|
1253
1249
|
},
|
|
1254
1250
|
{
|
|
1255
1251
|
id: '720p',
|
|
1256
1252
|
price: { starter: 0.0959, plus: 0.0924, scale: 0.0924 },
|
|
1257
1253
|
label: '720p',
|
|
1258
1254
|
resolution: '720p',
|
|
1259
|
-
unfiltered: { starter: 0.1006, plus: 0.097, scale: 0.097 },
|
|
1260
1255
|
},
|
|
1261
1256
|
{
|
|
1262
1257
|
id: '1080p',
|
|
1263
1258
|
price: { starter: 0.1919, plus: 0.1847, scale: 0.1847 },
|
|
1264
1259
|
label: '1080p',
|
|
1265
1260
|
resolution: '1080p',
|
|
1266
|
-
unfiltered: { starter: 0.2014, plus: 0.1939, scale: 0.1939 },
|
|
1267
1261
|
},
|
|
1268
1262
|
],
|
|
1269
|
-
unfiltered:
|
|
1263
|
+
unfiltered: null,
|
|
1270
1264
|
priority: null,
|
|
1271
1265
|
draft: null,
|
|
1272
1266
|
axes: { resolution: ['480p', '720p', '1080p'] },
|
|
@@ -1386,17 +1380,15 @@ var re,
|
|
|
1386
1380
|
price: { starter: 0.0219, plus: 0.0218, scale: 0.0218 },
|
|
1387
1381
|
label: '1K',
|
|
1388
1382
|
resolution: '1K',
|
|
1389
|
-
unfiltered: { starter: 0.0229, plus: 0.0228, scale: 0.0228 },
|
|
1390
1383
|
},
|
|
1391
1384
|
{
|
|
1392
1385
|
id: '2k',
|
|
1393
1386
|
price: { starter: 0.0219, plus: 0.0218, scale: 0.0218 },
|
|
1394
1387
|
label: '2K',
|
|
1395
1388
|
resolution: '2K',
|
|
1396
|
-
unfiltered: { starter: 0.0229, plus: 0.0228, scale: 0.0228 },
|
|
1397
1389
|
},
|
|
1398
1390
|
],
|
|
1399
|
-
unfiltered:
|
|
1391
|
+
unfiltered: null,
|
|
1400
1392
|
priority: null,
|
|
1401
1393
|
draft: null,
|
|
1402
1394
|
addons: [
|
|
@@ -1405,7 +1397,6 @@ var re,
|
|
|
1405
1397
|
price: { starter: 0.00226, plus: 0.00226, scale: 0.00226 },
|
|
1406
1398
|
label: 'Each reference image',
|
|
1407
1399
|
unit: '/ref image',
|
|
1408
|
-
unfiltered: { starter: 0.00237, plus: 0.00237, scale: 0.00237 },
|
|
1409
1400
|
},
|
|
1410
1401
|
],
|
|
1411
1402
|
axes: { resolution: ['1K', '2K'] },
|
|
@@ -1426,17 +1417,15 @@ var re,
|
|
|
1426
1417
|
price: { starter: 0.0304, plus: 0.029, scale: 0.029 },
|
|
1427
1418
|
label: '1K',
|
|
1428
1419
|
resolution: '1K',
|
|
1429
|
-
unfiltered: { starter: 0.0319, plus: 0.0304, scale: 0.0304 },
|
|
1430
1420
|
},
|
|
1431
1421
|
{
|
|
1432
1422
|
id: '2k',
|
|
1433
1423
|
price: { starter: 0.057, plus: 0.0545, scale: 0.0545 },
|
|
1434
1424
|
label: '2K',
|
|
1435
1425
|
resolution: '2K',
|
|
1436
|
-
unfiltered: { starter: 0.0598, plus: 0.0572, scale: 0.0572 },
|
|
1437
1426
|
},
|
|
1438
1427
|
],
|
|
1439
|
-
unfiltered:
|
|
1428
|
+
unfiltered: null,
|
|
1440
1429
|
priority: null,
|
|
1441
1430
|
draft: null,
|
|
1442
1431
|
addons: [
|
|
@@ -1445,7 +1434,6 @@ var re,
|
|
|
1445
1434
|
price: { starter: 0.00226, plus: 0.00226, scale: 0.00226 },
|
|
1446
1435
|
label: 'Each reference image',
|
|
1447
1436
|
unit: '/ref image',
|
|
1448
|
-
unfiltered: { starter: 0.00237, plus: 0.00237, scale: 0.00237 },
|
|
1449
1437
|
},
|
|
1450
1438
|
],
|
|
1451
1439
|
axes: { resolution: ['1K', '2K'] },
|
|
@@ -4217,7 +4205,7 @@ var re,
|
|
|
4217
4205
|
function ke(e, t) {
|
|
4218
4206
|
return `${e.trim().toLowerCase()}|${(t ?? '').trim().toLowerCase()}`;
|
|
4219
4207
|
}
|
|
4220
|
-
function
|
|
4208
|
+
function ni(e, t) {
|
|
4221
4209
|
if (e === 'seedance-2-mini') return 'mini';
|
|
4222
4210
|
if (e !== 'seedance-2') return;
|
|
4223
4211
|
let i = typeof t?.quality == 'string' ? t.quality.trim().toLowerCase() : '';
|
|
@@ -4227,24 +4215,24 @@ function ii(e, t) {
|
|
|
4227
4215
|
? 'fast'
|
|
4228
4216
|
: 'standard';
|
|
4229
4217
|
}
|
|
4230
|
-
function
|
|
4218
|
+
function si(e, t) {
|
|
4231
4219
|
let i = e
|
|
4232
4220
|
.trim()
|
|
4233
4221
|
.toLowerCase()
|
|
4234
4222
|
.replace(/-(?:unfiltered|uncensored)$/, '');
|
|
4235
4223
|
if (i === 'seedance-2' || i === 'seedance-2-mini') {
|
|
4236
|
-
let n =
|
|
4224
|
+
let n = ni(i, t),
|
|
4237
4225
|
s = be.get(ke('seedance-2', n));
|
|
4238
4226
|
return s ? s.slug : null;
|
|
4239
4227
|
}
|
|
4240
|
-
let
|
|
4241
|
-
return
|
|
4228
|
+
let r = ae.get(i) ?? be.get(ke(i));
|
|
4229
|
+
return r ? r.slug : null;
|
|
4242
4230
|
}
|
|
4243
|
-
function
|
|
4244
|
-
return ae.has(e) && !(
|
|
4231
|
+
function li(e, t) {
|
|
4232
|
+
return ae.has(e) && !(oi.has(e) && t) ? e : si(e, t);
|
|
4245
4233
|
}
|
|
4246
4234
|
function F(e, t) {
|
|
4247
|
-
let i =
|
|
4235
|
+
let i = li(e, t);
|
|
4248
4236
|
return i ? (ae.get(i) ?? null) : null;
|
|
4249
4237
|
}
|
|
4250
4238
|
function ne() {
|
|
@@ -4254,10 +4242,10 @@ var Ie,
|
|
|
4254
4242
|
ae,
|
|
4255
4243
|
be,
|
|
4256
4244
|
We,
|
|
4257
|
-
ti,
|
|
4258
|
-
we,
|
|
4259
4245
|
ai,
|
|
4260
|
-
|
|
4246
|
+
we,
|
|
4247
|
+
oi,
|
|
4248
|
+
N = y(() => {
|
|
4261
4249
|
'use strict';
|
|
4262
4250
|
Je();
|
|
4263
4251
|
He();
|
|
@@ -4269,18 +4257,18 @@ var Ie,
|
|
|
4269
4257
|
(ae = new Map()),
|
|
4270
4258
|
(be = new Map()),
|
|
4271
4259
|
(We = new Map()),
|
|
4272
|
-
(
|
|
4260
|
+
(ai = new Map()),
|
|
4273
4261
|
(we = new Map()));
|
|
4274
4262
|
for (let e of Ie.models) {
|
|
4275
4263
|
(ae.set(e.slug, e), be.set(ke(e.api.model, e.api.quality), e));
|
|
4276
4264
|
for (let t of e.variants) We.set(`${e.slug}/${t.id}`, { model: e, variant: t, edit: !1 });
|
|
4277
4265
|
for (let t of e.editVariants ?? [])
|
|
4278
4266
|
We.set(`${e.slug}/edit/${t.id}`, { model: e, variant: t, edit: !0 });
|
|
4279
|
-
for (let t of e.addons ?? [])
|
|
4267
|
+
for (let t of e.addons ?? []) ai.set(`${e.slug}/addon/${t.id}`, { model: e, addon: t });
|
|
4280
4268
|
we.set(e.slug, e.family);
|
|
4281
4269
|
}
|
|
4282
4270
|
for (let e of Ie.families) for (let t of e.models) we.has(t) || we.set(t, e.slug);
|
|
4283
|
-
|
|
4271
|
+
oi = new Set(['seedance-2']);
|
|
4284
4272
|
});
|
|
4285
4273
|
function se(e) {
|
|
4286
4274
|
let t = e.from?.variant;
|
|
@@ -4293,13 +4281,13 @@ function xe(e) {
|
|
|
4293
4281
|
: (e.defaultEndpoint ?? e.endpoints[0].id);
|
|
4294
4282
|
}
|
|
4295
4283
|
var ze,
|
|
4296
|
-
|
|
4284
|
+
_e = y(() => {
|
|
4297
4285
|
'use strict';
|
|
4298
|
-
|
|
4286
|
+
N();
|
|
4299
4287
|
ze = 'dynamic';
|
|
4300
4288
|
});
|
|
4301
4289
|
var oe,
|
|
4302
|
-
|
|
4290
|
+
ve = y(() => {
|
|
4303
4291
|
'use strict';
|
|
4304
4292
|
oe = {
|
|
4305
4293
|
'gemini-3-8-flash': 'gemini-3.8-flash',
|
|
@@ -4309,29 +4297,29 @@ var oe,
|
|
|
4309
4297
|
'gpt-image-2-5-sunburst': 'gpt-image-2.5-sunburst',
|
|
4310
4298
|
};
|
|
4311
4299
|
});
|
|
4312
|
-
var Ye =
|
|
4300
|
+
var Ye = y(() => {
|
|
4313
4301
|
'use strict';
|
|
4314
4302
|
});
|
|
4315
4303
|
function Qe(e, t) {
|
|
4316
|
-
return typeof t == 'string' && (
|
|
4304
|
+
return typeof t == 'string' && (pi[e]?.includes(t) ?? !1);
|
|
4317
4305
|
}
|
|
4318
|
-
var
|
|
4319
|
-
Xe =
|
|
4306
|
+
var pi,
|
|
4307
|
+
Xe = y(() => {
|
|
4320
4308
|
'use strict';
|
|
4321
|
-
|
|
4322
|
-
|
|
4309
|
+
N();
|
|
4310
|
+
_e();
|
|
4323
4311
|
Ye();
|
|
4324
|
-
|
|
4312
|
+
pi = { 'gpt-6-astra': ['balanced', 'stable'] };
|
|
4325
4313
|
});
|
|
4326
4314
|
function Ze(e) {
|
|
4327
|
-
return e === 'nano-banana-pro' ?
|
|
4315
|
+
return e === 'nano-banana-pro' ? di : ci;
|
|
4328
4316
|
}
|
|
4329
|
-
var
|
|
4330
|
-
|
|
4331
|
-
et =
|
|
4317
|
+
var di,
|
|
4318
|
+
ci,
|
|
4319
|
+
et = y(() => {
|
|
4332
4320
|
'use strict';
|
|
4333
|
-
((
|
|
4334
|
-
(
|
|
4321
|
+
((di = ['auto', '1:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9']),
|
|
4322
|
+
(ci = [
|
|
4335
4323
|
'auto',
|
|
4336
4324
|
'1:1',
|
|
4337
4325
|
'1:4',
|
|
@@ -4350,9 +4338,26 @@ var oi,
|
|
|
4350
4338
|
]));
|
|
4351
4339
|
});
|
|
4352
4340
|
var tt,
|
|
4353
|
-
it =
|
|
4341
|
+
it = y(() => {
|
|
4354
4342
|
'use strict';
|
|
4355
4343
|
tt = [
|
|
4344
|
+
'prompt',
|
|
4345
|
+
'system',
|
|
4346
|
+
'messages',
|
|
4347
|
+
'images',
|
|
4348
|
+
'image',
|
|
4349
|
+
'max_tokens',
|
|
4350
|
+
'temperature',
|
|
4351
|
+
'top_p',
|
|
4352
|
+
'top_k',
|
|
4353
|
+
'reasoning_effort',
|
|
4354
|
+
'endpoint',
|
|
4355
|
+
];
|
|
4356
|
+
});
|
|
4357
|
+
var rt,
|
|
4358
|
+
at = y(() => {
|
|
4359
|
+
'use strict';
|
|
4360
|
+
rt = [
|
|
4356
4361
|
{
|
|
4357
4362
|
slug: 'claude-fable-5-1',
|
|
4358
4363
|
family: 'fable-5-1',
|
|
@@ -4421,13 +4426,13 @@ var tt,
|
|
|
4421
4426
|
},
|
|
4422
4427
|
];
|
|
4423
4428
|
});
|
|
4424
|
-
function
|
|
4429
|
+
function nt(e) {
|
|
4425
4430
|
return `$${e}`;
|
|
4426
4431
|
}
|
|
4427
4432
|
function Pe(e, t, i) {
|
|
4428
4433
|
return F(e)?.variants.find((n) => n.endpoint === t && n.component === i)?.price.starter ?? null;
|
|
4429
4434
|
}
|
|
4430
|
-
function
|
|
4435
|
+
function ui(e) {
|
|
4431
4436
|
return [
|
|
4432
4437
|
{
|
|
4433
4438
|
name: 'prompt',
|
|
@@ -4493,13 +4498,13 @@ function pi(e) {
|
|
|
4493
4498
|
},
|
|
4494
4499
|
];
|
|
4495
4500
|
}
|
|
4496
|
-
function
|
|
4501
|
+
function st() {
|
|
4497
4502
|
return Object.fromEntries(
|
|
4498
|
-
|
|
4503
|
+
rt.map((e) => {
|
|
4499
4504
|
let t = Pe(e.slug, 'cheap', 'input'),
|
|
4500
4505
|
i = Pe(e.slug, 'cheap', 'output'),
|
|
4501
|
-
|
|
4502
|
-
n = t != null && i != null ? `${
|
|
4506
|
+
r = Pe(e.slug, 'stable', 'input') != null,
|
|
4507
|
+
n = t != null && i != null ? `${nt(t)}/M in \xB7 ${nt(i)}/M out` : '',
|
|
4503
4508
|
s = {
|
|
4504
4509
|
slug: e.slug,
|
|
4505
4510
|
name: e.name,
|
|
@@ -4510,20 +4515,20 @@ function at() {
|
|
|
4510
4515
|
priceFormatted: n,
|
|
4511
4516
|
unit: '/M tokens',
|
|
4512
4517
|
primaryToolName: 'run_task',
|
|
4513
|
-
parameters:
|
|
4518
|
+
parameters: ui(r),
|
|
4514
4519
|
};
|
|
4515
4520
|
return [e.slug, s];
|
|
4516
4521
|
}),
|
|
4517
4522
|
);
|
|
4518
4523
|
}
|
|
4519
|
-
var
|
|
4524
|
+
var ot = y(() => {
|
|
4520
4525
|
'use strict';
|
|
4521
|
-
|
|
4522
|
-
|
|
4526
|
+
at();
|
|
4527
|
+
N();
|
|
4523
4528
|
});
|
|
4524
4529
|
var G,
|
|
4525
4530
|
le,
|
|
4526
|
-
Te =
|
|
4531
|
+
Te = y(() => {
|
|
4527
4532
|
'use strict';
|
|
4528
4533
|
((G = ['seedance-2-5', 'seedance-2', 'seedance-2-mini', 'seedream-5-pro']),
|
|
4529
4534
|
(le =
|
|
@@ -4532,7 +4537,7 @@ var G,
|
|
|
4532
4537
|
function J(e) {
|
|
4533
4538
|
return `$${Number(e.toFixed(5))}`;
|
|
4534
4539
|
}
|
|
4535
|
-
function
|
|
4540
|
+
function hi(e) {
|
|
4536
4541
|
if (e.kind === 'llm') {
|
|
4537
4542
|
let t = e.defaultEndpoint,
|
|
4538
4543
|
i = (s) =>
|
|
@@ -4542,28 +4547,28 @@ function mi(e) {
|
|
|
4542
4547
|
(!t || !o.endpoint || o.endpoint === t) &&
|
|
4543
4548
|
(!o.context || o.context === '0\u201332K'),
|
|
4544
4549
|
),
|
|
4545
|
-
|
|
4550
|
+
r = i('input'),
|
|
4546
4551
|
n = i('output');
|
|
4547
|
-
return
|
|
4548
|
-
? `${J(
|
|
4552
|
+
return r && n
|
|
4553
|
+
? `${J(r.price.starter)}/M in \xB7 ${J(n.price.starter)}/M out`
|
|
4549
4554
|
: `from ${J(se(e).price.starter)}/M tokens`;
|
|
4550
4555
|
}
|
|
4551
4556
|
return `from ${J(se(e).price.starter)}${e.unit}`;
|
|
4552
4557
|
}
|
|
4553
|
-
function
|
|
4554
|
-
let i = t.filter((
|
|
4558
|
+
function yi(e, t) {
|
|
4559
|
+
let i = t.filter((r) => Number.isFinite(r) && r > 0);
|
|
4555
4560
|
return i.length ? `from ${J(Math.min(...i))}${e}` : null;
|
|
4556
4561
|
}
|
|
4557
|
-
function
|
|
4562
|
+
function ct(e) {
|
|
4558
4563
|
for (let t of B) {
|
|
4559
4564
|
let i = de[t],
|
|
4560
|
-
|
|
4561
|
-
i &&
|
|
4565
|
+
r = i ? yi(i.unit, e[t] ?? []) : null;
|
|
4566
|
+
i && r && (i.priceFormatted = r);
|
|
4562
4567
|
}
|
|
4563
4568
|
}
|
|
4564
4569
|
function H(e, t) {
|
|
4565
4570
|
let i = e.axes?.resolution ?? [
|
|
4566
|
-
...new Set(e.variants.map((
|
|
4571
|
+
...new Set(e.variants.map((r) => r.resolution).filter((r) => !!r)),
|
|
4567
4572
|
];
|
|
4568
4573
|
return {
|
|
4569
4574
|
name: 'resolution',
|
|
@@ -4573,7 +4578,7 @@ function H(e, t) {
|
|
|
4573
4578
|
...(t ? { description: t } : {}),
|
|
4574
4579
|
};
|
|
4575
4580
|
}
|
|
4576
|
-
function
|
|
4581
|
+
function ut(e) {
|
|
4577
4582
|
if (!e.endpoints?.length) return null;
|
|
4578
4583
|
let t = e.endpoints.filter((i) => Qe(e.slug, i.id));
|
|
4579
4584
|
return {
|
|
@@ -4582,24 +4587,26 @@ function dt(e) {
|
|
|
4582
4587
|
default: xe(e),
|
|
4583
4588
|
options: e.endpoints.filter((i) => !t.includes(i)).map((i) => i.id),
|
|
4584
4589
|
description:
|
|
4585
|
-
|
|
4590
|
+
(e.slug === 'gemini-3.1-pro-preview'
|
|
4591
|
+
? 'Where the request is served; a missing endpoint is the default, the lowest price, and an unknown one is refused.'
|
|
4592
|
+
: 'Where the request is served; a missing or unknown endpoint is the default, the lowest price.') +
|
|
4586
4593
|
(t.length ? ` ${t.map((i) => i.label).join(' and ')}: coming soon.` : ''),
|
|
4587
4594
|
};
|
|
4588
4595
|
}
|
|
4589
|
-
function
|
|
4590
|
-
if (e.unfiltered == null || t.some((
|
|
4596
|
+
function ki(e, t) {
|
|
4597
|
+
if (e.unfiltered == null || t.some((r) => r.name === 'creative_mode')) return t;
|
|
4591
4598
|
let i = G.includes(e.api.model);
|
|
4592
|
-
return [...t.filter((
|
|
4599
|
+
return [...t.filter((r) => !Ke.has(r.name)), i ? mt : bi];
|
|
4593
4600
|
}
|
|
4594
4601
|
function Me(e, t) {
|
|
4595
|
-
let i = e.filter((n) =>
|
|
4596
|
-
|
|
4597
|
-
return (
|
|
4602
|
+
let i = e.filter((n) => !Ke.has(n.name)),
|
|
4603
|
+
r = [mt, wi];
|
|
4604
|
+
return (r.push(ft, gt), [...i, ...r]);
|
|
4598
4605
|
}
|
|
4599
|
-
function
|
|
4606
|
+
function lt(e) {
|
|
4600
4607
|
return [
|
|
4601
4608
|
...e
|
|
4602
|
-
.filter((t) => !
|
|
4609
|
+
.filter((t) => !Ii.has(t.name) && !Ke.has(t.name))
|
|
4603
4610
|
.map((t) =>
|
|
4604
4611
|
t.name === 'resolution'
|
|
4605
4612
|
? {
|
|
@@ -4615,13 +4622,13 @@ function st(e) {
|
|
|
4615
4622
|
options: ['standard'],
|
|
4616
4623
|
description: 'LITE uses standard bitrate. High bitrate is on the standard endpoint.',
|
|
4617
4624
|
},
|
|
4618
|
-
|
|
4619
|
-
|
|
4625
|
+
ft,
|
|
4626
|
+
gt,
|
|
4620
4627
|
];
|
|
4621
4628
|
}
|
|
4622
4629
|
function Se(e, t) {
|
|
4623
4630
|
return [
|
|
4624
|
-
|
|
4631
|
+
K('Text prompt describing the video.'),
|
|
4625
4632
|
{ name: 'mode', type: 'select', required: !0, default: t.modes[0], options: t.modes },
|
|
4626
4633
|
{
|
|
4627
4634
|
name: 'duration',
|
|
@@ -4648,10 +4655,10 @@ function Se(e, t) {
|
|
|
4648
4655
|
),
|
|
4649
4656
|
];
|
|
4650
4657
|
}
|
|
4651
|
-
function
|
|
4652
|
-
let t =
|
|
4658
|
+
function xi(e) {
|
|
4659
|
+
let t = ut(e);
|
|
4653
4660
|
return [
|
|
4654
|
-
|
|
4661
|
+
K('Image prompt text. Supports complex composition and text instructions.'),
|
|
4655
4662
|
...(t ? [t] : []),
|
|
4656
4663
|
{
|
|
4657
4664
|
name: 'quality',
|
|
@@ -4660,28 +4667,6 @@ function wi(e) {
|
|
|
4660
4667
|
options: e.axes?.quality ?? ['low', 'medium', 'high'],
|
|
4661
4668
|
},
|
|
4662
4669
|
H(e, 'Square output: 1024, 2048 or 2880 px.'),
|
|
4663
|
-
{
|
|
4664
|
-
name: 'aspect_ratio',
|
|
4665
|
-
type: 'select',
|
|
4666
|
-
options: [
|
|
4667
|
-
'1:1',
|
|
4668
|
-
'16:9',
|
|
4669
|
-
'9:16',
|
|
4670
|
-
'4:3',
|
|
4671
|
-
'3:4',
|
|
4672
|
-
'3:2',
|
|
4673
|
-
'2:3',
|
|
4674
|
-
'4:5',
|
|
4675
|
-
'5:4',
|
|
4676
|
-
'1:2',
|
|
4677
|
-
'2:1',
|
|
4678
|
-
'21:9',
|
|
4679
|
-
'9:21',
|
|
4680
|
-
'auto',
|
|
4681
|
-
],
|
|
4682
|
-
description:
|
|
4683
|
-
'Accepted for older clients. GPT Image output stays square at the resolution (1024, 2048, or 2880 px) whatever ratio is sent.',
|
|
4684
|
-
},
|
|
4685
4670
|
{
|
|
4686
4671
|
name: 'input_images',
|
|
4687
4672
|
type: 'string[]',
|
|
@@ -4725,9 +4710,9 @@ function wi(e) {
|
|
|
4725
4710
|
},
|
|
4726
4711
|
];
|
|
4727
4712
|
}
|
|
4728
|
-
function
|
|
4713
|
+
function _i(e) {
|
|
4729
4714
|
return [
|
|
4730
|
-
|
|
4715
|
+
K('Image prompt text.'),
|
|
4731
4716
|
{
|
|
4732
4717
|
name: 'input_images',
|
|
4733
4718
|
type: 'string[]',
|
|
@@ -4759,9 +4744,37 @@ function ki(e) {
|
|
|
4759
4744
|
},
|
|
4760
4745
|
];
|
|
4761
4746
|
}
|
|
4762
|
-
function
|
|
4747
|
+
function Mi() {
|
|
4748
|
+
let e = tt,
|
|
4749
|
+
t = [];
|
|
4750
|
+
for (let i of ht(!0)) {
|
|
4751
|
+
let n = !e.includes(i.name) ? 'Cheap endpoint only.' : '';
|
|
4752
|
+
(t.push({
|
|
4753
|
+
...i,
|
|
4754
|
+
...(i.name === 'max_tokens' || i.name === 'max_completion_tokens' ? { min: 64 } : {}),
|
|
4755
|
+
...(i.name === 'messages'
|
|
4756
|
+
? {
|
|
4757
|
+
description:
|
|
4758
|
+
'Chat history: system, developer, user (text and image_url parts) and assistant turns; assistant tool_calls and tool turns on Cheap only.',
|
|
4759
|
+
}
|
|
4760
|
+
: n
|
|
4761
|
+
? { description: i.description ? `${i.description} ${n}` : n }
|
|
4762
|
+
: {}),
|
|
4763
|
+
}),
|
|
4764
|
+
i.name === 'top_p' &&
|
|
4765
|
+
t.push({
|
|
4766
|
+
name: 'top_k',
|
|
4767
|
+
type: 'number',
|
|
4768
|
+
min: 1,
|
|
4769
|
+
max: 64,
|
|
4770
|
+
description: 'Sample from the k likeliest tokens. Stable endpoint only.',
|
|
4771
|
+
}));
|
|
4772
|
+
}
|
|
4773
|
+
return t;
|
|
4774
|
+
}
|
|
4775
|
+
function ht(e) {
|
|
4763
4776
|
return [
|
|
4764
|
-
|
|
4777
|
+
K('The user message or task.'),
|
|
4765
4778
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
4766
4779
|
{
|
|
4767
4780
|
name: 'messages',
|
|
@@ -4854,36 +4867,40 @@ function _i(e) {
|
|
|
4854
4867
|
},
|
|
4855
4868
|
];
|
|
4856
4869
|
}
|
|
4857
|
-
function
|
|
4858
|
-
if (e.slug === 'seed-2-1-turbo') return
|
|
4859
|
-
let t =
|
|
4870
|
+
function Si(e) {
|
|
4871
|
+
if (e.slug === 'seed-2-1-turbo') return Pi;
|
|
4872
|
+
let t = ut(e);
|
|
4860
4873
|
return [
|
|
4861
|
-
...(e.slug === '
|
|
4874
|
+
...(e.slug === 'gemini-3.1-pro-preview'
|
|
4875
|
+
? Mi()
|
|
4876
|
+
: e.slug === 'gpt-6-astra' || Ti.includes(e.slug)
|
|
4877
|
+
? ht(e.slug !== 'gpt-6-astra')
|
|
4878
|
+
: vi),
|
|
4862
4879
|
...(t ? [t] : []),
|
|
4863
4880
|
];
|
|
4864
4881
|
}
|
|
4865
|
-
function
|
|
4882
|
+
function $i(e) {
|
|
4866
4883
|
let t = e.slug;
|
|
4867
|
-
if (e.kind === 'llm') return
|
|
4868
|
-
if (e.editVariants?.length) return
|
|
4884
|
+
if (e.kind === 'llm') return Si(e);
|
|
4885
|
+
if (e.editVariants?.length) return xi(e);
|
|
4869
4886
|
switch (t) {
|
|
4870
4887
|
case 'seedance-2-5':
|
|
4871
|
-
return Me(
|
|
4888
|
+
return Me(pt, t);
|
|
4872
4889
|
case 'seedance-2-5-lite':
|
|
4873
|
-
return
|
|
4890
|
+
return lt(pt);
|
|
4874
4891
|
case 'seedance-2':
|
|
4875
|
-
return Me(
|
|
4892
|
+
return Me(dt, t);
|
|
4876
4893
|
case 'seedance-2-lite':
|
|
4877
|
-
return
|
|
4894
|
+
return lt(dt);
|
|
4878
4895
|
case 'seedance-2-mini':
|
|
4879
|
-
return Me(
|
|
4896
|
+
return Me(Ki, t);
|
|
4880
4897
|
case 'nano-banana-2':
|
|
4881
4898
|
case 'nano-banana-2.1':
|
|
4882
4899
|
case 'nano-banana-pro':
|
|
4883
|
-
return
|
|
4900
|
+
return _i(e);
|
|
4884
4901
|
case 'seedream-5-pro':
|
|
4885
4902
|
return [
|
|
4886
|
-
|
|
4903
|
+
K('Detailed description of the image to generate.'),
|
|
4887
4904
|
{ name: 'images', type: 'string[]', description: 'Reference images (the first is free).' },
|
|
4888
4905
|
H(e),
|
|
4889
4906
|
{
|
|
@@ -4897,7 +4914,7 @@ function Ti(e) {
|
|
|
4897
4914
|
case 'qwen-3':
|
|
4898
4915
|
case 'qwen-3-pro':
|
|
4899
4916
|
return [
|
|
4900
|
-
|
|
4917
|
+
K('Image prompt text; dense layouts and multilingual text work well.'),
|
|
4901
4918
|
{
|
|
4902
4919
|
name: 'images',
|
|
4903
4920
|
type: 'string[]',
|
|
@@ -4972,135 +4989,136 @@ function Ti(e) {
|
|
|
4972
4989
|
references: ['images', 'videos', 'audios', 'first_frame_image', 'last_frame_image'],
|
|
4973
4990
|
});
|
|
4974
4991
|
default:
|
|
4975
|
-
return [
|
|
4992
|
+
return [K('Prompt text.')];
|
|
4976
4993
|
}
|
|
4977
4994
|
}
|
|
4978
|
-
function
|
|
4995
|
+
function $e(e, t = e.api.model) {
|
|
4979
4996
|
return {
|
|
4980
4997
|
slug: t,
|
|
4981
4998
|
name: e.name,
|
|
4982
|
-
category:
|
|
4983
|
-
kind:
|
|
4999
|
+
category: mi[e.kind],
|
|
5000
|
+
kind: gi[e.kind],
|
|
4984
5001
|
vendor: e.vendor ?? '',
|
|
4985
5002
|
description: e.desc ?? e.name,
|
|
4986
|
-
priceFormatted:
|
|
5003
|
+
priceFormatted: hi(e),
|
|
4987
5004
|
unit: e.unit,
|
|
4988
|
-
primaryToolName:
|
|
4989
|
-
parameters:
|
|
5005
|
+
primaryToolName: fi[e.kind],
|
|
5006
|
+
parameters: ki(e, $i(e)),
|
|
4990
5007
|
};
|
|
4991
5008
|
}
|
|
4992
|
-
function
|
|
5009
|
+
function Ci() {
|
|
4993
5010
|
let e = {};
|
|
4994
5011
|
for (let t of ne())
|
|
4995
5012
|
if (t.slug !== 'seedance-2-fast') {
|
|
4996
5013
|
if (t.slug === 'seedance-2-mini') {
|
|
4997
|
-
e['seedance-2-mini'] =
|
|
5014
|
+
e['seedance-2-mini'] = $e(t, 'seedance-2-mini');
|
|
4998
5015
|
continue;
|
|
4999
5016
|
}
|
|
5000
5017
|
if (t.slug === 'seedance-2') {
|
|
5001
|
-
let i =
|
|
5018
|
+
let i = $e(t);
|
|
5002
5019
|
((i.description = `${t.desc ?? t.name} Send quality fast or mini for Seedance 2.0 Fast or Mini.`),
|
|
5003
5020
|
(e['seedance-2'] = i));
|
|
5004
5021
|
continue;
|
|
5005
5022
|
}
|
|
5006
|
-
t.slug.startsWith('claude-') || (e[t.api.model] =
|
|
5023
|
+
t.slug.startsWith('claude-') || (e[t.api.model] = $e(t));
|
|
5007
5024
|
}
|
|
5008
|
-
Object.assign(e,
|
|
5025
|
+
Object.assign(e, st());
|
|
5009
5026
|
for (let [t, i] of Object.entries(oe))
|
|
5010
5027
|
e[i] && Object.defineProperty(e, t, { value: e[i], enumerable: !1 });
|
|
5011
5028
|
return e;
|
|
5012
5029
|
}
|
|
5013
|
-
function
|
|
5030
|
+
function V(e) {
|
|
5014
5031
|
return de[e] ?? null;
|
|
5015
5032
|
}
|
|
5016
|
-
function
|
|
5033
|
+
function wt(e, t, i) {
|
|
5017
5034
|
if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite') && t === 'duration') {
|
|
5018
|
-
let
|
|
5019
|
-
if (
|
|
5035
|
+
let r = (n) => (typeof n == 'string' ? n.trim().toLowerCase() : '');
|
|
5036
|
+
if (r(i.mode) === 'edit' || r(i.omni_reference_task_type) === 'edit') return !1;
|
|
5020
5037
|
}
|
|
5021
5038
|
return !0;
|
|
5022
5039
|
}
|
|
5023
5040
|
function E() {
|
|
5024
5041
|
return Object.values(de);
|
|
5025
5042
|
}
|
|
5026
|
-
var
|
|
5027
|
-
|
|
5028
|
-
ui,
|
|
5029
|
-
$,
|
|
5030
|
-
ct,
|
|
5043
|
+
var mi,
|
|
5044
|
+
fi,
|
|
5031
5045
|
gi,
|
|
5032
|
-
|
|
5033
|
-
ut,
|
|
5046
|
+
K,
|
|
5034
5047
|
mt,
|
|
5035
|
-
$e,
|
|
5036
5048
|
bi,
|
|
5049
|
+
wi,
|
|
5050
|
+
ft,
|
|
5051
|
+
gt,
|
|
5052
|
+
Ke,
|
|
5037
5053
|
Ii,
|
|
5038
|
-
xi,
|
|
5039
5054
|
vi,
|
|
5055
|
+
Pi,
|
|
5056
|
+
Ti,
|
|
5040
5057
|
pe,
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5058
|
+
pt,
|
|
5059
|
+
yt,
|
|
5060
|
+
bt,
|
|
5061
|
+
dt,
|
|
5062
|
+
Ki,
|
|
5046
5063
|
de,
|
|
5047
|
-
W =
|
|
5064
|
+
W = y(() => {
|
|
5048
5065
|
'use strict';
|
|
5049
5066
|
he();
|
|
5050
|
-
|
|
5051
|
-
ve();
|
|
5067
|
+
N();
|
|
5052
5068
|
_e();
|
|
5069
|
+
ve();
|
|
5053
5070
|
Xe();
|
|
5054
5071
|
et();
|
|
5055
|
-
|
|
5072
|
+
it();
|
|
5073
|
+
ot();
|
|
5056
5074
|
Te();
|
|
5057
|
-
((
|
|
5058
|
-
(
|
|
5075
|
+
((mi = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
|
|
5076
|
+
(fi = {
|
|
5059
5077
|
video: 'generate_video',
|
|
5060
5078
|
image: 'generate_image',
|
|
5061
5079
|
audio: 'generate_audio',
|
|
5062
5080
|
llm: 'run_task',
|
|
5063
5081
|
}),
|
|
5064
|
-
(
|
|
5082
|
+
(gi = {
|
|
5065
5083
|
video: 'Text-to-Video',
|
|
5066
5084
|
image: 'Text-to-Image',
|
|
5067
5085
|
audio: 'Text-to-Audio',
|
|
5068
5086
|
llm: 'Reasoning (LLM)',
|
|
5069
5087
|
}));
|
|
5070
|
-
|
|
5071
|
-
((
|
|
5088
|
+
K = (e) => ({ name: 'prompt', type: 'string', required: !0, description: e });
|
|
5089
|
+
((mt = {
|
|
5072
5090
|
name: 'creative_mode',
|
|
5073
5091
|
type: 'boolean',
|
|
5074
5092
|
default: !1,
|
|
5075
5093
|
description:
|
|
5076
5094
|
'Runs the Creative mode checkpoint at its published price (+5%). The Acceptable Use Policy applies.',
|
|
5077
5095
|
}),
|
|
5078
|
-
(
|
|
5096
|
+
(bi = {
|
|
5079
5097
|
name: 'creative_mode',
|
|
5080
5098
|
type: 'boolean',
|
|
5081
5099
|
default: !1,
|
|
5082
5100
|
description: `Not available yet on this model: ${le}.`,
|
|
5083
5101
|
}),
|
|
5084
|
-
(
|
|
5102
|
+
(wi = {
|
|
5085
5103
|
name: 'priority',
|
|
5086
5104
|
type: 'boolean',
|
|
5087
5105
|
default: !1,
|
|
5088
5106
|
description: 'Guaranteed speed and no queue, at the published Priority price (+6%).',
|
|
5089
5107
|
}),
|
|
5090
|
-
(
|
|
5108
|
+
(ft = {
|
|
5091
5109
|
name: 'reference_roles',
|
|
5092
5110
|
type: 'json',
|
|
5093
5111
|
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).`,
|
|
5094
5112
|
}),
|
|
5095
|
-
(
|
|
5113
|
+
(gt = {
|
|
5096
5114
|
name: 'auto_fit_images',
|
|
5097
5115
|
type: 'boolean',
|
|
5098
5116
|
default: !1,
|
|
5099
5117
|
description:
|
|
5100
5118
|
'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.',
|
|
5101
5119
|
}),
|
|
5102
|
-
(
|
|
5103
|
-
|
|
5120
|
+
(Ke = new Set(['full_access', 'is_uncensored', 'unfiltered', 'verificationSignature'])));
|
|
5121
|
+
Ii = new Set([
|
|
5104
5122
|
'quality',
|
|
5105
5123
|
'bitrate_mode',
|
|
5106
5124
|
'draft',
|
|
@@ -5108,8 +5126,8 @@ var di,
|
|
|
5108
5126
|
'draft_generation_id',
|
|
5109
5127
|
'pass_faces',
|
|
5110
5128
|
]);
|
|
5111
|
-
((
|
|
5112
|
-
|
|
5129
|
+
((vi = [
|
|
5130
|
+
K('The user message or task.'),
|
|
5113
5131
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
5114
5132
|
{
|
|
5115
5133
|
name: 'messages',
|
|
@@ -5126,8 +5144,8 @@ var di,
|
|
|
5126
5144
|
{ name: 'temperature', type: 'slider', min: 0, max: 1, step: 0.1 },
|
|
5127
5145
|
{ name: 'top_p', type: 'slider', min: 0, max: 1, step: 0.05 },
|
|
5128
5146
|
]),
|
|
5129
|
-
(
|
|
5130
|
-
|
|
5147
|
+
(Pi = [
|
|
5148
|
+
K('The user message or task.'),
|
|
5131
5149
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
5132
5150
|
{
|
|
5133
5151
|
name: 'messages',
|
|
@@ -5208,9 +5226,9 @@ var di,
|
|
|
5208
5226
|
description: 'Video frames read a second.',
|
|
5209
5227
|
},
|
|
5210
5228
|
]),
|
|
5211
|
-
(
|
|
5229
|
+
(Ti = ['gemini-3.8-flash', 'gemini-3.7-flash']));
|
|
5212
5230
|
((pe = 'Left out: 480p, the same default as the API, the playground and workflow steps.'),
|
|
5213
|
-
(
|
|
5231
|
+
(pt = [
|
|
5214
5232
|
{
|
|
5215
5233
|
name: 'prompt',
|
|
5216
5234
|
type: 'string',
|
|
@@ -5355,19 +5373,19 @@ var di,
|
|
|
5355
5373
|
description: 'Preserve facial likeness from reference images.',
|
|
5356
5374
|
},
|
|
5357
5375
|
]),
|
|
5358
|
-
(
|
|
5376
|
+
(yt = {
|
|
5359
5377
|
name: 'images',
|
|
5360
5378
|
type: 'string[]',
|
|
5361
5379
|
description:
|
|
5362
5380
|
'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.',
|
|
5363
5381
|
}),
|
|
5364
|
-
(
|
|
5382
|
+
(bt = {
|
|
5365
5383
|
name: 'audios',
|
|
5366
5384
|
type: 'string[]',
|
|
5367
5385
|
description:
|
|
5368
5386
|
'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.',
|
|
5369
5387
|
}),
|
|
5370
|
-
(
|
|
5388
|
+
(dt = [
|
|
5371
5389
|
{
|
|
5372
5390
|
name: 'prompt',
|
|
5373
5391
|
type: 'string',
|
|
@@ -5445,8 +5463,8 @@ var di,
|
|
|
5445
5463
|
description:
|
|
5446
5464
|
'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
|
|
5447
5465
|
},
|
|
5448
|
-
|
|
5449
|
-
|
|
5466
|
+
yt,
|
|
5467
|
+
bt,
|
|
5450
5468
|
{
|
|
5451
5469
|
name: 'first_frame_image',
|
|
5452
5470
|
type: 'string',
|
|
@@ -5460,7 +5478,7 @@ var di,
|
|
|
5460
5478
|
'End frame image as a public http(s) URL or data URI. Sent with mode multi_reference it is used as a reference image (within the image limit); other reference modes do not use it. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.',
|
|
5461
5479
|
},
|
|
5462
5480
|
]),
|
|
5463
|
-
(
|
|
5481
|
+
(Ki = [
|
|
5464
5482
|
{
|
|
5465
5483
|
name: 'prompt',
|
|
5466
5484
|
type: 'string',
|
|
@@ -5515,8 +5533,8 @@ var di,
|
|
|
5515
5533
|
description:
|
|
5516
5534
|
'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
|
|
5517
5535
|
},
|
|
5518
|
-
|
|
5519
|
-
|
|
5536
|
+
yt,
|
|
5537
|
+
bt,
|
|
5520
5538
|
{
|
|
5521
5539
|
name: 'first_frame_image',
|
|
5522
5540
|
type: 'string',
|
|
@@ -5524,52 +5542,52 @@ var di,
|
|
|
5524
5542
|
'Start frame image as a public http(s) URL or data URI. It makes the run Image to Video, so it cannot be sent with images or audios. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.',
|
|
5525
5543
|
},
|
|
5526
5544
|
]));
|
|
5527
|
-
de =
|
|
5545
|
+
de = Ci();
|
|
5528
5546
|
});
|
|
5529
5547
|
function ce(e) {
|
|
5530
5548
|
let t = '/v1/pricing/models',
|
|
5531
5549
|
i = e?.trim();
|
|
5532
5550
|
return i ? `${t}?model=${encodeURIComponent(i)}` : t;
|
|
5533
5551
|
}
|
|
5534
|
-
var qe =
|
|
5552
|
+
var qe = y(() => {
|
|
5535
5553
|
'use strict';
|
|
5536
5554
|
});
|
|
5537
|
-
function
|
|
5555
|
+
function Kt(e) {
|
|
5538
5556
|
return e.length <= 1 ? (e[0] ?? '') : `${e.slice(0, -1).join(', ')} and ${e[e.length - 1]}`;
|
|
5539
5557
|
}
|
|
5540
|
-
function
|
|
5558
|
+
function Ct(e) {
|
|
5541
5559
|
let t = ne().filter((s) => s.kind === e && s.unfiltered != null),
|
|
5542
5560
|
i = t.filter((s) => G.includes(s.api.model)).map((s) => s.name),
|
|
5543
|
-
|
|
5561
|
+
r = t.filter((s) => !G.includes(s.api.model)).map((s) => s.name);
|
|
5544
5562
|
return [
|
|
5545
5563
|
...(i.length
|
|
5546
|
-
? [`${
|
|
5564
|
+
? [`${Kt(i)}: runs the Creative mode checkpoint at its published price (+5%).`]
|
|
5547
5565
|
: []),
|
|
5548
|
-
...(
|
|
5566
|
+
...(r.length ? [`Not available yet on ${Kt(r)}: ${le}.`] : []),
|
|
5549
5567
|
'The Acceptable Use Policy applies.',
|
|
5550
5568
|
].join(' ');
|
|
5551
5569
|
}
|
|
5552
|
-
function
|
|
5553
|
-
if (
|
|
5570
|
+
function er(e) {
|
|
5571
|
+
if (Xi.has(e.name)) return e;
|
|
5554
5572
|
let t = e.inputSchema.properties;
|
|
5555
5573
|
return !t || t.callback_url
|
|
5556
5574
|
? e
|
|
5557
|
-
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url:
|
|
5575
|
+
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url: Qi } } };
|
|
5558
5576
|
}
|
|
5559
|
-
function
|
|
5577
|
+
function tr(e) {
|
|
5560
5578
|
let t = e.inputSchema.properties;
|
|
5561
5579
|
if (!t) return e;
|
|
5562
5580
|
let i = !1,
|
|
5563
|
-
|
|
5581
|
+
r = {};
|
|
5564
5582
|
for (let [n, s] of Object.entries(t))
|
|
5565
|
-
|
|
5566
|
-
? ((
|
|
5567
|
-
:
|
|
5568
|
-
? ((
|
|
5569
|
-
: (
|
|
5570
|
-
return i ? { ...e, inputSchema: { ...e.inputSchema, properties:
|
|
5583
|
+
qt.has(n) && s.type === 'string' && !s.format
|
|
5584
|
+
? ((r[n] = { ...s, format: 'uri' }), (i = !0))
|
|
5585
|
+
: qt.has(n) && s.type === 'array' && s.items?.type === 'string' && !s.items.format
|
|
5586
|
+
? ((r[n] = { ...s, items: { ...s.items, format: 'uri' } }), (i = !0))
|
|
5587
|
+
: (r[n] = s);
|
|
5588
|
+
return i ? { ...e, inputSchema: { ...e.inputSchema, properties: r } } : e;
|
|
5571
5589
|
}
|
|
5572
|
-
function
|
|
5590
|
+
function ir(e) {
|
|
5573
5591
|
switch (e.type) {
|
|
5574
5592
|
case 'string':
|
|
5575
5593
|
return {
|
|
@@ -5624,14 +5642,14 @@ function Zi(e) {
|
|
|
5624
5642
|
return { type: 'string', description: e.description };
|
|
5625
5643
|
}
|
|
5626
5644
|
}
|
|
5627
|
-
function
|
|
5645
|
+
function rr(e, t) {
|
|
5628
5646
|
let i = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
|
|
5629
|
-
|
|
5647
|
+
r = {},
|
|
5630
5648
|
n = [];
|
|
5631
|
-
for (let o of e.parameters) ((
|
|
5649
|
+
for (let o of e.parameters) ((r[o.name] = ir(o)), o.required && n.push(o.name));
|
|
5632
5650
|
let s = {
|
|
5633
5651
|
type: 'object',
|
|
5634
|
-
properties:
|
|
5652
|
+
properties: r,
|
|
5635
5653
|
...(n.length > 0 ? { required: n } : {}),
|
|
5636
5654
|
additionalProperties: !0,
|
|
5637
5655
|
};
|
|
@@ -5641,11 +5659,11 @@ function er(e, t) {
|
|
|
5641
5659
|
inputSchema: s,
|
|
5642
5660
|
};
|
|
5643
5661
|
}
|
|
5644
|
-
function
|
|
5662
|
+
function ar() {
|
|
5645
5663
|
let e = E().filter((c) => c.category === 'Image'),
|
|
5646
5664
|
t = E().filter((c) => c.category === 'Video'),
|
|
5647
5665
|
i = E().filter((c) => c.category === 'Text'),
|
|
5648
|
-
|
|
5666
|
+
r = E().filter((c) => c.category === 'Audio'),
|
|
5649
5667
|
n = {
|
|
5650
5668
|
name: 'generate_image',
|
|
5651
5669
|
description:
|
|
@@ -5666,7 +5684,7 @@ function tr() {
|
|
|
5666
5684
|
aspect_ratio: {
|
|
5667
5685
|
type: 'string',
|
|
5668
5686
|
description:
|
|
5669
|
-
'Aspect ratio where the model takes one (see each model tool for its list
|
|
5687
|
+
'Aspect ratio where the model takes one (see each model tool for its list). Not for GPT Image models.',
|
|
5670
5688
|
},
|
|
5671
5689
|
resolution: {
|
|
5672
5690
|
type: 'string',
|
|
@@ -5692,7 +5710,7 @@ function tr() {
|
|
|
5692
5710
|
enum: ['low', 'medium', 'high', 'xhigh', 'max'],
|
|
5693
5711
|
default: 'low',
|
|
5694
5712
|
description:
|
|
5695
|
-
'GPT Image models only. gpt-image-2 supports low, medium and high; the 2.5 models also xhigh and max. GPT Image output is square at the resolution
|
|
5713
|
+
'GPT Image models only. gpt-image-2 supports low, medium and high; the 2.5 models also xhigh and max. GPT Image output is square at the resolution.',
|
|
5696
5714
|
},
|
|
5697
5715
|
n: {
|
|
5698
5716
|
type: 'number',
|
|
@@ -5737,7 +5755,7 @@ function tr() {
|
|
|
5737
5755
|
maximum: 2147483647,
|
|
5738
5756
|
description: 'Nano Banana 2 and Nano Banana Pro. Omit it for a new image each time.',
|
|
5739
5757
|
},
|
|
5740
|
-
creative_mode: { type: 'boolean', default: !1, description:
|
|
5758
|
+
creative_mode: { type: 'boolean', default: !1, description: Ct('image') },
|
|
5741
5759
|
},
|
|
5742
5760
|
required: ['prompt'],
|
|
5743
5761
|
additionalProperties: !0,
|
|
@@ -5774,7 +5792,7 @@ function tr() {
|
|
|
5774
5792
|
default: '480p',
|
|
5775
5793
|
description: 'Video resolution (the lowest price is the default; see each model tool).',
|
|
5776
5794
|
},
|
|
5777
|
-
creative_mode: { type: 'boolean', default: !1, description:
|
|
5795
|
+
creative_mode: { type: 'boolean', default: !1, description: Ct('video') },
|
|
5778
5796
|
priority: {
|
|
5779
5797
|
type: 'boolean',
|
|
5780
5798
|
default: !1,
|
|
@@ -5896,10 +5914,10 @@ function tr() {
|
|
|
5896
5914
|
additionalProperties: !0,
|
|
5897
5915
|
},
|
|
5898
5916
|
},
|
|
5899
|
-
d =
|
|
5900
|
-
return [n, s, o, u, p, d, l,
|
|
5917
|
+
d = nr();
|
|
5918
|
+
return [n, s, o, u, p, d, l, Zi];
|
|
5901
5919
|
}
|
|
5902
|
-
function
|
|
5920
|
+
function nr() {
|
|
5903
5921
|
return {
|
|
5904
5922
|
name: 'upload_asset',
|
|
5905
5923
|
description:
|
|
@@ -5947,25 +5965,25 @@ function ir() {
|
|
|
5947
5965
|
};
|
|
5948
5966
|
}
|
|
5949
5967
|
function Le() {
|
|
5950
|
-
let e =
|
|
5951
|
-
t = E().map((i) =>
|
|
5952
|
-
return [...e, ...t].map(
|
|
5968
|
+
let e = ar(),
|
|
5969
|
+
t = E().map((i) => rr(i));
|
|
5970
|
+
return [...e, ...t].map(er).map(tr);
|
|
5953
5971
|
}
|
|
5954
|
-
var
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5972
|
+
var Qi,
|
|
5973
|
+
Xi,
|
|
5974
|
+
Zi,
|
|
5975
|
+
qt,
|
|
5976
|
+
Et = y(() => {
|
|
5959
5977
|
'use strict';
|
|
5960
|
-
|
|
5978
|
+
N();
|
|
5961
5979
|
Te();
|
|
5962
5980
|
W();
|
|
5963
|
-
((
|
|
5981
|
+
((Qi = {
|
|
5964
5982
|
type: 'string',
|
|
5965
5983
|
description:
|
|
5966
5984
|
'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.',
|
|
5967
5985
|
}),
|
|
5968
|
-
(
|
|
5986
|
+
(Xi = new Set([
|
|
5969
5987
|
'upload_asset',
|
|
5970
5988
|
'upload_media',
|
|
5971
5989
|
'upload_image',
|
|
@@ -5973,7 +5991,7 @@ var Wi,
|
|
|
5973
5991
|
'check_status',
|
|
5974
5992
|
'get_pricing',
|
|
5975
5993
|
])),
|
|
5976
|
-
(
|
|
5994
|
+
(Zi = {
|
|
5977
5995
|
name: 'get_pricing',
|
|
5978
5996
|
description:
|
|
5979
5997
|
'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.',
|
|
@@ -5988,7 +6006,7 @@ var Wi,
|
|
|
5988
6006
|
additionalProperties: !1,
|
|
5989
6007
|
},
|
|
5990
6008
|
}));
|
|
5991
|
-
|
|
6009
|
+
qt = new Set([
|
|
5992
6010
|
'image',
|
|
5993
6011
|
'images',
|
|
5994
6012
|
'image_url',
|
|
@@ -6005,28 +6023,28 @@ var Wi,
|
|
|
6005
6023
|
'lipsyncing_audio',
|
|
6006
6024
|
]);
|
|
6007
6025
|
});
|
|
6008
|
-
var
|
|
6009
|
-
|
|
6010
|
-
forgetToolSchemas: () =>
|
|
6011
|
-
jsonRpcAnswer: () =>
|
|
6012
|
-
preprocessLocalFiles: () =>
|
|
6013
|
-
startStdioServer: () =>
|
|
6026
|
+
var Bt = {};
|
|
6027
|
+
Qt(Bt, {
|
|
6028
|
+
forgetToolSchemas: () => dr,
|
|
6029
|
+
jsonRpcAnswer: () => Dt,
|
|
6030
|
+
preprocessLocalFiles: () => Ut,
|
|
6031
|
+
startStdioServer: () => jt,
|
|
6014
6032
|
});
|
|
6015
|
-
function
|
|
6033
|
+
function sr(e) {
|
|
6016
6034
|
let t = (i) =>
|
|
6017
6035
|
!!i && typeof i == 'object' && i.jsonrpc === '2.0' && ('result' in i || 'error' in i);
|
|
6018
6036
|
return Array.isArray(e) ? e.length > 0 && e.every(t) : t(e);
|
|
6019
6037
|
}
|
|
6020
|
-
function
|
|
6021
|
-
let
|
|
6022
|
-
n =
|
|
6038
|
+
function Dt(e, t, i) {
|
|
6039
|
+
let r = e?.id,
|
|
6040
|
+
n = r == null,
|
|
6023
6041
|
s = null;
|
|
6024
6042
|
try {
|
|
6025
6043
|
s = i ? JSON.parse(i) : null;
|
|
6026
6044
|
} catch {
|
|
6027
6045
|
s = null;
|
|
6028
6046
|
}
|
|
6029
|
-
if (s !== null &&
|
|
6047
|
+
if (s !== null && sr(s)) return n ? null : s;
|
|
6030
6048
|
if (n) return null;
|
|
6031
6049
|
if (!i && t >= 200 && t < 300) return;
|
|
6032
6050
|
let o = s?.error,
|
|
@@ -6039,7 +6057,7 @@ function At(e, t, i) {
|
|
|
6039
6057
|
p = o && typeof o == 'object' && typeof o.code == 'string' ? o.code : null;
|
|
6040
6058
|
return {
|
|
6041
6059
|
jsonrpc: '2.0',
|
|
6042
|
-
id:
|
|
6060
|
+
id: r,
|
|
6043
6061
|
error: {
|
|
6044
6062
|
code: t === 401 ? -32001 : -32603,
|
|
6045
6063
|
message: u,
|
|
@@ -6047,18 +6065,18 @@ function At(e, t, i) {
|
|
|
6047
6065
|
},
|
|
6048
6066
|
};
|
|
6049
6067
|
}
|
|
6050
|
-
function
|
|
6068
|
+
function or() {
|
|
6051
6069
|
let e = process.argv.slice(2),
|
|
6052
6070
|
t = e.indexOf('--api-key');
|
|
6053
6071
|
return S(t >= 0 ? e[t + 1] : void 0);
|
|
6054
6072
|
}
|
|
6055
|
-
async function
|
|
6056
|
-
let
|
|
6057
|
-
if (!A.default.existsSync(
|
|
6073
|
+
async function Lt(e, t, i) {
|
|
6074
|
+
let r = O.default.resolve(e);
|
|
6075
|
+
if (!A.default.existsSync(r) || !A.default.statSync(r).isFile())
|
|
6058
6076
|
throw new Error(`File not found: ${e}`);
|
|
6059
|
-
let n = A.default.readFileSync(
|
|
6077
|
+
let n = A.default.readFileSync(r),
|
|
6060
6078
|
s = n.toString('base64'),
|
|
6061
|
-
o = O.default.basename(
|
|
6079
|
+
o = O.default.basename(r),
|
|
6062
6080
|
u = n.length,
|
|
6063
6081
|
p = `${i.replace(/\/$/, '')}/v1/upload`,
|
|
6064
6082
|
l = await fetch(p, {
|
|
@@ -6082,15 +6100,15 @@ async function Rt(e, t, i) {
|
|
|
6082
6100
|
mimeType: d.mime_type || d.mimeType || 'image/png',
|
|
6083
6101
|
};
|
|
6084
6102
|
}
|
|
6085
|
-
function
|
|
6086
|
-
return
|
|
6103
|
+
function Nt(e) {
|
|
6104
|
+
return lr.has(O.default.extname(e).toLowerCase());
|
|
6087
6105
|
}
|
|
6088
|
-
function
|
|
6106
|
+
function Vt(e) {
|
|
6089
6107
|
return new Error(
|
|
6090
6108
|
`Tein uploads image, video and audio files only, and ${O.default.basename(e)} is not one.`,
|
|
6091
6109
|
);
|
|
6092
6110
|
}
|
|
6093
|
-
function
|
|
6111
|
+
function pr(e) {
|
|
6094
6112
|
let t = e.trim();
|
|
6095
6113
|
if (
|
|
6096
6114
|
!t ||
|
|
@@ -6103,7 +6121,7 @@ function sr(e) {
|
|
|
6103
6121
|
let i = O.default.resolve(t);
|
|
6104
6122
|
return A.default.existsSync(i) && A.default.statSync(i).isFile() ? i : null;
|
|
6105
6123
|
}
|
|
6106
|
-
function
|
|
6124
|
+
function Ve(e) {
|
|
6107
6125
|
if (Array.isArray(e))
|
|
6108
6126
|
for (let t of e) {
|
|
6109
6127
|
let i = t;
|
|
@@ -6113,14 +6131,14 @@ function Ne(e) {
|
|
|
6113
6131
|
Q.set(i.name, i.inputSchema);
|
|
6114
6132
|
}
|
|
6115
6133
|
}
|
|
6116
|
-
function
|
|
6117
|
-
(Q.clear(), (
|
|
6134
|
+
function dr() {
|
|
6135
|
+
(Q.clear(), (Ne = 0));
|
|
6118
6136
|
}
|
|
6119
|
-
async function
|
|
6120
|
-
if (!(Date.now() -
|
|
6121
|
-
|
|
6137
|
+
async function cr(e, t) {
|
|
6138
|
+
if (!(Date.now() - Ne < 6e4)) {
|
|
6139
|
+
Ne = Date.now();
|
|
6122
6140
|
try {
|
|
6123
|
-
let
|
|
6141
|
+
let r = await (
|
|
6124
6142
|
await fetch(e, {
|
|
6125
6143
|
method: 'POST',
|
|
6126
6144
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${t}` },
|
|
@@ -6128,39 +6146,39 @@ async function lr(e, t) {
|
|
|
6128
6146
|
signal: AbortSignal.timeout(1e4),
|
|
6129
6147
|
})
|
|
6130
6148
|
).json();
|
|
6131
|
-
|
|
6149
|
+
Ve(r.result?.tools);
|
|
6132
6150
|
} catch {}
|
|
6133
6151
|
}
|
|
6134
6152
|
}
|
|
6135
|
-
function
|
|
6153
|
+
function ur(e) {
|
|
6136
6154
|
return e
|
|
6137
6155
|
? e.type === 'string'
|
|
6138
6156
|
? e.format === 'uri'
|
|
6139
6157
|
: e.type === 'array' && e.items?.format === 'uri'
|
|
6140
6158
|
: !1;
|
|
6141
6159
|
}
|
|
6142
|
-
async function
|
|
6160
|
+
async function At(e, t, i) {
|
|
6143
6161
|
if (typeof e != 'string') return e;
|
|
6144
|
-
let
|
|
6145
|
-
if (!
|
|
6146
|
-
if (!
|
|
6147
|
-
return (await
|
|
6162
|
+
let r = pr(e);
|
|
6163
|
+
if (!r) return e;
|
|
6164
|
+
if (!Nt(r)) throw Vt(r);
|
|
6165
|
+
return (await Lt(r, t, i)).url;
|
|
6148
6166
|
}
|
|
6149
|
-
async function
|
|
6150
|
-
(Q.size === 0 &&
|
|
6167
|
+
async function Ut(e, t, i, r, n) {
|
|
6168
|
+
(Q.size === 0 && Ve(Le()), Q.has(e) || (await cr(n, i)));
|
|
6151
6169
|
let s = Q.get(e)?.properties;
|
|
6152
6170
|
if (!s) return t;
|
|
6153
6171
|
let o = { ...t };
|
|
6154
6172
|
for (let [u, p] of Object.entries(t))
|
|
6155
|
-
if (
|
|
6173
|
+
if (ur(s[u]))
|
|
6156
6174
|
if (Array.isArray(p)) {
|
|
6157
6175
|
let l = [];
|
|
6158
|
-
for (let d of p) l.push(await
|
|
6176
|
+
for (let d of p) l.push(await At(d, i, r));
|
|
6159
6177
|
o[u] = l;
|
|
6160
|
-
} else o[u] = await
|
|
6178
|
+
} else o[u] = await At(p, i, r);
|
|
6161
6179
|
return o;
|
|
6162
6180
|
}
|
|
6163
|
-
function
|
|
6181
|
+
function mr(e) {
|
|
6164
6182
|
let t = e.id ?? null;
|
|
6165
6183
|
switch (e.method) {
|
|
6166
6184
|
case 'initialize':
|
|
@@ -6201,13 +6219,13 @@ function dr(e) {
|
|
|
6201
6219
|
};
|
|
6202
6220
|
}
|
|
6203
6221
|
}
|
|
6204
|
-
async function
|
|
6205
|
-
if (
|
|
6206
|
-
|
|
6207
|
-
let e =
|
|
6222
|
+
async function jt() {
|
|
6223
|
+
if (Rt) return;
|
|
6224
|
+
Rt = !0;
|
|
6225
|
+
let e = or(),
|
|
6208
6226
|
t = I(),
|
|
6209
6227
|
i = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
|
|
6210
|
-
(
|
|
6228
|
+
(Ot.default
|
|
6211
6229
|
.createInterface({ input: process.stdin, output: process.stdout, terminal: !1 })
|
|
6212
6230
|
.on('line', async (n) => {
|
|
6213
6231
|
let s = n.trim();
|
|
@@ -6268,8 +6286,8 @@ async function Vt() {
|
|
|
6268
6286
|
try {
|
|
6269
6287
|
let c = O.default.resolve(d.trim());
|
|
6270
6288
|
if (A.default.existsSync(c) && A.default.statSync(c).isFile() && e) {
|
|
6271
|
-
if (!
|
|
6272
|
-
let m = await
|
|
6289
|
+
if (!Nt(c)) throw Vt(c);
|
|
6290
|
+
let m = await Lt(c, e, t),
|
|
6273
6291
|
f = (m.sizeBytes / 1024).toFixed(1),
|
|
6274
6292
|
ue =
|
|
6275
6293
|
m.mimeType.startsWith('image/') ||
|
|
@@ -6325,7 +6343,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
6325
6343
|
}
|
|
6326
6344
|
if (e)
|
|
6327
6345
|
try {
|
|
6328
|
-
o.params.arguments = await
|
|
6346
|
+
o.params.arguments = await Ut(String(p), l, e, t, i);
|
|
6329
6347
|
} catch (d) {
|
|
6330
6348
|
let c = d instanceof Error ? d.message : String(d);
|
|
6331
6349
|
process.stdout.write(
|
|
@@ -6356,10 +6374,10 @@ Pass this URL to any Tein generation tool.`,
|
|
|
6356
6374
|
body: JSON.stringify(o),
|
|
6357
6375
|
}),
|
|
6358
6376
|
l = await p.text(),
|
|
6359
|
-
d =
|
|
6377
|
+
d = Dt(o, p.status, l);
|
|
6360
6378
|
if (d === null) return;
|
|
6361
6379
|
if (d) {
|
|
6362
|
-
(o?.method === 'tools/list' &&
|
|
6380
|
+
(o?.method === 'tools/list' && Ve(d.result?.tools),
|
|
6363
6381
|
process.stdout.write(
|
|
6364
6382
|
JSON.stringify(d) +
|
|
6365
6383
|
`
|
|
@@ -6368,7 +6386,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
6368
6386
|
return;
|
|
6369
6387
|
}
|
|
6370
6388
|
} catch {}
|
|
6371
|
-
let u =
|
|
6389
|
+
let u = mr(o);
|
|
6372
6390
|
u !== null &&
|
|
6373
6391
|
process.stdout.write(
|
|
6374
6392
|
JSON.stringify(u) +
|
|
@@ -6393,20 +6411,20 @@ Pass this URL to any Tein generation tool.`,
|
|
|
6393
6411
|
}
|
|
6394
6412
|
var A,
|
|
6395
6413
|
O,
|
|
6396
|
-
|
|
6397
|
-
|
|
6414
|
+
Ot,
|
|
6415
|
+
lr,
|
|
6398
6416
|
Q,
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6417
|
+
Ne,
|
|
6418
|
+
Rt,
|
|
6419
|
+
Ft = y(() => {
|
|
6402
6420
|
'use strict';
|
|
6403
6421
|
((A = x(require('node:fs'))),
|
|
6404
6422
|
(O = x(require('node:path'))),
|
|
6405
|
-
(
|
|
6423
|
+
(Ot = x(require('node:readline'))));
|
|
6406
6424
|
qe();
|
|
6407
|
-
|
|
6425
|
+
Et();
|
|
6408
6426
|
q();
|
|
6409
|
-
|
|
6427
|
+
lr = new Set([
|
|
6410
6428
|
'.png',
|
|
6411
6429
|
'.jpg',
|
|
6412
6430
|
'.jpeg',
|
|
@@ -6432,40 +6450,40 @@ var A,
|
|
|
6432
6450
|
'.flac',
|
|
6433
6451
|
'.opus',
|
|
6434
6452
|
]);
|
|
6435
|
-
((Q = new Map()), (
|
|
6436
|
-
|
|
6453
|
+
((Q = new Map()), (Ne = 0));
|
|
6454
|
+
Rt = !1;
|
|
6437
6455
|
require.main === module &&
|
|
6438
|
-
|
|
6456
|
+
jt().catch((e) => {
|
|
6439
6457
|
(process.stderr.write(`Fatal error in Tein MCP CLI: ${e}
|
|
6440
6458
|
`),
|
|
6441
6459
|
process.exit(1));
|
|
6442
6460
|
});
|
|
6443
6461
|
});
|
|
6444
|
-
var
|
|
6462
|
+
var Zt =
|
|
6445
6463
|
!process.env.NO_COLOR &&
|
|
6446
6464
|
(process.stdout.isTTY || process.env.FORCE_COLOR === '1' || process.env.TERM !== 'dumb');
|
|
6447
|
-
function
|
|
6448
|
-
return (i) => (
|
|
6465
|
+
function b(e, t) {
|
|
6466
|
+
return (i) => (Zt ? `\x1B[${e}m${i}\x1B[${t}m` : String(i));
|
|
6449
6467
|
}
|
|
6450
|
-
var
|
|
6451
|
-
bold:
|
|
6452
|
-
dim:
|
|
6453
|
-
italic:
|
|
6454
|
-
underline:
|
|
6455
|
-
inverse:
|
|
6456
|
-
black:
|
|
6457
|
-
red:
|
|
6458
|
-
green:
|
|
6459
|
-
yellow:
|
|
6460
|
-
blue:
|
|
6461
|
-
magenta:
|
|
6462
|
-
cyan:
|
|
6463
|
-
white:
|
|
6464
|
-
gray:
|
|
6465
|
-
bgBlue:
|
|
6466
|
-
bgMagenta:
|
|
6467
|
-
bgCyan:
|
|
6468
|
-
bgGreen:
|
|
6468
|
+
var a = {
|
|
6469
|
+
bold: b(1, 22),
|
|
6470
|
+
dim: b(2, 22),
|
|
6471
|
+
italic: b(3, 23),
|
|
6472
|
+
underline: b(4, 24),
|
|
6473
|
+
inverse: b(7, 27),
|
|
6474
|
+
black: b(30, 39),
|
|
6475
|
+
red: b(31, 39),
|
|
6476
|
+
green: b(32, 39),
|
|
6477
|
+
yellow: b(33, 39),
|
|
6478
|
+
blue: b(34, 39),
|
|
6479
|
+
magenta: b(35, 39),
|
|
6480
|
+
cyan: b(36, 39),
|
|
6481
|
+
white: b(37, 39),
|
|
6482
|
+
gray: b(90, 39),
|
|
6483
|
+
bgBlue: b(44, 49),
|
|
6484
|
+
bgMagenta: b(45, 49),
|
|
6485
|
+
bgCyan: b(46, 49),
|
|
6486
|
+
bgGreen: b(42, 49),
|
|
6469
6487
|
},
|
|
6470
6488
|
P = class {
|
|
6471
6489
|
constructor(t = '') {
|
|
@@ -6491,7 +6509,7 @@ var r = {
|
|
|
6491
6509
|
process.stdout.isTTY
|
|
6492
6510
|
? (this.stop(),
|
|
6493
6511
|
(this.timer = setInterval(() => {
|
|
6494
|
-
let i =
|
|
6512
|
+
let i = a.cyan(this.frames[this.current]);
|
|
6495
6513
|
(process.stdout.write(`\r${i} ${this.text} `),
|
|
6496
6514
|
(this.current = (this.current + 1) % this.frames.length));
|
|
6497
6515
|
}, 80)),
|
|
@@ -6508,7 +6526,7 @@ var r = {
|
|
|
6508
6526
|
this.stop();
|
|
6509
6527
|
let i = t || this.text;
|
|
6510
6528
|
process.stdout.isTTY
|
|
6511
|
-
? process.stdout.write(`\r${
|
|
6529
|
+
? process.stdout.write(`\r${a.green('\u2713')} ${i}
|
|
6512
6530
|
`)
|
|
6513
6531
|
: process.stdout.write(`[\u2713] ${i}
|
|
6514
6532
|
`);
|
|
@@ -6517,7 +6535,7 @@ var r = {
|
|
|
6517
6535
|
this.stop();
|
|
6518
6536
|
let i = t || this.text;
|
|
6519
6537
|
process.stdout.isTTY
|
|
6520
|
-
? process.stdout.write(`\r${
|
|
6538
|
+
? process.stdout.write(`\r${a.red('\u2717')} ${i}
|
|
6521
6539
|
`)
|
|
6522
6540
|
: process.stdout.write(`[\u2717] ${i}
|
|
6523
6541
|
`);
|
|
@@ -6530,44 +6548,44 @@ var r = {
|
|
|
6530
6548
|
}
|
|
6531
6549
|
};
|
|
6532
6550
|
var R = x(require('node:fs')),
|
|
6533
|
-
|
|
6551
|
+
$ = x(require('node:path'));
|
|
6534
6552
|
var ee = x(require('node:fs')),
|
|
6535
6553
|
Be = x(require('node:path')),
|
|
6536
6554
|
Fe = require('node:stream/promises');
|
|
6537
|
-
var Z = '1.1.
|
|
6538
|
-
var
|
|
6555
|
+
var Z = '1.1.7';
|
|
6556
|
+
var ei = new Set([
|
|
6539
6557
|
'account_suspended',
|
|
6540
6558
|
'account_terminated',
|
|
6541
6559
|
'creative_mode_restricted',
|
|
6542
6560
|
'unfiltered_restricted',
|
|
6543
6561
|
'workspace_paused',
|
|
6544
6562
|
]),
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
constructor(t, i,
|
|
6563
|
+
_ = 1,
|
|
6564
|
+
ti = 3,
|
|
6565
|
+
w = class extends Error {
|
|
6566
|
+
constructor(t, i, r, n = {}) {
|
|
6549
6567
|
(super(i),
|
|
6550
6568
|
(this.name = 'TeinApiError'),
|
|
6551
6569
|
(this.status = t),
|
|
6552
|
-
|
|
6570
|
+
r && (this.code = r),
|
|
6553
6571
|
(this.fields = n));
|
|
6554
6572
|
}
|
|
6555
6573
|
get exitCode() {
|
|
6556
|
-
return this.code &&
|
|
6574
|
+
return this.code && ei.has(this.code) ? ti : _;
|
|
6557
6575
|
}
|
|
6558
6576
|
};
|
|
6559
|
-
function
|
|
6560
|
-
let
|
|
6561
|
-
if (!i || typeof i != 'object') return new
|
|
6577
|
+
function ii(e, t, i) {
|
|
6578
|
+
let r = `HTTP ${e}${t ? ` ${t}` : ''}`;
|
|
6579
|
+
if (!i || typeof i != 'object') return new w(e, r);
|
|
6562
6580
|
let n = i;
|
|
6563
6581
|
if (n.error && typeof n.error == 'object' && !Array.isArray(n.error)) {
|
|
6564
6582
|
let d = n.error,
|
|
6565
6583
|
{ code: c, message: m, ...f } = d;
|
|
6566
|
-
return new
|
|
6584
|
+
return new w(e, typeof m == 'string' && m ? m : r, typeof c == 'string' ? c : void 0, f);
|
|
6567
6585
|
}
|
|
6568
6586
|
let { error: s, code: o, message: u, ...p } = n,
|
|
6569
|
-
l = (typeof s == 'string' && s) || (typeof u == 'string' && u) ||
|
|
6570
|
-
return new
|
|
6587
|
+
l = (typeof s == 'string' && s) || (typeof u == 'string' && u) || r;
|
|
6588
|
+
return new w(e, l, typeof o == 'string' ? o : void 0, p);
|
|
6571
6589
|
}
|
|
6572
6590
|
function Ue(e) {
|
|
6573
6591
|
return typeof e == 'number' && Number.isFinite(e) ? `$${e.toFixed(4)}` : null;
|
|
@@ -6575,15 +6593,15 @@ function Ue(e) {
|
|
|
6575
6593
|
function M(e) {
|
|
6576
6594
|
let t = [e.message],
|
|
6577
6595
|
i = Ue(e.fields.required),
|
|
6578
|
-
|
|
6579
|
-
(i ||
|
|
6580
|
-
t.push([i ? `Required: ${i}` : '',
|
|
6596
|
+
r = Ue(e.fields.balance);
|
|
6597
|
+
(i || r) &&
|
|
6598
|
+
t.push([i ? `Required: ${i}` : '', r ? `Balance: ${r}` : ''].filter(Boolean).join(' '));
|
|
6581
6599
|
let n = e.fields.org_name ?? e.fields.orgName;
|
|
6582
6600
|
typeof n == 'string' && n && t.push(`Workspace: ${n}`);
|
|
6583
6601
|
let s = e.fields.url ?? e.fields.appeal_url ?? e.fields.top_up_url;
|
|
6584
6602
|
return (typeof s == 'string' && s && t.push(s), e.code && t.push(`(${e.code})`), t);
|
|
6585
6603
|
}
|
|
6586
|
-
function
|
|
6604
|
+
function ri(e) {
|
|
6587
6605
|
return /\.(mp4|webm|mov)(\?|$)/i.test(e)
|
|
6588
6606
|
? 'video'
|
|
6589
6607
|
: /\.(mp3|wav|ogg|flac)(\?|$)/i.test(e)
|
|
@@ -6595,7 +6613,7 @@ function je(e) {
|
|
|
6595
6613
|
for (let i of e.data ?? [])
|
|
6596
6614
|
typeof i.message?.content == 'string'
|
|
6597
6615
|
? t.push({ type: 'text', text: i.message.content })
|
|
6598
|
-
: i.url && t.push({ type:
|
|
6616
|
+
: i.url && t.push({ type: ri(i.url), url: i.url });
|
|
6599
6617
|
return t;
|
|
6600
6618
|
}
|
|
6601
6619
|
var T = class {
|
|
@@ -6610,18 +6628,18 @@ var T = class {
|
|
|
6610
6628
|
'X-Tein-Client': 'cli',
|
|
6611
6629
|
};
|
|
6612
6630
|
}
|
|
6613
|
-
async send(t, i,
|
|
6631
|
+
async send(t, i, r) {
|
|
6614
6632
|
let n = await fetch(`${this.baseUrl}${i}`, {
|
|
6615
6633
|
method: t,
|
|
6616
6634
|
headers: this.getHeaders(),
|
|
6617
|
-
...(
|
|
6635
|
+
...(r === void 0 ? {} : { body: JSON.stringify(r) }),
|
|
6618
6636
|
});
|
|
6619
6637
|
if (!n.ok) {
|
|
6620
6638
|
let s = null;
|
|
6621
6639
|
try {
|
|
6622
6640
|
s = await n.json();
|
|
6623
6641
|
} catch {}
|
|
6624
|
-
throw
|
|
6642
|
+
throw ii(n.status, n.statusText, s);
|
|
6625
6643
|
}
|
|
6626
6644
|
return await n.json();
|
|
6627
6645
|
}
|
|
@@ -6632,29 +6650,29 @@ var T = class {
|
|
|
6632
6650
|
return this.send('POST', '/v1/run', { model: t, parameters: i });
|
|
6633
6651
|
}
|
|
6634
6652
|
queueJob(t, i) {
|
|
6635
|
-
return this.send('POST', '/v1/generate', { model: t, ...i }).then((
|
|
6636
|
-
let n =
|
|
6653
|
+
return this.send('POST', '/v1/generate', { model: t, ...i }).then((r) => {
|
|
6654
|
+
let n = r.status,
|
|
6637
6655
|
s =
|
|
6638
6656
|
n === 'succeeded' || n === 'failed' || n === 'expired' || n === 'cancelled'
|
|
6639
6657
|
? n
|
|
6640
6658
|
: 'processing',
|
|
6641
|
-
o = je(
|
|
6659
|
+
o = je(r);
|
|
6642
6660
|
return {
|
|
6643
|
-
request_id:
|
|
6644
|
-
model:
|
|
6661
|
+
request_id: r.request_id || r.id || '',
|
|
6662
|
+
model: r.model,
|
|
6645
6663
|
status: s,
|
|
6646
6664
|
...(o.length ? { output: o } : {}),
|
|
6647
|
-
error:
|
|
6648
|
-
...(
|
|
6665
|
+
error: r.error && typeof r.error.message == 'string' ? r.error.message : null,
|
|
6666
|
+
...(r.usage ? { usage: r.usage } : {}),
|
|
6649
6667
|
};
|
|
6650
6668
|
});
|
|
6651
6669
|
}
|
|
6652
6670
|
getStatus(t) {
|
|
6653
6671
|
return this.send('GET', `/v1/jobs/${encodeURIComponent(t)}`).then((i) => {
|
|
6654
|
-
let
|
|
6672
|
+
let r = i.status,
|
|
6655
6673
|
n =
|
|
6656
|
-
|
|
6657
|
-
?
|
|
6674
|
+
r === 'succeeded' || r === 'failed' || r === 'expired' || r === 'cancelled'
|
|
6675
|
+
? r
|
|
6658
6676
|
: 'processing',
|
|
6659
6677
|
s = je(i),
|
|
6660
6678
|
o = i.error && typeof i.error.message == 'string' ? i.error.message : null;
|
|
@@ -6672,57 +6690,57 @@ var T = class {
|
|
|
6672
6690
|
return this.send('POST', '/v1/upload', { data: t, filename: i });
|
|
6673
6691
|
}
|
|
6674
6692
|
async downloadOutput(t, i) {
|
|
6675
|
-
let
|
|
6676
|
-
if (!
|
|
6693
|
+
let r = await fetch(t);
|
|
6694
|
+
if (!r.ok) throw new Error(`The file could not be downloaded (HTTP ${r.status})`);
|
|
6677
6695
|
let n = Be.default.dirname(i);
|
|
6678
6696
|
ee.default.existsSync(n) || ee.default.mkdirSync(n, { recursive: !0 });
|
|
6679
6697
|
let s = ee.default.createWriteStream(i);
|
|
6680
|
-
return (await (0, Fe.pipeline)(
|
|
6698
|
+
return (await (0, Fe.pipeline)(r.body, s), i);
|
|
6681
6699
|
}
|
|
6682
6700
|
};
|
|
6683
6701
|
q();
|
|
6684
6702
|
W();
|
|
6685
|
-
var
|
|
6686
|
-
function
|
|
6687
|
-
for (let t of
|
|
6703
|
+
var kt = ['images', 'input_images', 'videos', 'audios'];
|
|
6704
|
+
function qi(e) {
|
|
6705
|
+
for (let t of kt) typeof e[t] == 'string' && (e[t] = [e[t]]);
|
|
6688
6706
|
}
|
|
6689
|
-
function
|
|
6707
|
+
function Ei(e) {
|
|
6690
6708
|
if (e.startsWith('http://') || e.startsWith('https://')) return null;
|
|
6691
|
-
let t =
|
|
6709
|
+
let t = $.default.resolve(e);
|
|
6692
6710
|
return R.default.existsSync(t) && R.default.statSync(t).isFile() ? t : null;
|
|
6693
6711
|
}
|
|
6694
|
-
async function
|
|
6695
|
-
for (let i of
|
|
6712
|
+
async function Ai(e, t) {
|
|
6713
|
+
for (let i of kt) {
|
|
6696
6714
|
if (!Array.isArray(e[i])) continue;
|
|
6697
|
-
let
|
|
6715
|
+
let r = [];
|
|
6698
6716
|
for (let n of e[i]) {
|
|
6699
6717
|
if (typeof n != 'string') continue;
|
|
6700
|
-
let s =
|
|
6701
|
-
|
|
6718
|
+
let s = Ei(n);
|
|
6719
|
+
r.push(s ? await t(s) : n);
|
|
6702
6720
|
}
|
|
6703
|
-
e[i] =
|
|
6721
|
+
e[i] = r;
|
|
6704
6722
|
}
|
|
6705
6723
|
}
|
|
6706
6724
|
var z = { starter: 10, plus: 25, scale: 40, enterprise: 300 };
|
|
6707
|
-
function
|
|
6725
|
+
function Ri(e) {
|
|
6708
6726
|
if (e.count === void 0 || e.count === !0) return 1;
|
|
6709
6727
|
let t = typeof e.count == 'number' ? e.count : Number(e.count),
|
|
6710
6728
|
i = z.enterprise;
|
|
6711
6729
|
return (
|
|
6712
6730
|
(!Number.isInteger(t) || t < 1 || t > i) &&
|
|
6713
6731
|
(process.stderr
|
|
6714
|
-
.write(`${
|
|
6732
|
+
.write(`${a.red('Error:')} --count must be a whole number from 1 to ${i}. The API allows Starter ${z.starter}, Plus ${z.plus}, Scale ${z.scale}, Enterprise ${z.enterprise} at once, including polling.
|
|
6715
6733
|
`),
|
|
6716
6734
|
process.exit(1)),
|
|
6717
6735
|
t
|
|
6718
6736
|
);
|
|
6719
6737
|
}
|
|
6720
|
-
async function
|
|
6738
|
+
async function Oi(e, t, i, r, n) {
|
|
6721
6739
|
n.isJson ||
|
|
6722
|
-
process.stderr.write(`Starting ${
|
|
6740
|
+
process.stderr.write(`Starting ${r} ${t} jobs together...
|
|
6723
6741
|
`);
|
|
6724
6742
|
let s = await Promise.all(
|
|
6725
|
-
Array.from({ length:
|
|
6743
|
+
Array.from({ length: r }, async () => {
|
|
6726
6744
|
try {
|
|
6727
6745
|
return { job: await e.queueJob(t, i) };
|
|
6728
6746
|
} catch (p) {
|
|
@@ -6737,9 +6755,9 @@ async function Ei(e, t, i, a, n) {
|
|
|
6737
6755
|
? o.push(p.job)
|
|
6738
6756
|
: 'err' in p &&
|
|
6739
6757
|
u.push(
|
|
6740
|
-
p.err instanceof
|
|
6758
|
+
p.err instanceof w
|
|
6741
6759
|
? p.err
|
|
6742
|
-
: new
|
|
6760
|
+
: new w(0, p.err instanceof Error ? p.err.message : String(p.err)),
|
|
6743
6761
|
);
|
|
6744
6762
|
if (!n.isAsync) {
|
|
6745
6763
|
let p = Date.now(),
|
|
@@ -6747,7 +6765,7 @@ async function Ei(e, t, i, a, n) {
|
|
|
6747
6765
|
for (; l.length;) {
|
|
6748
6766
|
if ((await new Promise((c) => setTimeout(c, 2e3)), !n.isJson)) {
|
|
6749
6767
|
let c = Math.round((Date.now() - p) / 1e3);
|
|
6750
|
-
process.stderr.write(`Waiting on ${l.length} of ${
|
|
6768
|
+
process.stderr.write(`Waiting on ${l.length} of ${r} (${c}s)...
|
|
6751
6769
|
`);
|
|
6752
6770
|
}
|
|
6753
6771
|
let d = await Promise.all(
|
|
@@ -6790,12 +6808,12 @@ async function Ei(e, t, i, a, n) {
|
|
|
6790
6808
|
}
|
|
6791
6809
|
(u.length ||
|
|
6792
6810
|
o.some((p) => p.status === 'failed' || p.status === 'expired' || p.status === 'cancelled')) &&
|
|
6793
|
-
process.exit(
|
|
6811
|
+
process.exit(_);
|
|
6794
6812
|
}
|
|
6795
|
-
function
|
|
6813
|
+
function It(e) {
|
|
6796
6814
|
let t = {},
|
|
6797
6815
|
i = new Set(),
|
|
6798
|
-
|
|
6816
|
+
r = [];
|
|
6799
6817
|
for (let n = 0; n < e.length; n++) {
|
|
6800
6818
|
let s = e[n];
|
|
6801
6819
|
if (s.startsWith('--')) {
|
|
@@ -6833,33 +6851,33 @@ function bt(e) {
|
|
|
6833
6851
|
: n + 1 < e.length && !e[n + 1].startsWith('-')
|
|
6834
6852
|
? ((t[p] = e[n + 1]), n++)
|
|
6835
6853
|
: (t[p] = !0);
|
|
6836
|
-
} else
|
|
6854
|
+
} else r.push(s);
|
|
6837
6855
|
}
|
|
6838
|
-
return { command:
|
|
6856
|
+
return { command: r[0] || '', subcommand: r[1], modelSlug: r[1] || r[0], options: t, flags: i };
|
|
6839
6857
|
}
|
|
6840
6858
|
async function Ce(e, t) {
|
|
6841
6859
|
let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
6842
|
-
|
|
6860
|
+
r = I(typeof t.api_url == 'string' ? t.api_url : void 0);
|
|
6843
6861
|
(i ||
|
|
6844
|
-
(process.stderr.write(`${
|
|
6862
|
+
(process.stderr.write(`${a.red('Error:')} Authentication required.
|
|
6845
6863
|
`),
|
|
6846
6864
|
process.stderr
|
|
6847
|
-
.write(`Please run ${
|
|
6865
|
+
.write(`Please run ${a.cyan('tein auth login')} or set ${a.cyan('TEIN_API_KEY')} environment variable.
|
|
6848
6866
|
`),
|
|
6849
6867
|
process.exit(1)),
|
|
6850
6868
|
e ||
|
|
6851
|
-
(process.stderr.write(`${
|
|
6869
|
+
(process.stderr.write(`${a.red('Error:')} Missing model slug.
|
|
6852
6870
|
`),
|
|
6853
|
-
process.stderr.write(`Usage: ${
|
|
6871
|
+
process.stderr.write(`Usage: ${a.cyan('tein run <model-slug> --prompt "..."')}
|
|
6854
6872
|
`),
|
|
6855
|
-
process.stderr.write(`Run ${
|
|
6873
|
+
process.stderr.write(`Run ${a.cyan('tein models')} to list all available models.
|
|
6856
6874
|
`),
|
|
6857
6875
|
process.exit(1)));
|
|
6858
|
-
let n =
|
|
6876
|
+
let n = V(e),
|
|
6859
6877
|
s = !!t.json,
|
|
6860
6878
|
o = !!(t.async || t.no_wait),
|
|
6861
6879
|
u = typeof t.output == 'string' ? t.output : void 0,
|
|
6862
|
-
p =
|
|
6880
|
+
p = Ri(t),
|
|
6863
6881
|
l = { ...t };
|
|
6864
6882
|
if (
|
|
6865
6883
|
(delete l.json,
|
|
@@ -6874,27 +6892,27 @@ async function Ce(e, t) {
|
|
|
6874
6892
|
for (let h of n.parameters)
|
|
6875
6893
|
h.default !== void 0 &&
|
|
6876
6894
|
l[h.name] === void 0 &&
|
|
6877
|
-
|
|
6895
|
+
wt(n.slug, h.name, t) &&
|
|
6878
6896
|
(l[h.name] = h.default);
|
|
6879
|
-
(
|
|
6897
|
+
(qi(l),
|
|
6880
6898
|
typeof l.image == 'string' && !l.images && ((l.images = [l.image]), delete l.image),
|
|
6881
6899
|
l.image_url &&
|
|
6882
6900
|
!l.first_frame_image &&
|
|
6883
6901
|
(e.startsWith('seedance') || e.startsWith('happy-horse')) &&
|
|
6884
6902
|
(l.first_frame_image = l.image_url));
|
|
6885
|
-
let d = new T(i,
|
|
6903
|
+
let d = new T(i, r),
|
|
6886
6904
|
c = ['image', 'first_frame_image', 'last_frame_image', 'lipsyncing_audio', 'audio', 'video'];
|
|
6887
6905
|
for (let h of c) {
|
|
6888
6906
|
let g = l[h];
|
|
6889
6907
|
if (typeof g == 'string' && !g.startsWith('http://') && !g.startsWith('https://')) {
|
|
6890
|
-
let k =
|
|
6908
|
+
let k = $.default.resolve(g);
|
|
6891
6909
|
if (R.default.existsSync(k) && R.default.statSync(k).isFile()) {
|
|
6892
|
-
let
|
|
6893
|
-
s ||
|
|
6910
|
+
let v = new P(`Uploading local file ${$.default.basename(k)} to CDN...`);
|
|
6911
|
+
s || v.start();
|
|
6894
6912
|
try {
|
|
6895
6913
|
let j = R.default.readFileSync(k),
|
|
6896
|
-
X = await d.uploadAsset(j.toString('base64'),
|
|
6897
|
-
((l[h] = X.url), s ||
|
|
6914
|
+
X = await d.uploadAsset(j.toString('base64'), $.default.basename(k));
|
|
6915
|
+
((l[h] = X.url), s || v.succeed(`Uploaded ${$.default.basename(k)} to CDN`));
|
|
6898
6916
|
} catch (j) {
|
|
6899
6917
|
let X = j instanceof Error ? j.message : String(j);
|
|
6900
6918
|
(s
|
|
@@ -6903,42 +6921,42 @@ async function Ce(e, t) {
|
|
|
6903
6921
|
`
|
|
6904
6922
|
`,
|
|
6905
6923
|
)
|
|
6906
|
-
:
|
|
6924
|
+
: v.fail(`Upload failed: ${X}`),
|
|
6907
6925
|
process.exit(1));
|
|
6908
6926
|
}
|
|
6909
6927
|
}
|
|
6910
6928
|
}
|
|
6911
6929
|
}
|
|
6912
|
-
await
|
|
6913
|
-
let g = new P(`Uploading local file ${
|
|
6930
|
+
await Ai(l, async (h) => {
|
|
6931
|
+
let g = new P(`Uploading local file ${$.default.basename(h)} to CDN...`);
|
|
6914
6932
|
s || g.start();
|
|
6915
6933
|
try {
|
|
6916
6934
|
let k = R.default.readFileSync(h),
|
|
6917
|
-
|
|
6918
|
-
return (s || g.succeed(`Uploaded ${
|
|
6935
|
+
v = await d.uploadAsset(k.toString('base64'), $.default.basename(h));
|
|
6936
|
+
return (s || g.succeed(`Uploaded ${$.default.basename(h)} to CDN`), v.url);
|
|
6919
6937
|
} catch (k) {
|
|
6920
|
-
let
|
|
6938
|
+
let v = k instanceof Error ? k.message : String(k);
|
|
6921
6939
|
(s
|
|
6922
6940
|
? process.stdout.write(
|
|
6923
|
-
JSON.stringify({ error:
|
|
6941
|
+
JSON.stringify({ error: v }) +
|
|
6924
6942
|
`
|
|
6925
6943
|
`,
|
|
6926
6944
|
)
|
|
6927
|
-
: g.fail(`Upload failed: ${
|
|
6945
|
+
: g.fail(`Upload failed: ${v}`),
|
|
6928
6946
|
process.exit(1));
|
|
6929
6947
|
}
|
|
6930
6948
|
});
|
|
6931
|
-
let m = new P(`Submitting task for ${
|
|
6949
|
+
let m = new P(`Submitting task for ${a.bold(e)}...`);
|
|
6932
6950
|
s || m.start();
|
|
6933
6951
|
let f;
|
|
6934
6952
|
try {
|
|
6935
6953
|
if (p > 1) {
|
|
6936
|
-
await
|
|
6954
|
+
await Oi(d, e, l, p, { isJson: s, isAsync: o });
|
|
6937
6955
|
return;
|
|
6938
6956
|
}
|
|
6939
6957
|
f = await d.queueJob(e, l);
|
|
6940
6958
|
} catch (h) {
|
|
6941
|
-
let g = h instanceof
|
|
6959
|
+
let g = h instanceof w ? h : null;
|
|
6942
6960
|
(s
|
|
6943
6961
|
? process.stdout.write(
|
|
6944
6962
|
JSON.stringify(
|
|
@@ -6957,7 +6975,7 @@ async function Ce(e, t) {
|
|
|
6957
6975
|
`)
|
|
6958
6976
|
: `Failed to start generation: ${h instanceof Error ? h.message : h}`,
|
|
6959
6977
|
),
|
|
6960
|
-
process.exit(g ? g.exitCode :
|
|
6978
|
+
process.exit(g ? g.exitCode : _));
|
|
6961
6979
|
}
|
|
6962
6980
|
if (o) {
|
|
6963
6981
|
s
|
|
@@ -6966,8 +6984,8 @@ async function Ce(e, t) {
|
|
|
6966
6984
|
`
|
|
6967
6985
|
`,
|
|
6968
6986
|
)
|
|
6969
|
-
: (m.succeed(`Queued successfully! Request ID: ${
|
|
6970
|
-
process.stdout.write(`Check status anytime with: ${
|
|
6987
|
+
: (m.succeed(`Queued successfully! Request ID: ${a.bold(f.request_id)}`),
|
|
6988
|
+
process.stdout.write(`Check status anytime with: ${a.cyan(`tein status ${f.request_id}`)}
|
|
6971
6989
|
`));
|
|
6972
6990
|
return;
|
|
6973
6991
|
}
|
|
@@ -6975,13 +6993,13 @@ async function Ce(e, t) {
|
|
|
6975
6993
|
ue = 1500;
|
|
6976
6994
|
for (; f.status === 'processing';) {
|
|
6977
6995
|
let h = Math.round((Date.now() - U) / 1e3);
|
|
6978
|
-
(s || m.update(`Rendering ${
|
|
6996
|
+
(s || m.update(`Rendering ${a.bold(e)} (${h}s elapsed)... [ID: ${f.request_id}]`),
|
|
6979
6997
|
await new Promise((g) => setTimeout(g, ue)));
|
|
6980
6998
|
try {
|
|
6981
6999
|
f = await d.getStatus(f.request_id);
|
|
6982
7000
|
} catch (g) {
|
|
6983
|
-
g instanceof
|
|
6984
|
-
g.exitCode !==
|
|
7001
|
+
g instanceof w &&
|
|
7002
|
+
g.exitCode !== _ &&
|
|
6985
7003
|
(s ||
|
|
6986
7004
|
m.fail(
|
|
6987
7005
|
M(g).join(`
|
|
@@ -6999,8 +7017,8 @@ async function Ce(e, t) {
|
|
|
6999
7017
|
`,
|
|
7000
7018
|
)
|
|
7001
7019
|
: m.fail(`Generation ${f.status}: ${f.error || 'Something failed on our side.'}`),
|
|
7002
|
-
process.exit(
|
|
7003
|
-
s || m.succeed(`Generation completed for ${
|
|
7020
|
+
process.exit(_)),
|
|
7021
|
+
s || m.succeed(`Generation completed for ${a.bold(n?.name || e)}!`),
|
|
7004
7022
|
s)
|
|
7005
7023
|
) {
|
|
7006
7024
|
process.stdout.write(
|
|
@@ -7013,32 +7031,32 @@ async function Ce(e, t) {
|
|
|
7013
7031
|
if (
|
|
7014
7032
|
(process.stdout.write(`
|
|
7015
7033
|
`),
|
|
7016
|
-
process.stdout.write(` ${
|
|
7034
|
+
process.stdout.write(` ${a.bold('Status:')} ${a.green('Succeeded')}
|
|
7017
7035
|
`),
|
|
7018
|
-
process.stdout.write(` ${
|
|
7036
|
+
process.stdout.write(` ${a.bold('Request ID:')} ${f.request_id}
|
|
7019
7037
|
`),
|
|
7020
7038
|
f.usage?.cost !== void 0 &&
|
|
7021
|
-
process.stdout.write(` ${
|
|
7039
|
+
process.stdout.write(` ${a.bold('Cost:')} $${f.usage.cost.toFixed(4)}
|
|
7022
7040
|
`),
|
|
7023
7041
|
f.output && f.output.length > 0)
|
|
7024
7042
|
) {
|
|
7025
7043
|
process.stdout.write(`
|
|
7026
|
-
${
|
|
7044
|
+
${a.bold('Outputs:')}
|
|
7027
7045
|
`);
|
|
7028
7046
|
for (let h = 0; h < f.output.length; h++) {
|
|
7029
7047
|
let g = f.output[h];
|
|
7030
7048
|
if (g.url) {
|
|
7031
7049
|
if (
|
|
7032
|
-
(process.stdout.write(` [${g.type.toUpperCase()}] ${
|
|
7050
|
+
(process.stdout.write(` [${g.type.toUpperCase()}] ${a.cyan(a.underline(g.url))}
|
|
7033
7051
|
`),
|
|
7034
7052
|
u)
|
|
7035
7053
|
) {
|
|
7036
7054
|
let k = new P(`Downloading output to ${u}...`).start();
|
|
7037
7055
|
try {
|
|
7038
|
-
(await d.downloadOutput(g.url,
|
|
7039
|
-
k.succeed(`Saved to ${
|
|
7040
|
-
} catch (
|
|
7041
|
-
k.fail(`Failed to download: ${
|
|
7056
|
+
(await d.downloadOutput(g.url, $.default.resolve(process.cwd(), u)),
|
|
7057
|
+
k.succeed(`Saved to ${a.bold(u)}`));
|
|
7058
|
+
} catch (v) {
|
|
7059
|
+
k.fail(`Failed to download: ${v instanceof Error ? v.message : v}`);
|
|
7042
7060
|
}
|
|
7043
7061
|
}
|
|
7044
7062
|
} else
|
|
@@ -7051,24 +7069,24 @@ ${g.text}
|
|
|
7051
7069
|
process.stdout.write(`
|
|
7052
7070
|
`);
|
|
7053
7071
|
}
|
|
7054
|
-
var
|
|
7072
|
+
var xt = x(require('node:readline'));
|
|
7055
7073
|
q();
|
|
7056
|
-
async function
|
|
7074
|
+
async function Di(e) {
|
|
7057
7075
|
try {
|
|
7058
7076
|
return (await new T(e, I()).checkKey(), 'ok');
|
|
7059
7077
|
} catch (t) {
|
|
7060
|
-
if (t instanceof
|
|
7078
|
+
if (t instanceof w) {
|
|
7061
7079
|
if (t.status === 401) return 'invalid';
|
|
7062
7080
|
if (t.status === 403) return 'blocked';
|
|
7063
7081
|
}
|
|
7064
7082
|
return 'unchecked';
|
|
7065
7083
|
}
|
|
7066
7084
|
}
|
|
7067
|
-
function
|
|
7068
|
-
let t =
|
|
7085
|
+
function Li(e) {
|
|
7086
|
+
let t = xt.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
7069
7087
|
return new Promise((i) => {
|
|
7070
|
-
t.question(e, (
|
|
7071
|
-
(t.close(), i(
|
|
7088
|
+
t.question(e, (r) => {
|
|
7089
|
+
(t.close(), i(r.trim()));
|
|
7072
7090
|
});
|
|
7073
7091
|
});
|
|
7074
7092
|
}
|
|
@@ -7079,38 +7097,38 @@ async function Y(e, t) {
|
|
|
7079
7097
|
let i = t?.trim() || '';
|
|
7080
7098
|
(i ||
|
|
7081
7099
|
(process.stdout.write(`
|
|
7082
|
-
${
|
|
7100
|
+
${a.bold('Tein AI Authentication')}
|
|
7083
7101
|
`),
|
|
7084
|
-
process.stdout.write(`Get your API key at: ${
|
|
7102
|
+
process.stdout.write(`Get your API key at: ${a.cyan('https://tein.ai/dashboard/keys')}
|
|
7085
7103
|
|
|
7086
7104
|
`),
|
|
7087
|
-
(i = await
|
|
7105
|
+
(i = await Li('Enter your Tein API Key (sk_live_...): '))),
|
|
7088
7106
|
!i.startsWith('sk_live_') &&
|
|
7089
7107
|
!i.startsWith('sk_test_') &&
|
|
7090
7108
|
(process.stderr
|
|
7091
|
-
.write(`${
|
|
7109
|
+
.write(`${a.red('Error:')} Invalid key format. Tein API keys start with 'sk_live_' or 'sk_test_'.
|
|
7092
7110
|
`),
|
|
7093
7111
|
process.exit(1)));
|
|
7094
|
-
let
|
|
7095
|
-
(
|
|
7112
|
+
let r = await Di(i);
|
|
7113
|
+
(r === 'invalid' &&
|
|
7096
7114
|
(process.stderr
|
|
7097
|
-
.write(`${
|
|
7115
|
+
.write(`${a.red('Error:')} Tein did not accept this key. Copy it again from ${a.cyan('https://tein.ai/dashboard/keys')}. Nothing was saved.
|
|
7098
7116
|
`),
|
|
7099
7117
|
process.exit(1)),
|
|
7100
7118
|
ge({ apiKey: i }),
|
|
7101
7119
|
process.stdout.write(`
|
|
7102
|
-
${
|
|
7120
|
+
${a.green('\u2713')} API key saved to ${a.dim(ie())}
|
|
7103
7121
|
`),
|
|
7104
|
-
|
|
7122
|
+
r === 'blocked'
|
|
7105
7123
|
? process.stdout
|
|
7106
|
-
.write(`${
|
|
7124
|
+
.write(`${a.yellow('\u2139')} The key is valid, but this account cannot run requests right now. Check your dashboard.
|
|
7107
7125
|
`)
|
|
7108
|
-
:
|
|
7126
|
+
: r === 'unchecked' &&
|
|
7109
7127
|
process.stdout
|
|
7110
|
-
.write(`${
|
|
7128
|
+
.write(`${a.yellow('\u2139')} Could not reach Tein to check the key. It is saved; run ${a.cyan('tein auth set-key')} again once you are online to check it.
|
|
7111
7129
|
`),
|
|
7112
7130
|
process.stdout
|
|
7113
|
-
.write(`You can now run models directly using: ${
|
|
7131
|
+
.write(`You can now run models directly using: ${a.cyan('tein run <model-slug> --prompt "..."')}
|
|
7114
7132
|
|
|
7115
7133
|
`));
|
|
7116
7134
|
break;
|
|
@@ -7118,41 +7136,41 @@ ${r.green('\u2713')} API key saved to ${r.dim(ie())}
|
|
|
7118
7136
|
case 'logout': {
|
|
7119
7137
|
if (!L().apiKey) {
|
|
7120
7138
|
process.stdout
|
|
7121
|
-
.write(`${
|
|
7139
|
+
.write(`${a.yellow('\u2139')} No active API key found. You are already logged out.
|
|
7122
7140
|
`);
|
|
7123
7141
|
break;
|
|
7124
7142
|
}
|
|
7125
7143
|
(ge({ apiKey: '' }),
|
|
7126
7144
|
process.stdout
|
|
7127
|
-
.write(`${
|
|
7145
|
+
.write(`${a.green('\u2713')} Logged out successfully. Stored API key has been cleared from ${a.dim(ie())}
|
|
7128
7146
|
`));
|
|
7129
7147
|
break;
|
|
7130
7148
|
}
|
|
7131
7149
|
default: {
|
|
7132
7150
|
let i = S(),
|
|
7133
|
-
|
|
7151
|
+
r = I(),
|
|
7134
7152
|
n = L();
|
|
7135
7153
|
if (
|
|
7136
7154
|
(process.stdout.write(`
|
|
7137
|
-
${
|
|
7155
|
+
${a.bold('Tein AI CLI Configuration')}
|
|
7138
7156
|
`),
|
|
7139
|
-
process.stdout.write(` Config file: ${
|
|
7157
|
+
process.stdout.write(` Config file: ${a.dim(ie())}
|
|
7140
7158
|
`),
|
|
7141
|
-
process.stdout.write(` API URL: ${
|
|
7159
|
+
process.stdout.write(` API URL: ${a.cyan(r)}
|
|
7142
7160
|
`),
|
|
7143
7161
|
!i)
|
|
7144
7162
|
)
|
|
7145
|
-
(process.stdout.write(` API Key: ${
|
|
7163
|
+
(process.stdout.write(` API Key: ${a.red('Not configured')}
|
|
7146
7164
|
|
|
7147
7165
|
`),
|
|
7148
7166
|
process.stdout
|
|
7149
|
-
.write(`Run ${
|
|
7167
|
+
.write(`Run ${a.cyan('tein auth login')} or set ${a.cyan('TEIN_API_KEY')} environment variable.
|
|
7150
7168
|
|
|
7151
7169
|
`));
|
|
7152
7170
|
else {
|
|
7153
7171
|
let s = `${i.slice(0, 10)}...${i.slice(-4)}`;
|
|
7154
7172
|
process.stdout
|
|
7155
|
-
.write(` API Key: ${
|
|
7173
|
+
.write(` API Key: ${a.green(s)} (${i.startsWith('sk_live_') ? 'Live Key' : 'Test Key'})
|
|
7156
7174
|
|
|
7157
7175
|
`);
|
|
7158
7176
|
}
|
|
@@ -7163,55 +7181,55 @@ ${r.bold('Tein AI CLI Configuration')}
|
|
|
7163
7181
|
q();
|
|
7164
7182
|
he();
|
|
7165
7183
|
W();
|
|
7166
|
-
var
|
|
7167
|
-
async function
|
|
7184
|
+
var Ni = 3e3;
|
|
7185
|
+
async function _t(e) {
|
|
7168
7186
|
try {
|
|
7169
|
-
let t = await fetch(`${I(e)}/v1/pricing`, { signal: AbortSignal.timeout(
|
|
7187
|
+
let t = await fetch(`${I(e)}/v1/pricing`, { signal: AbortSignal.timeout(Ni) });
|
|
7170
7188
|
if (!t.ok) return;
|
|
7171
7189
|
let i = await t.json(),
|
|
7172
|
-
|
|
7190
|
+
r = {};
|
|
7173
7191
|
for (let n of i.configs ?? []) {
|
|
7174
7192
|
let s = String(n.modelSlug ?? '');
|
|
7175
|
-
B.has(s) && (
|
|
7193
|
+
B.has(s) && (r[s] ??= []).push(Number(n.starterPrice));
|
|
7176
7194
|
}
|
|
7177
|
-
|
|
7195
|
+
ct(r);
|
|
7178
7196
|
} catch {}
|
|
7179
7197
|
}
|
|
7180
|
-
var
|
|
7181
|
-
|
|
7182
|
-
async function
|
|
7183
|
-
await
|
|
7198
|
+
var Vi = new Set(['video', 'image', 'text', 'audio', '3d']),
|
|
7199
|
+
Ui = { llm: 'text', chat: 'text', reasoning: 'text' };
|
|
7200
|
+
async function vt(e, t) {
|
|
7201
|
+
await _t(t);
|
|
7184
7202
|
let i = E();
|
|
7185
7203
|
if (e) {
|
|
7186
7204
|
let s = e.toLowerCase(),
|
|
7187
|
-
o =
|
|
7188
|
-
i =
|
|
7205
|
+
o = Ui[s] ?? s;
|
|
7206
|
+
i = Vi.has(o)
|
|
7189
7207
|
? i.filter((u) => u.category.toLowerCase() === o)
|
|
7190
7208
|
: i.filter((u) => u.kind.toLowerCase().includes(s) || u.slug.toLowerCase().includes(s));
|
|
7191
7209
|
}
|
|
7192
7210
|
(process.stdout.write(`
|
|
7193
|
-
${
|
|
7211
|
+
${a.bold('Tein AI Models Catalog')} (${i.length} available)
|
|
7194
7212
|
`),
|
|
7195
7213
|
process.stdout
|
|
7196
|
-
.write(`${
|
|
7214
|
+
.write(`${a.dim('Run `tein info <model-slug>` to see detailed parameters and options.')}
|
|
7197
7215
|
|
|
7198
7216
|
`));
|
|
7199
|
-
let
|
|
7217
|
+
let r = {};
|
|
7200
7218
|
for (let s of i) {
|
|
7201
7219
|
let o = s.category;
|
|
7202
|
-
(
|
|
7220
|
+
(r[o] || (r[o] = []), r[o].push(s));
|
|
7203
7221
|
}
|
|
7204
7222
|
let n = ['Video', 'Image', 'Text', 'Audio', '3D'];
|
|
7205
7223
|
for (let s of n) {
|
|
7206
|
-
let o =
|
|
7224
|
+
let o = r[s];
|
|
7207
7225
|
if (!(!o || o.length === 0)) {
|
|
7208
|
-
process.stdout.write(`${
|
|
7226
|
+
process.stdout.write(`${a.bold(a.cyan(`\u2500\u2500 ${s} Models \u2500\u2500`))}
|
|
7209
7227
|
`);
|
|
7210
7228
|
for (let u of o) {
|
|
7211
7229
|
let p = u.slug.padEnd(24),
|
|
7212
7230
|
l = u.name.padEnd(22),
|
|
7213
7231
|
d = u.priceFormatted.padEnd(22);
|
|
7214
|
-
process.stdout.write(` ${
|
|
7232
|
+
process.stdout.write(` ${a.bold(p)} ${a.gray(l)} ${a.green(d)} ${a.dim(u.vendor)}
|
|
7215
7233
|
`);
|
|
7216
7234
|
}
|
|
7217
7235
|
process.stdout.write(`
|
|
@@ -7219,90 +7237,94 @@ ${r.bold('Tein AI Models Catalog')} (${i.length} available)
|
|
|
7219
7237
|
}
|
|
7220
7238
|
}
|
|
7221
7239
|
process.stdout
|
|
7222
|
-
.write(`${
|
|
7240
|
+
.write(`${a.dim('Tip:')} Generate directly with ${a.cyan('tein run <model-slug> --prompt "..."')}
|
|
7223
7241
|
|
|
7224
7242
|
`);
|
|
7225
7243
|
}
|
|
7226
|
-
async function
|
|
7227
|
-
B.has(e) && (await
|
|
7228
|
-
let i =
|
|
7244
|
+
async function Pt(e, t) {
|
|
7245
|
+
B.has(e) && (await _t(t));
|
|
7246
|
+
let i = V(e);
|
|
7229
7247
|
(i ||
|
|
7230
|
-
(process.stderr.write(`${
|
|
7248
|
+
(process.stderr.write(`${a.red('Error:')} Model "${e}" not found in Tein AI registry.
|
|
7231
7249
|
`),
|
|
7232
|
-
process.stderr.write(`Run ${
|
|
7250
|
+
process.stderr.write(`Run ${a.cyan('tein models')} to see all available model slugs.
|
|
7233
7251
|
`),
|
|
7234
7252
|
process.exit(1)),
|
|
7235
7253
|
process.stdout.write(`
|
|
7236
|
-
${
|
|
7254
|
+
${a.bold(a.cyan(i.name))} (${a.bold(i.slug)})
|
|
7237
7255
|
`),
|
|
7238
|
-
process.stdout.write(` ${
|
|
7256
|
+
process.stdout.write(` ${a.gray(i.description)}
|
|
7239
7257
|
|
|
7240
7258
|
`),
|
|
7241
|
-
process.stdout.write(`${
|
|
7259
|
+
process.stdout.write(`${a.bold('Metadata:')}
|
|
7242
7260
|
`),
|
|
7243
|
-
process.stdout.write(` Category: ${
|
|
7261
|
+
process.stdout.write(` Category: ${a.yellow(i.category)}
|
|
7244
7262
|
`),
|
|
7245
7263
|
process.stdout.write(` Kind: ${i.kind}
|
|
7246
7264
|
`),
|
|
7247
7265
|
process.stdout.write(` Vendor: ${i.vendor}
|
|
7248
7266
|
`),
|
|
7249
|
-
process.stdout.write(` Pricing: ${
|
|
7267
|
+
process.stdout.write(` Pricing: ${a.green(i.priceFormatted)}
|
|
7250
7268
|
|
|
7251
7269
|
`),
|
|
7252
|
-
process.stdout.write(`${
|
|
7270
|
+
process.stdout.write(`${a.bold('Parameters:')}
|
|
7253
7271
|
`));
|
|
7254
|
-
for (let
|
|
7255
|
-
let n =
|
|
7256
|
-
s =
|
|
7272
|
+
for (let r of i.parameters) {
|
|
7273
|
+
let n = r.required ? a.red('(required)') : a.dim('(optional)'),
|
|
7274
|
+
s = r.default !== void 0 ? a.dim(` [default: ${r.default}]`) : '';
|
|
7257
7275
|
(process.stdout
|
|
7258
|
-
.write(` ${
|
|
7276
|
+
.write(` ${a.bold(`--${r.name.replace(/_/g, '-')}`)} ${a.yellow(`<${r.type}>`)} ${n}${s}
|
|
7259
7277
|
`),
|
|
7260
|
-
|
|
7261
|
-
process.stdout.write(` ${
|
|
7278
|
+
r.description &&
|
|
7279
|
+
process.stdout.write(` ${a.gray(r.description)}
|
|
7262
7280
|
`),
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
process.stdout.write(` Allowed values: ${
|
|
7281
|
+
r.options &&
|
|
7282
|
+
r.options.length > 0 &&
|
|
7283
|
+
process.stdout.write(` Allowed values: ${a.dim(r.options.join(', '))}
|
|
7266
7284
|
`),
|
|
7267
|
-
(
|
|
7268
|
-
process.stdout.write(` Range: ${
|
|
7285
|
+
(r.min !== void 0 || r.max !== void 0) &&
|
|
7286
|
+
process.stdout.write(` Range: ${r.min ?? ''} to ${r.max ?? ''}
|
|
7269
7287
|
`),
|
|
7270
7288
|
process.stdout.write(`
|
|
7271
7289
|
`));
|
|
7272
7290
|
}
|
|
7273
|
-
(
|
|
7274
|
-
(
|
|
7275
|
-
|
|
7291
|
+
if (
|
|
7292
|
+
(i.parameters.some((r) => r.name === 'callback_url') ||
|
|
7293
|
+
(process.stdout
|
|
7294
|
+
.write(` ${a.bold('--callback-url')} ${a.yellow('<string>')} ${a.dim('(optional)')}
|
|
7276
7295
|
`),
|
|
7277
|
-
|
|
7278
|
-
|
|
7296
|
+
process.stdout
|
|
7297
|
+
.write(` ${a.gray('HTTPS URL. Tein POSTs the finished job here when it succeeds, fails, expires, or is cancelled.')}
|
|
7279
7298
|
|
|
7280
7299
|
`)),
|
|
7281
|
-
process.stdout.write(`${
|
|
7300
|
+
process.stdout.write(`${a.bold('Sample CLI Usage:')}
|
|
7282
7301
|
`),
|
|
7283
|
-
i.category === 'Video'
|
|
7284
|
-
|
|
7285
|
-
|
|
7302
|
+
i.category === 'Video')
|
|
7303
|
+
)
|
|
7304
|
+
process.stdout
|
|
7305
|
+
.write(` ${a.cyan(`tein run ${i.slug} --prompt "Cinematic camera drone shot of a coastline" --aspect-ratio 16:9 --duration 5 -o output.mp4`)}
|
|
7286
7306
|
|
|
7287
|
-
`)
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7307
|
+
`);
|
|
7308
|
+
else if (i.category === 'Image') {
|
|
7309
|
+
let r = i.parameters.some((n) => n.name === 'aspect_ratio') ? ' --aspect-ratio 16:9' : '';
|
|
7310
|
+
process.stdout
|
|
7311
|
+
.write(` ${a.cyan(`tein run ${i.slug} --prompt "Cyberpunk city in the rain, 8k render"${r} -o output.png`)}
|
|
7291
7312
|
|
|
7292
|
-
`)
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7313
|
+
`);
|
|
7314
|
+
} else
|
|
7315
|
+
i.category === 'Audio'
|
|
7316
|
+
? process.stdout
|
|
7317
|
+
.write(` ${a.cyan(`tein run ${i.slug} --prompt "Hello world from Tein AI" --speaker en_female_warm -o speech.wav`)}
|
|
7296
7318
|
|
|
7297
7319
|
`)
|
|
7298
|
-
|
|
7299
|
-
|
|
7320
|
+
: process.stdout
|
|
7321
|
+
.write(` ${a.cyan(`tein run ${i.slug} --prompt "Explain quantum computing in simple terms"`)}
|
|
7300
7322
|
|
|
7301
|
-
`)
|
|
7323
|
+
`);
|
|
7302
7324
|
}
|
|
7303
7325
|
q();
|
|
7304
7326
|
qe();
|
|
7305
|
-
var
|
|
7327
|
+
var ji = 1e4,
|
|
7306
7328
|
Ae = {
|
|
7307
7329
|
price: '',
|
|
7308
7330
|
creativeMode: 'Creative mode',
|
|
@@ -7313,41 +7335,41 @@ var Vi = 1e4,
|
|
|
7313
7335
|
priorityDraft: 'Priority + Draft',
|
|
7314
7336
|
creativeModePriorityDraft: 'Creative mode + Priority + Draft',
|
|
7315
7337
|
},
|
|
7316
|
-
|
|
7317
|
-
|
|
7338
|
+
Bi = Object.keys(Ae),
|
|
7339
|
+
Fi = {
|
|
7318
7340
|
creativeMode: 'unfiltered',
|
|
7319
7341
|
creativeModePriority: 'unfilteredPriority',
|
|
7320
7342
|
creativeModeDraft: 'unfilteredDraft',
|
|
7321
7343
|
creativeModePriorityDraft: 'unfilteredPriorityDraft',
|
|
7322
7344
|
};
|
|
7323
|
-
function
|
|
7324
|
-
let i =
|
|
7345
|
+
function Gi(e, t) {
|
|
7346
|
+
let i = Fi[t];
|
|
7325
7347
|
return e[t] ?? (i ? e[i] : void 0);
|
|
7326
7348
|
}
|
|
7327
|
-
async function
|
|
7349
|
+
async function Ji(e, t) {
|
|
7328
7350
|
let i = `${I(e)}${ce(t)}`,
|
|
7329
|
-
|
|
7351
|
+
r;
|
|
7330
7352
|
try {
|
|
7331
|
-
|
|
7353
|
+
r = await fetch(i, { signal: AbortSignal.timeout(ji) });
|
|
7332
7354
|
} catch {
|
|
7333
7355
|
throw new Error(`Could not reach ${i}`);
|
|
7334
7356
|
}
|
|
7335
|
-
let n = await
|
|
7336
|
-
if (!
|
|
7357
|
+
let n = await r.json().catch(() => null);
|
|
7358
|
+
if (!r.ok || !n || n.object !== 'list' || !n.board) {
|
|
7337
7359
|
let s =
|
|
7338
7360
|
n && typeof n.error == 'string'
|
|
7339
7361
|
? n.error
|
|
7340
7362
|
: n && typeof n.error == 'object' && n.error?.message
|
|
7341
7363
|
? n.error.message
|
|
7342
|
-
: `Pricing request failed (${
|
|
7364
|
+
: `Pricing request failed (${r.status})`;
|
|
7343
7365
|
throw new Error(s);
|
|
7344
7366
|
}
|
|
7345
7367
|
return n;
|
|
7346
7368
|
}
|
|
7347
7369
|
function Ee(e) {
|
|
7348
7370
|
let t = e.toFixed(4).replace(/0+$/, '').replace(/\.$/, ''),
|
|
7349
|
-
[i,
|
|
7350
|
-
return `$${i}.${
|
|
7371
|
+
[i, r = ''] = t.split('.');
|
|
7372
|
+
return `$${i}.${r.padEnd(2, '0')}`;
|
|
7351
7373
|
}
|
|
7352
7374
|
function Re(e) {
|
|
7353
7375
|
if (!e || typeof e.starter != 'number') return null;
|
|
@@ -7355,36 +7377,36 @@ function Re(e) {
|
|
|
7355
7377
|
i = typeof e.scale == 'number' ? e.scale : t;
|
|
7356
7378
|
return `Starter ${Ee(e.starter)} Plus ${Ee(t)} Scale ${Ee(i)}`;
|
|
7357
7379
|
}
|
|
7358
|
-
function
|
|
7380
|
+
function Hi(e) {
|
|
7359
7381
|
if (typeof e.label == 'string' && e.label.trim()) return e.label.trim();
|
|
7360
7382
|
let t = [];
|
|
7361
7383
|
for (let i of ['endpoint', 'resolution', 'quality', 'mode', 'task', 'component', 'token']) {
|
|
7362
|
-
let
|
|
7363
|
-
|
|
7384
|
+
let r = e[i];
|
|
7385
|
+
r != null && r !== '' && t.push(String(r));
|
|
7364
7386
|
}
|
|
7365
7387
|
return (
|
|
7366
7388
|
e.withVideo === !0 && t.push('with video'),
|
|
7367
7389
|
t.length ? t.join(' \xB7 ') : String(e.id ?? 'default')
|
|
7368
7390
|
);
|
|
7369
7391
|
}
|
|
7370
|
-
function
|
|
7371
|
-
let i =
|
|
7372
|
-
for (let
|
|
7373
|
-
let n = Re(
|
|
7392
|
+
function Wi(e, t) {
|
|
7393
|
+
let i = Hi(e);
|
|
7394
|
+
for (let r of Bi) {
|
|
7395
|
+
let n = Re(Gi(e, r));
|
|
7374
7396
|
if (!n) continue;
|
|
7375
|
-
let s = Ae[
|
|
7397
|
+
let s = Ae[r] ? ` (${Ae[r]})` : '';
|
|
7376
7398
|
t.push(` ${i}${s} ${n}`);
|
|
7377
7399
|
}
|
|
7378
7400
|
}
|
|
7379
|
-
function
|
|
7401
|
+
function zi(e, t) {
|
|
7380
7402
|
let i = e.quality ? ` quality=${e.quality}` : '';
|
|
7381
7403
|
t.push(
|
|
7382
|
-
` ${
|
|
7404
|
+
` ${a.bold(e.slug.padEnd(26))} ${a.gray(e.name)} ${a.dim(`${e.kind} ${e.unit} model=${e.model}${i}`)}`,
|
|
7383
7405
|
);
|
|
7384
|
-
for (let n of e.variants ?? [])
|
|
7385
|
-
let
|
|
7386
|
-
if (Array.isArray(
|
|
7387
|
-
for (let n of
|
|
7406
|
+
for (let n of e.variants ?? []) Wi(n, t);
|
|
7407
|
+
let r = e.addons;
|
|
7408
|
+
if (Array.isArray(r))
|
|
7409
|
+
for (let n of r) {
|
|
7388
7410
|
if (!n || typeof n != 'object') continue;
|
|
7389
7411
|
let s = n,
|
|
7390
7412
|
o = typeof s.label == 'string' ? s.label : String(s.id ?? 'add-on'),
|
|
@@ -7393,34 +7415,34 @@ function Ji(e, t) {
|
|
|
7393
7415
|
}
|
|
7394
7416
|
t.push('');
|
|
7395
7417
|
}
|
|
7396
|
-
function
|
|
7418
|
+
function Yi(e) {
|
|
7397
7419
|
let t = [],
|
|
7398
7420
|
i = e.board.checked ? ` \xB7 checked ${e.board.checked}` : '';
|
|
7399
|
-
(t.push(`${
|
|
7421
|
+
(t.push(`${a.bold('Tein prices')} ${a.green(e.currency)} ${e.count} models${i}`),
|
|
7400
7422
|
t.push(
|
|
7401
|
-
`${
|
|
7423
|
+
`${a.dim('Starter, Plus and Scale. Creative mode, Priority and draft show only where published.')}`,
|
|
7402
7424
|
),
|
|
7403
7425
|
t.push(''));
|
|
7404
|
-
let
|
|
7426
|
+
let r = new Map();
|
|
7405
7427
|
for (let p of e.board.models) {
|
|
7406
7428
|
let l = p.kind || 'other',
|
|
7407
|
-
d =
|
|
7408
|
-
(d.push(p),
|
|
7429
|
+
d = r.get(l) ?? [];
|
|
7430
|
+
(d.push(p), r.set(l, d));
|
|
7409
7431
|
}
|
|
7410
7432
|
let n = ['video', 'image', 'audio', 'llm', 'text', '3d'],
|
|
7411
|
-
s = [...
|
|
7433
|
+
s = [...r.keys()].sort((p, l) => {
|
|
7412
7434
|
let d = n.indexOf(p),
|
|
7413
7435
|
c = n.indexOf(l);
|
|
7414
7436
|
return (d === -1 ? 99 : d) - (c === -1 ? 99 : c);
|
|
7415
7437
|
});
|
|
7416
7438
|
for (let p of s) {
|
|
7417
|
-
t.push(`${
|
|
7418
|
-
for (let l of
|
|
7439
|
+
t.push(`${a.bold(a.cyan(`\u2500\u2500 ${p} \u2500\u2500`))}`);
|
|
7440
|
+
for (let l of r.get(p) ?? []) zi(l, t);
|
|
7419
7441
|
}
|
|
7420
7442
|
let o = new Set(e.board.models.map((p) => p.slug.toLowerCase())),
|
|
7421
7443
|
u = (e.configs ?? []).filter((p) => !o.has(String(p.modelSlug ?? '').toLowerCase()));
|
|
7422
7444
|
if (u.length) {
|
|
7423
|
-
t.push(`${
|
|
7445
|
+
t.push(`${a.bold(a.cyan('\u2500\u2500 other prices \u2500\u2500'))}`);
|
|
7424
7446
|
let p = new Map();
|
|
7425
7447
|
for (let l of u) {
|
|
7426
7448
|
let d = String(l.modelSlug ?? ''),
|
|
@@ -7429,7 +7451,7 @@ function Hi(e) {
|
|
|
7429
7451
|
}
|
|
7430
7452
|
for (let [l, d] of p) {
|
|
7431
7453
|
let c = String(d[0]?.modelName ?? l);
|
|
7432
|
-
t.push(` ${
|
|
7454
|
+
t.push(` ${a.bold(l.padEnd(26))} ${a.gray(c)}`);
|
|
7433
7455
|
for (let m of d) {
|
|
7434
7456
|
let f = String(m.displayLabel ?? m.billingUnit ?? 'price'),
|
|
7435
7457
|
U = Re(m.prices);
|
|
@@ -7439,19 +7461,19 @@ function Hi(e) {
|
|
|
7439
7461
|
}
|
|
7440
7462
|
}
|
|
7441
7463
|
return (
|
|
7442
|
-
t.push(`${
|
|
7464
|
+
t.push(`${a.dim('JSON:')} ${a.cyan('tein pricing --json')}`),
|
|
7443
7465
|
`${t.join(`
|
|
7444
7466
|
`)}
|
|
7445
7467
|
`
|
|
7446
7468
|
);
|
|
7447
7469
|
}
|
|
7448
|
-
async function
|
|
7470
|
+
async function Tt(e) {
|
|
7449
7471
|
let t;
|
|
7450
7472
|
try {
|
|
7451
|
-
t = await
|
|
7473
|
+
t = await Ji(e.apiUrl, e.model);
|
|
7452
7474
|
} catch (i) {
|
|
7453
|
-
let
|
|
7454
|
-
(process.stderr.write(`${
|
|
7475
|
+
let r = i instanceof Error ? i.message : String(i);
|
|
7476
|
+
(process.stderr.write(`${a.red('Error:')} ${r}
|
|
7455
7477
|
`),
|
|
7456
7478
|
process.exit(1));
|
|
7457
7479
|
}
|
|
@@ -7459,38 +7481,38 @@ async function vt(e) {
|
|
|
7459
7481
|
e.json
|
|
7460
7482
|
? `${JSON.stringify(t, null, 2)}
|
|
7461
7483
|
`
|
|
7462
|
-
:
|
|
7484
|
+
: Yi(t),
|
|
7463
7485
|
);
|
|
7464
7486
|
}
|
|
7465
|
-
var
|
|
7487
|
+
var Mt = x(require('node:path'));
|
|
7466
7488
|
q();
|
|
7467
|
-
async function
|
|
7489
|
+
async function St(e, t) {
|
|
7468
7490
|
let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
7469
|
-
|
|
7491
|
+
r = I(typeof t.api_url == 'string' ? t.api_url : void 0);
|
|
7470
7492
|
(i ||
|
|
7471
|
-
(process.stderr.write(`${
|
|
7493
|
+
(process.stderr.write(`${a.red('Error:')} Authentication required.
|
|
7472
7494
|
`),
|
|
7473
7495
|
process.stderr
|
|
7474
|
-
.write(`Please run ${
|
|
7496
|
+
.write(`Please run ${a.cyan('tein auth login')} or set ${a.cyan('TEIN_API_KEY')} environment variable.
|
|
7475
7497
|
`),
|
|
7476
7498
|
process.exit(1)),
|
|
7477
7499
|
e ||
|
|
7478
|
-
(process.stderr.write(`${
|
|
7500
|
+
(process.stderr.write(`${a.red('Error:')} Missing request ID.
|
|
7479
7501
|
`),
|
|
7480
|
-
process.stderr.write(`Usage: ${
|
|
7502
|
+
process.stderr.write(`Usage: ${a.cyan('tein status <request-id> [--wait] [-o output.mp4]')}
|
|
7481
7503
|
`),
|
|
7482
7504
|
process.exit(1)));
|
|
7483
7505
|
let n = !!t.json,
|
|
7484
7506
|
s = !!t.wait,
|
|
7485
7507
|
o = typeof t.output == 'string' ? t.output : void 0,
|
|
7486
|
-
u = new T(i,
|
|
7487
|
-
p = new P(`Checking status of ${
|
|
7508
|
+
u = new T(i, r),
|
|
7509
|
+
p = new P(`Checking status of ${a.bold(e)}...`);
|
|
7488
7510
|
n || p.start();
|
|
7489
7511
|
let l;
|
|
7490
7512
|
try {
|
|
7491
7513
|
l = await u.getStatus(e);
|
|
7492
7514
|
} catch (d) {
|
|
7493
|
-
(d instanceof
|
|
7515
|
+
(d instanceof w &&
|
|
7494
7516
|
(n
|
|
7495
7517
|
? process.stdout.write(
|
|
7496
7518
|
JSON.stringify(
|
|
@@ -7507,13 +7529,13 @@ async function Pt(e, t) {
|
|
|
7507
7529
|
),
|
|
7508
7530
|
process.exit(d.exitCode)),
|
|
7509
7531
|
n || p.fail(d instanceof Error ? d.message : String(d)),
|
|
7510
|
-
process.exit(
|
|
7532
|
+
process.exit(_));
|
|
7511
7533
|
}
|
|
7512
7534
|
if (s && l.status === 'processing') {
|
|
7513
7535
|
let d = Date.now();
|
|
7514
7536
|
for (; l.status === 'processing';) {
|
|
7515
7537
|
let c = Math.round((Date.now() - d) / 1e3);
|
|
7516
|
-
(n || p.update(`Waiting for ${
|
|
7538
|
+
(n || p.update(`Waiting for ${a.bold(l.model)} (${c}s elapsed)...`),
|
|
7517
7539
|
await new Promise((m) => setTimeout(m, 1500)));
|
|
7518
7540
|
try {
|
|
7519
7541
|
l = await u.getStatus(e);
|
|
@@ -7538,29 +7560,29 @@ async function Pt(e, t) {
|
|
|
7538
7560
|
}
|
|
7539
7561
|
if (
|
|
7540
7562
|
(process.stdout.write(`
|
|
7541
|
-
${
|
|
7563
|
+
${a.bold('Model:')} ${l.model}
|
|
7542
7564
|
`),
|
|
7543
7565
|
process.stdout
|
|
7544
|
-
.write(` ${
|
|
7566
|
+
.write(` ${a.bold('Status:')} ${l.status === 'succeeded' ? a.green(l.status) : l.status === 'processing' ? a.yellow(l.status) : a.red(l.status)}
|
|
7545
7567
|
`),
|
|
7546
|
-
process.stdout.write(` ${
|
|
7568
|
+
process.stdout.write(` ${a.bold('Request ID:')} ${l.request_id}
|
|
7547
7569
|
`),
|
|
7548
7570
|
l.output && l.output.length > 0)
|
|
7549
7571
|
) {
|
|
7550
7572
|
process.stdout.write(`
|
|
7551
|
-
${
|
|
7573
|
+
${a.bold('Outputs:')}
|
|
7552
7574
|
`);
|
|
7553
7575
|
for (let d of l.output)
|
|
7554
7576
|
if (d.url) {
|
|
7555
7577
|
if (
|
|
7556
|
-
(process.stdout.write(` [${d.type.toUpperCase()}] ${
|
|
7578
|
+
(process.stdout.write(` [${d.type.toUpperCase()}] ${a.cyan(a.underline(d.url))}
|
|
7557
7579
|
`),
|
|
7558
7580
|
o)
|
|
7559
7581
|
) {
|
|
7560
7582
|
let c = new P(`Downloading output to ${o}...`).start();
|
|
7561
7583
|
try {
|
|
7562
|
-
(await u.downloadOutput(d.url,
|
|
7563
|
-
c.succeed(`Saved to ${
|
|
7584
|
+
(await u.downloadOutput(d.url, Mt.default.resolve(process.cwd(), o)),
|
|
7585
|
+
c.succeed(`Saved to ${a.bold(o)}`));
|
|
7564
7586
|
} catch (m) {
|
|
7565
7587
|
c.fail(`Failed to download: ${m instanceof Error ? m.message : m}`);
|
|
7566
7588
|
}
|
|
@@ -7577,32 +7599,32 @@ ${d.text}
|
|
|
7577
7599
|
var Oe = x(require('node:fs')),
|
|
7578
7600
|
De = x(require('node:path'));
|
|
7579
7601
|
q();
|
|
7580
|
-
async function
|
|
7602
|
+
async function $t(e, t = {}) {
|
|
7581
7603
|
let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
7582
|
-
|
|
7604
|
+
r = I(typeof t.api_url == 'string' ? t.api_url : void 0),
|
|
7583
7605
|
n = !!t.json;
|
|
7584
7606
|
(i ||
|
|
7585
|
-
(process.stderr.write(`${
|
|
7607
|
+
(process.stderr.write(`${a.red('Error:')} Authentication required.
|
|
7586
7608
|
`),
|
|
7587
7609
|
process.stderr
|
|
7588
|
-
.write(`Please run ${
|
|
7610
|
+
.write(`Please run ${a.cyan('tein auth login')} or set ${a.cyan('TEIN_API_KEY')} environment variable.
|
|
7589
7611
|
`),
|
|
7590
7612
|
process.exit(1)),
|
|
7591
7613
|
e ||
|
|
7592
|
-
(process.stderr.write(`${
|
|
7614
|
+
(process.stderr.write(`${a.red('Error:')} Missing file path.
|
|
7593
7615
|
`),
|
|
7594
|
-
process.stderr.write(`Usage: ${
|
|
7616
|
+
process.stderr.write(`Usage: ${a.cyan('tein upload <image.png|video.mp4>')}
|
|
7595
7617
|
`),
|
|
7596
7618
|
process.exit(1)));
|
|
7597
7619
|
let s = De.default.resolve(e);
|
|
7598
7620
|
Oe.default.existsSync(s) ||
|
|
7599
|
-
(process.stderr.write(`${
|
|
7621
|
+
(process.stderr.write(`${a.red('Error:')} File not found: ${s}
|
|
7600
7622
|
`),
|
|
7601
7623
|
process.exit(1));
|
|
7602
7624
|
let o = De.default.basename(s),
|
|
7603
7625
|
p = Oe.default.readFileSync(s).toString('base64'),
|
|
7604
|
-
l = new T(i,
|
|
7605
|
-
d = new P(`Uploading ${
|
|
7626
|
+
l = new T(i, r),
|
|
7627
|
+
d = new P(`Uploading ${a.bold(o)} to Tein AI CDN...`);
|
|
7606
7628
|
n || d.start();
|
|
7607
7629
|
try {
|
|
7608
7630
|
let c = await l.uploadAsset(p, o);
|
|
@@ -7614,17 +7636,17 @@ async function Tt(e, t = {}) {
|
|
|
7614
7636
|
)
|
|
7615
7637
|
: (d.succeed('Upload successful!'),
|
|
7616
7638
|
process.stdout.write(`
|
|
7617
|
-
${
|
|
7639
|
+
${a.bold('CDN URL:')} ${a.green(c.url)}
|
|
7618
7640
|
`),
|
|
7619
|
-
process.stdout.write(`${
|
|
7641
|
+
process.stdout.write(`${a.dim(`Key: ${c.key}`)}
|
|
7620
7642
|
|
|
7621
7643
|
`),
|
|
7622
7644
|
process.stdout.write(`Use this CDN URL directly in your CLI runs:
|
|
7623
|
-
${
|
|
7645
|
+
${a.cyan(`tein run seedance-2-5 --prompt "Animate this scene" --image "${c.url}"`)}
|
|
7624
7646
|
|
|
7625
7647
|
`));
|
|
7626
7648
|
} catch (c) {
|
|
7627
|
-
let m = c instanceof
|
|
7649
|
+
let m = c instanceof w ? c : null,
|
|
7628
7650
|
f = m
|
|
7629
7651
|
? M(m).join(`
|
|
7630
7652
|
`)
|
|
@@ -7638,73 +7660,73 @@ ${r.bold('CDN URL:')} ${r.green(c.url)}
|
|
|
7638
7660
|
`,
|
|
7639
7661
|
)
|
|
7640
7662
|
: d.fail(`Upload failed: ${f}`),
|
|
7641
|
-
process.exit(m ? m.exitCode :
|
|
7663
|
+
process.exit(m ? m.exitCode : _));
|
|
7642
7664
|
}
|
|
7643
7665
|
}
|
|
7644
7666
|
W();
|
|
7645
|
-
|
|
7646
|
-
function
|
|
7667
|
+
ve();
|
|
7668
|
+
function Gt() {
|
|
7647
7669
|
process.stdout.write(`
|
|
7648
|
-
${
|
|
7670
|
+
${a.bold(a.cyan('Tein AI CLI'))} - Official Command-Line Interface for Tein AI models
|
|
7649
7671
|
|
|
7650
|
-
${
|
|
7651
|
-
${
|
|
7672
|
+
${a.bold('USAGE:')}
|
|
7673
|
+
${a.cyan('tein')} <command> [arguments] [options]
|
|
7652
7674
|
|
|
7653
|
-
${
|
|
7654
|
-
${
|
|
7655
|
-
${
|
|
7656
|
-
${
|
|
7657
|
-
${
|
|
7658
|
-
${
|
|
7659
|
-
${
|
|
7660
|
-
${
|
|
7661
|
-
${
|
|
7675
|
+
${a.bold('COMMANDS:')}
|
|
7676
|
+
${a.bold('auth')} <login|set-key|logout|status> Manage Tein API key and authentication
|
|
7677
|
+
${a.bold('models')} [category] List all 25+ models (Video, Image, Audio, Text, 3D)
|
|
7678
|
+
${a.bold('pricing')} [model-slug] Every published price (Starter, Plus, Scale)
|
|
7679
|
+
${a.bold('info')} <model-slug> View parameter schemas, pricing, and options
|
|
7680
|
+
${a.bold('upload')} <filepath> Upload local image/video directly to Tein CDN
|
|
7681
|
+
${a.bold('run')} <model-slug> [options] Generate video, image, audio, or reasoning outputs
|
|
7682
|
+
${a.bold('status')} <request-id> [options] Check generation progress and retrieve output files
|
|
7683
|
+
${a.bold('mcp')} Launch stdio MCP server for Claude Desktop / Code
|
|
7662
7684
|
|
|
7663
|
-
${
|
|
7664
|
-
${
|
|
7665
|
-
${
|
|
7666
|
-
${
|
|
7667
|
-
${
|
|
7668
|
-
${
|
|
7669
|
-
${
|
|
7670
|
-
${
|
|
7671
|
-
${
|
|
7672
|
-
${
|
|
7673
|
-
${
|
|
7674
|
-
${
|
|
7675
|
-
${
|
|
7676
|
-
${
|
|
7685
|
+
${a.bold('GENERATION OPTIONS (for `tein run`):')}
|
|
7686
|
+
${a.cyan('-p, --prompt')} <text> Text prompt for generation ${a.red('(required)')}
|
|
7687
|
+
${a.cyan('-o, --output')} <filepath> Download output file locally (e.g. video.mp4, image.png)
|
|
7688
|
+
${a.cyan('--aspect-ratio')} <ratio> Aspect ratio (16:9, 9:16, 1:1, 4:3, 21:9)
|
|
7689
|
+
${a.cyan('-d, --duration')} <seconds> Video duration in seconds (4-30s depending on model)
|
|
7690
|
+
${a.cyan('-r, --resolution')} <res> Resolution (720p, 1080p, 1K, 2K, 4K)
|
|
7691
|
+
${a.cyan('-q, --quality')} <quality> Quality tier (standard, fast, mini, high)
|
|
7692
|
+
${a.cyan('-s, --speaker')} <speaker_id> Voice speaker ID for audio TTS models
|
|
7693
|
+
${a.cyan('--image')} <url> Input image URL for image-to-video or image-to-image
|
|
7694
|
+
${a.cyan('--generate-audio')} Enable native synchronized audio (Seedance 2.5)
|
|
7695
|
+
${a.cyan('--callback-url')} <url> HTTPS URL that receives the finished job
|
|
7696
|
+
${a.cyan('--async, --no-wait')} Queue task and return request ID immediately
|
|
7697
|
+
${a.cyan('--json')} Output response in raw JSON format
|
|
7698
|
+
${a.cyan('--api-key')} <key> Override API key for this request
|
|
7677
7699
|
|
|
7678
|
-
${
|
|
7679
|
-
${
|
|
7680
|
-
${
|
|
7700
|
+
${a.bold('EXAMPLES:')}
|
|
7701
|
+
${a.dim('# 1. Authenticate with your Tein API key')}
|
|
7702
|
+
${a.cyan('tein auth login')}
|
|
7681
7703
|
|
|
7682
|
-
${
|
|
7683
|
-
${
|
|
7704
|
+
${a.dim('# 2. List all Video models')}
|
|
7705
|
+
${a.cyan('tein models video')}
|
|
7684
7706
|
|
|
7685
|
-
${
|
|
7686
|
-
${
|
|
7687
|
-
${
|
|
7707
|
+
${a.dim('# 3. Every published price, or one model as JSON')}
|
|
7708
|
+
${a.cyan('tein pricing')}
|
|
7709
|
+
${a.cyan('tein pricing seedance-2-5 --json')}
|
|
7688
7710
|
|
|
7689
|
-
${
|
|
7690
|
-
${
|
|
7711
|
+
${a.dim('# 4. Generate a high-quality 2K image and download it')}
|
|
7712
|
+
${a.cyan('tein run gpt-image-2 --prompt "Neon Tokyo street in rain" --quality high -r 2K -o tokyo.png')}
|
|
7691
7713
|
|
|
7692
|
-
${
|
|
7693
|
-
${
|
|
7714
|
+
${a.dim('# 5. Generate a video using Seedance 2.5 with audio')}
|
|
7715
|
+
${a.cyan('tein run seedance-2-5 --prompt "Drone shot of ocean waves at sunrise" --duration 5 -o ocean.mp4')}
|
|
7694
7716
|
|
|
7695
|
-
${
|
|
7696
|
-
${
|
|
7717
|
+
${a.dim('# 6. Generate speech with Seed Audio 1.0')}
|
|
7718
|
+
${a.cyan('tein run seed-audio-1-0 --prompt "Welcome to Tein AI CLI" -o welcome.wav')}
|
|
7697
7719
|
|
|
7698
|
-
${
|
|
7699
|
-
${
|
|
7720
|
+
${a.dim('# 7. Run deep reasoning task with GPT-6 Astra')}
|
|
7721
|
+
${a.cyan('tein run gpt-6-astra --prompt "Write a TypeScript binary search tree implementation"')}
|
|
7700
7722
|
|
|
7701
7723
|
`);
|
|
7702
7724
|
}
|
|
7703
|
-
async function
|
|
7725
|
+
async function fr() {
|
|
7704
7726
|
let e = process.argv.slice(2),
|
|
7705
|
-
t =
|
|
7727
|
+
t = It(e);
|
|
7706
7728
|
if (t.flags.has('help') || t.options.help || t.command === 'help') {
|
|
7707
|
-
|
|
7729
|
+
Gt();
|
|
7708
7730
|
return;
|
|
7709
7731
|
}
|
|
7710
7732
|
if (t.flags.has('version') || t.options.version || t.command === 'version') {
|
|
@@ -7731,15 +7753,15 @@ async function cr() {
|
|
|
7731
7753
|
}
|
|
7732
7754
|
case 'models':
|
|
7733
7755
|
case 'list': {
|
|
7734
|
-
await
|
|
7756
|
+
await vt(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0);
|
|
7735
7757
|
break;
|
|
7736
7758
|
}
|
|
7737
7759
|
case 'pricing':
|
|
7738
7760
|
case 'prices': {
|
|
7739
7761
|
let i = t.options.model,
|
|
7740
|
-
|
|
7741
|
-
await
|
|
7742
|
-
model:
|
|
7762
|
+
r = t.subcommand || (typeof i == 'string' ? i : void 0);
|
|
7763
|
+
await Tt({
|
|
7764
|
+
model: r,
|
|
7743
7765
|
json: !!t.options.json,
|
|
7744
7766
|
apiUrl: typeof t.options.api_url == 'string' ? t.options.api_url : void 0,
|
|
7745
7767
|
});
|
|
@@ -7748,17 +7770,17 @@ async function cr() {
|
|
|
7748
7770
|
case 'info':
|
|
7749
7771
|
case 'show': {
|
|
7750
7772
|
(t.subcommand ||
|
|
7751
|
-
(process.stderr.write(`${
|
|
7773
|
+
(process.stderr.write(`${a.red('Error:')} Missing model slug.
|
|
7752
7774
|
`),
|
|
7753
|
-
process.stderr.write(`Usage: ${
|
|
7775
|
+
process.stderr.write(`Usage: ${a.cyan('tein info <model-slug>')}
|
|
7754
7776
|
`),
|
|
7755
7777
|
process.exit(1)),
|
|
7756
|
-
await
|
|
7778
|
+
await Pt(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0));
|
|
7757
7779
|
break;
|
|
7758
7780
|
}
|
|
7759
7781
|
case 'upload': {
|
|
7760
7782
|
let i = t.subcommand || '';
|
|
7761
|
-
await
|
|
7783
|
+
await $t(i, t.options);
|
|
7762
7784
|
break;
|
|
7763
7785
|
}
|
|
7764
7786
|
case 'run':
|
|
@@ -7769,40 +7791,40 @@ async function cr() {
|
|
|
7769
7791
|
}
|
|
7770
7792
|
case 'status': {
|
|
7771
7793
|
let i = t.subcommand || '';
|
|
7772
|
-
await
|
|
7794
|
+
await St(i, t.options);
|
|
7773
7795
|
break;
|
|
7774
7796
|
}
|
|
7775
7797
|
case 'mcp': {
|
|
7776
|
-
let { startStdioServer: i } = await Promise.resolve().then(() => (
|
|
7798
|
+
let { startStdioServer: i } = await Promise.resolve().then(() => (Ft(), Bt));
|
|
7777
7799
|
await i();
|
|
7778
7800
|
break;
|
|
7779
7801
|
}
|
|
7780
7802
|
default: {
|
|
7781
7803
|
if (t.command && !t.command.startsWith('-')) {
|
|
7782
|
-
(!
|
|
7804
|
+
(!V(t.command) &&
|
|
7783
7805
|
!oe[t.command] &&
|
|
7784
7806
|
(process.stderr.write(`
|
|
7785
|
-
${
|
|
7786
|
-
Run ${
|
|
7807
|
+
${a.red('Error:')} Unknown command or model "${t.command}".
|
|
7808
|
+
Run ${a.cyan('tein --help')} for the commands, or ${a.cyan('tein models')} for the model slugs.
|
|
7787
7809
|
`),
|
|
7788
|
-
process.exit(
|
|
7810
|
+
process.exit(_)),
|
|
7789
7811
|
await Ce(t.command, t.options));
|
|
7790
7812
|
return;
|
|
7791
7813
|
}
|
|
7792
|
-
|
|
7814
|
+
Gt();
|
|
7793
7815
|
break;
|
|
7794
7816
|
}
|
|
7795
7817
|
}
|
|
7796
7818
|
}
|
|
7797
|
-
|
|
7798
|
-
(e instanceof
|
|
7819
|
+
fr().catch((e) => {
|
|
7820
|
+
(e instanceof w &&
|
|
7799
7821
|
(process.stderr.write(`
|
|
7800
|
-
${
|
|
7822
|
+
${a.red('Error:')} ${M(e).join(`
|
|
7801
7823
|
`)}
|
|
7802
7824
|
`),
|
|
7803
7825
|
process.exit(e.exitCode)),
|
|
7804
7826
|
process.stderr.write(`
|
|
7805
|
-
${
|
|
7827
|
+
${a.red('Fatal error:')} ${e instanceof Error ? e.message : e}
|
|
7806
7828
|
`),
|
|
7807
|
-
process.exit(
|
|
7829
|
+
process.exit(_));
|
|
7808
7830
|
});
|