@teinai/cli 1.1.11 → 1.1.13

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.
Files changed (3) hide show
  1. package/README.md +12 -0
  2. package/index.js +934 -808
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
- var zt = Object.create;
4
- var me = Object.defineProperty;
5
- var Yt = Object.getOwnPropertyDescriptor;
6
- var Qt = Object.getOwnPropertyNames;
7
- var Xt = Object.getPrototypeOf,
8
- Zt = Object.prototype.hasOwnProperty;
9
- var y = (e, t, i) => () => {
3
+ var Yt = Object.create;
4
+ var fe = Object.defineProperty;
5
+ var Qt = Object.getOwnPropertyDescriptor;
6
+ var Xt = Object.getOwnPropertyNames;
7
+ var Zt = Object.getPrototypeOf,
8
+ ei = Object.prototype.hasOwnProperty;
9
+ var b = (e, t, i) => () => {
10
10
  if (i) throw i[0];
11
11
  try {
12
12
  return (e && (t = e((e = 0))), t);
@@ -14,94 +14,94 @@ var y = (e, t, i) => () => {
14
14
  throw ((i = [r]), r);
15
15
  }
16
16
  };
17
- var ei = (e, t) => {
18
- for (var i in t) me(e, i, { get: t[i], enumerable: !0 });
17
+ var ti = (e, t) => {
18
+ for (var i in t) fe(e, i, { get: t[i], enumerable: !0 });
19
19
  },
20
- ti = (e, t, i, r) => {
20
+ ii = (e, t, i, r) => {
21
21
  if ((t && typeof t == 'object') || typeof t == 'function')
22
- for (let n of Qt(t))
23
- !Zt.call(e, n) &&
22
+ for (let n of Xt(t))
23
+ !ei.call(e, n) &&
24
24
  n !== i &&
25
- me(e, n, { get: () => t[n], enumerable: !(r = Yt(t, n)) || r.enumerable });
25
+ fe(e, n, { get: () => t[n], enumerable: !(r = Qt(t, n)) || r.enumerable });
26
26
  return e;
27
27
  };
28
- var v = (e, t, i) => (
29
- (i = e != null ? zt(Xt(e)) : {}),
30
- ti(t || !e || !e.__esModule ? me(i, 'default', { value: e, enumerable: !0 }) : i, e)
28
+ var I = (e, t, i) => (
29
+ (i = e != null ? Yt(Zt(e)) : {}),
30
+ ii(t || !e || !e.__esModule ? fe(i, 'default', { value: e, enumerable: !0 }) : i, e)
31
31
  );
32
- function D() {
32
+ function L() {
33
33
  try {
34
- if ($.default.existsSync(O)) {
35
- let e = $.default.readFileSync(O, 'utf-8');
34
+ if (C.default.existsSync(D)) {
35
+ let e = C.default.readFileSync(D, 'utf-8');
36
36
  return JSON.parse(e);
37
37
  }
38
38
  } catch {}
39
39
  return {};
40
40
  }
41
- function ge(e) {
41
+ function he(e) {
42
42
  try {
43
- $.default.existsSync(te) || $.default.mkdirSync(te, { recursive: !0, mode: 448 });
44
- let i = { ...D(), ...e };
45
- ($.default.writeFileSync(O, JSON.stringify(i, null, 2), { encoding: 'utf-8', mode: 384 }),
46
- $.default.chmodSync(te, 448),
47
- $.default.chmodSync(O, 384));
43
+ C.default.existsSync(te) || C.default.mkdirSync(te, { recursive: !0, mode: 448 });
44
+ let i = { ...L(), ...e };
45
+ (C.default.writeFileSync(D, JSON.stringify(i, null, 2), { encoding: 'utf-8', mode: 384 }),
46
+ C.default.chmodSync(te, 448),
47
+ C.default.chmodSync(D, 384));
48
48
  } catch (t) {
49
- throw new Error(`Failed to save config to ${O}: ${t}`);
49
+ throw new Error(`Failed to save config to ${D}: ${t}`);
50
50
  }
51
51
  }
52
- function K(e) {
52
+ function S(e) {
53
53
  if (e && e.trim()) return e.trim();
54
54
  let t = process.env.TEIN_API_KEY || process.env.TEIN_KEY;
55
55
  if (t && t.trim()) return t.trim();
56
- let i = D();
56
+ let i = L();
57
57
  return i.apiKey && i.apiKey.trim() ? i.apiKey.trim() : '';
58
58
  }
59
- function k(e) {
59
+ function x(e) {
60
60
  if (e && e.trim()) return e.trim().replace(/\/+$/, '');
61
61
  let t = process.env.TEIN_API_URL;
62
62
  if (t && t.trim()) return t.trim().replace(/\/+$/, '');
63
- let i = D();
63
+ let i = L();
64
64
  return i.apiUrl && i.apiUrl.trim() ? i.apiUrl.trim().replace(/\/+$/, '') : 'https://api.tein.ai';
65
65
  }
66
66
  function ie() {
67
- return O;
67
+ return D;
68
68
  }
69
- var $,
70
- Ge,
71
- fe,
69
+ var C,
70
+ Je,
71
+ ge,
72
72
  te,
73
- O,
74
- C = y(() => {
73
+ D,
74
+ E = b(() => {
75
75
  'use strict';
76
- (($ = v(require('node:fs'))),
77
- (Ge = v(require('node:os'))),
78
- (fe = v(require('node:path'))),
79
- (te = fe.default.join(Ge.default.homedir(), '.tein')),
80
- (O = fe.default.join(te, 'config.json')));
76
+ ((C = I(require('node:fs'))),
77
+ (Je = I(require('node:os'))),
78
+ (ge = I(require('node:path'))),
79
+ (te = ge.default.join(Je.default.homedir(), '.tein')),
80
+ (D = ge.default.join(te, 'config.json')));
81
81
  });
82
- var oi,
83
- Je,
82
+ var li,
84
83
  He,
85
- We = y(() => {
84
+ ze,
85
+ We = b(() => {
86
86
  'use strict';
87
- ((oi = ['1:1', '16:9', '9:16', '21:9', '3:2', '2:3', '4:3', '3:4']),
88
- (Je = [...oi, 'auto']),
89
- (He =
87
+ ((li = ['1:1', '16:9', '9:16', '21:9', '3:2', '2:3', '4:3', '3:4']),
88
+ (He = [...li, 'auto']),
89
+ (ze =
90
90
  'The medium endpoint renders non-square images at 1K only. Use resolution 1K, aspect_ratio 1:1, or the dynamic endpoint for a non-square 2K or 4K image.'));
91
91
  });
92
92
  var B,
93
- he = y(() => {
93
+ ye = b(() => {
94
94
  'use strict';
95
95
  B = new Set(['nano-banana-2.1', 'seedance-2-lite', 'seedance-2-5-lite']);
96
96
  });
97
- function ye(e) {
97
+ function be(e) {
98
98
  return !1;
99
99
  }
100
- var ze = y(() => {
100
+ var Ye = b(() => {
101
101
  'use strict';
102
102
  });
103
103
  var re,
104
- Ye = y(() => {
104
+ Qe = b(() => {
105
105
  'use strict';
106
106
  re = {
107
107
  source: 'TEIN Price Board',
@@ -190,6 +190,111 @@ var re,
190
190
  unit: '/sec',
191
191
  api: { model: 'seedance-2-5' },
192
192
  variants: [
193
+ {
194
+ id: '4k-with-video',
195
+ price: { starter: 0.7374, plus: 0.6806, scale: 0.6523 },
196
+ label: '4K \xB7 Omni Reference \xB7 with reference video',
197
+ resolution: '4k',
198
+ task: 'omni',
199
+ withVideo: !0,
200
+ unfiltered: { starter: 0.7742, plus: 0.7146, scale: 0.6849 },
201
+ priority: { starter: 0.7816, plus: 0.7214, scale: 0.6914 },
202
+ unfilteredPriority: { starter: 0.8206, plus: 0.7574, scale: 0.7259 },
203
+ draft: { starter: 0.7374, plus: 0.6806, scale: 0.6523 },
204
+ unfilteredDraft: { starter: 0.7742, plus: 0.7146, scale: 0.6849 },
205
+ priorityDraft: { starter: 0.7816, plus: 0.7214, scale: 0.6914 },
206
+ unfilteredPriorityDraft: { starter: 0.8206, plus: 0.7574, scale: 0.7259 },
207
+ },
208
+ {
209
+ id: '4k-no-video',
210
+ price: { starter: 1.2003, plus: 1.108, scale: 1.0618 },
211
+ label: '4K \xB7 Text to Video',
212
+ resolution: '4k',
213
+ task: 't2v',
214
+ withVideo: !1,
215
+ unfiltered: { starter: 1.2603, plus: 1.1634, scale: 1.1148 },
216
+ priority: { starter: 1.2723, plus: 1.1744, scale: 1.1255 },
217
+ unfilteredPriority: { starter: 1.3359, plus: 1.2332, scale: 1.1816 },
218
+ draft: { starter: 1.2003, plus: 1.108, scale: 1.0618 },
219
+ unfilteredDraft: { starter: 1.2603, plus: 1.1634, scale: 1.1148 },
220
+ priorityDraft: { starter: 1.2723, plus: 1.1744, scale: 1.1255 },
221
+ unfilteredPriorityDraft: { starter: 1.3359, plus: 1.2332, scale: 1.1816 },
222
+ },
223
+ {
224
+ id: '4k-with-video-extend',
225
+ price: { starter: 0.7375, plus: 0.6807, scale: 0.6523 },
226
+ label: '4K \xB7 Extend \xB7 with reference video',
227
+ resolution: '4k',
228
+ task: 'extend',
229
+ withVideo: !0,
230
+ unfiltered: { starter: 0.7743, plus: 0.7147, scale: 0.6849 },
231
+ priority: { starter: 0.7817, plus: 0.7215, scale: 0.6914 },
232
+ unfilteredPriority: { starter: 0.8207, plus: 0.7575, scale: 0.7259 },
233
+ draft: { starter: 0.7375, plus: 0.6807, scale: 0.6523 },
234
+ unfilteredDraft: { starter: 0.7743, plus: 0.7147, scale: 0.6849 },
235
+ priorityDraft: { starter: 0.7817, plus: 0.7215, scale: 0.6914 },
236
+ unfilteredPriorityDraft: { starter: 0.8207, plus: 0.7575, scale: 0.7259 },
237
+ },
238
+ {
239
+ id: '4k-with-video-edit',
240
+ price: { starter: 0.7379, plus: 0.6811, scale: 0.6523 },
241
+ label: '4K \xB7 Edit \xB7 with reference video',
242
+ resolution: '4k',
243
+ task: 'edit',
244
+ withVideo: !0,
245
+ unfiltered: { starter: 0.7747, plus: 0.7151, scale: 0.6849 },
246
+ priority: { starter: 0.7821, plus: 0.7219, scale: 0.6914 },
247
+ unfilteredPriority: { starter: 0.8211, plus: 0.758, scale: 0.7259 },
248
+ draft: { starter: 0.7379, plus: 0.6811, scale: 0.6523 },
249
+ unfilteredDraft: { starter: 0.7747, plus: 0.7151, scale: 0.6849 },
250
+ priorityDraft: { starter: 0.7821, plus: 0.7219, scale: 0.6914 },
251
+ unfilteredPriorityDraft: { starter: 0.8211, plus: 0.758, scale: 0.7259 },
252
+ },
253
+ {
254
+ id: '4k-no-video-i2v',
255
+ price: { starter: 1.2005, plus: 1.1082, scale: 1.0618 },
256
+ label: '4K \xB7 Image to Video',
257
+ resolution: '4k',
258
+ task: 'i2v',
259
+ withVideo: !1,
260
+ unfiltered: { starter: 1.2605, plus: 1.1636, scale: 1.1148 },
261
+ priority: { starter: 1.2725, plus: 1.1746, scale: 1.1255 },
262
+ unfilteredPriority: { starter: 1.3361, plus: 1.2334, scale: 1.1816 },
263
+ draft: { starter: 1.2005, plus: 1.1082, scale: 1.0618 },
264
+ unfilteredDraft: { starter: 1.2605, plus: 1.1636, scale: 1.1148 },
265
+ priorityDraft: { starter: 1.2725, plus: 1.1746, scale: 1.1255 },
266
+ unfilteredPriorityDraft: { starter: 1.3361, plus: 1.2334, scale: 1.1816 },
267
+ },
268
+ {
269
+ id: '4k-no-video-frames',
270
+ price: { starter: 1.2009, plus: 1.1086, scale: 1.0618 },
271
+ label: '4K \xB7 First & Last Frame',
272
+ resolution: '4k',
273
+ task: 'frames',
274
+ withVideo: !1,
275
+ unfiltered: { starter: 1.2609, plus: 1.164, scale: 1.1148 },
276
+ priority: { starter: 1.2729, plus: 1.1751, scale: 1.1255 },
277
+ unfilteredPriority: { starter: 1.3365, plus: 1.2338, scale: 1.1816 },
278
+ draft: { starter: 1.2009, plus: 1.1086, scale: 1.0618 },
279
+ unfilteredDraft: { starter: 1.2609, plus: 1.164, scale: 1.1148 },
280
+ priorityDraft: { starter: 1.2729, plus: 1.1751, scale: 1.1255 },
281
+ unfilteredPriorityDraft: { starter: 1.3365, plus: 1.2338, scale: 1.1816 },
282
+ },
283
+ {
284
+ id: '4k-no-video-omni',
285
+ price: { starter: 1.2003, plus: 1.108, scale: 1.0618 },
286
+ label: '4K \xB7 Omni Reference',
287
+ resolution: '4k',
288
+ task: 'omni',
289
+ withVideo: !1,
290
+ unfiltered: { starter: 1.2603, plus: 1.1634, scale: 1.1148 },
291
+ priority: { starter: 1.2723, plus: 1.1744, scale: 1.1255 },
292
+ unfilteredPriority: { starter: 1.3359, plus: 1.2332, scale: 1.1816 },
293
+ draft: { starter: 1.2003, plus: 1.108, scale: 1.0618 },
294
+ unfilteredDraft: { starter: 1.2603, plus: 1.1634, scale: 1.1148 },
295
+ priorityDraft: { starter: 1.2723, plus: 1.1744, scale: 1.1255 },
296
+ unfilteredPriorityDraft: { starter: 1.3359, plus: 1.2332, scale: 1.1816 },
297
+ },
193
298
  {
194
299
  id: '1080p-with-video',
195
300
  price: { starter: 0.4349, plus: 0.4132, scale: 0.378 },
@@ -481,7 +586,7 @@ var re,
481
586
  unfiltered: 0.05,
482
587
  priority: 0.06,
483
588
  draft: { off: 0.03, draft: '480p', finalize: '1080p', expiresDays: 7 },
484
- axes: { resolution: ['480p', '720p', '1080p'] },
589
+ axes: { resolution: ['480p', '720p', '1080p', '4k'] },
485
590
  from: { variant: '480p-no-video-omni' },
486
591
  },
487
592
  {
@@ -4522,10 +4627,10 @@ var re,
4522
4627
  ],
4523
4628
  };
4524
4629
  });
4525
- function ke(e, t) {
4630
+ function xe(e, t) {
4526
4631
  return `${e.trim().toLowerCase()}|${(t ?? '').trim().toLowerCase()}`;
4527
4632
  }
4528
- function pi(e, t) {
4633
+ function di(e, t) {
4529
4634
  if (e === 'seedance-2-mini') return 'mini';
4530
4635
  if (e !== 'seedance-2') return;
4531
4636
  let i = typeof t?.quality == 'string' ? t.quality.trim().toLowerCase() : '';
@@ -4535,79 +4640,79 @@ function pi(e, t) {
4535
4640
  ? 'fast'
4536
4641
  : 'standard';
4537
4642
  }
4538
- function di(e, t) {
4643
+ function ci(e, t) {
4539
4644
  let i = e
4540
4645
  .trim()
4541
4646
  .toLowerCase()
4542
4647
  .replace(/-(?:unfiltered|uncensored)$/, '');
4543
4648
  if (i === 'seedance-2' || i === 'seedance-2-mini') {
4544
- let n = pi(i, t),
4545
- s = be.get(ke('seedance-2', n));
4649
+ let n = di(i, t),
4650
+ s = we.get(xe('seedance-2', n));
4546
4651
  return s ? s.slug : null;
4547
4652
  }
4548
- let r = ae.get(i) ?? be.get(ke(i));
4653
+ let r = ae.get(i) ?? we.get(xe(i));
4549
4654
  return r ? r.slug : null;
4550
4655
  }
4551
- function ui(e, t) {
4552
- return ae.has(e) && !(ci.has(e) && t) ? e : di(e, t);
4656
+ function mi(e, t) {
4657
+ return ae.has(e) && !(ui.has(e) && t) ? e : ci(e, t);
4553
4658
  }
4554
4659
  function F(e, t) {
4555
- let i = ui(e, t);
4660
+ let i = mi(e, t);
4556
4661
  return i ? (ae.get(i) ?? null) : null;
4557
4662
  }
4558
4663
  function ne() {
4559
- return xe.models;
4664
+ return ve.models;
4560
4665
  }
4561
- var xe,
4666
+ var ve,
4562
4667
  ae,
4563
- be,
4564
- Qe,
4565
- li,
4566
4668
  we,
4567
- ci,
4568
- L = y(() => {
4669
+ Xe,
4670
+ pi,
4671
+ ke,
4672
+ ui,
4673
+ V = b(() => {
4569
4674
  'use strict';
4570
- ze();
4571
4675
  Ye();
4572
- ((xe = {
4676
+ Qe();
4677
+ ((ve = {
4573
4678
  ...re,
4574
- families: re.families.map((e) => ({ ...e, models: e.models.filter((t) => !ye(t)) })),
4575
- models: re.models.filter((e) => !ye(e.slug)),
4679
+ families: re.families.map((e) => ({ ...e, models: e.models.filter((t) => !be(t)) })),
4680
+ models: re.models.filter((e) => !be(e.slug)),
4576
4681
  }),
4577
4682
  (ae = new Map()),
4578
- (be = new Map()),
4579
- (Qe = new Map()),
4580
- (li = new Map()),
4581
- (we = new Map()));
4582
- for (let e of xe.models) {
4583
- (ae.set(e.slug, e), be.set(ke(e.api.model, e.api.quality), e));
4584
- for (let t of e.variants) Qe.set(`${e.slug}/${t.id}`, { model: e, variant: t, edit: !1 });
4683
+ (we = new Map()),
4684
+ (Xe = new Map()),
4685
+ (pi = new Map()),
4686
+ (ke = new Map()));
4687
+ for (let e of ve.models) {
4688
+ (ae.set(e.slug, e), we.set(xe(e.api.model, e.api.quality), e));
4689
+ for (let t of e.variants) Xe.set(`${e.slug}/${t.id}`, { model: e, variant: t, edit: !1 });
4585
4690
  for (let t of e.editVariants ?? [])
4586
- Qe.set(`${e.slug}/edit/${t.id}`, { model: e, variant: t, edit: !0 });
4587
- for (let t of e.addons ?? []) li.set(`${e.slug}/addon/${t.id}`, { model: e, addon: t });
4588
- we.set(e.slug, e.family);
4691
+ Xe.set(`${e.slug}/edit/${t.id}`, { model: e, variant: t, edit: !0 });
4692
+ for (let t of e.addons ?? []) pi.set(`${e.slug}/addon/${t.id}`, { model: e, addon: t });
4693
+ ke.set(e.slug, e.family);
4589
4694
  }
4590
- for (let e of xe.families) for (let t of e.models) we.has(t) || we.set(t, e.slug);
4591
- ci = new Set(['seedance-2']);
4695
+ for (let e of ve.families) for (let t of e.models) ke.has(t) || ke.set(t, e.slug);
4696
+ ui = new Set(['seedance-2']);
4592
4697
  });
4593
4698
  function se(e) {
4594
4699
  let t = e.from?.variant;
4595
4700
  return (t && e.variants.find((i) => i.id === t)) || e.variants[0];
4596
4701
  }
4597
- function ve(e) {
4702
+ function Ie(e) {
4598
4703
  if (e.endpoints?.length)
4599
- return e.editVariants?.length && e.endpoints.some((t) => t.id === Xe)
4600
- ? Xe
4704
+ return e.editVariants?.length && e.endpoints.some((t) => t.id === Ze)
4705
+ ? Ze
4601
4706
  : (e.defaultEndpoint ?? e.endpoints[0].id);
4602
4707
  }
4603
- var Xe,
4604
- Ie = y(() => {
4708
+ var Ze,
4709
+ _e = b(() => {
4605
4710
  'use strict';
4606
- L();
4607
- Xe = 'dynamic';
4711
+ V();
4712
+ Ze = 'dynamic';
4608
4713
  });
4609
4714
  var oe,
4610
- _e = y(() => {
4715
+ Pe = b(() => {
4611
4716
  'use strict';
4612
4717
  oe = {
4613
4718
  'gemini-3-8-flash': 'gemini-3.8-flash',
@@ -4617,29 +4722,29 @@ var oe,
4617
4722
  'gpt-image-2-5-sunburst': 'gpt-image-2.5-sunburst',
4618
4723
  };
4619
4724
  });
4620
- var Ze = y(() => {
4725
+ var et = b(() => {
4621
4726
  'use strict';
4622
4727
  });
4623
- function et(e, t) {
4624
- return typeof t == 'string' && (mi[e]?.includes(t) ?? !1);
4728
+ function tt(e, t) {
4729
+ return typeof t == 'string' && (fi[e]?.includes(t) ?? !1);
4625
4730
  }
4626
- var mi,
4627
- tt = y(() => {
4731
+ var fi,
4732
+ it = b(() => {
4628
4733
  'use strict';
4629
- L();
4630
- Ie();
4631
- Ze();
4632
- mi = {};
4734
+ V();
4735
+ _e();
4736
+ et();
4737
+ fi = {};
4633
4738
  });
4634
- function it(e) {
4635
- return e === 'nano-banana-pro' ? fi : gi;
4739
+ function rt(e) {
4740
+ return e === 'nano-banana-pro' ? gi : hi;
4636
4741
  }
4637
- var fi,
4638
- gi,
4639
- rt = y(() => {
4742
+ var gi,
4743
+ hi,
4744
+ at = b(() => {
4640
4745
  'use strict';
4641
- ((fi = ['auto', '1:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9']),
4642
- (gi = [
4746
+ ((gi = ['auto', '1:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9']),
4747
+ (hi = [
4643
4748
  'auto',
4644
4749
  '1:1',
4645
4750
  '1:4',
@@ -4657,10 +4762,10 @@ var fi,
4657
4762
  '21:9',
4658
4763
  ]));
4659
4764
  });
4660
- var at,
4661
- nt = y(() => {
4765
+ var nt,
4766
+ st = b(() => {
4662
4767
  'use strict';
4663
- at = [
4768
+ nt = [
4664
4769
  'prompt',
4665
4770
  'system',
4666
4771
  'messages',
@@ -4674,10 +4779,10 @@ var at,
4674
4779
  'endpoint',
4675
4780
  ];
4676
4781
  });
4677
- var st,
4678
- ot = y(() => {
4782
+ var ot,
4783
+ lt = b(() => {
4679
4784
  'use strict';
4680
- st = [
4785
+ ot = [
4681
4786
  {
4682
4787
  slug: 'claude-fable-5-1',
4683
4788
  family: 'fable-5-1',
@@ -4746,13 +4851,13 @@ var st,
4746
4851
  },
4747
4852
  ];
4748
4853
  });
4749
- function lt(e) {
4854
+ function pt(e) {
4750
4855
  return `$${e}`;
4751
4856
  }
4752
- function Pe(e, t, i) {
4857
+ function Te(e, t, i) {
4753
4858
  return F(e)?.variants.find((n) => n.endpoint === t && n.component === i)?.price.starter ?? null;
4754
4859
  }
4755
- function hi(e) {
4860
+ function yi(e) {
4756
4861
  return [
4757
4862
  {
4758
4863
  name: 'prompt',
@@ -4818,13 +4923,13 @@ function hi(e) {
4818
4923
  },
4819
4924
  ];
4820
4925
  }
4821
- function pt() {
4926
+ function dt() {
4822
4927
  return Object.fromEntries(
4823
- st.map((e) => {
4824
- let t = Pe(e.slug, 'cheap', 'input'),
4825
- i = Pe(e.slug, 'cheap', 'output'),
4826
- r = Pe(e.slug, 'stable', 'input') != null,
4827
- n = t != null && i != null ? `${lt(t)}/M in \xB7 ${lt(i)}/M out` : '',
4928
+ ot.map((e) => {
4929
+ let t = Te(e.slug, 'cheap', 'input'),
4930
+ i = Te(e.slug, 'cheap', 'output'),
4931
+ r = Te(e.slug, 'stable', 'input') != null,
4932
+ n = t != null && i != null ? `${pt(t)}/M in \xB7 ${pt(i)}/M out` : '',
4828
4933
  s = {
4829
4934
  slug: e.slug,
4830
4935
  name: e.name,
@@ -4835,20 +4940,20 @@ function pt() {
4835
4940
  priceFormatted: n,
4836
4941
  unit: '/M tokens',
4837
4942
  primaryToolName: 'run_task',
4838
- parameters: hi(r),
4943
+ parameters: yi(r),
4839
4944
  };
4840
4945
  return [e.slug, s];
4841
4946
  }),
4842
4947
  );
4843
4948
  }
4844
- var dt = y(() => {
4949
+ var ct = b(() => {
4845
4950
  'use strict';
4846
- ot();
4847
- L();
4951
+ lt();
4952
+ V();
4848
4953
  });
4849
4954
  var G,
4850
4955
  le,
4851
- Te = y(() => {
4956
+ Me = b(() => {
4852
4957
  'use strict';
4853
4958
  ((G = ['seedance-2-5', 'seedance-2', 'seedance-2-mini', 'seedream-5-pro', 'wan-3-0']),
4854
4959
  (le =
@@ -4857,7 +4962,7 @@ var G,
4857
4962
  function J(e) {
4858
4963
  return `$${Number(e.toFixed(5))}`;
4859
4964
  }
4860
- function ki(e) {
4965
+ function xi(e) {
4861
4966
  if (e.kind === 'llm') {
4862
4967
  let t = e.defaultEndpoint,
4863
4968
  i = (s) =>
@@ -4875,14 +4980,14 @@ function ki(e) {
4875
4980
  }
4876
4981
  return `from ${J(se(e).price.starter)}${e.unit}`;
4877
4982
  }
4878
- function xi(e, t) {
4983
+ function vi(e, t) {
4879
4984
  let i = t.filter((r) => Number.isFinite(r) && r > 0);
4880
4985
  return i.length ? `from ${J(Math.min(...i))}${e}` : null;
4881
4986
  }
4882
- function ft(e) {
4987
+ function gt(e) {
4883
4988
  for (let t of B) {
4884
4989
  let i = de[t],
4885
- r = i ? xi(i.unit, e[t] ?? []) : null;
4990
+ r = i ? vi(i.unit, e[t] ?? []) : null;
4886
4991
  i && r && (i.priceFormatted = r);
4887
4992
  }
4888
4993
  }
@@ -4898,13 +5003,13 @@ function H(e, t) {
4898
5003
  ...(t ? { description: t } : {}),
4899
5004
  };
4900
5005
  }
4901
- function gt(e) {
5006
+ function ht(e) {
4902
5007
  if (!e.endpoints?.length) return null;
4903
- let t = e.endpoints.filter((i) => et(e.slug, i.id));
5008
+ let t = e.endpoints.filter((i) => tt(e.slug, i.id));
4904
5009
  return {
4905
5010
  name: 'endpoint',
4906
5011
  type: 'select',
4907
- default: ve(e),
5012
+ default: Ie(e),
4908
5013
  options: e.endpoints.filter((i) => !t.includes(i)).map((i) => i.id),
4909
5014
  description:
4910
5015
  (e.slug === 'gemini-3.1-pro-preview'
@@ -4913,27 +5018,32 @@ function gt(e) {
4913
5018
  (t.length ? ` ${t.map((i) => i.label).join(' and ')}: coming soon.` : ''),
4914
5019
  };
4915
5020
  }
4916
- function _i(e, t) {
5021
+ function Pi(e, t) {
4917
5022
  if (e.unfiltered == null || t.some((r) => r.name === 'creative_mode')) return t;
4918
5023
  let i = G.includes(e.api.model);
4919
- return [...t.filter((r) => !$e.has(r.name)), i ? ht : vi];
5024
+ return [...t.filter((r) => !Ce.has(r.name)), i ? yt : Ii];
4920
5025
  }
4921
- function Me(e, t) {
4922
- let i = e.filter((n) => !$e.has(n.name)),
4923
- r = [ht, Ii];
4924
- return (r.push(yt, bt), [...i, ...r]);
5026
+ function Ke(e, t) {
5027
+ let i = e.filter((n) => !Ce.has(n.name)),
5028
+ r = [yt, _i];
5029
+ return (r.push(bt, wt), [...i, ...r]);
4925
5030
  }
4926
- function ct(e) {
5031
+ function ut(e, t = {}) {
4927
5032
  return [
4928
5033
  ...e
4929
- .filter((t) => !Pi.has(t.name) && !$e.has(t.name))
4930
- .map((t) =>
4931
- t.name === 'resolution'
4932
- ? {
4933
- ...t,
4934
- description: `Output resolution. TEIN LITE is the lower-priced endpoint for getting started. Stability and reliability are not guaranteed. ${pe}`,
4935
- }
4936
- : t,
5034
+ .filter((i) => !Ti.has(i.name) && !Ce.has(i.name))
5035
+ .map((i) =>
5036
+ i.name === 'prompt'
5037
+ ? { ...i, required: !0 }
5038
+ : i.name === 'resolution'
5039
+ ? {
5040
+ ...i,
5041
+ ...(t.no4k && i.options
5042
+ ? { options: i.options.filter((r) => String(r).toLowerCase() !== '4k') }
5043
+ : {}),
5044
+ description: `Output resolution. TEIN LITE is the lower-priced endpoint for getting started. Stability and reliability are not guaranteed. ${pe}`,
5045
+ }
5046
+ : i,
4937
5047
  ),
4938
5048
  {
4939
5049
  name: 'bitrate_mode',
@@ -4942,13 +5052,13 @@ function ct(e) {
4942
5052
  options: ['standard'],
4943
5053
  description: 'LITE uses standard bitrate. High bitrate is on the standard endpoint.',
4944
5054
  },
4945
- yt,
4946
5055
  bt,
5056
+ wt,
4947
5057
  ];
4948
5058
  }
4949
- function Ke(e, t) {
5059
+ function Se(e, t) {
4950
5060
  return [
4951
- S('Text prompt describing the video.'),
5061
+ $('Text prompt describing the video.'),
4952
5062
  { name: 'mode', type: 'select', required: !0, default: t.modes[0], options: t.modes },
4953
5063
  {
4954
5064
  name: 'duration',
@@ -4975,10 +5085,10 @@ function Ke(e, t) {
4975
5085
  ),
4976
5086
  ];
4977
5087
  }
4978
- function Ti(e) {
4979
- let t = gt(e);
5088
+ function Mi(e) {
5089
+ let t = ht(e);
4980
5090
  return [
4981
- S('Image prompt text. Supports complex composition and text instructions.'),
5091
+ $('Image prompt text. Supports complex composition and text instructions.'),
4982
5092
  ...(t ? [t] : []),
4983
5093
  {
4984
5094
  name: 'quality',
@@ -4989,14 +5099,14 @@ function Ti(e) {
4989
5099
  H(
4990
5100
  e,
4991
5101
  e.slug === 'gpt-image-2'
4992
- ? `1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count. ${He}`
5102
+ ? `1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count. ${ze}`
4993
5103
  : '1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count.',
4994
5104
  ),
4995
5105
  {
4996
5106
  name: 'aspect_ratio',
4997
5107
  type: 'select',
4998
5108
  default: 'auto',
4999
- options: [...Je],
5109
+ options: [...He],
5000
5110
  description:
5001
5111
  "The frame. auto: an edit keeps its first input image's ratio (the nearest listed one), text to image is 1:1. The image is delivered at exactly the size for the ratio and resolution.",
5002
5112
  },
@@ -5043,15 +5153,15 @@ function Ti(e) {
5043
5153
  },
5044
5154
  ];
5045
5155
  }
5046
- function Mi(e) {
5156
+ function Ki(e) {
5047
5157
  return [
5048
- S('Image prompt text.'),
5158
+ $('Image prompt text.'),
5049
5159
  {
5050
5160
  name: 'input_images',
5051
5161
  type: 'string[]',
5052
5162
  description: 'Images to edit or use as reference (up to 14).',
5053
5163
  },
5054
- { name: 'aspect_ratio', type: 'select', default: '1:1', options: [...it(e.slug)] },
5164
+ { name: 'aspect_ratio', type: 'select', default: '1:1', options: [...rt(e.slug)] },
5055
5165
  H(e),
5056
5166
  {
5057
5167
  name: 'n',
@@ -5077,10 +5187,10 @@ function Mi(e) {
5077
5187
  },
5078
5188
  ];
5079
5189
  }
5080
- function Ci() {
5081
- let e = at,
5190
+ function Ei() {
5191
+ let e = nt,
5082
5192
  t = [];
5083
- for (let i of wt(!0))
5193
+ for (let i of kt(!0))
5084
5194
  e.includes(i.name) &&
5085
5195
  (t.push({
5086
5196
  ...i,
@@ -5102,9 +5212,9 @@ function Ci() {
5102
5212
  }));
5103
5213
  return t;
5104
5214
  }
5105
- function wt(e) {
5215
+ function kt(e) {
5106
5216
  return [
5107
- S('The user message or task.'),
5217
+ $('The user message or task.'),
5108
5218
  { name: 'system', type: 'string', description: 'Optional system instructions.' },
5109
5219
  {
5110
5220
  name: 'messages',
@@ -5197,40 +5307,40 @@ function wt(e) {
5197
5307
  },
5198
5308
  ];
5199
5309
  }
5200
- function Ei(e) {
5201
- if (e.slug === 'seed-2-1-turbo') return Si;
5202
- let t = gt(e);
5310
+ function qi(e) {
5311
+ if (e.slug === 'seed-2-1-turbo') return $i;
5312
+ let t = ht(e);
5203
5313
  return [
5204
5314
  ...(e.slug === 'gemini-3.1-pro-preview'
5205
- ? Ci()
5206
- : e.slug === 'gpt-6-astra' || $i.includes(e.slug)
5207
- ? wt(e.slug !== 'gpt-6-astra')
5208
- : Ki),
5315
+ ? Ei()
5316
+ : e.slug === 'gpt-6-astra' || Ci.includes(e.slug)
5317
+ ? kt(e.slug !== 'gpt-6-astra')
5318
+ : Si),
5209
5319
  ...(t ? [t] : []),
5210
5320
  ];
5211
5321
  }
5212
- function qi(e) {
5322
+ function Ai(e) {
5213
5323
  let t = e.slug;
5214
- if (e.kind === 'llm') return Ei(e);
5215
- if (e.editVariants?.length) return Ti(e);
5324
+ if (e.kind === 'llm') return qi(e);
5325
+ if (e.editVariants?.length) return Mi(e);
5216
5326
  switch (t) {
5217
5327
  case 'seedance-2-5':
5218
- return Me(ut, t);
5328
+ return Ke(mt, t);
5219
5329
  case 'seedance-2-5-lite':
5220
- return ct(ut);
5330
+ return ut(mt, { no4k: !0 });
5221
5331
  case 'seedance-2':
5222
- return Me(mt, t);
5332
+ return Ke(ft, t);
5223
5333
  case 'seedance-2-lite':
5224
- return ct(mt);
5334
+ return ut(ft);
5225
5335
  case 'seedance-2-mini':
5226
- return Me(Ai, t);
5336
+ return Ke(Ri, t);
5227
5337
  case 'nano-banana-2':
5228
5338
  case 'nano-banana-2.1':
5229
5339
  case 'nano-banana-pro':
5230
- return Mi(e);
5340
+ return Ki(e);
5231
5341
  case 'seedream-5-pro':
5232
5342
  return [
5233
- S('Detailed description of the image to generate.'),
5343
+ $('Detailed description of the image to generate.'),
5234
5344
  { name: 'images', type: 'string[]', description: 'Reference images (the first is free).' },
5235
5345
  H(e),
5236
5346
  {
@@ -5244,7 +5354,7 @@ function qi(e) {
5244
5354
  case 'qwen-3':
5245
5355
  case 'qwen-3-pro':
5246
5356
  return [
5247
- S('Image prompt text; dense layouts and multilingual text work well.'),
5357
+ $('Image prompt text; dense layouts and multilingual text work well.'),
5248
5358
  {
5249
5359
  name: 'images',
5250
5360
  type: 'string[]',
@@ -5290,7 +5400,7 @@ function qi(e) {
5290
5400
  ];
5291
5401
  case 'wan-3-0':
5292
5402
  case 'wan-3-0-prime':
5293
- return Ke(e, {
5403
+ return Se(e, {
5294
5404
  modes: ['text_to_video', 'first_n_last_frames', 'multi_reference'],
5295
5405
  aspects: ['16:9', '9:16', '4:3', '3:4', '1:1', 'adaptive'],
5296
5406
  minSec: 2,
@@ -5300,7 +5410,7 @@ function qi(e) {
5300
5410
  });
5301
5411
  case 'happy-horse-1-1':
5302
5412
  case 'happy-horse-1-0':
5303
- return Ke(e, {
5413
+ return Se(e, {
5304
5414
  modes:
5305
5415
  t === 'happy-horse-1-0'
5306
5416
  ? ['text-to-video', 'single-image', 'multi-reference', 'video-editing']
@@ -5311,7 +5421,7 @@ function qi(e) {
5311
5421
  references: t === 'happy-horse-1-0' ? ['images', 'videos'] : ['images'],
5312
5422
  });
5313
5423
  case 'minimax-h3':
5314
- return Ke(e, {
5424
+ return Se(e, {
5315
5425
  modes: ['text_to_video', 'first_n_last_frames', 'multi_reference'],
5316
5426
  aspects: ['16:9', '21:9', '4:3', '1:1', '3:4', '9:16', 'adaptive'],
5317
5427
  minSec: 4,
@@ -5319,146 +5429,162 @@ function qi(e) {
5319
5429
  references: ['images', 'videos', 'audios', 'first_frame_image', 'last_frame_image'],
5320
5430
  });
5321
5431
  default:
5322
- return [S('Prompt text.')];
5432
+ return [$('Prompt text.')];
5323
5433
  }
5324
5434
  }
5325
- function Se(e, t = e.api.model) {
5435
+ function $e(e, t = e.api.model) {
5326
5436
  return {
5327
5437
  slug: t,
5328
5438
  name: e.name,
5329
- category: yi[e.kind],
5330
- kind: wi[e.kind],
5439
+ category: bi[e.kind],
5440
+ kind: ki[e.kind],
5331
5441
  vendor: e.vendor ?? '',
5332
5442
  description: e.desc ?? e.name,
5333
- priceFormatted: ki(e),
5443
+ priceFormatted: xi(e),
5334
5444
  unit: e.unit,
5335
- primaryToolName: bi[e.kind],
5336
- parameters: _i(e, qi(e)),
5445
+ primaryToolName: wi[e.kind],
5446
+ parameters: Pi(e, Ai(e)),
5337
5447
  };
5338
5448
  }
5339
- function Ri() {
5449
+ function Oi() {
5340
5450
  let e = {};
5341
5451
  for (let t of ne())
5342
5452
  if (t.slug !== 'seedance-2-fast') {
5343
5453
  if (t.slug === 'seedance-2-mini') {
5344
- e['seedance-2-mini'] = Se(t, 'seedance-2-mini');
5454
+ e['seedance-2-mini'] = $e(t, 'seedance-2-mini');
5345
5455
  continue;
5346
5456
  }
5347
5457
  if (t.slug === 'seedance-2') {
5348
- let i = Se(t);
5458
+ let i = $e(t);
5349
5459
  ((i.description = `${t.desc ?? t.name} Send quality fast or mini for Seedance 2.0 Fast or Mini.`),
5350
5460
  (e['seedance-2'] = i));
5351
5461
  continue;
5352
5462
  }
5353
- t.slug.startsWith('claude-') || (e[t.api.model] = Se(t));
5463
+ t.slug.startsWith('claude-') || (e[t.api.model] = $e(t));
5354
5464
  }
5355
- Object.assign(e, pt());
5465
+ Object.assign(e, dt());
5356
5466
  for (let [t, i] of Object.entries(oe))
5357
5467
  e[i] && Object.defineProperty(e, t, { value: e[i], enumerable: !1 });
5358
5468
  return e;
5359
5469
  }
5360
- function V(e) {
5470
+ function N(e) {
5361
5471
  return de[e] ?? null;
5362
5472
  }
5363
- function vt(e, t, i) {
5473
+ function Di(e, t, i) {
5364
5474
  if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite') && t === 'duration') {
5365
5475
  let r = (n) => (typeof n == 'string' ? n.trim().toLowerCase() : '');
5366
5476
  if (r(i.mode) === 'edit' || r(i.omni_reference_task_type) === 'edit') return !1;
5367
5477
  }
5368
5478
  return !0;
5369
5479
  }
5370
- function E() {
5480
+ function It(e, t) {
5481
+ let i = { ...t };
5482
+ if (e?.slug === 'seedance-2-5') {
5483
+ let r = (n) => typeof n != 'string' || !n.trim();
5484
+ for (let n of Li) (r(i.finalize) && !r(i[n]) && (i.finalize = i[n]), delete i[n]);
5485
+ if (!r(i.finalize)) return i;
5486
+ }
5487
+ for (let r of e?.parameters ?? [])
5488
+ r.default !== void 0 &&
5489
+ i[r.name] === void 0 &&
5490
+ Di(e.slug, r.name, t) &&
5491
+ (i[r.name] = r.default);
5492
+ return i;
5493
+ }
5494
+ function q() {
5371
5495
  return Object.values(de);
5372
5496
  }
5373
- var yi,
5374
- bi,
5497
+ var bi,
5375
5498
  wi,
5376
- S,
5377
- ht,
5378
- vi,
5379
- Ii,
5499
+ ki,
5500
+ $,
5380
5501
  yt,
5502
+ Ii,
5503
+ _i,
5381
5504
  bt,
5382
- $e,
5383
- Pi,
5384
- Ki,
5505
+ wt,
5506
+ Ce,
5507
+ Ti,
5385
5508
  Si,
5386
5509
  $i,
5510
+ Ci,
5387
5511
  pe,
5388
- ut,
5389
- kt,
5390
- xt,
5391
5512
  mt,
5392
- Ai,
5513
+ xt,
5514
+ vt,
5515
+ ft,
5516
+ Ri,
5393
5517
  de,
5394
- W = y(() => {
5518
+ Li,
5519
+ z = b(() => {
5395
5520
  'use strict';
5396
5521
  We();
5397
- he();
5398
- L();
5399
- Ie();
5522
+ ye();
5523
+ V();
5400
5524
  _e();
5401
- tt();
5402
- rt();
5403
- nt();
5404
- dt();
5405
- Te();
5406
- ((yi = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
5407
- (bi = {
5525
+ Pe();
5526
+ it();
5527
+ at();
5528
+ st();
5529
+ ct();
5530
+ Me();
5531
+ ((bi = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
5532
+ (wi = {
5408
5533
  video: 'generate_video',
5409
5534
  image: 'generate_image',
5410
5535
  audio: 'generate_audio',
5411
5536
  llm: 'run_task',
5412
5537
  }),
5413
- (wi = {
5538
+ (ki = {
5414
5539
  video: 'Text-to-Video',
5415
5540
  image: 'Text-to-Image',
5416
5541
  audio: 'Text-to-Audio',
5417
5542
  llm: 'Reasoning (LLM)',
5418
5543
  }));
5419
- S = (e) => ({ name: 'prompt', type: 'string', required: !0, description: e });
5420
- ((ht = {
5544
+ $ = (e) => ({ name: 'prompt', type: 'string', required: !0, description: e });
5545
+ ((yt = {
5421
5546
  name: 'creative_mode',
5422
5547
  type: 'boolean',
5423
5548
  default: !1,
5424
5549
  description:
5425
5550
  'Runs the Creative mode checkpoint at its published price (+5%). The Acceptable Use Policy applies.',
5426
5551
  }),
5427
- (vi = {
5552
+ (Ii = {
5428
5553
  name: 'creative_mode',
5429
5554
  type: 'boolean',
5430
5555
  default: !1,
5431
5556
  description: `Not available yet on this model: ${le}.`,
5432
5557
  }),
5433
- (Ii = {
5558
+ (_i = {
5434
5559
  name: 'priority',
5435
5560
  type: 'boolean',
5436
5561
  default: !1,
5437
5562
  description: 'Guaranteed speed and no queue, at the published Priority price (+6%).',
5438
5563
  }),
5439
- (yt = {
5564
+ (bt = {
5440
5565
  name: 'reference_roles',
5441
5566
  type: 'json',
5442
5567
  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).`,
5443
5568
  }),
5444
- (bt = {
5569
+ (wt = {
5445
5570
  name: 'auto_fit_images',
5446
5571
  type: 'boolean',
5447
5572
  default: !1,
5448
5573
  description:
5449
5574
  '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.',
5450
5575
  }),
5451
- ($e = new Set(['full_access', 'is_uncensored', 'unfiltered', 'verificationSignature'])));
5452
- Pi = new Set([
5576
+ (Ce = new Set(['full_access', 'is_uncensored', 'unfiltered', 'verificationSignature'])));
5577
+ Ti = new Set([
5453
5578
  'quality',
5454
5579
  'bitrate_mode',
5455
5580
  'draft',
5581
+ 'finalize',
5456
5582
  'draft_task_id',
5457
5583
  'draft_generation_id',
5458
5584
  'pass_faces',
5459
5585
  ]);
5460
- ((Ki = [
5461
- S('The user message or task.'),
5586
+ ((Si = [
5587
+ $('The user message or task.'),
5462
5588
  { name: 'system', type: 'string', description: 'Optional system instructions.' },
5463
5589
  {
5464
5590
  name: 'messages',
@@ -5475,8 +5601,8 @@ var yi,
5475
5601
  { name: 'temperature', type: 'slider', min: 0, max: 1, step: 0.1 },
5476
5602
  { name: 'top_p', type: 'slider', min: 0, max: 1, step: 0.05 },
5477
5603
  ]),
5478
- (Si = [
5479
- S('The user message or task.'),
5604
+ ($i = [
5605
+ $('The user message or task.'),
5480
5606
  { name: 'system', type: 'string', description: 'Optional system instructions.' },
5481
5607
  {
5482
5608
  name: 'messages',
@@ -5557,15 +5683,14 @@ var yi,
5557
5683
  description: 'Video frames read a second.',
5558
5684
  },
5559
5685
  ]),
5560
- ($i = ['gemini-3.8-flash', 'gemini-3.7-flash']));
5686
+ (Ci = ['gemini-3.8-flash', 'gemini-3.7-flash']));
5561
5687
  ((pe = 'Left out: 480p, the same default as the API, the playground and workflow steps.'),
5562
- (ut = [
5688
+ (mt = [
5563
5689
  {
5564
5690
  name: 'prompt',
5565
5691
  type: 'string',
5566
- required: !0,
5567
5692
  description:
5568
- 'Text prompt describing the desired video scene, actions, camera angles, lighting, and style.',
5693
+ 'Required, except with finalize. Text prompt describing the desired video scene, actions, camera angles, lighting, and style.',
5569
5694
  },
5570
5695
  {
5571
5696
  name: 'mode',
@@ -5597,8 +5722,8 @@ var yi,
5597
5722
  name: 'resolution',
5598
5723
  type: 'select',
5599
5724
  default: '480p',
5600
- options: ['480p', '720p', '1080p'],
5601
- description: `Output resolution. 480p and 720p are 8-bit. 1080p is 10-bit H.265/HEVC. ${pe}`,
5725
+ options: ['480p', '720p', '1080p', '4k'],
5726
+ description: `Output resolution. 480p and 720p are 8-bit. 1080p and 4k are 10-bit H.265/HEVC. 4k is 3840x2160 at 16:9, works with Creative mode, and runs on one dedicated endpoint with no fallback, so it can be busy. ${pe}`,
5602
5727
  },
5603
5728
  {
5604
5729
  name: 'aspect_ratio',
@@ -5647,19 +5772,23 @@ var yi,
5647
5772
  type: 'boolean',
5648
5773
  default: !1,
5649
5774
  description:
5650
- '480p preview, billed at the 480p rate. Resolution must be 480p. Render the final 1080p video with draft_task_id or draft_generation_id within 7 days.',
5775
+ '480p preview, billed at the 480p rate. Resolution must be 480p. Render the final 1080p or 4k video with finalize within 7 days.',
5651
5776
  },
5652
5777
  {
5653
- name: 'draft_task_id',
5778
+ name: 'finalize',
5654
5779
  type: 'string',
5655
5780
  description:
5656
- 'Job id of a succeeded Seedance 2.5 draft. Renders that draft at 1080p at the finalize price. Do not send the prompt or references again.',
5781
+ 'Job id of a succeeded Seedance 2.5 draft. Renders that draft at 1080p (default) or at 4k with resolution "4k", at the finalize price. Send only finalize, resolution and output options: the prompt, references and other settings are reused from the draft.',
5782
+ },
5783
+ {
5784
+ name: 'draft_task_id',
5785
+ type: 'string',
5786
+ description: 'Older name for finalize. Same final render.',
5657
5787
  },
5658
5788
  {
5659
5789
  name: 'draft_generation_id',
5660
5790
  type: 'string',
5661
- description:
5662
- 'Tein generation id of a succeeded Seedance 2.5 draft. Same final render as draft_task_id.',
5791
+ description: 'Older name for finalize. Same final render.',
5663
5792
  },
5664
5793
  {
5665
5794
  name: 'images',
@@ -5705,19 +5834,19 @@ var yi,
5705
5834
  'Keeps real faces in reference images. On by default. Send false to turn it off.',
5706
5835
  },
5707
5836
  ]),
5708
- (kt = {
5837
+ (xt = {
5709
5838
  name: 'images',
5710
5839
  type: 'string[]',
5711
5840
  description:
5712
5841
  '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.',
5713
5842
  }),
5714
- (xt = {
5843
+ (vt = {
5715
5844
  name: 'audios',
5716
5845
  type: 'string[]',
5717
5846
  description:
5718
5847
  '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.',
5719
5848
  }),
5720
- (mt = [
5849
+ (ft = [
5721
5850
  {
5722
5851
  name: 'prompt',
5723
5852
  type: 'string',
@@ -5795,8 +5924,8 @@ var yi,
5795
5924
  description:
5796
5925
  'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
5797
5926
  },
5798
- kt,
5799
5927
  xt,
5928
+ vt,
5800
5929
  {
5801
5930
  name: 'first_frame_image',
5802
5931
  type: 'string',
@@ -5817,7 +5946,7 @@ var yi,
5817
5946
  'Keeps real faces in reference images. On by default. Send false to turn it off.',
5818
5947
  },
5819
5948
  ]),
5820
- (Ai = [
5949
+ (Ri = [
5821
5950
  {
5822
5951
  name: 'prompt',
5823
5952
  type: 'string',
@@ -5872,8 +6001,8 @@ var yi,
5872
6001
  description:
5873
6002
  'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
5874
6003
  },
5875
- kt,
5876
6004
  xt,
6005
+ vt,
5877
6006
  {
5878
6007
  name: 'first_frame_image',
5879
6008
  type: 'string',
@@ -5888,52 +6017,53 @@ var yi,
5888
6017
  'Keeps real faces in reference images. On by default. Send false to turn it off.',
5889
6018
  },
5890
6019
  ]));
5891
- de = Ri();
6020
+ de = Oi();
6021
+ Li = ['draft_task_id', 'draft_generation_id'];
5892
6022
  });
5893
6023
  function ce(e) {
5894
6024
  let t = '/v1/pricing/models',
5895
6025
  i = e?.trim();
5896
6026
  return i ? `${t}?model=${encodeURIComponent(i)}` : t;
5897
6027
  }
5898
- var Ee = y(() => {
6028
+ var qe = b(() => {
5899
6029
  'use strict';
5900
6030
  });
5901
- function qt(e) {
6031
+ function At(e) {
5902
6032
  return e.length <= 1 ? (e[0] ?? '') : `${e.slice(0, -1).join(', ')} and ${e[e.length - 1]}`;
5903
6033
  }
5904
- function At(e) {
6034
+ function Rt(e) {
5905
6035
  let t = ne().filter((s) => s.kind === e && s.unfiltered != null),
5906
6036
  i = t.filter((s) => G.includes(s.api.model)).map((s) => s.name),
5907
6037
  r = t.filter((s) => !G.includes(s.api.model)).map((s) => s.name);
5908
6038
  return [
5909
6039
  ...(i.length
5910
- ? [`${qt(i)}: runs the Creative mode checkpoint at its published price (+5%).`]
6040
+ ? [`${At(i)}: runs the Creative mode checkpoint at its published price (+5%).`]
5911
6041
  : []),
5912
- ...(r.length ? [`Not available yet on ${qt(r)}: ${le}.`] : []),
6042
+ ...(r.length ? [`Not available yet on ${At(r)}: ${le}.`] : []),
5913
6043
  'The Acceptable Use Policy applies.',
5914
6044
  ].join(' ');
5915
6045
  }
5916
- function ar(e) {
5917
- if (ir.has(e.name)) return e;
6046
+ function or(e) {
6047
+ if (nr.has(e.name)) return e;
5918
6048
  let t = e.inputSchema.properties;
5919
6049
  return !t || t.callback_url
5920
6050
  ? e
5921
- : { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url: tr } } };
6051
+ : { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url: ar } } };
5922
6052
  }
5923
- function nr(e) {
6053
+ function lr(e) {
5924
6054
  let t = e.inputSchema.properties;
5925
6055
  if (!t) return e;
5926
6056
  let i = !1,
5927
6057
  r = {};
5928
6058
  for (let [n, s] of Object.entries(t))
5929
- Rt.has(n) && s.type === 'string' && !s.format
6059
+ Ot.has(n) && s.type === 'string' && !s.format
5930
6060
  ? ((r[n] = { ...s, format: 'uri' }), (i = !0))
5931
- : Rt.has(n) && s.type === 'array' && s.items?.type === 'string' && !s.items.format
6061
+ : Ot.has(n) && s.type === 'array' && s.items?.type === 'string' && !s.items.format
5932
6062
  ? ((r[n] = { ...s, items: { ...s.items, format: 'uri' } }), (i = !0))
5933
6063
  : (r[n] = s);
5934
6064
  return i ? { ...e, inputSchema: { ...e.inputSchema, properties: r } } : e;
5935
6065
  }
5936
- function sr(e) {
6066
+ function pr(e) {
5937
6067
  switch (e.type) {
5938
6068
  case 'string':
5939
6069
  return {
@@ -5988,11 +6118,11 @@ function sr(e) {
5988
6118
  return { type: 'string', description: e.description };
5989
6119
  }
5990
6120
  }
5991
- function or(e, t) {
6121
+ function dr(e, t) {
5992
6122
  let i = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
5993
6123
  r = {},
5994
6124
  n = [];
5995
- for (let o of e.parameters) ((r[o.name] = sr(o)), o.required && n.push(o.name));
6125
+ for (let o of e.parameters) ((r[o.name] = pr(o)), o.required && n.push(o.name));
5996
6126
  let s = {
5997
6127
  type: 'object',
5998
6128
  properties: r,
@@ -6005,11 +6135,11 @@ function or(e, t) {
6005
6135
  inputSchema: s,
6006
6136
  };
6007
6137
  }
6008
- function lr() {
6009
- let e = E().filter((c) => c.category === 'Image'),
6010
- t = E().filter((c) => c.category === 'Video'),
6011
- i = E().filter((c) => c.category === 'Text'),
6012
- r = E().filter((c) => c.category === 'Audio'),
6138
+ function cr() {
6139
+ let e = q().filter((d) => d.category === 'Image'),
6140
+ t = q().filter((d) => d.category === 'Video'),
6141
+ i = q().filter((d) => d.category === 'Text'),
6142
+ r = q().filter((d) => d.category === 'Audio'),
6013
6143
  n = {
6014
6144
  name: 'generate_image',
6015
6145
  description:
@@ -6023,7 +6153,7 @@ function lr() {
6023
6153
  },
6024
6154
  model: {
6025
6155
  type: 'string',
6026
- enum: e.map((c) => c.slug),
6156
+ enum: e.map((d) => d.slug),
6027
6157
  default: 'gpt-image-2',
6028
6158
  description: 'The image model to use (default: gpt-image-2).',
6029
6159
  },
@@ -6101,7 +6231,7 @@ function lr() {
6101
6231
  maximum: 2147483647,
6102
6232
  description: 'Nano Banana 2 and Nano Banana Pro. Omit it for a new image each time.',
6103
6233
  },
6104
- creative_mode: { type: 'boolean', default: !1, description: At('image') },
6234
+ creative_mode: { type: 'boolean', default: !1, description: Rt('image') },
6105
6235
  },
6106
6236
  required: ['prompt'],
6107
6237
  additionalProperties: !0,
@@ -6121,7 +6251,7 @@ function lr() {
6121
6251
  },
6122
6252
  model: {
6123
6253
  type: 'string',
6124
- enum: t.map((c) => c.slug),
6254
+ enum: t.map((d) => d.slug),
6125
6255
  default: 'seedance-2-5',
6126
6256
  description: 'The video model to use (default: seedance-2-5).',
6127
6257
  },
@@ -6138,7 +6268,7 @@ function lr() {
6138
6268
  default: '480p',
6139
6269
  description: 'Video resolution (the lowest price is the default; see each model tool).',
6140
6270
  },
6141
- creative_mode: { type: 'boolean', default: !1, description: At('video') },
6271
+ creative_mode: { type: 'boolean', default: !1, description: Rt('video') },
6142
6272
  priority: {
6143
6273
  type: 'boolean',
6144
6274
  default: !1,
@@ -6206,7 +6336,7 @@ function lr() {
6206
6336
  prompt: { type: 'string', description: 'The reasoning task or query to execute.' },
6207
6337
  model: {
6208
6338
  type: 'string',
6209
- enum: i.map((c) => c.slug),
6339
+ enum: i.map((d) => d.slug),
6210
6340
  default: 'gpt-6-astra',
6211
6341
  description: 'The reasoning model to use (default: gpt-6-astra).',
6212
6342
  },
@@ -6227,7 +6357,7 @@ function lr() {
6227
6357
  additionalProperties: !0,
6228
6358
  },
6229
6359
  },
6230
- p = {
6360
+ l = {
6231
6361
  name: 'generate_mesh',
6232
6362
  description: 'Split an image into layers with Seedream 5.0 Pro (layer decomposition).',
6233
6363
  inputSchema: {
@@ -6244,7 +6374,7 @@ function lr() {
6244
6374
  additionalProperties: !0,
6245
6375
  },
6246
6376
  },
6247
- l = {
6377
+ c = {
6248
6378
  name: 'get_generation_status',
6249
6379
  description:
6250
6380
  'Check the progress and retrieve final output URLs for any in-progress generation using its request_id.',
@@ -6260,10 +6390,10 @@ function lr() {
6260
6390
  additionalProperties: !0,
6261
6391
  },
6262
6392
  },
6263
- d = pr();
6264
- return [n, s, o, u, p, d, l, rr];
6393
+ p = ur();
6394
+ return [n, s, o, u, l, p, c, sr];
6265
6395
  }
6266
- function pr() {
6396
+ function ur() {
6267
6397
  return {
6268
6398
  name: 'upload_asset',
6269
6399
  description:
@@ -6310,26 +6440,26 @@ function pr() {
6310
6440
  },
6311
6441
  };
6312
6442
  }
6313
- function Le() {
6314
- let e = lr(),
6315
- t = E().map((i) => or(i));
6316
- return [...e, ...t].map(ar).map(nr);
6443
+ function Ve() {
6444
+ let e = cr(),
6445
+ t = q().map((i) => dr(i));
6446
+ return [...e, ...t].map(or).map(lr);
6317
6447
  }
6318
- var tr,
6319
- ir,
6320
- rr,
6321
- Rt,
6322
- Ot = y(() => {
6448
+ var ar,
6449
+ nr,
6450
+ sr,
6451
+ Ot,
6452
+ Dt = b(() => {
6323
6453
  'use strict';
6324
- L();
6325
- Te();
6326
- W();
6327
- ((tr = {
6454
+ V();
6455
+ Me();
6456
+ z();
6457
+ ((ar = {
6328
6458
  type: 'string',
6329
6459
  description:
6330
6460
  '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.',
6331
6461
  }),
6332
- (ir = new Set([
6462
+ (nr = new Set([
6333
6463
  'upload_asset',
6334
6464
  'upload_media',
6335
6465
  'upload_image',
@@ -6337,7 +6467,7 @@ var tr,
6337
6467
  'check_status',
6338
6468
  'get_pricing',
6339
6469
  ])),
6340
- (rr = {
6470
+ (sr = {
6341
6471
  name: 'get_pricing',
6342
6472
  description:
6343
6473
  '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.',
@@ -6352,7 +6482,7 @@ var tr,
6352
6482
  additionalProperties: !1,
6353
6483
  },
6354
6484
  }));
6355
- Rt = new Set([
6485
+ Ot = new Set([
6356
6486
  'image',
6357
6487
  'images',
6358
6488
  'image_url',
@@ -6369,19 +6499,19 @@ var tr,
6369
6499
  'lipsyncing_audio',
6370
6500
  ]);
6371
6501
  });
6372
- var Jt = {};
6373
- ei(Jt, {
6374
- forgetToolSchemas: () => fr,
6375
- jsonRpcAnswer: () => Nt,
6376
- preprocessLocalFiles: () => Ft,
6377
- startStdioServer: () => Gt,
6502
+ var Ht = {};
6503
+ ti(Ht, {
6504
+ forgetToolSchemas: () => yr,
6505
+ jsonRpcAnswer: () => Ut,
6506
+ preprocessLocalFiles: () => Gt,
6507
+ startStdioServer: () => Jt,
6378
6508
  });
6379
- function dr(e) {
6509
+ function mr(e) {
6380
6510
  let t = (i) =>
6381
6511
  !!i && typeof i == 'object' && i.jsonrpc === '2.0' && ('result' in i || 'error' in i);
6382
6512
  return Array.isArray(e) ? e.length > 0 && e.every(t) : t(e);
6383
6513
  }
6384
- function Nt(e, t, i) {
6514
+ function Ut(e, t, i) {
6385
6515
  let r = e?.id,
6386
6516
  n = r == null,
6387
6517
  s = null;
@@ -6390,7 +6520,7 @@ function Nt(e, t, i) {
6390
6520
  } catch {
6391
6521
  s = null;
6392
6522
  }
6393
- if (s !== null && dr(s)) return n ? null : s;
6523
+ if (s !== null && mr(s)) return n ? null : s;
6394
6524
  if (n) return null;
6395
6525
  if (!i && t >= 200 && t < 300) return;
6396
6526
  let o = s?.error,
@@ -6400,60 +6530,60 @@ function Nt(e, t, i) {
6400
6530
  : o && typeof o == 'object' && typeof o.message == 'string'
6401
6531
  ? o.message
6402
6532
  : `Tein answered with HTTP ${t}.`,
6403
- p = o && typeof o == 'object' && typeof o.code == 'string' ? o.code : null;
6533
+ l = o && typeof o == 'object' && typeof o.code == 'string' ? o.code : null;
6404
6534
  return {
6405
6535
  jsonrpc: '2.0',
6406
6536
  id: r,
6407
6537
  error: {
6408
6538
  code: t === 401 ? -32001 : -32603,
6409
6539
  message: u,
6410
- data: { status: t, ...(p ? { code: p } : {}) },
6540
+ data: { status: t, ...(l ? { code: l } : {}) },
6411
6541
  },
6412
6542
  };
6413
6543
  }
6414
- function cr() {
6544
+ function fr() {
6415
6545
  let e = process.argv.slice(2),
6416
6546
  t = e.indexOf('--api-key');
6417
- return K(t >= 0 ? e[t + 1] : void 0);
6547
+ return S(t >= 0 ? e[t + 1] : void 0);
6418
6548
  }
6419
- async function Ut(e, t, i) {
6420
- let r = N.default.resolve(e);
6421
- if (!A.default.existsSync(r) || !A.default.statSync(r).isFile())
6549
+ async function jt(e, t, i) {
6550
+ let r = U.default.resolve(e);
6551
+ if (!R.default.existsSync(r) || !R.default.statSync(r).isFile())
6422
6552
  throw new Error(`File not found: ${e}`);
6423
- let n = A.default.readFileSync(r),
6553
+ let n = R.default.readFileSync(r),
6424
6554
  s = n.toString('base64'),
6425
6555
  o = n.length,
6426
6556
  u = `${i.replace(/\/$/, '')}/v1/upload`,
6427
- p = await fetch(u, {
6557
+ l = await fetch(u, {
6428
6558
  method: 'POST',
6429
6559
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${t}` },
6430
6560
  body: JSON.stringify({ data: s }),
6431
6561
  });
6432
- if (!p.ok) {
6433
- let d = `Upload failed (HTTP ${p.status})`;
6562
+ if (!l.ok) {
6563
+ let p = `Upload failed (HTTP ${l.status})`;
6434
6564
  try {
6435
- let c = await p.json();
6436
- d = (typeof c.error == 'string' ? c.error : c.error?.message) || c.message || d;
6565
+ let d = await l.json();
6566
+ p = (typeof d.error == 'string' ? d.error : d.error?.message) || d.message || p;
6437
6567
  } catch {}
6438
- throw new Error(d);
6568
+ throw new Error(p);
6439
6569
  }
6440
- let l = await p.json();
6570
+ let c = await l.json();
6441
6571
  return {
6442
- url: l.url,
6443
- key: l.key,
6444
- sizeBytes: l.size_bytes || o,
6445
- mimeType: l.mime_type || l.mimeType || 'image/png',
6572
+ url: c.url,
6573
+ key: c.key,
6574
+ sizeBytes: c.size_bytes || o,
6575
+ mimeType: c.mime_type || c.mimeType || 'image/png',
6446
6576
  };
6447
6577
  }
6448
- function jt(e) {
6449
- return ur.has(N.default.extname(e).toLowerCase());
6450
- }
6451
6578
  function Bt(e) {
6579
+ return gr.has(U.default.extname(e).toLowerCase());
6580
+ }
6581
+ function Ft(e) {
6452
6582
  return new Error(
6453
- `Tein uploads image, video and audio files only, and ${N.default.basename(e)} is not one.`,
6583
+ `Tein uploads image, video and audio files only, and ${U.default.basename(e)} is not one.`,
6454
6584
  );
6455
6585
  }
6456
- function mr(e) {
6586
+ function hr(e) {
6457
6587
  let t = e.trim();
6458
6588
  if (
6459
6589
  !t ||
@@ -6463,10 +6593,10 @@ function mr(e) {
6463
6593
  `)
6464
6594
  )
6465
6595
  return null;
6466
- let i = N.default.resolve(t);
6467
- return A.default.existsSync(i) && A.default.statSync(i).isFile() ? i : null;
6596
+ let i = U.default.resolve(t);
6597
+ return R.default.existsSync(i) && R.default.statSync(i).isFile() ? i : null;
6468
6598
  }
6469
- function Ne(e) {
6599
+ function Ue(e) {
6470
6600
  if (Array.isArray(e))
6471
6601
  for (let t of e) {
6472
6602
  let i = t;
@@ -6476,12 +6606,12 @@ function Ne(e) {
6476
6606
  Q.set(i.name, i.inputSchema);
6477
6607
  }
6478
6608
  }
6479
- function fr() {
6480
- (Q.clear(), (Ve = 0));
6609
+ function yr() {
6610
+ (Q.clear(), (Ne = 0));
6481
6611
  }
6482
- async function gr(e, t) {
6483
- if (!(Date.now() - Ve < 6e4)) {
6484
- Ve = Date.now();
6612
+ async function br(e, t) {
6613
+ if (!(Date.now() - Ne < 6e4)) {
6614
+ Ne = Date.now();
6485
6615
  try {
6486
6616
  let r = await (
6487
6617
  await fetch(e, {
@@ -6491,39 +6621,39 @@ async function gr(e, t) {
6491
6621
  signal: AbortSignal.timeout(1e4),
6492
6622
  })
6493
6623
  ).json();
6494
- Ne(r.result?.tools);
6624
+ Ue(r.result?.tools);
6495
6625
  } catch {}
6496
6626
  }
6497
6627
  }
6498
- function hr(e) {
6628
+ function wr(e) {
6499
6629
  return e
6500
6630
  ? e.type === 'string'
6501
6631
  ? e.format === 'uri'
6502
6632
  : e.type === 'array' && e.items?.format === 'uri'
6503
6633
  : !1;
6504
6634
  }
6505
- async function Dt(e, t, i) {
6635
+ async function Lt(e, t, i) {
6506
6636
  if (typeof e != 'string') return e;
6507
- let r = mr(e);
6637
+ let r = hr(e);
6508
6638
  if (!r) return e;
6509
- if (!jt(r)) throw Bt(r);
6510
- return (await Ut(r, t, i)).url;
6639
+ if (!Bt(r)) throw Ft(r);
6640
+ return (await jt(r, t, i)).url;
6511
6641
  }
6512
- async function Ft(e, t, i, r, n) {
6513
- (Q.size === 0 && Ne(Le()), Q.has(e) || (await gr(n, i)));
6642
+ async function Gt(e, t, i, r, n) {
6643
+ (Q.size === 0 && Ue(Ve()), Q.has(e) || (await br(n, i)));
6514
6644
  let s = Q.get(e)?.properties;
6515
6645
  if (!s) return t;
6516
6646
  let o = { ...t };
6517
- for (let [u, p] of Object.entries(t))
6518
- if (hr(s[u]))
6519
- if (Array.isArray(p)) {
6520
- let l = [];
6521
- for (let d of p) l.push(await Dt(d, i, r));
6522
- o[u] = l;
6523
- } else o[u] = await Dt(p, i, r);
6647
+ for (let [u, l] of Object.entries(t))
6648
+ if (wr(s[u]))
6649
+ if (Array.isArray(l)) {
6650
+ let c = [];
6651
+ for (let p of l) c.push(await Lt(p, i, r));
6652
+ o[u] = c;
6653
+ } else o[u] = await Lt(l, i, r);
6524
6654
  return o;
6525
6655
  }
6526
- function yr(e) {
6656
+ function kr(e) {
6527
6657
  let t = e.id ?? null;
6528
6658
  switch (e.method) {
6529
6659
  case 'initialize':
@@ -6541,7 +6671,7 @@ function yr(e) {
6541
6671
  case 'ping':
6542
6672
  return { jsonrpc: '2.0', id: t, result: {} };
6543
6673
  case 'tools/list':
6544
- return { jsonrpc: '2.0', id: t, result: { tools: Le() } };
6674
+ return { jsonrpc: '2.0', id: t, result: { tools: Ve() } };
6545
6675
  case 'tools/call':
6546
6676
  return {
6547
6677
  jsonrpc: '2.0',
@@ -6564,13 +6694,13 @@ function yr(e) {
6564
6694
  };
6565
6695
  }
6566
6696
  }
6567
- async function Gt() {
6568
- if (Lt) return;
6569
- Lt = !0;
6570
- let e = cr(),
6571
- t = k(),
6697
+ async function Jt() {
6698
+ if (Vt) return;
6699
+ Vt = !0;
6700
+ let e = fr(),
6701
+ t = x(),
6572
6702
  i = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
6573
- (Vt.default
6703
+ (Nt.default
6574
6704
  .createInterface({ input: process.stdin, output: process.stdout, terminal: !1 })
6575
6705
  .on('line', async (n) => {
6576
6706
  let s = n.trim();
@@ -6578,14 +6708,14 @@ async function Gt() {
6578
6708
  try {
6579
6709
  let o = JSON.parse(s);
6580
6710
  if (o && o.method === 'tools/call' && o.params) {
6581
- let p = o.params.name,
6582
- l = o.params.arguments || {};
6583
- if (p === 'get_pricing') {
6584
- let d = typeof l.model == 'string' ? l.model.trim() : '',
6585
- c = `${t.replace(/\/+$/, '')}${ce(d)}`;
6711
+ let l = o.params.name,
6712
+ c = o.params.arguments || {};
6713
+ if (l === 'get_pricing') {
6714
+ let p = typeof c.model == 'string' ? c.model.trim() : '',
6715
+ d = `${t.replace(/\/+$/, '')}${ce(p)}`;
6586
6716
  try {
6587
- let m = await fetch(c, { signal: AbortSignal.timeout(1e4) }),
6588
- f = await m.text();
6717
+ let m = await fetch(d, { signal: AbortSignal.timeout(1e4) }),
6718
+ h = await m.text();
6589
6719
  process.stdout.write(
6590
6720
  JSON.stringify({
6591
6721
  jsonrpc: '2.0',
@@ -6594,7 +6724,7 @@ async function Gt() {
6594
6724
  content: [
6595
6725
  {
6596
6726
  type: 'text',
6597
- text: m.ok ? f : `Pricing request failed (${m.status}). ${f}`,
6727
+ text: m.ok ? h : `Pricing request failed (${m.status}). ${h}`,
6598
6728
  },
6599
6729
  ],
6600
6730
  isError: !m.ok,
@@ -6604,13 +6734,13 @@ async function Gt() {
6604
6734
  `,
6605
6735
  );
6606
6736
  } catch (m) {
6607
- let f = m instanceof Error ? m.message : String(m);
6737
+ let h = m instanceof Error ? m.message : String(m);
6608
6738
  process.stdout.write(
6609
6739
  JSON.stringify({
6610
6740
  jsonrpc: '2.0',
6611
6741
  id: o.id,
6612
6742
  result: {
6613
- content: [{ type: 'text', text: `Could not reach Tein prices: ${f}` }],
6743
+ content: [{ type: 'text', text: `Could not reach Tein prices: ${h}` }],
6614
6744
  isError: !0,
6615
6745
  },
6616
6746
  }) +
@@ -6620,20 +6750,20 @@ async function Gt() {
6620
6750
  }
6621
6751
  return;
6622
6752
  }
6623
- if (p === 'upload_asset' || p === 'upload_media' || p === 'upload_image') {
6624
- let d = l.path || l.filepath || l.file_path || l.file || l.data;
6753
+ if (l === 'upload_asset' || l === 'upload_media' || l === 'upload_image') {
6754
+ let p = c.path || c.filepath || c.file_path || c.file || c.data;
6625
6755
  if (
6626
- typeof d == 'string' &&
6627
- !d.startsWith('http://') &&
6628
- !d.startsWith('https://') &&
6629
- !d.startsWith('data:')
6756
+ typeof p == 'string' &&
6757
+ !p.startsWith('http://') &&
6758
+ !p.startsWith('https://') &&
6759
+ !p.startsWith('data:')
6630
6760
  )
6631
6761
  try {
6632
- let c = N.default.resolve(d.trim());
6633
- if (A.default.existsSync(c) && A.default.statSync(c).isFile() && e) {
6634
- if (!jt(c)) throw Bt(c);
6635
- let m = await Ut(c, e, t),
6636
- f = (m.sizeBytes / 1024).toFixed(1),
6762
+ let d = U.default.resolve(p.trim());
6763
+ if (R.default.existsSync(d) && R.default.statSync(d).isFile() && e) {
6764
+ if (!Bt(d)) throw Ft(d);
6765
+ let m = await jt(d, e, t),
6766
+ h = (m.sizeBytes / 1024).toFixed(1),
6637
6767
  ue =
6638
6768
  m.mimeType.startsWith('image/') ||
6639
6769
  /\.(png|jpe?g|webp|gif|svg)$/i.test(m.url)
@@ -6641,7 +6771,7 @@ async function Gt() {
6641
6771
 
6642
6772
  ![Uploaded Asset](${m.url})`
6643
6773
  : '',
6644
- h = {
6774
+ me = {
6645
6775
  jsonrpc: '2.0',
6646
6776
  id: o.id,
6647
6777
  result: {
@@ -6652,7 +6782,7 @@ async function Gt() {
6652
6782
 
6653
6783
  - **URL:** ${m.url}
6654
6784
  - **Type:** \`${m.mimeType}\`
6655
- - **Size:** ${f} KB${ue}
6785
+ - **Size:** ${h} KB${ue}
6656
6786
 
6657
6787
  Pass this URL to any Tein generation tool.`,
6658
6788
  },
@@ -6661,14 +6791,14 @@ Pass this URL to any Tein generation tool.`,
6661
6791
  },
6662
6792
  };
6663
6793
  process.stdout.write(
6664
- JSON.stringify(h) +
6794
+ JSON.stringify(me) +
6665
6795
  `
6666
6796
  `,
6667
6797
  );
6668
6798
  return;
6669
6799
  }
6670
- } catch (c) {
6671
- let m = c instanceof Error ? c.message : String(c);
6800
+ } catch (d) {
6801
+ let m = d instanceof Error ? d.message : String(d);
6672
6802
  process.stdout.write(
6673
6803
  JSON.stringify({
6674
6804
  jsonrpc: '2.0',
@@ -6688,9 +6818,9 @@ Pass this URL to any Tein generation tool.`,
6688
6818
  }
6689
6819
  if (e)
6690
6820
  try {
6691
- o.params.arguments = await Ft(String(p), l, e, t, i);
6692
- } catch (d) {
6693
- let c = d instanceof Error ? d.message : String(d);
6821
+ o.params.arguments = await Gt(String(l), c, e, t, i);
6822
+ } catch (p) {
6823
+ let d = p instanceof Error ? p.message : String(p);
6694
6824
  process.stdout.write(
6695
6825
  JSON.stringify({
6696
6826
  jsonrpc: '2.0',
@@ -6699,7 +6829,7 @@ Pass this URL to any Tein generation tool.`,
6699
6829
  content: [
6700
6830
  {
6701
6831
  type: 'text',
6702
- text: `Failed to read or upload a local file before calling Tein: ${c}`,
6832
+ text: `Failed to read or upload a local file before calling Tein: ${d}`,
6703
6833
  },
6704
6834
  ],
6705
6835
  isError: !0,
@@ -6713,25 +6843,25 @@ Pass this URL to any Tein generation tool.`,
6713
6843
  }
6714
6844
  if (e)
6715
6845
  try {
6716
- let p = await fetch(i, {
6846
+ let l = await fetch(i, {
6717
6847
  method: 'POST',
6718
6848
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${e}` },
6719
6849
  body: JSON.stringify(o),
6720
6850
  }),
6721
- l = await p.text(),
6722
- d = Nt(o, p.status, l);
6723
- if (d === null) return;
6724
- if (d) {
6725
- (o?.method === 'tools/list' && Ne(d.result?.tools),
6851
+ c = await l.text(),
6852
+ p = Ut(o, l.status, c);
6853
+ if (p === null) return;
6854
+ if (p) {
6855
+ (o?.method === 'tools/list' && Ue(p.result?.tools),
6726
6856
  process.stdout.write(
6727
- JSON.stringify(d) +
6857
+ JSON.stringify(p) +
6728
6858
  `
6729
6859
  `,
6730
6860
  ));
6731
6861
  return;
6732
6862
  }
6733
6863
  } catch {}
6734
- let u = yr(o);
6864
+ let u = kr(o);
6735
6865
  u !== null &&
6736
6866
  process.stdout.write(
6737
6867
  JSON.stringify(u) +
@@ -6754,22 +6884,22 @@ Pass this URL to any Tein generation tool.`,
6754
6884
  process.stderr.write(`Tein AI MCP Server running on stdio transport.
6755
6885
  `));
6756
6886
  }
6757
- var A,
6758
- N,
6759
- Vt,
6760
- ur,
6887
+ var R,
6888
+ U,
6889
+ Nt,
6890
+ gr,
6761
6891
  Q,
6762
- Ve,
6763
- Lt,
6764
- Ht = y(() => {
6892
+ Ne,
6893
+ Vt,
6894
+ zt = b(() => {
6765
6895
  'use strict';
6766
- ((A = v(require('node:fs'))),
6767
- (N = v(require('node:path'))),
6768
- (Vt = v(require('node:readline'))));
6769
- Ee();
6770
- Ot();
6771
- C();
6772
- ur = new Set([
6896
+ ((R = I(require('node:fs'))),
6897
+ (U = I(require('node:path'))),
6898
+ (Nt = I(require('node:readline'))));
6899
+ qe();
6900
+ Dt();
6901
+ E();
6902
+ gr = new Set([
6773
6903
  '.png',
6774
6904
  '.jpg',
6775
6905
  '.jpeg',
@@ -6795,42 +6925,42 @@ var A,
6795
6925
  '.flac',
6796
6926
  '.opus',
6797
6927
  ]);
6798
- ((Q = new Map()), (Ve = 0));
6799
- Lt = !1;
6928
+ ((Q = new Map()), (Ne = 0));
6929
+ Vt = !1;
6800
6930
  require.main === module &&
6801
- Gt().catch((e) => {
6931
+ Jt().catch((e) => {
6802
6932
  (process.stderr.write(`Fatal error in Tein MCP CLI: ${e}
6803
6933
  `),
6804
6934
  process.exit(1));
6805
6935
  });
6806
6936
  });
6807
- var ii =
6937
+ var ri =
6808
6938
  !process.env.NO_COLOR &&
6809
6939
  (process.stdout.isTTY || process.env.FORCE_COLOR === '1' || process.env.TERM !== 'dumb');
6810
- function b(e, t) {
6811
- return (i) => (ii ? `\x1B[${e}m${i}\x1B[${t}m` : String(i));
6940
+ function w(e, t) {
6941
+ return (i) => (ri ? `\x1B[${e}m${i}\x1B[${t}m` : String(i));
6812
6942
  }
6813
6943
  var a = {
6814
- bold: b(1, 22),
6815
- dim: b(2, 22),
6816
- italic: b(3, 23),
6817
- underline: b(4, 24),
6818
- inverse: b(7, 27),
6819
- black: b(30, 39),
6820
- red: b(31, 39),
6821
- green: b(32, 39),
6822
- yellow: b(33, 39),
6823
- blue: b(34, 39),
6824
- magenta: b(35, 39),
6825
- cyan: b(36, 39),
6826
- white: b(37, 39),
6827
- gray: b(90, 39),
6828
- bgBlue: b(44, 49),
6829
- bgMagenta: b(45, 49),
6830
- bgCyan: b(46, 49),
6831
- bgGreen: b(42, 49),
6944
+ bold: w(1, 22),
6945
+ dim: w(2, 22),
6946
+ italic: w(3, 23),
6947
+ underline: w(4, 24),
6948
+ inverse: w(7, 27),
6949
+ black: w(30, 39),
6950
+ red: w(31, 39),
6951
+ green: w(32, 39),
6952
+ yellow: w(33, 39),
6953
+ blue: w(34, 39),
6954
+ magenta: w(35, 39),
6955
+ cyan: w(36, 39),
6956
+ white: w(37, 39),
6957
+ gray: w(90, 39),
6958
+ bgBlue: w(44, 49),
6959
+ bgMagenta: w(45, 49),
6960
+ bgCyan: w(46, 49),
6961
+ bgGreen: w(42, 49),
6832
6962
  },
6833
- P = class {
6963
+ T = class {
6834
6964
  constructor(t = '') {
6835
6965
  this.frames = [
6836
6966
  '\u280B',
@@ -6892,22 +7022,22 @@ var a = {
6892
7022
  process.stdout.isTTY && process.stdout.write('\r\x1B[K'));
6893
7023
  }
6894
7024
  };
6895
- var R = v(require('node:fs')),
6896
- q = v(require('node:path'));
6897
- var ee = v(require('node:fs')),
6898
- Be = v(require('node:path')),
6899
- Fe = require('node:stream/promises');
7025
+ var O = I(require('node:fs')),
7026
+ A = I(require('node:path'));
7027
+ var ee = I(require('node:fs')),
7028
+ Fe = I(require('node:path')),
7029
+ Ge = require('node:stream/promises');
6900
7030
  var Z = '1.1.7';
6901
- var ri = new Set([
7031
+ var ai = new Set([
6902
7032
  'account_suspended',
6903
7033
  'account_terminated',
6904
7034
  'creative_mode_restricted',
6905
7035
  'unfiltered_restricted',
6906
7036
  'workspace_paused',
6907
7037
  ]),
6908
- I = 1,
6909
- ai = 3,
6910
- w = class extends Error {
7038
+ _ = 1,
7039
+ ni = 3,
7040
+ k = class extends Error {
6911
7041
  constructor(t, i, r, n = {}) {
6912
7042
  (super(i),
6913
7043
  (this.name = 'TeinApiError'),
@@ -6916,29 +7046,29 @@ var ri = new Set([
6916
7046
  (this.fields = n));
6917
7047
  }
6918
7048
  get exitCode() {
6919
- return this.code && ri.has(this.code) ? ai : I;
7049
+ return this.code && ai.has(this.code) ? ni : _;
6920
7050
  }
6921
7051
  };
6922
- function ni(e, t, i) {
7052
+ function si(e, t, i) {
6923
7053
  let r = `HTTP ${e}${t ? ` ${t}` : ''}`;
6924
- if (!i || typeof i != 'object') return new w(e, r);
7054
+ if (!i || typeof i != 'object') return new k(e, r);
6925
7055
  let n = i;
6926
7056
  if (n.error && typeof n.error == 'object' && !Array.isArray(n.error)) {
6927
- let d = n.error,
6928
- { code: c, message: m, ...f } = d;
6929
- return new w(e, typeof m == 'string' && m ? m : r, typeof c == 'string' ? c : void 0, f);
7057
+ let p = n.error,
7058
+ { code: d, message: m, ...h } = p;
7059
+ return new k(e, typeof m == 'string' && m ? m : r, typeof d == 'string' ? d : void 0, h);
6930
7060
  }
6931
- let { error: s, code: o, message: u, ...p } = n,
6932
- l = (typeof s == 'string' && s) || (typeof u == 'string' && u) || r;
6933
- return new w(e, l, typeof o == 'string' ? o : void 0, p);
7061
+ let { error: s, code: o, message: u, ...l } = n,
7062
+ c = (typeof s == 'string' && s) || (typeof u == 'string' && u) || r;
7063
+ return new k(e, c, typeof o == 'string' ? o : void 0, l);
6934
7064
  }
6935
- function Ue(e) {
7065
+ function je(e) {
6936
7066
  return typeof e == 'number' && Number.isFinite(e) ? `$${e.toFixed(4)}` : null;
6937
7067
  }
6938
- function M(e) {
7068
+ function K(e) {
6939
7069
  let t = [e.message],
6940
- i = Ue(e.fields.required),
6941
- r = Ue(e.fields.balance);
7070
+ i = je(e.fields.required),
7071
+ r = je(e.fields.balance);
6942
7072
  (i || r) &&
6943
7073
  t.push([i ? `Required: ${i}` : '', r ? `Balance: ${r}` : ''].filter(Boolean).join(' '));
6944
7074
  let n = e.fields.org_name ?? e.fields.orgName;
@@ -6946,22 +7076,22 @@ function M(e) {
6946
7076
  let s = e.fields.url ?? e.fields.appeal_url ?? e.fields.top_up_url;
6947
7077
  return (typeof s == 'string' && s && t.push(s), e.code && t.push(`(${e.code})`), t);
6948
7078
  }
6949
- function si(e) {
7079
+ function oi(e) {
6950
7080
  return /\.(mp4|webm|mov)(\?|$)/i.test(e)
6951
7081
  ? 'video'
6952
7082
  : /\.(mp3|wav|ogg|flac)(\?|$)/i.test(e)
6953
7083
  ? 'audio'
6954
7084
  : 'image';
6955
7085
  }
6956
- function je(e) {
7086
+ function Be(e) {
6957
7087
  let t = [];
6958
7088
  for (let i of e.data ?? [])
6959
7089
  typeof i.message?.content == 'string'
6960
7090
  ? t.push({ type: 'text', text: i.message.content })
6961
- : i.url && t.push({ type: si(i.url), url: i.url });
7091
+ : i.url && t.push({ type: oi(i.url), url: i.url });
6962
7092
  return t;
6963
7093
  }
6964
- var T = class {
7094
+ var M = class {
6965
7095
  constructor(t, i) {
6966
7096
  ((this.apiKey = t), (this.baseUrl = i.replace(/\/+$/, '')));
6967
7097
  }
@@ -6984,7 +7114,7 @@ var T = class {
6984
7114
  try {
6985
7115
  s = await n.json();
6986
7116
  } catch {}
6987
- throw ni(n.status, n.statusText, s);
7117
+ throw si(n.status, n.statusText, s);
6988
7118
  }
6989
7119
  return await n.json();
6990
7120
  }
@@ -6998,7 +7128,7 @@ var T = class {
6998
7128
  n === 'succeeded' || n === 'failed' || n === 'expired' || n === 'cancelled'
6999
7129
  ? n
7000
7130
  : 'processing',
7001
- o = je(r);
7131
+ o = Be(r);
7002
7132
  return {
7003
7133
  request_id: r.request_id || r.id || '',
7004
7134
  model: r.model,
@@ -7016,7 +7146,7 @@ var T = class {
7016
7146
  r === 'succeeded' || r === 'failed' || r === 'expired' || r === 'cancelled'
7017
7147
  ? r
7018
7148
  : 'processing',
7019
- s = je(i),
7149
+ s = Be(i),
7020
7150
  o = i.error && typeof i.error.message == 'string' ? i.error.message : null;
7021
7151
  return {
7022
7152
  request_id: i.id || t,
@@ -7034,50 +7164,50 @@ var T = class {
7034
7164
  async downloadOutput(t, i) {
7035
7165
  let r = await fetch(t);
7036
7166
  if (!r.ok) throw new Error(`The file could not be downloaded (HTTP ${r.status})`);
7037
- let n = Be.default.dirname(i);
7167
+ let n = Fe.default.dirname(i);
7038
7168
  ee.default.existsSync(n) || ee.default.mkdirSync(n, { recursive: !0 });
7039
7169
  let s = ee.default.createWriteStream(i);
7040
- return (await (0, Fe.pipeline)(r.body, s), i);
7170
+ return (await (0, Ge.pipeline)(r.body, s), i);
7041
7171
  }
7042
7172
  };
7043
- C();
7044
- W();
7045
- var It = ['images', 'input_images', 'videos', 'audios'];
7046
- function Oi(e) {
7047
- for (let t of It) typeof e[t] == 'string' && (e[t] = [e[t]]);
7173
+ E();
7174
+ z();
7175
+ var _t = ['images', 'input_images', 'videos', 'audios'];
7176
+ function Vi(e) {
7177
+ for (let t of _t) typeof e[t] == 'string' && (e[t] = [e[t]]);
7048
7178
  }
7049
- function Di(e) {
7179
+ function Ni(e) {
7050
7180
  if (e.startsWith('http://') || e.startsWith('https://')) return null;
7051
- let t = q.default.resolve(e);
7052
- return R.default.existsSync(t) && R.default.statSync(t).isFile() ? t : null;
7181
+ let t = A.default.resolve(e);
7182
+ return O.default.existsSync(t) && O.default.statSync(t).isFile() ? t : null;
7053
7183
  }
7054
- async function Li(e, t) {
7055
- for (let i of It) {
7184
+ async function Ui(e, t) {
7185
+ for (let i of _t) {
7056
7186
  if (!Array.isArray(e[i])) continue;
7057
7187
  let r = [];
7058
7188
  for (let n of e[i]) {
7059
7189
  if (typeof n != 'string') continue;
7060
- let s = Di(n);
7190
+ let s = Ni(n);
7061
7191
  r.push(s ? await t(s) : n);
7062
7192
  }
7063
7193
  e[i] = r;
7064
7194
  }
7065
7195
  }
7066
- var z = { starter: 10, plus: 25, scale: 40, enterprise: 300 };
7067
- function Vi(e) {
7196
+ var W = { starter: 10, plus: 25, scale: 40, enterprise: 300 };
7197
+ function ji(e) {
7068
7198
  if (e.count === void 0 || e.count === !0) return 1;
7069
7199
  let t = typeof e.count == 'number' ? e.count : Number(e.count),
7070
- i = z.enterprise;
7200
+ i = W.enterprise;
7071
7201
  return (
7072
7202
  (!Number.isInteger(t) || t < 1 || t > i) &&
7073
7203
  (process.stderr
7074
- .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.
7204
+ .write(`${a.red('Error:')} --count must be a whole number from 1 to ${i}. The API allows Starter ${W.starter}, Plus ${W.plus}, Scale ${W.scale}, Enterprise ${W.enterprise} at once, including polling.
7075
7205
  `),
7076
7206
  process.exit(1)),
7077
7207
  t
7078
7208
  );
7079
7209
  }
7080
- async function Ni(e, t, i, r, n) {
7210
+ async function Bi(e, t, i, r, n) {
7081
7211
  n.isJson ||
7082
7212
  process.stderr.write(`Starting ${r} ${t} jobs together...
7083
7213
  `);
@@ -7085,51 +7215,51 @@ async function Ni(e, t, i, r, n) {
7085
7215
  Array.from({ length: r }, async () => {
7086
7216
  try {
7087
7217
  return { job: await e.queueJob(t, i) };
7088
- } catch (p) {
7089
- return { err: p };
7218
+ } catch (l) {
7219
+ return { err: l };
7090
7220
  }
7091
7221
  }),
7092
7222
  ),
7093
7223
  o = [],
7094
7224
  u = [];
7095
- for (let p of s)
7096
- 'job' in p && p.job
7097
- ? o.push(p.job)
7098
- : 'err' in p &&
7225
+ for (let l of s)
7226
+ 'job' in l && l.job
7227
+ ? o.push(l.job)
7228
+ : 'err' in l &&
7099
7229
  u.push(
7100
- p.err instanceof w
7101
- ? p.err
7102
- : new w(0, p.err instanceof Error ? p.err.message : String(p.err)),
7230
+ l.err instanceof k
7231
+ ? l.err
7232
+ : new k(0, l.err instanceof Error ? l.err.message : String(l.err)),
7103
7233
  );
7104
7234
  if (!n.isAsync) {
7105
- let p = Date.now(),
7106
- l = o.filter((d) => d.status === 'processing' && d.request_id);
7107
- for (; l.length;) {
7108
- if ((await new Promise((c) => setTimeout(c, 2e3)), !n.isJson)) {
7109
- let c = Math.round((Date.now() - p) / 1e3);
7110
- process.stderr.write(`Waiting on ${l.length} of ${r} (${c}s)...
7235
+ let l = Date.now(),
7236
+ c = o.filter((p) => p.status === 'processing' && p.request_id);
7237
+ for (; c.length;) {
7238
+ if ((await new Promise((d) => setTimeout(d, 2e3)), !n.isJson)) {
7239
+ let d = Math.round((Date.now() - l) / 1e3);
7240
+ process.stderr.write(`Waiting on ${c.length} of ${r} (${d}s)...
7111
7241
  `);
7112
7242
  }
7113
- let d = await Promise.all(
7114
- l.map(async (c) => {
7243
+ let p = await Promise.all(
7244
+ c.map(async (d) => {
7115
7245
  try {
7116
- return await e.getStatus(c.request_id);
7246
+ return await e.getStatus(d.request_id);
7117
7247
  } catch {
7118
- return c;
7248
+ return d;
7119
7249
  }
7120
7250
  }),
7121
7251
  );
7122
- for (let c of d) {
7123
- let m = o.findIndex((f) => f.request_id === c.request_id);
7124
- m >= 0 && (o[m] = c);
7252
+ for (let d of p) {
7253
+ let m = o.findIndex((h) => h.request_id === d.request_id);
7254
+ m >= 0 && (o[m] = d);
7125
7255
  }
7126
- l = o.filter((c) => c.status === 'processing' && c.request_id);
7256
+ c = o.filter((d) => d.status === 'processing' && d.request_id);
7127
7257
  }
7128
7258
  }
7129
7259
  if (n.isJson)
7130
7260
  process.stdout.write(
7131
7261
  JSON.stringify(
7132
- { jobs: o, errors: u.map((p) => ({ code: p.code ?? null, message: p.message })) },
7262
+ { jobs: o, errors: u.map((l) => ({ code: l.code ?? null, message: l.message })) },
7133
7263
  null,
7134
7264
  2,
7135
7265
  ) +
@@ -7137,22 +7267,22 @@ async function Ni(e, t, i, r, n) {
7137
7267
  `,
7138
7268
  );
7139
7269
  else {
7140
- for (let p of o)
7141
- (process.stdout.write(`${p.request_id} ${p.status}`),
7142
- p.usage?.cost !== void 0 && process.stdout.write(` $${p.usage.cost.toFixed(4)}`),
7143
- p.error && process.stdout.write(` ${p.error}`),
7270
+ for (let l of o)
7271
+ (process.stdout.write(`${l.request_id} ${l.status}`),
7272
+ l.usage?.cost !== void 0 && process.stdout.write(` $${l.usage.cost.toFixed(4)}`),
7273
+ l.error && process.stdout.write(` ${l.error}`),
7144
7274
  process.stdout.write(`
7145
7275
  `));
7146
- for (let p of u)
7147
- process.stderr.write(`${M(p).join(`
7276
+ for (let l of u)
7277
+ process.stderr.write(`${K(l).join(`
7148
7278
  `)}
7149
7279
  `);
7150
7280
  }
7151
7281
  (u.length ||
7152
- o.some((p) => p.status === 'failed' || p.status === 'expired' || p.status === 'cancelled')) &&
7153
- process.exit(I);
7282
+ o.some((l) => l.status === 'failed' || l.status === 'expired' || l.status === 'cancelled')) &&
7283
+ process.exit(_);
7154
7284
  }
7155
- function _t(e) {
7285
+ function Pt(e) {
7156
7286
  let t = {},
7157
7287
  i = new Set(),
7158
7288
  r = [];
@@ -7161,8 +7291,8 @@ function _t(e) {
7161
7291
  if (s.startsWith('--')) {
7162
7292
  let o = s.slice(2);
7163
7293
  if (o.includes('=')) {
7164
- let [u, p] = o.split('=', 2);
7165
- t[u.replace(/-/g, '_')] = p;
7294
+ let [u, l] = o.split('=', 2);
7295
+ t[u.replace(/-/g, '_')] = l;
7166
7296
  } else if (n + 1 < e.length && !e[n + 1].startsWith('-')) {
7167
7297
  let u = e[n + 1];
7168
7298
  (u === 'true'
@@ -7176,7 +7306,7 @@ function _t(e) {
7176
7306
  } else ((t[o.replace(/-/g, '_')] = !0), i.add(o));
7177
7307
  } else if (s.startsWith('-') && s.length === 2) {
7178
7308
  let o = s[1],
7179
- p =
7309
+ l =
7180
7310
  {
7181
7311
  p: 'prompt',
7182
7312
  o: 'output',
@@ -7189,17 +7319,17 @@ function _t(e) {
7189
7319
  v: 'version',
7190
7320
  }[o] || o;
7191
7321
  o === 'j' || o === 'h' || o === 'v'
7192
- ? ((t[p] = !0), i.add(p))
7322
+ ? ((t[l] = !0), i.add(l))
7193
7323
  : n + 1 < e.length && !e[n + 1].startsWith('-')
7194
- ? ((t[p] = e[n + 1]), n++)
7195
- : (t[p] = !0);
7324
+ ? ((t[l] = e[n + 1]), n++)
7325
+ : (t[l] = !0);
7196
7326
  } else r.push(s);
7197
7327
  }
7198
7328
  return { command: r[0] || '', subcommand: r[1], modelSlug: r[1] || r[0], options: t, flags: i };
7199
7329
  }
7200
- async function Ce(e, t) {
7201
- let i = K(typeof t.api_key == 'string' ? t.api_key : void 0),
7202
- r = k(typeof t.api_url == 'string' ? t.api_url : void 0);
7330
+ async function Ee(e, t) {
7331
+ let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
7332
+ r = x(typeof t.api_url == 'string' ? t.api_url : void 0);
7203
7333
  (i ||
7204
7334
  (process.stderr.write(`${a.red('Error:')} Authentication required.
7205
7335
  `),
@@ -7215,46 +7345,39 @@ async function Ce(e, t) {
7215
7345
  process.stderr.write(`Run ${a.cyan('tein models')} to list all available models.
7216
7346
  `),
7217
7347
  process.exit(1)));
7218
- let n = V(e),
7348
+ let n = N(e),
7219
7349
  s = !!t.json,
7220
7350
  o = !!(t.async || t.no_wait),
7221
7351
  u = typeof t.output == 'string' ? t.output : void 0,
7222
- p = Vi(t),
7223
- l = { ...t };
7224
- if (
7225
- (delete l.json,
7226
- delete l.async,
7227
- delete l.no_wait,
7228
- delete l.output,
7229
- delete l.api_key,
7230
- delete l.api_url,
7231
- delete l.count,
7232
- n?.parameters)
7233
- )
7234
- for (let h of n.parameters)
7235
- h.default !== void 0 &&
7236
- l[h.name] === void 0 &&
7237
- vt(n.slug, h.name, t) &&
7238
- (l[h.name] = h.default);
7239
- (Oi(l),
7240
- typeof l.image == 'string' && !l.images && ((l.images = [l.image]), delete l.image),
7241
- l.image_url &&
7242
- !l.first_frame_image &&
7352
+ l = ji(t),
7353
+ c = { ...t };
7354
+ (delete c.json,
7355
+ delete c.async,
7356
+ delete c.no_wait,
7357
+ delete c.output,
7358
+ delete c.api_key,
7359
+ delete c.api_url,
7360
+ delete c.count);
7361
+ let p = It(n, c);
7362
+ (Vi(p),
7363
+ typeof p.image == 'string' && !p.images && ((p.images = [p.image]), delete p.image),
7364
+ p.image_url &&
7365
+ !p.first_frame_image &&
7243
7366
  (e.startsWith('seedance') || e.startsWith('happy-horse')) &&
7244
- (l.first_frame_image = l.image_url));
7245
- let d = new T(i, r),
7246
- c = ['image', 'first_frame_image', 'last_frame_image', 'lipsyncing_audio', 'audio', 'video'];
7247
- for (let h of c) {
7248
- let g = l[h];
7249
- if (typeof g == 'string' && !g.startsWith('http://') && !g.startsWith('https://')) {
7250
- let x = q.default.resolve(g);
7251
- if (R.default.existsSync(x) && R.default.statSync(x).isFile()) {
7252
- let _ = new P(`Uploading local file ${q.default.basename(x)} to CDN...`);
7253
- s || _.start();
7367
+ (p.first_frame_image = p.image_url));
7368
+ let d = new M(i, r),
7369
+ m = ['image', 'first_frame_image', 'last_frame_image', 'lipsyncing_audio', 'audio', 'video'];
7370
+ for (let y of m) {
7371
+ let f = p[y];
7372
+ if (typeof f == 'string' && !f.startsWith('http://') && !f.startsWith('https://')) {
7373
+ let v = A.default.resolve(f);
7374
+ if (O.default.existsSync(v) && O.default.statSync(v).isFile()) {
7375
+ let P = new T(`Uploading local file ${A.default.basename(v)} to CDN...`);
7376
+ s || P.start();
7254
7377
  try {
7255
- let j = R.default.readFileSync(x),
7378
+ let j = O.default.readFileSync(v),
7256
7379
  X = await d.uploadAsset(j.toString('base64'));
7257
- ((l[h] = X.url), s || _.succeed(`Uploaded ${q.default.basename(x)} to CDN`));
7380
+ ((p[y] = X.url), s || P.succeed(`Uploaded ${A.default.basename(v)} to CDN`));
7258
7381
  } catch (j) {
7259
7382
  let X = j instanceof Error ? j.message : String(j);
7260
7383
  (s
@@ -7263,108 +7386,108 @@ async function Ce(e, t) {
7263
7386
  `
7264
7387
  `,
7265
7388
  )
7266
- : _.fail(`Upload failed: ${X}`),
7389
+ : P.fail(`Upload failed: ${X}`),
7267
7390
  process.exit(1));
7268
7391
  }
7269
7392
  }
7270
7393
  }
7271
7394
  }
7272
- await Li(l, async (h) => {
7273
- let g = new P(`Uploading local file ${q.default.basename(h)} to CDN...`);
7274
- s || g.start();
7395
+ await Ui(p, async (y) => {
7396
+ let f = new T(`Uploading local file ${A.default.basename(y)} to CDN...`);
7397
+ s || f.start();
7275
7398
  try {
7276
- let x = R.default.readFileSync(h),
7277
- _ = await d.uploadAsset(x.toString('base64'));
7278
- return (s || g.succeed(`Uploaded ${q.default.basename(h)} to CDN`), _.url);
7279
- } catch (x) {
7280
- let _ = x instanceof Error ? x.message : String(x);
7399
+ let v = O.default.readFileSync(y),
7400
+ P = await d.uploadAsset(v.toString('base64'));
7401
+ return (s || f.succeed(`Uploaded ${A.default.basename(y)} to CDN`), P.url);
7402
+ } catch (v) {
7403
+ let P = v instanceof Error ? v.message : String(v);
7281
7404
  (s
7282
7405
  ? process.stdout.write(
7283
- JSON.stringify({ error: _ }) +
7406
+ JSON.stringify({ error: P }) +
7284
7407
  `
7285
7408
  `,
7286
7409
  )
7287
- : g.fail(`Upload failed: ${_}`),
7410
+ : f.fail(`Upload failed: ${P}`),
7288
7411
  process.exit(1));
7289
7412
  }
7290
7413
  });
7291
- let m = new P(`Submitting task for ${a.bold(e)}...`);
7292
- s || m.start();
7293
- let f;
7414
+ let h = new T(`Submitting task for ${a.bold(e)}...`);
7415
+ s || h.start();
7416
+ let g;
7294
7417
  try {
7295
- if (p > 1) {
7296
- await Ni(d, e, l, p, { isJson: s, isAsync: o });
7418
+ if (l > 1) {
7419
+ await Bi(d, e, p, l, { isJson: s, isAsync: o });
7297
7420
  return;
7298
7421
  }
7299
- f = await d.queueJob(e, l);
7300
- } catch (h) {
7301
- let g = h instanceof w ? h : null;
7422
+ g = await d.queueJob(e, p);
7423
+ } catch (y) {
7424
+ let f = y instanceof k ? y : null;
7302
7425
  (s
7303
7426
  ? process.stdout.write(
7304
7427
  JSON.stringify(
7305
- g
7306
- ? { error: { code: g.code ?? null, message: g.message, ...g.fields } }
7307
- : { error: { code: null, message: h instanceof Error ? h.message : String(h) } },
7428
+ f
7429
+ ? { error: { code: f.code ?? null, message: f.message, ...f.fields } }
7430
+ : { error: { code: null, message: y instanceof Error ? y.message : String(y) } },
7308
7431
  null,
7309
7432
  2,
7310
7433
  ) +
7311
7434
  `
7312
7435
  `,
7313
7436
  )
7314
- : m.fail(
7315
- g
7316
- ? M(g).join(`
7437
+ : h.fail(
7438
+ f
7439
+ ? K(f).join(`
7317
7440
  `)
7318
- : `Failed to start generation: ${h instanceof Error ? h.message : h}`,
7441
+ : `Failed to start generation: ${y instanceof Error ? y.message : y}`,
7319
7442
  ),
7320
- process.exit(g ? g.exitCode : I));
7443
+ process.exit(f ? f.exitCode : _));
7321
7444
  }
7322
7445
  if (o) {
7323
7446
  s
7324
7447
  ? process.stdout.write(
7325
- JSON.stringify(f, null, 2) +
7448
+ JSON.stringify(g, null, 2) +
7326
7449
  `
7327
7450
  `,
7328
7451
  )
7329
- : (m.succeed(`Queued successfully! Request ID: ${a.bold(f.request_id)}`),
7330
- process.stdout.write(`Check status anytime with: ${a.cyan(`tein status ${f.request_id}`)}
7452
+ : (h.succeed(`Queued successfully! Request ID: ${a.bold(g.request_id)}`),
7453
+ process.stdout.write(`Check status anytime with: ${a.cyan(`tein status ${g.request_id}`)}
7331
7454
  `));
7332
7455
  return;
7333
7456
  }
7334
- let U = Date.now(),
7335
- ue = 1500;
7336
- for (; f.status === 'processing';) {
7337
- let h = Math.round((Date.now() - U) / 1e3);
7338
- (s || m.update(`Rendering ${a.bold(e)} (${h}s elapsed)... [ID: ${f.request_id}]`),
7339
- await new Promise((g) => setTimeout(g, ue)));
7457
+ let ue = Date.now(),
7458
+ me = 1500;
7459
+ for (; g.status === 'processing';) {
7460
+ let y = Math.round((Date.now() - ue) / 1e3);
7461
+ (s || h.update(`Rendering ${a.bold(e)} (${y}s elapsed)... [ID: ${g.request_id}]`),
7462
+ await new Promise((f) => setTimeout(f, me)));
7340
7463
  try {
7341
- f = await d.getStatus(f.request_id);
7342
- } catch (g) {
7343
- g instanceof w &&
7344
- g.exitCode !== I &&
7464
+ g = await d.getStatus(g.request_id);
7465
+ } catch (f) {
7466
+ f instanceof k &&
7467
+ f.exitCode !== _ &&
7345
7468
  (s ||
7346
- m.fail(
7347
- M(g).join(`
7469
+ h.fail(
7470
+ K(f).join(`
7348
7471
  `),
7349
7472
  ),
7350
- process.exit(g.exitCode));
7473
+ process.exit(f.exitCode));
7351
7474
  }
7352
7475
  }
7353
7476
  if (
7354
- ((f.status === 'failed' || f.status === 'expired' || f.status === 'cancelled') &&
7477
+ ((g.status === 'failed' || g.status === 'expired' || g.status === 'cancelled') &&
7355
7478
  (s
7356
7479
  ? process.stdout.write(
7357
- JSON.stringify(f, null, 2) +
7480
+ JSON.stringify(g, null, 2) +
7358
7481
  `
7359
7482
  `,
7360
7483
  )
7361
- : m.fail(`Generation ${f.status}: ${f.error || 'Something failed on our side.'}`),
7362
- process.exit(I)),
7363
- s || m.succeed(`Generation completed for ${a.bold(n?.name || e)}!`),
7484
+ : h.fail(`Generation ${g.status}: ${g.error || 'Something failed on our side.'}`),
7485
+ process.exit(_)),
7486
+ s || h.succeed(`Generation completed for ${a.bold(n?.name || e)}!`),
7364
7487
  s)
7365
7488
  ) {
7366
7489
  process.stdout.write(
7367
- JSON.stringify(f, null, 2) +
7490
+ JSON.stringify(g, null, 2) +
7368
7491
  `
7369
7492
  `,
7370
7493
  );
@@ -7375,57 +7498,57 @@ async function Ce(e, t) {
7375
7498
  `),
7376
7499
  process.stdout.write(` ${a.bold('Status:')} ${a.green('Succeeded')}
7377
7500
  `),
7378
- process.stdout.write(` ${a.bold('Request ID:')} ${f.request_id}
7501
+ process.stdout.write(` ${a.bold('Request ID:')} ${g.request_id}
7379
7502
  `),
7380
- f.usage?.cost !== void 0 &&
7381
- process.stdout.write(` ${a.bold('Cost:')} $${f.usage.cost.toFixed(4)}
7503
+ g.usage?.cost !== void 0 &&
7504
+ process.stdout.write(` ${a.bold('Cost:')} $${g.usage.cost.toFixed(4)}
7382
7505
  `),
7383
- f.output && f.output.length > 0)
7506
+ g.output && g.output.length > 0)
7384
7507
  ) {
7385
7508
  process.stdout.write(`
7386
7509
  ${a.bold('Outputs:')}
7387
7510
  `);
7388
- for (let h = 0; h < f.output.length; h++) {
7389
- let g = f.output[h];
7390
- if (g.url) {
7511
+ for (let y = 0; y < g.output.length; y++) {
7512
+ let f = g.output[y];
7513
+ if (f.url) {
7391
7514
  if (
7392
- (process.stdout.write(` [${g.type.toUpperCase()}] ${a.cyan(a.underline(g.url))}
7515
+ (process.stdout.write(` [${f.type.toUpperCase()}] ${a.cyan(a.underline(f.url))}
7393
7516
  `),
7394
7517
  u)
7395
7518
  ) {
7396
- let x = new P(`Downloading output to ${u}...`).start();
7519
+ let v = new T(`Downloading output to ${u}...`).start();
7397
7520
  try {
7398
- (await d.downloadOutput(g.url, q.default.resolve(process.cwd(), u)),
7399
- x.succeed(`Saved to ${a.bold(u)}`));
7400
- } catch (_) {
7401
- x.fail(`Failed to download: ${_ instanceof Error ? _.message : _}`);
7521
+ (await d.downloadOutput(f.url, A.default.resolve(process.cwd(), u)),
7522
+ v.succeed(`Saved to ${a.bold(u)}`));
7523
+ } catch (P) {
7524
+ v.fail(`Failed to download: ${P instanceof Error ? P.message : P}`);
7402
7525
  }
7403
7526
  }
7404
7527
  } else
7405
- g.text &&
7528
+ f.text &&
7406
7529
  process.stdout.write(`
7407
- ${g.text}
7530
+ ${f.text}
7408
7531
  `);
7409
7532
  }
7410
7533
  }
7411
7534
  process.stdout.write(`
7412
7535
  `);
7413
7536
  }
7414
- var Pt = v(require('node:readline'));
7415
- C();
7416
- async function Ui(e) {
7537
+ var Tt = I(require('node:readline'));
7538
+ E();
7539
+ async function Fi(e) {
7417
7540
  try {
7418
- return (await new T(e, k()).checkKey(), 'ok');
7541
+ return (await new M(e, x()).checkKey(), 'ok');
7419
7542
  } catch (t) {
7420
- if (t instanceof w) {
7543
+ if (t instanceof k) {
7421
7544
  if (t.status === 401) return 'invalid';
7422
7545
  if (t.status === 403) return 'blocked';
7423
7546
  }
7424
7547
  return 'unchecked';
7425
7548
  }
7426
7549
  }
7427
- function ji(e) {
7428
- let t = Pt.default.createInterface({ input: process.stdin, output: process.stdout });
7550
+ function Gi(e) {
7551
+ let t = Tt.default.createInterface({ input: process.stdin, output: process.stdout });
7429
7552
  return new Promise((i) => {
7430
7553
  t.question(e, (r) => {
7431
7554
  (t.close(), i(r.trim()));
@@ -7444,20 +7567,20 @@ ${a.bold('Tein AI Authentication')}
7444
7567
  process.stdout.write(`Get your API key at: ${a.cyan('https://tein.ai/dashboard/keys')}
7445
7568
 
7446
7569
  `),
7447
- (i = await ji('Enter your Tein API Key (sk_live_...): '))),
7570
+ (i = await Gi('Enter your Tein API Key (sk_live_...): '))),
7448
7571
  !i.startsWith('sk_live_') &&
7449
7572
  !i.startsWith('sk_test_') &&
7450
7573
  (process.stderr
7451
7574
  .write(`${a.red('Error:')} Invalid key format. Tein API keys start with 'sk_live_' or 'sk_test_'.
7452
7575
  `),
7453
7576
  process.exit(1)));
7454
- let r = await Ui(i);
7577
+ let r = await Fi(i);
7455
7578
  (r === 'invalid' &&
7456
7579
  (process.stderr
7457
7580
  .write(`${a.red('Error:')} Tein did not accept this key. Copy it again from ${a.cyan('https://tein.ai/dashboard/keys')}. Nothing was saved.
7458
7581
  `),
7459
7582
  process.exit(1)),
7460
- ge({ apiKey: i }),
7583
+ he({ apiKey: i }),
7461
7584
  process.stdout.write(`
7462
7585
  ${a.green('\u2713')} API key saved to ${a.dim(ie())}
7463
7586
  `),
@@ -7476,22 +7599,22 @@ ${a.green('\u2713')} API key saved to ${a.dim(ie())}
7476
7599
  break;
7477
7600
  }
7478
7601
  case 'logout': {
7479
- if (!D().apiKey) {
7602
+ if (!L().apiKey) {
7480
7603
  process.stdout
7481
7604
  .write(`${a.yellow('\u2139')} No active API key found. You are already logged out.
7482
7605
  `);
7483
7606
  break;
7484
7607
  }
7485
- (ge({ apiKey: '' }),
7608
+ (he({ apiKey: '' }),
7486
7609
  process.stdout
7487
7610
  .write(`${a.green('\u2713')} Logged out successfully. Stored API key has been cleared from ${a.dim(ie())}
7488
7611
  `));
7489
7612
  break;
7490
7613
  }
7491
7614
  default: {
7492
- let i = K(),
7493
- r = k(),
7494
- n = D();
7615
+ let i = S(),
7616
+ r = x(),
7617
+ n = L();
7495
7618
  if (
7496
7619
  (process.stdout.write(`
7497
7620
  ${a.bold('Tein AI CLI Configuration')}
@@ -7520,13 +7643,13 @@ ${a.bold('Tein AI CLI Configuration')}
7520
7643
  }
7521
7644
  }
7522
7645
  }
7523
- C();
7524
- he();
7525
- W();
7526
- var Bi = 3e3;
7527
- async function Tt(e) {
7646
+ E();
7647
+ ye();
7648
+ z();
7649
+ var Ji = 3e3;
7650
+ async function Mt(e) {
7528
7651
  try {
7529
- let t = await fetch(`${k(e)}/v1/pricing`, { signal: AbortSignal.timeout(Bi) });
7652
+ let t = await fetch(`${x(e)}/v1/pricing`, { signal: AbortSignal.timeout(Ji) });
7530
7653
  if (!t.ok) return;
7531
7654
  let i = await t.json(),
7532
7655
  r = {};
@@ -7534,18 +7657,18 @@ async function Tt(e) {
7534
7657
  let s = String(n.modelSlug ?? '');
7535
7658
  B.has(s) && (r[s] ??= []).push(Number(n.starterPrice));
7536
7659
  }
7537
- ft(r);
7660
+ gt(r);
7538
7661
  } catch {}
7539
7662
  }
7540
- var Fi = new Set(['video', 'image', 'text', 'audio', '3d']),
7541
- Gi = { llm: 'text', chat: 'text', reasoning: 'text' };
7542
- async function Mt(e, t) {
7543
- await Tt(t);
7544
- let i = E();
7663
+ var Hi = new Set(['video', 'image', 'text', 'audio', '3d']),
7664
+ zi = { llm: 'text', chat: 'text', reasoning: 'text' };
7665
+ async function Kt(e, t) {
7666
+ await Mt(t);
7667
+ let i = q();
7545
7668
  if (e) {
7546
7669
  let s = e.toLowerCase(),
7547
- o = Gi[s] ?? s;
7548
- i = Fi.has(o)
7670
+ o = zi[s] ?? s;
7671
+ i = Hi.has(o)
7549
7672
  ? i.filter((u) => u.category.toLowerCase() === o)
7550
7673
  : i.filter((u) => u.kind.toLowerCase().includes(s) || u.slug.toLowerCase().includes(s));
7551
7674
  }
@@ -7568,10 +7691,10 @@ ${a.bold('Tein AI Models Catalog')} (${i.length} available)
7568
7691
  process.stdout.write(`${a.bold(a.cyan(`\u2500\u2500 ${s} Models \u2500\u2500`))}
7569
7692
  `);
7570
7693
  for (let u of o) {
7571
- let p = u.slug.padEnd(24),
7572
- l = u.name.padEnd(22),
7573
- d = u.priceFormatted.padEnd(22);
7574
- process.stdout.write(` ${a.bold(p)} ${a.gray(l)} ${a.green(d)} ${a.dim(u.vendor)}
7694
+ let l = u.slug.padEnd(24),
7695
+ c = u.name.padEnd(22),
7696
+ p = u.priceFormatted.padEnd(22);
7697
+ process.stdout.write(` ${a.bold(l)} ${a.gray(c)} ${a.green(p)} ${a.dim(u.vendor)}
7575
7698
  `);
7576
7699
  }
7577
7700
  process.stdout.write(`
@@ -7583,9 +7706,9 @@ ${a.bold('Tein AI Models Catalog')} (${i.length} available)
7583
7706
 
7584
7707
  `);
7585
7708
  }
7586
- async function Kt(e, t) {
7587
- B.has(e) && (await Tt(t));
7588
- let i = V(e);
7709
+ async function St(e, t) {
7710
+ B.has(e) && (await Mt(t));
7711
+ let i = N(e);
7589
7712
  (i ||
7590
7713
  (process.stderr.write(`${a.red('Error:')} Model "${e}" not found in Tein AI registry.
7591
7714
  `),
@@ -7664,10 +7787,10 @@ ${a.bold(a.cyan(i.name))} (${a.bold(i.slug)})
7664
7787
 
7665
7788
  `);
7666
7789
  }
7667
- C();
7668
- Ee();
7669
- var Ji = 1e4,
7670
- Ae = {
7790
+ E();
7791
+ qe();
7792
+ var Wi = 1e4,
7793
+ Re = {
7671
7794
  price: '',
7672
7795
  creativeMode: 'Creative mode',
7673
7796
  priority: 'Priority',
@@ -7677,22 +7800,22 @@ var Ji = 1e4,
7677
7800
  priorityDraft: 'Priority + Draft',
7678
7801
  creativeModePriorityDraft: 'Creative mode + Priority + Draft',
7679
7802
  },
7680
- Hi = Object.keys(Ae),
7681
- Wi = {
7803
+ Yi = Object.keys(Re),
7804
+ Qi = {
7682
7805
  creativeMode: 'unfiltered',
7683
7806
  creativeModePriority: 'unfilteredPriority',
7684
7807
  creativeModeDraft: 'unfilteredDraft',
7685
7808
  creativeModePriorityDraft: 'unfilteredPriorityDraft',
7686
7809
  };
7687
- function zi(e, t) {
7688
- let i = Wi[t];
7810
+ function Xi(e, t) {
7811
+ let i = Qi[t];
7689
7812
  return e[t] ?? (i ? e[i] : void 0);
7690
7813
  }
7691
- async function Yi(e, t) {
7692
- let i = `${k(e)}${ce(t)}`,
7814
+ async function Zi(e, t) {
7815
+ let i = `${x(e)}${ce(t)}`,
7693
7816
  r;
7694
7817
  try {
7695
- r = await fetch(i, { signal: AbortSignal.timeout(Ji) });
7818
+ r = await fetch(i, { signal: AbortSignal.timeout(Wi) });
7696
7819
  } catch {
7697
7820
  throw new Error(`Could not reach ${i}`);
7698
7821
  }
@@ -7708,18 +7831,18 @@ async function Yi(e, t) {
7708
7831
  }
7709
7832
  return n;
7710
7833
  }
7711
- function qe(e) {
7834
+ function Ae(e) {
7712
7835
  let t = e.toFixed(4).replace(/0+$/, '').replace(/\.$/, ''),
7713
7836
  [i, r = ''] = t.split('.');
7714
7837
  return `$${i}.${r.padEnd(2, '0')}`;
7715
7838
  }
7716
- function Re(e) {
7839
+ function Oe(e) {
7717
7840
  if (!e || typeof e.starter != 'number') return null;
7718
7841
  let t = typeof e.plus == 'number' ? e.plus : e.starter,
7719
7842
  i = typeof e.scale == 'number' ? e.scale : t;
7720
- return `Starter ${qe(e.starter)} Plus ${qe(t)} Scale ${qe(i)}`;
7843
+ return `Starter ${Ae(e.starter)} Plus ${Ae(t)} Scale ${Ae(i)}`;
7721
7844
  }
7722
- function Qi(e) {
7845
+ function er(e) {
7723
7846
  if (typeof e.label == 'string' && e.label.trim()) return e.label.trim();
7724
7847
  let t = [];
7725
7848
  for (let i of ['endpoint', 'resolution', 'quality', 'mode', 'task', 'component', 'token']) {
@@ -7731,33 +7854,33 @@ function Qi(e) {
7731
7854
  t.length ? t.join(' \xB7 ') : String(e.id ?? 'default')
7732
7855
  );
7733
7856
  }
7734
- function Xi(e, t) {
7735
- let i = Qi(e);
7736
- for (let r of Hi) {
7737
- let n = Re(zi(e, r));
7857
+ function tr(e, t) {
7858
+ let i = er(e);
7859
+ for (let r of Yi) {
7860
+ let n = Oe(Xi(e, r));
7738
7861
  if (!n) continue;
7739
- let s = Ae[r] ? ` (${Ae[r]})` : '';
7862
+ let s = Re[r] ? ` (${Re[r]})` : '';
7740
7863
  t.push(` ${i}${s} ${n}`);
7741
7864
  }
7742
7865
  }
7743
- function Zi(e, t) {
7866
+ function ir(e, t) {
7744
7867
  let i = e.quality ? ` quality=${e.quality}` : '';
7745
7868
  t.push(
7746
7869
  ` ${a.bold(e.slug.padEnd(26))} ${a.gray(e.name)} ${a.dim(`${e.kind} ${e.unit} model=${e.model}${i}`)}`,
7747
7870
  );
7748
- for (let n of e.variants ?? []) Xi(n, t);
7871
+ for (let n of e.variants ?? []) tr(n, t);
7749
7872
  let r = e.addons;
7750
7873
  if (Array.isArray(r))
7751
7874
  for (let n of r) {
7752
7875
  if (!n || typeof n != 'object') continue;
7753
7876
  let s = n,
7754
7877
  o = typeof s.label == 'string' ? s.label : String(s.id ?? 'add-on'),
7755
- u = Re(s.price);
7878
+ u = Oe(s.price);
7756
7879
  u && t.push(` ${o} (add-on) ${u}`);
7757
7880
  }
7758
7881
  t.push('');
7759
7882
  }
7760
- function er(e) {
7883
+ function rr(e) {
7761
7884
  let t = [],
7762
7885
  i = e.board.checked ? ` \xB7 checked ${e.board.checked}` : '';
7763
7886
  (t.push(`${a.bold('Tein prices')} ${a.green(e.currency)} ${e.count} models${i}`),
@@ -7766,38 +7889,38 @@ function er(e) {
7766
7889
  ),
7767
7890
  t.push(''));
7768
7891
  let r = new Map();
7769
- for (let p of e.board.models) {
7770
- let l = p.kind || 'other',
7771
- d = r.get(l) ?? [];
7772
- (d.push(p), r.set(l, d));
7892
+ for (let l of e.board.models) {
7893
+ let c = l.kind || 'other',
7894
+ p = r.get(c) ?? [];
7895
+ (p.push(l), r.set(c, p));
7773
7896
  }
7774
7897
  let n = ['video', 'image', 'audio', 'llm', 'text', '3d'],
7775
- s = [...r.keys()].sort((p, l) => {
7776
- let d = n.indexOf(p),
7777
- c = n.indexOf(l);
7778
- return (d === -1 ? 99 : d) - (c === -1 ? 99 : c);
7898
+ s = [...r.keys()].sort((l, c) => {
7899
+ let p = n.indexOf(l),
7900
+ d = n.indexOf(c);
7901
+ return (p === -1 ? 99 : p) - (d === -1 ? 99 : d);
7779
7902
  });
7780
- for (let p of s) {
7781
- t.push(`${a.bold(a.cyan(`\u2500\u2500 ${p} \u2500\u2500`))}`);
7782
- for (let l of r.get(p) ?? []) Zi(l, t);
7903
+ for (let l of s) {
7904
+ t.push(`${a.bold(a.cyan(`\u2500\u2500 ${l} \u2500\u2500`))}`);
7905
+ for (let c of r.get(l) ?? []) ir(c, t);
7783
7906
  }
7784
- let o = new Set(e.board.models.map((p) => p.slug.toLowerCase())),
7785
- u = (e.configs ?? []).filter((p) => !o.has(String(p.modelSlug ?? '').toLowerCase()));
7907
+ let o = new Set(e.board.models.map((l) => l.slug.toLowerCase())),
7908
+ u = (e.configs ?? []).filter((l) => !o.has(String(l.modelSlug ?? '').toLowerCase()));
7786
7909
  if (u.length) {
7787
7910
  t.push(`${a.bold(a.cyan('\u2500\u2500 other prices \u2500\u2500'))}`);
7788
- let p = new Map();
7789
- for (let l of u) {
7790
- let d = String(l.modelSlug ?? ''),
7791
- c = p.get(d) ?? [];
7792
- (c.push(l), p.set(d, c));
7911
+ let l = new Map();
7912
+ for (let c of u) {
7913
+ let p = String(c.modelSlug ?? ''),
7914
+ d = l.get(p) ?? [];
7915
+ (d.push(c), l.set(p, d));
7793
7916
  }
7794
- for (let [l, d] of p) {
7795
- let c = String(d[0]?.modelName ?? l);
7796
- t.push(` ${a.bold(l.padEnd(26))} ${a.gray(c)}`);
7797
- for (let m of d) {
7798
- let f = String(m.displayLabel ?? m.billingUnit ?? 'price'),
7799
- U = Re(m.prices);
7800
- U && t.push(` ${f} ${U}`);
7917
+ for (let [c, p] of l) {
7918
+ let d = String(p[0]?.modelName ?? c);
7919
+ t.push(` ${a.bold(c.padEnd(26))} ${a.gray(d)}`);
7920
+ for (let m of p) {
7921
+ let h = String(m.displayLabel ?? m.billingUnit ?? 'price'),
7922
+ g = Oe(m.prices);
7923
+ g && t.push(` ${h} ${g}`);
7801
7924
  }
7802
7925
  t.push('');
7803
7926
  }
@@ -7809,10 +7932,10 @@ function er(e) {
7809
7932
  `
7810
7933
  );
7811
7934
  }
7812
- async function St(e) {
7935
+ async function $t(e) {
7813
7936
  let t;
7814
7937
  try {
7815
- t = await Yi(e.apiUrl, e.model);
7938
+ t = await Zi(e.apiUrl, e.model);
7816
7939
  } catch (i) {
7817
7940
  let r = i instanceof Error ? i.message : String(i);
7818
7941
  (process.stderr.write(`${a.red('Error:')} ${r}
@@ -7823,14 +7946,14 @@ async function St(e) {
7823
7946
  e.json
7824
7947
  ? `${JSON.stringify(t, null, 2)}
7825
7948
  `
7826
- : er(t),
7949
+ : rr(t),
7827
7950
  );
7828
7951
  }
7829
- var $t = v(require('node:path'));
7830
- C();
7831
- async function Ct(e, t) {
7832
- let i = K(typeof t.api_key == 'string' ? t.api_key : void 0),
7833
- r = k(typeof t.api_url == 'string' ? t.api_url : void 0);
7952
+ var Ct = I(require('node:path'));
7953
+ E();
7954
+ async function Et(e, t) {
7955
+ let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
7956
+ r = x(typeof t.api_url == 'string' ? t.api_url : void 0);
7834
7957
  (i ||
7835
7958
  (process.stderr.write(`${a.red('Error:')} Authentication required.
7836
7959
  `),
@@ -7847,54 +7970,54 @@ async function Ct(e, t) {
7847
7970
  let n = !!t.json,
7848
7971
  s = !!t.wait,
7849
7972
  o = typeof t.output == 'string' ? t.output : void 0,
7850
- u = new T(i, r),
7851
- p = new P(`Checking status of ${a.bold(e)}...`);
7852
- n || p.start();
7853
- let l;
7973
+ u = new M(i, r),
7974
+ l = new T(`Checking status of ${a.bold(e)}...`);
7975
+ n || l.start();
7976
+ let c;
7854
7977
  try {
7855
- l = await u.getStatus(e);
7856
- } catch (d) {
7857
- (d instanceof w &&
7978
+ c = await u.getStatus(e);
7979
+ } catch (p) {
7980
+ (p instanceof k &&
7858
7981
  (n
7859
7982
  ? process.stdout.write(
7860
7983
  JSON.stringify(
7861
- { error: { code: d.code ?? null, message: d.message, ...d.fields } },
7984
+ { error: { code: p.code ?? null, message: p.message, ...p.fields } },
7862
7985
  null,
7863
7986
  2,
7864
7987
  ) +
7865
7988
  `
7866
7989
  `,
7867
7990
  )
7868
- : p.fail(
7869
- M(d).join(`
7991
+ : l.fail(
7992
+ K(p).join(`
7870
7993
  `),
7871
7994
  ),
7872
- process.exit(d.exitCode)),
7873
- n || p.fail(d instanceof Error ? d.message : String(d)),
7874
- process.exit(I));
7995
+ process.exit(p.exitCode)),
7996
+ n || l.fail(p instanceof Error ? p.message : String(p)),
7997
+ process.exit(_));
7875
7998
  }
7876
- if (s && l.status === 'processing') {
7877
- let d = Date.now();
7878
- for (; l.status === 'processing';) {
7879
- let c = Math.round((Date.now() - d) / 1e3);
7880
- (n || p.update(`Waiting for ${a.bold(l.model)} (${c}s elapsed)...`),
7999
+ if (s && c.status === 'processing') {
8000
+ let p = Date.now();
8001
+ for (; c.status === 'processing';) {
8002
+ let d = Math.round((Date.now() - p) / 1e3);
8003
+ (n || l.update(`Waiting for ${a.bold(c.model)} (${d}s elapsed)...`),
7881
8004
  await new Promise((m) => setTimeout(m, 1500)));
7882
8005
  try {
7883
- l = await u.getStatus(e);
8006
+ c = await u.getStatus(e);
7884
8007
  } catch {}
7885
8008
  }
7886
8009
  }
7887
8010
  if (
7888
8011
  (n ||
7889
- (l.status === 'succeeded'
7890
- ? p.succeed('Task completed!')
7891
- : l.status === 'failed' || l.status === 'expired' || l.status === 'cancelled'
7892
- ? p.fail(`Task ${l.status}: ${l.error || 'Something failed on our side.'}`)
7893
- : p.stop()),
8012
+ (c.status === 'succeeded'
8013
+ ? l.succeed('Task completed!')
8014
+ : c.status === 'failed' || c.status === 'expired' || c.status === 'cancelled'
8015
+ ? l.fail(`Task ${c.status}: ${c.error || 'Something failed on our side.'}`)
8016
+ : l.stop()),
7894
8017
  n)
7895
8018
  ) {
7896
8019
  process.stdout.write(
7897
- JSON.stringify(l, null, 2) +
8020
+ JSON.stringify(c, null, 2) +
7898
8021
  `
7899
8022
  `,
7900
8023
  );
@@ -7902,48 +8025,48 @@ async function Ct(e, t) {
7902
8025
  }
7903
8026
  if (
7904
8027
  (process.stdout.write(`
7905
- ${a.bold('Model:')} ${l.model}
8028
+ ${a.bold('Model:')} ${c.model}
7906
8029
  `),
7907
8030
  process.stdout
7908
- .write(` ${a.bold('Status:')} ${l.status === 'succeeded' ? a.green(l.status) : l.status === 'processing' ? a.yellow(l.status) : a.red(l.status)}
8031
+ .write(` ${a.bold('Status:')} ${c.status === 'succeeded' ? a.green(c.status) : c.status === 'processing' ? a.yellow(c.status) : a.red(c.status)}
7909
8032
  `),
7910
- process.stdout.write(` ${a.bold('Request ID:')} ${l.request_id}
8033
+ process.stdout.write(` ${a.bold('Request ID:')} ${c.request_id}
7911
8034
  `),
7912
- l.output && l.output.length > 0)
8035
+ c.output && c.output.length > 0)
7913
8036
  ) {
7914
8037
  process.stdout.write(`
7915
8038
  ${a.bold('Outputs:')}
7916
8039
  `);
7917
- for (let d of l.output)
7918
- if (d.url) {
8040
+ for (let p of c.output)
8041
+ if (p.url) {
7919
8042
  if (
7920
- (process.stdout.write(` [${d.type.toUpperCase()}] ${a.cyan(a.underline(d.url))}
8043
+ (process.stdout.write(` [${p.type.toUpperCase()}] ${a.cyan(a.underline(p.url))}
7921
8044
  `),
7922
8045
  o)
7923
8046
  ) {
7924
- let c = new P(`Downloading output to ${o}...`).start();
8047
+ let d = new T(`Downloading output to ${o}...`).start();
7925
8048
  try {
7926
- (await u.downloadOutput(d.url, $t.default.resolve(process.cwd(), o)),
7927
- c.succeed(`Saved to ${a.bold(o)}`));
8049
+ (await u.downloadOutput(p.url, Ct.default.resolve(process.cwd(), o)),
8050
+ d.succeed(`Saved to ${a.bold(o)}`));
7928
8051
  } catch (m) {
7929
- c.fail(`Failed to download: ${m instanceof Error ? m.message : m}`);
8052
+ d.fail(`Failed to download: ${m instanceof Error ? m.message : m}`);
7930
8053
  }
7931
8054
  }
7932
8055
  } else
7933
- d.text &&
8056
+ p.text &&
7934
8057
  process.stdout.write(`
7935
- ${d.text}
8058
+ ${p.text}
7936
8059
  `);
7937
8060
  }
7938
8061
  process.stdout.write(`
7939
8062
  `);
7940
8063
  }
7941
- var Oe = v(require('node:fs')),
7942
- De = v(require('node:path'));
7943
- C();
7944
- async function Et(e, t = {}) {
7945
- let i = K(typeof t.api_key == 'string' ? t.api_key : void 0),
7946
- r = k(typeof t.api_url == 'string' ? t.api_url : void 0),
8064
+ var De = I(require('node:fs')),
8065
+ Le = I(require('node:path'));
8066
+ E();
8067
+ async function qt(e, t = {}) {
8068
+ let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
8069
+ r = x(typeof t.api_url == 'string' ? t.api_url : void 0),
7947
8070
  n = !!t.json;
7948
8071
  (i ||
7949
8072
  (process.stderr.write(`${a.red('Error:')} Authentication required.
@@ -7958,55 +8081,55 @@ async function Et(e, t = {}) {
7958
8081
  process.stderr.write(`Usage: ${a.cyan('tein upload <image.png|video.mp4>')}
7959
8082
  `),
7960
8083
  process.exit(1)));
7961
- let s = De.default.resolve(e);
7962
- Oe.default.existsSync(s) ||
8084
+ let s = Le.default.resolve(e);
8085
+ De.default.existsSync(s) ||
7963
8086
  (process.stderr.write(`${a.red('Error:')} File not found: ${s}
7964
8087
  `),
7965
8088
  process.exit(1));
7966
- let o = De.default.basename(s),
7967
- p = Oe.default.readFileSync(s).toString('base64'),
7968
- l = new T(i, r),
7969
- d = new P(`Uploading ${a.bold(o)} to Tein AI CDN...`);
7970
- n || d.start();
8089
+ let o = Le.default.basename(s),
8090
+ l = De.default.readFileSync(s).toString('base64'),
8091
+ c = new M(i, r),
8092
+ p = new T(`Uploading ${a.bold(o)} to Tein AI CDN...`);
8093
+ n || p.start();
7971
8094
  try {
7972
- let c = await l.uploadAsset(p);
8095
+ let d = await c.uploadAsset(l);
7973
8096
  n
7974
8097
  ? process.stdout.write(
7975
- JSON.stringify(c, null, 2) +
8098
+ JSON.stringify(d, null, 2) +
7976
8099
  `
7977
8100
  `,
7978
8101
  )
7979
- : (d.succeed('Upload successful!'),
8102
+ : (p.succeed('Upload successful!'),
7980
8103
  process.stdout.write(`
7981
- ${a.bold('CDN URL:')} ${a.green(c.url)}
8104
+ ${a.bold('CDN URL:')} ${a.green(d.url)}
7982
8105
  `),
7983
- process.stdout.write(`${a.dim(`Key: ${c.key}`)}
8106
+ process.stdout.write(`${a.dim(`Key: ${d.key}`)}
7984
8107
 
7985
8108
  `),
7986
8109
  process.stdout.write(`Use this CDN URL directly in your CLI runs:
7987
- ${a.cyan(`tein run seedance-2-5 --prompt "Animate this scene" --image "${c.url}"`)}
8110
+ ${a.cyan(`tein run seedance-2-5 --prompt "Animate this scene" --image "${d.url}"`)}
7988
8111
 
7989
8112
  `));
7990
- } catch (c) {
7991
- let m = c instanceof w ? c : null,
7992
- f = m
7993
- ? M(m).join(`
8113
+ } catch (d) {
8114
+ let m = d instanceof k ? d : null,
8115
+ h = m
8116
+ ? K(m).join(`
7994
8117
  `)
7995
- : c instanceof Error
7996
- ? c.message
7997
- : String(c);
8118
+ : d instanceof Error
8119
+ ? d.message
8120
+ : String(d);
7998
8121
  (n
7999
8122
  ? process.stdout.write(
8000
- JSON.stringify({ error: { code: m?.code ?? null, message: m?.message ?? f } }, null, 2) +
8123
+ JSON.stringify({ error: { code: m?.code ?? null, message: m?.message ?? h } }, null, 2) +
8001
8124
  `
8002
8125
  `,
8003
8126
  )
8004
- : d.fail(`Upload failed: ${f}`),
8005
- process.exit(m ? m.exitCode : I));
8127
+ : p.fail(`Upload failed: ${h}`),
8128
+ process.exit(m ? m.exitCode : _));
8006
8129
  }
8007
8130
  }
8008
- W();
8009
- _e();
8131
+ z();
8132
+ Pe();
8010
8133
  function Wt() {
8011
8134
  process.stdout.write(`
8012
8135
  ${a.bold(a.cyan('Tein AI CLI'))} - Official Command-Line Interface for Tein AI models
@@ -8034,6 +8157,7 @@ ${a.bold('GENERATION OPTIONS (for `tein run`):')}
8034
8157
  ${a.cyan('-s, --speaker')} <speaker_id> Voice speaker ID for audio TTS models
8035
8158
  ${a.cyan('--image')} <url> Input image URL for image-to-video or image-to-image
8036
8159
  ${a.cyan('--generate-audio')} Enable native synchronized audio (Seedance 2.5)
8160
+ ${a.cyan('--finalize')} <job-id> Render a Seedance 2.5 draft at 1080p, or 4K with -r 4k (no prompt)
8037
8161
  ${a.cyan('--callback-url')} <url> HTTPS URL that receives the finished job
8038
8162
  ${a.cyan('--async, --no-wait')} Queue task and return request ID immediately
8039
8163
  ${a.cyan('--json')} Output response in raw JSON format
@@ -8055,6 +8179,8 @@ ${a.bold('EXAMPLES:')}
8055
8179
 
8056
8180
  ${a.dim('# 5. Generate a video using Seedance 2.5 with audio')}
8057
8181
  ${a.cyan('tein run seedance-2-5 --prompt "Drone shot of ocean waves at sunrise" --duration 5 -o ocean.mp4')}
8182
+ ${a.dim('# The same at 4K (10-bit H.265; add --creative-mode true for Creative mode)')}
8183
+ ${a.cyan('tein run seedance-2-5 --prompt "Drone shot of ocean waves at sunrise" --duration 5 -r 4k -o ocean-4k.mp4')}
8058
8184
 
8059
8185
  ${a.dim('# 6. Generate speech with Seed Audio 1.0')}
8060
8186
  ${a.cyan('tein run seed-audio-1-0 --prompt "Welcome to Tein AI CLI" -o welcome.wav')}
@@ -8064,9 +8190,9 @@ ${a.bold('EXAMPLES:')}
8064
8190
 
8065
8191
  `);
8066
8192
  }
8067
- async function br() {
8193
+ async function xr() {
8068
8194
  let e = process.argv.slice(2),
8069
- t = _t(e);
8195
+ t = Pt(e);
8070
8196
  if (t.flags.has('help') || t.options.help || t.command === 'help') {
8071
8197
  Wt();
8072
8198
  return;
@@ -8095,14 +8221,14 @@ async function br() {
8095
8221
  }
8096
8222
  case 'models':
8097
8223
  case 'list': {
8098
- await Mt(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0);
8224
+ await Kt(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0);
8099
8225
  break;
8100
8226
  }
8101
8227
  case 'pricing':
8102
8228
  case 'prices': {
8103
8229
  let i = t.options.model,
8104
8230
  r = t.subcommand || (typeof i == 'string' ? i : void 0);
8105
- await St({
8231
+ await $t({
8106
8232
  model: r,
8107
8233
  json: !!t.options.json,
8108
8234
  apiUrl: typeof t.options.api_url == 'string' ? t.options.api_url : void 0,
@@ -8117,40 +8243,40 @@ async function br() {
8117
8243
  process.stderr.write(`Usage: ${a.cyan('tein info <model-slug>')}
8118
8244
  `),
8119
8245
  process.exit(1)),
8120
- await Kt(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0));
8246
+ await St(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0));
8121
8247
  break;
8122
8248
  }
8123
8249
  case 'upload': {
8124
8250
  let i = t.subcommand || '';
8125
- await Et(i, t.options);
8251
+ await qt(i, t.options);
8126
8252
  break;
8127
8253
  }
8128
8254
  case 'run':
8129
8255
  case 'generate': {
8130
8256
  let i = t.subcommand || '';
8131
- await Ce(i, t.options);
8257
+ await Ee(i, t.options);
8132
8258
  break;
8133
8259
  }
8134
8260
  case 'status': {
8135
8261
  let i = t.subcommand || '';
8136
- await Ct(i, t.options);
8262
+ await Et(i, t.options);
8137
8263
  break;
8138
8264
  }
8139
8265
  case 'mcp': {
8140
- let { startStdioServer: i } = await Promise.resolve().then(() => (Ht(), Jt));
8266
+ let { startStdioServer: i } = await Promise.resolve().then(() => (zt(), Ht));
8141
8267
  await i();
8142
8268
  break;
8143
8269
  }
8144
8270
  default: {
8145
8271
  if (t.command && !t.command.startsWith('-')) {
8146
- (!V(t.command) &&
8272
+ (!N(t.command) &&
8147
8273
  !oe[t.command] &&
8148
8274
  (process.stderr.write(`
8149
8275
  ${a.red('Error:')} Unknown command or model "${t.command}".
8150
8276
  Run ${a.cyan('tein --help')} for the commands, or ${a.cyan('tein models')} for the model slugs.
8151
8277
  `),
8152
- process.exit(I)),
8153
- await Ce(t.command, t.options));
8278
+ process.exit(_)),
8279
+ await Ee(t.command, t.options));
8154
8280
  return;
8155
8281
  }
8156
8282
  Wt();
@@ -8158,15 +8284,15 @@ Run ${a.cyan('tein --help')} for the commands, or ${a.cyan('tein models')} for t
8158
8284
  }
8159
8285
  }
8160
8286
  }
8161
- br().catch((e) => {
8162
- (e instanceof w &&
8287
+ xr().catch((e) => {
8288
+ (e instanceof k &&
8163
8289
  (process.stderr.write(`
8164
- ${a.red('Error:')} ${M(e).join(`
8290
+ ${a.red('Error:')} ${K(e).join(`
8165
8291
  `)}
8166
8292
  `),
8167
8293
  process.exit(e.exitCode)),
8168
8294
  process.stderr.write(`
8169
8295
  ${a.red('Fatal error:')} ${e instanceof Error ? e.message : e}
8170
8296
  `),
8171
- process.exit(I));
8297
+ process.exit(_));
8172
8298
  });