@teinai/cli 1.1.11 → 1.1.12

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 +859 -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,36 @@ 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
+ },
193
223
  {
194
224
  id: '1080p-with-video',
195
225
  price: { starter: 0.4349, plus: 0.4132, scale: 0.378 },
@@ -481,7 +511,7 @@ var re,
481
511
  unfiltered: 0.05,
482
512
  priority: 0.06,
483
513
  draft: { off: 0.03, draft: '480p', finalize: '1080p', expiresDays: 7 },
484
- axes: { resolution: ['480p', '720p', '1080p'] },
514
+ axes: { resolution: ['480p', '720p', '1080p', '4k'] },
485
515
  from: { variant: '480p-no-video-omni' },
486
516
  },
487
517
  {
@@ -4522,10 +4552,10 @@ var re,
4522
4552
  ],
4523
4553
  };
4524
4554
  });
4525
- function ke(e, t) {
4555
+ function xe(e, t) {
4526
4556
  return `${e.trim().toLowerCase()}|${(t ?? '').trim().toLowerCase()}`;
4527
4557
  }
4528
- function pi(e, t) {
4558
+ function di(e, t) {
4529
4559
  if (e === 'seedance-2-mini') return 'mini';
4530
4560
  if (e !== 'seedance-2') return;
4531
4561
  let i = typeof t?.quality == 'string' ? t.quality.trim().toLowerCase() : '';
@@ -4535,79 +4565,79 @@ function pi(e, t) {
4535
4565
  ? 'fast'
4536
4566
  : 'standard';
4537
4567
  }
4538
- function di(e, t) {
4568
+ function ci(e, t) {
4539
4569
  let i = e
4540
4570
  .trim()
4541
4571
  .toLowerCase()
4542
4572
  .replace(/-(?:unfiltered|uncensored)$/, '');
4543
4573
  if (i === 'seedance-2' || i === 'seedance-2-mini') {
4544
- let n = pi(i, t),
4545
- s = be.get(ke('seedance-2', n));
4574
+ let n = di(i, t),
4575
+ s = we.get(xe('seedance-2', n));
4546
4576
  return s ? s.slug : null;
4547
4577
  }
4548
- let r = ae.get(i) ?? be.get(ke(i));
4578
+ let r = ae.get(i) ?? we.get(xe(i));
4549
4579
  return r ? r.slug : null;
4550
4580
  }
4551
- function ui(e, t) {
4552
- return ae.has(e) && !(ci.has(e) && t) ? e : di(e, t);
4581
+ function mi(e, t) {
4582
+ return ae.has(e) && !(ui.has(e) && t) ? e : ci(e, t);
4553
4583
  }
4554
4584
  function F(e, t) {
4555
- let i = ui(e, t);
4585
+ let i = mi(e, t);
4556
4586
  return i ? (ae.get(i) ?? null) : null;
4557
4587
  }
4558
4588
  function ne() {
4559
- return xe.models;
4589
+ return ve.models;
4560
4590
  }
4561
- var xe,
4591
+ var ve,
4562
4592
  ae,
4563
- be,
4564
- Qe,
4565
- li,
4566
4593
  we,
4567
- ci,
4568
- L = y(() => {
4594
+ Xe,
4595
+ pi,
4596
+ ke,
4597
+ ui,
4598
+ V = b(() => {
4569
4599
  'use strict';
4570
- ze();
4571
4600
  Ye();
4572
- ((xe = {
4601
+ Qe();
4602
+ ((ve = {
4573
4603
  ...re,
4574
- families: re.families.map((e) => ({ ...e, models: e.models.filter((t) => !ye(t)) })),
4575
- models: re.models.filter((e) => !ye(e.slug)),
4604
+ families: re.families.map((e) => ({ ...e, models: e.models.filter((t) => !be(t)) })),
4605
+ models: re.models.filter((e) => !be(e.slug)),
4576
4606
  }),
4577
4607
  (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 });
4608
+ (we = new Map()),
4609
+ (Xe = new Map()),
4610
+ (pi = new Map()),
4611
+ (ke = new Map()));
4612
+ for (let e of ve.models) {
4613
+ (ae.set(e.slug, e), we.set(xe(e.api.model, e.api.quality), e));
4614
+ for (let t of e.variants) Xe.set(`${e.slug}/${t.id}`, { model: e, variant: t, edit: !1 });
4585
4615
  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);
4616
+ Xe.set(`${e.slug}/edit/${t.id}`, { model: e, variant: t, edit: !0 });
4617
+ for (let t of e.addons ?? []) pi.set(`${e.slug}/addon/${t.id}`, { model: e, addon: t });
4618
+ ke.set(e.slug, e.family);
4589
4619
  }
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']);
4620
+ for (let e of ve.families) for (let t of e.models) ke.has(t) || ke.set(t, e.slug);
4621
+ ui = new Set(['seedance-2']);
4592
4622
  });
4593
4623
  function se(e) {
4594
4624
  let t = e.from?.variant;
4595
4625
  return (t && e.variants.find((i) => i.id === t)) || e.variants[0];
4596
4626
  }
4597
- function ve(e) {
4627
+ function Ie(e) {
4598
4628
  if (e.endpoints?.length)
4599
- return e.editVariants?.length && e.endpoints.some((t) => t.id === Xe)
4600
- ? Xe
4629
+ return e.editVariants?.length && e.endpoints.some((t) => t.id === Ze)
4630
+ ? Ze
4601
4631
  : (e.defaultEndpoint ?? e.endpoints[0].id);
4602
4632
  }
4603
- var Xe,
4604
- Ie = y(() => {
4633
+ var Ze,
4634
+ _e = b(() => {
4605
4635
  'use strict';
4606
- L();
4607
- Xe = 'dynamic';
4636
+ V();
4637
+ Ze = 'dynamic';
4608
4638
  });
4609
4639
  var oe,
4610
- _e = y(() => {
4640
+ Pe = b(() => {
4611
4641
  'use strict';
4612
4642
  oe = {
4613
4643
  'gemini-3-8-flash': 'gemini-3.8-flash',
@@ -4617,29 +4647,29 @@ var oe,
4617
4647
  'gpt-image-2-5-sunburst': 'gpt-image-2.5-sunburst',
4618
4648
  };
4619
4649
  });
4620
- var Ze = y(() => {
4650
+ var et = b(() => {
4621
4651
  'use strict';
4622
4652
  });
4623
- function et(e, t) {
4624
- return typeof t == 'string' && (mi[e]?.includes(t) ?? !1);
4653
+ function tt(e, t) {
4654
+ return typeof t == 'string' && (fi[e]?.includes(t) ?? !1);
4625
4655
  }
4626
- var mi,
4627
- tt = y(() => {
4656
+ var fi,
4657
+ it = b(() => {
4628
4658
  'use strict';
4629
- L();
4630
- Ie();
4631
- Ze();
4632
- mi = {};
4659
+ V();
4660
+ _e();
4661
+ et();
4662
+ fi = {};
4633
4663
  });
4634
- function it(e) {
4635
- return e === 'nano-banana-pro' ? fi : gi;
4664
+ function rt(e) {
4665
+ return e === 'nano-banana-pro' ? gi : hi;
4636
4666
  }
4637
- var fi,
4638
- gi,
4639
- rt = y(() => {
4667
+ var gi,
4668
+ hi,
4669
+ at = b(() => {
4640
4670
  '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 = [
4671
+ ((gi = ['auto', '1:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9']),
4672
+ (hi = [
4643
4673
  'auto',
4644
4674
  '1:1',
4645
4675
  '1:4',
@@ -4657,10 +4687,10 @@ var fi,
4657
4687
  '21:9',
4658
4688
  ]));
4659
4689
  });
4660
- var at,
4661
- nt = y(() => {
4690
+ var nt,
4691
+ st = b(() => {
4662
4692
  'use strict';
4663
- at = [
4693
+ nt = [
4664
4694
  'prompt',
4665
4695
  'system',
4666
4696
  'messages',
@@ -4674,10 +4704,10 @@ var at,
4674
4704
  'endpoint',
4675
4705
  ];
4676
4706
  });
4677
- var st,
4678
- ot = y(() => {
4707
+ var ot,
4708
+ lt = b(() => {
4679
4709
  'use strict';
4680
- st = [
4710
+ ot = [
4681
4711
  {
4682
4712
  slug: 'claude-fable-5-1',
4683
4713
  family: 'fable-5-1',
@@ -4746,13 +4776,13 @@ var st,
4746
4776
  },
4747
4777
  ];
4748
4778
  });
4749
- function lt(e) {
4779
+ function pt(e) {
4750
4780
  return `$${e}`;
4751
4781
  }
4752
- function Pe(e, t, i) {
4782
+ function Te(e, t, i) {
4753
4783
  return F(e)?.variants.find((n) => n.endpoint === t && n.component === i)?.price.starter ?? null;
4754
4784
  }
4755
- function hi(e) {
4785
+ function yi(e) {
4756
4786
  return [
4757
4787
  {
4758
4788
  name: 'prompt',
@@ -4818,13 +4848,13 @@ function hi(e) {
4818
4848
  },
4819
4849
  ];
4820
4850
  }
4821
- function pt() {
4851
+ function dt() {
4822
4852
  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` : '',
4853
+ ot.map((e) => {
4854
+ let t = Te(e.slug, 'cheap', 'input'),
4855
+ i = Te(e.slug, 'cheap', 'output'),
4856
+ r = Te(e.slug, 'stable', 'input') != null,
4857
+ n = t != null && i != null ? `${pt(t)}/M in \xB7 ${pt(i)}/M out` : '',
4828
4858
  s = {
4829
4859
  slug: e.slug,
4830
4860
  name: e.name,
@@ -4835,20 +4865,20 @@ function pt() {
4835
4865
  priceFormatted: n,
4836
4866
  unit: '/M tokens',
4837
4867
  primaryToolName: 'run_task',
4838
- parameters: hi(r),
4868
+ parameters: yi(r),
4839
4869
  };
4840
4870
  return [e.slug, s];
4841
4871
  }),
4842
4872
  );
4843
4873
  }
4844
- var dt = y(() => {
4874
+ var ct = b(() => {
4845
4875
  'use strict';
4846
- ot();
4847
- L();
4876
+ lt();
4877
+ V();
4848
4878
  });
4849
4879
  var G,
4850
4880
  le,
4851
- Te = y(() => {
4881
+ Me = b(() => {
4852
4882
  'use strict';
4853
4883
  ((G = ['seedance-2-5', 'seedance-2', 'seedance-2-mini', 'seedream-5-pro', 'wan-3-0']),
4854
4884
  (le =
@@ -4857,7 +4887,7 @@ var G,
4857
4887
  function J(e) {
4858
4888
  return `$${Number(e.toFixed(5))}`;
4859
4889
  }
4860
- function ki(e) {
4890
+ function xi(e) {
4861
4891
  if (e.kind === 'llm') {
4862
4892
  let t = e.defaultEndpoint,
4863
4893
  i = (s) =>
@@ -4875,14 +4905,14 @@ function ki(e) {
4875
4905
  }
4876
4906
  return `from ${J(se(e).price.starter)}${e.unit}`;
4877
4907
  }
4878
- function xi(e, t) {
4908
+ function vi(e, t) {
4879
4909
  let i = t.filter((r) => Number.isFinite(r) && r > 0);
4880
4910
  return i.length ? `from ${J(Math.min(...i))}${e}` : null;
4881
4911
  }
4882
- function ft(e) {
4912
+ function gt(e) {
4883
4913
  for (let t of B) {
4884
4914
  let i = de[t],
4885
- r = i ? xi(i.unit, e[t] ?? []) : null;
4915
+ r = i ? vi(i.unit, e[t] ?? []) : null;
4886
4916
  i && r && (i.priceFormatted = r);
4887
4917
  }
4888
4918
  }
@@ -4898,13 +4928,13 @@ function H(e, t) {
4898
4928
  ...(t ? { description: t } : {}),
4899
4929
  };
4900
4930
  }
4901
- function gt(e) {
4931
+ function ht(e) {
4902
4932
  if (!e.endpoints?.length) return null;
4903
- let t = e.endpoints.filter((i) => et(e.slug, i.id));
4933
+ let t = e.endpoints.filter((i) => tt(e.slug, i.id));
4904
4934
  return {
4905
4935
  name: 'endpoint',
4906
4936
  type: 'select',
4907
- default: ve(e),
4937
+ default: Ie(e),
4908
4938
  options: e.endpoints.filter((i) => !t.includes(i)).map((i) => i.id),
4909
4939
  description:
4910
4940
  (e.slug === 'gemini-3.1-pro-preview'
@@ -4913,27 +4943,32 @@ function gt(e) {
4913
4943
  (t.length ? ` ${t.map((i) => i.label).join(' and ')}: coming soon.` : ''),
4914
4944
  };
4915
4945
  }
4916
- function _i(e, t) {
4946
+ function Pi(e, t) {
4917
4947
  if (e.unfiltered == null || t.some((r) => r.name === 'creative_mode')) return t;
4918
4948
  let i = G.includes(e.api.model);
4919
- return [...t.filter((r) => !$e.has(r.name)), i ? ht : vi];
4949
+ return [...t.filter((r) => !Ce.has(r.name)), i ? yt : Ii];
4920
4950
  }
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]);
4951
+ function Ke(e, t) {
4952
+ let i = e.filter((n) => !Ce.has(n.name)),
4953
+ r = [yt, _i];
4954
+ return (r.push(bt, wt), [...i, ...r]);
4925
4955
  }
4926
- function ct(e) {
4956
+ function ut(e, t = {}) {
4927
4957
  return [
4928
4958
  ...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,
4959
+ .filter((i) => !Ti.has(i.name) && !Ce.has(i.name))
4960
+ .map((i) =>
4961
+ i.name === 'prompt'
4962
+ ? { ...i, required: !0 }
4963
+ : i.name === 'resolution'
4964
+ ? {
4965
+ ...i,
4966
+ ...(t.no4k && i.options
4967
+ ? { options: i.options.filter((r) => String(r).toLowerCase() !== '4k') }
4968
+ : {}),
4969
+ description: `Output resolution. TEIN LITE is the lower-priced endpoint for getting started. Stability and reliability are not guaranteed. ${pe}`,
4970
+ }
4971
+ : i,
4937
4972
  ),
4938
4973
  {
4939
4974
  name: 'bitrate_mode',
@@ -4942,13 +4977,13 @@ function ct(e) {
4942
4977
  options: ['standard'],
4943
4978
  description: 'LITE uses standard bitrate. High bitrate is on the standard endpoint.',
4944
4979
  },
4945
- yt,
4946
4980
  bt,
4981
+ wt,
4947
4982
  ];
4948
4983
  }
4949
- function Ke(e, t) {
4984
+ function Se(e, t) {
4950
4985
  return [
4951
- S('Text prompt describing the video.'),
4986
+ $('Text prompt describing the video.'),
4952
4987
  { name: 'mode', type: 'select', required: !0, default: t.modes[0], options: t.modes },
4953
4988
  {
4954
4989
  name: 'duration',
@@ -4975,10 +5010,10 @@ function Ke(e, t) {
4975
5010
  ),
4976
5011
  ];
4977
5012
  }
4978
- function Ti(e) {
4979
- let t = gt(e);
5013
+ function Mi(e) {
5014
+ let t = ht(e);
4980
5015
  return [
4981
- S('Image prompt text. Supports complex composition and text instructions.'),
5016
+ $('Image prompt text. Supports complex composition and text instructions.'),
4982
5017
  ...(t ? [t] : []),
4983
5018
  {
4984
5019
  name: 'quality',
@@ -4989,14 +5024,14 @@ function Ti(e) {
4989
5024
  H(
4990
5025
  e,
4991
5026
  e.slug === 'gpt-image-2'
4992
- ? `1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count. ${He}`
5027
+ ? `1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count. ${ze}`
4993
5028
  : '1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count.',
4994
5029
  ),
4995
5030
  {
4996
5031
  name: 'aspect_ratio',
4997
5032
  type: 'select',
4998
5033
  default: 'auto',
4999
- options: [...Je],
5034
+ options: [...He],
5000
5035
  description:
5001
5036
  "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
5037
  },
@@ -5043,15 +5078,15 @@ function Ti(e) {
5043
5078
  },
5044
5079
  ];
5045
5080
  }
5046
- function Mi(e) {
5081
+ function Ki(e) {
5047
5082
  return [
5048
- S('Image prompt text.'),
5083
+ $('Image prompt text.'),
5049
5084
  {
5050
5085
  name: 'input_images',
5051
5086
  type: 'string[]',
5052
5087
  description: 'Images to edit or use as reference (up to 14).',
5053
5088
  },
5054
- { name: 'aspect_ratio', type: 'select', default: '1:1', options: [...it(e.slug)] },
5089
+ { name: 'aspect_ratio', type: 'select', default: '1:1', options: [...rt(e.slug)] },
5055
5090
  H(e),
5056
5091
  {
5057
5092
  name: 'n',
@@ -5077,10 +5112,10 @@ function Mi(e) {
5077
5112
  },
5078
5113
  ];
5079
5114
  }
5080
- function Ci() {
5081
- let e = at,
5115
+ function Ei() {
5116
+ let e = nt,
5082
5117
  t = [];
5083
- for (let i of wt(!0))
5118
+ for (let i of kt(!0))
5084
5119
  e.includes(i.name) &&
5085
5120
  (t.push({
5086
5121
  ...i,
@@ -5102,9 +5137,9 @@ function Ci() {
5102
5137
  }));
5103
5138
  return t;
5104
5139
  }
5105
- function wt(e) {
5140
+ function kt(e) {
5106
5141
  return [
5107
- S('The user message or task.'),
5142
+ $('The user message or task.'),
5108
5143
  { name: 'system', type: 'string', description: 'Optional system instructions.' },
5109
5144
  {
5110
5145
  name: 'messages',
@@ -5197,40 +5232,40 @@ function wt(e) {
5197
5232
  },
5198
5233
  ];
5199
5234
  }
5200
- function Ei(e) {
5201
- if (e.slug === 'seed-2-1-turbo') return Si;
5202
- let t = gt(e);
5235
+ function qi(e) {
5236
+ if (e.slug === 'seed-2-1-turbo') return $i;
5237
+ let t = ht(e);
5203
5238
  return [
5204
5239
  ...(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),
5240
+ ? Ei()
5241
+ : e.slug === 'gpt-6-astra' || Ci.includes(e.slug)
5242
+ ? kt(e.slug !== 'gpt-6-astra')
5243
+ : Si),
5209
5244
  ...(t ? [t] : []),
5210
5245
  ];
5211
5246
  }
5212
- function qi(e) {
5247
+ function Ai(e) {
5213
5248
  let t = e.slug;
5214
- if (e.kind === 'llm') return Ei(e);
5215
- if (e.editVariants?.length) return Ti(e);
5249
+ if (e.kind === 'llm') return qi(e);
5250
+ if (e.editVariants?.length) return Mi(e);
5216
5251
  switch (t) {
5217
5252
  case 'seedance-2-5':
5218
- return Me(ut, t);
5253
+ return Ke(mt, t);
5219
5254
  case 'seedance-2-5-lite':
5220
- return ct(ut);
5255
+ return ut(mt, { no4k: !0 });
5221
5256
  case 'seedance-2':
5222
- return Me(mt, t);
5257
+ return Ke(ft, t);
5223
5258
  case 'seedance-2-lite':
5224
- return ct(mt);
5259
+ return ut(ft);
5225
5260
  case 'seedance-2-mini':
5226
- return Me(Ai, t);
5261
+ return Ke(Ri, t);
5227
5262
  case 'nano-banana-2':
5228
5263
  case 'nano-banana-2.1':
5229
5264
  case 'nano-banana-pro':
5230
- return Mi(e);
5265
+ return Ki(e);
5231
5266
  case 'seedream-5-pro':
5232
5267
  return [
5233
- S('Detailed description of the image to generate.'),
5268
+ $('Detailed description of the image to generate.'),
5234
5269
  { name: 'images', type: 'string[]', description: 'Reference images (the first is free).' },
5235
5270
  H(e),
5236
5271
  {
@@ -5244,7 +5279,7 @@ function qi(e) {
5244
5279
  case 'qwen-3':
5245
5280
  case 'qwen-3-pro':
5246
5281
  return [
5247
- S('Image prompt text; dense layouts and multilingual text work well.'),
5282
+ $('Image prompt text; dense layouts and multilingual text work well.'),
5248
5283
  {
5249
5284
  name: 'images',
5250
5285
  type: 'string[]',
@@ -5290,7 +5325,7 @@ function qi(e) {
5290
5325
  ];
5291
5326
  case 'wan-3-0':
5292
5327
  case 'wan-3-0-prime':
5293
- return Ke(e, {
5328
+ return Se(e, {
5294
5329
  modes: ['text_to_video', 'first_n_last_frames', 'multi_reference'],
5295
5330
  aspects: ['16:9', '9:16', '4:3', '3:4', '1:1', 'adaptive'],
5296
5331
  minSec: 2,
@@ -5300,7 +5335,7 @@ function qi(e) {
5300
5335
  });
5301
5336
  case 'happy-horse-1-1':
5302
5337
  case 'happy-horse-1-0':
5303
- return Ke(e, {
5338
+ return Se(e, {
5304
5339
  modes:
5305
5340
  t === 'happy-horse-1-0'
5306
5341
  ? ['text-to-video', 'single-image', 'multi-reference', 'video-editing']
@@ -5311,7 +5346,7 @@ function qi(e) {
5311
5346
  references: t === 'happy-horse-1-0' ? ['images', 'videos'] : ['images'],
5312
5347
  });
5313
5348
  case 'minimax-h3':
5314
- return Ke(e, {
5349
+ return Se(e, {
5315
5350
  modes: ['text_to_video', 'first_n_last_frames', 'multi_reference'],
5316
5351
  aspects: ['16:9', '21:9', '4:3', '1:1', '3:4', '9:16', 'adaptive'],
5317
5352
  minSec: 4,
@@ -5319,146 +5354,162 @@ function qi(e) {
5319
5354
  references: ['images', 'videos', 'audios', 'first_frame_image', 'last_frame_image'],
5320
5355
  });
5321
5356
  default:
5322
- return [S('Prompt text.')];
5357
+ return [$('Prompt text.')];
5323
5358
  }
5324
5359
  }
5325
- function Se(e, t = e.api.model) {
5360
+ function $e(e, t = e.api.model) {
5326
5361
  return {
5327
5362
  slug: t,
5328
5363
  name: e.name,
5329
- category: yi[e.kind],
5330
- kind: wi[e.kind],
5364
+ category: bi[e.kind],
5365
+ kind: ki[e.kind],
5331
5366
  vendor: e.vendor ?? '',
5332
5367
  description: e.desc ?? e.name,
5333
- priceFormatted: ki(e),
5368
+ priceFormatted: xi(e),
5334
5369
  unit: e.unit,
5335
- primaryToolName: bi[e.kind],
5336
- parameters: _i(e, qi(e)),
5370
+ primaryToolName: wi[e.kind],
5371
+ parameters: Pi(e, Ai(e)),
5337
5372
  };
5338
5373
  }
5339
- function Ri() {
5374
+ function Oi() {
5340
5375
  let e = {};
5341
5376
  for (let t of ne())
5342
5377
  if (t.slug !== 'seedance-2-fast') {
5343
5378
  if (t.slug === 'seedance-2-mini') {
5344
- e['seedance-2-mini'] = Se(t, 'seedance-2-mini');
5379
+ e['seedance-2-mini'] = $e(t, 'seedance-2-mini');
5345
5380
  continue;
5346
5381
  }
5347
5382
  if (t.slug === 'seedance-2') {
5348
- let i = Se(t);
5383
+ let i = $e(t);
5349
5384
  ((i.description = `${t.desc ?? t.name} Send quality fast or mini for Seedance 2.0 Fast or Mini.`),
5350
5385
  (e['seedance-2'] = i));
5351
5386
  continue;
5352
5387
  }
5353
- t.slug.startsWith('claude-') || (e[t.api.model] = Se(t));
5388
+ t.slug.startsWith('claude-') || (e[t.api.model] = $e(t));
5354
5389
  }
5355
- Object.assign(e, pt());
5390
+ Object.assign(e, dt());
5356
5391
  for (let [t, i] of Object.entries(oe))
5357
5392
  e[i] && Object.defineProperty(e, t, { value: e[i], enumerable: !1 });
5358
5393
  return e;
5359
5394
  }
5360
- function V(e) {
5395
+ function N(e) {
5361
5396
  return de[e] ?? null;
5362
5397
  }
5363
- function vt(e, t, i) {
5398
+ function Di(e, t, i) {
5364
5399
  if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite') && t === 'duration') {
5365
5400
  let r = (n) => (typeof n == 'string' ? n.trim().toLowerCase() : '');
5366
5401
  if (r(i.mode) === 'edit' || r(i.omni_reference_task_type) === 'edit') return !1;
5367
5402
  }
5368
5403
  return !0;
5369
5404
  }
5370
- function E() {
5405
+ function It(e, t) {
5406
+ let i = { ...t };
5407
+ if (e?.slug === 'seedance-2-5') {
5408
+ let r = (n) => typeof n != 'string' || !n.trim();
5409
+ for (let n of Li) (r(i.finalize) && !r(i[n]) && (i.finalize = i[n]), delete i[n]);
5410
+ if (!r(i.finalize)) return i;
5411
+ }
5412
+ for (let r of e?.parameters ?? [])
5413
+ r.default !== void 0 &&
5414
+ i[r.name] === void 0 &&
5415
+ Di(e.slug, r.name, t) &&
5416
+ (i[r.name] = r.default);
5417
+ return i;
5418
+ }
5419
+ function q() {
5371
5420
  return Object.values(de);
5372
5421
  }
5373
- var yi,
5374
- bi,
5422
+ var bi,
5375
5423
  wi,
5376
- S,
5377
- ht,
5378
- vi,
5379
- Ii,
5424
+ ki,
5425
+ $,
5380
5426
  yt,
5427
+ Ii,
5428
+ _i,
5381
5429
  bt,
5382
- $e,
5383
- Pi,
5384
- Ki,
5430
+ wt,
5431
+ Ce,
5432
+ Ti,
5385
5433
  Si,
5386
5434
  $i,
5435
+ Ci,
5387
5436
  pe,
5388
- ut,
5389
- kt,
5390
- xt,
5391
5437
  mt,
5392
- Ai,
5438
+ xt,
5439
+ vt,
5440
+ ft,
5441
+ Ri,
5393
5442
  de,
5394
- W = y(() => {
5443
+ Li,
5444
+ z = b(() => {
5395
5445
  'use strict';
5396
5446
  We();
5397
- he();
5398
- L();
5399
- Ie();
5447
+ ye();
5448
+ V();
5400
5449
  _e();
5401
- tt();
5402
- rt();
5403
- nt();
5404
- dt();
5405
- Te();
5406
- ((yi = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
5407
- (bi = {
5450
+ Pe();
5451
+ it();
5452
+ at();
5453
+ st();
5454
+ ct();
5455
+ Me();
5456
+ ((bi = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
5457
+ (wi = {
5408
5458
  video: 'generate_video',
5409
5459
  image: 'generate_image',
5410
5460
  audio: 'generate_audio',
5411
5461
  llm: 'run_task',
5412
5462
  }),
5413
- (wi = {
5463
+ (ki = {
5414
5464
  video: 'Text-to-Video',
5415
5465
  image: 'Text-to-Image',
5416
5466
  audio: 'Text-to-Audio',
5417
5467
  llm: 'Reasoning (LLM)',
5418
5468
  }));
5419
- S = (e) => ({ name: 'prompt', type: 'string', required: !0, description: e });
5420
- ((ht = {
5469
+ $ = (e) => ({ name: 'prompt', type: 'string', required: !0, description: e });
5470
+ ((yt = {
5421
5471
  name: 'creative_mode',
5422
5472
  type: 'boolean',
5423
5473
  default: !1,
5424
5474
  description:
5425
5475
  'Runs the Creative mode checkpoint at its published price (+5%). The Acceptable Use Policy applies.',
5426
5476
  }),
5427
- (vi = {
5477
+ (Ii = {
5428
5478
  name: 'creative_mode',
5429
5479
  type: 'boolean',
5430
5480
  default: !1,
5431
5481
  description: `Not available yet on this model: ${le}.`,
5432
5482
  }),
5433
- (Ii = {
5483
+ (_i = {
5434
5484
  name: 'priority',
5435
5485
  type: 'boolean',
5436
5486
  default: !1,
5437
5487
  description: 'Guaranteed speed and no queue, at the published Priority price (+6%).',
5438
5488
  }),
5439
- (yt = {
5489
+ (bt = {
5440
5490
  name: 'reference_roles',
5441
5491
  type: 'json',
5442
5492
  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
5493
  }),
5444
- (bt = {
5494
+ (wt = {
5445
5495
  name: 'auto_fit_images',
5446
5496
  type: 'boolean',
5447
5497
  default: !1,
5448
5498
  description:
5449
5499
  '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
5500
  }),
5451
- ($e = new Set(['full_access', 'is_uncensored', 'unfiltered', 'verificationSignature'])));
5452
- Pi = new Set([
5501
+ (Ce = new Set(['full_access', 'is_uncensored', 'unfiltered', 'verificationSignature'])));
5502
+ Ti = new Set([
5453
5503
  'quality',
5454
5504
  'bitrate_mode',
5455
5505
  'draft',
5506
+ 'finalize',
5456
5507
  'draft_task_id',
5457
5508
  'draft_generation_id',
5458
5509
  'pass_faces',
5459
5510
  ]);
5460
- ((Ki = [
5461
- S('The user message or task.'),
5511
+ ((Si = [
5512
+ $('The user message or task.'),
5462
5513
  { name: 'system', type: 'string', description: 'Optional system instructions.' },
5463
5514
  {
5464
5515
  name: 'messages',
@@ -5475,8 +5526,8 @@ var yi,
5475
5526
  { name: 'temperature', type: 'slider', min: 0, max: 1, step: 0.1 },
5476
5527
  { name: 'top_p', type: 'slider', min: 0, max: 1, step: 0.05 },
5477
5528
  ]),
5478
- (Si = [
5479
- S('The user message or task.'),
5529
+ ($i = [
5530
+ $('The user message or task.'),
5480
5531
  { name: 'system', type: 'string', description: 'Optional system instructions.' },
5481
5532
  {
5482
5533
  name: 'messages',
@@ -5557,15 +5608,14 @@ var yi,
5557
5608
  description: 'Video frames read a second.',
5558
5609
  },
5559
5610
  ]),
5560
- ($i = ['gemini-3.8-flash', 'gemini-3.7-flash']));
5611
+ (Ci = ['gemini-3.8-flash', 'gemini-3.7-flash']));
5561
5612
  ((pe = 'Left out: 480p, the same default as the API, the playground and workflow steps.'),
5562
- (ut = [
5613
+ (mt = [
5563
5614
  {
5564
5615
  name: 'prompt',
5565
5616
  type: 'string',
5566
- required: !0,
5567
5617
  description:
5568
- 'Text prompt describing the desired video scene, actions, camera angles, lighting, and style.',
5618
+ 'Required, except with finalize. Text prompt describing the desired video scene, actions, camera angles, lighting, and style.',
5569
5619
  },
5570
5620
  {
5571
5621
  name: 'mode',
@@ -5597,8 +5647,8 @@ var yi,
5597
5647
  name: 'resolution',
5598
5648
  type: 'select',
5599
5649
  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}`,
5650
+ options: ['480p', '720p', '1080p', '4k'],
5651
+ 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
5652
  },
5603
5653
  {
5604
5654
  name: 'aspect_ratio',
@@ -5647,19 +5697,23 @@ var yi,
5647
5697
  type: 'boolean',
5648
5698
  default: !1,
5649
5699
  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.',
5700
+ '480p preview, billed at the 480p rate. Resolution must be 480p. Render the final 1080p or 4k video with finalize within 7 days.',
5651
5701
  },
5652
5702
  {
5653
- name: 'draft_task_id',
5703
+ name: 'finalize',
5654
5704
  type: 'string',
5655
5705
  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.',
5706
+ '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.',
5707
+ },
5708
+ {
5709
+ name: 'draft_task_id',
5710
+ type: 'string',
5711
+ description: 'Older name for finalize. Same final render.',
5657
5712
  },
5658
5713
  {
5659
5714
  name: 'draft_generation_id',
5660
5715
  type: 'string',
5661
- description:
5662
- 'Tein generation id of a succeeded Seedance 2.5 draft. Same final render as draft_task_id.',
5716
+ description: 'Older name for finalize. Same final render.',
5663
5717
  },
5664
5718
  {
5665
5719
  name: 'images',
@@ -5705,19 +5759,19 @@ var yi,
5705
5759
  'Keeps real faces in reference images. On by default. Send false to turn it off.',
5706
5760
  },
5707
5761
  ]),
5708
- (kt = {
5762
+ (xt = {
5709
5763
  name: 'images',
5710
5764
  type: 'string[]',
5711
5765
  description:
5712
5766
  '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
5767
  }),
5714
- (xt = {
5768
+ (vt = {
5715
5769
  name: 'audios',
5716
5770
  type: 'string[]',
5717
5771
  description:
5718
5772
  '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
5773
  }),
5720
- (mt = [
5774
+ (ft = [
5721
5775
  {
5722
5776
  name: 'prompt',
5723
5777
  type: 'string',
@@ -5795,8 +5849,8 @@ var yi,
5795
5849
  description:
5796
5850
  'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
5797
5851
  },
5798
- kt,
5799
5852
  xt,
5853
+ vt,
5800
5854
  {
5801
5855
  name: 'first_frame_image',
5802
5856
  type: 'string',
@@ -5817,7 +5871,7 @@ var yi,
5817
5871
  'Keeps real faces in reference images. On by default. Send false to turn it off.',
5818
5872
  },
5819
5873
  ]),
5820
- (Ai = [
5874
+ (Ri = [
5821
5875
  {
5822
5876
  name: 'prompt',
5823
5877
  type: 'string',
@@ -5872,8 +5926,8 @@ var yi,
5872
5926
  description:
5873
5927
  'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
5874
5928
  },
5875
- kt,
5876
5929
  xt,
5930
+ vt,
5877
5931
  {
5878
5932
  name: 'first_frame_image',
5879
5933
  type: 'string',
@@ -5888,52 +5942,53 @@ var yi,
5888
5942
  'Keeps real faces in reference images. On by default. Send false to turn it off.',
5889
5943
  },
5890
5944
  ]));
5891
- de = Ri();
5945
+ de = Oi();
5946
+ Li = ['draft_task_id', 'draft_generation_id'];
5892
5947
  });
5893
5948
  function ce(e) {
5894
5949
  let t = '/v1/pricing/models',
5895
5950
  i = e?.trim();
5896
5951
  return i ? `${t}?model=${encodeURIComponent(i)}` : t;
5897
5952
  }
5898
- var Ee = y(() => {
5953
+ var qe = b(() => {
5899
5954
  'use strict';
5900
5955
  });
5901
- function qt(e) {
5956
+ function At(e) {
5902
5957
  return e.length <= 1 ? (e[0] ?? '') : `${e.slice(0, -1).join(', ')} and ${e[e.length - 1]}`;
5903
5958
  }
5904
- function At(e) {
5959
+ function Rt(e) {
5905
5960
  let t = ne().filter((s) => s.kind === e && s.unfiltered != null),
5906
5961
  i = t.filter((s) => G.includes(s.api.model)).map((s) => s.name),
5907
5962
  r = t.filter((s) => !G.includes(s.api.model)).map((s) => s.name);
5908
5963
  return [
5909
5964
  ...(i.length
5910
- ? [`${qt(i)}: runs the Creative mode checkpoint at its published price (+5%).`]
5965
+ ? [`${At(i)}: runs the Creative mode checkpoint at its published price (+5%).`]
5911
5966
  : []),
5912
- ...(r.length ? [`Not available yet on ${qt(r)}: ${le}.`] : []),
5967
+ ...(r.length ? [`Not available yet on ${At(r)}: ${le}.`] : []),
5913
5968
  'The Acceptable Use Policy applies.',
5914
5969
  ].join(' ');
5915
5970
  }
5916
- function ar(e) {
5917
- if (ir.has(e.name)) return e;
5971
+ function or(e) {
5972
+ if (nr.has(e.name)) return e;
5918
5973
  let t = e.inputSchema.properties;
5919
5974
  return !t || t.callback_url
5920
5975
  ? e
5921
- : { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url: tr } } };
5976
+ : { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url: ar } } };
5922
5977
  }
5923
- function nr(e) {
5978
+ function lr(e) {
5924
5979
  let t = e.inputSchema.properties;
5925
5980
  if (!t) return e;
5926
5981
  let i = !1,
5927
5982
  r = {};
5928
5983
  for (let [n, s] of Object.entries(t))
5929
- Rt.has(n) && s.type === 'string' && !s.format
5984
+ Ot.has(n) && s.type === 'string' && !s.format
5930
5985
  ? ((r[n] = { ...s, format: 'uri' }), (i = !0))
5931
- : Rt.has(n) && s.type === 'array' && s.items?.type === 'string' && !s.items.format
5986
+ : Ot.has(n) && s.type === 'array' && s.items?.type === 'string' && !s.items.format
5932
5987
  ? ((r[n] = { ...s, items: { ...s.items, format: 'uri' } }), (i = !0))
5933
5988
  : (r[n] = s);
5934
5989
  return i ? { ...e, inputSchema: { ...e.inputSchema, properties: r } } : e;
5935
5990
  }
5936
- function sr(e) {
5991
+ function pr(e) {
5937
5992
  switch (e.type) {
5938
5993
  case 'string':
5939
5994
  return {
@@ -5988,11 +6043,11 @@ function sr(e) {
5988
6043
  return { type: 'string', description: e.description };
5989
6044
  }
5990
6045
  }
5991
- function or(e, t) {
6046
+ function dr(e, t) {
5992
6047
  let i = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
5993
6048
  r = {},
5994
6049
  n = [];
5995
- for (let o of e.parameters) ((r[o.name] = sr(o)), o.required && n.push(o.name));
6050
+ for (let o of e.parameters) ((r[o.name] = pr(o)), o.required && n.push(o.name));
5996
6051
  let s = {
5997
6052
  type: 'object',
5998
6053
  properties: r,
@@ -6005,11 +6060,11 @@ function or(e, t) {
6005
6060
  inputSchema: s,
6006
6061
  };
6007
6062
  }
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'),
6063
+ function cr() {
6064
+ let e = q().filter((d) => d.category === 'Image'),
6065
+ t = q().filter((d) => d.category === 'Video'),
6066
+ i = q().filter((d) => d.category === 'Text'),
6067
+ r = q().filter((d) => d.category === 'Audio'),
6013
6068
  n = {
6014
6069
  name: 'generate_image',
6015
6070
  description:
@@ -6023,7 +6078,7 @@ function lr() {
6023
6078
  },
6024
6079
  model: {
6025
6080
  type: 'string',
6026
- enum: e.map((c) => c.slug),
6081
+ enum: e.map((d) => d.slug),
6027
6082
  default: 'gpt-image-2',
6028
6083
  description: 'The image model to use (default: gpt-image-2).',
6029
6084
  },
@@ -6101,7 +6156,7 @@ function lr() {
6101
6156
  maximum: 2147483647,
6102
6157
  description: 'Nano Banana 2 and Nano Banana Pro. Omit it for a new image each time.',
6103
6158
  },
6104
- creative_mode: { type: 'boolean', default: !1, description: At('image') },
6159
+ creative_mode: { type: 'boolean', default: !1, description: Rt('image') },
6105
6160
  },
6106
6161
  required: ['prompt'],
6107
6162
  additionalProperties: !0,
@@ -6121,7 +6176,7 @@ function lr() {
6121
6176
  },
6122
6177
  model: {
6123
6178
  type: 'string',
6124
- enum: t.map((c) => c.slug),
6179
+ enum: t.map((d) => d.slug),
6125
6180
  default: 'seedance-2-5',
6126
6181
  description: 'The video model to use (default: seedance-2-5).',
6127
6182
  },
@@ -6138,7 +6193,7 @@ function lr() {
6138
6193
  default: '480p',
6139
6194
  description: 'Video resolution (the lowest price is the default; see each model tool).',
6140
6195
  },
6141
- creative_mode: { type: 'boolean', default: !1, description: At('video') },
6196
+ creative_mode: { type: 'boolean', default: !1, description: Rt('video') },
6142
6197
  priority: {
6143
6198
  type: 'boolean',
6144
6199
  default: !1,
@@ -6206,7 +6261,7 @@ function lr() {
6206
6261
  prompt: { type: 'string', description: 'The reasoning task or query to execute.' },
6207
6262
  model: {
6208
6263
  type: 'string',
6209
- enum: i.map((c) => c.slug),
6264
+ enum: i.map((d) => d.slug),
6210
6265
  default: 'gpt-6-astra',
6211
6266
  description: 'The reasoning model to use (default: gpt-6-astra).',
6212
6267
  },
@@ -6227,7 +6282,7 @@ function lr() {
6227
6282
  additionalProperties: !0,
6228
6283
  },
6229
6284
  },
6230
- p = {
6285
+ l = {
6231
6286
  name: 'generate_mesh',
6232
6287
  description: 'Split an image into layers with Seedream 5.0 Pro (layer decomposition).',
6233
6288
  inputSchema: {
@@ -6244,7 +6299,7 @@ function lr() {
6244
6299
  additionalProperties: !0,
6245
6300
  },
6246
6301
  },
6247
- l = {
6302
+ c = {
6248
6303
  name: 'get_generation_status',
6249
6304
  description:
6250
6305
  'Check the progress and retrieve final output URLs for any in-progress generation using its request_id.',
@@ -6260,10 +6315,10 @@ function lr() {
6260
6315
  additionalProperties: !0,
6261
6316
  },
6262
6317
  },
6263
- d = pr();
6264
- return [n, s, o, u, p, d, l, rr];
6318
+ p = ur();
6319
+ return [n, s, o, u, l, p, c, sr];
6265
6320
  }
6266
- function pr() {
6321
+ function ur() {
6267
6322
  return {
6268
6323
  name: 'upload_asset',
6269
6324
  description:
@@ -6310,26 +6365,26 @@ function pr() {
6310
6365
  },
6311
6366
  };
6312
6367
  }
6313
- function Le() {
6314
- let e = lr(),
6315
- t = E().map((i) => or(i));
6316
- return [...e, ...t].map(ar).map(nr);
6368
+ function Ve() {
6369
+ let e = cr(),
6370
+ t = q().map((i) => dr(i));
6371
+ return [...e, ...t].map(or).map(lr);
6317
6372
  }
6318
- var tr,
6319
- ir,
6320
- rr,
6321
- Rt,
6322
- Ot = y(() => {
6373
+ var ar,
6374
+ nr,
6375
+ sr,
6376
+ Ot,
6377
+ Dt = b(() => {
6323
6378
  'use strict';
6324
- L();
6325
- Te();
6326
- W();
6327
- ((tr = {
6379
+ V();
6380
+ Me();
6381
+ z();
6382
+ ((ar = {
6328
6383
  type: 'string',
6329
6384
  description:
6330
6385
  '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
6386
  }),
6332
- (ir = new Set([
6387
+ (nr = new Set([
6333
6388
  'upload_asset',
6334
6389
  'upload_media',
6335
6390
  'upload_image',
@@ -6337,7 +6392,7 @@ var tr,
6337
6392
  'check_status',
6338
6393
  'get_pricing',
6339
6394
  ])),
6340
- (rr = {
6395
+ (sr = {
6341
6396
  name: 'get_pricing',
6342
6397
  description:
6343
6398
  '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 +6407,7 @@ var tr,
6352
6407
  additionalProperties: !1,
6353
6408
  },
6354
6409
  }));
6355
- Rt = new Set([
6410
+ Ot = new Set([
6356
6411
  'image',
6357
6412
  'images',
6358
6413
  'image_url',
@@ -6369,19 +6424,19 @@ var tr,
6369
6424
  'lipsyncing_audio',
6370
6425
  ]);
6371
6426
  });
6372
- var Jt = {};
6373
- ei(Jt, {
6374
- forgetToolSchemas: () => fr,
6375
- jsonRpcAnswer: () => Nt,
6376
- preprocessLocalFiles: () => Ft,
6377
- startStdioServer: () => Gt,
6427
+ var Ht = {};
6428
+ ti(Ht, {
6429
+ forgetToolSchemas: () => yr,
6430
+ jsonRpcAnswer: () => Ut,
6431
+ preprocessLocalFiles: () => Gt,
6432
+ startStdioServer: () => Jt,
6378
6433
  });
6379
- function dr(e) {
6434
+ function mr(e) {
6380
6435
  let t = (i) =>
6381
6436
  !!i && typeof i == 'object' && i.jsonrpc === '2.0' && ('result' in i || 'error' in i);
6382
6437
  return Array.isArray(e) ? e.length > 0 && e.every(t) : t(e);
6383
6438
  }
6384
- function Nt(e, t, i) {
6439
+ function Ut(e, t, i) {
6385
6440
  let r = e?.id,
6386
6441
  n = r == null,
6387
6442
  s = null;
@@ -6390,7 +6445,7 @@ function Nt(e, t, i) {
6390
6445
  } catch {
6391
6446
  s = null;
6392
6447
  }
6393
- if (s !== null && dr(s)) return n ? null : s;
6448
+ if (s !== null && mr(s)) return n ? null : s;
6394
6449
  if (n) return null;
6395
6450
  if (!i && t >= 200 && t < 300) return;
6396
6451
  let o = s?.error,
@@ -6400,60 +6455,60 @@ function Nt(e, t, i) {
6400
6455
  : o && typeof o == 'object' && typeof o.message == 'string'
6401
6456
  ? o.message
6402
6457
  : `Tein answered with HTTP ${t}.`,
6403
- p = o && typeof o == 'object' && typeof o.code == 'string' ? o.code : null;
6458
+ l = o && typeof o == 'object' && typeof o.code == 'string' ? o.code : null;
6404
6459
  return {
6405
6460
  jsonrpc: '2.0',
6406
6461
  id: r,
6407
6462
  error: {
6408
6463
  code: t === 401 ? -32001 : -32603,
6409
6464
  message: u,
6410
- data: { status: t, ...(p ? { code: p } : {}) },
6465
+ data: { status: t, ...(l ? { code: l } : {}) },
6411
6466
  },
6412
6467
  };
6413
6468
  }
6414
- function cr() {
6469
+ function fr() {
6415
6470
  let e = process.argv.slice(2),
6416
6471
  t = e.indexOf('--api-key');
6417
- return K(t >= 0 ? e[t + 1] : void 0);
6472
+ return S(t >= 0 ? e[t + 1] : void 0);
6418
6473
  }
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())
6474
+ async function jt(e, t, i) {
6475
+ let r = U.default.resolve(e);
6476
+ if (!R.default.existsSync(r) || !R.default.statSync(r).isFile())
6422
6477
  throw new Error(`File not found: ${e}`);
6423
- let n = A.default.readFileSync(r),
6478
+ let n = R.default.readFileSync(r),
6424
6479
  s = n.toString('base64'),
6425
6480
  o = n.length,
6426
6481
  u = `${i.replace(/\/$/, '')}/v1/upload`,
6427
- p = await fetch(u, {
6482
+ l = await fetch(u, {
6428
6483
  method: 'POST',
6429
6484
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${t}` },
6430
6485
  body: JSON.stringify({ data: s }),
6431
6486
  });
6432
- if (!p.ok) {
6433
- let d = `Upload failed (HTTP ${p.status})`;
6487
+ if (!l.ok) {
6488
+ let p = `Upload failed (HTTP ${l.status})`;
6434
6489
  try {
6435
- let c = await p.json();
6436
- d = (typeof c.error == 'string' ? c.error : c.error?.message) || c.message || d;
6490
+ let d = await l.json();
6491
+ p = (typeof d.error == 'string' ? d.error : d.error?.message) || d.message || p;
6437
6492
  } catch {}
6438
- throw new Error(d);
6493
+ throw new Error(p);
6439
6494
  }
6440
- let l = await p.json();
6495
+ let c = await l.json();
6441
6496
  return {
6442
- url: l.url,
6443
- key: l.key,
6444
- sizeBytes: l.size_bytes || o,
6445
- mimeType: l.mime_type || l.mimeType || 'image/png',
6497
+ url: c.url,
6498
+ key: c.key,
6499
+ sizeBytes: c.size_bytes || o,
6500
+ mimeType: c.mime_type || c.mimeType || 'image/png',
6446
6501
  };
6447
6502
  }
6448
- function jt(e) {
6449
- return ur.has(N.default.extname(e).toLowerCase());
6450
- }
6451
6503
  function Bt(e) {
6504
+ return gr.has(U.default.extname(e).toLowerCase());
6505
+ }
6506
+ function Ft(e) {
6452
6507
  return new Error(
6453
- `Tein uploads image, video and audio files only, and ${N.default.basename(e)} is not one.`,
6508
+ `Tein uploads image, video and audio files only, and ${U.default.basename(e)} is not one.`,
6454
6509
  );
6455
6510
  }
6456
- function mr(e) {
6511
+ function hr(e) {
6457
6512
  let t = e.trim();
6458
6513
  if (
6459
6514
  !t ||
@@ -6463,10 +6518,10 @@ function mr(e) {
6463
6518
  `)
6464
6519
  )
6465
6520
  return null;
6466
- let i = N.default.resolve(t);
6467
- return A.default.existsSync(i) && A.default.statSync(i).isFile() ? i : null;
6521
+ let i = U.default.resolve(t);
6522
+ return R.default.existsSync(i) && R.default.statSync(i).isFile() ? i : null;
6468
6523
  }
6469
- function Ne(e) {
6524
+ function Ue(e) {
6470
6525
  if (Array.isArray(e))
6471
6526
  for (let t of e) {
6472
6527
  let i = t;
@@ -6476,12 +6531,12 @@ function Ne(e) {
6476
6531
  Q.set(i.name, i.inputSchema);
6477
6532
  }
6478
6533
  }
6479
- function fr() {
6480
- (Q.clear(), (Ve = 0));
6534
+ function yr() {
6535
+ (Q.clear(), (Ne = 0));
6481
6536
  }
6482
- async function gr(e, t) {
6483
- if (!(Date.now() - Ve < 6e4)) {
6484
- Ve = Date.now();
6537
+ async function br(e, t) {
6538
+ if (!(Date.now() - Ne < 6e4)) {
6539
+ Ne = Date.now();
6485
6540
  try {
6486
6541
  let r = await (
6487
6542
  await fetch(e, {
@@ -6491,39 +6546,39 @@ async function gr(e, t) {
6491
6546
  signal: AbortSignal.timeout(1e4),
6492
6547
  })
6493
6548
  ).json();
6494
- Ne(r.result?.tools);
6549
+ Ue(r.result?.tools);
6495
6550
  } catch {}
6496
6551
  }
6497
6552
  }
6498
- function hr(e) {
6553
+ function wr(e) {
6499
6554
  return e
6500
6555
  ? e.type === 'string'
6501
6556
  ? e.format === 'uri'
6502
6557
  : e.type === 'array' && e.items?.format === 'uri'
6503
6558
  : !1;
6504
6559
  }
6505
- async function Dt(e, t, i) {
6560
+ async function Lt(e, t, i) {
6506
6561
  if (typeof e != 'string') return e;
6507
- let r = mr(e);
6562
+ let r = hr(e);
6508
6563
  if (!r) return e;
6509
- if (!jt(r)) throw Bt(r);
6510
- return (await Ut(r, t, i)).url;
6564
+ if (!Bt(r)) throw Ft(r);
6565
+ return (await jt(r, t, i)).url;
6511
6566
  }
6512
- async function Ft(e, t, i, r, n) {
6513
- (Q.size === 0 && Ne(Le()), Q.has(e) || (await gr(n, i)));
6567
+ async function Gt(e, t, i, r, n) {
6568
+ (Q.size === 0 && Ue(Ve()), Q.has(e) || (await br(n, i)));
6514
6569
  let s = Q.get(e)?.properties;
6515
6570
  if (!s) return t;
6516
6571
  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);
6572
+ for (let [u, l] of Object.entries(t))
6573
+ if (wr(s[u]))
6574
+ if (Array.isArray(l)) {
6575
+ let c = [];
6576
+ for (let p of l) c.push(await Lt(p, i, r));
6577
+ o[u] = c;
6578
+ } else o[u] = await Lt(l, i, r);
6524
6579
  return o;
6525
6580
  }
6526
- function yr(e) {
6581
+ function kr(e) {
6527
6582
  let t = e.id ?? null;
6528
6583
  switch (e.method) {
6529
6584
  case 'initialize':
@@ -6541,7 +6596,7 @@ function yr(e) {
6541
6596
  case 'ping':
6542
6597
  return { jsonrpc: '2.0', id: t, result: {} };
6543
6598
  case 'tools/list':
6544
- return { jsonrpc: '2.0', id: t, result: { tools: Le() } };
6599
+ return { jsonrpc: '2.0', id: t, result: { tools: Ve() } };
6545
6600
  case 'tools/call':
6546
6601
  return {
6547
6602
  jsonrpc: '2.0',
@@ -6564,13 +6619,13 @@ function yr(e) {
6564
6619
  };
6565
6620
  }
6566
6621
  }
6567
- async function Gt() {
6568
- if (Lt) return;
6569
- Lt = !0;
6570
- let e = cr(),
6571
- t = k(),
6622
+ async function Jt() {
6623
+ if (Vt) return;
6624
+ Vt = !0;
6625
+ let e = fr(),
6626
+ t = x(),
6572
6627
  i = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
6573
- (Vt.default
6628
+ (Nt.default
6574
6629
  .createInterface({ input: process.stdin, output: process.stdout, terminal: !1 })
6575
6630
  .on('line', async (n) => {
6576
6631
  let s = n.trim();
@@ -6578,14 +6633,14 @@ async function Gt() {
6578
6633
  try {
6579
6634
  let o = JSON.parse(s);
6580
6635
  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)}`;
6636
+ let l = o.params.name,
6637
+ c = o.params.arguments || {};
6638
+ if (l === 'get_pricing') {
6639
+ let p = typeof c.model == 'string' ? c.model.trim() : '',
6640
+ d = `${t.replace(/\/+$/, '')}${ce(p)}`;
6586
6641
  try {
6587
- let m = await fetch(c, { signal: AbortSignal.timeout(1e4) }),
6588
- f = await m.text();
6642
+ let m = await fetch(d, { signal: AbortSignal.timeout(1e4) }),
6643
+ h = await m.text();
6589
6644
  process.stdout.write(
6590
6645
  JSON.stringify({
6591
6646
  jsonrpc: '2.0',
@@ -6594,7 +6649,7 @@ async function Gt() {
6594
6649
  content: [
6595
6650
  {
6596
6651
  type: 'text',
6597
- text: m.ok ? f : `Pricing request failed (${m.status}). ${f}`,
6652
+ text: m.ok ? h : `Pricing request failed (${m.status}). ${h}`,
6598
6653
  },
6599
6654
  ],
6600
6655
  isError: !m.ok,
@@ -6604,13 +6659,13 @@ async function Gt() {
6604
6659
  `,
6605
6660
  );
6606
6661
  } catch (m) {
6607
- let f = m instanceof Error ? m.message : String(m);
6662
+ let h = m instanceof Error ? m.message : String(m);
6608
6663
  process.stdout.write(
6609
6664
  JSON.stringify({
6610
6665
  jsonrpc: '2.0',
6611
6666
  id: o.id,
6612
6667
  result: {
6613
- content: [{ type: 'text', text: `Could not reach Tein prices: ${f}` }],
6668
+ content: [{ type: 'text', text: `Could not reach Tein prices: ${h}` }],
6614
6669
  isError: !0,
6615
6670
  },
6616
6671
  }) +
@@ -6620,20 +6675,20 @@ async function Gt() {
6620
6675
  }
6621
6676
  return;
6622
6677
  }
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;
6678
+ if (l === 'upload_asset' || l === 'upload_media' || l === 'upload_image') {
6679
+ let p = c.path || c.filepath || c.file_path || c.file || c.data;
6625
6680
  if (
6626
- typeof d == 'string' &&
6627
- !d.startsWith('http://') &&
6628
- !d.startsWith('https://') &&
6629
- !d.startsWith('data:')
6681
+ typeof p == 'string' &&
6682
+ !p.startsWith('http://') &&
6683
+ !p.startsWith('https://') &&
6684
+ !p.startsWith('data:')
6630
6685
  )
6631
6686
  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),
6687
+ let d = U.default.resolve(p.trim());
6688
+ if (R.default.existsSync(d) && R.default.statSync(d).isFile() && e) {
6689
+ if (!Bt(d)) throw Ft(d);
6690
+ let m = await jt(d, e, t),
6691
+ h = (m.sizeBytes / 1024).toFixed(1),
6637
6692
  ue =
6638
6693
  m.mimeType.startsWith('image/') ||
6639
6694
  /\.(png|jpe?g|webp|gif|svg)$/i.test(m.url)
@@ -6641,7 +6696,7 @@ async function Gt() {
6641
6696
 
6642
6697
  ![Uploaded Asset](${m.url})`
6643
6698
  : '',
6644
- h = {
6699
+ me = {
6645
6700
  jsonrpc: '2.0',
6646
6701
  id: o.id,
6647
6702
  result: {
@@ -6652,7 +6707,7 @@ async function Gt() {
6652
6707
 
6653
6708
  - **URL:** ${m.url}
6654
6709
  - **Type:** \`${m.mimeType}\`
6655
- - **Size:** ${f} KB${ue}
6710
+ - **Size:** ${h} KB${ue}
6656
6711
 
6657
6712
  Pass this URL to any Tein generation tool.`,
6658
6713
  },
@@ -6661,14 +6716,14 @@ Pass this URL to any Tein generation tool.`,
6661
6716
  },
6662
6717
  };
6663
6718
  process.stdout.write(
6664
- JSON.stringify(h) +
6719
+ JSON.stringify(me) +
6665
6720
  `
6666
6721
  `,
6667
6722
  );
6668
6723
  return;
6669
6724
  }
6670
- } catch (c) {
6671
- let m = c instanceof Error ? c.message : String(c);
6725
+ } catch (d) {
6726
+ let m = d instanceof Error ? d.message : String(d);
6672
6727
  process.stdout.write(
6673
6728
  JSON.stringify({
6674
6729
  jsonrpc: '2.0',
@@ -6688,9 +6743,9 @@ Pass this URL to any Tein generation tool.`,
6688
6743
  }
6689
6744
  if (e)
6690
6745
  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);
6746
+ o.params.arguments = await Gt(String(l), c, e, t, i);
6747
+ } catch (p) {
6748
+ let d = p instanceof Error ? p.message : String(p);
6694
6749
  process.stdout.write(
6695
6750
  JSON.stringify({
6696
6751
  jsonrpc: '2.0',
@@ -6699,7 +6754,7 @@ Pass this URL to any Tein generation tool.`,
6699
6754
  content: [
6700
6755
  {
6701
6756
  type: 'text',
6702
- text: `Failed to read or upload a local file before calling Tein: ${c}`,
6757
+ text: `Failed to read or upload a local file before calling Tein: ${d}`,
6703
6758
  },
6704
6759
  ],
6705
6760
  isError: !0,
@@ -6713,25 +6768,25 @@ Pass this URL to any Tein generation tool.`,
6713
6768
  }
6714
6769
  if (e)
6715
6770
  try {
6716
- let p = await fetch(i, {
6771
+ let l = await fetch(i, {
6717
6772
  method: 'POST',
6718
6773
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${e}` },
6719
6774
  body: JSON.stringify(o),
6720
6775
  }),
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),
6776
+ c = await l.text(),
6777
+ p = Ut(o, l.status, c);
6778
+ if (p === null) return;
6779
+ if (p) {
6780
+ (o?.method === 'tools/list' && Ue(p.result?.tools),
6726
6781
  process.stdout.write(
6727
- JSON.stringify(d) +
6782
+ JSON.stringify(p) +
6728
6783
  `
6729
6784
  `,
6730
6785
  ));
6731
6786
  return;
6732
6787
  }
6733
6788
  } catch {}
6734
- let u = yr(o);
6789
+ let u = kr(o);
6735
6790
  u !== null &&
6736
6791
  process.stdout.write(
6737
6792
  JSON.stringify(u) +
@@ -6754,22 +6809,22 @@ Pass this URL to any Tein generation tool.`,
6754
6809
  process.stderr.write(`Tein AI MCP Server running on stdio transport.
6755
6810
  `));
6756
6811
  }
6757
- var A,
6758
- N,
6759
- Vt,
6760
- ur,
6812
+ var R,
6813
+ U,
6814
+ Nt,
6815
+ gr,
6761
6816
  Q,
6762
- Ve,
6763
- Lt,
6764
- Ht = y(() => {
6817
+ Ne,
6818
+ Vt,
6819
+ zt = b(() => {
6765
6820
  '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([
6821
+ ((R = I(require('node:fs'))),
6822
+ (U = I(require('node:path'))),
6823
+ (Nt = I(require('node:readline'))));
6824
+ qe();
6825
+ Dt();
6826
+ E();
6827
+ gr = new Set([
6773
6828
  '.png',
6774
6829
  '.jpg',
6775
6830
  '.jpeg',
@@ -6795,42 +6850,42 @@ var A,
6795
6850
  '.flac',
6796
6851
  '.opus',
6797
6852
  ]);
6798
- ((Q = new Map()), (Ve = 0));
6799
- Lt = !1;
6853
+ ((Q = new Map()), (Ne = 0));
6854
+ Vt = !1;
6800
6855
  require.main === module &&
6801
- Gt().catch((e) => {
6856
+ Jt().catch((e) => {
6802
6857
  (process.stderr.write(`Fatal error in Tein MCP CLI: ${e}
6803
6858
  `),
6804
6859
  process.exit(1));
6805
6860
  });
6806
6861
  });
6807
- var ii =
6862
+ var ri =
6808
6863
  !process.env.NO_COLOR &&
6809
6864
  (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));
6865
+ function w(e, t) {
6866
+ return (i) => (ri ? `\x1B[${e}m${i}\x1B[${t}m` : String(i));
6812
6867
  }
6813
6868
  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),
6869
+ bold: w(1, 22),
6870
+ dim: w(2, 22),
6871
+ italic: w(3, 23),
6872
+ underline: w(4, 24),
6873
+ inverse: w(7, 27),
6874
+ black: w(30, 39),
6875
+ red: w(31, 39),
6876
+ green: w(32, 39),
6877
+ yellow: w(33, 39),
6878
+ blue: w(34, 39),
6879
+ magenta: w(35, 39),
6880
+ cyan: w(36, 39),
6881
+ white: w(37, 39),
6882
+ gray: w(90, 39),
6883
+ bgBlue: w(44, 49),
6884
+ bgMagenta: w(45, 49),
6885
+ bgCyan: w(46, 49),
6886
+ bgGreen: w(42, 49),
6832
6887
  },
6833
- P = class {
6888
+ T = class {
6834
6889
  constructor(t = '') {
6835
6890
  this.frames = [
6836
6891
  '\u280B',
@@ -6892,22 +6947,22 @@ var a = {
6892
6947
  process.stdout.isTTY && process.stdout.write('\r\x1B[K'));
6893
6948
  }
6894
6949
  };
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');
6950
+ var O = I(require('node:fs')),
6951
+ A = I(require('node:path'));
6952
+ var ee = I(require('node:fs')),
6953
+ Fe = I(require('node:path')),
6954
+ Ge = require('node:stream/promises');
6900
6955
  var Z = '1.1.7';
6901
- var ri = new Set([
6956
+ var ai = new Set([
6902
6957
  'account_suspended',
6903
6958
  'account_terminated',
6904
6959
  'creative_mode_restricted',
6905
6960
  'unfiltered_restricted',
6906
6961
  'workspace_paused',
6907
6962
  ]),
6908
- I = 1,
6909
- ai = 3,
6910
- w = class extends Error {
6963
+ _ = 1,
6964
+ ni = 3,
6965
+ k = class extends Error {
6911
6966
  constructor(t, i, r, n = {}) {
6912
6967
  (super(i),
6913
6968
  (this.name = 'TeinApiError'),
@@ -6916,29 +6971,29 @@ var ri = new Set([
6916
6971
  (this.fields = n));
6917
6972
  }
6918
6973
  get exitCode() {
6919
- return this.code && ri.has(this.code) ? ai : I;
6974
+ return this.code && ai.has(this.code) ? ni : _;
6920
6975
  }
6921
6976
  };
6922
- function ni(e, t, i) {
6977
+ function si(e, t, i) {
6923
6978
  let r = `HTTP ${e}${t ? ` ${t}` : ''}`;
6924
- if (!i || typeof i != 'object') return new w(e, r);
6979
+ if (!i || typeof i != 'object') return new k(e, r);
6925
6980
  let n = i;
6926
6981
  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);
6982
+ let p = n.error,
6983
+ { code: d, message: m, ...h } = p;
6984
+ return new k(e, typeof m == 'string' && m ? m : r, typeof d == 'string' ? d : void 0, h);
6930
6985
  }
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);
6986
+ let { error: s, code: o, message: u, ...l } = n,
6987
+ c = (typeof s == 'string' && s) || (typeof u == 'string' && u) || r;
6988
+ return new k(e, c, typeof o == 'string' ? o : void 0, l);
6934
6989
  }
6935
- function Ue(e) {
6990
+ function je(e) {
6936
6991
  return typeof e == 'number' && Number.isFinite(e) ? `$${e.toFixed(4)}` : null;
6937
6992
  }
6938
- function M(e) {
6993
+ function K(e) {
6939
6994
  let t = [e.message],
6940
- i = Ue(e.fields.required),
6941
- r = Ue(e.fields.balance);
6995
+ i = je(e.fields.required),
6996
+ r = je(e.fields.balance);
6942
6997
  (i || r) &&
6943
6998
  t.push([i ? `Required: ${i}` : '', r ? `Balance: ${r}` : ''].filter(Boolean).join(' '));
6944
6999
  let n = e.fields.org_name ?? e.fields.orgName;
@@ -6946,22 +7001,22 @@ function M(e) {
6946
7001
  let s = e.fields.url ?? e.fields.appeal_url ?? e.fields.top_up_url;
6947
7002
  return (typeof s == 'string' && s && t.push(s), e.code && t.push(`(${e.code})`), t);
6948
7003
  }
6949
- function si(e) {
7004
+ function oi(e) {
6950
7005
  return /\.(mp4|webm|mov)(\?|$)/i.test(e)
6951
7006
  ? 'video'
6952
7007
  : /\.(mp3|wav|ogg|flac)(\?|$)/i.test(e)
6953
7008
  ? 'audio'
6954
7009
  : 'image';
6955
7010
  }
6956
- function je(e) {
7011
+ function Be(e) {
6957
7012
  let t = [];
6958
7013
  for (let i of e.data ?? [])
6959
7014
  typeof i.message?.content == 'string'
6960
7015
  ? t.push({ type: 'text', text: i.message.content })
6961
- : i.url && t.push({ type: si(i.url), url: i.url });
7016
+ : i.url && t.push({ type: oi(i.url), url: i.url });
6962
7017
  return t;
6963
7018
  }
6964
- var T = class {
7019
+ var M = class {
6965
7020
  constructor(t, i) {
6966
7021
  ((this.apiKey = t), (this.baseUrl = i.replace(/\/+$/, '')));
6967
7022
  }
@@ -6984,7 +7039,7 @@ var T = class {
6984
7039
  try {
6985
7040
  s = await n.json();
6986
7041
  } catch {}
6987
- throw ni(n.status, n.statusText, s);
7042
+ throw si(n.status, n.statusText, s);
6988
7043
  }
6989
7044
  return await n.json();
6990
7045
  }
@@ -6998,7 +7053,7 @@ var T = class {
6998
7053
  n === 'succeeded' || n === 'failed' || n === 'expired' || n === 'cancelled'
6999
7054
  ? n
7000
7055
  : 'processing',
7001
- o = je(r);
7056
+ o = Be(r);
7002
7057
  return {
7003
7058
  request_id: r.request_id || r.id || '',
7004
7059
  model: r.model,
@@ -7016,7 +7071,7 @@ var T = class {
7016
7071
  r === 'succeeded' || r === 'failed' || r === 'expired' || r === 'cancelled'
7017
7072
  ? r
7018
7073
  : 'processing',
7019
- s = je(i),
7074
+ s = Be(i),
7020
7075
  o = i.error && typeof i.error.message == 'string' ? i.error.message : null;
7021
7076
  return {
7022
7077
  request_id: i.id || t,
@@ -7034,50 +7089,50 @@ var T = class {
7034
7089
  async downloadOutput(t, i) {
7035
7090
  let r = await fetch(t);
7036
7091
  if (!r.ok) throw new Error(`The file could not be downloaded (HTTP ${r.status})`);
7037
- let n = Be.default.dirname(i);
7092
+ let n = Fe.default.dirname(i);
7038
7093
  ee.default.existsSync(n) || ee.default.mkdirSync(n, { recursive: !0 });
7039
7094
  let s = ee.default.createWriteStream(i);
7040
- return (await (0, Fe.pipeline)(r.body, s), i);
7095
+ return (await (0, Ge.pipeline)(r.body, s), i);
7041
7096
  }
7042
7097
  };
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]]);
7098
+ E();
7099
+ z();
7100
+ var _t = ['images', 'input_images', 'videos', 'audios'];
7101
+ function Vi(e) {
7102
+ for (let t of _t) typeof e[t] == 'string' && (e[t] = [e[t]]);
7048
7103
  }
7049
- function Di(e) {
7104
+ function Ni(e) {
7050
7105
  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;
7106
+ let t = A.default.resolve(e);
7107
+ return O.default.existsSync(t) && O.default.statSync(t).isFile() ? t : null;
7053
7108
  }
7054
- async function Li(e, t) {
7055
- for (let i of It) {
7109
+ async function Ui(e, t) {
7110
+ for (let i of _t) {
7056
7111
  if (!Array.isArray(e[i])) continue;
7057
7112
  let r = [];
7058
7113
  for (let n of e[i]) {
7059
7114
  if (typeof n != 'string') continue;
7060
- let s = Di(n);
7115
+ let s = Ni(n);
7061
7116
  r.push(s ? await t(s) : n);
7062
7117
  }
7063
7118
  e[i] = r;
7064
7119
  }
7065
7120
  }
7066
- var z = { starter: 10, plus: 25, scale: 40, enterprise: 300 };
7067
- function Vi(e) {
7121
+ var W = { starter: 10, plus: 25, scale: 40, enterprise: 300 };
7122
+ function ji(e) {
7068
7123
  if (e.count === void 0 || e.count === !0) return 1;
7069
7124
  let t = typeof e.count == 'number' ? e.count : Number(e.count),
7070
- i = z.enterprise;
7125
+ i = W.enterprise;
7071
7126
  return (
7072
7127
  (!Number.isInteger(t) || t < 1 || t > i) &&
7073
7128
  (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.
7129
+ .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
7130
  `),
7076
7131
  process.exit(1)),
7077
7132
  t
7078
7133
  );
7079
7134
  }
7080
- async function Ni(e, t, i, r, n) {
7135
+ async function Bi(e, t, i, r, n) {
7081
7136
  n.isJson ||
7082
7137
  process.stderr.write(`Starting ${r} ${t} jobs together...
7083
7138
  `);
@@ -7085,51 +7140,51 @@ async function Ni(e, t, i, r, n) {
7085
7140
  Array.from({ length: r }, async () => {
7086
7141
  try {
7087
7142
  return { job: await e.queueJob(t, i) };
7088
- } catch (p) {
7089
- return { err: p };
7143
+ } catch (l) {
7144
+ return { err: l };
7090
7145
  }
7091
7146
  }),
7092
7147
  ),
7093
7148
  o = [],
7094
7149
  u = [];
7095
- for (let p of s)
7096
- 'job' in p && p.job
7097
- ? o.push(p.job)
7098
- : 'err' in p &&
7150
+ for (let l of s)
7151
+ 'job' in l && l.job
7152
+ ? o.push(l.job)
7153
+ : 'err' in l &&
7099
7154
  u.push(
7100
- p.err instanceof w
7101
- ? p.err
7102
- : new w(0, p.err instanceof Error ? p.err.message : String(p.err)),
7155
+ l.err instanceof k
7156
+ ? l.err
7157
+ : new k(0, l.err instanceof Error ? l.err.message : String(l.err)),
7103
7158
  );
7104
7159
  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)...
7160
+ let l = Date.now(),
7161
+ c = o.filter((p) => p.status === 'processing' && p.request_id);
7162
+ for (; c.length;) {
7163
+ if ((await new Promise((d) => setTimeout(d, 2e3)), !n.isJson)) {
7164
+ let d = Math.round((Date.now() - l) / 1e3);
7165
+ process.stderr.write(`Waiting on ${c.length} of ${r} (${d}s)...
7111
7166
  `);
7112
7167
  }
7113
- let d = await Promise.all(
7114
- l.map(async (c) => {
7168
+ let p = await Promise.all(
7169
+ c.map(async (d) => {
7115
7170
  try {
7116
- return await e.getStatus(c.request_id);
7171
+ return await e.getStatus(d.request_id);
7117
7172
  } catch {
7118
- return c;
7173
+ return d;
7119
7174
  }
7120
7175
  }),
7121
7176
  );
7122
- for (let c of d) {
7123
- let m = o.findIndex((f) => f.request_id === c.request_id);
7124
- m >= 0 && (o[m] = c);
7177
+ for (let d of p) {
7178
+ let m = o.findIndex((h) => h.request_id === d.request_id);
7179
+ m >= 0 && (o[m] = d);
7125
7180
  }
7126
- l = o.filter((c) => c.status === 'processing' && c.request_id);
7181
+ c = o.filter((d) => d.status === 'processing' && d.request_id);
7127
7182
  }
7128
7183
  }
7129
7184
  if (n.isJson)
7130
7185
  process.stdout.write(
7131
7186
  JSON.stringify(
7132
- { jobs: o, errors: u.map((p) => ({ code: p.code ?? null, message: p.message })) },
7187
+ { jobs: o, errors: u.map((l) => ({ code: l.code ?? null, message: l.message })) },
7133
7188
  null,
7134
7189
  2,
7135
7190
  ) +
@@ -7137,22 +7192,22 @@ async function Ni(e, t, i, r, n) {
7137
7192
  `,
7138
7193
  );
7139
7194
  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}`),
7195
+ for (let l of o)
7196
+ (process.stdout.write(`${l.request_id} ${l.status}`),
7197
+ l.usage?.cost !== void 0 && process.stdout.write(` $${l.usage.cost.toFixed(4)}`),
7198
+ l.error && process.stdout.write(` ${l.error}`),
7144
7199
  process.stdout.write(`
7145
7200
  `));
7146
- for (let p of u)
7147
- process.stderr.write(`${M(p).join(`
7201
+ for (let l of u)
7202
+ process.stderr.write(`${K(l).join(`
7148
7203
  `)}
7149
7204
  `);
7150
7205
  }
7151
7206
  (u.length ||
7152
- o.some((p) => p.status === 'failed' || p.status === 'expired' || p.status === 'cancelled')) &&
7153
- process.exit(I);
7207
+ o.some((l) => l.status === 'failed' || l.status === 'expired' || l.status === 'cancelled')) &&
7208
+ process.exit(_);
7154
7209
  }
7155
- function _t(e) {
7210
+ function Pt(e) {
7156
7211
  let t = {},
7157
7212
  i = new Set(),
7158
7213
  r = [];
@@ -7161,8 +7216,8 @@ function _t(e) {
7161
7216
  if (s.startsWith('--')) {
7162
7217
  let o = s.slice(2);
7163
7218
  if (o.includes('=')) {
7164
- let [u, p] = o.split('=', 2);
7165
- t[u.replace(/-/g, '_')] = p;
7219
+ let [u, l] = o.split('=', 2);
7220
+ t[u.replace(/-/g, '_')] = l;
7166
7221
  } else if (n + 1 < e.length && !e[n + 1].startsWith('-')) {
7167
7222
  let u = e[n + 1];
7168
7223
  (u === 'true'
@@ -7176,7 +7231,7 @@ function _t(e) {
7176
7231
  } else ((t[o.replace(/-/g, '_')] = !0), i.add(o));
7177
7232
  } else if (s.startsWith('-') && s.length === 2) {
7178
7233
  let o = s[1],
7179
- p =
7234
+ l =
7180
7235
  {
7181
7236
  p: 'prompt',
7182
7237
  o: 'output',
@@ -7189,17 +7244,17 @@ function _t(e) {
7189
7244
  v: 'version',
7190
7245
  }[o] || o;
7191
7246
  o === 'j' || o === 'h' || o === 'v'
7192
- ? ((t[p] = !0), i.add(p))
7247
+ ? ((t[l] = !0), i.add(l))
7193
7248
  : n + 1 < e.length && !e[n + 1].startsWith('-')
7194
- ? ((t[p] = e[n + 1]), n++)
7195
- : (t[p] = !0);
7249
+ ? ((t[l] = e[n + 1]), n++)
7250
+ : (t[l] = !0);
7196
7251
  } else r.push(s);
7197
7252
  }
7198
7253
  return { command: r[0] || '', subcommand: r[1], modelSlug: r[1] || r[0], options: t, flags: i };
7199
7254
  }
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);
7255
+ async function Ee(e, t) {
7256
+ let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
7257
+ r = x(typeof t.api_url == 'string' ? t.api_url : void 0);
7203
7258
  (i ||
7204
7259
  (process.stderr.write(`${a.red('Error:')} Authentication required.
7205
7260
  `),
@@ -7215,46 +7270,39 @@ async function Ce(e, t) {
7215
7270
  process.stderr.write(`Run ${a.cyan('tein models')} to list all available models.
7216
7271
  `),
7217
7272
  process.exit(1)));
7218
- let n = V(e),
7273
+ let n = N(e),
7219
7274
  s = !!t.json,
7220
7275
  o = !!(t.async || t.no_wait),
7221
7276
  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 &&
7277
+ l = ji(t),
7278
+ c = { ...t };
7279
+ (delete c.json,
7280
+ delete c.async,
7281
+ delete c.no_wait,
7282
+ delete c.output,
7283
+ delete c.api_key,
7284
+ delete c.api_url,
7285
+ delete c.count);
7286
+ let p = It(n, c);
7287
+ (Vi(p),
7288
+ typeof p.image == 'string' && !p.images && ((p.images = [p.image]), delete p.image),
7289
+ p.image_url &&
7290
+ !p.first_frame_image &&
7243
7291
  (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();
7292
+ (p.first_frame_image = p.image_url));
7293
+ let d = new M(i, r),
7294
+ m = ['image', 'first_frame_image', 'last_frame_image', 'lipsyncing_audio', 'audio', 'video'];
7295
+ for (let y of m) {
7296
+ let f = p[y];
7297
+ if (typeof f == 'string' && !f.startsWith('http://') && !f.startsWith('https://')) {
7298
+ let v = A.default.resolve(f);
7299
+ if (O.default.existsSync(v) && O.default.statSync(v).isFile()) {
7300
+ let P = new T(`Uploading local file ${A.default.basename(v)} to CDN...`);
7301
+ s || P.start();
7254
7302
  try {
7255
- let j = R.default.readFileSync(x),
7303
+ let j = O.default.readFileSync(v),
7256
7304
  X = await d.uploadAsset(j.toString('base64'));
7257
- ((l[h] = X.url), s || _.succeed(`Uploaded ${q.default.basename(x)} to CDN`));
7305
+ ((p[y] = X.url), s || P.succeed(`Uploaded ${A.default.basename(v)} to CDN`));
7258
7306
  } catch (j) {
7259
7307
  let X = j instanceof Error ? j.message : String(j);
7260
7308
  (s
@@ -7263,108 +7311,108 @@ async function Ce(e, t) {
7263
7311
  `
7264
7312
  `,
7265
7313
  )
7266
- : _.fail(`Upload failed: ${X}`),
7314
+ : P.fail(`Upload failed: ${X}`),
7267
7315
  process.exit(1));
7268
7316
  }
7269
7317
  }
7270
7318
  }
7271
7319
  }
7272
- await Li(l, async (h) => {
7273
- let g = new P(`Uploading local file ${q.default.basename(h)} to CDN...`);
7274
- s || g.start();
7320
+ await Ui(p, async (y) => {
7321
+ let f = new T(`Uploading local file ${A.default.basename(y)} to CDN...`);
7322
+ s || f.start();
7275
7323
  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);
7324
+ let v = O.default.readFileSync(y),
7325
+ P = await d.uploadAsset(v.toString('base64'));
7326
+ return (s || f.succeed(`Uploaded ${A.default.basename(y)} to CDN`), P.url);
7327
+ } catch (v) {
7328
+ let P = v instanceof Error ? v.message : String(v);
7281
7329
  (s
7282
7330
  ? process.stdout.write(
7283
- JSON.stringify({ error: _ }) +
7331
+ JSON.stringify({ error: P }) +
7284
7332
  `
7285
7333
  `,
7286
7334
  )
7287
- : g.fail(`Upload failed: ${_}`),
7335
+ : f.fail(`Upload failed: ${P}`),
7288
7336
  process.exit(1));
7289
7337
  }
7290
7338
  });
7291
- let m = new P(`Submitting task for ${a.bold(e)}...`);
7292
- s || m.start();
7293
- let f;
7339
+ let h = new T(`Submitting task for ${a.bold(e)}...`);
7340
+ s || h.start();
7341
+ let g;
7294
7342
  try {
7295
- if (p > 1) {
7296
- await Ni(d, e, l, p, { isJson: s, isAsync: o });
7343
+ if (l > 1) {
7344
+ await Bi(d, e, p, l, { isJson: s, isAsync: o });
7297
7345
  return;
7298
7346
  }
7299
- f = await d.queueJob(e, l);
7300
- } catch (h) {
7301
- let g = h instanceof w ? h : null;
7347
+ g = await d.queueJob(e, p);
7348
+ } catch (y) {
7349
+ let f = y instanceof k ? y : null;
7302
7350
  (s
7303
7351
  ? process.stdout.write(
7304
7352
  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) } },
7353
+ f
7354
+ ? { error: { code: f.code ?? null, message: f.message, ...f.fields } }
7355
+ : { error: { code: null, message: y instanceof Error ? y.message : String(y) } },
7308
7356
  null,
7309
7357
  2,
7310
7358
  ) +
7311
7359
  `
7312
7360
  `,
7313
7361
  )
7314
- : m.fail(
7315
- g
7316
- ? M(g).join(`
7362
+ : h.fail(
7363
+ f
7364
+ ? K(f).join(`
7317
7365
  `)
7318
- : `Failed to start generation: ${h instanceof Error ? h.message : h}`,
7366
+ : `Failed to start generation: ${y instanceof Error ? y.message : y}`,
7319
7367
  ),
7320
- process.exit(g ? g.exitCode : I));
7368
+ process.exit(f ? f.exitCode : _));
7321
7369
  }
7322
7370
  if (o) {
7323
7371
  s
7324
7372
  ? process.stdout.write(
7325
- JSON.stringify(f, null, 2) +
7373
+ JSON.stringify(g, null, 2) +
7326
7374
  `
7327
7375
  `,
7328
7376
  )
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}`)}
7377
+ : (h.succeed(`Queued successfully! Request ID: ${a.bold(g.request_id)}`),
7378
+ process.stdout.write(`Check status anytime with: ${a.cyan(`tein status ${g.request_id}`)}
7331
7379
  `));
7332
7380
  return;
7333
7381
  }
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)));
7382
+ let ue = Date.now(),
7383
+ me = 1500;
7384
+ for (; g.status === 'processing';) {
7385
+ let y = Math.round((Date.now() - ue) / 1e3);
7386
+ (s || h.update(`Rendering ${a.bold(e)} (${y}s elapsed)... [ID: ${g.request_id}]`),
7387
+ await new Promise((f) => setTimeout(f, me)));
7340
7388
  try {
7341
- f = await d.getStatus(f.request_id);
7342
- } catch (g) {
7343
- g instanceof w &&
7344
- g.exitCode !== I &&
7389
+ g = await d.getStatus(g.request_id);
7390
+ } catch (f) {
7391
+ f instanceof k &&
7392
+ f.exitCode !== _ &&
7345
7393
  (s ||
7346
- m.fail(
7347
- M(g).join(`
7394
+ h.fail(
7395
+ K(f).join(`
7348
7396
  `),
7349
7397
  ),
7350
- process.exit(g.exitCode));
7398
+ process.exit(f.exitCode));
7351
7399
  }
7352
7400
  }
7353
7401
  if (
7354
- ((f.status === 'failed' || f.status === 'expired' || f.status === 'cancelled') &&
7402
+ ((g.status === 'failed' || g.status === 'expired' || g.status === 'cancelled') &&
7355
7403
  (s
7356
7404
  ? process.stdout.write(
7357
- JSON.stringify(f, null, 2) +
7405
+ JSON.stringify(g, null, 2) +
7358
7406
  `
7359
7407
  `,
7360
7408
  )
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)}!`),
7409
+ : h.fail(`Generation ${g.status}: ${g.error || 'Something failed on our side.'}`),
7410
+ process.exit(_)),
7411
+ s || h.succeed(`Generation completed for ${a.bold(n?.name || e)}!`),
7364
7412
  s)
7365
7413
  ) {
7366
7414
  process.stdout.write(
7367
- JSON.stringify(f, null, 2) +
7415
+ JSON.stringify(g, null, 2) +
7368
7416
  `
7369
7417
  `,
7370
7418
  );
@@ -7375,57 +7423,57 @@ async function Ce(e, t) {
7375
7423
  `),
7376
7424
  process.stdout.write(` ${a.bold('Status:')} ${a.green('Succeeded')}
7377
7425
  `),
7378
- process.stdout.write(` ${a.bold('Request ID:')} ${f.request_id}
7426
+ process.stdout.write(` ${a.bold('Request ID:')} ${g.request_id}
7379
7427
  `),
7380
- f.usage?.cost !== void 0 &&
7381
- process.stdout.write(` ${a.bold('Cost:')} $${f.usage.cost.toFixed(4)}
7428
+ g.usage?.cost !== void 0 &&
7429
+ process.stdout.write(` ${a.bold('Cost:')} $${g.usage.cost.toFixed(4)}
7382
7430
  `),
7383
- f.output && f.output.length > 0)
7431
+ g.output && g.output.length > 0)
7384
7432
  ) {
7385
7433
  process.stdout.write(`
7386
7434
  ${a.bold('Outputs:')}
7387
7435
  `);
7388
- for (let h = 0; h < f.output.length; h++) {
7389
- let g = f.output[h];
7390
- if (g.url) {
7436
+ for (let y = 0; y < g.output.length; y++) {
7437
+ let f = g.output[y];
7438
+ if (f.url) {
7391
7439
  if (
7392
- (process.stdout.write(` [${g.type.toUpperCase()}] ${a.cyan(a.underline(g.url))}
7440
+ (process.stdout.write(` [${f.type.toUpperCase()}] ${a.cyan(a.underline(f.url))}
7393
7441
  `),
7394
7442
  u)
7395
7443
  ) {
7396
- let x = new P(`Downloading output to ${u}...`).start();
7444
+ let v = new T(`Downloading output to ${u}...`).start();
7397
7445
  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 : _}`);
7446
+ (await d.downloadOutput(f.url, A.default.resolve(process.cwd(), u)),
7447
+ v.succeed(`Saved to ${a.bold(u)}`));
7448
+ } catch (P) {
7449
+ v.fail(`Failed to download: ${P instanceof Error ? P.message : P}`);
7402
7450
  }
7403
7451
  }
7404
7452
  } else
7405
- g.text &&
7453
+ f.text &&
7406
7454
  process.stdout.write(`
7407
- ${g.text}
7455
+ ${f.text}
7408
7456
  `);
7409
7457
  }
7410
7458
  }
7411
7459
  process.stdout.write(`
7412
7460
  `);
7413
7461
  }
7414
- var Pt = v(require('node:readline'));
7415
- C();
7416
- async function Ui(e) {
7462
+ var Tt = I(require('node:readline'));
7463
+ E();
7464
+ async function Fi(e) {
7417
7465
  try {
7418
- return (await new T(e, k()).checkKey(), 'ok');
7466
+ return (await new M(e, x()).checkKey(), 'ok');
7419
7467
  } catch (t) {
7420
- if (t instanceof w) {
7468
+ if (t instanceof k) {
7421
7469
  if (t.status === 401) return 'invalid';
7422
7470
  if (t.status === 403) return 'blocked';
7423
7471
  }
7424
7472
  return 'unchecked';
7425
7473
  }
7426
7474
  }
7427
- function ji(e) {
7428
- let t = Pt.default.createInterface({ input: process.stdin, output: process.stdout });
7475
+ function Gi(e) {
7476
+ let t = Tt.default.createInterface({ input: process.stdin, output: process.stdout });
7429
7477
  return new Promise((i) => {
7430
7478
  t.question(e, (r) => {
7431
7479
  (t.close(), i(r.trim()));
@@ -7444,20 +7492,20 @@ ${a.bold('Tein AI Authentication')}
7444
7492
  process.stdout.write(`Get your API key at: ${a.cyan('https://tein.ai/dashboard/keys')}
7445
7493
 
7446
7494
  `),
7447
- (i = await ji('Enter your Tein API Key (sk_live_...): '))),
7495
+ (i = await Gi('Enter your Tein API Key (sk_live_...): '))),
7448
7496
  !i.startsWith('sk_live_') &&
7449
7497
  !i.startsWith('sk_test_') &&
7450
7498
  (process.stderr
7451
7499
  .write(`${a.red('Error:')} Invalid key format. Tein API keys start with 'sk_live_' or 'sk_test_'.
7452
7500
  `),
7453
7501
  process.exit(1)));
7454
- let r = await Ui(i);
7502
+ let r = await Fi(i);
7455
7503
  (r === 'invalid' &&
7456
7504
  (process.stderr
7457
7505
  .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
7506
  `),
7459
7507
  process.exit(1)),
7460
- ge({ apiKey: i }),
7508
+ he({ apiKey: i }),
7461
7509
  process.stdout.write(`
7462
7510
  ${a.green('\u2713')} API key saved to ${a.dim(ie())}
7463
7511
  `),
@@ -7476,22 +7524,22 @@ ${a.green('\u2713')} API key saved to ${a.dim(ie())}
7476
7524
  break;
7477
7525
  }
7478
7526
  case 'logout': {
7479
- if (!D().apiKey) {
7527
+ if (!L().apiKey) {
7480
7528
  process.stdout
7481
7529
  .write(`${a.yellow('\u2139')} No active API key found. You are already logged out.
7482
7530
  `);
7483
7531
  break;
7484
7532
  }
7485
- (ge({ apiKey: '' }),
7533
+ (he({ apiKey: '' }),
7486
7534
  process.stdout
7487
7535
  .write(`${a.green('\u2713')} Logged out successfully. Stored API key has been cleared from ${a.dim(ie())}
7488
7536
  `));
7489
7537
  break;
7490
7538
  }
7491
7539
  default: {
7492
- let i = K(),
7493
- r = k(),
7494
- n = D();
7540
+ let i = S(),
7541
+ r = x(),
7542
+ n = L();
7495
7543
  if (
7496
7544
  (process.stdout.write(`
7497
7545
  ${a.bold('Tein AI CLI Configuration')}
@@ -7520,13 +7568,13 @@ ${a.bold('Tein AI CLI Configuration')}
7520
7568
  }
7521
7569
  }
7522
7570
  }
7523
- C();
7524
- he();
7525
- W();
7526
- var Bi = 3e3;
7527
- async function Tt(e) {
7571
+ E();
7572
+ ye();
7573
+ z();
7574
+ var Ji = 3e3;
7575
+ async function Mt(e) {
7528
7576
  try {
7529
- let t = await fetch(`${k(e)}/v1/pricing`, { signal: AbortSignal.timeout(Bi) });
7577
+ let t = await fetch(`${x(e)}/v1/pricing`, { signal: AbortSignal.timeout(Ji) });
7530
7578
  if (!t.ok) return;
7531
7579
  let i = await t.json(),
7532
7580
  r = {};
@@ -7534,18 +7582,18 @@ async function Tt(e) {
7534
7582
  let s = String(n.modelSlug ?? '');
7535
7583
  B.has(s) && (r[s] ??= []).push(Number(n.starterPrice));
7536
7584
  }
7537
- ft(r);
7585
+ gt(r);
7538
7586
  } catch {}
7539
7587
  }
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();
7588
+ var Hi = new Set(['video', 'image', 'text', 'audio', '3d']),
7589
+ zi = { llm: 'text', chat: 'text', reasoning: 'text' };
7590
+ async function Kt(e, t) {
7591
+ await Mt(t);
7592
+ let i = q();
7545
7593
  if (e) {
7546
7594
  let s = e.toLowerCase(),
7547
- o = Gi[s] ?? s;
7548
- i = Fi.has(o)
7595
+ o = zi[s] ?? s;
7596
+ i = Hi.has(o)
7549
7597
  ? i.filter((u) => u.category.toLowerCase() === o)
7550
7598
  : i.filter((u) => u.kind.toLowerCase().includes(s) || u.slug.toLowerCase().includes(s));
7551
7599
  }
@@ -7568,10 +7616,10 @@ ${a.bold('Tein AI Models Catalog')} (${i.length} available)
7568
7616
  process.stdout.write(`${a.bold(a.cyan(`\u2500\u2500 ${s} Models \u2500\u2500`))}
7569
7617
  `);
7570
7618
  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)}
7619
+ let l = u.slug.padEnd(24),
7620
+ c = u.name.padEnd(22),
7621
+ p = u.priceFormatted.padEnd(22);
7622
+ process.stdout.write(` ${a.bold(l)} ${a.gray(c)} ${a.green(p)} ${a.dim(u.vendor)}
7575
7623
  `);
7576
7624
  }
7577
7625
  process.stdout.write(`
@@ -7583,9 +7631,9 @@ ${a.bold('Tein AI Models Catalog')} (${i.length} available)
7583
7631
 
7584
7632
  `);
7585
7633
  }
7586
- async function Kt(e, t) {
7587
- B.has(e) && (await Tt(t));
7588
- let i = V(e);
7634
+ async function St(e, t) {
7635
+ B.has(e) && (await Mt(t));
7636
+ let i = N(e);
7589
7637
  (i ||
7590
7638
  (process.stderr.write(`${a.red('Error:')} Model "${e}" not found in Tein AI registry.
7591
7639
  `),
@@ -7664,10 +7712,10 @@ ${a.bold(a.cyan(i.name))} (${a.bold(i.slug)})
7664
7712
 
7665
7713
  `);
7666
7714
  }
7667
- C();
7668
- Ee();
7669
- var Ji = 1e4,
7670
- Ae = {
7715
+ E();
7716
+ qe();
7717
+ var Wi = 1e4,
7718
+ Re = {
7671
7719
  price: '',
7672
7720
  creativeMode: 'Creative mode',
7673
7721
  priority: 'Priority',
@@ -7677,22 +7725,22 @@ var Ji = 1e4,
7677
7725
  priorityDraft: 'Priority + Draft',
7678
7726
  creativeModePriorityDraft: 'Creative mode + Priority + Draft',
7679
7727
  },
7680
- Hi = Object.keys(Ae),
7681
- Wi = {
7728
+ Yi = Object.keys(Re),
7729
+ Qi = {
7682
7730
  creativeMode: 'unfiltered',
7683
7731
  creativeModePriority: 'unfilteredPriority',
7684
7732
  creativeModeDraft: 'unfilteredDraft',
7685
7733
  creativeModePriorityDraft: 'unfilteredPriorityDraft',
7686
7734
  };
7687
- function zi(e, t) {
7688
- let i = Wi[t];
7735
+ function Xi(e, t) {
7736
+ let i = Qi[t];
7689
7737
  return e[t] ?? (i ? e[i] : void 0);
7690
7738
  }
7691
- async function Yi(e, t) {
7692
- let i = `${k(e)}${ce(t)}`,
7739
+ async function Zi(e, t) {
7740
+ let i = `${x(e)}${ce(t)}`,
7693
7741
  r;
7694
7742
  try {
7695
- r = await fetch(i, { signal: AbortSignal.timeout(Ji) });
7743
+ r = await fetch(i, { signal: AbortSignal.timeout(Wi) });
7696
7744
  } catch {
7697
7745
  throw new Error(`Could not reach ${i}`);
7698
7746
  }
@@ -7708,18 +7756,18 @@ async function Yi(e, t) {
7708
7756
  }
7709
7757
  return n;
7710
7758
  }
7711
- function qe(e) {
7759
+ function Ae(e) {
7712
7760
  let t = e.toFixed(4).replace(/0+$/, '').replace(/\.$/, ''),
7713
7761
  [i, r = ''] = t.split('.');
7714
7762
  return `$${i}.${r.padEnd(2, '0')}`;
7715
7763
  }
7716
- function Re(e) {
7764
+ function Oe(e) {
7717
7765
  if (!e || typeof e.starter != 'number') return null;
7718
7766
  let t = typeof e.plus == 'number' ? e.plus : e.starter,
7719
7767
  i = typeof e.scale == 'number' ? e.scale : t;
7720
- return `Starter ${qe(e.starter)} Plus ${qe(t)} Scale ${qe(i)}`;
7768
+ return `Starter ${Ae(e.starter)} Plus ${Ae(t)} Scale ${Ae(i)}`;
7721
7769
  }
7722
- function Qi(e) {
7770
+ function er(e) {
7723
7771
  if (typeof e.label == 'string' && e.label.trim()) return e.label.trim();
7724
7772
  let t = [];
7725
7773
  for (let i of ['endpoint', 'resolution', 'quality', 'mode', 'task', 'component', 'token']) {
@@ -7731,33 +7779,33 @@ function Qi(e) {
7731
7779
  t.length ? t.join(' \xB7 ') : String(e.id ?? 'default')
7732
7780
  );
7733
7781
  }
7734
- function Xi(e, t) {
7735
- let i = Qi(e);
7736
- for (let r of Hi) {
7737
- let n = Re(zi(e, r));
7782
+ function tr(e, t) {
7783
+ let i = er(e);
7784
+ for (let r of Yi) {
7785
+ let n = Oe(Xi(e, r));
7738
7786
  if (!n) continue;
7739
- let s = Ae[r] ? ` (${Ae[r]})` : '';
7787
+ let s = Re[r] ? ` (${Re[r]})` : '';
7740
7788
  t.push(` ${i}${s} ${n}`);
7741
7789
  }
7742
7790
  }
7743
- function Zi(e, t) {
7791
+ function ir(e, t) {
7744
7792
  let i = e.quality ? ` quality=${e.quality}` : '';
7745
7793
  t.push(
7746
7794
  ` ${a.bold(e.slug.padEnd(26))} ${a.gray(e.name)} ${a.dim(`${e.kind} ${e.unit} model=${e.model}${i}`)}`,
7747
7795
  );
7748
- for (let n of e.variants ?? []) Xi(n, t);
7796
+ for (let n of e.variants ?? []) tr(n, t);
7749
7797
  let r = e.addons;
7750
7798
  if (Array.isArray(r))
7751
7799
  for (let n of r) {
7752
7800
  if (!n || typeof n != 'object') continue;
7753
7801
  let s = n,
7754
7802
  o = typeof s.label == 'string' ? s.label : String(s.id ?? 'add-on'),
7755
- u = Re(s.price);
7803
+ u = Oe(s.price);
7756
7804
  u && t.push(` ${o} (add-on) ${u}`);
7757
7805
  }
7758
7806
  t.push('');
7759
7807
  }
7760
- function er(e) {
7808
+ function rr(e) {
7761
7809
  let t = [],
7762
7810
  i = e.board.checked ? ` \xB7 checked ${e.board.checked}` : '';
7763
7811
  (t.push(`${a.bold('Tein prices')} ${a.green(e.currency)} ${e.count} models${i}`),
@@ -7766,38 +7814,38 @@ function er(e) {
7766
7814
  ),
7767
7815
  t.push(''));
7768
7816
  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));
7817
+ for (let l of e.board.models) {
7818
+ let c = l.kind || 'other',
7819
+ p = r.get(c) ?? [];
7820
+ (p.push(l), r.set(c, p));
7773
7821
  }
7774
7822
  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);
7823
+ s = [...r.keys()].sort((l, c) => {
7824
+ let p = n.indexOf(l),
7825
+ d = n.indexOf(c);
7826
+ return (p === -1 ? 99 : p) - (d === -1 ? 99 : d);
7779
7827
  });
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);
7828
+ for (let l of s) {
7829
+ t.push(`${a.bold(a.cyan(`\u2500\u2500 ${l} \u2500\u2500`))}`);
7830
+ for (let c of r.get(l) ?? []) ir(c, t);
7783
7831
  }
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()));
7832
+ let o = new Set(e.board.models.map((l) => l.slug.toLowerCase())),
7833
+ u = (e.configs ?? []).filter((l) => !o.has(String(l.modelSlug ?? '').toLowerCase()));
7786
7834
  if (u.length) {
7787
7835
  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));
7836
+ let l = new Map();
7837
+ for (let c of u) {
7838
+ let p = String(c.modelSlug ?? ''),
7839
+ d = l.get(p) ?? [];
7840
+ (d.push(c), l.set(p, d));
7793
7841
  }
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}`);
7842
+ for (let [c, p] of l) {
7843
+ let d = String(p[0]?.modelName ?? c);
7844
+ t.push(` ${a.bold(c.padEnd(26))} ${a.gray(d)}`);
7845
+ for (let m of p) {
7846
+ let h = String(m.displayLabel ?? m.billingUnit ?? 'price'),
7847
+ g = Oe(m.prices);
7848
+ g && t.push(` ${h} ${g}`);
7801
7849
  }
7802
7850
  t.push('');
7803
7851
  }
@@ -7809,10 +7857,10 @@ function er(e) {
7809
7857
  `
7810
7858
  );
7811
7859
  }
7812
- async function St(e) {
7860
+ async function $t(e) {
7813
7861
  let t;
7814
7862
  try {
7815
- t = await Yi(e.apiUrl, e.model);
7863
+ t = await Zi(e.apiUrl, e.model);
7816
7864
  } catch (i) {
7817
7865
  let r = i instanceof Error ? i.message : String(i);
7818
7866
  (process.stderr.write(`${a.red('Error:')} ${r}
@@ -7823,14 +7871,14 @@ async function St(e) {
7823
7871
  e.json
7824
7872
  ? `${JSON.stringify(t, null, 2)}
7825
7873
  `
7826
- : er(t),
7874
+ : rr(t),
7827
7875
  );
7828
7876
  }
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);
7877
+ var Ct = I(require('node:path'));
7878
+ E();
7879
+ async function Et(e, t) {
7880
+ let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
7881
+ r = x(typeof t.api_url == 'string' ? t.api_url : void 0);
7834
7882
  (i ||
7835
7883
  (process.stderr.write(`${a.red('Error:')} Authentication required.
7836
7884
  `),
@@ -7847,54 +7895,54 @@ async function Ct(e, t) {
7847
7895
  let n = !!t.json,
7848
7896
  s = !!t.wait,
7849
7897
  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;
7898
+ u = new M(i, r),
7899
+ l = new T(`Checking status of ${a.bold(e)}...`);
7900
+ n || l.start();
7901
+ let c;
7854
7902
  try {
7855
- l = await u.getStatus(e);
7856
- } catch (d) {
7857
- (d instanceof w &&
7903
+ c = await u.getStatus(e);
7904
+ } catch (p) {
7905
+ (p instanceof k &&
7858
7906
  (n
7859
7907
  ? process.stdout.write(
7860
7908
  JSON.stringify(
7861
- { error: { code: d.code ?? null, message: d.message, ...d.fields } },
7909
+ { error: { code: p.code ?? null, message: p.message, ...p.fields } },
7862
7910
  null,
7863
7911
  2,
7864
7912
  ) +
7865
7913
  `
7866
7914
  `,
7867
7915
  )
7868
- : p.fail(
7869
- M(d).join(`
7916
+ : l.fail(
7917
+ K(p).join(`
7870
7918
  `),
7871
7919
  ),
7872
- process.exit(d.exitCode)),
7873
- n || p.fail(d instanceof Error ? d.message : String(d)),
7874
- process.exit(I));
7920
+ process.exit(p.exitCode)),
7921
+ n || l.fail(p instanceof Error ? p.message : String(p)),
7922
+ process.exit(_));
7875
7923
  }
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)...`),
7924
+ if (s && c.status === 'processing') {
7925
+ let p = Date.now();
7926
+ for (; c.status === 'processing';) {
7927
+ let d = Math.round((Date.now() - p) / 1e3);
7928
+ (n || l.update(`Waiting for ${a.bold(c.model)} (${d}s elapsed)...`),
7881
7929
  await new Promise((m) => setTimeout(m, 1500)));
7882
7930
  try {
7883
- l = await u.getStatus(e);
7931
+ c = await u.getStatus(e);
7884
7932
  } catch {}
7885
7933
  }
7886
7934
  }
7887
7935
  if (
7888
7936
  (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()),
7937
+ (c.status === 'succeeded'
7938
+ ? l.succeed('Task completed!')
7939
+ : c.status === 'failed' || c.status === 'expired' || c.status === 'cancelled'
7940
+ ? l.fail(`Task ${c.status}: ${c.error || 'Something failed on our side.'}`)
7941
+ : l.stop()),
7894
7942
  n)
7895
7943
  ) {
7896
7944
  process.stdout.write(
7897
- JSON.stringify(l, null, 2) +
7945
+ JSON.stringify(c, null, 2) +
7898
7946
  `
7899
7947
  `,
7900
7948
  );
@@ -7902,48 +7950,48 @@ async function Ct(e, t) {
7902
7950
  }
7903
7951
  if (
7904
7952
  (process.stdout.write(`
7905
- ${a.bold('Model:')} ${l.model}
7953
+ ${a.bold('Model:')} ${c.model}
7906
7954
  `),
7907
7955
  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)}
7956
+ .write(` ${a.bold('Status:')} ${c.status === 'succeeded' ? a.green(c.status) : c.status === 'processing' ? a.yellow(c.status) : a.red(c.status)}
7909
7957
  `),
7910
- process.stdout.write(` ${a.bold('Request ID:')} ${l.request_id}
7958
+ process.stdout.write(` ${a.bold('Request ID:')} ${c.request_id}
7911
7959
  `),
7912
- l.output && l.output.length > 0)
7960
+ c.output && c.output.length > 0)
7913
7961
  ) {
7914
7962
  process.stdout.write(`
7915
7963
  ${a.bold('Outputs:')}
7916
7964
  `);
7917
- for (let d of l.output)
7918
- if (d.url) {
7965
+ for (let p of c.output)
7966
+ if (p.url) {
7919
7967
  if (
7920
- (process.stdout.write(` [${d.type.toUpperCase()}] ${a.cyan(a.underline(d.url))}
7968
+ (process.stdout.write(` [${p.type.toUpperCase()}] ${a.cyan(a.underline(p.url))}
7921
7969
  `),
7922
7970
  o)
7923
7971
  ) {
7924
- let c = new P(`Downloading output to ${o}...`).start();
7972
+ let d = new T(`Downloading output to ${o}...`).start();
7925
7973
  try {
7926
- (await u.downloadOutput(d.url, $t.default.resolve(process.cwd(), o)),
7927
- c.succeed(`Saved to ${a.bold(o)}`));
7974
+ (await u.downloadOutput(p.url, Ct.default.resolve(process.cwd(), o)),
7975
+ d.succeed(`Saved to ${a.bold(o)}`));
7928
7976
  } catch (m) {
7929
- c.fail(`Failed to download: ${m instanceof Error ? m.message : m}`);
7977
+ d.fail(`Failed to download: ${m instanceof Error ? m.message : m}`);
7930
7978
  }
7931
7979
  }
7932
7980
  } else
7933
- d.text &&
7981
+ p.text &&
7934
7982
  process.stdout.write(`
7935
- ${d.text}
7983
+ ${p.text}
7936
7984
  `);
7937
7985
  }
7938
7986
  process.stdout.write(`
7939
7987
  `);
7940
7988
  }
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),
7989
+ var De = I(require('node:fs')),
7990
+ Le = I(require('node:path'));
7991
+ E();
7992
+ async function qt(e, t = {}) {
7993
+ let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
7994
+ r = x(typeof t.api_url == 'string' ? t.api_url : void 0),
7947
7995
  n = !!t.json;
7948
7996
  (i ||
7949
7997
  (process.stderr.write(`${a.red('Error:')} Authentication required.
@@ -7958,55 +8006,55 @@ async function Et(e, t = {}) {
7958
8006
  process.stderr.write(`Usage: ${a.cyan('tein upload <image.png|video.mp4>')}
7959
8007
  `),
7960
8008
  process.exit(1)));
7961
- let s = De.default.resolve(e);
7962
- Oe.default.existsSync(s) ||
8009
+ let s = Le.default.resolve(e);
8010
+ De.default.existsSync(s) ||
7963
8011
  (process.stderr.write(`${a.red('Error:')} File not found: ${s}
7964
8012
  `),
7965
8013
  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();
8014
+ let o = Le.default.basename(s),
8015
+ l = De.default.readFileSync(s).toString('base64'),
8016
+ c = new M(i, r),
8017
+ p = new T(`Uploading ${a.bold(o)} to Tein AI CDN...`);
8018
+ n || p.start();
7971
8019
  try {
7972
- let c = await l.uploadAsset(p);
8020
+ let d = await c.uploadAsset(l);
7973
8021
  n
7974
8022
  ? process.stdout.write(
7975
- JSON.stringify(c, null, 2) +
8023
+ JSON.stringify(d, null, 2) +
7976
8024
  `
7977
8025
  `,
7978
8026
  )
7979
- : (d.succeed('Upload successful!'),
8027
+ : (p.succeed('Upload successful!'),
7980
8028
  process.stdout.write(`
7981
- ${a.bold('CDN URL:')} ${a.green(c.url)}
8029
+ ${a.bold('CDN URL:')} ${a.green(d.url)}
7982
8030
  `),
7983
- process.stdout.write(`${a.dim(`Key: ${c.key}`)}
8031
+ process.stdout.write(`${a.dim(`Key: ${d.key}`)}
7984
8032
 
7985
8033
  `),
7986
8034
  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}"`)}
8035
+ ${a.cyan(`tein run seedance-2-5 --prompt "Animate this scene" --image "${d.url}"`)}
7988
8036
 
7989
8037
  `));
7990
- } catch (c) {
7991
- let m = c instanceof w ? c : null,
7992
- f = m
7993
- ? M(m).join(`
8038
+ } catch (d) {
8039
+ let m = d instanceof k ? d : null,
8040
+ h = m
8041
+ ? K(m).join(`
7994
8042
  `)
7995
- : c instanceof Error
7996
- ? c.message
7997
- : String(c);
8043
+ : d instanceof Error
8044
+ ? d.message
8045
+ : String(d);
7998
8046
  (n
7999
8047
  ? process.stdout.write(
8000
- JSON.stringify({ error: { code: m?.code ?? null, message: m?.message ?? f } }, null, 2) +
8048
+ JSON.stringify({ error: { code: m?.code ?? null, message: m?.message ?? h } }, null, 2) +
8001
8049
  `
8002
8050
  `,
8003
8051
  )
8004
- : d.fail(`Upload failed: ${f}`),
8005
- process.exit(m ? m.exitCode : I));
8052
+ : p.fail(`Upload failed: ${h}`),
8053
+ process.exit(m ? m.exitCode : _));
8006
8054
  }
8007
8055
  }
8008
- W();
8009
- _e();
8056
+ z();
8057
+ Pe();
8010
8058
  function Wt() {
8011
8059
  process.stdout.write(`
8012
8060
  ${a.bold(a.cyan('Tein AI CLI'))} - Official Command-Line Interface for Tein AI models
@@ -8034,6 +8082,7 @@ ${a.bold('GENERATION OPTIONS (for `tein run`):')}
8034
8082
  ${a.cyan('-s, --speaker')} <speaker_id> Voice speaker ID for audio TTS models
8035
8083
  ${a.cyan('--image')} <url> Input image URL for image-to-video or image-to-image
8036
8084
  ${a.cyan('--generate-audio')} Enable native synchronized audio (Seedance 2.5)
8085
+ ${a.cyan('--finalize')} <job-id> Render a Seedance 2.5 draft at 1080p, or 4K with -r 4k (no prompt)
8037
8086
  ${a.cyan('--callback-url')} <url> HTTPS URL that receives the finished job
8038
8087
  ${a.cyan('--async, --no-wait')} Queue task and return request ID immediately
8039
8088
  ${a.cyan('--json')} Output response in raw JSON format
@@ -8055,6 +8104,8 @@ ${a.bold('EXAMPLES:')}
8055
8104
 
8056
8105
  ${a.dim('# 5. Generate a video using Seedance 2.5 with audio')}
8057
8106
  ${a.cyan('tein run seedance-2-5 --prompt "Drone shot of ocean waves at sunrise" --duration 5 -o ocean.mp4')}
8107
+ ${a.dim('# The same at 4K (10-bit H.265; add --creative-mode true for Creative mode)')}
8108
+ ${a.cyan('tein run seedance-2-5 --prompt "Drone shot of ocean waves at sunrise" --duration 5 -r 4k -o ocean-4k.mp4')}
8058
8109
 
8059
8110
  ${a.dim('# 6. Generate speech with Seed Audio 1.0')}
8060
8111
  ${a.cyan('tein run seed-audio-1-0 --prompt "Welcome to Tein AI CLI" -o welcome.wav')}
@@ -8064,9 +8115,9 @@ ${a.bold('EXAMPLES:')}
8064
8115
 
8065
8116
  `);
8066
8117
  }
8067
- async function br() {
8118
+ async function xr() {
8068
8119
  let e = process.argv.slice(2),
8069
- t = _t(e);
8120
+ t = Pt(e);
8070
8121
  if (t.flags.has('help') || t.options.help || t.command === 'help') {
8071
8122
  Wt();
8072
8123
  return;
@@ -8095,14 +8146,14 @@ async function br() {
8095
8146
  }
8096
8147
  case 'models':
8097
8148
  case 'list': {
8098
- await Mt(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0);
8149
+ await Kt(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0);
8099
8150
  break;
8100
8151
  }
8101
8152
  case 'pricing':
8102
8153
  case 'prices': {
8103
8154
  let i = t.options.model,
8104
8155
  r = t.subcommand || (typeof i == 'string' ? i : void 0);
8105
- await St({
8156
+ await $t({
8106
8157
  model: r,
8107
8158
  json: !!t.options.json,
8108
8159
  apiUrl: typeof t.options.api_url == 'string' ? t.options.api_url : void 0,
@@ -8117,40 +8168,40 @@ async function br() {
8117
8168
  process.stderr.write(`Usage: ${a.cyan('tein info <model-slug>')}
8118
8169
  `),
8119
8170
  process.exit(1)),
8120
- await Kt(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0));
8171
+ await St(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0));
8121
8172
  break;
8122
8173
  }
8123
8174
  case 'upload': {
8124
8175
  let i = t.subcommand || '';
8125
- await Et(i, t.options);
8176
+ await qt(i, t.options);
8126
8177
  break;
8127
8178
  }
8128
8179
  case 'run':
8129
8180
  case 'generate': {
8130
8181
  let i = t.subcommand || '';
8131
- await Ce(i, t.options);
8182
+ await Ee(i, t.options);
8132
8183
  break;
8133
8184
  }
8134
8185
  case 'status': {
8135
8186
  let i = t.subcommand || '';
8136
- await Ct(i, t.options);
8187
+ await Et(i, t.options);
8137
8188
  break;
8138
8189
  }
8139
8190
  case 'mcp': {
8140
- let { startStdioServer: i } = await Promise.resolve().then(() => (Ht(), Jt));
8191
+ let { startStdioServer: i } = await Promise.resolve().then(() => (zt(), Ht));
8141
8192
  await i();
8142
8193
  break;
8143
8194
  }
8144
8195
  default: {
8145
8196
  if (t.command && !t.command.startsWith('-')) {
8146
- (!V(t.command) &&
8197
+ (!N(t.command) &&
8147
8198
  !oe[t.command] &&
8148
8199
  (process.stderr.write(`
8149
8200
  ${a.red('Error:')} Unknown command or model "${t.command}".
8150
8201
  Run ${a.cyan('tein --help')} for the commands, or ${a.cyan('tein models')} for the model slugs.
8151
8202
  `),
8152
- process.exit(I)),
8153
- await Ce(t.command, t.options));
8203
+ process.exit(_)),
8204
+ await Ee(t.command, t.options));
8154
8205
  return;
8155
8206
  }
8156
8207
  Wt();
@@ -8158,15 +8209,15 @@ Run ${a.cyan('tein --help')} for the commands, or ${a.cyan('tein models')} for t
8158
8209
  }
8159
8210
  }
8160
8211
  }
8161
- br().catch((e) => {
8162
- (e instanceof w &&
8212
+ xr().catch((e) => {
8213
+ (e instanceof k &&
8163
8214
  (process.stderr.write(`
8164
- ${a.red('Error:')} ${M(e).join(`
8215
+ ${a.red('Error:')} ${K(e).join(`
8165
8216
  `)}
8166
8217
  `),
8167
8218
  process.exit(e.exitCode)),
8168
8219
  process.stderr.write(`
8169
8220
  ${a.red('Fatal error:')} ${e instanceof Error ? e.message : e}
8170
8221
  `),
8171
- process.exit(I));
8222
+ process.exit(_));
8172
8223
  });