@teinai/cli 1.1.6 → 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 +694 -660
- 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',
|
|
@@ -4205,7 +4205,7 @@ var re,
|
|
|
4205
4205
|
function ke(e, t) {
|
|
4206
4206
|
return `${e.trim().toLowerCase()}|${(t ?? '').trim().toLowerCase()}`;
|
|
4207
4207
|
}
|
|
4208
|
-
function
|
|
4208
|
+
function ni(e, t) {
|
|
4209
4209
|
if (e === 'seedance-2-mini') return 'mini';
|
|
4210
4210
|
if (e !== 'seedance-2') return;
|
|
4211
4211
|
let i = typeof t?.quality == 'string' ? t.quality.trim().toLowerCase() : '';
|
|
@@ -4215,24 +4215,24 @@ function ii(e, t) {
|
|
|
4215
4215
|
? 'fast'
|
|
4216
4216
|
: 'standard';
|
|
4217
4217
|
}
|
|
4218
|
-
function
|
|
4218
|
+
function si(e, t) {
|
|
4219
4219
|
let i = e
|
|
4220
4220
|
.trim()
|
|
4221
4221
|
.toLowerCase()
|
|
4222
4222
|
.replace(/-(?:unfiltered|uncensored)$/, '');
|
|
4223
4223
|
if (i === 'seedance-2' || i === 'seedance-2-mini') {
|
|
4224
|
-
let n =
|
|
4224
|
+
let n = ni(i, t),
|
|
4225
4225
|
s = be.get(ke('seedance-2', n));
|
|
4226
4226
|
return s ? s.slug : null;
|
|
4227
4227
|
}
|
|
4228
|
-
let
|
|
4229
|
-
return
|
|
4228
|
+
let r = ae.get(i) ?? be.get(ke(i));
|
|
4229
|
+
return r ? r.slug : null;
|
|
4230
4230
|
}
|
|
4231
|
-
function
|
|
4232
|
-
return ae.has(e) && !(
|
|
4231
|
+
function li(e, t) {
|
|
4232
|
+
return ae.has(e) && !(oi.has(e) && t) ? e : si(e, t);
|
|
4233
4233
|
}
|
|
4234
4234
|
function F(e, t) {
|
|
4235
|
-
let i =
|
|
4235
|
+
let i = li(e, t);
|
|
4236
4236
|
return i ? (ae.get(i) ?? null) : null;
|
|
4237
4237
|
}
|
|
4238
4238
|
function ne() {
|
|
@@ -4242,10 +4242,10 @@ var Ie,
|
|
|
4242
4242
|
ae,
|
|
4243
4243
|
be,
|
|
4244
4244
|
We,
|
|
4245
|
-
ti,
|
|
4246
|
-
we,
|
|
4247
4245
|
ai,
|
|
4248
|
-
|
|
4246
|
+
we,
|
|
4247
|
+
oi,
|
|
4248
|
+
N = y(() => {
|
|
4249
4249
|
'use strict';
|
|
4250
4250
|
Je();
|
|
4251
4251
|
He();
|
|
@@ -4257,18 +4257,18 @@ var Ie,
|
|
|
4257
4257
|
(ae = new Map()),
|
|
4258
4258
|
(be = new Map()),
|
|
4259
4259
|
(We = new Map()),
|
|
4260
|
-
(
|
|
4260
|
+
(ai = new Map()),
|
|
4261
4261
|
(we = new Map()));
|
|
4262
4262
|
for (let e of Ie.models) {
|
|
4263
4263
|
(ae.set(e.slug, e), be.set(ke(e.api.model, e.api.quality), e));
|
|
4264
4264
|
for (let t of e.variants) We.set(`${e.slug}/${t.id}`, { model: e, variant: t, edit: !1 });
|
|
4265
4265
|
for (let t of e.editVariants ?? [])
|
|
4266
4266
|
We.set(`${e.slug}/edit/${t.id}`, { model: e, variant: t, edit: !0 });
|
|
4267
|
-
for (let t of e.addons ?? [])
|
|
4267
|
+
for (let t of e.addons ?? []) ai.set(`${e.slug}/addon/${t.id}`, { model: e, addon: t });
|
|
4268
4268
|
we.set(e.slug, e.family);
|
|
4269
4269
|
}
|
|
4270
4270
|
for (let e of Ie.families) for (let t of e.models) we.has(t) || we.set(t, e.slug);
|
|
4271
|
-
|
|
4271
|
+
oi = new Set(['seedance-2']);
|
|
4272
4272
|
});
|
|
4273
4273
|
function se(e) {
|
|
4274
4274
|
let t = e.from?.variant;
|
|
@@ -4281,13 +4281,13 @@ function xe(e) {
|
|
|
4281
4281
|
: (e.defaultEndpoint ?? e.endpoints[0].id);
|
|
4282
4282
|
}
|
|
4283
4283
|
var ze,
|
|
4284
|
-
|
|
4284
|
+
_e = y(() => {
|
|
4285
4285
|
'use strict';
|
|
4286
|
-
|
|
4286
|
+
N();
|
|
4287
4287
|
ze = 'dynamic';
|
|
4288
4288
|
});
|
|
4289
4289
|
var oe,
|
|
4290
|
-
|
|
4290
|
+
ve = y(() => {
|
|
4291
4291
|
'use strict';
|
|
4292
4292
|
oe = {
|
|
4293
4293
|
'gemini-3-8-flash': 'gemini-3.8-flash',
|
|
@@ -4297,29 +4297,29 @@ var oe,
|
|
|
4297
4297
|
'gpt-image-2-5-sunburst': 'gpt-image-2.5-sunburst',
|
|
4298
4298
|
};
|
|
4299
4299
|
});
|
|
4300
|
-
var Ye =
|
|
4300
|
+
var Ye = y(() => {
|
|
4301
4301
|
'use strict';
|
|
4302
4302
|
});
|
|
4303
4303
|
function Qe(e, t) {
|
|
4304
|
-
return typeof t == 'string' && (
|
|
4304
|
+
return typeof t == 'string' && (pi[e]?.includes(t) ?? !1);
|
|
4305
4305
|
}
|
|
4306
|
-
var
|
|
4307
|
-
Xe =
|
|
4306
|
+
var pi,
|
|
4307
|
+
Xe = y(() => {
|
|
4308
4308
|
'use strict';
|
|
4309
|
-
|
|
4310
|
-
|
|
4309
|
+
N();
|
|
4310
|
+
_e();
|
|
4311
4311
|
Ye();
|
|
4312
|
-
|
|
4312
|
+
pi = { 'gpt-6-astra': ['balanced', 'stable'] };
|
|
4313
4313
|
});
|
|
4314
4314
|
function Ze(e) {
|
|
4315
|
-
return e === 'nano-banana-pro' ?
|
|
4315
|
+
return e === 'nano-banana-pro' ? di : ci;
|
|
4316
4316
|
}
|
|
4317
|
-
var
|
|
4318
|
-
|
|
4319
|
-
et =
|
|
4317
|
+
var di,
|
|
4318
|
+
ci,
|
|
4319
|
+
et = y(() => {
|
|
4320
4320
|
'use strict';
|
|
4321
|
-
((
|
|
4322
|
-
(
|
|
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 = [
|
|
4323
4323
|
'auto',
|
|
4324
4324
|
'1:1',
|
|
4325
4325
|
'1:4',
|
|
@@ -4338,9 +4338,26 @@ var oi,
|
|
|
4338
4338
|
]));
|
|
4339
4339
|
});
|
|
4340
4340
|
var tt,
|
|
4341
|
-
it =
|
|
4341
|
+
it = y(() => {
|
|
4342
4342
|
'use strict';
|
|
4343
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 = [
|
|
4344
4361
|
{
|
|
4345
4362
|
slug: 'claude-fable-5-1',
|
|
4346
4363
|
family: 'fable-5-1',
|
|
@@ -4409,13 +4426,13 @@ var tt,
|
|
|
4409
4426
|
},
|
|
4410
4427
|
];
|
|
4411
4428
|
});
|
|
4412
|
-
function
|
|
4429
|
+
function nt(e) {
|
|
4413
4430
|
return `$${e}`;
|
|
4414
4431
|
}
|
|
4415
4432
|
function Pe(e, t, i) {
|
|
4416
4433
|
return F(e)?.variants.find((n) => n.endpoint === t && n.component === i)?.price.starter ?? null;
|
|
4417
4434
|
}
|
|
4418
|
-
function
|
|
4435
|
+
function ui(e) {
|
|
4419
4436
|
return [
|
|
4420
4437
|
{
|
|
4421
4438
|
name: 'prompt',
|
|
@@ -4481,13 +4498,13 @@ function pi(e) {
|
|
|
4481
4498
|
},
|
|
4482
4499
|
];
|
|
4483
4500
|
}
|
|
4484
|
-
function
|
|
4501
|
+
function st() {
|
|
4485
4502
|
return Object.fromEntries(
|
|
4486
|
-
|
|
4503
|
+
rt.map((e) => {
|
|
4487
4504
|
let t = Pe(e.slug, 'cheap', 'input'),
|
|
4488
4505
|
i = Pe(e.slug, 'cheap', 'output'),
|
|
4489
|
-
|
|
4490
|
-
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` : '',
|
|
4491
4508
|
s = {
|
|
4492
4509
|
slug: e.slug,
|
|
4493
4510
|
name: e.name,
|
|
@@ -4498,20 +4515,20 @@ function at() {
|
|
|
4498
4515
|
priceFormatted: n,
|
|
4499
4516
|
unit: '/M tokens',
|
|
4500
4517
|
primaryToolName: 'run_task',
|
|
4501
|
-
parameters:
|
|
4518
|
+
parameters: ui(r),
|
|
4502
4519
|
};
|
|
4503
4520
|
return [e.slug, s];
|
|
4504
4521
|
}),
|
|
4505
4522
|
);
|
|
4506
4523
|
}
|
|
4507
|
-
var
|
|
4524
|
+
var ot = y(() => {
|
|
4508
4525
|
'use strict';
|
|
4509
|
-
|
|
4510
|
-
|
|
4526
|
+
at();
|
|
4527
|
+
N();
|
|
4511
4528
|
});
|
|
4512
4529
|
var G,
|
|
4513
4530
|
le,
|
|
4514
|
-
Te =
|
|
4531
|
+
Te = y(() => {
|
|
4515
4532
|
'use strict';
|
|
4516
4533
|
((G = ['seedance-2-5', 'seedance-2', 'seedance-2-mini', 'seedream-5-pro']),
|
|
4517
4534
|
(le =
|
|
@@ -4520,7 +4537,7 @@ var G,
|
|
|
4520
4537
|
function J(e) {
|
|
4521
4538
|
return `$${Number(e.toFixed(5))}`;
|
|
4522
4539
|
}
|
|
4523
|
-
function
|
|
4540
|
+
function hi(e) {
|
|
4524
4541
|
if (e.kind === 'llm') {
|
|
4525
4542
|
let t = e.defaultEndpoint,
|
|
4526
4543
|
i = (s) =>
|
|
@@ -4530,28 +4547,28 @@ function mi(e) {
|
|
|
4530
4547
|
(!t || !o.endpoint || o.endpoint === t) &&
|
|
4531
4548
|
(!o.context || o.context === '0\u201332K'),
|
|
4532
4549
|
),
|
|
4533
|
-
|
|
4550
|
+
r = i('input'),
|
|
4534
4551
|
n = i('output');
|
|
4535
|
-
return
|
|
4536
|
-
? `${J(
|
|
4552
|
+
return r && n
|
|
4553
|
+
? `${J(r.price.starter)}/M in \xB7 ${J(n.price.starter)}/M out`
|
|
4537
4554
|
: `from ${J(se(e).price.starter)}/M tokens`;
|
|
4538
4555
|
}
|
|
4539
4556
|
return `from ${J(se(e).price.starter)}${e.unit}`;
|
|
4540
4557
|
}
|
|
4541
|
-
function
|
|
4542
|
-
let i = t.filter((
|
|
4558
|
+
function yi(e, t) {
|
|
4559
|
+
let i = t.filter((r) => Number.isFinite(r) && r > 0);
|
|
4543
4560
|
return i.length ? `from ${J(Math.min(...i))}${e}` : null;
|
|
4544
4561
|
}
|
|
4545
|
-
function
|
|
4562
|
+
function ct(e) {
|
|
4546
4563
|
for (let t of B) {
|
|
4547
4564
|
let i = de[t],
|
|
4548
|
-
|
|
4549
|
-
i &&
|
|
4565
|
+
r = i ? yi(i.unit, e[t] ?? []) : null;
|
|
4566
|
+
i && r && (i.priceFormatted = r);
|
|
4550
4567
|
}
|
|
4551
4568
|
}
|
|
4552
4569
|
function H(e, t) {
|
|
4553
4570
|
let i = e.axes?.resolution ?? [
|
|
4554
|
-
...new Set(e.variants.map((
|
|
4571
|
+
...new Set(e.variants.map((r) => r.resolution).filter((r) => !!r)),
|
|
4555
4572
|
];
|
|
4556
4573
|
return {
|
|
4557
4574
|
name: 'resolution',
|
|
@@ -4561,7 +4578,7 @@ function H(e, t) {
|
|
|
4561
4578
|
...(t ? { description: t } : {}),
|
|
4562
4579
|
};
|
|
4563
4580
|
}
|
|
4564
|
-
function
|
|
4581
|
+
function ut(e) {
|
|
4565
4582
|
if (!e.endpoints?.length) return null;
|
|
4566
4583
|
let t = e.endpoints.filter((i) => Qe(e.slug, i.id));
|
|
4567
4584
|
return {
|
|
@@ -4570,24 +4587,26 @@ function dt(e) {
|
|
|
4570
4587
|
default: xe(e),
|
|
4571
4588
|
options: e.endpoints.filter((i) => !t.includes(i)).map((i) => i.id),
|
|
4572
4589
|
description:
|
|
4573
|
-
|
|
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.') +
|
|
4574
4593
|
(t.length ? ` ${t.map((i) => i.label).join(' and ')}: coming soon.` : ''),
|
|
4575
4594
|
};
|
|
4576
4595
|
}
|
|
4577
|
-
function
|
|
4578
|
-
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;
|
|
4579
4598
|
let i = G.includes(e.api.model);
|
|
4580
|
-
return [...t.filter((
|
|
4599
|
+
return [...t.filter((r) => !Ke.has(r.name)), i ? mt : bi];
|
|
4581
4600
|
}
|
|
4582
4601
|
function Me(e, t) {
|
|
4583
|
-
let i = e.filter((n) =>
|
|
4584
|
-
|
|
4585
|
-
return (
|
|
4602
|
+
let i = e.filter((n) => !Ke.has(n.name)),
|
|
4603
|
+
r = [mt, wi];
|
|
4604
|
+
return (r.push(ft, gt), [...i, ...r]);
|
|
4586
4605
|
}
|
|
4587
|
-
function
|
|
4606
|
+
function lt(e) {
|
|
4588
4607
|
return [
|
|
4589
4608
|
...e
|
|
4590
|
-
.filter((t) => !
|
|
4609
|
+
.filter((t) => !Ii.has(t.name) && !Ke.has(t.name))
|
|
4591
4610
|
.map((t) =>
|
|
4592
4611
|
t.name === 'resolution'
|
|
4593
4612
|
? {
|
|
@@ -4603,13 +4622,13 @@ function st(e) {
|
|
|
4603
4622
|
options: ['standard'],
|
|
4604
4623
|
description: 'LITE uses standard bitrate. High bitrate is on the standard endpoint.',
|
|
4605
4624
|
},
|
|
4606
|
-
|
|
4607
|
-
|
|
4625
|
+
ft,
|
|
4626
|
+
gt,
|
|
4608
4627
|
];
|
|
4609
4628
|
}
|
|
4610
4629
|
function Se(e, t) {
|
|
4611
4630
|
return [
|
|
4612
|
-
|
|
4631
|
+
K('Text prompt describing the video.'),
|
|
4613
4632
|
{ name: 'mode', type: 'select', required: !0, default: t.modes[0], options: t.modes },
|
|
4614
4633
|
{
|
|
4615
4634
|
name: 'duration',
|
|
@@ -4636,10 +4655,10 @@ function Se(e, t) {
|
|
|
4636
4655
|
),
|
|
4637
4656
|
];
|
|
4638
4657
|
}
|
|
4639
|
-
function
|
|
4640
|
-
let t =
|
|
4658
|
+
function xi(e) {
|
|
4659
|
+
let t = ut(e);
|
|
4641
4660
|
return [
|
|
4642
|
-
|
|
4661
|
+
K('Image prompt text. Supports complex composition and text instructions.'),
|
|
4643
4662
|
...(t ? [t] : []),
|
|
4644
4663
|
{
|
|
4645
4664
|
name: 'quality',
|
|
@@ -4648,28 +4667,6 @@ function wi(e) {
|
|
|
4648
4667
|
options: e.axes?.quality ?? ['low', 'medium', 'high'],
|
|
4649
4668
|
},
|
|
4650
4669
|
H(e, 'Square output: 1024, 2048 or 2880 px.'),
|
|
4651
|
-
{
|
|
4652
|
-
name: 'aspect_ratio',
|
|
4653
|
-
type: 'select',
|
|
4654
|
-
options: [
|
|
4655
|
-
'1:1',
|
|
4656
|
-
'16:9',
|
|
4657
|
-
'9:16',
|
|
4658
|
-
'4:3',
|
|
4659
|
-
'3:4',
|
|
4660
|
-
'3:2',
|
|
4661
|
-
'2:3',
|
|
4662
|
-
'4:5',
|
|
4663
|
-
'5:4',
|
|
4664
|
-
'1:2',
|
|
4665
|
-
'2:1',
|
|
4666
|
-
'21:9',
|
|
4667
|
-
'9:21',
|
|
4668
|
-
'auto',
|
|
4669
|
-
],
|
|
4670
|
-
description:
|
|
4671
|
-
'Accepted for older clients. GPT Image output stays square at the resolution (1024, 2048, or 2880 px) whatever ratio is sent.',
|
|
4672
|
-
},
|
|
4673
4670
|
{
|
|
4674
4671
|
name: 'input_images',
|
|
4675
4672
|
type: 'string[]',
|
|
@@ -4713,9 +4710,9 @@ function wi(e) {
|
|
|
4713
4710
|
},
|
|
4714
4711
|
];
|
|
4715
4712
|
}
|
|
4716
|
-
function
|
|
4713
|
+
function _i(e) {
|
|
4717
4714
|
return [
|
|
4718
|
-
|
|
4715
|
+
K('Image prompt text.'),
|
|
4719
4716
|
{
|
|
4720
4717
|
name: 'input_images',
|
|
4721
4718
|
type: 'string[]',
|
|
@@ -4747,9 +4744,37 @@ function ki(e) {
|
|
|
4747
4744
|
},
|
|
4748
4745
|
];
|
|
4749
4746
|
}
|
|
4750
|
-
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) {
|
|
4751
4776
|
return [
|
|
4752
|
-
|
|
4777
|
+
K('The user message or task.'),
|
|
4753
4778
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
4754
4779
|
{
|
|
4755
4780
|
name: 'messages',
|
|
@@ -4842,36 +4867,40 @@ function _i(e) {
|
|
|
4842
4867
|
},
|
|
4843
4868
|
];
|
|
4844
4869
|
}
|
|
4845
|
-
function
|
|
4846
|
-
if (e.slug === 'seed-2-1-turbo') return
|
|
4847
|
-
let t =
|
|
4870
|
+
function Si(e) {
|
|
4871
|
+
if (e.slug === 'seed-2-1-turbo') return Pi;
|
|
4872
|
+
let t = ut(e);
|
|
4848
4873
|
return [
|
|
4849
|
-
...(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),
|
|
4850
4879
|
...(t ? [t] : []),
|
|
4851
4880
|
];
|
|
4852
4881
|
}
|
|
4853
|
-
function
|
|
4882
|
+
function $i(e) {
|
|
4854
4883
|
let t = e.slug;
|
|
4855
|
-
if (e.kind === 'llm') return
|
|
4856
|
-
if (e.editVariants?.length) return
|
|
4884
|
+
if (e.kind === 'llm') return Si(e);
|
|
4885
|
+
if (e.editVariants?.length) return xi(e);
|
|
4857
4886
|
switch (t) {
|
|
4858
4887
|
case 'seedance-2-5':
|
|
4859
|
-
return Me(
|
|
4888
|
+
return Me(pt, t);
|
|
4860
4889
|
case 'seedance-2-5-lite':
|
|
4861
|
-
return
|
|
4890
|
+
return lt(pt);
|
|
4862
4891
|
case 'seedance-2':
|
|
4863
|
-
return Me(
|
|
4892
|
+
return Me(dt, t);
|
|
4864
4893
|
case 'seedance-2-lite':
|
|
4865
|
-
return
|
|
4894
|
+
return lt(dt);
|
|
4866
4895
|
case 'seedance-2-mini':
|
|
4867
|
-
return Me(
|
|
4896
|
+
return Me(Ki, t);
|
|
4868
4897
|
case 'nano-banana-2':
|
|
4869
4898
|
case 'nano-banana-2.1':
|
|
4870
4899
|
case 'nano-banana-pro':
|
|
4871
|
-
return
|
|
4900
|
+
return _i(e);
|
|
4872
4901
|
case 'seedream-5-pro':
|
|
4873
4902
|
return [
|
|
4874
|
-
|
|
4903
|
+
K('Detailed description of the image to generate.'),
|
|
4875
4904
|
{ name: 'images', type: 'string[]', description: 'Reference images (the first is free).' },
|
|
4876
4905
|
H(e),
|
|
4877
4906
|
{
|
|
@@ -4885,7 +4914,7 @@ function Ti(e) {
|
|
|
4885
4914
|
case 'qwen-3':
|
|
4886
4915
|
case 'qwen-3-pro':
|
|
4887
4916
|
return [
|
|
4888
|
-
|
|
4917
|
+
K('Image prompt text; dense layouts and multilingual text work well.'),
|
|
4889
4918
|
{
|
|
4890
4919
|
name: 'images',
|
|
4891
4920
|
type: 'string[]',
|
|
@@ -4960,135 +4989,136 @@ function Ti(e) {
|
|
|
4960
4989
|
references: ['images', 'videos', 'audios', 'first_frame_image', 'last_frame_image'],
|
|
4961
4990
|
});
|
|
4962
4991
|
default:
|
|
4963
|
-
return [
|
|
4992
|
+
return [K('Prompt text.')];
|
|
4964
4993
|
}
|
|
4965
4994
|
}
|
|
4966
|
-
function
|
|
4995
|
+
function $e(e, t = e.api.model) {
|
|
4967
4996
|
return {
|
|
4968
4997
|
slug: t,
|
|
4969
4998
|
name: e.name,
|
|
4970
|
-
category:
|
|
4971
|
-
kind:
|
|
4999
|
+
category: mi[e.kind],
|
|
5000
|
+
kind: gi[e.kind],
|
|
4972
5001
|
vendor: e.vendor ?? '',
|
|
4973
5002
|
description: e.desc ?? e.name,
|
|
4974
|
-
priceFormatted:
|
|
5003
|
+
priceFormatted: hi(e),
|
|
4975
5004
|
unit: e.unit,
|
|
4976
|
-
primaryToolName:
|
|
4977
|
-
parameters:
|
|
5005
|
+
primaryToolName: fi[e.kind],
|
|
5006
|
+
parameters: ki(e, $i(e)),
|
|
4978
5007
|
};
|
|
4979
5008
|
}
|
|
4980
|
-
function
|
|
5009
|
+
function Ci() {
|
|
4981
5010
|
let e = {};
|
|
4982
5011
|
for (let t of ne())
|
|
4983
5012
|
if (t.slug !== 'seedance-2-fast') {
|
|
4984
5013
|
if (t.slug === 'seedance-2-mini') {
|
|
4985
|
-
e['seedance-2-mini'] =
|
|
5014
|
+
e['seedance-2-mini'] = $e(t, 'seedance-2-mini');
|
|
4986
5015
|
continue;
|
|
4987
5016
|
}
|
|
4988
5017
|
if (t.slug === 'seedance-2') {
|
|
4989
|
-
let i =
|
|
5018
|
+
let i = $e(t);
|
|
4990
5019
|
((i.description = `${t.desc ?? t.name} Send quality fast or mini for Seedance 2.0 Fast or Mini.`),
|
|
4991
5020
|
(e['seedance-2'] = i));
|
|
4992
5021
|
continue;
|
|
4993
5022
|
}
|
|
4994
|
-
t.slug.startsWith('claude-') || (e[t.api.model] =
|
|
5023
|
+
t.slug.startsWith('claude-') || (e[t.api.model] = $e(t));
|
|
4995
5024
|
}
|
|
4996
|
-
Object.assign(e,
|
|
5025
|
+
Object.assign(e, st());
|
|
4997
5026
|
for (let [t, i] of Object.entries(oe))
|
|
4998
5027
|
e[i] && Object.defineProperty(e, t, { value: e[i], enumerable: !1 });
|
|
4999
5028
|
return e;
|
|
5000
5029
|
}
|
|
5001
|
-
function
|
|
5030
|
+
function V(e) {
|
|
5002
5031
|
return de[e] ?? null;
|
|
5003
5032
|
}
|
|
5004
|
-
function
|
|
5033
|
+
function wt(e, t, i) {
|
|
5005
5034
|
if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite') && t === 'duration') {
|
|
5006
|
-
let
|
|
5007
|
-
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;
|
|
5008
5037
|
}
|
|
5009
5038
|
return !0;
|
|
5010
5039
|
}
|
|
5011
5040
|
function E() {
|
|
5012
5041
|
return Object.values(de);
|
|
5013
5042
|
}
|
|
5014
|
-
var
|
|
5015
|
-
|
|
5016
|
-
ui,
|
|
5017
|
-
$,
|
|
5018
|
-
ct,
|
|
5043
|
+
var mi,
|
|
5044
|
+
fi,
|
|
5019
5045
|
gi,
|
|
5020
|
-
|
|
5021
|
-
ut,
|
|
5046
|
+
K,
|
|
5022
5047
|
mt,
|
|
5023
|
-
$e,
|
|
5024
5048
|
bi,
|
|
5049
|
+
wi,
|
|
5050
|
+
ft,
|
|
5051
|
+
gt,
|
|
5052
|
+
Ke,
|
|
5025
5053
|
Ii,
|
|
5026
|
-
xi,
|
|
5027
5054
|
vi,
|
|
5055
|
+
Pi,
|
|
5056
|
+
Ti,
|
|
5028
5057
|
pe,
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5058
|
+
pt,
|
|
5059
|
+
yt,
|
|
5060
|
+
bt,
|
|
5061
|
+
dt,
|
|
5062
|
+
Ki,
|
|
5034
5063
|
de,
|
|
5035
|
-
W =
|
|
5064
|
+
W = y(() => {
|
|
5036
5065
|
'use strict';
|
|
5037
5066
|
he();
|
|
5038
|
-
|
|
5039
|
-
ve();
|
|
5067
|
+
N();
|
|
5040
5068
|
_e();
|
|
5069
|
+
ve();
|
|
5041
5070
|
Xe();
|
|
5042
5071
|
et();
|
|
5043
|
-
|
|
5072
|
+
it();
|
|
5073
|
+
ot();
|
|
5044
5074
|
Te();
|
|
5045
|
-
((
|
|
5046
|
-
(
|
|
5075
|
+
((mi = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
|
|
5076
|
+
(fi = {
|
|
5047
5077
|
video: 'generate_video',
|
|
5048
5078
|
image: 'generate_image',
|
|
5049
5079
|
audio: 'generate_audio',
|
|
5050
5080
|
llm: 'run_task',
|
|
5051
5081
|
}),
|
|
5052
|
-
(
|
|
5082
|
+
(gi = {
|
|
5053
5083
|
video: 'Text-to-Video',
|
|
5054
5084
|
image: 'Text-to-Image',
|
|
5055
5085
|
audio: 'Text-to-Audio',
|
|
5056
5086
|
llm: 'Reasoning (LLM)',
|
|
5057
5087
|
}));
|
|
5058
|
-
|
|
5059
|
-
((
|
|
5088
|
+
K = (e) => ({ name: 'prompt', type: 'string', required: !0, description: e });
|
|
5089
|
+
((mt = {
|
|
5060
5090
|
name: 'creative_mode',
|
|
5061
5091
|
type: 'boolean',
|
|
5062
5092
|
default: !1,
|
|
5063
5093
|
description:
|
|
5064
5094
|
'Runs the Creative mode checkpoint at its published price (+5%). The Acceptable Use Policy applies.',
|
|
5065
5095
|
}),
|
|
5066
|
-
(
|
|
5096
|
+
(bi = {
|
|
5067
5097
|
name: 'creative_mode',
|
|
5068
5098
|
type: 'boolean',
|
|
5069
5099
|
default: !1,
|
|
5070
5100
|
description: `Not available yet on this model: ${le}.`,
|
|
5071
5101
|
}),
|
|
5072
|
-
(
|
|
5102
|
+
(wi = {
|
|
5073
5103
|
name: 'priority',
|
|
5074
5104
|
type: 'boolean',
|
|
5075
5105
|
default: !1,
|
|
5076
5106
|
description: 'Guaranteed speed and no queue, at the published Priority price (+6%).',
|
|
5077
5107
|
}),
|
|
5078
|
-
(
|
|
5108
|
+
(ft = {
|
|
5079
5109
|
name: 'reference_roles',
|
|
5080
5110
|
type: 'json',
|
|
5081
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).`,
|
|
5082
5112
|
}),
|
|
5083
|
-
(
|
|
5113
|
+
(gt = {
|
|
5084
5114
|
name: 'auto_fit_images',
|
|
5085
5115
|
type: 'boolean',
|
|
5086
5116
|
default: !1,
|
|
5087
5117
|
description:
|
|
5088
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.',
|
|
5089
5119
|
}),
|
|
5090
|
-
(
|
|
5091
|
-
|
|
5120
|
+
(Ke = new Set(['full_access', 'is_uncensored', 'unfiltered', 'verificationSignature'])));
|
|
5121
|
+
Ii = new Set([
|
|
5092
5122
|
'quality',
|
|
5093
5123
|
'bitrate_mode',
|
|
5094
5124
|
'draft',
|
|
@@ -5096,8 +5126,8 @@ var di,
|
|
|
5096
5126
|
'draft_generation_id',
|
|
5097
5127
|
'pass_faces',
|
|
5098
5128
|
]);
|
|
5099
|
-
((
|
|
5100
|
-
|
|
5129
|
+
((vi = [
|
|
5130
|
+
K('The user message or task.'),
|
|
5101
5131
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
5102
5132
|
{
|
|
5103
5133
|
name: 'messages',
|
|
@@ -5114,8 +5144,8 @@ var di,
|
|
|
5114
5144
|
{ name: 'temperature', type: 'slider', min: 0, max: 1, step: 0.1 },
|
|
5115
5145
|
{ name: 'top_p', type: 'slider', min: 0, max: 1, step: 0.05 },
|
|
5116
5146
|
]),
|
|
5117
|
-
(
|
|
5118
|
-
|
|
5147
|
+
(Pi = [
|
|
5148
|
+
K('The user message or task.'),
|
|
5119
5149
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
5120
5150
|
{
|
|
5121
5151
|
name: 'messages',
|
|
@@ -5196,9 +5226,9 @@ var di,
|
|
|
5196
5226
|
description: 'Video frames read a second.',
|
|
5197
5227
|
},
|
|
5198
5228
|
]),
|
|
5199
|
-
(
|
|
5229
|
+
(Ti = ['gemini-3.8-flash', 'gemini-3.7-flash']));
|
|
5200
5230
|
((pe = 'Left out: 480p, the same default as the API, the playground and workflow steps.'),
|
|
5201
|
-
(
|
|
5231
|
+
(pt = [
|
|
5202
5232
|
{
|
|
5203
5233
|
name: 'prompt',
|
|
5204
5234
|
type: 'string',
|
|
@@ -5343,19 +5373,19 @@ var di,
|
|
|
5343
5373
|
description: 'Preserve facial likeness from reference images.',
|
|
5344
5374
|
},
|
|
5345
5375
|
]),
|
|
5346
|
-
(
|
|
5376
|
+
(yt = {
|
|
5347
5377
|
name: 'images',
|
|
5348
5378
|
type: 'string[]',
|
|
5349
5379
|
description:
|
|
5350
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.',
|
|
5351
5381
|
}),
|
|
5352
|
-
(
|
|
5382
|
+
(bt = {
|
|
5353
5383
|
name: 'audios',
|
|
5354
5384
|
type: 'string[]',
|
|
5355
5385
|
description:
|
|
5356
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.',
|
|
5357
5387
|
}),
|
|
5358
|
-
(
|
|
5388
|
+
(dt = [
|
|
5359
5389
|
{
|
|
5360
5390
|
name: 'prompt',
|
|
5361
5391
|
type: 'string',
|
|
@@ -5433,8 +5463,8 @@ var di,
|
|
|
5433
5463
|
description:
|
|
5434
5464
|
'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
|
|
5435
5465
|
},
|
|
5436
|
-
|
|
5437
|
-
|
|
5466
|
+
yt,
|
|
5467
|
+
bt,
|
|
5438
5468
|
{
|
|
5439
5469
|
name: 'first_frame_image',
|
|
5440
5470
|
type: 'string',
|
|
@@ -5448,7 +5478,7 @@ var di,
|
|
|
5448
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.',
|
|
5449
5479
|
},
|
|
5450
5480
|
]),
|
|
5451
|
-
(
|
|
5481
|
+
(Ki = [
|
|
5452
5482
|
{
|
|
5453
5483
|
name: 'prompt',
|
|
5454
5484
|
type: 'string',
|
|
@@ -5503,8 +5533,8 @@ var di,
|
|
|
5503
5533
|
description:
|
|
5504
5534
|
'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
|
|
5505
5535
|
},
|
|
5506
|
-
|
|
5507
|
-
|
|
5536
|
+
yt,
|
|
5537
|
+
bt,
|
|
5508
5538
|
{
|
|
5509
5539
|
name: 'first_frame_image',
|
|
5510
5540
|
type: 'string',
|
|
@@ -5512,52 +5542,52 @@ var di,
|
|
|
5512
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.',
|
|
5513
5543
|
},
|
|
5514
5544
|
]));
|
|
5515
|
-
de =
|
|
5545
|
+
de = Ci();
|
|
5516
5546
|
});
|
|
5517
5547
|
function ce(e) {
|
|
5518
5548
|
let t = '/v1/pricing/models',
|
|
5519
5549
|
i = e?.trim();
|
|
5520
5550
|
return i ? `${t}?model=${encodeURIComponent(i)}` : t;
|
|
5521
5551
|
}
|
|
5522
|
-
var qe =
|
|
5552
|
+
var qe = y(() => {
|
|
5523
5553
|
'use strict';
|
|
5524
5554
|
});
|
|
5525
|
-
function
|
|
5555
|
+
function Kt(e) {
|
|
5526
5556
|
return e.length <= 1 ? (e[0] ?? '') : `${e.slice(0, -1).join(', ')} and ${e[e.length - 1]}`;
|
|
5527
5557
|
}
|
|
5528
|
-
function
|
|
5558
|
+
function Ct(e) {
|
|
5529
5559
|
let t = ne().filter((s) => s.kind === e && s.unfiltered != null),
|
|
5530
5560
|
i = t.filter((s) => G.includes(s.api.model)).map((s) => s.name),
|
|
5531
|
-
|
|
5561
|
+
r = t.filter((s) => !G.includes(s.api.model)).map((s) => s.name);
|
|
5532
5562
|
return [
|
|
5533
5563
|
...(i.length
|
|
5534
|
-
? [`${
|
|
5564
|
+
? [`${Kt(i)}: runs the Creative mode checkpoint at its published price (+5%).`]
|
|
5535
5565
|
: []),
|
|
5536
|
-
...(
|
|
5566
|
+
...(r.length ? [`Not available yet on ${Kt(r)}: ${le}.`] : []),
|
|
5537
5567
|
'The Acceptable Use Policy applies.',
|
|
5538
5568
|
].join(' ');
|
|
5539
5569
|
}
|
|
5540
|
-
function
|
|
5541
|
-
if (
|
|
5570
|
+
function er(e) {
|
|
5571
|
+
if (Xi.has(e.name)) return e;
|
|
5542
5572
|
let t = e.inputSchema.properties;
|
|
5543
5573
|
return !t || t.callback_url
|
|
5544
5574
|
? e
|
|
5545
|
-
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url:
|
|
5575
|
+
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url: Qi } } };
|
|
5546
5576
|
}
|
|
5547
|
-
function
|
|
5577
|
+
function tr(e) {
|
|
5548
5578
|
let t = e.inputSchema.properties;
|
|
5549
5579
|
if (!t) return e;
|
|
5550
5580
|
let i = !1,
|
|
5551
|
-
|
|
5581
|
+
r = {};
|
|
5552
5582
|
for (let [n, s] of Object.entries(t))
|
|
5553
|
-
|
|
5554
|
-
? ((
|
|
5555
|
-
:
|
|
5556
|
-
? ((
|
|
5557
|
-
: (
|
|
5558
|
-
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;
|
|
5559
5589
|
}
|
|
5560
|
-
function
|
|
5590
|
+
function ir(e) {
|
|
5561
5591
|
switch (e.type) {
|
|
5562
5592
|
case 'string':
|
|
5563
5593
|
return {
|
|
@@ -5612,14 +5642,14 @@ function Zi(e) {
|
|
|
5612
5642
|
return { type: 'string', description: e.description };
|
|
5613
5643
|
}
|
|
5614
5644
|
}
|
|
5615
|
-
function
|
|
5645
|
+
function rr(e, t) {
|
|
5616
5646
|
let i = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
|
|
5617
|
-
|
|
5647
|
+
r = {},
|
|
5618
5648
|
n = [];
|
|
5619
|
-
for (let o of e.parameters) ((
|
|
5649
|
+
for (let o of e.parameters) ((r[o.name] = ir(o)), o.required && n.push(o.name));
|
|
5620
5650
|
let s = {
|
|
5621
5651
|
type: 'object',
|
|
5622
|
-
properties:
|
|
5652
|
+
properties: r,
|
|
5623
5653
|
...(n.length > 0 ? { required: n } : {}),
|
|
5624
5654
|
additionalProperties: !0,
|
|
5625
5655
|
};
|
|
@@ -5629,11 +5659,11 @@ function er(e, t) {
|
|
|
5629
5659
|
inputSchema: s,
|
|
5630
5660
|
};
|
|
5631
5661
|
}
|
|
5632
|
-
function
|
|
5662
|
+
function ar() {
|
|
5633
5663
|
let e = E().filter((c) => c.category === 'Image'),
|
|
5634
5664
|
t = E().filter((c) => c.category === 'Video'),
|
|
5635
5665
|
i = E().filter((c) => c.category === 'Text'),
|
|
5636
|
-
|
|
5666
|
+
r = E().filter((c) => c.category === 'Audio'),
|
|
5637
5667
|
n = {
|
|
5638
5668
|
name: 'generate_image',
|
|
5639
5669
|
description:
|
|
@@ -5654,7 +5684,7 @@ function tr() {
|
|
|
5654
5684
|
aspect_ratio: {
|
|
5655
5685
|
type: 'string',
|
|
5656
5686
|
description:
|
|
5657
|
-
'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.',
|
|
5658
5688
|
},
|
|
5659
5689
|
resolution: {
|
|
5660
5690
|
type: 'string',
|
|
@@ -5680,7 +5710,7 @@ function tr() {
|
|
|
5680
5710
|
enum: ['low', 'medium', 'high', 'xhigh', 'max'],
|
|
5681
5711
|
default: 'low',
|
|
5682
5712
|
description:
|
|
5683
|
-
'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.',
|
|
5684
5714
|
},
|
|
5685
5715
|
n: {
|
|
5686
5716
|
type: 'number',
|
|
@@ -5725,7 +5755,7 @@ function tr() {
|
|
|
5725
5755
|
maximum: 2147483647,
|
|
5726
5756
|
description: 'Nano Banana 2 and Nano Banana Pro. Omit it for a new image each time.',
|
|
5727
5757
|
},
|
|
5728
|
-
creative_mode: { type: 'boolean', default: !1, description:
|
|
5758
|
+
creative_mode: { type: 'boolean', default: !1, description: Ct('image') },
|
|
5729
5759
|
},
|
|
5730
5760
|
required: ['prompt'],
|
|
5731
5761
|
additionalProperties: !0,
|
|
@@ -5762,7 +5792,7 @@ function tr() {
|
|
|
5762
5792
|
default: '480p',
|
|
5763
5793
|
description: 'Video resolution (the lowest price is the default; see each model tool).',
|
|
5764
5794
|
},
|
|
5765
|
-
creative_mode: { type: 'boolean', default: !1, description:
|
|
5795
|
+
creative_mode: { type: 'boolean', default: !1, description: Ct('video') },
|
|
5766
5796
|
priority: {
|
|
5767
5797
|
type: 'boolean',
|
|
5768
5798
|
default: !1,
|
|
@@ -5884,10 +5914,10 @@ function tr() {
|
|
|
5884
5914
|
additionalProperties: !0,
|
|
5885
5915
|
},
|
|
5886
5916
|
},
|
|
5887
|
-
d =
|
|
5888
|
-
return [n, s, o, u, p, d, l,
|
|
5917
|
+
d = nr();
|
|
5918
|
+
return [n, s, o, u, p, d, l, Zi];
|
|
5889
5919
|
}
|
|
5890
|
-
function
|
|
5920
|
+
function nr() {
|
|
5891
5921
|
return {
|
|
5892
5922
|
name: 'upload_asset',
|
|
5893
5923
|
description:
|
|
@@ -5935,25 +5965,25 @@ function ir() {
|
|
|
5935
5965
|
};
|
|
5936
5966
|
}
|
|
5937
5967
|
function Le() {
|
|
5938
|
-
let e =
|
|
5939
|
-
t = E().map((i) =>
|
|
5940
|
-
return [...e, ...t].map(
|
|
5968
|
+
let e = ar(),
|
|
5969
|
+
t = E().map((i) => rr(i));
|
|
5970
|
+
return [...e, ...t].map(er).map(tr);
|
|
5941
5971
|
}
|
|
5942
|
-
var
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5972
|
+
var Qi,
|
|
5973
|
+
Xi,
|
|
5974
|
+
Zi,
|
|
5975
|
+
qt,
|
|
5976
|
+
Et = y(() => {
|
|
5947
5977
|
'use strict';
|
|
5948
|
-
|
|
5978
|
+
N();
|
|
5949
5979
|
Te();
|
|
5950
5980
|
W();
|
|
5951
|
-
((
|
|
5981
|
+
((Qi = {
|
|
5952
5982
|
type: 'string',
|
|
5953
5983
|
description:
|
|
5954
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.',
|
|
5955
5985
|
}),
|
|
5956
|
-
(
|
|
5986
|
+
(Xi = new Set([
|
|
5957
5987
|
'upload_asset',
|
|
5958
5988
|
'upload_media',
|
|
5959
5989
|
'upload_image',
|
|
@@ -5961,7 +5991,7 @@ var Wi,
|
|
|
5961
5991
|
'check_status',
|
|
5962
5992
|
'get_pricing',
|
|
5963
5993
|
])),
|
|
5964
|
-
(
|
|
5994
|
+
(Zi = {
|
|
5965
5995
|
name: 'get_pricing',
|
|
5966
5996
|
description:
|
|
5967
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.',
|
|
@@ -5976,7 +6006,7 @@ var Wi,
|
|
|
5976
6006
|
additionalProperties: !1,
|
|
5977
6007
|
},
|
|
5978
6008
|
}));
|
|
5979
|
-
|
|
6009
|
+
qt = new Set([
|
|
5980
6010
|
'image',
|
|
5981
6011
|
'images',
|
|
5982
6012
|
'image_url',
|
|
@@ -5993,28 +6023,28 @@ var Wi,
|
|
|
5993
6023
|
'lipsyncing_audio',
|
|
5994
6024
|
]);
|
|
5995
6025
|
});
|
|
5996
|
-
var
|
|
5997
|
-
|
|
5998
|
-
forgetToolSchemas: () =>
|
|
5999
|
-
jsonRpcAnswer: () =>
|
|
6000
|
-
preprocessLocalFiles: () =>
|
|
6001
|
-
startStdioServer: () =>
|
|
6026
|
+
var Bt = {};
|
|
6027
|
+
Qt(Bt, {
|
|
6028
|
+
forgetToolSchemas: () => dr,
|
|
6029
|
+
jsonRpcAnswer: () => Dt,
|
|
6030
|
+
preprocessLocalFiles: () => Ut,
|
|
6031
|
+
startStdioServer: () => jt,
|
|
6002
6032
|
});
|
|
6003
|
-
function
|
|
6033
|
+
function sr(e) {
|
|
6004
6034
|
let t = (i) =>
|
|
6005
6035
|
!!i && typeof i == 'object' && i.jsonrpc === '2.0' && ('result' in i || 'error' in i);
|
|
6006
6036
|
return Array.isArray(e) ? e.length > 0 && e.every(t) : t(e);
|
|
6007
6037
|
}
|
|
6008
|
-
function
|
|
6009
|
-
let
|
|
6010
|
-
n =
|
|
6038
|
+
function Dt(e, t, i) {
|
|
6039
|
+
let r = e?.id,
|
|
6040
|
+
n = r == null,
|
|
6011
6041
|
s = null;
|
|
6012
6042
|
try {
|
|
6013
6043
|
s = i ? JSON.parse(i) : null;
|
|
6014
6044
|
} catch {
|
|
6015
6045
|
s = null;
|
|
6016
6046
|
}
|
|
6017
|
-
if (s !== null &&
|
|
6047
|
+
if (s !== null && sr(s)) return n ? null : s;
|
|
6018
6048
|
if (n) return null;
|
|
6019
6049
|
if (!i && t >= 200 && t < 300) return;
|
|
6020
6050
|
let o = s?.error,
|
|
@@ -6027,7 +6057,7 @@ function At(e, t, i) {
|
|
|
6027
6057
|
p = o && typeof o == 'object' && typeof o.code == 'string' ? o.code : null;
|
|
6028
6058
|
return {
|
|
6029
6059
|
jsonrpc: '2.0',
|
|
6030
|
-
id:
|
|
6060
|
+
id: r,
|
|
6031
6061
|
error: {
|
|
6032
6062
|
code: t === 401 ? -32001 : -32603,
|
|
6033
6063
|
message: u,
|
|
@@ -6035,18 +6065,18 @@ function At(e, t, i) {
|
|
|
6035
6065
|
},
|
|
6036
6066
|
};
|
|
6037
6067
|
}
|
|
6038
|
-
function
|
|
6068
|
+
function or() {
|
|
6039
6069
|
let e = process.argv.slice(2),
|
|
6040
6070
|
t = e.indexOf('--api-key');
|
|
6041
6071
|
return S(t >= 0 ? e[t + 1] : void 0);
|
|
6042
6072
|
}
|
|
6043
|
-
async function
|
|
6044
|
-
let
|
|
6045
|
-
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())
|
|
6046
6076
|
throw new Error(`File not found: ${e}`);
|
|
6047
|
-
let n = A.default.readFileSync(
|
|
6077
|
+
let n = A.default.readFileSync(r),
|
|
6048
6078
|
s = n.toString('base64'),
|
|
6049
|
-
o = O.default.basename(
|
|
6079
|
+
o = O.default.basename(r),
|
|
6050
6080
|
u = n.length,
|
|
6051
6081
|
p = `${i.replace(/\/$/, '')}/v1/upload`,
|
|
6052
6082
|
l = await fetch(p, {
|
|
@@ -6070,15 +6100,15 @@ async function Rt(e, t, i) {
|
|
|
6070
6100
|
mimeType: d.mime_type || d.mimeType || 'image/png',
|
|
6071
6101
|
};
|
|
6072
6102
|
}
|
|
6073
|
-
function
|
|
6074
|
-
return
|
|
6103
|
+
function Nt(e) {
|
|
6104
|
+
return lr.has(O.default.extname(e).toLowerCase());
|
|
6075
6105
|
}
|
|
6076
|
-
function
|
|
6106
|
+
function Vt(e) {
|
|
6077
6107
|
return new Error(
|
|
6078
6108
|
`Tein uploads image, video and audio files only, and ${O.default.basename(e)} is not one.`,
|
|
6079
6109
|
);
|
|
6080
6110
|
}
|
|
6081
|
-
function
|
|
6111
|
+
function pr(e) {
|
|
6082
6112
|
let t = e.trim();
|
|
6083
6113
|
if (
|
|
6084
6114
|
!t ||
|
|
@@ -6091,7 +6121,7 @@ function sr(e) {
|
|
|
6091
6121
|
let i = O.default.resolve(t);
|
|
6092
6122
|
return A.default.existsSync(i) && A.default.statSync(i).isFile() ? i : null;
|
|
6093
6123
|
}
|
|
6094
|
-
function
|
|
6124
|
+
function Ve(e) {
|
|
6095
6125
|
if (Array.isArray(e))
|
|
6096
6126
|
for (let t of e) {
|
|
6097
6127
|
let i = t;
|
|
@@ -6101,14 +6131,14 @@ function Ne(e) {
|
|
|
6101
6131
|
Q.set(i.name, i.inputSchema);
|
|
6102
6132
|
}
|
|
6103
6133
|
}
|
|
6104
|
-
function
|
|
6105
|
-
(Q.clear(), (
|
|
6134
|
+
function dr() {
|
|
6135
|
+
(Q.clear(), (Ne = 0));
|
|
6106
6136
|
}
|
|
6107
|
-
async function
|
|
6108
|
-
if (!(Date.now() -
|
|
6109
|
-
|
|
6137
|
+
async function cr(e, t) {
|
|
6138
|
+
if (!(Date.now() - Ne < 6e4)) {
|
|
6139
|
+
Ne = Date.now();
|
|
6110
6140
|
try {
|
|
6111
|
-
let
|
|
6141
|
+
let r = await (
|
|
6112
6142
|
await fetch(e, {
|
|
6113
6143
|
method: 'POST',
|
|
6114
6144
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${t}` },
|
|
@@ -6116,39 +6146,39 @@ async function lr(e, t) {
|
|
|
6116
6146
|
signal: AbortSignal.timeout(1e4),
|
|
6117
6147
|
})
|
|
6118
6148
|
).json();
|
|
6119
|
-
|
|
6149
|
+
Ve(r.result?.tools);
|
|
6120
6150
|
} catch {}
|
|
6121
6151
|
}
|
|
6122
6152
|
}
|
|
6123
|
-
function
|
|
6153
|
+
function ur(e) {
|
|
6124
6154
|
return e
|
|
6125
6155
|
? e.type === 'string'
|
|
6126
6156
|
? e.format === 'uri'
|
|
6127
6157
|
: e.type === 'array' && e.items?.format === 'uri'
|
|
6128
6158
|
: !1;
|
|
6129
6159
|
}
|
|
6130
|
-
async function
|
|
6160
|
+
async function At(e, t, i) {
|
|
6131
6161
|
if (typeof e != 'string') return e;
|
|
6132
|
-
let
|
|
6133
|
-
if (!
|
|
6134
|
-
if (!
|
|
6135
|
-
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;
|
|
6136
6166
|
}
|
|
6137
|
-
async function
|
|
6138
|
-
(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)));
|
|
6139
6169
|
let s = Q.get(e)?.properties;
|
|
6140
6170
|
if (!s) return t;
|
|
6141
6171
|
let o = { ...t };
|
|
6142
6172
|
for (let [u, p] of Object.entries(t))
|
|
6143
|
-
if (
|
|
6173
|
+
if (ur(s[u]))
|
|
6144
6174
|
if (Array.isArray(p)) {
|
|
6145
6175
|
let l = [];
|
|
6146
|
-
for (let d of p) l.push(await
|
|
6176
|
+
for (let d of p) l.push(await At(d, i, r));
|
|
6147
6177
|
o[u] = l;
|
|
6148
|
-
} else o[u] = await
|
|
6178
|
+
} else o[u] = await At(p, i, r);
|
|
6149
6179
|
return o;
|
|
6150
6180
|
}
|
|
6151
|
-
function
|
|
6181
|
+
function mr(e) {
|
|
6152
6182
|
let t = e.id ?? null;
|
|
6153
6183
|
switch (e.method) {
|
|
6154
6184
|
case 'initialize':
|
|
@@ -6189,13 +6219,13 @@ function dr(e) {
|
|
|
6189
6219
|
};
|
|
6190
6220
|
}
|
|
6191
6221
|
}
|
|
6192
|
-
async function
|
|
6193
|
-
if (
|
|
6194
|
-
|
|
6195
|
-
let e =
|
|
6222
|
+
async function jt() {
|
|
6223
|
+
if (Rt) return;
|
|
6224
|
+
Rt = !0;
|
|
6225
|
+
let e = or(),
|
|
6196
6226
|
t = I(),
|
|
6197
6227
|
i = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
|
|
6198
|
-
(
|
|
6228
|
+
(Ot.default
|
|
6199
6229
|
.createInterface({ input: process.stdin, output: process.stdout, terminal: !1 })
|
|
6200
6230
|
.on('line', async (n) => {
|
|
6201
6231
|
let s = n.trim();
|
|
@@ -6256,8 +6286,8 @@ async function Vt() {
|
|
|
6256
6286
|
try {
|
|
6257
6287
|
let c = O.default.resolve(d.trim());
|
|
6258
6288
|
if (A.default.existsSync(c) && A.default.statSync(c).isFile() && e) {
|
|
6259
|
-
if (!
|
|
6260
|
-
let m = await
|
|
6289
|
+
if (!Nt(c)) throw Vt(c);
|
|
6290
|
+
let m = await Lt(c, e, t),
|
|
6261
6291
|
f = (m.sizeBytes / 1024).toFixed(1),
|
|
6262
6292
|
ue =
|
|
6263
6293
|
m.mimeType.startsWith('image/') ||
|
|
@@ -6313,7 +6343,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
6313
6343
|
}
|
|
6314
6344
|
if (e)
|
|
6315
6345
|
try {
|
|
6316
|
-
o.params.arguments = await
|
|
6346
|
+
o.params.arguments = await Ut(String(p), l, e, t, i);
|
|
6317
6347
|
} catch (d) {
|
|
6318
6348
|
let c = d instanceof Error ? d.message : String(d);
|
|
6319
6349
|
process.stdout.write(
|
|
@@ -6344,10 +6374,10 @@ Pass this URL to any Tein generation tool.`,
|
|
|
6344
6374
|
body: JSON.stringify(o),
|
|
6345
6375
|
}),
|
|
6346
6376
|
l = await p.text(),
|
|
6347
|
-
d =
|
|
6377
|
+
d = Dt(o, p.status, l);
|
|
6348
6378
|
if (d === null) return;
|
|
6349
6379
|
if (d) {
|
|
6350
|
-
(o?.method === 'tools/list' &&
|
|
6380
|
+
(o?.method === 'tools/list' && Ve(d.result?.tools),
|
|
6351
6381
|
process.stdout.write(
|
|
6352
6382
|
JSON.stringify(d) +
|
|
6353
6383
|
`
|
|
@@ -6356,7 +6386,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
6356
6386
|
return;
|
|
6357
6387
|
}
|
|
6358
6388
|
} catch {}
|
|
6359
|
-
let u =
|
|
6389
|
+
let u = mr(o);
|
|
6360
6390
|
u !== null &&
|
|
6361
6391
|
process.stdout.write(
|
|
6362
6392
|
JSON.stringify(u) +
|
|
@@ -6381,20 +6411,20 @@ Pass this URL to any Tein generation tool.`,
|
|
|
6381
6411
|
}
|
|
6382
6412
|
var A,
|
|
6383
6413
|
O,
|
|
6384
|
-
|
|
6385
|
-
|
|
6414
|
+
Ot,
|
|
6415
|
+
lr,
|
|
6386
6416
|
Q,
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6417
|
+
Ne,
|
|
6418
|
+
Rt,
|
|
6419
|
+
Ft = y(() => {
|
|
6390
6420
|
'use strict';
|
|
6391
6421
|
((A = x(require('node:fs'))),
|
|
6392
6422
|
(O = x(require('node:path'))),
|
|
6393
|
-
(
|
|
6423
|
+
(Ot = x(require('node:readline'))));
|
|
6394
6424
|
qe();
|
|
6395
|
-
|
|
6425
|
+
Et();
|
|
6396
6426
|
q();
|
|
6397
|
-
|
|
6427
|
+
lr = new Set([
|
|
6398
6428
|
'.png',
|
|
6399
6429
|
'.jpg',
|
|
6400
6430
|
'.jpeg',
|
|
@@ -6420,40 +6450,40 @@ var A,
|
|
|
6420
6450
|
'.flac',
|
|
6421
6451
|
'.opus',
|
|
6422
6452
|
]);
|
|
6423
|
-
((Q = new Map()), (
|
|
6424
|
-
|
|
6453
|
+
((Q = new Map()), (Ne = 0));
|
|
6454
|
+
Rt = !1;
|
|
6425
6455
|
require.main === module &&
|
|
6426
|
-
|
|
6456
|
+
jt().catch((e) => {
|
|
6427
6457
|
(process.stderr.write(`Fatal error in Tein MCP CLI: ${e}
|
|
6428
6458
|
`),
|
|
6429
6459
|
process.exit(1));
|
|
6430
6460
|
});
|
|
6431
6461
|
});
|
|
6432
|
-
var
|
|
6462
|
+
var Zt =
|
|
6433
6463
|
!process.env.NO_COLOR &&
|
|
6434
6464
|
(process.stdout.isTTY || process.env.FORCE_COLOR === '1' || process.env.TERM !== 'dumb');
|
|
6435
|
-
function
|
|
6436
|
-
return (i) => (
|
|
6465
|
+
function b(e, t) {
|
|
6466
|
+
return (i) => (Zt ? `\x1B[${e}m${i}\x1B[${t}m` : String(i));
|
|
6437
6467
|
}
|
|
6438
|
-
var
|
|
6439
|
-
bold:
|
|
6440
|
-
dim:
|
|
6441
|
-
italic:
|
|
6442
|
-
underline:
|
|
6443
|
-
inverse:
|
|
6444
|
-
black:
|
|
6445
|
-
red:
|
|
6446
|
-
green:
|
|
6447
|
-
yellow:
|
|
6448
|
-
blue:
|
|
6449
|
-
magenta:
|
|
6450
|
-
cyan:
|
|
6451
|
-
white:
|
|
6452
|
-
gray:
|
|
6453
|
-
bgBlue:
|
|
6454
|
-
bgMagenta:
|
|
6455
|
-
bgCyan:
|
|
6456
|
-
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),
|
|
6457
6487
|
},
|
|
6458
6488
|
P = class {
|
|
6459
6489
|
constructor(t = '') {
|
|
@@ -6479,7 +6509,7 @@ var r = {
|
|
|
6479
6509
|
process.stdout.isTTY
|
|
6480
6510
|
? (this.stop(),
|
|
6481
6511
|
(this.timer = setInterval(() => {
|
|
6482
|
-
let i =
|
|
6512
|
+
let i = a.cyan(this.frames[this.current]);
|
|
6483
6513
|
(process.stdout.write(`\r${i} ${this.text} `),
|
|
6484
6514
|
(this.current = (this.current + 1) % this.frames.length));
|
|
6485
6515
|
}, 80)),
|
|
@@ -6496,7 +6526,7 @@ var r = {
|
|
|
6496
6526
|
this.stop();
|
|
6497
6527
|
let i = t || this.text;
|
|
6498
6528
|
process.stdout.isTTY
|
|
6499
|
-
? process.stdout.write(`\r${
|
|
6529
|
+
? process.stdout.write(`\r${a.green('\u2713')} ${i}
|
|
6500
6530
|
`)
|
|
6501
6531
|
: process.stdout.write(`[\u2713] ${i}
|
|
6502
6532
|
`);
|
|
@@ -6505,7 +6535,7 @@ var r = {
|
|
|
6505
6535
|
this.stop();
|
|
6506
6536
|
let i = t || this.text;
|
|
6507
6537
|
process.stdout.isTTY
|
|
6508
|
-
? process.stdout.write(`\r${
|
|
6538
|
+
? process.stdout.write(`\r${a.red('\u2717')} ${i}
|
|
6509
6539
|
`)
|
|
6510
6540
|
: process.stdout.write(`[\u2717] ${i}
|
|
6511
6541
|
`);
|
|
@@ -6518,44 +6548,44 @@ var r = {
|
|
|
6518
6548
|
}
|
|
6519
6549
|
};
|
|
6520
6550
|
var R = x(require('node:fs')),
|
|
6521
|
-
|
|
6551
|
+
$ = x(require('node:path'));
|
|
6522
6552
|
var ee = x(require('node:fs')),
|
|
6523
6553
|
Be = x(require('node:path')),
|
|
6524
6554
|
Fe = require('node:stream/promises');
|
|
6525
|
-
var Z = '1.1.
|
|
6526
|
-
var
|
|
6555
|
+
var Z = '1.1.7';
|
|
6556
|
+
var ei = new Set([
|
|
6527
6557
|
'account_suspended',
|
|
6528
6558
|
'account_terminated',
|
|
6529
6559
|
'creative_mode_restricted',
|
|
6530
6560
|
'unfiltered_restricted',
|
|
6531
6561
|
'workspace_paused',
|
|
6532
6562
|
]),
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
constructor(t, i,
|
|
6563
|
+
_ = 1,
|
|
6564
|
+
ti = 3,
|
|
6565
|
+
w = class extends Error {
|
|
6566
|
+
constructor(t, i, r, n = {}) {
|
|
6537
6567
|
(super(i),
|
|
6538
6568
|
(this.name = 'TeinApiError'),
|
|
6539
6569
|
(this.status = t),
|
|
6540
|
-
|
|
6570
|
+
r && (this.code = r),
|
|
6541
6571
|
(this.fields = n));
|
|
6542
6572
|
}
|
|
6543
6573
|
get exitCode() {
|
|
6544
|
-
return this.code &&
|
|
6574
|
+
return this.code && ei.has(this.code) ? ti : _;
|
|
6545
6575
|
}
|
|
6546
6576
|
};
|
|
6547
|
-
function
|
|
6548
|
-
let
|
|
6549
|
-
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);
|
|
6550
6580
|
let n = i;
|
|
6551
6581
|
if (n.error && typeof n.error == 'object' && !Array.isArray(n.error)) {
|
|
6552
6582
|
let d = n.error,
|
|
6553
6583
|
{ code: c, message: m, ...f } = d;
|
|
6554
|
-
return new
|
|
6584
|
+
return new w(e, typeof m == 'string' && m ? m : r, typeof c == 'string' ? c : void 0, f);
|
|
6555
6585
|
}
|
|
6556
6586
|
let { error: s, code: o, message: u, ...p } = n,
|
|
6557
|
-
l = (typeof s == 'string' && s) || (typeof u == 'string' && u) ||
|
|
6558
|
-
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);
|
|
6559
6589
|
}
|
|
6560
6590
|
function Ue(e) {
|
|
6561
6591
|
return typeof e == 'number' && Number.isFinite(e) ? `$${e.toFixed(4)}` : null;
|
|
@@ -6563,15 +6593,15 @@ function Ue(e) {
|
|
|
6563
6593
|
function M(e) {
|
|
6564
6594
|
let t = [e.message],
|
|
6565
6595
|
i = Ue(e.fields.required),
|
|
6566
|
-
|
|
6567
|
-
(i ||
|
|
6568
|
-
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(' '));
|
|
6569
6599
|
let n = e.fields.org_name ?? e.fields.orgName;
|
|
6570
6600
|
typeof n == 'string' && n && t.push(`Workspace: ${n}`);
|
|
6571
6601
|
let s = e.fields.url ?? e.fields.appeal_url ?? e.fields.top_up_url;
|
|
6572
6602
|
return (typeof s == 'string' && s && t.push(s), e.code && t.push(`(${e.code})`), t);
|
|
6573
6603
|
}
|
|
6574
|
-
function
|
|
6604
|
+
function ri(e) {
|
|
6575
6605
|
return /\.(mp4|webm|mov)(\?|$)/i.test(e)
|
|
6576
6606
|
? 'video'
|
|
6577
6607
|
: /\.(mp3|wav|ogg|flac)(\?|$)/i.test(e)
|
|
@@ -6583,7 +6613,7 @@ function je(e) {
|
|
|
6583
6613
|
for (let i of e.data ?? [])
|
|
6584
6614
|
typeof i.message?.content == 'string'
|
|
6585
6615
|
? t.push({ type: 'text', text: i.message.content })
|
|
6586
|
-
: i.url && t.push({ type:
|
|
6616
|
+
: i.url && t.push({ type: ri(i.url), url: i.url });
|
|
6587
6617
|
return t;
|
|
6588
6618
|
}
|
|
6589
6619
|
var T = class {
|
|
@@ -6598,18 +6628,18 @@ var T = class {
|
|
|
6598
6628
|
'X-Tein-Client': 'cli',
|
|
6599
6629
|
};
|
|
6600
6630
|
}
|
|
6601
|
-
async send(t, i,
|
|
6631
|
+
async send(t, i, r) {
|
|
6602
6632
|
let n = await fetch(`${this.baseUrl}${i}`, {
|
|
6603
6633
|
method: t,
|
|
6604
6634
|
headers: this.getHeaders(),
|
|
6605
|
-
...(
|
|
6635
|
+
...(r === void 0 ? {} : { body: JSON.stringify(r) }),
|
|
6606
6636
|
});
|
|
6607
6637
|
if (!n.ok) {
|
|
6608
6638
|
let s = null;
|
|
6609
6639
|
try {
|
|
6610
6640
|
s = await n.json();
|
|
6611
6641
|
} catch {}
|
|
6612
|
-
throw
|
|
6642
|
+
throw ii(n.status, n.statusText, s);
|
|
6613
6643
|
}
|
|
6614
6644
|
return await n.json();
|
|
6615
6645
|
}
|
|
@@ -6620,29 +6650,29 @@ var T = class {
|
|
|
6620
6650
|
return this.send('POST', '/v1/run', { model: t, parameters: i });
|
|
6621
6651
|
}
|
|
6622
6652
|
queueJob(t, i) {
|
|
6623
|
-
return this.send('POST', '/v1/generate', { model: t, ...i }).then((
|
|
6624
|
-
let n =
|
|
6653
|
+
return this.send('POST', '/v1/generate', { model: t, ...i }).then((r) => {
|
|
6654
|
+
let n = r.status,
|
|
6625
6655
|
s =
|
|
6626
6656
|
n === 'succeeded' || n === 'failed' || n === 'expired' || n === 'cancelled'
|
|
6627
6657
|
? n
|
|
6628
6658
|
: 'processing',
|
|
6629
|
-
o = je(
|
|
6659
|
+
o = je(r);
|
|
6630
6660
|
return {
|
|
6631
|
-
request_id:
|
|
6632
|
-
model:
|
|
6661
|
+
request_id: r.request_id || r.id || '',
|
|
6662
|
+
model: r.model,
|
|
6633
6663
|
status: s,
|
|
6634
6664
|
...(o.length ? { output: o } : {}),
|
|
6635
|
-
error:
|
|
6636
|
-
...(
|
|
6665
|
+
error: r.error && typeof r.error.message == 'string' ? r.error.message : null,
|
|
6666
|
+
...(r.usage ? { usage: r.usage } : {}),
|
|
6637
6667
|
};
|
|
6638
6668
|
});
|
|
6639
6669
|
}
|
|
6640
6670
|
getStatus(t) {
|
|
6641
6671
|
return this.send('GET', `/v1/jobs/${encodeURIComponent(t)}`).then((i) => {
|
|
6642
|
-
let
|
|
6672
|
+
let r = i.status,
|
|
6643
6673
|
n =
|
|
6644
|
-
|
|
6645
|
-
?
|
|
6674
|
+
r === 'succeeded' || r === 'failed' || r === 'expired' || r === 'cancelled'
|
|
6675
|
+
? r
|
|
6646
6676
|
: 'processing',
|
|
6647
6677
|
s = je(i),
|
|
6648
6678
|
o = i.error && typeof i.error.message == 'string' ? i.error.message : null;
|
|
@@ -6660,57 +6690,57 @@ var T = class {
|
|
|
6660
6690
|
return this.send('POST', '/v1/upload', { data: t, filename: i });
|
|
6661
6691
|
}
|
|
6662
6692
|
async downloadOutput(t, i) {
|
|
6663
|
-
let
|
|
6664
|
-
if (!
|
|
6693
|
+
let r = await fetch(t);
|
|
6694
|
+
if (!r.ok) throw new Error(`The file could not be downloaded (HTTP ${r.status})`);
|
|
6665
6695
|
let n = Be.default.dirname(i);
|
|
6666
6696
|
ee.default.existsSync(n) || ee.default.mkdirSync(n, { recursive: !0 });
|
|
6667
6697
|
let s = ee.default.createWriteStream(i);
|
|
6668
|
-
return (await (0, Fe.pipeline)(
|
|
6698
|
+
return (await (0, Fe.pipeline)(r.body, s), i);
|
|
6669
6699
|
}
|
|
6670
6700
|
};
|
|
6671
6701
|
q();
|
|
6672
6702
|
W();
|
|
6673
|
-
var
|
|
6674
|
-
function
|
|
6675
|
-
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]]);
|
|
6676
6706
|
}
|
|
6677
|
-
function
|
|
6707
|
+
function Ei(e) {
|
|
6678
6708
|
if (e.startsWith('http://') || e.startsWith('https://')) return null;
|
|
6679
|
-
let t =
|
|
6709
|
+
let t = $.default.resolve(e);
|
|
6680
6710
|
return R.default.existsSync(t) && R.default.statSync(t).isFile() ? t : null;
|
|
6681
6711
|
}
|
|
6682
|
-
async function
|
|
6683
|
-
for (let i of
|
|
6712
|
+
async function Ai(e, t) {
|
|
6713
|
+
for (let i of kt) {
|
|
6684
6714
|
if (!Array.isArray(e[i])) continue;
|
|
6685
|
-
let
|
|
6715
|
+
let r = [];
|
|
6686
6716
|
for (let n of e[i]) {
|
|
6687
6717
|
if (typeof n != 'string') continue;
|
|
6688
|
-
let s =
|
|
6689
|
-
|
|
6718
|
+
let s = Ei(n);
|
|
6719
|
+
r.push(s ? await t(s) : n);
|
|
6690
6720
|
}
|
|
6691
|
-
e[i] =
|
|
6721
|
+
e[i] = r;
|
|
6692
6722
|
}
|
|
6693
6723
|
}
|
|
6694
6724
|
var z = { starter: 10, plus: 25, scale: 40, enterprise: 300 };
|
|
6695
|
-
function
|
|
6725
|
+
function Ri(e) {
|
|
6696
6726
|
if (e.count === void 0 || e.count === !0) return 1;
|
|
6697
6727
|
let t = typeof e.count == 'number' ? e.count : Number(e.count),
|
|
6698
6728
|
i = z.enterprise;
|
|
6699
6729
|
return (
|
|
6700
6730
|
(!Number.isInteger(t) || t < 1 || t > i) &&
|
|
6701
6731
|
(process.stderr
|
|
6702
|
-
.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.
|
|
6703
6733
|
`),
|
|
6704
6734
|
process.exit(1)),
|
|
6705
6735
|
t
|
|
6706
6736
|
);
|
|
6707
6737
|
}
|
|
6708
|
-
async function
|
|
6738
|
+
async function Oi(e, t, i, r, n) {
|
|
6709
6739
|
n.isJson ||
|
|
6710
|
-
process.stderr.write(`Starting ${
|
|
6740
|
+
process.stderr.write(`Starting ${r} ${t} jobs together...
|
|
6711
6741
|
`);
|
|
6712
6742
|
let s = await Promise.all(
|
|
6713
|
-
Array.from({ length:
|
|
6743
|
+
Array.from({ length: r }, async () => {
|
|
6714
6744
|
try {
|
|
6715
6745
|
return { job: await e.queueJob(t, i) };
|
|
6716
6746
|
} catch (p) {
|
|
@@ -6725,9 +6755,9 @@ async function Ei(e, t, i, a, n) {
|
|
|
6725
6755
|
? o.push(p.job)
|
|
6726
6756
|
: 'err' in p &&
|
|
6727
6757
|
u.push(
|
|
6728
|
-
p.err instanceof
|
|
6758
|
+
p.err instanceof w
|
|
6729
6759
|
? p.err
|
|
6730
|
-
: new
|
|
6760
|
+
: new w(0, p.err instanceof Error ? p.err.message : String(p.err)),
|
|
6731
6761
|
);
|
|
6732
6762
|
if (!n.isAsync) {
|
|
6733
6763
|
let p = Date.now(),
|
|
@@ -6735,7 +6765,7 @@ async function Ei(e, t, i, a, n) {
|
|
|
6735
6765
|
for (; l.length;) {
|
|
6736
6766
|
if ((await new Promise((c) => setTimeout(c, 2e3)), !n.isJson)) {
|
|
6737
6767
|
let c = Math.round((Date.now() - p) / 1e3);
|
|
6738
|
-
process.stderr.write(`Waiting on ${l.length} of ${
|
|
6768
|
+
process.stderr.write(`Waiting on ${l.length} of ${r} (${c}s)...
|
|
6739
6769
|
`);
|
|
6740
6770
|
}
|
|
6741
6771
|
let d = await Promise.all(
|
|
@@ -6778,12 +6808,12 @@ async function Ei(e, t, i, a, n) {
|
|
|
6778
6808
|
}
|
|
6779
6809
|
(u.length ||
|
|
6780
6810
|
o.some((p) => p.status === 'failed' || p.status === 'expired' || p.status === 'cancelled')) &&
|
|
6781
|
-
process.exit(
|
|
6811
|
+
process.exit(_);
|
|
6782
6812
|
}
|
|
6783
|
-
function
|
|
6813
|
+
function It(e) {
|
|
6784
6814
|
let t = {},
|
|
6785
6815
|
i = new Set(),
|
|
6786
|
-
|
|
6816
|
+
r = [];
|
|
6787
6817
|
for (let n = 0; n < e.length; n++) {
|
|
6788
6818
|
let s = e[n];
|
|
6789
6819
|
if (s.startsWith('--')) {
|
|
@@ -6821,33 +6851,33 @@ function bt(e) {
|
|
|
6821
6851
|
: n + 1 < e.length && !e[n + 1].startsWith('-')
|
|
6822
6852
|
? ((t[p] = e[n + 1]), n++)
|
|
6823
6853
|
: (t[p] = !0);
|
|
6824
|
-
} else
|
|
6854
|
+
} else r.push(s);
|
|
6825
6855
|
}
|
|
6826
|
-
return { command:
|
|
6856
|
+
return { command: r[0] || '', subcommand: r[1], modelSlug: r[1] || r[0], options: t, flags: i };
|
|
6827
6857
|
}
|
|
6828
6858
|
async function Ce(e, t) {
|
|
6829
6859
|
let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
6830
|
-
|
|
6860
|
+
r = I(typeof t.api_url == 'string' ? t.api_url : void 0);
|
|
6831
6861
|
(i ||
|
|
6832
|
-
(process.stderr.write(`${
|
|
6862
|
+
(process.stderr.write(`${a.red('Error:')} Authentication required.
|
|
6833
6863
|
`),
|
|
6834
6864
|
process.stderr
|
|
6835
|
-
.write(`Please run ${
|
|
6865
|
+
.write(`Please run ${a.cyan('tein auth login')} or set ${a.cyan('TEIN_API_KEY')} environment variable.
|
|
6836
6866
|
`),
|
|
6837
6867
|
process.exit(1)),
|
|
6838
6868
|
e ||
|
|
6839
|
-
(process.stderr.write(`${
|
|
6869
|
+
(process.stderr.write(`${a.red('Error:')} Missing model slug.
|
|
6840
6870
|
`),
|
|
6841
|
-
process.stderr.write(`Usage: ${
|
|
6871
|
+
process.stderr.write(`Usage: ${a.cyan('tein run <model-slug> --prompt "..."')}
|
|
6842
6872
|
`),
|
|
6843
|
-
process.stderr.write(`Run ${
|
|
6873
|
+
process.stderr.write(`Run ${a.cyan('tein models')} to list all available models.
|
|
6844
6874
|
`),
|
|
6845
6875
|
process.exit(1)));
|
|
6846
|
-
let n =
|
|
6876
|
+
let n = V(e),
|
|
6847
6877
|
s = !!t.json,
|
|
6848
6878
|
o = !!(t.async || t.no_wait),
|
|
6849
6879
|
u = typeof t.output == 'string' ? t.output : void 0,
|
|
6850
|
-
p =
|
|
6880
|
+
p = Ri(t),
|
|
6851
6881
|
l = { ...t };
|
|
6852
6882
|
if (
|
|
6853
6883
|
(delete l.json,
|
|
@@ -6862,27 +6892,27 @@ async function Ce(e, t) {
|
|
|
6862
6892
|
for (let h of n.parameters)
|
|
6863
6893
|
h.default !== void 0 &&
|
|
6864
6894
|
l[h.name] === void 0 &&
|
|
6865
|
-
|
|
6895
|
+
wt(n.slug, h.name, t) &&
|
|
6866
6896
|
(l[h.name] = h.default);
|
|
6867
|
-
(
|
|
6897
|
+
(qi(l),
|
|
6868
6898
|
typeof l.image == 'string' && !l.images && ((l.images = [l.image]), delete l.image),
|
|
6869
6899
|
l.image_url &&
|
|
6870
6900
|
!l.first_frame_image &&
|
|
6871
6901
|
(e.startsWith('seedance') || e.startsWith('happy-horse')) &&
|
|
6872
6902
|
(l.first_frame_image = l.image_url));
|
|
6873
|
-
let d = new T(i,
|
|
6903
|
+
let d = new T(i, r),
|
|
6874
6904
|
c = ['image', 'first_frame_image', 'last_frame_image', 'lipsyncing_audio', 'audio', 'video'];
|
|
6875
6905
|
for (let h of c) {
|
|
6876
6906
|
let g = l[h];
|
|
6877
6907
|
if (typeof g == 'string' && !g.startsWith('http://') && !g.startsWith('https://')) {
|
|
6878
|
-
let k =
|
|
6908
|
+
let k = $.default.resolve(g);
|
|
6879
6909
|
if (R.default.existsSync(k) && R.default.statSync(k).isFile()) {
|
|
6880
|
-
let
|
|
6881
|
-
s ||
|
|
6910
|
+
let v = new P(`Uploading local file ${$.default.basename(k)} to CDN...`);
|
|
6911
|
+
s || v.start();
|
|
6882
6912
|
try {
|
|
6883
6913
|
let j = R.default.readFileSync(k),
|
|
6884
|
-
X = await d.uploadAsset(j.toString('base64'),
|
|
6885
|
-
((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`));
|
|
6886
6916
|
} catch (j) {
|
|
6887
6917
|
let X = j instanceof Error ? j.message : String(j);
|
|
6888
6918
|
(s
|
|
@@ -6891,42 +6921,42 @@ async function Ce(e, t) {
|
|
|
6891
6921
|
`
|
|
6892
6922
|
`,
|
|
6893
6923
|
)
|
|
6894
|
-
:
|
|
6924
|
+
: v.fail(`Upload failed: ${X}`),
|
|
6895
6925
|
process.exit(1));
|
|
6896
6926
|
}
|
|
6897
6927
|
}
|
|
6898
6928
|
}
|
|
6899
6929
|
}
|
|
6900
|
-
await
|
|
6901
|
-
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...`);
|
|
6902
6932
|
s || g.start();
|
|
6903
6933
|
try {
|
|
6904
6934
|
let k = R.default.readFileSync(h),
|
|
6905
|
-
|
|
6906
|
-
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);
|
|
6907
6937
|
} catch (k) {
|
|
6908
|
-
let
|
|
6938
|
+
let v = k instanceof Error ? k.message : String(k);
|
|
6909
6939
|
(s
|
|
6910
6940
|
? process.stdout.write(
|
|
6911
|
-
JSON.stringify({ error:
|
|
6941
|
+
JSON.stringify({ error: v }) +
|
|
6912
6942
|
`
|
|
6913
6943
|
`,
|
|
6914
6944
|
)
|
|
6915
|
-
: g.fail(`Upload failed: ${
|
|
6945
|
+
: g.fail(`Upload failed: ${v}`),
|
|
6916
6946
|
process.exit(1));
|
|
6917
6947
|
}
|
|
6918
6948
|
});
|
|
6919
|
-
let m = new P(`Submitting task for ${
|
|
6949
|
+
let m = new P(`Submitting task for ${a.bold(e)}...`);
|
|
6920
6950
|
s || m.start();
|
|
6921
6951
|
let f;
|
|
6922
6952
|
try {
|
|
6923
6953
|
if (p > 1) {
|
|
6924
|
-
await
|
|
6954
|
+
await Oi(d, e, l, p, { isJson: s, isAsync: o });
|
|
6925
6955
|
return;
|
|
6926
6956
|
}
|
|
6927
6957
|
f = await d.queueJob(e, l);
|
|
6928
6958
|
} catch (h) {
|
|
6929
|
-
let g = h instanceof
|
|
6959
|
+
let g = h instanceof w ? h : null;
|
|
6930
6960
|
(s
|
|
6931
6961
|
? process.stdout.write(
|
|
6932
6962
|
JSON.stringify(
|
|
@@ -6945,7 +6975,7 @@ async function Ce(e, t) {
|
|
|
6945
6975
|
`)
|
|
6946
6976
|
: `Failed to start generation: ${h instanceof Error ? h.message : h}`,
|
|
6947
6977
|
),
|
|
6948
|
-
process.exit(g ? g.exitCode :
|
|
6978
|
+
process.exit(g ? g.exitCode : _));
|
|
6949
6979
|
}
|
|
6950
6980
|
if (o) {
|
|
6951
6981
|
s
|
|
@@ -6954,8 +6984,8 @@ async function Ce(e, t) {
|
|
|
6954
6984
|
`
|
|
6955
6985
|
`,
|
|
6956
6986
|
)
|
|
6957
|
-
: (m.succeed(`Queued successfully! Request ID: ${
|
|
6958
|
-
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}`)}
|
|
6959
6989
|
`));
|
|
6960
6990
|
return;
|
|
6961
6991
|
}
|
|
@@ -6963,13 +6993,13 @@ async function Ce(e, t) {
|
|
|
6963
6993
|
ue = 1500;
|
|
6964
6994
|
for (; f.status === 'processing';) {
|
|
6965
6995
|
let h = Math.round((Date.now() - U) / 1e3);
|
|
6966
|
-
(s || m.update(`Rendering ${
|
|
6996
|
+
(s || m.update(`Rendering ${a.bold(e)} (${h}s elapsed)... [ID: ${f.request_id}]`),
|
|
6967
6997
|
await new Promise((g) => setTimeout(g, ue)));
|
|
6968
6998
|
try {
|
|
6969
6999
|
f = await d.getStatus(f.request_id);
|
|
6970
7000
|
} catch (g) {
|
|
6971
|
-
g instanceof
|
|
6972
|
-
g.exitCode !==
|
|
7001
|
+
g instanceof w &&
|
|
7002
|
+
g.exitCode !== _ &&
|
|
6973
7003
|
(s ||
|
|
6974
7004
|
m.fail(
|
|
6975
7005
|
M(g).join(`
|
|
@@ -6987,8 +7017,8 @@ async function Ce(e, t) {
|
|
|
6987
7017
|
`,
|
|
6988
7018
|
)
|
|
6989
7019
|
: m.fail(`Generation ${f.status}: ${f.error || 'Something failed on our side.'}`),
|
|
6990
|
-
process.exit(
|
|
6991
|
-
s || m.succeed(`Generation completed for ${
|
|
7020
|
+
process.exit(_)),
|
|
7021
|
+
s || m.succeed(`Generation completed for ${a.bold(n?.name || e)}!`),
|
|
6992
7022
|
s)
|
|
6993
7023
|
) {
|
|
6994
7024
|
process.stdout.write(
|
|
@@ -7001,32 +7031,32 @@ async function Ce(e, t) {
|
|
|
7001
7031
|
if (
|
|
7002
7032
|
(process.stdout.write(`
|
|
7003
7033
|
`),
|
|
7004
|
-
process.stdout.write(` ${
|
|
7034
|
+
process.stdout.write(` ${a.bold('Status:')} ${a.green('Succeeded')}
|
|
7005
7035
|
`),
|
|
7006
|
-
process.stdout.write(` ${
|
|
7036
|
+
process.stdout.write(` ${a.bold('Request ID:')} ${f.request_id}
|
|
7007
7037
|
`),
|
|
7008
7038
|
f.usage?.cost !== void 0 &&
|
|
7009
|
-
process.stdout.write(` ${
|
|
7039
|
+
process.stdout.write(` ${a.bold('Cost:')} $${f.usage.cost.toFixed(4)}
|
|
7010
7040
|
`),
|
|
7011
7041
|
f.output && f.output.length > 0)
|
|
7012
7042
|
) {
|
|
7013
7043
|
process.stdout.write(`
|
|
7014
|
-
${
|
|
7044
|
+
${a.bold('Outputs:')}
|
|
7015
7045
|
`);
|
|
7016
7046
|
for (let h = 0; h < f.output.length; h++) {
|
|
7017
7047
|
let g = f.output[h];
|
|
7018
7048
|
if (g.url) {
|
|
7019
7049
|
if (
|
|
7020
|
-
(process.stdout.write(` [${g.type.toUpperCase()}] ${
|
|
7050
|
+
(process.stdout.write(` [${g.type.toUpperCase()}] ${a.cyan(a.underline(g.url))}
|
|
7021
7051
|
`),
|
|
7022
7052
|
u)
|
|
7023
7053
|
) {
|
|
7024
7054
|
let k = new P(`Downloading output to ${u}...`).start();
|
|
7025
7055
|
try {
|
|
7026
|
-
(await d.downloadOutput(g.url,
|
|
7027
|
-
k.succeed(`Saved to ${
|
|
7028
|
-
} catch (
|
|
7029
|
-
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}`);
|
|
7030
7060
|
}
|
|
7031
7061
|
}
|
|
7032
7062
|
} else
|
|
@@ -7039,24 +7069,24 @@ ${g.text}
|
|
|
7039
7069
|
process.stdout.write(`
|
|
7040
7070
|
`);
|
|
7041
7071
|
}
|
|
7042
|
-
var
|
|
7072
|
+
var xt = x(require('node:readline'));
|
|
7043
7073
|
q();
|
|
7044
|
-
async function
|
|
7074
|
+
async function Di(e) {
|
|
7045
7075
|
try {
|
|
7046
7076
|
return (await new T(e, I()).checkKey(), 'ok');
|
|
7047
7077
|
} catch (t) {
|
|
7048
|
-
if (t instanceof
|
|
7078
|
+
if (t instanceof w) {
|
|
7049
7079
|
if (t.status === 401) return 'invalid';
|
|
7050
7080
|
if (t.status === 403) return 'blocked';
|
|
7051
7081
|
}
|
|
7052
7082
|
return 'unchecked';
|
|
7053
7083
|
}
|
|
7054
7084
|
}
|
|
7055
|
-
function
|
|
7056
|
-
let t =
|
|
7085
|
+
function Li(e) {
|
|
7086
|
+
let t = xt.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
7057
7087
|
return new Promise((i) => {
|
|
7058
|
-
t.question(e, (
|
|
7059
|
-
(t.close(), i(
|
|
7088
|
+
t.question(e, (r) => {
|
|
7089
|
+
(t.close(), i(r.trim()));
|
|
7060
7090
|
});
|
|
7061
7091
|
});
|
|
7062
7092
|
}
|
|
@@ -7067,38 +7097,38 @@ async function Y(e, t) {
|
|
|
7067
7097
|
let i = t?.trim() || '';
|
|
7068
7098
|
(i ||
|
|
7069
7099
|
(process.stdout.write(`
|
|
7070
|
-
${
|
|
7100
|
+
${a.bold('Tein AI Authentication')}
|
|
7071
7101
|
`),
|
|
7072
|
-
process.stdout.write(`Get your API key at: ${
|
|
7102
|
+
process.stdout.write(`Get your API key at: ${a.cyan('https://tein.ai/dashboard/keys')}
|
|
7073
7103
|
|
|
7074
7104
|
`),
|
|
7075
|
-
(i = await
|
|
7105
|
+
(i = await Li('Enter your Tein API Key (sk_live_...): '))),
|
|
7076
7106
|
!i.startsWith('sk_live_') &&
|
|
7077
7107
|
!i.startsWith('sk_test_') &&
|
|
7078
7108
|
(process.stderr
|
|
7079
|
-
.write(`${
|
|
7109
|
+
.write(`${a.red('Error:')} Invalid key format. Tein API keys start with 'sk_live_' or 'sk_test_'.
|
|
7080
7110
|
`),
|
|
7081
7111
|
process.exit(1)));
|
|
7082
|
-
let
|
|
7083
|
-
(
|
|
7112
|
+
let r = await Di(i);
|
|
7113
|
+
(r === 'invalid' &&
|
|
7084
7114
|
(process.stderr
|
|
7085
|
-
.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.
|
|
7086
7116
|
`),
|
|
7087
7117
|
process.exit(1)),
|
|
7088
7118
|
ge({ apiKey: i }),
|
|
7089
7119
|
process.stdout.write(`
|
|
7090
|
-
${
|
|
7120
|
+
${a.green('\u2713')} API key saved to ${a.dim(ie())}
|
|
7091
7121
|
`),
|
|
7092
|
-
|
|
7122
|
+
r === 'blocked'
|
|
7093
7123
|
? process.stdout
|
|
7094
|
-
.write(`${
|
|
7124
|
+
.write(`${a.yellow('\u2139')} The key is valid, but this account cannot run requests right now. Check your dashboard.
|
|
7095
7125
|
`)
|
|
7096
|
-
:
|
|
7126
|
+
: r === 'unchecked' &&
|
|
7097
7127
|
process.stdout
|
|
7098
|
-
.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.
|
|
7099
7129
|
`),
|
|
7100
7130
|
process.stdout
|
|
7101
|
-
.write(`You can now run models directly using: ${
|
|
7131
|
+
.write(`You can now run models directly using: ${a.cyan('tein run <model-slug> --prompt "..."')}
|
|
7102
7132
|
|
|
7103
7133
|
`));
|
|
7104
7134
|
break;
|
|
@@ -7106,41 +7136,41 @@ ${r.green('\u2713')} API key saved to ${r.dim(ie())}
|
|
|
7106
7136
|
case 'logout': {
|
|
7107
7137
|
if (!L().apiKey) {
|
|
7108
7138
|
process.stdout
|
|
7109
|
-
.write(`${
|
|
7139
|
+
.write(`${a.yellow('\u2139')} No active API key found. You are already logged out.
|
|
7110
7140
|
`);
|
|
7111
7141
|
break;
|
|
7112
7142
|
}
|
|
7113
7143
|
(ge({ apiKey: '' }),
|
|
7114
7144
|
process.stdout
|
|
7115
|
-
.write(`${
|
|
7145
|
+
.write(`${a.green('\u2713')} Logged out successfully. Stored API key has been cleared from ${a.dim(ie())}
|
|
7116
7146
|
`));
|
|
7117
7147
|
break;
|
|
7118
7148
|
}
|
|
7119
7149
|
default: {
|
|
7120
7150
|
let i = S(),
|
|
7121
|
-
|
|
7151
|
+
r = I(),
|
|
7122
7152
|
n = L();
|
|
7123
7153
|
if (
|
|
7124
7154
|
(process.stdout.write(`
|
|
7125
|
-
${
|
|
7155
|
+
${a.bold('Tein AI CLI Configuration')}
|
|
7126
7156
|
`),
|
|
7127
|
-
process.stdout.write(` Config file: ${
|
|
7157
|
+
process.stdout.write(` Config file: ${a.dim(ie())}
|
|
7128
7158
|
`),
|
|
7129
|
-
process.stdout.write(` API URL: ${
|
|
7159
|
+
process.stdout.write(` API URL: ${a.cyan(r)}
|
|
7130
7160
|
`),
|
|
7131
7161
|
!i)
|
|
7132
7162
|
)
|
|
7133
|
-
(process.stdout.write(` API Key: ${
|
|
7163
|
+
(process.stdout.write(` API Key: ${a.red('Not configured')}
|
|
7134
7164
|
|
|
7135
7165
|
`),
|
|
7136
7166
|
process.stdout
|
|
7137
|
-
.write(`Run ${
|
|
7167
|
+
.write(`Run ${a.cyan('tein auth login')} or set ${a.cyan('TEIN_API_KEY')} environment variable.
|
|
7138
7168
|
|
|
7139
7169
|
`));
|
|
7140
7170
|
else {
|
|
7141
7171
|
let s = `${i.slice(0, 10)}...${i.slice(-4)}`;
|
|
7142
7172
|
process.stdout
|
|
7143
|
-
.write(` API Key: ${
|
|
7173
|
+
.write(` API Key: ${a.green(s)} (${i.startsWith('sk_live_') ? 'Live Key' : 'Test Key'})
|
|
7144
7174
|
|
|
7145
7175
|
`);
|
|
7146
7176
|
}
|
|
@@ -7151,55 +7181,55 @@ ${r.bold('Tein AI CLI Configuration')}
|
|
|
7151
7181
|
q();
|
|
7152
7182
|
he();
|
|
7153
7183
|
W();
|
|
7154
|
-
var
|
|
7155
|
-
async function
|
|
7184
|
+
var Ni = 3e3;
|
|
7185
|
+
async function _t(e) {
|
|
7156
7186
|
try {
|
|
7157
|
-
let t = await fetch(`${I(e)}/v1/pricing`, { signal: AbortSignal.timeout(
|
|
7187
|
+
let t = await fetch(`${I(e)}/v1/pricing`, { signal: AbortSignal.timeout(Ni) });
|
|
7158
7188
|
if (!t.ok) return;
|
|
7159
7189
|
let i = await t.json(),
|
|
7160
|
-
|
|
7190
|
+
r = {};
|
|
7161
7191
|
for (let n of i.configs ?? []) {
|
|
7162
7192
|
let s = String(n.modelSlug ?? '');
|
|
7163
|
-
B.has(s) && (
|
|
7193
|
+
B.has(s) && (r[s] ??= []).push(Number(n.starterPrice));
|
|
7164
7194
|
}
|
|
7165
|
-
|
|
7195
|
+
ct(r);
|
|
7166
7196
|
} catch {}
|
|
7167
7197
|
}
|
|
7168
|
-
var
|
|
7169
|
-
|
|
7170
|
-
async function
|
|
7171
|
-
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);
|
|
7172
7202
|
let i = E();
|
|
7173
7203
|
if (e) {
|
|
7174
7204
|
let s = e.toLowerCase(),
|
|
7175
|
-
o =
|
|
7176
|
-
i =
|
|
7205
|
+
o = Ui[s] ?? s;
|
|
7206
|
+
i = Vi.has(o)
|
|
7177
7207
|
? i.filter((u) => u.category.toLowerCase() === o)
|
|
7178
7208
|
: i.filter((u) => u.kind.toLowerCase().includes(s) || u.slug.toLowerCase().includes(s));
|
|
7179
7209
|
}
|
|
7180
7210
|
(process.stdout.write(`
|
|
7181
|
-
${
|
|
7211
|
+
${a.bold('Tein AI Models Catalog')} (${i.length} available)
|
|
7182
7212
|
`),
|
|
7183
7213
|
process.stdout
|
|
7184
|
-
.write(`${
|
|
7214
|
+
.write(`${a.dim('Run `tein info <model-slug>` to see detailed parameters and options.')}
|
|
7185
7215
|
|
|
7186
7216
|
`));
|
|
7187
|
-
let
|
|
7217
|
+
let r = {};
|
|
7188
7218
|
for (let s of i) {
|
|
7189
7219
|
let o = s.category;
|
|
7190
|
-
(
|
|
7220
|
+
(r[o] || (r[o] = []), r[o].push(s));
|
|
7191
7221
|
}
|
|
7192
7222
|
let n = ['Video', 'Image', 'Text', 'Audio', '3D'];
|
|
7193
7223
|
for (let s of n) {
|
|
7194
|
-
let o =
|
|
7224
|
+
let o = r[s];
|
|
7195
7225
|
if (!(!o || o.length === 0)) {
|
|
7196
|
-
process.stdout.write(`${
|
|
7226
|
+
process.stdout.write(`${a.bold(a.cyan(`\u2500\u2500 ${s} Models \u2500\u2500`))}
|
|
7197
7227
|
`);
|
|
7198
7228
|
for (let u of o) {
|
|
7199
7229
|
let p = u.slug.padEnd(24),
|
|
7200
7230
|
l = u.name.padEnd(22),
|
|
7201
7231
|
d = u.priceFormatted.padEnd(22);
|
|
7202
|
-
process.stdout.write(` ${
|
|
7232
|
+
process.stdout.write(` ${a.bold(p)} ${a.gray(l)} ${a.green(d)} ${a.dim(u.vendor)}
|
|
7203
7233
|
`);
|
|
7204
7234
|
}
|
|
7205
7235
|
process.stdout.write(`
|
|
@@ -7207,90 +7237,94 @@ ${r.bold('Tein AI Models Catalog')} (${i.length} available)
|
|
|
7207
7237
|
}
|
|
7208
7238
|
}
|
|
7209
7239
|
process.stdout
|
|
7210
|
-
.write(`${
|
|
7240
|
+
.write(`${a.dim('Tip:')} Generate directly with ${a.cyan('tein run <model-slug> --prompt "..."')}
|
|
7211
7241
|
|
|
7212
7242
|
`);
|
|
7213
7243
|
}
|
|
7214
|
-
async function
|
|
7215
|
-
B.has(e) && (await
|
|
7216
|
-
let i =
|
|
7244
|
+
async function Pt(e, t) {
|
|
7245
|
+
B.has(e) && (await _t(t));
|
|
7246
|
+
let i = V(e);
|
|
7217
7247
|
(i ||
|
|
7218
|
-
(process.stderr.write(`${
|
|
7248
|
+
(process.stderr.write(`${a.red('Error:')} Model "${e}" not found in Tein AI registry.
|
|
7219
7249
|
`),
|
|
7220
|
-
process.stderr.write(`Run ${
|
|
7250
|
+
process.stderr.write(`Run ${a.cyan('tein models')} to see all available model slugs.
|
|
7221
7251
|
`),
|
|
7222
7252
|
process.exit(1)),
|
|
7223
7253
|
process.stdout.write(`
|
|
7224
|
-
${
|
|
7254
|
+
${a.bold(a.cyan(i.name))} (${a.bold(i.slug)})
|
|
7225
7255
|
`),
|
|
7226
|
-
process.stdout.write(` ${
|
|
7256
|
+
process.stdout.write(` ${a.gray(i.description)}
|
|
7227
7257
|
|
|
7228
7258
|
`),
|
|
7229
|
-
process.stdout.write(`${
|
|
7259
|
+
process.stdout.write(`${a.bold('Metadata:')}
|
|
7230
7260
|
`),
|
|
7231
|
-
process.stdout.write(` Category: ${
|
|
7261
|
+
process.stdout.write(` Category: ${a.yellow(i.category)}
|
|
7232
7262
|
`),
|
|
7233
7263
|
process.stdout.write(` Kind: ${i.kind}
|
|
7234
7264
|
`),
|
|
7235
7265
|
process.stdout.write(` Vendor: ${i.vendor}
|
|
7236
7266
|
`),
|
|
7237
|
-
process.stdout.write(` Pricing: ${
|
|
7267
|
+
process.stdout.write(` Pricing: ${a.green(i.priceFormatted)}
|
|
7238
7268
|
|
|
7239
7269
|
`),
|
|
7240
|
-
process.stdout.write(`${
|
|
7270
|
+
process.stdout.write(`${a.bold('Parameters:')}
|
|
7241
7271
|
`));
|
|
7242
|
-
for (let
|
|
7243
|
-
let n =
|
|
7244
|
-
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}]`) : '';
|
|
7245
7275
|
(process.stdout
|
|
7246
|
-
.write(` ${
|
|
7276
|
+
.write(` ${a.bold(`--${r.name.replace(/_/g, '-')}`)} ${a.yellow(`<${r.type}>`)} ${n}${s}
|
|
7247
7277
|
`),
|
|
7248
|
-
|
|
7249
|
-
process.stdout.write(` ${
|
|
7278
|
+
r.description &&
|
|
7279
|
+
process.stdout.write(` ${a.gray(r.description)}
|
|
7250
7280
|
`),
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
process.stdout.write(` Allowed values: ${
|
|
7281
|
+
r.options &&
|
|
7282
|
+
r.options.length > 0 &&
|
|
7283
|
+
process.stdout.write(` Allowed values: ${a.dim(r.options.join(', '))}
|
|
7254
7284
|
`),
|
|
7255
|
-
(
|
|
7256
|
-
process.stdout.write(` Range: ${
|
|
7285
|
+
(r.min !== void 0 || r.max !== void 0) &&
|
|
7286
|
+
process.stdout.write(` Range: ${r.min ?? ''} to ${r.max ?? ''}
|
|
7257
7287
|
`),
|
|
7258
7288
|
process.stdout.write(`
|
|
7259
7289
|
`));
|
|
7260
7290
|
}
|
|
7261
|
-
(
|
|
7262
|
-
(
|
|
7263
|
-
|
|
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)')}
|
|
7264
7295
|
`),
|
|
7265
|
-
|
|
7266
|
-
|
|
7296
|
+
process.stdout
|
|
7297
|
+
.write(` ${a.gray('HTTPS URL. Tein POSTs the finished job here when it succeeds, fails, expires, or is cancelled.')}
|
|
7267
7298
|
|
|
7268
7299
|
`)),
|
|
7269
|
-
process.stdout.write(`${
|
|
7300
|
+
process.stdout.write(`${a.bold('Sample CLI Usage:')}
|
|
7270
7301
|
`),
|
|
7271
|
-
i.category === 'Video'
|
|
7272
|
-
|
|
7273
|
-
|
|
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`)}
|
|
7274
7306
|
|
|
7275
|
-
`)
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
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`)}
|
|
7279
7312
|
|
|
7280
|
-
`)
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
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`)}
|
|
7284
7318
|
|
|
7285
7319
|
`)
|
|
7286
|
-
|
|
7287
|
-
|
|
7320
|
+
: process.stdout
|
|
7321
|
+
.write(` ${a.cyan(`tein run ${i.slug} --prompt "Explain quantum computing in simple terms"`)}
|
|
7288
7322
|
|
|
7289
|
-
`)
|
|
7323
|
+
`);
|
|
7290
7324
|
}
|
|
7291
7325
|
q();
|
|
7292
7326
|
qe();
|
|
7293
|
-
var
|
|
7327
|
+
var ji = 1e4,
|
|
7294
7328
|
Ae = {
|
|
7295
7329
|
price: '',
|
|
7296
7330
|
creativeMode: 'Creative mode',
|
|
@@ -7301,41 +7335,41 @@ var Vi = 1e4,
|
|
|
7301
7335
|
priorityDraft: 'Priority + Draft',
|
|
7302
7336
|
creativeModePriorityDraft: 'Creative mode + Priority + Draft',
|
|
7303
7337
|
},
|
|
7304
|
-
|
|
7305
|
-
|
|
7338
|
+
Bi = Object.keys(Ae),
|
|
7339
|
+
Fi = {
|
|
7306
7340
|
creativeMode: 'unfiltered',
|
|
7307
7341
|
creativeModePriority: 'unfilteredPriority',
|
|
7308
7342
|
creativeModeDraft: 'unfilteredDraft',
|
|
7309
7343
|
creativeModePriorityDraft: 'unfilteredPriorityDraft',
|
|
7310
7344
|
};
|
|
7311
|
-
function
|
|
7312
|
-
let i =
|
|
7345
|
+
function Gi(e, t) {
|
|
7346
|
+
let i = Fi[t];
|
|
7313
7347
|
return e[t] ?? (i ? e[i] : void 0);
|
|
7314
7348
|
}
|
|
7315
|
-
async function
|
|
7349
|
+
async function Ji(e, t) {
|
|
7316
7350
|
let i = `${I(e)}${ce(t)}`,
|
|
7317
|
-
|
|
7351
|
+
r;
|
|
7318
7352
|
try {
|
|
7319
|
-
|
|
7353
|
+
r = await fetch(i, { signal: AbortSignal.timeout(ji) });
|
|
7320
7354
|
} catch {
|
|
7321
7355
|
throw new Error(`Could not reach ${i}`);
|
|
7322
7356
|
}
|
|
7323
|
-
let n = await
|
|
7324
|
-
if (!
|
|
7357
|
+
let n = await r.json().catch(() => null);
|
|
7358
|
+
if (!r.ok || !n || n.object !== 'list' || !n.board) {
|
|
7325
7359
|
let s =
|
|
7326
7360
|
n && typeof n.error == 'string'
|
|
7327
7361
|
? n.error
|
|
7328
7362
|
: n && typeof n.error == 'object' && n.error?.message
|
|
7329
7363
|
? n.error.message
|
|
7330
|
-
: `Pricing request failed (${
|
|
7364
|
+
: `Pricing request failed (${r.status})`;
|
|
7331
7365
|
throw new Error(s);
|
|
7332
7366
|
}
|
|
7333
7367
|
return n;
|
|
7334
7368
|
}
|
|
7335
7369
|
function Ee(e) {
|
|
7336
7370
|
let t = e.toFixed(4).replace(/0+$/, '').replace(/\.$/, ''),
|
|
7337
|
-
[i,
|
|
7338
|
-
return `$${i}.${
|
|
7371
|
+
[i, r = ''] = t.split('.');
|
|
7372
|
+
return `$${i}.${r.padEnd(2, '0')}`;
|
|
7339
7373
|
}
|
|
7340
7374
|
function Re(e) {
|
|
7341
7375
|
if (!e || typeof e.starter != 'number') return null;
|
|
@@ -7343,36 +7377,36 @@ function Re(e) {
|
|
|
7343
7377
|
i = typeof e.scale == 'number' ? e.scale : t;
|
|
7344
7378
|
return `Starter ${Ee(e.starter)} Plus ${Ee(t)} Scale ${Ee(i)}`;
|
|
7345
7379
|
}
|
|
7346
|
-
function
|
|
7380
|
+
function Hi(e) {
|
|
7347
7381
|
if (typeof e.label == 'string' && e.label.trim()) return e.label.trim();
|
|
7348
7382
|
let t = [];
|
|
7349
7383
|
for (let i of ['endpoint', 'resolution', 'quality', 'mode', 'task', 'component', 'token']) {
|
|
7350
|
-
let
|
|
7351
|
-
|
|
7384
|
+
let r = e[i];
|
|
7385
|
+
r != null && r !== '' && t.push(String(r));
|
|
7352
7386
|
}
|
|
7353
7387
|
return (
|
|
7354
7388
|
e.withVideo === !0 && t.push('with video'),
|
|
7355
7389
|
t.length ? t.join(' \xB7 ') : String(e.id ?? 'default')
|
|
7356
7390
|
);
|
|
7357
7391
|
}
|
|
7358
|
-
function
|
|
7359
|
-
let i =
|
|
7360
|
-
for (let
|
|
7361
|
-
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));
|
|
7362
7396
|
if (!n) continue;
|
|
7363
|
-
let s = Ae[
|
|
7397
|
+
let s = Ae[r] ? ` (${Ae[r]})` : '';
|
|
7364
7398
|
t.push(` ${i}${s} ${n}`);
|
|
7365
7399
|
}
|
|
7366
7400
|
}
|
|
7367
|
-
function
|
|
7401
|
+
function zi(e, t) {
|
|
7368
7402
|
let i = e.quality ? ` quality=${e.quality}` : '';
|
|
7369
7403
|
t.push(
|
|
7370
|
-
` ${
|
|
7404
|
+
` ${a.bold(e.slug.padEnd(26))} ${a.gray(e.name)} ${a.dim(`${e.kind} ${e.unit} model=${e.model}${i}`)}`,
|
|
7371
7405
|
);
|
|
7372
|
-
for (let n of e.variants ?? [])
|
|
7373
|
-
let
|
|
7374
|
-
if (Array.isArray(
|
|
7375
|
-
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) {
|
|
7376
7410
|
if (!n || typeof n != 'object') continue;
|
|
7377
7411
|
let s = n,
|
|
7378
7412
|
o = typeof s.label == 'string' ? s.label : String(s.id ?? 'add-on'),
|
|
@@ -7381,34 +7415,34 @@ function Ji(e, t) {
|
|
|
7381
7415
|
}
|
|
7382
7416
|
t.push('');
|
|
7383
7417
|
}
|
|
7384
|
-
function
|
|
7418
|
+
function Yi(e) {
|
|
7385
7419
|
let t = [],
|
|
7386
7420
|
i = e.board.checked ? ` \xB7 checked ${e.board.checked}` : '';
|
|
7387
|
-
(t.push(`${
|
|
7421
|
+
(t.push(`${a.bold('Tein prices')} ${a.green(e.currency)} ${e.count} models${i}`),
|
|
7388
7422
|
t.push(
|
|
7389
|
-
`${
|
|
7423
|
+
`${a.dim('Starter, Plus and Scale. Creative mode, Priority and draft show only where published.')}`,
|
|
7390
7424
|
),
|
|
7391
7425
|
t.push(''));
|
|
7392
|
-
let
|
|
7426
|
+
let r = new Map();
|
|
7393
7427
|
for (let p of e.board.models) {
|
|
7394
7428
|
let l = p.kind || 'other',
|
|
7395
|
-
d =
|
|
7396
|
-
(d.push(p),
|
|
7429
|
+
d = r.get(l) ?? [];
|
|
7430
|
+
(d.push(p), r.set(l, d));
|
|
7397
7431
|
}
|
|
7398
7432
|
let n = ['video', 'image', 'audio', 'llm', 'text', '3d'],
|
|
7399
|
-
s = [...
|
|
7433
|
+
s = [...r.keys()].sort((p, l) => {
|
|
7400
7434
|
let d = n.indexOf(p),
|
|
7401
7435
|
c = n.indexOf(l);
|
|
7402
7436
|
return (d === -1 ? 99 : d) - (c === -1 ? 99 : c);
|
|
7403
7437
|
});
|
|
7404
7438
|
for (let p of s) {
|
|
7405
|
-
t.push(`${
|
|
7406
|
-
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);
|
|
7407
7441
|
}
|
|
7408
7442
|
let o = new Set(e.board.models.map((p) => p.slug.toLowerCase())),
|
|
7409
7443
|
u = (e.configs ?? []).filter((p) => !o.has(String(p.modelSlug ?? '').toLowerCase()));
|
|
7410
7444
|
if (u.length) {
|
|
7411
|
-
t.push(`${
|
|
7445
|
+
t.push(`${a.bold(a.cyan('\u2500\u2500 other prices \u2500\u2500'))}`);
|
|
7412
7446
|
let p = new Map();
|
|
7413
7447
|
for (let l of u) {
|
|
7414
7448
|
let d = String(l.modelSlug ?? ''),
|
|
@@ -7417,7 +7451,7 @@ function Hi(e) {
|
|
|
7417
7451
|
}
|
|
7418
7452
|
for (let [l, d] of p) {
|
|
7419
7453
|
let c = String(d[0]?.modelName ?? l);
|
|
7420
|
-
t.push(` ${
|
|
7454
|
+
t.push(` ${a.bold(l.padEnd(26))} ${a.gray(c)}`);
|
|
7421
7455
|
for (let m of d) {
|
|
7422
7456
|
let f = String(m.displayLabel ?? m.billingUnit ?? 'price'),
|
|
7423
7457
|
U = Re(m.prices);
|
|
@@ -7427,19 +7461,19 @@ function Hi(e) {
|
|
|
7427
7461
|
}
|
|
7428
7462
|
}
|
|
7429
7463
|
return (
|
|
7430
|
-
t.push(`${
|
|
7464
|
+
t.push(`${a.dim('JSON:')} ${a.cyan('tein pricing --json')}`),
|
|
7431
7465
|
`${t.join(`
|
|
7432
7466
|
`)}
|
|
7433
7467
|
`
|
|
7434
7468
|
);
|
|
7435
7469
|
}
|
|
7436
|
-
async function
|
|
7470
|
+
async function Tt(e) {
|
|
7437
7471
|
let t;
|
|
7438
7472
|
try {
|
|
7439
|
-
t = await
|
|
7473
|
+
t = await Ji(e.apiUrl, e.model);
|
|
7440
7474
|
} catch (i) {
|
|
7441
|
-
let
|
|
7442
|
-
(process.stderr.write(`${
|
|
7475
|
+
let r = i instanceof Error ? i.message : String(i);
|
|
7476
|
+
(process.stderr.write(`${a.red('Error:')} ${r}
|
|
7443
7477
|
`),
|
|
7444
7478
|
process.exit(1));
|
|
7445
7479
|
}
|
|
@@ -7447,38 +7481,38 @@ async function vt(e) {
|
|
|
7447
7481
|
e.json
|
|
7448
7482
|
? `${JSON.stringify(t, null, 2)}
|
|
7449
7483
|
`
|
|
7450
|
-
:
|
|
7484
|
+
: Yi(t),
|
|
7451
7485
|
);
|
|
7452
7486
|
}
|
|
7453
|
-
var
|
|
7487
|
+
var Mt = x(require('node:path'));
|
|
7454
7488
|
q();
|
|
7455
|
-
async function
|
|
7489
|
+
async function St(e, t) {
|
|
7456
7490
|
let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
7457
|
-
|
|
7491
|
+
r = I(typeof t.api_url == 'string' ? t.api_url : void 0);
|
|
7458
7492
|
(i ||
|
|
7459
|
-
(process.stderr.write(`${
|
|
7493
|
+
(process.stderr.write(`${a.red('Error:')} Authentication required.
|
|
7460
7494
|
`),
|
|
7461
7495
|
process.stderr
|
|
7462
|
-
.write(`Please run ${
|
|
7496
|
+
.write(`Please run ${a.cyan('tein auth login')} or set ${a.cyan('TEIN_API_KEY')} environment variable.
|
|
7463
7497
|
`),
|
|
7464
7498
|
process.exit(1)),
|
|
7465
7499
|
e ||
|
|
7466
|
-
(process.stderr.write(`${
|
|
7500
|
+
(process.stderr.write(`${a.red('Error:')} Missing request ID.
|
|
7467
7501
|
`),
|
|
7468
|
-
process.stderr.write(`Usage: ${
|
|
7502
|
+
process.stderr.write(`Usage: ${a.cyan('tein status <request-id> [--wait] [-o output.mp4]')}
|
|
7469
7503
|
`),
|
|
7470
7504
|
process.exit(1)));
|
|
7471
7505
|
let n = !!t.json,
|
|
7472
7506
|
s = !!t.wait,
|
|
7473
7507
|
o = typeof t.output == 'string' ? t.output : void 0,
|
|
7474
|
-
u = new T(i,
|
|
7475
|
-
p = new P(`Checking status of ${
|
|
7508
|
+
u = new T(i, r),
|
|
7509
|
+
p = new P(`Checking status of ${a.bold(e)}...`);
|
|
7476
7510
|
n || p.start();
|
|
7477
7511
|
let l;
|
|
7478
7512
|
try {
|
|
7479
7513
|
l = await u.getStatus(e);
|
|
7480
7514
|
} catch (d) {
|
|
7481
|
-
(d instanceof
|
|
7515
|
+
(d instanceof w &&
|
|
7482
7516
|
(n
|
|
7483
7517
|
? process.stdout.write(
|
|
7484
7518
|
JSON.stringify(
|
|
@@ -7495,13 +7529,13 @@ async function Pt(e, t) {
|
|
|
7495
7529
|
),
|
|
7496
7530
|
process.exit(d.exitCode)),
|
|
7497
7531
|
n || p.fail(d instanceof Error ? d.message : String(d)),
|
|
7498
|
-
process.exit(
|
|
7532
|
+
process.exit(_));
|
|
7499
7533
|
}
|
|
7500
7534
|
if (s && l.status === 'processing') {
|
|
7501
7535
|
let d = Date.now();
|
|
7502
7536
|
for (; l.status === 'processing';) {
|
|
7503
7537
|
let c = Math.round((Date.now() - d) / 1e3);
|
|
7504
|
-
(n || p.update(`Waiting for ${
|
|
7538
|
+
(n || p.update(`Waiting for ${a.bold(l.model)} (${c}s elapsed)...`),
|
|
7505
7539
|
await new Promise((m) => setTimeout(m, 1500)));
|
|
7506
7540
|
try {
|
|
7507
7541
|
l = await u.getStatus(e);
|
|
@@ -7526,29 +7560,29 @@ async function Pt(e, t) {
|
|
|
7526
7560
|
}
|
|
7527
7561
|
if (
|
|
7528
7562
|
(process.stdout.write(`
|
|
7529
|
-
${
|
|
7563
|
+
${a.bold('Model:')} ${l.model}
|
|
7530
7564
|
`),
|
|
7531
7565
|
process.stdout
|
|
7532
|
-
.write(` ${
|
|
7566
|
+
.write(` ${a.bold('Status:')} ${l.status === 'succeeded' ? a.green(l.status) : l.status === 'processing' ? a.yellow(l.status) : a.red(l.status)}
|
|
7533
7567
|
`),
|
|
7534
|
-
process.stdout.write(` ${
|
|
7568
|
+
process.stdout.write(` ${a.bold('Request ID:')} ${l.request_id}
|
|
7535
7569
|
`),
|
|
7536
7570
|
l.output && l.output.length > 0)
|
|
7537
7571
|
) {
|
|
7538
7572
|
process.stdout.write(`
|
|
7539
|
-
${
|
|
7573
|
+
${a.bold('Outputs:')}
|
|
7540
7574
|
`);
|
|
7541
7575
|
for (let d of l.output)
|
|
7542
7576
|
if (d.url) {
|
|
7543
7577
|
if (
|
|
7544
|
-
(process.stdout.write(` [${d.type.toUpperCase()}] ${
|
|
7578
|
+
(process.stdout.write(` [${d.type.toUpperCase()}] ${a.cyan(a.underline(d.url))}
|
|
7545
7579
|
`),
|
|
7546
7580
|
o)
|
|
7547
7581
|
) {
|
|
7548
7582
|
let c = new P(`Downloading output to ${o}...`).start();
|
|
7549
7583
|
try {
|
|
7550
|
-
(await u.downloadOutput(d.url,
|
|
7551
|
-
c.succeed(`Saved to ${
|
|
7584
|
+
(await u.downloadOutput(d.url, Mt.default.resolve(process.cwd(), o)),
|
|
7585
|
+
c.succeed(`Saved to ${a.bold(o)}`));
|
|
7552
7586
|
} catch (m) {
|
|
7553
7587
|
c.fail(`Failed to download: ${m instanceof Error ? m.message : m}`);
|
|
7554
7588
|
}
|
|
@@ -7565,32 +7599,32 @@ ${d.text}
|
|
|
7565
7599
|
var Oe = x(require('node:fs')),
|
|
7566
7600
|
De = x(require('node:path'));
|
|
7567
7601
|
q();
|
|
7568
|
-
async function
|
|
7602
|
+
async function $t(e, t = {}) {
|
|
7569
7603
|
let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
7570
|
-
|
|
7604
|
+
r = I(typeof t.api_url == 'string' ? t.api_url : void 0),
|
|
7571
7605
|
n = !!t.json;
|
|
7572
7606
|
(i ||
|
|
7573
|
-
(process.stderr.write(`${
|
|
7607
|
+
(process.stderr.write(`${a.red('Error:')} Authentication required.
|
|
7574
7608
|
`),
|
|
7575
7609
|
process.stderr
|
|
7576
|
-
.write(`Please run ${
|
|
7610
|
+
.write(`Please run ${a.cyan('tein auth login')} or set ${a.cyan('TEIN_API_KEY')} environment variable.
|
|
7577
7611
|
`),
|
|
7578
7612
|
process.exit(1)),
|
|
7579
7613
|
e ||
|
|
7580
|
-
(process.stderr.write(`${
|
|
7614
|
+
(process.stderr.write(`${a.red('Error:')} Missing file path.
|
|
7581
7615
|
`),
|
|
7582
|
-
process.stderr.write(`Usage: ${
|
|
7616
|
+
process.stderr.write(`Usage: ${a.cyan('tein upload <image.png|video.mp4>')}
|
|
7583
7617
|
`),
|
|
7584
7618
|
process.exit(1)));
|
|
7585
7619
|
let s = De.default.resolve(e);
|
|
7586
7620
|
Oe.default.existsSync(s) ||
|
|
7587
|
-
(process.stderr.write(`${
|
|
7621
|
+
(process.stderr.write(`${a.red('Error:')} File not found: ${s}
|
|
7588
7622
|
`),
|
|
7589
7623
|
process.exit(1));
|
|
7590
7624
|
let o = De.default.basename(s),
|
|
7591
7625
|
p = Oe.default.readFileSync(s).toString('base64'),
|
|
7592
|
-
l = new T(i,
|
|
7593
|
-
d = new P(`Uploading ${
|
|
7626
|
+
l = new T(i, r),
|
|
7627
|
+
d = new P(`Uploading ${a.bold(o)} to Tein AI CDN...`);
|
|
7594
7628
|
n || d.start();
|
|
7595
7629
|
try {
|
|
7596
7630
|
let c = await l.uploadAsset(p, o);
|
|
@@ -7602,17 +7636,17 @@ async function Tt(e, t = {}) {
|
|
|
7602
7636
|
)
|
|
7603
7637
|
: (d.succeed('Upload successful!'),
|
|
7604
7638
|
process.stdout.write(`
|
|
7605
|
-
${
|
|
7639
|
+
${a.bold('CDN URL:')} ${a.green(c.url)}
|
|
7606
7640
|
`),
|
|
7607
|
-
process.stdout.write(`${
|
|
7641
|
+
process.stdout.write(`${a.dim(`Key: ${c.key}`)}
|
|
7608
7642
|
|
|
7609
7643
|
`),
|
|
7610
7644
|
process.stdout.write(`Use this CDN URL directly in your CLI runs:
|
|
7611
|
-
${
|
|
7645
|
+
${a.cyan(`tein run seedance-2-5 --prompt "Animate this scene" --image "${c.url}"`)}
|
|
7612
7646
|
|
|
7613
7647
|
`));
|
|
7614
7648
|
} catch (c) {
|
|
7615
|
-
let m = c instanceof
|
|
7649
|
+
let m = c instanceof w ? c : null,
|
|
7616
7650
|
f = m
|
|
7617
7651
|
? M(m).join(`
|
|
7618
7652
|
`)
|
|
@@ -7626,73 +7660,73 @@ ${r.bold('CDN URL:')} ${r.green(c.url)}
|
|
|
7626
7660
|
`,
|
|
7627
7661
|
)
|
|
7628
7662
|
: d.fail(`Upload failed: ${f}`),
|
|
7629
|
-
process.exit(m ? m.exitCode :
|
|
7663
|
+
process.exit(m ? m.exitCode : _));
|
|
7630
7664
|
}
|
|
7631
7665
|
}
|
|
7632
7666
|
W();
|
|
7633
|
-
|
|
7634
|
-
function
|
|
7667
|
+
ve();
|
|
7668
|
+
function Gt() {
|
|
7635
7669
|
process.stdout.write(`
|
|
7636
|
-
${
|
|
7670
|
+
${a.bold(a.cyan('Tein AI CLI'))} - Official Command-Line Interface for Tein AI models
|
|
7637
7671
|
|
|
7638
|
-
${
|
|
7639
|
-
${
|
|
7672
|
+
${a.bold('USAGE:')}
|
|
7673
|
+
${a.cyan('tein')} <command> [arguments] [options]
|
|
7640
7674
|
|
|
7641
|
-
${
|
|
7642
|
-
${
|
|
7643
|
-
${
|
|
7644
|
-
${
|
|
7645
|
-
${
|
|
7646
|
-
${
|
|
7647
|
-
${
|
|
7648
|
-
${
|
|
7649
|
-
${
|
|
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
|
|
7650
7684
|
|
|
7651
|
-
${
|
|
7652
|
-
${
|
|
7653
|
-
${
|
|
7654
|
-
${
|
|
7655
|
-
${
|
|
7656
|
-
${
|
|
7657
|
-
${
|
|
7658
|
-
${
|
|
7659
|
-
${
|
|
7660
|
-
${
|
|
7661
|
-
${
|
|
7662
|
-
${
|
|
7663
|
-
${
|
|
7664
|
-
${
|
|
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
|
|
7665
7699
|
|
|
7666
|
-
${
|
|
7667
|
-
${
|
|
7668
|
-
${
|
|
7700
|
+
${a.bold('EXAMPLES:')}
|
|
7701
|
+
${a.dim('# 1. Authenticate with your Tein API key')}
|
|
7702
|
+
${a.cyan('tein auth login')}
|
|
7669
7703
|
|
|
7670
|
-
${
|
|
7671
|
-
${
|
|
7704
|
+
${a.dim('# 2. List all Video models')}
|
|
7705
|
+
${a.cyan('tein models video')}
|
|
7672
7706
|
|
|
7673
|
-
${
|
|
7674
|
-
${
|
|
7675
|
-
${
|
|
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')}
|
|
7676
7710
|
|
|
7677
|
-
${
|
|
7678
|
-
${
|
|
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')}
|
|
7679
7713
|
|
|
7680
|
-
${
|
|
7681
|
-
${
|
|
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')}
|
|
7682
7716
|
|
|
7683
|
-
${
|
|
7684
|
-
${
|
|
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')}
|
|
7685
7719
|
|
|
7686
|
-
${
|
|
7687
|
-
${
|
|
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"')}
|
|
7688
7722
|
|
|
7689
7723
|
`);
|
|
7690
7724
|
}
|
|
7691
|
-
async function
|
|
7725
|
+
async function fr() {
|
|
7692
7726
|
let e = process.argv.slice(2),
|
|
7693
|
-
t =
|
|
7727
|
+
t = It(e);
|
|
7694
7728
|
if (t.flags.has('help') || t.options.help || t.command === 'help') {
|
|
7695
|
-
|
|
7729
|
+
Gt();
|
|
7696
7730
|
return;
|
|
7697
7731
|
}
|
|
7698
7732
|
if (t.flags.has('version') || t.options.version || t.command === 'version') {
|
|
@@ -7719,15 +7753,15 @@ async function cr() {
|
|
|
7719
7753
|
}
|
|
7720
7754
|
case 'models':
|
|
7721
7755
|
case 'list': {
|
|
7722
|
-
await
|
|
7756
|
+
await vt(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0);
|
|
7723
7757
|
break;
|
|
7724
7758
|
}
|
|
7725
7759
|
case 'pricing':
|
|
7726
7760
|
case 'prices': {
|
|
7727
7761
|
let i = t.options.model,
|
|
7728
|
-
|
|
7729
|
-
await
|
|
7730
|
-
model:
|
|
7762
|
+
r = t.subcommand || (typeof i == 'string' ? i : void 0);
|
|
7763
|
+
await Tt({
|
|
7764
|
+
model: r,
|
|
7731
7765
|
json: !!t.options.json,
|
|
7732
7766
|
apiUrl: typeof t.options.api_url == 'string' ? t.options.api_url : void 0,
|
|
7733
7767
|
});
|
|
@@ -7736,17 +7770,17 @@ async function cr() {
|
|
|
7736
7770
|
case 'info':
|
|
7737
7771
|
case 'show': {
|
|
7738
7772
|
(t.subcommand ||
|
|
7739
|
-
(process.stderr.write(`${
|
|
7773
|
+
(process.stderr.write(`${a.red('Error:')} Missing model slug.
|
|
7740
7774
|
`),
|
|
7741
|
-
process.stderr.write(`Usage: ${
|
|
7775
|
+
process.stderr.write(`Usage: ${a.cyan('tein info <model-slug>')}
|
|
7742
7776
|
`),
|
|
7743
7777
|
process.exit(1)),
|
|
7744
|
-
await
|
|
7778
|
+
await Pt(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0));
|
|
7745
7779
|
break;
|
|
7746
7780
|
}
|
|
7747
7781
|
case 'upload': {
|
|
7748
7782
|
let i = t.subcommand || '';
|
|
7749
|
-
await
|
|
7783
|
+
await $t(i, t.options);
|
|
7750
7784
|
break;
|
|
7751
7785
|
}
|
|
7752
7786
|
case 'run':
|
|
@@ -7757,40 +7791,40 @@ async function cr() {
|
|
|
7757
7791
|
}
|
|
7758
7792
|
case 'status': {
|
|
7759
7793
|
let i = t.subcommand || '';
|
|
7760
|
-
await
|
|
7794
|
+
await St(i, t.options);
|
|
7761
7795
|
break;
|
|
7762
7796
|
}
|
|
7763
7797
|
case 'mcp': {
|
|
7764
|
-
let { startStdioServer: i } = await Promise.resolve().then(() => (
|
|
7798
|
+
let { startStdioServer: i } = await Promise.resolve().then(() => (Ft(), Bt));
|
|
7765
7799
|
await i();
|
|
7766
7800
|
break;
|
|
7767
7801
|
}
|
|
7768
7802
|
default: {
|
|
7769
7803
|
if (t.command && !t.command.startsWith('-')) {
|
|
7770
|
-
(!
|
|
7804
|
+
(!V(t.command) &&
|
|
7771
7805
|
!oe[t.command] &&
|
|
7772
7806
|
(process.stderr.write(`
|
|
7773
|
-
${
|
|
7774
|
-
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.
|
|
7775
7809
|
`),
|
|
7776
|
-
process.exit(
|
|
7810
|
+
process.exit(_)),
|
|
7777
7811
|
await Ce(t.command, t.options));
|
|
7778
7812
|
return;
|
|
7779
7813
|
}
|
|
7780
|
-
|
|
7814
|
+
Gt();
|
|
7781
7815
|
break;
|
|
7782
7816
|
}
|
|
7783
7817
|
}
|
|
7784
7818
|
}
|
|
7785
|
-
|
|
7786
|
-
(e instanceof
|
|
7819
|
+
fr().catch((e) => {
|
|
7820
|
+
(e instanceof w &&
|
|
7787
7821
|
(process.stderr.write(`
|
|
7788
|
-
${
|
|
7822
|
+
${a.red('Error:')} ${M(e).join(`
|
|
7789
7823
|
`)}
|
|
7790
7824
|
`),
|
|
7791
7825
|
process.exit(e.exitCode)),
|
|
7792
7826
|
process.stderr.write(`
|
|
7793
|
-
${
|
|
7827
|
+
${a.red('Fatal error:')} ${e instanceof Error ? e.message : e}
|
|
7794
7828
|
`),
|
|
7795
|
-
process.exit(
|
|
7829
|
+
process.exit(_));
|
|
7796
7830
|
});
|