@teinai/cli 1.1.50 → 1.1.51

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 (2) hide show
  1. package/index.js +1069 -904
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,44 +1,44 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
- var wi = Object.create;
3
+ var kr = Object.create;
4
4
  var Se = Object.defineProperty;
5
- var xi = Object.getOwnPropertyDescriptor;
6
- var ki = Object.getOwnPropertyNames;
7
- var _i = Object.getPrototypeOf,
8
- Pi = Object.prototype.hasOwnProperty;
9
- var y = (e, t, r) => () => {
10
- if (r) throw r[0];
5
+ var _r = Object.getOwnPropertyDescriptor;
6
+ var Pr = Object.getOwnPropertyNames;
7
+ var vr = Object.getPrototypeOf,
8
+ Ir = Object.prototype.hasOwnProperty;
9
+ var y = (e, t, i) => () => {
10
+ if (i) throw i[0];
11
11
  try {
12
12
  return (e && (t = e((e = 0))), t);
13
- } catch (i) {
14
- throw ((r = [i]), i);
13
+ } catch (r) {
14
+ throw ((i = [r]), r);
15
15
  }
16
16
  };
17
- var vi = (e, t) => {
18
- for (var r in t) Se(e, r, { get: t[r], enumerable: !0 });
17
+ var Tr = (e, t) => {
18
+ for (var i in t) Se(e, i, { get: t[i], enumerable: !0 });
19
19
  },
20
- Ii = (e, t, r, i) => {
20
+ Mr = (e, t, i, r) => {
21
21
  if ((t && typeof t == 'object') || typeof t == 'function')
22
- for (let n of ki(t))
23
- !Pi.call(e, n) &&
24
- n !== r &&
25
- Se(e, n, { get: () => t[n], enumerable: !(i = xi(t, n)) || i.enumerable });
22
+ for (let n of Pr(t))
23
+ !Ir.call(e, n) &&
24
+ n !== i &&
25
+ Se(e, n, { get: () => t[n], enumerable: !(r = _r(t, n)) || r.enumerable });
26
26
  return e;
27
27
  };
28
- var M = (e, t, r) => (
29
- (r = e != null ? wi(_i(e)) : {}),
30
- Ii(t || !e || !e.__esModule ? Se(r, 'default', { value: e, enumerable: !0 }) : r, e)
28
+ var M = (e, t, i) => (
29
+ (i = e != null ? kr(vr(e)) : {}),
30
+ Mr(t || !e || !e.__esModule ? Se(i, 'default', { value: e, enumerable: !0 }) : i, e)
31
31
  );
32
- function Si(e) {
32
+ function Er(e) {
33
33
  for (let t of e)
34
34
  try {
35
- let r = JSON.parse(kt.default.readFileSync(t, 'utf8'));
36
- if (r.name === '@teinai/cli' && typeof r.version == 'string' && r.version.trim())
37
- return r.version.trim();
35
+ let i = JSON.parse(kt.default.readFileSync(t, 'utf8'));
36
+ if (i.name === '@teinai/cli' && typeof i.version == 'string' && i.version.trim())
37
+ return i.version.trim();
38
38
  } catch {}
39
- return Mi;
39
+ return Kr;
40
40
  }
41
- function Ki() {
41
+ function $r() {
42
42
  let e = typeof __dirname == 'string' ? __dirname : process.cwd();
43
43
  return [
44
44
  Ke.default.join(e, 'package.json'),
@@ -47,12 +47,12 @@ function Ki() {
47
47
  }
48
48
  var kt,
49
49
  Ke,
50
- Mi,
50
+ Kr,
51
51
  H,
52
52
  oe = y(() => {
53
53
  'use strict';
54
- ((kt = M(require('node:fs'))), (Ke = M(require('node:path'))), (Mi = '0.0.0-dev'));
55
- H = Si(Ki());
54
+ ((kt = M(require('node:fs'))), (Ke = M(require('node:path'))), (Kr = '0.0.0-dev'));
55
+ H = Er($r());
56
56
  });
57
57
  function W() {
58
58
  try {
@@ -66,8 +66,8 @@ function W() {
66
66
  function $e(e) {
67
67
  try {
68
68
  L.default.existsSync(pe) || L.default.mkdirSync(pe, { recursive: !0, mode: 448 });
69
- let r = { ...W(), ...e };
70
- (L.default.writeFileSync(z, JSON.stringify(r, null, 2), { encoding: 'utf-8', mode: 384 }),
69
+ let i = { ...W(), ...e };
70
+ (L.default.writeFileSync(z, JSON.stringify(i, null, 2), { encoding: 'utf-8', mode: 384 }),
71
71
  L.default.chmodSync(pe, 448),
72
72
  L.default.chmodSync(z, 384));
73
73
  } catch (t) {
@@ -78,15 +78,15 @@ function _(e) {
78
78
  if (e && e.trim()) return e.trim();
79
79
  let t = process.env.TEIN_API_KEY || process.env.TEIN_KEY;
80
80
  if (t && t.trim()) return t.trim();
81
- let r = W();
82
- return r.apiKey && r.apiKey.trim() ? r.apiKey.trim() : '';
81
+ let i = W();
82
+ return i.apiKey && i.apiKey.trim() ? i.apiKey.trim() : '';
83
83
  }
84
84
  function x(e) {
85
85
  if (e && e.trim()) return e.trim().replace(/\/+$/, '');
86
86
  let t = process.env.TEIN_API_URL;
87
87
  if (t && t.trim()) return t.trim().replace(/\/+$/, '');
88
- let r = W();
89
- return r.apiUrl && r.apiUrl.trim() ? r.apiUrl.trim().replace(/\/+$/, '') : 'https://api.tein.ai';
88
+ let i = W();
89
+ return i.apiUrl && i.apiUrl.trim() ? i.apiUrl.trim().replace(/\/+$/, '') : 'https://api.tein.ai';
90
90
  }
91
91
  function de() {
92
92
  return z;
@@ -104,13 +104,13 @@ var L,
104
104
  (pe = Ee.default.join(Tt.default.homedir(), '.tein')),
105
105
  (z = Ee.default.join(pe, 'config.json')));
106
106
  });
107
- var Ri,
107
+ var qr,
108
108
  Mt,
109
109
  St,
110
110
  Kt = y(() => {
111
111
  'use strict';
112
- ((Ri = ['1:1', '16:9', '9:16', '21:9', '3:2', '2:3', '4:3', '3:4', '4:5', '5:4']),
113
- (Mt = [...Ri, 'auto']),
112
+ ((qr = ['1:1', '16:9', '9:16', '21:9', '3:2', '2:3', '4:3', '3:4', '4:5', '5:4']),
113
+ (Mt = [...qr, 'auto']),
114
114
  (St =
115
115
  'The medium endpoint renders non-square images at 1K only. Use resolution 1K, aspect_ratio 1:1, or the dynamic endpoint for a non-square 2K or 4K image.'));
116
116
  });
@@ -158,6 +158,7 @@ var ue,
158
158
  'seedance-2-lite',
159
159
  'seedance-2-fast',
160
160
  'seedance-2-mini',
161
+ 'seedance-2-5-vip',
161
162
  ],
162
163
  },
163
164
  { slug: 'seedream', name: 'Seedream', models: ['seedream-5-pro', 'seedream-5-5'] },
@@ -875,6 +876,79 @@ var ue,
875
876
  axes: { resolution: ['480p', '720p'] },
876
877
  from: { variant: '480p-no-video-omni' },
877
878
  },
879
+ {
880
+ slug: 'seedance-2-5-vip',
881
+ name: 'Seedance 2.5 VIP',
882
+ family: 'seedance',
883
+ vendor: 'ByteDance',
884
+ desc: 'A distilled version of Seedance 2.5 for cheaper results: 480p to 4K with native sound, from text, a start frame (with an optional end frame), or images, videos and audio clips as references, up to 30 seconds. Slower than Seedance 2.5: expect a video in 9 to 11 minutes.',
885
+ kind: 'video',
886
+ unit: '/sec',
887
+ api: { model: 'seedance-2-5-vip' },
888
+ variants: [
889
+ {
890
+ id: '480p',
891
+ price: { starter: 0.0496, plus: 0.0465, scale: 0.0438 },
892
+ label: '480p',
893
+ resolution: '480p',
894
+ withVideo: !1,
895
+ },
896
+ {
897
+ id: '480p-with-video',
898
+ price: { starter: 0.0992, plus: 0.093, scale: 0.0876 },
899
+ label: '480p \xB7 with reference video',
900
+ resolution: '480p',
901
+ withVideo: !0,
902
+ },
903
+ {
904
+ id: '720p',
905
+ price: { starter: 0.078, plus: 0.0731, scale: 0.0688 },
906
+ label: '720p',
907
+ resolution: '720p',
908
+ withVideo: !1,
909
+ },
910
+ {
911
+ id: '720p-with-video',
912
+ price: { starter: 0.156, plus: 0.1462, scale: 0.1376 },
913
+ label: '720p \xB7 with reference video',
914
+ resolution: '720p',
915
+ withVideo: !0,
916
+ },
917
+ {
918
+ id: '1080p',
919
+ price: { starter: 0.1399, plus: 0.1312, scale: 0.1235 },
920
+ label: '1080p',
921
+ resolution: '1080p',
922
+ withVideo: !1,
923
+ },
924
+ {
925
+ id: '1080p-with-video',
926
+ price: { starter: 0.2798, plus: 0.2624, scale: 0.247 },
927
+ label: '1080p \xB7 with reference video',
928
+ resolution: '1080p',
929
+ withVideo: !0,
930
+ },
931
+ {
932
+ id: '4k',
933
+ price: { starter: 0.3807, plus: 0.357, scale: 0.336 },
934
+ label: '4K',
935
+ resolution: '4k',
936
+ withVideo: !1,
937
+ },
938
+ {
939
+ id: '4k-with-video',
940
+ price: { starter: 0.7614, plus: 0.714, scale: 0.672 },
941
+ label: '4K \xB7 with reference video',
942
+ resolution: '4k',
943
+ withVideo: !0,
944
+ },
945
+ ],
946
+ unfiltered: null,
947
+ priority: null,
948
+ draft: null,
949
+ axes: { resolution: ['480p', '720p', '1080p', '4k'] },
950
+ from: { variant: '480p' },
951
+ },
878
952
  {
879
953
  slug: 'seedance-2',
880
954
  name: 'Seedance 2.0',
@@ -6442,40 +6516,40 @@ var me,
6442
6516
  function Le(e, t) {
6443
6517
  return `${e.trim().toLowerCase()}|${(t ?? '').trim().toLowerCase()}`;
6444
6518
  }
6445
- function qi(e, t) {
6519
+ function Dr(e, t) {
6446
6520
  if (e === 'seedance-2-mini') return 'mini';
6447
6521
  if (e !== 'seedance-2') return;
6448
- let r = typeof t?.quality == 'string' ? t.quality.trim().toLowerCase() : '';
6449
- return r === 'fast' || r === 'mini' || r === 'standard'
6450
- ? r
6522
+ let i = typeof t?.quality == 'string' ? t.quality.trim().toLowerCase() : '';
6523
+ return i === 'fast' || i === 'mini' || i === 'standard'
6524
+ ? i
6451
6525
  : t?.fast_mode === !0
6452
6526
  ? 'fast'
6453
6527
  : 'standard';
6454
6528
  }
6455
- function Li(e, t) {
6456
- let r = e
6529
+ function Nr(e, t) {
6530
+ let i = e
6457
6531
  .trim()
6458
6532
  .toLowerCase()
6459
6533
  .replace(/-(?:unfiltered|uncensored)$/, '');
6460
- if (r === 'seedance-2' || r === 'seedance-2-mini') {
6461
- let n = qi(r, t),
6534
+ if (i === 'seedance-2' || i === 'seedance-2-mini') {
6535
+ let n = Dr(i, t),
6462
6536
  s = Oe.get(Le('seedance-2', n));
6463
6537
  return s ? s.slug : null;
6464
6538
  }
6465
- let i = fe.get(r) ?? Oe.get(Le(r));
6466
- return i ? i.slug : null;
6539
+ let r = fe.get(i) ?? Oe.get(Le(i));
6540
+ return r ? r.slug : null;
6467
6541
  }
6468
- function Ni(e, t) {
6469
- return fe.has(e) && !(Di.has(e) && t) ? e : Li(e, t);
6542
+ function Ur(e, t) {
6543
+ return fe.has(e) && !(Vr.has(e) && t) ? e : Nr(e, t);
6470
6544
  }
6471
6545
  function F(e, t) {
6472
- let r = Ni(e, t);
6473
- return r ? (fe.get(r) ?? null) : null;
6546
+ let i = Ur(e, t);
6547
+ return i ? (fe.get(i) ?? null) : null;
6474
6548
  }
6475
- function Ut(e, t) {
6549
+ function Vt(e, t) {
6476
6550
  return `${e}/addon/${t}`;
6477
6551
  }
6478
- function Vt(e) {
6552
+ function Ut(e) {
6479
6553
  return Nt.get(e) ?? null;
6480
6554
  }
6481
6555
  function ge() {
@@ -6485,13 +6559,13 @@ var De,
6485
6559
  qt,
6486
6560
  Lt,
6487
6561
  Dt,
6488
- Oi,
6562
+ Lr,
6489
6563
  fe,
6490
6564
  Oe,
6491
6565
  Ot,
6492
6566
  Nt,
6493
6567
  qe,
6494
- Di,
6568
+ Vr,
6495
6569
  B = y(() => {
6496
6570
  'use strict';
6497
6571
  Et();
@@ -6508,9 +6582,9 @@ var De,
6508
6582
  (qt = me.filter((e) => !Z(e.slug))),
6509
6583
  (Lt = Ct.filter((e) => !Z(e.slug) && !De.models.some((t) => t.slug === e.slug))),
6510
6584
  (Dt = [...De.models, ...Lt, ...qt]),
6511
- (Oi = [
6585
+ (Lr = [
6512
6586
  ...De.families.map((e) => {
6513
- let t = Lt.filter((r) => r.family === e.slug).map((r) => r.slug);
6587
+ let t = Lt.filter((i) => i.family === e.slug).map((i) => i.slug);
6514
6588
  return t.length ? { ...e, models: [...e.models, ...t] } : e;
6515
6589
  }),
6516
6590
  ...Rt.map((e) => ({
@@ -6531,27 +6605,46 @@ var De,
6531
6605
  for (let t of e.addons ?? []) Nt.set(`${e.slug}/addon/${t.id}`, { model: e, addon: t });
6532
6606
  qe.set(e.slug, e.family);
6533
6607
  }
6534
- for (let e of Oi) for (let t of e.models) qe.has(t) || qe.set(t, e.slug);
6535
- Di = new Set(['seedance-2']);
6608
+ for (let e of Lr) for (let t of e.models) qe.has(t) || qe.set(t, e.slug);
6609
+ Vr = new Set(['seedance-2']);
6536
6610
  });
6537
6611
  function he(e) {
6538
6612
  let t = e.from?.variant;
6539
- return (t && e.variants.find((r) => r.id === t)) || e.variants[0];
6613
+ return (t && e.variants.find((i) => i.id === t)) || e.variants[0];
6614
+ }
6615
+ function jt(e) {
6616
+ let t = he(e),
6617
+ i = Fr[e.slug];
6618
+ return !i || Ft(t.resolution, i)
6619
+ ? t
6620
+ : (e.variants.find(
6621
+ (r) =>
6622
+ Ft(r.resolution, i) &&
6623
+ !!r.withVideo == !!t.withVideo &&
6624
+ (r.endpoint ?? null) === (t.endpoint ?? null),
6625
+ ) ?? t);
6540
6626
  }
6541
6627
  function Ne(e) {
6542
6628
  if (e.endpoints?.length)
6543
- return e.editVariants?.length && e.endpoints.some((t) => t.id === Ft)
6544
- ? Ft
6629
+ return e.editVariants?.length && e.endpoints.some((t) => t.id === Bt)
6630
+ ? Bt
6545
6631
  : (e.defaultEndpoint ?? e.endpoints[0].id);
6546
6632
  }
6547
6633
  var Ft,
6548
- Ue = y(() => {
6634
+ Fr,
6635
+ Bt,
6636
+ Ve = y(() => {
6549
6637
  'use strict';
6550
6638
  B();
6551
- Ft = 'dynamic';
6639
+ Ft = (e, t) =>
6640
+ typeof e == 'string' &&
6641
+ typeof t == 'string' &&
6642
+ e.trim().toLowerCase() === t.trim().toLowerCase();
6643
+ Fr = { 'seedance-2-5-vip': '1080p' };
6644
+ Bt = 'dynamic';
6552
6645
  });
6553
- function Fi(e) {
6554
- return Ut(e, Ui);
6646
+ function Gr(e) {
6647
+ return Vt(e, Br);
6555
6648
  }
6556
6649
  function ye(e) {
6557
6650
  let t = e.toFixed(5).replace(/0+$/, '');
@@ -6560,40 +6653,40 @@ function ye(e) {
6560
6653
  (t.split('.')[1] ?? '').length < 2 ? `$${e.toFixed(2)}` : `$${t}`
6561
6654
  );
6562
6655
  }
6563
- function Ve(e) {
6656
+ function Ue(e) {
6564
6657
  return e.starter === e.plus && e.plus === e.scale
6565
6658
  ? `${ye(e.starter)} on every plan`
6566
6659
  : `${ye(e.starter)} on Starter, ${ye(e.plus)} on Plus, ${ye(e.scale)} on Scale`;
6567
6660
  }
6568
- function Bt(e) {
6661
+ function Gt(e) {
6569
6662
  let t = [],
6570
- r = Vi[e],
6571
- i = r != null ? Vt(Fi(e)) : null;
6572
- if (i && r != null) {
6663
+ i = jr[e],
6664
+ r = i != null ? Ut(Gr(e)) : null;
6665
+ if (r && i != null) {
6573
6666
  let n =
6574
- i.addon.unfiltered && Ve(i.addon.unfiltered) === Ve(i.addon.price)
6667
+ r.addon.unfiltered && Ue(r.addon.unfiltered) === Ue(r.addon.price)
6575
6668
  ? ', Creative mode included'
6576
6669
  : '';
6577
- t.push(`Each reference image after the ${ji[r] ?? `${r}th`} adds ${Ve(i.addon.price)}${n}.`);
6670
+ t.push(`Each reference image after the ${zr[i] ?? `${i}th`} adds ${Ue(r.addon.price)}${n}.`);
6578
6671
  }
6579
6672
  return (
6580
- Bi.has(e) &&
6673
+ Hr.has(e) &&
6581
6674
  t.push(
6582
6675
  'With reference videos (multiple references mode), their seconds are billed with the output, at the same price per second (a 5 s video with a 10 s reference video bills 15 s).',
6583
6676
  ),
6584
6677
  t
6585
6678
  );
6586
6679
  }
6587
- var Ui,
6588
- Vi,
6589
- Bi,
6590
- ji,
6591
- jt = y(() => {
6680
+ var Br,
6681
+ jr,
6682
+ Hr,
6683
+ zr,
6684
+ Ht = y(() => {
6592
6685
  'use strict';
6593
6686
  B();
6594
- ((Ui = 'extra-image-input'), (Vi = { 'seedream-5-pro': 1, 'minimax-h3': 5 }));
6595
- Bi = new Set(['minimax-h3']);
6596
- ji = { 1: 'first', 5: '5th' };
6687
+ ((Br = 'extra-image-input'), (jr = { 'seedream-5-pro': 1, 'minimax-h3': 5 }));
6688
+ Hr = new Set(['minimax-h3']);
6689
+ zr = { 1: 'first', 5: '5th' };
6597
6690
  });
6598
6691
  var be,
6599
6692
  Fe = y(() => {
@@ -6608,29 +6701,29 @@ var be,
6608
6701
  'gpt-image-2-6-sunburst': 'gpt-image-2.6-sunburst',
6609
6702
  };
6610
6703
  });
6611
- var Gt = y(() => {
6704
+ var zt = y(() => {
6612
6705
  'use strict';
6613
6706
  });
6614
- function Ht(e, t) {
6615
- return typeof t == 'string' && (Gi[e]?.includes(t) ?? !1);
6707
+ function Wt(e, t) {
6708
+ return typeof t == 'string' && (Wr[e]?.includes(t) ?? !1);
6616
6709
  }
6617
- var Gi,
6618
- zt = y(() => {
6710
+ var Wr,
6711
+ Jt = y(() => {
6619
6712
  'use strict';
6620
6713
  B();
6621
- Ue();
6622
- Gt();
6623
- Gi = {};
6714
+ Ve();
6715
+ zt();
6716
+ Wr = {};
6624
6717
  });
6625
- function Wt(e) {
6626
- return e === 'nano-banana-pro' ? Hi : zi;
6718
+ function Yt(e) {
6719
+ return e === 'nano-banana-pro' ? Jr : Yr;
6627
6720
  }
6628
- var Hi,
6629
- zi,
6630
- Jt = y(() => {
6721
+ var Jr,
6722
+ Yr,
6723
+ Xt = y(() => {
6631
6724
  'use strict';
6632
- ((Hi = ['auto', '1:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9']),
6633
- (zi = [
6725
+ ((Jr = ['auto', '1:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9']),
6726
+ (Yr = [
6634
6727
  'auto',
6635
6728
  '1:1',
6636
6729
  '1:4',
@@ -6648,10 +6741,10 @@ var Hi,
6648
6741
  '21:9',
6649
6742
  ]));
6650
6743
  });
6651
- var Yt,
6652
- Xt = y(() => {
6744
+ var Qt,
6745
+ Zt = y(() => {
6653
6746
  'use strict';
6654
- Yt = [
6747
+ Qt = [
6655
6748
  'prompt',
6656
6749
  'system',
6657
6750
  'messages',
@@ -6665,10 +6758,10 @@ var Yt,
6665
6758
  'endpoint',
6666
6759
  ];
6667
6760
  });
6668
- var Qt,
6669
- Zt = y(() => {
6761
+ var ei,
6762
+ ti = y(() => {
6670
6763
  'use strict';
6671
- Qt = [
6764
+ ei = [
6672
6765
  {
6673
6766
  slug: 'claude-fable-5-1',
6674
6767
  family: 'fable-5-1',
@@ -6737,13 +6830,13 @@ var Qt,
6737
6830
  },
6738
6831
  ];
6739
6832
  });
6740
- function er(e) {
6833
+ function ii(e) {
6741
6834
  return `$${e}`;
6742
6835
  }
6743
- function Be(e, t, r) {
6744
- return F(e)?.variants.find((n) => n.endpoint === t && n.component === r)?.price.starter ?? null;
6836
+ function Be(e, t, i) {
6837
+ return F(e)?.variants.find((n) => n.endpoint === t && n.component === i)?.price.starter ?? null;
6745
6838
  }
6746
- function Wi(e) {
6839
+ function Xr(e) {
6747
6840
  return [
6748
6841
  {
6749
6842
  name: 'prompt',
@@ -6809,61 +6902,61 @@ function Wi(e) {
6809
6902
  },
6810
6903
  ];
6811
6904
  }
6812
- function tr(e) {
6905
+ function ri(e) {
6813
6906
  let t = Be(e, 'cheap', 'input'),
6814
- r = Be(e, 'cheap', 'output');
6815
- return t != null && r != null ? `${er(t)}/M in \xB7 ${er(r)}/M out` : '';
6907
+ i = Be(e, 'cheap', 'output');
6908
+ return t != null && i != null ? `${ii(t)}/M in \xB7 ${ii(i)}/M out` : '';
6816
6909
  }
6817
- function rr() {
6910
+ function ai() {
6818
6911
  return Object.fromEntries(
6819
- Qt.map((e) => {
6912
+ ei.map((e) => {
6820
6913
  let t = Be(e.slug, 'stable', 'input') != null,
6821
- r = tr(e.slug),
6822
- i = {
6914
+ i = ri(e.slug),
6915
+ r = {
6823
6916
  slug: e.slug,
6824
6917
  name: e.name,
6825
6918
  category: 'Text',
6826
6919
  kind: 'Reasoning (LLM)',
6827
6920
  vendor: 'Anthropic',
6828
6921
  description: e.description,
6829
- priceFormatted: r,
6922
+ priceFormatted: i,
6830
6923
  unit: '/M tokens',
6831
6924
  primaryToolName: 'run_task',
6832
- parameters: Wi(t),
6925
+ parameters: Xr(t),
6833
6926
  };
6834
- return [e.slug, i];
6927
+ return [e.slug, r];
6835
6928
  }),
6836
6929
  );
6837
6930
  }
6838
- var ir = y(() => {
6931
+ var ni = y(() => {
6839
6932
  'use strict';
6840
- Zt();
6933
+ ti();
6841
6934
  B();
6842
6935
  });
6843
6936
  function je(e) {
6844
- return e ? Yi.get(e) : void 0;
6937
+ return e ? Zr.get(e) : void 0;
6845
6938
  }
6846
- function or(e, t) {
6939
+ function pi(e, t) {
6847
6940
  return !e.aspects?.length || e.sourceFramedModes?.includes(t)
6848
6941
  ? null
6849
6942
  : e.adaptiveModes?.includes(t)
6850
6943
  ? [...e.aspects, 'adaptive']
6851
6944
  : [...e.aspects];
6852
6945
  }
6853
- var ar,
6854
- Ji,
6855
- nr,
6856
- cs,
6857
- Yi,
6858
- sr,
6946
+ var si,
6947
+ Qr,
6948
+ oi,
6949
+ gs,
6950
+ Zr,
6951
+ li,
6859
6952
  Ge,
6860
- us,
6953
+ hs,
6861
6954
  He,
6862
6955
  ze = y(() => {
6863
6956
  'use strict';
6864
- ((ar = ['16:9', '9:16', '1:1', '21:9']),
6865
- (Ji = ['16:9', '9:16', '1:1', '4:3', '3:4', '21:9']),
6866
- (nr = [
6957
+ ((si = ['16:9', '9:16', '1:1', '21:9']),
6958
+ (Qr = ['16:9', '9:16', '1:1', '4:3', '3:4', '21:9']),
6959
+ (oi = [
6867
6960
  {
6868
6961
  slug: 'kling-v4',
6869
6962
  kind: 'video',
@@ -6871,7 +6964,7 @@ var ar,
6871
6964
  promptMax: 26e3,
6872
6965
  duration: { min: 3, max: 30, default: 5 },
6873
6966
  heights: { '720p': 720, '1080p': 1080 },
6874
- aspects: ar,
6967
+ aspects: si,
6875
6968
  sourceFramedModes: ['image_to_video'],
6876
6969
  adaptiveModes: ['multi_reference'],
6877
6970
  fps: 24,
@@ -6895,7 +6988,7 @@ var ar,
6895
6988
  promptMax: 26e3,
6896
6989
  duration: { min: 3, max: 20, default: 5 },
6897
6990
  heights: { '720p': 720 },
6898
- aspects: [...ar, '4:3', '3:4'],
6991
+ aspects: [...si, '4:3', '3:4'],
6899
6992
  sourceFramedModes: ['image_to_video'],
6900
6993
  adaptiveModes: ['multi_reference'],
6901
6994
  fps: 24,
@@ -6934,7 +7027,7 @@ var ar,
6934
7027
  promptMax: 65535,
6935
7028
  duration: { min: 5, max: 15, default: 5 },
6936
7029
  heights: { '480p': 480, '768p': 768 },
6937
- aspects: Ji,
7030
+ aspects: Qr,
6938
7031
  fps: 24,
6939
7032
  audio: 'free',
6940
7033
  seed: !0,
@@ -7009,9 +7102,9 @@ var ar,
7009
7102
  seed: !0,
7010
7103
  },
7011
7104
  ]),
7012
- (cs = nr.map((e) => e.slug)),
7013
- (Yi = new Map(nr.map((e) => [e.slug, e]))));
7014
- ((sr = 'EXAVITQu4vr4xnSDxMaL'),
7105
+ (gs = oi.map((e) => e.slug)),
7106
+ (Zr = new Map(oi.map((e) => [e.slug, e]))));
7107
+ ((li = 'EXAVITQu4vr4xnSDxMaL'),
7015
7108
  (Ge = {
7016
7109
  hpp4J3VqNfWAUOO0d1Us: 'Bella',
7017
7110
  CwhRBWXzGAHq8TQ4Fs17: 'Roger',
@@ -7034,7 +7127,7 @@ var ar,
7034
7127
  pqHfZKP75CvOlQylNhV4: 'Bill',
7035
7128
  pNInz6obpgDQGcFmaJgB: 'Adam',
7036
7129
  }),
7037
- (us = Object.keys(Ge)),
7130
+ (hs = Object.keys(Ge)),
7038
7131
  (He = [
7039
7132
  'mp3_44100_128',
7040
7133
  'mp3_22050_32',
@@ -7050,10 +7143,10 @@ var ar,
7050
7143
  'opus_48000_192',
7051
7144
  ]));
7052
7145
  });
7053
- function Qi(e) {
7146
+ function ta(e) {
7054
7147
  let t = e.duration,
7055
- r = Object.keys(e.heights),
7056
- i = e.sourceFramedModes?.length
7148
+ i = Object.keys(e.heights),
7149
+ r = e.sourceFramedModes?.length
7057
7150
  ? ` Not taken by ${e.sourceFramedModes.join(', ')}: the source image sets the frame.`
7058
7151
  : '',
7059
7152
  n = e.modeRequired ? void 0 : e.modes[0],
@@ -7071,8 +7164,8 @@ function Qi(e) {
7071
7164
  {
7072
7165
  name: 'resolution',
7073
7166
  type: 'select',
7074
- default: r[0],
7075
- options: r,
7167
+ default: i[0],
7168
+ options: i,
7076
7169
  description: 'Output resolution. Higher resolutions cost more per second.',
7077
7170
  },
7078
7171
  {
@@ -7080,7 +7173,7 @@ function Qi(e) {
7080
7173
  type: 'select',
7081
7174
  ...(s ? {} : { default: e.aspects[0] }),
7082
7175
  options: [...e.aspects, ...(e.adaptiveModes?.length ? ['adaptive'] : [])],
7083
- description: `The frame.${e.adaptiveModes?.length ? ` adaptive: ${e.adaptiveModes.join(', ')} only.` : ''}${i}`,
7176
+ description: `The frame.${e.adaptiveModes?.length ? ` adaptive: ${e.adaptiveModes.join(', ')} only.` : ''}${r}`,
7084
7177
  },
7085
7178
  ];
7086
7179
  if (
@@ -7143,7 +7236,7 @@ function Qi(e) {
7143
7236
  }
7144
7237
  return o;
7145
7238
  }
7146
- function Zi(e) {
7239
+ function ia(e) {
7147
7240
  let t = Object.keys(e.sizes);
7148
7241
  return [
7149
7242
  {
@@ -7160,13 +7253,13 @@ function Zi(e) {
7160
7253
  },
7161
7254
  ];
7162
7255
  }
7163
- function ta() {
7256
+ function aa() {
7164
7257
  return [
7165
7258
  {
7166
7259
  name: 'voice_id',
7167
7260
  type: 'string',
7168
- default: sr,
7169
- description: `text_to_speech: the ElevenLabs voice id, one of: ${ea}.`,
7261
+ default: li,
7262
+ description: `text_to_speech: the ElevenLabs voice id, one of: ${ra}.`,
7170
7263
  },
7171
7264
  {
7172
7265
  name: 'turns',
@@ -7185,9 +7278,9 @@ function ta() {
7185
7278
  },
7186
7279
  ];
7187
7280
  }
7188
- function lr(e) {
7281
+ function di(e) {
7189
7282
  let t = e.promptOptionalModes?.length ? ` Optional on ${e.promptOptionalModes.join(', ')}.` : '',
7190
- r = [
7283
+ i = [
7191
7284
  {
7192
7285
  name: 'prompt',
7193
7286
  type: 'string',
@@ -7200,25 +7293,25 @@ function lr(e) {
7200
7293
  required: !0,
7201
7294
  ...(e.modeRequired ? {} : { default: e.modes[0] }),
7202
7295
  options: [...e.modes],
7203
- description: `${e.modeRequired ? 'Required. ' : ''}${e.modes.map((i) => Xi[i]).join(' ')}`,
7296
+ description: `${e.modeRequired ? 'Required. ' : ''}${e.modes.map((r) => ea[r]).join(' ')}`,
7204
7297
  },
7205
7298
  ];
7206
7299
  return (
7207
- e.kind === 'video' ? r.push(...Qi(e)) : e.kind === 'image' ? r.push(...Zi(e)) : r.push(...ta()),
7300
+ e.kind === 'video' ? i.push(...ta(e)) : e.kind === 'image' ? i.push(...ia(e)) : i.push(...aa()),
7208
7301
  e.seed &&
7209
- r.push({ name: 'seed', type: 'number', min: 0, description: 'Seed for repeatable runs.' }),
7210
- r
7302
+ i.push({ name: 'seed', type: 'number', min: 0, description: 'Seed for repeatable runs.' }),
7303
+ i
7211
7304
  );
7212
7305
  }
7213
7306
  var J,
7214
- Xi,
7215
7307
  ea,
7216
- pr = y(() => {
7308
+ ra,
7309
+ ci = y(() => {
7217
7310
  'use strict';
7218
7311
  ze();
7219
7312
  ((J =
7220
7313
  'as public http(s) URLs or data URIs. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.'),
7221
- (Xi = {
7314
+ (ea = {
7222
7315
  text_to_video: 'text_to_video: from the prompt alone.',
7223
7316
  image_to_video: 'image_to_video: a start image in first_frame_image.',
7224
7317
  first_n_last_frames: 'first_n_last_frames: first_frame_image and last_frame_image.',
@@ -7228,44 +7321,44 @@ var J,
7228
7321
  text_to_speech: 'text_to_speech: speaks the prompt in one voice.',
7229
7322
  dialogue: 'dialogue: speaks `turns`, each with its own voice.',
7230
7323
  }));
7231
- ea = Object.entries(Ge)
7324
+ ra = Object.entries(Ge)
7232
7325
  .map(([e, t]) => `${e} (${t})`)
7233
7326
  .join(', ');
7234
7327
  });
7235
- function ur(e) {
7328
+ function fi(e) {
7236
7329
  return e === we || e === xe;
7237
7330
  }
7238
7331
  var we,
7239
- dr,
7332
+ ui,
7240
7333
  xe,
7241
- cr,
7334
+ mi,
7242
7335
  We,
7243
- mr,
7244
- hs,
7245
- ys,
7246
- bs,
7247
- ws,
7248
- fr = y(() => {
7336
+ gi,
7337
+ xs,
7338
+ ks,
7339
+ _s,
7340
+ Ps,
7341
+ hi = y(() => {
7249
7342
  'use strict';
7250
7343
  ((we = 'enhancor-ultrafine'),
7251
- (dr = 'Enhancor Ultrafine'),
7344
+ (ui = 'Enhancor Ultrafine'),
7252
7345
  (xe = 'enhancor-deblur'),
7253
- (cr = 'Enhancor Deblur'));
7346
+ (mi = 'Enhancor Deblur'));
7254
7347
  ((We = { skin: [2, 3, 4], noSkin: [2, 3, 4, 8, 16] }),
7255
- (mr = 2),
7256
- (hs = 24 * 1024 * 1024),
7257
- (ys = 4096 * 4096),
7258
- (bs = 30 * 6e4),
7259
- (ws = 120 * 6e4));
7348
+ (gi = 2),
7349
+ (xs = 24 * 1024 * 1024),
7350
+ (ks = 4096 * 4096),
7351
+ (_s = 30 * 6e4),
7352
+ (Ps = 120 * 6e4));
7260
7353
  });
7261
- var ra,
7262
- gr,
7263
- ia,
7354
+ var na,
7355
+ yi,
7356
+ sa,
7264
7357
  Je,
7265
- hr = y(() => {
7358
+ bi = y(() => {
7266
7359
  'use strict';
7267
- ((ra = ['natural', 'pores', 'freckles', 'more_freckles', 'blemish', 'glow', 'unblur']),
7268
- (gr = {
7360
+ ((na = ['natural', 'pores', 'freckles', 'more_freckles', 'blemish', 'glow', 'unblur']),
7361
+ (yi = {
7269
7362
  natural: 'Natural',
7270
7363
  pores: 'Pores',
7271
7364
  freckles: 'Freckles',
@@ -7274,8 +7367,8 @@ var ra,
7274
7367
  glow: 'Glow',
7275
7368
  unblur: 'Unblur',
7276
7369
  }),
7277
- (ia = 'unblur'),
7278
- (Je = ra.filter((e) => e !== ia)));
7370
+ (sa = 'unblur'),
7371
+ (Je = na.filter((e) => e !== sa)));
7279
7372
  });
7280
7373
  var ee,
7281
7374
  ke,
@@ -7296,150 +7389,222 @@ var ee,
7296
7389
  (ke =
7297
7390
  'a request with creative_mode: true answers 503 checkpoint_unavailable and nothing is charged'));
7298
7391
  });
7299
- function aa(e) {
7300
- return yr.includes(e);
7392
+ function oa(e) {
7393
+ return wi.includes(e);
7301
7394
  }
7302
7395
  function _e(e = process.env) {
7303
7396
  let t = String(e.IMAGE_PRIORITY_MODELS ?? ''),
7304
- r = new Set(
7397
+ i = new Set(
7305
7398
  t
7306
7399
  .split(',')
7307
- .map((i) => i.trim().toLowerCase())
7400
+ .map((r) => r.trim().toLowerCase())
7308
7401
  .filter(Boolean),
7309
7402
  );
7310
- return yr.filter((i) => r.has(i));
7403
+ return wi.filter((r) => i.has(r));
7311
7404
  }
7312
- function br(e, t = process.env) {
7313
- return aa(e) && _e(t).includes(e);
7405
+ function xi(e, t = process.env) {
7406
+ return oa(e) && _e(t).includes(e);
7314
7407
  }
7315
- function wr(e) {
7408
+ function ki(e) {
7316
7409
  return e === 'nano-banana-pro' ? 'Nano Banana Pro' : 'Nano Banana 2.1';
7317
7410
  }
7318
- var yr,
7411
+ var wi,
7319
7412
  Xe = y(() => {
7320
7413
  'use strict';
7321
- yr = ['nano-banana-2.1', 'nano-banana-pro'];
7414
+ wi = ['nano-banana-2.1', 'nano-banana-pro'];
7322
7415
  });
7323
7416
  function te(e) {
7324
7417
  return `$${Number(e.toFixed(5))}`;
7325
7418
  }
7326
- function it(e) {
7419
+ function rt(e) {
7327
7420
  if (e.kind === 'llm') {
7328
7421
  let t = e.defaultEndpoint,
7329
- r = (s) =>
7422
+ i = (s) =>
7330
7423
  e.variants.find(
7331
7424
  (o) =>
7332
7425
  o.component === s &&
7333
7426
  (!t || !o.endpoint || o.endpoint === t) &&
7334
7427
  (!o.context || o.context === '0\u201332K'),
7335
7428
  ),
7336
- i = r('input'),
7337
- n = r('output');
7338
- return i && n
7339
- ? `${te(i.price.starter)}/M in \xB7 ${te(n.price.starter)}/M out`
7429
+ r = i('input'),
7430
+ n = i('output');
7431
+ return r && n
7432
+ ? `${te(r.price.starter)}/M in \xB7 ${te(n.price.starter)}/M out`
7340
7433
  : `from ${te(he(e).price.starter)}/M tokens`;
7341
7434
  }
7342
7435
  return `from ${te(he(e).price.starter)}${e.unit}`;
7343
7436
  }
7344
- function oa(e, t) {
7345
- let r = t.filter((i) => Number.isFinite(i) && i > 0);
7346
- return r.length ? `from ${te(Math.min(...r))}${e}` : null;
7437
+ function da(e, t) {
7438
+ let i = t.filter((r) => Number.isFinite(r) && r > 0);
7439
+ return i.length ? `from ${te(Math.min(...i))}${e}` : null;
7347
7440
  }
7348
- function vr(e) {
7441
+ function Ti(e) {
7349
7442
  for (let t of ce) {
7350
- let r = Y[t],
7351
- i = r ? oa(r.unit, e[t] ?? []) : null;
7352
- r && i && (r.priceFormatted = i);
7443
+ let i = Y[t],
7444
+ r = i ? da(i.unit, e[t] ?? []) : null;
7445
+ i && r && (i.priceFormatted = r);
7353
7446
  }
7354
7447
  }
7355
7448
  function $(e, t) {
7356
- let r = e.axes?.resolution ?? [
7357
- ...new Set(e.variants.map((i) => i.resolution).filter((i) => !!i)),
7449
+ let i = e.axes?.resolution ?? [
7450
+ ...new Set(e.variants.map((r) => r.resolution).filter((r) => !!r)),
7358
7451
  ];
7359
7452
  return {
7360
7453
  name: 'resolution',
7361
7454
  type: 'select',
7362
- default: he(e).resolution ?? r[0],
7363
- options: r,
7455
+ default: jt(e).resolution ?? i[0],
7456
+ options: i,
7364
7457
  ...(t ? { description: t } : {}),
7365
7458
  };
7366
7459
  }
7367
- function Ir(e) {
7460
+ function Mi(e) {
7368
7461
  if (!e.endpoints?.length) return null;
7369
- let t = e.endpoints.filter((r) => Ht(e.slug, r.id));
7462
+ let t = e.endpoints.filter((i) => Wt(e.slug, i.id));
7370
7463
  return {
7371
7464
  name: 'endpoint',
7372
7465
  type: 'select',
7373
7466
  default: Ne(e),
7374
- options: e.endpoints.filter((r) => !t.includes(r)).map((r) => r.id),
7467
+ options: e.endpoints.filter((i) => !t.includes(i)).map((i) => i.id),
7375
7468
  description:
7376
7469
  (e.slug === 'gemini-3.1-pro-preview'
7377
7470
  ? 'Where the request is served; a missing endpoint is the default, the lowest price, and an unknown one is refused.'
7378
7471
  : 'Where the request is served; a missing or unknown endpoint is the default, the lowest price.') +
7379
- (t.length ? ` ${t.map((r) => r.label).join(' and ')}: coming soon.` : ''),
7472
+ (t.length ? ` ${t.map((i) => i.label).join(' and ')}: coming soon.` : ''),
7380
7473
  };
7381
7474
  }
7382
- function pa(e, t) {
7383
- if (e.unfiltered == null || t.some((i) => i.name === 'creative_mode')) return t;
7384
- let r = ee.includes(e.api.model);
7385
- return [...t.filter((i) => !Pe.has(i.name)), r ? nt : la];
7475
+ function ua(e, t) {
7476
+ if (e.unfiltered == null || t.some((r) => r.name === 'creative_mode')) return t;
7477
+ let i = ee.includes(e.api.model);
7478
+ return [...t.filter((r) => !Pe.has(r.name)), i ? nt : ca];
7386
7479
  }
7387
7480
  function Qe(e, t) {
7388
- let r = e.filter((n) => !Pe.has(n.name)),
7389
- i = [nt, Tr];
7390
- return (i.push(st, ot), [...r, ...i]);
7481
+ let i = e.filter((n) => !Pe.has(n.name)),
7482
+ r = [nt, Si];
7483
+ return (r.push(st, ot), [...i, ...r]);
7391
7484
  }
7392
- function ma(e) {
7485
+ function ha(e) {
7393
7486
  return [
7394
7487
  ...e
7395
- .filter((t) => !ca.has(t.name) && !Pe.has(t.name))
7488
+ .filter((t) => !fa.has(t.name) && !Pe.has(t.name))
7396
7489
  .map((t) => {
7397
7490
  if (t.name === 'resolution')
7398
7491
  return {
7399
7492
  ...t,
7400
7493
  ...(t.options
7401
7494
  ? {
7402
- options: t.options.filter((i) =>
7403
- ['480p', '720p'].includes(String(i).toLowerCase()),
7495
+ options: t.options.filter((r) =>
7496
+ ['480p', '720p'].includes(String(r).toLowerCase()),
7404
7497
  ),
7405
7498
  }
7406
7499
  : {}),
7407
- description: `Output resolution: 480p or 720p (8-bit). This tier has no 1080p or 4k. ${re}`,
7500
+ description: `Output resolution: 480p or 720p (8-bit). This tier has no 1080p or 4k. ${ie}`,
7408
7501
  };
7409
- let r = ua[t.name];
7410
- return r && typeof t.description == 'string'
7411
- ? { ...t, description: t.description.replace(/\(up to [^)]*\)/, `(${r})`) }
7502
+ let i = ga[t.name];
7503
+ return i && typeof t.description == 'string'
7504
+ ? { ...t, description: t.description.replace(/\(up to [^)]*\)/, `(${i})`) }
7412
7505
  : t;
7413
7506
  }),
7414
7507
  nt,
7415
- Tr,
7508
+ Si,
7416
7509
  st,
7417
7510
  ot,
7418
7511
  ];
7419
7512
  }
7420
- function Mr(e) {
7513
+ function Ki(e) {
7421
7514
  return (
7422
7515
  e.startsWith('seedance-2-5-') &&
7423
7516
  e !== 'seedance-2-5-lite' &&
7517
+ e !== 'seedance-2-5-vip' &&
7424
7518
  !/-(creative-mode|unfiltered|uncensored)$/.test(e)
7425
7519
  );
7426
7520
  }
7427
- function kr(e, t = {}) {
7521
+ function ya(e) {
7522
+ return [
7523
+ S(
7524
+ 'Describe the video, the camera and its sound; for multi_reference say what each reference is for (up to 15000 characters).',
7525
+ ),
7526
+ {
7527
+ name: 'mode',
7528
+ type: 'select',
7529
+ required: !0,
7530
+ options: ['text_to_video', 'image_to_video', 'multi_reference'],
7531
+ description:
7532
+ 'text_to_video; image_to_video (first_frame_image, optional last_frame_image); multi_reference (images, videos and/or audios).',
7533
+ },
7534
+ {
7535
+ name: 'duration',
7536
+ type: 'slider',
7537
+ default: 5,
7538
+ min: 4,
7539
+ max: 30,
7540
+ description: 'Video length in whole seconds: 4 to 30.',
7541
+ },
7542
+ {
7543
+ ...$(
7544
+ e,
7545
+ 'Left out: 1080p. Sound is the same price on or off. Slower than Seedance 2.5: expect 9 to 11 minutes a run.',
7546
+ ),
7547
+ default: '1080p',
7548
+ },
7549
+ {
7550
+ name: 'aspect_ratio',
7551
+ type: 'select',
7552
+ options: ['16:9', '9:16', '1:1', '4:3', '3:4', '21:9'],
7553
+ description:
7554
+ 'text_to_video and multi_reference only (left out: 16:9). image_to_video takes no ratio: the video follows the start image.',
7555
+ },
7556
+ {
7557
+ name: 'generate_audio',
7558
+ type: 'boolean',
7559
+ default: !0,
7560
+ description: 'Generate sound with the video (same price either way).',
7561
+ },
7562
+ {
7563
+ name: 'first_frame_image',
7564
+ type: 'string',
7565
+ description:
7566
+ 'image_to_video: the start frame (JPEG, PNG or WebP), as a public http(s) URL or data URI. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.',
7567
+ },
7568
+ {
7569
+ name: 'last_frame_image',
7570
+ type: 'string',
7571
+ description: 'image_to_video: an optional end frame.',
7572
+ },
7573
+ {
7574
+ name: 'images',
7575
+ type: 'string[]',
7576
+ description: 'multi_reference: up to 10 reference images. Public http(s) URLs or data URIs.',
7577
+ },
7578
+ {
7579
+ name: 'videos',
7580
+ type: 'string[]',
7581
+ description:
7582
+ 'multi_reference: up to 5 reference videos, MP4 or MOV, 2-30 s each and 30 s in all. A run with a reference video is priced on its own row.',
7583
+ },
7584
+ {
7585
+ name: 'audios',
7586
+ type: 'string[]',
7587
+ description:
7588
+ 'multi_reference: up to 5 reference audio clips, MP3 or WAV, 2-30 s each and 30 s in all, always with at least one reference image or video.',
7589
+ },
7590
+ ];
7591
+ }
7592
+ function Pi(e, t = {}) {
7428
7593
  return [
7429
7594
  ...e
7430
- .filter((r) => !da.has(r.name) && !Pe.has(r.name))
7431
- .map((r) =>
7432
- r.name === 'prompt'
7433
- ? { ...r, required: !0 }
7434
- : r.name === 'resolution'
7595
+ .filter((i) => !ma.has(i.name) && !Pe.has(i.name))
7596
+ .map((i) =>
7597
+ i.name === 'prompt'
7598
+ ? { ...i, required: !0 }
7599
+ : i.name === 'resolution'
7435
7600
  ? {
7436
- ...r,
7437
- ...(t.no4k && r.options
7438
- ? { options: r.options.filter((i) => String(i).toLowerCase() !== '4k') }
7601
+ ...i,
7602
+ ...(t.no4k && i.options
7603
+ ? { options: i.options.filter((r) => String(r).toLowerCase() !== '4k') }
7439
7604
  : {}),
7440
- description: `Output resolution. TEIN LITE is the lower-priced endpoint for getting started. Stability and reliability are not guaranteed. ${re}`,
7605
+ description: `Output resolution. TEIN LITE is the lower-priced endpoint for getting started. Stability and reliability are not guaranteed. ${ie}`,
7441
7606
  }
7442
- : r,
7607
+ : i,
7443
7608
  ),
7444
7609
  {
7445
7610
  name: 'bitrate_mode',
@@ -7466,28 +7631,28 @@ function Ze(e, t) {
7466
7631
  },
7467
7632
  $(e),
7468
7633
  { name: 'aspect_ratio', type: 'select', default: t.aspects[0], options: t.aspects },
7469
- ...t.references.map((r) =>
7470
- r.endsWith('s')
7634
+ ...t.references.map((i) =>
7635
+ i.endsWith('s')
7471
7636
  ? {
7472
- name: r,
7637
+ name: i,
7473
7638
  type: 'string[]',
7474
- description: `${r} as public http(s) URLs or data URIs. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.`,
7639
+ description: `${i} as public http(s) URLs or data URIs. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.`,
7475
7640
  }
7476
7641
  : {
7477
- name: r,
7642
+ name: i,
7478
7643
  type: 'string',
7479
- description: `${r} as a public http(s) URL or data URI. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.`,
7644
+ description: `${i} as a public http(s) URL or data URI. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.`,
7480
7645
  },
7481
7646
  ),
7482
7647
  ];
7483
7648
  }
7484
- function fa(e, t) {
7485
- return e.map((r) =>
7486
- t[r.name] ? { ...r, description: `${r.description ?? ''} ${t[r.name]}`.trim() } : r,
7649
+ function ba(e, t) {
7650
+ return e.map((i) =>
7651
+ t[i.name] ? { ...i, description: `${i.description ?? ''} ${t[i.name]}`.trim() } : i,
7487
7652
  );
7488
7653
  }
7489
- function ga(e) {
7490
- let t = Ir(e);
7654
+ function wa(e) {
7655
+ let t = Mi(e);
7491
7656
  return [
7492
7657
  S('Image prompt text. Supports complex composition and text instructions.'),
7493
7658
  ...(t ? [t] : []),
@@ -7554,7 +7719,7 @@ function ga(e) {
7554
7719
  },
7555
7720
  ];
7556
7721
  }
7557
- function ha(e) {
7722
+ function xa(e) {
7558
7723
  return [
7559
7724
  S('Image prompt text.'),
7560
7725
  {
@@ -7562,7 +7727,7 @@ function ha(e) {
7562
7727
  type: 'string[]',
7563
7728
  description: 'Images to edit or use as reference (up to 14).',
7564
7729
  },
7565
- { name: 'aspect_ratio', type: 'select', default: '1:1', options: [...Wt(e.slug)] },
7730
+ { name: 'aspect_ratio', type: 'select', default: '1:1', options: [...Yt(e.slug)] },
7566
7731
  $(e),
7567
7732
  {
7568
7733
  name: 'n',
@@ -7588,22 +7753,22 @@ function ha(e) {
7588
7753
  },
7589
7754
  ];
7590
7755
  }
7591
- function xa() {
7592
- let e = Yt,
7756
+ function va() {
7757
+ let e = Qt,
7593
7758
  t = [];
7594
- for (let r of lt(!0))
7595
- e.includes(r.name) &&
7759
+ for (let i of lt(!0))
7760
+ e.includes(i.name) &&
7596
7761
  (t.push({
7597
- ...r,
7598
- ...(r.name === 'max_tokens' ? { min: 64 } : {}),
7599
- ...(r.name === 'messages'
7762
+ ...i,
7763
+ ...(i.name === 'max_tokens' ? { min: 64 } : {}),
7764
+ ...(i.name === 'messages'
7600
7765
  ? {
7601
7766
  description:
7602
7767
  'Chat history: system, developer, user (text and image_url parts) and assistant turns; no tool turns.',
7603
7768
  }
7604
7769
  : {}),
7605
7770
  }),
7606
- r.name === 'top_p' &&
7771
+ i.name === 'top_p' &&
7607
7772
  t.push({
7608
7773
  name: 'top_k',
7609
7774
  type: 'number',
@@ -7613,7 +7778,7 @@ function xa() {
7613
7778
  }));
7614
7779
  return t;
7615
7780
  }
7616
- function ka() {
7781
+ function Ia() {
7617
7782
  return lt(!0).map((e) =>
7618
7783
  e.name === 'max_tokens' || e.name === 'max_completion_tokens' ? { ...e, min: 128 } : e,
7619
7784
  );
@@ -7713,17 +7878,17 @@ function lt(e) {
7713
7878
  },
7714
7879
  ];
7715
7880
  }
7716
- function _a(e) {
7717
- if (e.slug === 'seed-2-1-turbo') return ba;
7718
- let t = Ir(e);
7881
+ function Ta(e) {
7882
+ if (e.slug === 'seed-2-1-turbo') return _a;
7883
+ let t = Mi(e);
7719
7884
  return [
7720
7885
  ...(e.slug === 'gemini-3.1-pro-preview'
7721
- ? xa()
7886
+ ? va()
7722
7887
  : e.slug === 'gemini-3.7-flash'
7723
- ? ka()
7724
- : e.slug === 'gpt-6-astra' || wa.includes(e.slug)
7888
+ ? Ia()
7889
+ : e.slug === 'gpt-6-astra' || Pa.includes(e.slug)
7725
7890
  ? lt(e.slug !== 'gpt-6-astra')
7726
- : ya),
7891
+ : ka),
7727
7892
  ...(t ? [t] : []),
7728
7893
  ];
7729
7894
  }
@@ -7735,7 +7900,7 @@ function et() {
7735
7900
  description: 'The photo to fix: one JPEG or PNG URL.',
7736
7901
  };
7737
7902
  }
7738
- function va(e) {
7903
+ function Sa(e) {
7739
7904
  return [
7740
7905
  {
7741
7906
  name: 'video_url',
@@ -7757,7 +7922,7 @@ function va(e) {
7757
7922
  },
7758
7923
  ];
7759
7924
  }
7760
- function Ia() {
7925
+ function Ka() {
7761
7926
  return [
7762
7927
  {
7763
7928
  name: 'mode',
@@ -7828,7 +7993,7 @@ function Ia() {
7828
7993
  },
7829
7994
  ];
7830
7995
  }
7831
- function Ta(e) {
7996
+ function Ea(e) {
7832
7997
  return [
7833
7998
  {
7834
7999
  name: 'image',
@@ -7853,31 +8018,32 @@ function Ta(e) {
7853
8018
  $(e, 'Output resolution. 720p only.'),
7854
8019
  ];
7855
8020
  }
7856
- function Ma(e) {
8021
+ function $a(e) {
7857
8022
  let t = e.slug;
7858
- if (e.family === 'tein-labs' && e.kind === 'image') return Ia();
7859
- if (me.some((i) => i.slug === t)) return va(e);
7860
- if (e.kind === 'llm') return _a(e);
7861
- if (e.family === 'omnihuman') return Ta(e);
7862
- if (e.editVariants?.length) return ga(e);
7863
- let r = je(t);
7864
- if (r) return lr(r);
7865
- if (Mr(t)) return ma(tt);
8023
+ if (e.family === 'tein-labs' && e.kind === 'image') return Ka();
8024
+ if (me.some((r) => r.slug === t)) return Sa(e);
8025
+ if (e.kind === 'llm') return Ta(e);
8026
+ if (e.family === 'omnihuman') return Ea(e);
8027
+ if (e.editVariants?.length) return wa(e);
8028
+ let i = je(t);
8029
+ if (i) return di(i);
8030
+ if (t === 'seedance-2-5-vip') return ya(e);
8031
+ if (Ki(t)) return ha(tt);
7866
8032
  switch (t) {
7867
8033
  case 'seedance-2-5':
7868
8034
  return Qe(tt, t);
7869
8035
  case 'seedance-2-5-lite':
7870
- return kr(tt, { no4k: !0 });
8036
+ return Pi(tt, { no4k: !0 });
7871
8037
  case 'seedance-2':
7872
- return Qe(_r, t);
8038
+ return Qe(vi, t);
7873
8039
  case 'seedance-2-lite':
7874
- return kr(_r);
8040
+ return Pi(vi);
7875
8041
  case 'seedance-2-mini':
7876
- return Qe(Sa, t);
8042
+ return Qe(Ca, t);
7877
8043
  case 'nano-banana-2':
7878
8044
  case 'nano-banana-2.1':
7879
8045
  case 'nano-banana-pro':
7880
- return ha(e);
8046
+ return xa(e);
7881
8047
  case 'seedream-5-pro':
7882
8048
  return [
7883
8049
  S('Detailed description of the image to generate.'),
@@ -8155,7 +8321,7 @@ function Ma(e) {
8155
8321
  max: 0.4,
8156
8322
  description: 'Portrait depth. Heavy only.',
8157
8323
  },
8158
- ...Pa,
8324
+ ...Ma,
8159
8325
  ];
8160
8326
  case 'enhancor-skin-fix-v3':
8161
8327
  return [
@@ -8234,13 +8400,13 @@ function Ma(e) {
8234
8400
  name: 'image_url',
8235
8401
  type: 'string',
8236
8402
  required: !0,
8237
- description: `The character to animate: one jpg or png, at least 300 px a side, aspect 1:2.5 to 2.5:1, with the head and upper or full body clearly visible. ${xr}`,
8403
+ description: `The character to animate: one jpg or png, at least 300 px a side, aspect 1:2.5 to 2.5:1, with the head and upper or full body clearly visible. ${_i}`,
8238
8404
  },
8239
8405
  {
8240
8406
  name: 'video_url',
8241
8407
  type: 'string',
8242
8408
  required: !0,
8243
- description: `The motion to copy: one mp4 or mov of a single person in one continuous take, 3 to 30 s (up to 10 s when character_orientation is image). Billed per second of this video, rounded up. ${xr}`,
8409
+ description: `The motion to copy: one mp4 or mov of a single person in one continuous take, 3 to 30 s (up to 10 s when character_orientation is image). Billed per second of this video, rounded up. ${_i}`,
8244
8410
  },
8245
8411
  {
8246
8412
  name: 'prompt',
@@ -8418,7 +8584,7 @@ function Ma(e) {
8418
8584
  },
8419
8585
  ];
8420
8586
  case 'minimax-h3':
8421
- return fa(
8587
+ return ba(
8422
8588
  Ze(e, {
8423
8589
  modes: ['text_to_video', 'first_n_last_frames', 'multi_reference'],
8424
8590
  aspects: ['16:9', '21:9', '4:3', '1:1', '3:4', '9:16', 'adaptive'],
@@ -8437,15 +8603,15 @@ function Ma(e) {
8437
8603
  return [S('Prompt text.')];
8438
8604
  }
8439
8605
  }
8440
- function Er() {
8441
- let e = (t, r) => ({
8606
+ function Ci() {
8607
+ let e = (t, i) => ({
8442
8608
  name: t,
8443
8609
  type: 'slider',
8444
8610
  default: 50,
8445
8611
  min: 0,
8446
8612
  max: 100,
8447
8613
  step: 1,
8448
- description: `${r} 0 to 100. 50 is the default look.`,
8614
+ description: `${i} 0 to 100. 50 is the default look.`,
8449
8615
  });
8450
8616
  return [
8451
8617
  e(
@@ -8458,7 +8624,7 @@ function Er() {
8458
8624
  ),
8459
8625
  ];
8460
8626
  }
8461
- function $r(e) {
8627
+ function Ai(e) {
8462
8628
  return {
8463
8629
  name: 'image',
8464
8630
  type: 'string',
@@ -8466,10 +8632,10 @@ function $r(e) {
8466
8632
  description: `The photo to ${e}: one JPEG, PNG or WebP URL, up to 24 MB and 16.7 MP, with a shorter side of at least 256 px. HEIC/HEIF isn't supported.`,
8467
8633
  };
8468
8634
  }
8469
- function Ka() {
8635
+ function Aa() {
8470
8636
  return {
8471
8637
  slug: we,
8472
- name: dr,
8638
+ name: ui,
8473
8639
  category: 'Image',
8474
8640
  kind: 'Image-to-Image',
8475
8641
  vendor: 'Enhancor',
@@ -8479,12 +8645,12 @@ function Ka() {
8479
8645
  unit: '/img',
8480
8646
  primaryToolName: at.image,
8481
8647
  parameters: [
8482
- $r('upscale'),
8648
+ Ai('upscale'),
8483
8649
  {
8484
8650
  name: 'preset',
8485
8651
  type: 'select',
8486
8652
  options: [...Je],
8487
- description: `Skin preset, run before the upscale: ${Je.map((e) => `${e} (${gr[e]})`).join(', ')}. Seedream 5.5 redraws the skin at about the photo's own size and shape, keeping the person, the background and any text; that picture is brought back to the photo's size and upscaled, so the output is still the photo times the scale. Priced at the skin rate. Leave it out for a plain upscale.`,
8653
+ description: `Skin preset, run before the upscale: ${Je.map((e) => `${e} (${yi[e]})`).join(', ')}. Seedream 5.5 redraws the skin at about the photo's own size and shape, keeping the person, the background and any text; that picture is brought back to the photo's size and upscaled, so the output is still the photo times the scale. Priced at the skin rate. Leave it out for a plain upscale.`,
8488
8654
  },
8489
8655
  {
8490
8656
  name: 'skin_fix',
@@ -8492,16 +8658,16 @@ function Ka() {
8492
8658
  default: !1,
8493
8659
  description: 'Same as preset natural. Off by default.',
8494
8660
  },
8495
- Cr,
8496
- Ar,
8497
- ...Er(),
8661
+ Ri,
8662
+ Oi,
8663
+ ...Ci(),
8498
8664
  ],
8499
8665
  };
8500
8666
  }
8501
- function Ea() {
8667
+ function Ra() {
8502
8668
  return {
8503
8669
  slug: xe,
8504
- name: cr,
8670
+ name: mi,
8505
8671
  category: 'Image',
8506
8672
  kind: 'Image-to-Image',
8507
8673
  vendor: 'Enhancor',
@@ -8510,59 +8676,59 @@ function Ea() {
8510
8676
  priceFormatted: '',
8511
8677
  unit: '/img',
8512
8678
  primaryToolName: at.image,
8513
- parameters: [$r('deblur'), Cr, Ar, ...Er()],
8679
+ parameters: [Ai('deblur'), Ri, Oi, ...Ci()],
8514
8680
  };
8515
8681
  }
8516
- function rt(e, t = e.api.model) {
8517
- let r = Bt(e.slug);
8682
+ function it(e, t = e.api.model) {
8683
+ let i = Gt(e.slug);
8518
8684
  return {
8519
8685
  slug: t,
8520
8686
  name: e.name,
8521
- category: na[e.kind],
8522
- kind: t.startsWith('enhancor-skin-fix-') ? 'Image-to-Image' : sa[e.kind],
8687
+ category: la[e.kind],
8688
+ kind: t.startsWith('enhancor-skin-fix-') ? 'Image-to-Image' : pa[e.kind],
8523
8689
  vendor: e.vendor ?? '',
8524
8690
  description: e.desc ?? e.name,
8525
- priceFormatted: it(e),
8526
- ...(r.length ? { priceNotes: r } : {}),
8691
+ priceFormatted: rt(e),
8692
+ ...(i.length ? { priceNotes: i } : {}),
8527
8693
  unit: e.unit,
8528
8694
  primaryToolName: at[e.kind],
8529
- parameters: pa(e, Ma(e)),
8695
+ parameters: ua(e, $a(e)),
8530
8696
  };
8531
8697
  }
8532
- function $a() {
8698
+ function Oa() {
8533
8699
  let e = {};
8534
8700
  for (let t of ge())
8535
8701
  if (t.slug !== 'seedance-2-fast') {
8536
8702
  if (t.slug === 'seedance-2-mini') {
8537
- e['seedance-2-mini'] = rt(t, 'seedance-2-mini');
8703
+ e['seedance-2-mini'] = it(t, 'seedance-2-mini');
8538
8704
  continue;
8539
8705
  }
8540
8706
  if (t.slug === 'seedance-2') {
8541
- let r = rt(t);
8542
- ((r.description = `${t.desc ?? t.name} Send quality fast or mini for Seedance 2.0 Fast or Mini.`),
8543
- (r.priceFormatted = Ca(t)),
8544
- (e['seedance-2'] = r));
8707
+ let i = it(t);
8708
+ ((i.description = `${t.desc ?? t.name} Send quality fast or mini for Seedance 2.0 Fast or Mini.`),
8709
+ (i.priceFormatted = qa(t)),
8710
+ (e['seedance-2'] = i));
8545
8711
  continue;
8546
8712
  }
8547
- t.slug.startsWith('claude-') || (e[t.api.model] = rt(t));
8713
+ t.slug.startsWith('claude-') || (e[t.api.model] = it(t));
8548
8714
  }
8549
- (Object.assign(e, rr()), (e[we] = Ka()), (e[xe] = Ea()));
8550
- for (let [t, r] of Object.entries(be))
8551
- e[r] && Object.defineProperty(e, t, { value: e[r], enumerable: !1 });
8715
+ (Object.assign(e, ai()), (e[we] = Aa()), (e[xe] = Ra()));
8716
+ for (let [t, i] of Object.entries(be))
8717
+ e[i] && Object.defineProperty(e, t, { value: e[i], enumerable: !1 });
8552
8718
  return e;
8553
8719
  }
8554
- function Ca(e = F('seedance-2')) {
8720
+ function qa(e = F('seedance-2')) {
8555
8721
  let t = F('seedance-2-fast'),
8556
- r = e ? it(e) : '';
8557
- if (!t) return r;
8558
- let i = `Fast ${it(t)}`;
8559
- return r ? `${r} \xB7 ${i}` : i;
8722
+ i = e ? rt(e) : '';
8723
+ if (!t) return i;
8724
+ let r = `Fast ${rt(t)}`;
8725
+ return i ? `${i} \xB7 ${r}` : r;
8560
8726
  }
8561
- function Rr(e) {
8727
+ function qi(e) {
8562
8728
  if (!(!e || typeof e != 'object' || Array.isArray(e)))
8563
- for (let [t, r] of Object.entries(e)) {
8564
- let i = Object.prototype.hasOwnProperty.call(Y, t) ? Y[t] : null;
8565
- i && typeof r == 'string' && r.trim() && (i.priceFormatted = r.trim());
8729
+ for (let [t, i] of Object.entries(e)) {
8730
+ let r = Object.prototype.hasOwnProperty.call(Y, t) ? Y[t] : null;
8731
+ r && typeof i == 'string' && i.trim() && (r.priceFormatted = i.trim());
8566
8732
  }
8567
8733
  }
8568
8734
  function ve(e) {
@@ -8570,125 +8736,124 @@ function ve(e) {
8570
8736
  }
8571
8737
  function j(e) {
8572
8738
  let t = Y[e];
8573
- return t ? Or(t) : null;
8739
+ return t ? Li(t) : null;
8574
8740
  }
8575
- function Or(e) {
8576
- return !br(e.slug) || e.parameters.some((t) => t.name === 'priority')
8741
+ function Li(e) {
8742
+ return !xi(e.slug) || e.parameters.some((t) => t.name === 'priority')
8577
8743
  ? e
8578
- : { ...e, parameters: [...e.parameters, Aa] };
8744
+ : { ...e, parameters: [...e.parameters, La] };
8579
8745
  }
8580
- function Ra(e, t, r) {
8746
+ function Da(e, t, i) {
8581
8747
  if (
8582
8748
  e.startsWith('enhancor-skin-fix-') ||
8583
- ur(e) ||
8584
- (e === 'gemini-omni-1.2-flash' && (t === 'aspect_ratio' || t === 'duration')) ||
8585
- (e === 'magi-2' &&
8586
- t === 'aspect_ratio' &&
8587
- (typeof r.mode == 'string' ? r.mode.trim().toLowerCase() : '').replace(/-/g, '_') ===
8588
- 'image_to_video')
8749
+ fi(e) ||
8750
+ (e === 'gemini-omni-1.2-flash' && (t === 'aspect_ratio' || t === 'duration'))
8589
8751
  )
8590
8752
  return !1;
8591
- if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite' || Mr(e)) && t === 'duration') {
8592
- let i = (n) => (typeof n == 'string' ? n.trim().toLowerCase() : '');
8593
- if (i(r.mode) === 'edit' || i(r.omni_reference_task_type) === 'edit') return !1;
8753
+ let r = typeof i.mode == 'string' ? i.mode.trim().toLowerCase() : '',
8754
+ n = t === 'aspect_ratio' && r.replace(/-/g, '_') === 'image_to_video';
8755
+ if ((n && e === 'magi-2') || (n && e === 'seedance-2-5-vip')) return !1;
8756
+ if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite' || Ki(e)) && t === 'duration') {
8757
+ let s = (o) => (typeof o == 'string' ? o.trim().toLowerCase() : '');
8758
+ if (s(i.mode) === 'edit' || s(i.omni_reference_task_type) === 'edit') return !1;
8594
8759
  }
8595
8760
  if (
8596
- (t === 'max_tokens' && Pr(r.max_completion_tokens)) ||
8597
- (t === 'max_completion_tokens' && Pr(r.max_tokens))
8761
+ (t === 'max_tokens' && Ii(i.max_completion_tokens)) ||
8762
+ (t === 'max_completion_tokens' && Ii(i.max_tokens))
8598
8763
  )
8599
8764
  return !1;
8600
8765
  if (t === 'aspect_ratio') {
8601
- let i = je(e);
8602
- if (i) {
8603
- let n = typeof r.mode == 'string' ? r.mode.trim().toLowerCase() : '',
8604
- s = n ? n.replace(/-/g, '_') : i.modes[0];
8605
- if (i.modes.includes(s) && !or(i, s)) return !1;
8766
+ let s = je(e);
8767
+ if (s) {
8768
+ let o = typeof i.mode == 'string' ? i.mode.trim().toLowerCase() : '',
8769
+ p = o ? o.replace(/-/g, '_') : s.modes[0];
8770
+ if (s.modes.includes(p) && !pi(s, p)) return !1;
8606
8771
  }
8607
8772
  }
8608
8773
  return !0;
8609
8774
  }
8610
- function Pr(e) {
8775
+ function Ii(e) {
8611
8776
  return e != null && e !== '';
8612
8777
  }
8613
- function qr(e, t) {
8614
- let r = { ...t };
8778
+ function Di(e, t) {
8779
+ let i = { ...t };
8615
8780
  if (e?.slug === 'seedance-2-5') {
8616
- let i = (n) => typeof n != 'string' || !n.trim();
8617
- for (let n of Oa) (i(r.finalize) && !i(r[n]) && (r.finalize = r[n]), delete r[n]);
8618
- if (!i(r.finalize)) return r;
8781
+ let r = (n) => typeof n != 'string' || !n.trim();
8782
+ for (let n of Na) (r(i.finalize) && !r(i[n]) && (i.finalize = i[n]), delete i[n]);
8783
+ if (!r(i.finalize)) return i;
8619
8784
  }
8620
- for (let i of e?.parameters ?? [])
8621
- i.default !== void 0 &&
8622
- r[i.name] === void 0 &&
8623
- Ra(e.slug, i.name, t) &&
8624
- (r[i.name] = i.default);
8625
- return r;
8785
+ for (let r of e?.parameters ?? [])
8786
+ r.default !== void 0 &&
8787
+ i[r.name] === void 0 &&
8788
+ Da(e.slug, r.name, t) &&
8789
+ (i[r.name] = r.default);
8790
+ return i;
8626
8791
  }
8627
8792
  function D() {
8628
- return Object.values(Y).map(Or);
8793
+ return Object.values(Y).map(Li);
8629
8794
  }
8630
- var na,
8795
+ var la,
8631
8796
  at,
8632
- sa,
8633
- xr,
8797
+ pa,
8798
+ _i,
8634
8799
  S,
8635
8800
  nt,
8636
- la,
8637
- Tr,
8801
+ ca,
8802
+ Si,
8638
8803
  st,
8639
8804
  ot,
8640
8805
  Pe,
8641
- da,
8642
- ca,
8643
- ua,
8644
- ya,
8645
- ba,
8646
- wa,
8806
+ ma,
8807
+ fa,
8808
+ ga,
8809
+ ka,
8810
+ _a,
8647
8811
  Pa,
8648
- re,
8812
+ Ma,
8813
+ ie,
8649
8814
  tt,
8650
- Sr,
8651
- Kr,
8652
- _r,
8653
- Sa,
8654
- Cr,
8655
- Ar,
8815
+ Ei,
8816
+ $i,
8817
+ vi,
8818
+ Ca,
8819
+ Ri,
8820
+ Oi,
8656
8821
  Y,
8657
- Aa,
8658
- Oa,
8659
- ie = y(() => {
8822
+ La,
8823
+ Na,
8824
+ re = y(() => {
8660
8825
  'use strict';
8661
8826
  Kt();
8662
8827
  Ae();
8663
8828
  B();
8664
- Ue();
8665
- jt();
8829
+ Ve();
8830
+ Ht();
8666
8831
  Re();
8667
8832
  Fe();
8668
- zt();
8669
8833
  Jt();
8670
8834
  Xt();
8671
- ir();
8835
+ Zt();
8836
+ ni();
8672
8837
  ze();
8673
- pr();
8674
- fr();
8675
- hr();
8838
+ ci();
8839
+ hi();
8840
+ bi();
8676
8841
  Ye();
8677
8842
  Xe();
8678
- ((na = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
8843
+ ((la = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
8679
8844
  (at = {
8680
8845
  video: 'generate_video',
8681
8846
  image: 'generate_image',
8682
8847
  audio: 'generate_audio',
8683
8848
  llm: 'run_task',
8684
8849
  }),
8685
- (sa = {
8850
+ (pa = {
8686
8851
  video: 'Text-to-Video',
8687
8852
  image: 'Text-to-Image',
8688
8853
  audio: 'Text-to-Audio',
8689
8854
  llm: 'Reasoning (LLM)',
8690
8855
  }));
8691
- ((xr =
8856
+ ((_i =
8692
8857
  'A public http(s) URL or data URI. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.'),
8693
8858
  (S = (e) => ({ name: 'prompt', type: 'string', required: !0, description: e })));
8694
8859
  ((nt = {
@@ -8698,13 +8863,13 @@ var na,
8698
8863
  description:
8699
8864
  'Runs the Creative mode checkpoint at its published price (+5%). The Acceptable Use Policy applies.',
8700
8865
  }),
8701
- (la = {
8866
+ (ca = {
8702
8867
  name: 'creative_mode',
8703
8868
  type: 'boolean',
8704
8869
  default: !1,
8705
8870
  description: `Not available yet on this model: ${ke}.`,
8706
8871
  }),
8707
- (Tr = {
8872
+ (Si = {
8708
8873
  name: 'priority',
8709
8874
  type: 'boolean',
8710
8875
  default: !1,
@@ -8722,7 +8887,7 @@ var na,
8722
8887
  '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.',
8723
8888
  }),
8724
8889
  (Pe = new Set(['full_access', 'is_uncensored', 'unfiltered', 'verificationSignature'])));
8725
- ((da = new Set([
8890
+ ((ma = new Set([
8726
8891
  'quality',
8727
8892
  'bitrate_mode',
8728
8893
  'draft',
@@ -8731,7 +8896,7 @@ var na,
8731
8896
  'draft_generation_id',
8732
8897
  'pass_faces',
8733
8898
  ])),
8734
- (ca = new Set([
8899
+ (fa = new Set([
8735
8900
  'quality',
8736
8901
  'bitrate_mode',
8737
8902
  'draft',
@@ -8739,12 +8904,12 @@ var na,
8739
8904
  'draft_task_id',
8740
8905
  'draft_generation_id',
8741
8906
  ])),
8742
- (ua = {
8907
+ (ga = {
8743
8908
  images: 'up to 10',
8744
8909
  videos: 'up to 5; combined duration < 30s',
8745
8910
  audios: 'up to 5; combined duration < 30s',
8746
8911
  }));
8747
- ((ya = [
8912
+ ((ka = [
8748
8913
  S('The user message or task.'),
8749
8914
  { name: 'system', type: 'string', description: 'Optional system instructions.' },
8750
8915
  {
@@ -8762,7 +8927,7 @@ var na,
8762
8927
  { name: 'temperature', type: 'slider', min: 0, max: 1, step: 0.1 },
8763
8928
  { name: 'top_p', type: 'slider', min: 0, max: 1, step: 0.05 },
8764
8929
  ]),
8765
- (ba = [
8930
+ (_a = [
8766
8931
  S('The user message or task.'),
8767
8932
  { name: 'system', type: 'string', description: 'Optional system instructions.' },
8768
8933
  {
@@ -8844,8 +9009,8 @@ var na,
8844
9009
  description: 'Video frames read a second.',
8845
9010
  },
8846
9011
  ]),
8847
- (wa = ['gemini-3.8-flash', 'gemini-3.7-flash']));
8848
- Pa = Object.entries({
9012
+ (Pa = ['gemini-3.8-flash', 'gemini-3.7-flash']));
9013
+ Ma = Object.entries({
8849
9014
  background: !1,
8850
9015
  skin: !1,
8851
9016
  nose: !1,
@@ -8871,7 +9036,7 @@ var na,
8871
9036
  default: t,
8872
9037
  description: 'Keep this part out of the fix. Standard only.',
8873
9038
  }));
8874
- ((re = 'Left out: 480p, the same default as the API, the playground and workflow steps.'),
9039
+ ((ie = 'Left out: 480p, the same default as the API, the playground and workflow steps.'),
8875
9040
  (tt = [
8876
9041
  {
8877
9042
  name: 'prompt',
@@ -8910,7 +9075,7 @@ var na,
8910
9075
  type: 'select',
8911
9076
  default: '480p',
8912
9077
  options: ['480p', '720p', '1080p', '4k'],
8913
- 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. ${re}`,
9078
+ 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. ${ie}`,
8914
9079
  },
8915
9080
  {
8916
9081
  name: 'aspect_ratio',
@@ -9021,19 +9186,19 @@ var na,
9021
9186
  'Keeps real faces in reference images. On by default. Send false to turn it off.',
9022
9187
  },
9023
9188
  ]),
9024
- (Sr = {
9189
+ (Ei = {
9025
9190
  name: 'images',
9026
9191
  type: 'string[]',
9027
9192
  description:
9028
9193
  '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.',
9029
9194
  }),
9030
- (Kr = {
9195
+ ($i = {
9031
9196
  name: 'audios',
9032
9197
  type: 'string[]',
9033
9198
  description:
9034
9199
  '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.',
9035
9200
  }),
9036
- (_r = [
9201
+ (vi = [
9037
9202
  {
9038
9203
  name: 'prompt',
9039
9204
  type: 'string',
@@ -9077,7 +9242,7 @@ var na,
9077
9242
  type: 'select',
9078
9243
  default: '480p',
9079
9244
  options: ['480p', '720p', '1080p', '4k'],
9080
- description: `Standard: 480p, 720p, 1080p (8-bit) and 4k (10-bit H.265). Fast and Mini: 480p and 720p only. ${re}`,
9245
+ description: `Standard: 480p, 720p, 1080p (8-bit) and 4k (10-bit H.265). Fast and Mini: 480p and 720p only. ${ie}`,
9081
9246
  },
9082
9247
  {
9083
9248
  name: 'bitrate_mode',
@@ -9111,8 +9276,8 @@ var na,
9111
9276
  description:
9112
9277
  'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
9113
9278
  },
9114
- Sr,
9115
- Kr,
9279
+ Ei,
9280
+ $i,
9116
9281
  {
9117
9282
  name: 'first_frame_image',
9118
9283
  type: 'string',
@@ -9133,7 +9298,7 @@ var na,
9133
9298
  'Keeps real faces in reference images. On by default. Send false to turn it off.',
9134
9299
  },
9135
9300
  ]),
9136
- (Sa = [
9301
+ (Ca = [
9137
9302
  {
9138
9303
  name: 'prompt',
9139
9304
  type: 'string',
@@ -9154,7 +9319,7 @@ var na,
9154
9319
  type: 'select',
9155
9320
  default: '480p',
9156
9321
  options: ['480p', '720p'],
9157
- description: `480p and 720p, both 8-bit. Mini does not serve 1080p or 4k. ${re}`,
9322
+ description: `480p and 720p, both 8-bit. Mini does not serve 1080p or 4k. ${ie}`,
9158
9323
  },
9159
9324
  {
9160
9325
  name: 'bitrate_mode',
@@ -9188,8 +9353,8 @@ var na,
9188
9353
  description:
9189
9354
  'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
9190
9355
  },
9191
- Sr,
9192
- Kr,
9356
+ Ei,
9357
+ $i,
9193
9358
  {
9194
9359
  name: 'first_frame_image',
9195
9360
  type: 'string',
@@ -9204,7 +9369,7 @@ var na,
9204
9369
  'Keeps real faces in reference images. On by default. Send false to turn it off.',
9205
9370
  },
9206
9371
  ]));
9207
- ((Cr = {
9372
+ ((Ri = {
9208
9373
  name: 'mode',
9209
9374
  type: 'select',
9210
9375
  default: 'full',
@@ -9212,27 +9377,27 @@ var na,
9212
9377
  description:
9213
9378
  'Full: the photo times the scale. Fast: long side 2432 px. Both are priced per output megapixel, no minimum: the first 10 MP at one rate, every MP past 10 at a lower one (get_pricing).',
9214
9379
  }),
9215
- (Ar = {
9380
+ (Oi = {
9216
9381
  name: 'scale',
9217
9382
  type: 'select',
9218
- default: String(mr),
9383
+ default: String(gi),
9219
9384
  options: We.noSkin.map(String),
9220
9385
  description: `Full only: ${We.noSkin.join(', ')}. The output is the photo times the scale (a 500 x 500 photo at 4 is 2000 x 2000), at most 48 megapixels: a scale past that is refused with the scales that fit.`,
9221
9386
  }));
9222
- Y = $a();
9223
- Aa = {
9387
+ Y = Oa();
9388
+ La = {
9224
9389
  name: 'priority',
9225
9390
  type: 'boolean',
9226
9391
  default: !1,
9227
9392
  description:
9228
9393
  "Sent straight to Google's own API, skipping the shared queue, at Google's price + 10% (per output image and per input image, the same on every plan). If Google can not serve it, the request fails and nothing is charged.",
9229
9394
  };
9230
- Oa = ['draft_task_id', 'draft_generation_id'];
9395
+ Na = ['draft_task_id', 'draft_generation_id'];
9231
9396
  });
9232
9397
  function Ie(e) {
9233
9398
  let t = '/v1/pricing/models',
9234
- r = e?.trim();
9235
- return r ? `${t}?model=${encodeURIComponent(r)}` : t;
9399
+ i = e?.trim();
9400
+ return i ? `${t}?model=${encodeURIComponent(i)}` : t;
9236
9401
  }
9237
9402
  var ct = y(() => {
9238
9403
  'use strict';
@@ -9240,39 +9405,39 @@ var ct = y(() => {
9240
9405
  function ht(e) {
9241
9406
  return e.length <= 1 ? (e[0] ?? '') : `${e.slice(0, -1).join(', ')} and ${e[e.length - 1]}`;
9242
9407
  }
9243
- function ii(e) {
9408
+ function nr(e) {
9244
9409
  let t = ge().filter((s) => s.kind === e && s.unfiltered != null),
9245
- r = t.filter((s) => ee.includes(s.api.model)).map((s) => s.name),
9246
- i = t.filter((s) => !ee.includes(s.api.model)).map((s) => s.name);
9410
+ i = t.filter((s) => ee.includes(s.api.model)).map((s) => s.name),
9411
+ r = t.filter((s) => !ee.includes(s.api.model)).map((s) => s.name);
9247
9412
  return [
9248
- ...(r.length
9249
- ? [`${ht(r)}: runs the Creative mode checkpoint at its published price (+5%).`]
9413
+ ...(i.length
9414
+ ? [`${ht(i)}: runs the Creative mode checkpoint at its published price (+5%).`]
9250
9415
  : []),
9251
- ...(i.length ? [`Not available yet on ${ht(i)}: ${ke}.`] : []),
9416
+ ...(r.length ? [`Not available yet on ${ht(r)}: ${ke}.`] : []),
9252
9417
  'The Acceptable Use Policy applies.',
9253
9418
  ].join(' ');
9254
9419
  }
9255
- function fn(e) {
9256
- if (pn.has(e.name)) return e;
9420
+ function bn(e) {
9421
+ if (mn.has(e.name)) return e;
9257
9422
  let t = e.inputSchema.properties;
9258
9423
  return !t || t.callback_url
9259
9424
  ? e
9260
- : { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url: ln } } };
9425
+ : { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url: un } } };
9261
9426
  }
9262
- function gn(e) {
9427
+ function wn(e) {
9263
9428
  let t = e.inputSchema.properties;
9264
9429
  if (!t) return e;
9265
- let r = !1,
9266
- i = {};
9430
+ let i = !1,
9431
+ r = {};
9267
9432
  for (let [n, s] of Object.entries(t))
9268
- ai.has(n) && s.type === 'string' && !s.format
9269
- ? ((i[n] = { ...s, format: 'uri' }), (r = !0))
9270
- : ai.has(n) && s.type === 'array' && s.items?.type === 'string' && !s.items.format
9271
- ? ((i[n] = { ...s, items: { ...s.items, format: 'uri' } }), (r = !0))
9272
- : (i[n] = s);
9273
- return r ? { ...e, inputSchema: { ...e.inputSchema, properties: i } } : e;
9274
- }
9275
- function hn(e) {
9433
+ sr.has(n) && s.type === 'string' && !s.format
9434
+ ? ((r[n] = { ...s, format: 'uri' }), (i = !0))
9435
+ : sr.has(n) && s.type === 'array' && s.items?.type === 'string' && !s.items.format
9436
+ ? ((r[n] = { ...s, items: { ...s.items, format: 'uri' } }), (i = !0))
9437
+ : (r[n] = s);
9438
+ return i ? { ...e, inputSchema: { ...e.inputSchema, properties: r } } : e;
9439
+ }
9440
+ function xn(e) {
9276
9441
  switch (e.type) {
9277
9442
  case 'string':
9278
9443
  return {
@@ -9327,28 +9492,28 @@ function hn(e) {
9327
9492
  return { type: 'string', description: e.description };
9328
9493
  }
9329
9494
  }
9330
- function yn(e, t) {
9331
- let r = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
9332
- i = {},
9495
+ function kn(e, t) {
9496
+ let i = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
9497
+ r = {},
9333
9498
  n = [];
9334
- for (let o of e.parameters) ((i[o.name] = hn(o)), o.required && n.push(o.name));
9499
+ for (let o of e.parameters) ((r[o.name] = xn(o)), o.required && n.push(o.name));
9335
9500
  let s = {
9336
9501
  type: 'object',
9337
- properties: i,
9502
+ properties: r,
9338
9503
  ...(n.length > 0 ? { required: n } : {}),
9339
9504
  additionalProperties: !0,
9340
9505
  };
9341
9506
  return {
9342
- name: r,
9507
+ name: i,
9343
9508
  description: `[Tein AI - ${e.name} (${e.category})] ${e.description} (Pricing: ${e.priceFormatted}${e.priceNotes?.length ? `. ${e.priceNotes.join(' ')}` : ''})`,
9344
9509
  inputSchema: s,
9345
9510
  };
9346
9511
  }
9347
- function bn() {
9512
+ function _n() {
9348
9513
  let e = D().filter((u) => u.category === 'Image' && !ve(u)),
9349
9514
  t = D().filter((u) => u.category === 'Video'),
9350
- r = D().filter((u) => u.category === 'Text'),
9351
- i = D().filter((u) => u.category === 'Audio'),
9515
+ i = D().filter((u) => u.category === 'Text'),
9516
+ r = D().filter((u) => u.category === 'Audio'),
9352
9517
  n = {
9353
9518
  name: 'generate_image',
9354
9519
  description:
@@ -9435,12 +9600,12 @@ function bn() {
9435
9600
  maximum: 2147483647,
9436
9601
  description: 'Nano Banana 2 and Nano Banana Pro. Omit it for a new image each time.',
9437
9602
  },
9438
- creative_mode: { type: 'boolean', description: ii('image') },
9603
+ creative_mode: { type: 'boolean', description: nr('image') },
9439
9604
  ...(_e().length
9440
9605
  ? {
9441
9606
  priority: {
9442
9607
  type: 'boolean',
9443
- description: `${ht(_e().map(wr))} only: sent straight to Google's own API, skipping the shared queue, at Google's price + 10% (per output image and per input image, the same on every plan). If Google can not serve it, the request fails and nothing is charged.`,
9608
+ description: `${ht(_e().map(ki))} only: sent straight to Google's own API, skipping the shared queue, at Google's price + 10% (per output image and per input image, the same on every plan). If Google can not serve it, the request fails and nothing is charged.`,
9444
9609
  },
9445
9610
  }
9446
9611
  : {}),
@@ -9480,7 +9645,7 @@ function bn() {
9480
9645
  description:
9481
9646
  "Video resolution, where the model takes it (see each model tool). Left out: the model's own default, which that model's tool shows.",
9482
9647
  },
9483
- creative_mode: { type: 'boolean', description: ii('video') },
9648
+ creative_mode: { type: 'boolean', description: nr('video') },
9484
9649
  priority: {
9485
9650
  type: 'boolean',
9486
9651
  description:
@@ -9546,7 +9711,7 @@ function bn() {
9546
9711
  prompt: { type: 'string', description: 'The reasoning task or query to execute.' },
9547
9712
  model: {
9548
9713
  type: 'string',
9549
- enum: r.map((u) => u.slug),
9714
+ enum: i.map((u) => u.slug),
9550
9715
  default: 'gpt-6-astra',
9551
9716
  description: 'The reasoning model to use (default: gpt-6-astra).',
9552
9717
  },
@@ -9616,10 +9781,10 @@ function bn() {
9616
9781
  additionalProperties: !0,
9617
9782
  },
9618
9783
  },
9619
- d = wn();
9620
- return [n, s, o, p, l, d, c, dn, ...ni];
9784
+ d = Pn();
9785
+ return [n, s, o, p, l, d, c, fn, ...or];
9621
9786
  }
9622
- function wn() {
9787
+ function Pn() {
9623
9788
  return {
9624
9789
  name: 'upload_asset',
9625
9790
  description:
@@ -9667,31 +9832,31 @@ function wn() {
9667
9832
  };
9668
9833
  }
9669
9834
  function yt() {
9670
- let e = bn(),
9671
- t = D().map((r) => yn(r));
9672
- return [...e, ...t].map(fn).map(gn);
9673
- }
9674
- var ln,
9675
- pn,
9676
- dn,
9677
- cn,
9678
- un,
9835
+ let e = _n(),
9836
+ t = D().map((i) => kn(i));
9837
+ return [...e, ...t].map(bn).map(wn);
9838
+ }
9839
+ var un,
9679
9840
  mn,
9680
- ni,
9681
- $o,
9682
- ai,
9683
- si = y(() => {
9841
+ fn,
9842
+ gn,
9843
+ hn,
9844
+ yn,
9845
+ or,
9846
+ Oo,
9847
+ sr,
9848
+ lr = y(() => {
9684
9849
  'use strict';
9685
9850
  B();
9686
9851
  Xe();
9687
9852
  Ye();
9688
- ie();
9689
- ((ln = {
9853
+ re();
9854
+ ((un = {
9690
9855
  type: 'string',
9691
9856
  description:
9692
9857
  '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.',
9693
9858
  }),
9694
- (pn = new Set([
9859
+ (mn = new Set([
9695
9860
  'upload_asset',
9696
9861
  'upload_media',
9697
9862
  'upload_image',
@@ -9702,7 +9867,7 @@ var ln,
9702
9867
  'get_usage',
9703
9868
  'get_balance_history',
9704
9869
  ])),
9705
- (dn = {
9870
+ (fn = {
9706
9871
  name: 'get_pricing',
9707
9872
  description:
9708
9873
  '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. price_texts has the current "from" price of each model. No API key is required; with one, your_prices lists the prices your workspace pays (Your price) next to the published price of each row on its price list. Pass model to keep one catalog slug or API model id (for example seedance-2-5). The same payload as GET /v1/pricing/models.',
@@ -9717,13 +9882,13 @@ var ln,
9717
9882
  additionalProperties: !1,
9718
9883
  },
9719
9884
  }),
9720
- (cn = {
9885
+ (gn = {
9721
9886
  name: 'get_balance',
9722
9887
  description:
9723
9888
  "Your Tein workspace's balance right now, what this API key can still spend (the balance, or less when the key has its own spending limit), credits on hold, and the workspace's usage this month and in the last 30 days from every channel (website, API, MCP, CLI, workflows). Use it before a run to check the balance covers it, or to show the balance in an app. Nothing runs and nothing is charged. The same payload as GET /v1/balance.",
9724
9889
  inputSchema: { type: 'object', properties: {}, additionalProperties: !1 },
9725
9890
  }),
9726
- (un = {
9891
+ (hn = {
9727
9892
  name: 'get_usage',
9728
9893
  description:
9729
9894
  "Your Tein workspace's usage in detail, the same numbers as the dashboard's Usage page: total spend and requests (succeeded, failed, running), this API key's own share, and breakdowns by model, by channel (website, api, mcp, cli), by API key, and over time. Covers every run of the workspace, wherever it was started. Nothing runs and nothing is charged. The same payload as GET /v1/usage.",
@@ -9754,7 +9919,7 @@ var ln,
9754
9919
  additionalProperties: !1,
9755
9920
  },
9756
9921
  }),
9757
- (mn = {
9922
+ (yn = {
9758
9923
  name: 'get_balance_history',
9759
9924
  description:
9760
9925
  "Your Tein balance's history, newest first, the same list as the Billing page: top ups, each run's charge (with its job_id and model), refunds, credits from Tein and adjustments, each with the balance after it. Nothing runs and nothing is charged. The same payload as GET /v1/balance/transactions.",
@@ -9772,9 +9937,9 @@ var ln,
9772
9937
  additionalProperties: !1,
9773
9938
  },
9774
9939
  }),
9775
- (ni = [cn, un, mn]),
9776
- ($o = new Set(ni.map((e) => e.name))));
9777
- ai = new Set([
9940
+ (or = [gn, hn, yn]),
9941
+ (Oo = new Set(or.map((e) => e.name))));
9942
+ sr = new Set([
9778
9943
  'image',
9779
9944
  'images',
9780
9945
  'image_url',
@@ -9791,30 +9956,30 @@ var ln,
9791
9956
  'lipsyncing_audio',
9792
9957
  ]);
9793
9958
  });
9794
- var hi = {};
9795
- vi(hi, {
9796
- forgetToolSchemas: () => vn,
9797
- jsonRpcAnswer: () => di,
9798
- preprocessLocalFiles: () => fi,
9799
- startStdioServer: () => gi,
9959
+ var br = {};
9960
+ Tr(br, {
9961
+ forgetToolSchemas: () => Sn,
9962
+ jsonRpcAnswer: () => ur,
9963
+ preprocessLocalFiles: () => hr,
9964
+ startStdioServer: () => yr,
9800
9965
  });
9801
- function xn(e) {
9802
- let t = (r) =>
9803
- !!r && typeof r == 'object' && r.jsonrpc === '2.0' && ('result' in r || 'error' in r);
9966
+ function vn(e) {
9967
+ let t = (i) =>
9968
+ !!i && typeof i == 'object' && i.jsonrpc === '2.0' && ('result' in i || 'error' in i);
9804
9969
  return Array.isArray(e) ? e.length > 0 && e.every(t) : t(e);
9805
9970
  }
9806
- function di(e, t, r) {
9807
- let i = e?.id,
9808
- n = i == null,
9971
+ function ur(e, t, i) {
9972
+ let r = e?.id,
9973
+ n = r == null,
9809
9974
  s = null;
9810
9975
  try {
9811
- s = r ? JSON.parse(r) : null;
9976
+ s = i ? JSON.parse(i) : null;
9812
9977
  } catch {
9813
9978
  s = null;
9814
9979
  }
9815
- if (s !== null && xn(s)) return n ? null : s;
9980
+ if (s !== null && vn(s)) return n ? null : s;
9816
9981
  if (n) return null;
9817
- if (!r && t >= 200 && t < 300) return;
9982
+ if (!i && t >= 200 && t < 300) return;
9818
9983
  let o = s?.error,
9819
9984
  p =
9820
9985
  typeof o == 'string'
@@ -9825,7 +9990,7 @@ function di(e, t, r) {
9825
9990
  l = o && typeof o == 'object' && typeof o.code == 'string' ? o.code : null;
9826
9991
  return {
9827
9992
  jsonrpc: '2.0',
9828
- id: i,
9993
+ id: r,
9829
9994
  error: {
9830
9995
  code: t === 401 ? -32001 : -32603,
9831
9996
  message: p,
@@ -9833,19 +9998,19 @@ function di(e, t, r) {
9833
9998
  },
9834
9999
  };
9835
10000
  }
9836
- function kn() {
10001
+ function In() {
9837
10002
  let e = process.argv.slice(2),
9838
10003
  t = e.indexOf('--api-key');
9839
10004
  return _(t >= 0 ? e[t + 1] : void 0);
9840
10005
  }
9841
- async function ci(e, t, r) {
9842
- let i = Q.default.resolve(e);
9843
- if (!N.default.existsSync(i) || !N.default.statSync(i).isFile())
10006
+ async function mr(e, t, i) {
10007
+ let r = Q.default.resolve(e);
10008
+ if (!N.default.existsSync(r) || !N.default.statSync(r).isFile())
9844
10009
  throw new Error(`File not found: ${e}`);
9845
- let n = N.default.readFileSync(i),
10010
+ let n = N.default.readFileSync(r),
9846
10011
  s = n.toString('base64'),
9847
10012
  o = n.length,
9848
- p = `${r.replace(/\/$/, '')}/v1/upload`,
10013
+ p = `${i.replace(/\/$/, '')}/v1/upload`,
9849
10014
  l = await fetch(p, {
9850
10015
  method: 'POST',
9851
10016
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${t}` },
@@ -9867,15 +10032,15 @@ async function ci(e, t, r) {
9867
10032
  mimeType: c.mime_type || c.mimeType || 'image/png',
9868
10033
  };
9869
10034
  }
9870
- function ui(e) {
9871
- return _n.has(Q.default.extname(e).toLowerCase());
10035
+ function fr(e) {
10036
+ return Tn.has(Q.default.extname(e).toLowerCase());
9872
10037
  }
9873
- function mi(e) {
10038
+ function gr(e) {
9874
10039
  return new Error(
9875
10040
  `Tein uploads image, video and audio files only, and ${Q.default.basename(e)} is not one.`,
9876
10041
  );
9877
10042
  }
9878
- function Pn(e) {
10043
+ function Mn(e) {
9879
10044
  let t = e.trim();
9880
10045
  if (
9881
10046
  !t ||
@@ -9885,27 +10050,27 @@ function Pn(e) {
9885
10050
  `)
9886
10051
  )
9887
10052
  return null;
9888
- let r = Q.default.resolve(t);
9889
- return N.default.existsSync(r) && N.default.statSync(r).isFile() ? r : null;
10053
+ let i = Q.default.resolve(t);
10054
+ return N.default.existsSync(i) && N.default.statSync(i).isFile() ? i : null;
9890
10055
  }
9891
10056
  function wt(e) {
9892
10057
  if (Array.isArray(e))
9893
10058
  for (let t of e) {
9894
- let r = t;
9895
- typeof r.name == 'string' &&
9896
- r.inputSchema &&
9897
- typeof r.inputSchema == 'object' &&
9898
- se.set(r.name, r.inputSchema);
10059
+ let i = t;
10060
+ typeof i.name == 'string' &&
10061
+ i.inputSchema &&
10062
+ typeof i.inputSchema == 'object' &&
10063
+ se.set(i.name, i.inputSchema);
9899
10064
  }
9900
10065
  }
9901
- function vn() {
10066
+ function Sn() {
9902
10067
  (se.clear(), (bt = 0));
9903
10068
  }
9904
- async function In(e, t) {
10069
+ async function Kn(e, t) {
9905
10070
  if (!(Date.now() - bt < 6e4)) {
9906
10071
  bt = Date.now();
9907
10072
  try {
9908
- let i = await (
10073
+ let r = await (
9909
10074
  await fetch(e, {
9910
10075
  method: 'POST',
9911
10076
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${t}` },
@@ -9913,39 +10078,39 @@ async function In(e, t) {
9913
10078
  signal: AbortSignal.timeout(1e4),
9914
10079
  })
9915
10080
  ).json();
9916
- wt(i.result?.tools);
10081
+ wt(r.result?.tools);
9917
10082
  } catch {}
9918
10083
  }
9919
10084
  }
9920
- function Tn(e) {
10085
+ function En(e) {
9921
10086
  return e
9922
10087
  ? e.type === 'string'
9923
10088
  ? e.format === 'uri'
9924
10089
  : e.type === 'array' && e.items?.format === 'uri'
9925
10090
  : !1;
9926
10091
  }
9927
- async function oi(e, t, r) {
10092
+ async function pr(e, t, i) {
9928
10093
  if (typeof e != 'string') return e;
9929
- let i = Pn(e);
9930
- if (!i) return e;
9931
- if (!ui(i)) throw mi(i);
9932
- return (await ci(i, t, r)).url;
10094
+ let r = Mn(e);
10095
+ if (!r) return e;
10096
+ if (!fr(r)) throw gr(r);
10097
+ return (await mr(r, t, i)).url;
9933
10098
  }
9934
- async function fi(e, t, r, i, n) {
9935
- (se.size === 0 && wt(yt()), se.has(e) || (await In(n, r)));
10099
+ async function hr(e, t, i, r, n) {
10100
+ (se.size === 0 && wt(yt()), se.has(e) || (await Kn(n, i)));
9936
10101
  let s = se.get(e)?.properties;
9937
10102
  if (!s) return t;
9938
10103
  let o = { ...t };
9939
10104
  for (let [p, l] of Object.entries(t))
9940
- if (Tn(s[p]))
10105
+ if (En(s[p]))
9941
10106
  if (Array.isArray(l)) {
9942
10107
  let c = [];
9943
- for (let d of l) c.push(await oi(d, r, i));
10108
+ for (let d of l) c.push(await pr(d, i, r));
9944
10109
  o[p] = c;
9945
- } else o[p] = await oi(l, r, i);
10110
+ } else o[p] = await pr(l, i, r);
9946
10111
  return o;
9947
10112
  }
9948
- function Mn(e) {
10113
+ function $n(e) {
9949
10114
  let t = e.id ?? null;
9950
10115
  switch (e.method) {
9951
10116
  case 'initialize':
@@ -9986,13 +10151,13 @@ function Mn(e) {
9986
10151
  };
9987
10152
  }
9988
10153
  }
9989
- async function gi() {
9990
- if (li) return;
9991
- li = !0;
9992
- let e = kn(),
10154
+ async function yr() {
10155
+ if (dr) return;
10156
+ dr = !0;
10157
+ let e = In(),
9993
10158
  t = x(),
9994
- r = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
9995
- (pi.default
10159
+ i = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
10160
+ (cr.default
9996
10161
  .createInterface({ input: process.stdin, output: process.stdout, terminal: !1 })
9997
10162
  .on('line', async (n) => {
9998
10163
  let s = n.trim();
@@ -10056,8 +10221,8 @@ async function gi() {
10056
10221
  try {
10057
10222
  let u = Q.default.resolve(d.trim());
10058
10223
  if (N.default.existsSync(u) && N.default.statSync(u).isFile() && e) {
10059
- if (!ui(u)) throw mi(u);
10060
- let m = await ci(u, e, t),
10224
+ if (!fr(u)) throw gr(u);
10225
+ let m = await mr(u, e, t),
10061
10226
  g = (m.sizeBytes / 1024).toFixed(1),
10062
10227
  A =
10063
10228
  m.mimeType.startsWith('image/') ||
@@ -10066,7 +10231,7 @@ async function gi() {
10066
10231
 
10067
10232
  ![Uploaded Asset](${m.url})`
10068
10233
  : '',
10069
- U = {
10234
+ V = {
10070
10235
  jsonrpc: '2.0',
10071
10236
  id: o.id,
10072
10237
  result: {
@@ -10086,7 +10251,7 @@ Pass this URL to any Tein generation tool.`,
10086
10251
  },
10087
10252
  };
10088
10253
  process.stdout.write(
10089
- JSON.stringify(U) +
10254
+ JSON.stringify(V) +
10090
10255
  `
10091
10256
  `,
10092
10257
  );
@@ -10113,7 +10278,7 @@ Pass this URL to any Tein generation tool.`,
10113
10278
  }
10114
10279
  if (e)
10115
10280
  try {
10116
- o.params.arguments = await fi(String(l), c, e, t, r);
10281
+ o.params.arguments = await hr(String(l), c, e, t, i);
10117
10282
  } catch (d) {
10118
10283
  let u = d instanceof Error ? d.message : String(d);
10119
10284
  process.stdout.write(
@@ -10138,13 +10303,13 @@ Pass this URL to any Tein generation tool.`,
10138
10303
  }
10139
10304
  if (e)
10140
10305
  try {
10141
- let l = await fetch(r, {
10306
+ let l = await fetch(i, {
10142
10307
  method: 'POST',
10143
10308
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${e}` },
10144
10309
  body: JSON.stringify(o),
10145
10310
  }),
10146
10311
  c = await l.text(),
10147
- d = di(o, l.status, c);
10312
+ d = ur(o, l.status, c);
10148
10313
  if (d === null) return;
10149
10314
  if (d) {
10150
10315
  (o?.method === 'tools/list' && wt(d.result?.tools),
@@ -10156,7 +10321,7 @@ Pass this URL to any Tein generation tool.`,
10156
10321
  return;
10157
10322
  }
10158
10323
  } catch {}
10159
- let p = Mn(o);
10324
+ let p = $n(o);
10160
10325
  p !== null &&
10161
10326
  process.stdout.write(
10162
10327
  JSON.stringify(p) +
@@ -10181,21 +10346,21 @@ Pass this URL to any Tein generation tool.`,
10181
10346
  }
10182
10347
  var N,
10183
10348
  Q,
10184
- pi,
10185
- _n,
10349
+ cr,
10350
+ Tn,
10186
10351
  se,
10187
10352
  bt,
10188
- li,
10189
- yi = y(() => {
10353
+ dr,
10354
+ wr = y(() => {
10190
10355
  'use strict';
10191
10356
  ((N = M(require('node:fs'))),
10192
10357
  (Q = M(require('node:path'))),
10193
- (pi = M(require('node:readline'))));
10358
+ (cr = M(require('node:readline'))));
10194
10359
  ct();
10195
- si();
10360
+ lr();
10196
10361
  R();
10197
10362
  oe();
10198
- _n = new Set([
10363
+ Tn = new Set([
10199
10364
  '.png',
10200
10365
  '.jpg',
10201
10366
  '.jpeg',
@@ -10222,19 +10387,19 @@ var N,
10222
10387
  '.opus',
10223
10388
  ]);
10224
10389
  ((se = new Map()), (bt = 0));
10225
- li = !1;
10390
+ dr = !1;
10226
10391
  require.main === module &&
10227
- gi().catch((e) => {
10392
+ yr().catch((e) => {
10228
10393
  (process.stderr.write(`Fatal error in Tein MCP CLI: ${e}
10229
10394
  `),
10230
10395
  process.exit(1));
10231
10396
  });
10232
10397
  });
10233
- var Ti =
10398
+ var Sr =
10234
10399
  !process.env.NO_COLOR &&
10235
10400
  (process.stdout.isTTY || process.env.FORCE_COLOR === '1' || process.env.TERM !== 'dumb');
10236
10401
  function k(e, t) {
10237
- return (r) => (Ti ? `\x1B[${e}m${r}\x1B[${t}m` : String(r));
10402
+ return (i) => (Sr ? `\x1B[${e}m${i}\x1B[${t}m` : String(i));
10238
10403
  }
10239
10404
  var a = {
10240
10405
  bold: k(1, 22),
@@ -10280,8 +10445,8 @@ var a = {
10280
10445
  process.stdout.isTTY
10281
10446
  ? (this.stop(),
10282
10447
  (this.timer = setInterval(() => {
10283
- let r = a.cyan(this.frames[this.current]);
10284
- (process.stdout.write(`\r${r} ${this.text} `),
10448
+ let i = a.cyan(this.frames[this.current]);
10449
+ (process.stdout.write(`\r${i} ${this.text} `),
10285
10450
  (this.current = (this.current + 1) % this.frames.length));
10286
10451
  }, 80)),
10287
10452
  this)
@@ -10295,20 +10460,20 @@ var a = {
10295
10460
  }
10296
10461
  succeed(t) {
10297
10462
  this.stop();
10298
- let r = t || this.text;
10463
+ let i = t || this.text;
10299
10464
  process.stdout.isTTY
10300
- ? process.stdout.write(`\r${a.green('\u2713')} ${r}
10465
+ ? process.stdout.write(`\r${a.green('\u2713')} ${i}
10301
10466
  `)
10302
- : process.stdout.write(`[\u2713] ${r}
10467
+ : process.stdout.write(`[\u2713] ${i}
10303
10468
  `);
10304
10469
  }
10305
10470
  fail(t) {
10306
10471
  this.stop();
10307
- let r = t || this.text;
10472
+ let i = t || this.text;
10308
10473
  process.stdout.isTTY
10309
- ? process.stdout.write(`\r${a.red('\u2717')} ${r}
10474
+ ? process.stdout.write(`\r${a.red('\u2717')} ${i}
10310
10475
  `)
10311
- : process.stdout.write(`[\u2717] ${r}
10476
+ : process.stdout.write(`[\u2717] ${i}
10312
10477
  `);
10313
10478
  }
10314
10479
  stop() {
@@ -10324,7 +10489,7 @@ var le = M(require('node:fs')),
10324
10489
  vt = M(require('node:path')),
10325
10490
  It = require('node:stream/promises');
10326
10491
  oe();
10327
- var Ei = new Set([
10492
+ var Cr = new Set([
10328
10493
  'account_suspended',
10329
10494
  'account_terminated',
10330
10495
  'creative_mode_restricted',
@@ -10332,30 +10497,30 @@ var Ei = new Set([
10332
10497
  'workspace_paused',
10333
10498
  ]),
10334
10499
  T = 1,
10335
- $i = 3,
10500
+ Ar = 3,
10336
10501
  b = class extends Error {
10337
- constructor(t, r, i, n = {}) {
10338
- (super(r),
10502
+ constructor(t, i, r, n = {}) {
10503
+ (super(i),
10339
10504
  (this.name = 'TeinApiError'),
10340
10505
  (this.status = t),
10341
- i && (this.code = i),
10506
+ r && (this.code = r),
10342
10507
  (this.fields = n));
10343
10508
  }
10344
10509
  get exitCode() {
10345
- return this.code && Ei.has(this.code) ? $i : T;
10510
+ return this.code && Cr.has(this.code) ? Ar : T;
10346
10511
  }
10347
10512
  };
10348
- function Ci(e, t, r) {
10349
- let i = `HTTP ${e}${t ? ` ${t}` : ''}`;
10350
- if (!r || typeof r != 'object') return new b(e, i);
10351
- let n = r;
10513
+ function Rr(e, t, i) {
10514
+ let r = `HTTP ${e}${t ? ` ${t}` : ''}`;
10515
+ if (!i || typeof i != 'object') return new b(e, r);
10516
+ let n = i;
10352
10517
  if (n.error && typeof n.error == 'object' && !Array.isArray(n.error)) {
10353
10518
  let d = n.error,
10354
10519
  { code: u, message: m, ...g } = d;
10355
- return new b(e, typeof m == 'string' && m ? m : i, typeof u == 'string' ? u : void 0, g);
10520
+ return new b(e, typeof m == 'string' && m ? m : r, typeof u == 'string' ? u : void 0, g);
10356
10521
  }
10357
10522
  let { error: s, code: o, message: p, ...l } = n,
10358
- c = (typeof s == 'string' && s) || (typeof p == 'string' && p) || i;
10523
+ c = (typeof s == 'string' && s) || (typeof p == 'string' && p) || r;
10359
10524
  return new b(e, c, typeof o == 'string' ? o : void 0, l);
10360
10525
  }
10361
10526
  function _t(e) {
@@ -10363,16 +10528,16 @@ function _t(e) {
10363
10528
  }
10364
10529
  function E(e) {
10365
10530
  let t = [e.message],
10366
- r = _t(e.fields.required),
10367
- i = _t(e.fields.balance);
10368
- (r || i) &&
10369
- t.push([r ? `Required: ${r}` : '', i ? `Balance: ${i}` : ''].filter(Boolean).join(' '));
10531
+ i = _t(e.fields.required),
10532
+ r = _t(e.fields.balance);
10533
+ (i || r) &&
10534
+ t.push([i ? `Required: ${i}` : '', r ? `Balance: ${r}` : ''].filter(Boolean).join(' '));
10370
10535
  let n = e.fields.org_name ?? e.fields.orgName;
10371
10536
  typeof n == 'string' && n && t.push(`Workspace: ${n}`);
10372
10537
  let s = e.fields.url ?? e.fields.appeal_url ?? e.fields.top_up_url;
10373
10538
  return (typeof s == 'string' && s && t.push(s), e.code && t.push(`(${e.code})`), t);
10374
10539
  }
10375
- function Ai(e) {
10540
+ function Or(e) {
10376
10541
  return /\.(mp4|webm|mov)(\?|$)/i.test(e)
10377
10542
  ? 'video'
10378
10543
  : /\.(mp3|wav|ogg|flac)(\?|$)/i.test(e)
@@ -10381,15 +10546,15 @@ function Ai(e) {
10381
10546
  }
10382
10547
  function Pt(e) {
10383
10548
  let t = [];
10384
- for (let r of e.data ?? [])
10385
- typeof r.message?.content == 'string'
10386
- ? t.push({ type: 'text', text: r.message.content })
10387
- : r.url && t.push({ type: Ai(r.url), url: r.url, ...(r.layer ? { layer: r.layer } : {}) });
10549
+ for (let i of e.data ?? [])
10550
+ typeof i.message?.content == 'string'
10551
+ ? t.push({ type: 'text', text: i.message.content })
10552
+ : i.url && t.push({ type: Or(i.url), url: i.url, ...(i.layer ? { layer: i.layer } : {}) });
10388
10553
  return t;
10389
10554
  }
10390
10555
  var K = class {
10391
- constructor(t, r) {
10392
- ((this.apiKey = t), (this.baseUrl = r.replace(/\/+$/, '')));
10556
+ constructor(t, i) {
10557
+ ((this.apiKey = t), (this.baseUrl = i.replace(/\/+$/, '')));
10393
10558
  }
10394
10559
  getHeaders() {
10395
10560
  return {
@@ -10399,58 +10564,58 @@ var K = class {
10399
10564
  'X-Tein-Client': 'cli',
10400
10565
  };
10401
10566
  }
10402
- async send(t, r, i) {
10403
- let n = await fetch(`${this.baseUrl}${r}`, {
10567
+ async send(t, i, r) {
10568
+ let n = await fetch(`${this.baseUrl}${i}`, {
10404
10569
  method: t,
10405
10570
  headers: this.getHeaders(),
10406
- ...(i === void 0 ? {} : { body: JSON.stringify(i) }),
10571
+ ...(r === void 0 ? {} : { body: JSON.stringify(r) }),
10407
10572
  });
10408
10573
  if (!n.ok) {
10409
10574
  let s = null;
10410
10575
  try {
10411
10576
  s = await n.json();
10412
10577
  } catch {}
10413
- throw Ci(n.status, n.statusText, s);
10578
+ throw Rr(n.status, n.statusText, s);
10414
10579
  }
10415
10580
  return await n.json();
10416
10581
  }
10417
10582
  async checkKey() {
10418
10583
  await this.send('GET', '/v1/jobs?limit=1');
10419
10584
  }
10420
- queueJob(t, r) {
10421
- return this.send('POST', '/v1/generate', { model: t, ...r }).then((i) => {
10422
- let n = i.status,
10585
+ queueJob(t, i) {
10586
+ return this.send('POST', '/v1/generate', { model: t, ...i }).then((r) => {
10587
+ let n = r.status,
10423
10588
  s =
10424
10589
  n === 'succeeded' || n === 'failed' || n === 'expired' || n === 'cancelled'
10425
10590
  ? n
10426
10591
  : 'processing',
10427
- o = Pt(i);
10592
+ o = Pt(r);
10428
10593
  return {
10429
- request_id: i.request_id || i.id || '',
10430
- model: i.model,
10594
+ request_id: r.request_id || r.id || '',
10595
+ model: r.model,
10431
10596
  status: s,
10432
10597
  ...(o.length ? { output: o } : {}),
10433
- error: i.error && typeof i.error.message == 'string' ? i.error.message : null,
10434
- ...(i.usage ? { usage: i.usage } : {}),
10598
+ error: r.error && typeof r.error.message == 'string' ? r.error.message : null,
10599
+ ...(r.usage ? { usage: r.usage } : {}),
10435
10600
  };
10436
10601
  });
10437
10602
  }
10438
10603
  getStatus(t) {
10439
- return this.send('GET', `/v1/jobs/${encodeURIComponent(t)}`).then((r) => {
10440
- let i = r.status,
10604
+ return this.send('GET', `/v1/jobs/${encodeURIComponent(t)}`).then((i) => {
10605
+ let r = i.status,
10441
10606
  n =
10442
- i === 'succeeded' || i === 'failed' || i === 'expired' || i === 'cancelled'
10443
- ? i
10607
+ r === 'succeeded' || r === 'failed' || r === 'expired' || r === 'cancelled'
10608
+ ? r
10444
10609
  : 'processing',
10445
- s = Pt(r),
10446
- o = r.error && typeof r.error.message == 'string' ? r.error.message : null;
10610
+ s = Pt(i),
10611
+ o = i.error && typeof i.error.message == 'string' ? i.error.message : null;
10447
10612
  return {
10448
- request_id: r.id || t,
10449
- model: r.model,
10613
+ request_id: i.id || t,
10614
+ model: i.model,
10450
10615
  status: n,
10451
10616
  ...(s.length ? { output: s } : {}),
10452
10617
  error: o,
10453
- ...(r.usage ? { usage: r.usage } : {}),
10618
+ ...(i.usage ? { usage: i.usage } : {}),
10454
10619
  };
10455
10620
  });
10456
10621
  }
@@ -10458,23 +10623,23 @@ var K = class {
10458
10623
  return this.send('GET', '/v1/balance');
10459
10624
  }
10460
10625
  getUsage(t) {
10461
- let r = new URLSearchParams(t).toString();
10462
- return this.send('GET', `/v1/usage${r ? `?${r}` : ''}`);
10626
+ let i = new URLSearchParams(t).toString();
10627
+ return this.send('GET', `/v1/usage${i ? `?${i}` : ''}`);
10463
10628
  }
10464
10629
  getTransactions(t) {
10465
- let r = new URLSearchParams(t).toString();
10466
- return this.send('GET', `/v1/balance/transactions${r ? `?${r}` : ''}`);
10630
+ let i = new URLSearchParams(t).toString();
10631
+ return this.send('GET', `/v1/balance/transactions${i ? `?${i}` : ''}`);
10467
10632
  }
10468
10633
  uploadAsset(t) {
10469
10634
  return this.send('POST', '/v1/upload', { data: t });
10470
10635
  }
10471
- async downloadOutput(t, r) {
10472
- let i = await fetch(t);
10473
- if (!i.ok) throw new Error(`The file could not be downloaded (HTTP ${i.status})`);
10474
- let n = vt.default.dirname(r);
10636
+ async downloadOutput(t, i) {
10637
+ let r = await fetch(t);
10638
+ if (!r.ok) throw new Error(`The file could not be downloaded (HTTP ${r.status})`);
10639
+ let n = vt.default.dirname(i);
10475
10640
  le.default.existsSync(n) || le.default.mkdirSync(n, { recursive: !0 });
10476
- let s = le.default.createWriteStream(r);
10477
- return (await (0, It.pipeline)(i.body, s), r);
10641
+ let s = le.default.createWriteStream(i);
10642
+ return (await (0, It.pipeline)(r.body, s), i);
10478
10643
  }
10479
10644
  };
10480
10645
  R();
@@ -10482,54 +10647,54 @@ function Ce(e) {
10482
10647
  if (typeof e != 'number' || !Number.isFinite(e)) return '';
10483
10648
  if (Math.abs(e) >= 1 || Math.abs(Number(e.toFixed(4)) - e) < 1e-12) return `$${e.toFixed(4)}`;
10484
10649
  let t = Math.max(0, 3 - Number(e.toExponential(3).split('e')[1])),
10485
- r = 10 ** t,
10486
- i = Math.round(Number((e * r).toFixed(6))) / r;
10487
- return i >= 1 ? `$${i.toFixed(4)}` : `$${i.toFixed(t).replace(/0+$/, '')}`;
10650
+ i = 10 ** t,
10651
+ r = Math.round(Number((e * i).toFixed(6))) / i;
10652
+ return r >= 1 ? `$${r.toFixed(4)}` : `$${r.toFixed(t).replace(/0+$/, '')}`;
10488
10653
  }
10489
- ie();
10490
- var Lr = ['images', 'input_images', 'videos', 'audios'];
10491
- function qa(e) {
10492
- for (let t of Lr) typeof e[t] == 'string' && (e[t] = [e[t]]);
10654
+ re();
10655
+ var Ni = ['images', 'input_images', 'videos', 'audios'];
10656
+ function Va(e) {
10657
+ for (let t of Ni) typeof e[t] == 'string' && (e[t] = [e[t]]);
10493
10658
  }
10494
- function La(e) {
10659
+ function Ua(e) {
10495
10660
  if (e.startsWith('http://') || e.startsWith('https://')) return null;
10496
10661
  let t = O.default.resolve(e);
10497
10662
  return G.default.existsSync(t) && G.default.statSync(t).isFile() ? t : null;
10498
10663
  }
10499
- async function Da(e, t) {
10500
- for (let r of Lr) {
10501
- if (!Array.isArray(e[r])) continue;
10502
- let i = [];
10503
- for (let n of e[r]) {
10664
+ async function Fa(e, t) {
10665
+ for (let i of Ni) {
10666
+ if (!Array.isArray(e[i])) continue;
10667
+ let r = [];
10668
+ for (let n of e[i]) {
10504
10669
  if (typeof n != 'string') continue;
10505
- let s = La(n);
10506
- i.push(s ? await t(s) : n);
10670
+ let s = Ua(n);
10671
+ r.push(s ? await t(s) : n);
10507
10672
  }
10508
- e[r] = i;
10673
+ e[i] = r;
10509
10674
  }
10510
10675
  }
10511
10676
  var ae = { starter: 10, plus: 25, scale: 40, enterprise: 200 };
10512
- function Na(e) {
10677
+ function Ba(e) {
10513
10678
  if (e.count === void 0 || e.count === !0) return 1;
10514
10679
  let t = typeof e.count == 'number' ? e.count : Number(e.count),
10515
- r = ae.enterprise;
10680
+ i = ae.enterprise;
10516
10681
  return (
10517
- (!Number.isInteger(t) || t < 1 || t > r) &&
10682
+ (!Number.isInteger(t) || t < 1 || t > i) &&
10518
10683
  (process.stderr
10519
- .write(`${a.red('Error:')} --count must be a whole number from 1 to ${r}. The API allows Starter ${ae.starter}, Plus ${ae.plus}, Scale ${ae.scale}, Enterprise ${ae.enterprise} at once, including polling.
10684
+ .write(`${a.red('Error:')} --count must be a whole number from 1 to ${i}. The API allows Starter ${ae.starter}, Plus ${ae.plus}, Scale ${ae.scale}, Enterprise ${ae.enterprise} at once, including polling.
10520
10685
  `),
10521
10686
  process.exit(1)),
10522
10687
  t
10523
10688
  );
10524
10689
  }
10525
- async function Ua(e, t, r, i, n) {
10690
+ async function ja(e, t, i, r, n) {
10526
10691
  n.isJson ||
10527
- process.stderr.write(`Starting ${i} ${t} jobs together...
10692
+ process.stderr.write(`Starting ${r} ${t} jobs together...
10528
10693
  `);
10529
10694
  let s = await Promise.all(
10530
- Array.from({ length: i }, async () => {
10695
+ Array.from({ length: r }, async () => {
10531
10696
  try {
10532
- return { job: await e.queueJob(t, r) };
10697
+ return { job: await e.queueJob(t, i) };
10533
10698
  } catch (l) {
10534
10699
  return { err: l };
10535
10700
  }
@@ -10552,7 +10717,7 @@ async function Ua(e, t, r, i, n) {
10552
10717
  for (; c.length;) {
10553
10718
  if ((await new Promise((u) => setTimeout(u, 2e3)), !n.isJson)) {
10554
10719
  let u = Math.round((Date.now() - l) / 1e3);
10555
- process.stderr.write(`Waiting on ${c.length} of ${i} (${u}s)...
10720
+ process.stderr.write(`Waiting on ${c.length} of ${r} (${u}s)...
10556
10721
  `);
10557
10722
  }
10558
10723
  let d = await Promise.all(
@@ -10600,15 +10765,15 @@ async function Ua(e, t, r, i, n) {
10600
10765
  o.some((l) => l.status === 'failed' || l.status === 'expired' || l.status === 'cancelled')) &&
10601
10766
  process.exit(T);
10602
10767
  }
10603
- function Va(e, t, r) {
10604
- if (r <= 1) return e;
10605
- let i = O.default.extname(e);
10606
- return `${e.slice(0, e.length - i.length)}-${t + 1}${i}`;
10768
+ function Ga(e, t, i) {
10769
+ if (i <= 1) return e;
10770
+ let r = O.default.extname(e);
10771
+ return `${e.slice(0, e.length - r.length)}-${t + 1}${r}`;
10607
10772
  }
10608
- function Dr(e) {
10773
+ function Vi(e) {
10609
10774
  let t = {},
10610
- r = new Set(),
10611
- i = [];
10775
+ i = new Set(),
10776
+ r = [];
10612
10777
  for (let n = 0; n < e.length; n++) {
10613
10778
  let s = e[n];
10614
10779
  if (s.startsWith('--')) {
@@ -10626,7 +10791,7 @@ function Dr(e) {
10626
10791
  ? (t[o.replace(/-/g, '_')] = Number(p))
10627
10792
  : (t[o.replace(/-/g, '_')] = p),
10628
10793
  n++);
10629
- } else ((t[o.replace(/-/g, '_')] = !0), r.add(o));
10794
+ } else ((t[o.replace(/-/g, '_')] = !0), i.add(o));
10630
10795
  } else if (s.startsWith('-') && s.length === 2) {
10631
10796
  let o = s[1],
10632
10797
  l =
@@ -10642,18 +10807,18 @@ function Dr(e) {
10642
10807
  v: 'version',
10643
10808
  }[o] || o;
10644
10809
  o === 'j' || o === 'h' || o === 'v'
10645
- ? ((t[l] = !0), r.add(l))
10810
+ ? ((t[l] = !0), i.add(l))
10646
10811
  : n + 1 < e.length && !e[n + 1].startsWith('-')
10647
10812
  ? ((t[l] = e[n + 1]), n++)
10648
10813
  : (t[l] = !0);
10649
- } else i.push(s);
10814
+ } else r.push(s);
10650
10815
  }
10651
- return { command: i[0] || '', subcommand: i[1], modelSlug: i[1] || i[0], options: t, flags: r };
10816
+ return { command: r[0] || '', subcommand: r[1], modelSlug: r[1] || r[0], options: t, flags: i };
10652
10817
  }
10653
10818
  async function pt(e, t) {
10654
- let r = _(typeof t.api_key == 'string' ? t.api_key : void 0),
10655
- i = x(typeof t.api_url == 'string' ? t.api_url : void 0);
10656
- (r ||
10819
+ let i = _(typeof t.api_key == 'string' ? t.api_key : void 0),
10820
+ r = x(typeof t.api_url == 'string' ? t.api_url : void 0);
10821
+ (i ||
10657
10822
  (process.stderr.write(`${a.red('Error:')} Authentication required.
10658
10823
  `),
10659
10824
  process.stderr
@@ -10672,7 +10837,7 @@ async function pt(e, t) {
10672
10837
  s = !!t.json,
10673
10838
  o = !!(t.async || t.no_wait),
10674
10839
  p = typeof t.output == 'string' ? t.output : void 0,
10675
- l = Na(t),
10840
+ l = Ba(t),
10676
10841
  c = { ...t };
10677
10842
  (delete c.json,
10678
10843
  delete c.async,
@@ -10681,14 +10846,14 @@ async function pt(e, t) {
10681
10846
  delete c.api_key,
10682
10847
  delete c.api_url,
10683
10848
  delete c.count);
10684
- let d = qr(n, c);
10685
- (qa(d),
10849
+ let d = Di(n, c);
10850
+ (Va(d),
10686
10851
  typeof d.image == 'string' && !d.images && !ve(n) && ((d.images = [d.image]), delete d.image),
10687
10852
  d.image_url &&
10688
10853
  !d.first_frame_image &&
10689
10854
  (e.startsWith('seedance') || e.startsWith('happy-horse')) &&
10690
10855
  (d.first_frame_image = d.image_url));
10691
- let u = new K(r, i),
10856
+ let u = new K(i, r),
10692
10857
  m = [
10693
10858
  'image',
10694
10859
  'mask_image',
@@ -10708,11 +10873,11 @@ async function pt(e, t) {
10708
10873
  let I = new C(`Uploading local file ${O.default.basename(v)} to CDN...`);
10709
10874
  s || I.start();
10710
10875
  try {
10711
- let V = G.default.readFileSync(v),
10712
- q = await u.uploadAsset(V.toString('base64'));
10876
+ let U = G.default.readFileSync(v),
10877
+ q = await u.uploadAsset(U.toString('base64'));
10713
10878
  ((d[w] = q.url), s || I.succeed(`Uploaded ${O.default.basename(v)} to CDN`));
10714
- } catch (V) {
10715
- let q = V instanceof Error ? V.message : String(V);
10879
+ } catch (U) {
10880
+ let q = U instanceof Error ? U.message : String(U);
10716
10881
  (s
10717
10882
  ? process.stdout.write(
10718
10883
  JSON.stringify({ error: q }) +
@@ -10725,7 +10890,7 @@ async function pt(e, t) {
10725
10890
  }
10726
10891
  }
10727
10892
  }
10728
- await Da(d, async (w) => {
10893
+ await Fa(d, async (w) => {
10729
10894
  let h = new C(`Uploading local file ${O.default.basename(w)} to CDN...`);
10730
10895
  s || h.start();
10731
10896
  try {
@@ -10749,7 +10914,7 @@ async function pt(e, t) {
10749
10914
  let f;
10750
10915
  try {
10751
10916
  if (l > 1) {
10752
- await Ua(u, e, d, l, { isJson: s, isAsync: o });
10917
+ await ja(u, e, d, l, { isJson: s, isAsync: o });
10753
10918
  return;
10754
10919
  }
10755
10920
  f = await u.queueJob(e, d);
@@ -10788,11 +10953,11 @@ async function pt(e, t) {
10788
10953
  return;
10789
10954
  }
10790
10955
  let A = Date.now(),
10791
- U = 1500;
10956
+ V = 1500;
10792
10957
  for (; f.status === 'processing';) {
10793
10958
  let w = Math.round((Date.now() - A) / 1e3);
10794
10959
  (s || g.update(`Rendering ${a.bold(e)} (${w}s elapsed)... [ID: ${f.request_id}]`),
10795
- await new Promise((h) => setTimeout(h, U)));
10960
+ await new Promise((h) => setTimeout(h, V)));
10796
10961
  try {
10797
10962
  f = await u.getStatus(f.request_id);
10798
10963
  } catch (h) {
@@ -10846,13 +11011,13 @@ ${a.bold('Outputs:')}
10846
11011
  for (let v = 0; v < f.output.length; v++) {
10847
11012
  let I = f.output[v];
10848
11013
  if (I.url) {
10849
- let V = I.layer?.name ? ` ${a.bold(I.layer.name)}` : '';
11014
+ let U = I.layer?.name ? ` ${a.bold(I.layer.name)}` : '';
10850
11015
  if (
10851
- (process.stdout.write(` [${I.type.toUpperCase()}]${V} ${a.cyan(a.underline(I.url))}
11016
+ (process.stdout.write(` [${I.type.toUpperCase()}]${U} ${a.cyan(a.underline(I.url))}
10852
11017
  `),
10853
11018
  p)
10854
11019
  ) {
10855
- let q = Va(p, h++, w),
11020
+ let q = Ga(p, h++, w),
10856
11021
  xt = new C(`Downloading output to ${q}...`).start();
10857
11022
  try {
10858
11023
  (await u.downloadOutput(I.url, O.default.resolve(process.cwd(), q)),
@@ -10871,9 +11036,9 @@ ${I.text}
10871
11036
  process.stdout.write(`
10872
11037
  `);
10873
11038
  }
10874
- var Nr = M(require('node:readline'));
11039
+ var Ui = M(require('node:readline'));
10875
11040
  R();
10876
- async function Fa(e) {
11041
+ async function Ha(e) {
10877
11042
  try {
10878
11043
  return (await new K(e, x()).checkKey(), 'ok');
10879
11044
  } catch (t) {
@@ -10884,11 +11049,11 @@ async function Fa(e) {
10884
11049
  return 'unchecked';
10885
11050
  }
10886
11051
  }
10887
- function Ba(e) {
10888
- let t = Nr.default.createInterface({ input: process.stdin, output: process.stdout });
10889
- return new Promise((r) => {
10890
- t.question(e, (i) => {
10891
- (t.close(), r(i.trim()));
11052
+ function za(e) {
11053
+ let t = Ui.default.createInterface({ input: process.stdin, output: process.stdout });
11054
+ return new Promise((i) => {
11055
+ t.question(e, (r) => {
11056
+ (t.close(), i(r.trim()));
10892
11057
  });
10893
11058
  });
10894
11059
  }
@@ -10896,36 +11061,36 @@ async function ne(e, t) {
10896
11061
  switch (e) {
10897
11062
  case 'login':
10898
11063
  case 'set-key': {
10899
- let r = t?.trim() || '';
10900
- (r ||
11064
+ let i = t?.trim() || '';
11065
+ (i ||
10901
11066
  (process.stdout.write(`
10902
11067
  ${a.bold('Tein AI Authentication')}
10903
11068
  `),
10904
11069
  process.stdout.write(`Get your API key at: ${a.cyan('https://tein.ai/dashboard/keys')}
10905
11070
 
10906
11071
  `),
10907
- (r = await Ba('Enter your Tein API Key (sk_live_...): '))),
10908
- !r.startsWith('sk_live_') &&
10909
- !r.startsWith('sk_test_') &&
11072
+ (i = await za('Enter your Tein API Key (sk_live_...): '))),
11073
+ !i.startsWith('sk_live_') &&
11074
+ !i.startsWith('sk_test_') &&
10910
11075
  (process.stderr
10911
11076
  .write(`${a.red('Error:')} Invalid key format. Tein API keys start with 'sk_live_' or 'sk_test_'.
10912
11077
  `),
10913
11078
  process.exit(1)));
10914
- let i = await Fa(r);
10915
- (i === 'invalid' &&
11079
+ let r = await Ha(i);
11080
+ (r === 'invalid' &&
10916
11081
  (process.stderr
10917
11082
  .write(`${a.red('Error:')} Tein did not accept this key. Copy it again from ${a.cyan('https://tein.ai/dashboard/keys')}. Nothing was saved.
10918
11083
  `),
10919
11084
  process.exit(1)),
10920
- $e({ apiKey: r }),
11085
+ $e({ apiKey: i }),
10921
11086
  process.stdout.write(`
10922
11087
  ${a.green('\u2713')} API key saved to ${a.dim(de())}
10923
11088
  `),
10924
- i === 'blocked'
11089
+ r === 'blocked'
10925
11090
  ? process.stdout
10926
11091
  .write(`${a.yellow('\u2139')} The key is valid, but this account cannot run requests right now. Check your dashboard.
10927
11092
  `)
10928
- : i === 'unchecked' &&
11093
+ : r === 'unchecked' &&
10929
11094
  process.stdout
10930
11095
  .write(`${a.yellow('\u2139')} Could not reach Tein to check the key. It is saved; run ${a.cyan('tein auth set-key')} again once you are online to check it.
10931
11096
  `),
@@ -10949,8 +11114,8 @@ ${a.green('\u2713')} API key saved to ${a.dim(de())}
10949
11114
  break;
10950
11115
  }
10951
11116
  default: {
10952
- let r = _(),
10953
- i = x(),
11117
+ let i = _(),
11118
+ r = x(),
10954
11119
  n = W();
10955
11120
  if (
10956
11121
  (process.stdout.write(`
@@ -10958,9 +11123,9 @@ ${a.bold('Tein AI CLI Configuration')}
10958
11123
  `),
10959
11124
  process.stdout.write(` Config file: ${a.dim(de())}
10960
11125
  `),
10961
- process.stdout.write(` API URL: ${a.cyan(i)}
11126
+ process.stdout.write(` API URL: ${a.cyan(r)}
10962
11127
  `),
10963
- !r)
11128
+ !i)
10964
11129
  )
10965
11130
  (process.stdout.write(` API Key: ${a.red('Not configured')}
10966
11131
 
@@ -10970,9 +11135,9 @@ ${a.bold('Tein AI CLI Configuration')}
10970
11135
 
10971
11136
  `));
10972
11137
  else {
10973
- let s = `${r.slice(0, 10)}...${r.slice(-4)}`;
11138
+ let s = `${i.slice(0, 10)}...${i.slice(-4)}`;
10974
11139
  process.stdout
10975
- .write(` API Key: ${a.green(s)} (${r.startsWith('sk_live_') ? 'Live Key' : 'Test Key'})
11140
+ .write(` API Key: ${a.green(s)} (${i.startsWith('sk_live_') ? 'Live Key' : 'Test Key'})
10976
11141
 
10977
11142
  `);
10978
11143
  }
@@ -10986,10 +11151,10 @@ function P(e) {
10986
11151
  ? `$${e.toFixed(6).replace(/0+$/, '').replace(/\.$/, '')}`
10987
11152
  : `$${e.toFixed(2)}`;
10988
11153
  }
10989
- function Ur(e) {
11154
+ function Fi(e) {
10990
11155
  return `${e} ${e === 1 ? 'request' : 'requests'}`;
10991
11156
  }
10992
- function ja(e) {
11157
+ function Wa(e) {
10993
11158
  let t = [
10994
11159
  ['Balance', P(e.balance)],
10995
11160
  ['Available to this key', P(e.available)],
@@ -11002,15 +11167,15 @@ function ja(e) {
11002
11167
  : '';
11003
11168
  t.push(['Credits from Tein', `${P(e.credits_from_tein.amount)}${n}`]);
11004
11169
  }
11005
- let r = e.key.spending_limit;
11006
- (r &&
11170
+ let i = e.key.spending_limit;
11171
+ (i &&
11007
11172
  t.push([
11008
- `Key limit (${r.period})`,
11009
- `${P(r.remaining)} left of ${P(r.amount)}${r.resets_at ? `, resets ${r.resets_at.slice(0, 10)}` : ''}`,
11173
+ `Key limit (${i.period})`,
11174
+ `${P(i.remaining)} left of ${P(i.amount)}${i.resets_at ? `, resets ${i.resets_at.slice(0, 10)}` : ''}`,
11010
11175
  ]),
11011
11176
  t.push(
11012
- ['This month', `${P(e.usage.this_month.spend)} on ${Ur(e.usage.this_month.requests)}`],
11013
- ['Last 30 days', `${P(e.usage.last_30_days.spend)} on ${Ur(e.usage.last_30_days.requests)}`],
11177
+ ['This month', `${P(e.usage.this_month.spend)} on ${Fi(e.usage.this_month.requests)}`],
11178
+ ['Last 30 days', `${P(e.usage.last_30_days.spend)} on ${Fi(e.usage.last_30_days.requests)}`],
11014
11179
  [
11015
11180
  'Auto top up',
11016
11181
  e.auto_top_up.enabled
@@ -11020,13 +11185,13 @@ function ja(e) {
11020
11185
  ['Workspace', `${e.workspace.name} (${e.workspace.plan.name})`],
11021
11186
  ['Key', `${e.key.name} (${e.key.env})`],
11022
11187
  ));
11023
- let i = Math.max(...t.map(([n]) => n.length));
11024
- return t.map(([n, s]) => ` ${n.padEnd(i)} ${s}`);
11188
+ let r = Math.max(...t.map(([n]) => n.length));
11189
+ return t.map(([n, s]) => ` ${n.padEnd(r)} ${s}`);
11025
11190
  }
11026
- async function Vr(e) {
11191
+ async function Bi(e) {
11027
11192
  let t = _(typeof e.api_key == 'string' ? e.api_key : void 0),
11028
- r = x(typeof e.api_url == 'string' ? e.api_url : void 0),
11029
- i = !!e.json;
11193
+ i = x(typeof e.api_url == 'string' ? e.api_url : void 0),
11194
+ r = !!e.json;
11030
11195
  t ||
11031
11196
  (process.stderr.write(`${a.red('Error:')} Authentication required.
11032
11197
  `),
@@ -11036,10 +11201,10 @@ async function Vr(e) {
11036
11201
  process.exit(1));
11037
11202
  let n;
11038
11203
  try {
11039
- n = await new K(t, r).getBalance();
11204
+ n = await new K(t, i).getBalance();
11040
11205
  } catch (s) {
11041
11206
  (s instanceof b &&
11042
- (i
11207
+ (r
11043
11208
  ? process.stdout.write(
11044
11209
  JSON.stringify(
11045
11210
  { error: { code: s.code ?? null, message: s.message, ...s.fields } },
@@ -11057,7 +11222,7 @@ async function Vr(e) {
11057
11222
  `),
11058
11223
  process.exit(T));
11059
11224
  }
11060
- if (i) {
11225
+ if (r) {
11061
11226
  process.stdout.write(
11062
11227
  JSON.stringify(n, null, 2) +
11063
11228
  `
@@ -11067,15 +11232,15 @@ async function Vr(e) {
11067
11232
  }
11068
11233
  process.stdout.write(`
11069
11234
  ${a.bold('Tein balance')}
11070
- ${ja(n).join(`
11235
+ ${Wa(n).join(`
11071
11236
  `)}
11072
11237
 
11073
11238
  `);
11074
11239
  }
11075
11240
  R();
11076
- function Fr(e) {
11241
+ function ji(e) {
11077
11242
  let t = _(typeof e.api_key == 'string' ? e.api_key : void 0),
11078
- r = x(typeof e.api_url == 'string' ? e.api_url : void 0);
11243
+ i = x(typeof e.api_url == 'string' ? e.api_url : void 0);
11079
11244
  return (
11080
11245
  t ||
11081
11246
  (process.stderr.write(`${a.red('Error:')} Authentication required.
@@ -11084,55 +11249,55 @@ function Fr(e) {
11084
11249
  .write(`Please run ${a.cyan('tein auth login')} or set ${a.cyan('TEIN_API_KEY')} environment variable.
11085
11250
  `),
11086
11251
  process.exit(1)),
11087
- new K(t, r)
11252
+ new K(t, i)
11088
11253
  );
11089
11254
  }
11090
- function Br(e, t) {
11091
- let r = {};
11092
- for (let i of t) {
11093
- let n = e[i];
11094
- (typeof n == 'string' || typeof n == 'number') && (r[i] = String(n));
11255
+ function Gi(e, t) {
11256
+ let i = {};
11257
+ for (let r of t) {
11258
+ let n = e[r];
11259
+ (typeof n == 'string' || typeof n == 'number') && (i[r] = String(n));
11095
11260
  }
11096
- return r;
11261
+ return i;
11097
11262
  }
11098
- async function jr(e, t) {
11263
+ async function Hi(e, t) {
11099
11264
  try {
11100
11265
  return await t();
11101
- } catch (r) {
11102
- (r instanceof b &&
11266
+ } catch (i) {
11267
+ (i instanceof b &&
11103
11268
  (e
11104
11269
  ? process.stdout.write(
11105
11270
  JSON.stringify(
11106
- { error: { code: r.code ?? null, message: r.message, ...r.fields } },
11271
+ { error: { code: i.code ?? null, message: i.message, ...i.fields } },
11107
11272
  null,
11108
11273
  2,
11109
11274
  ) +
11110
11275
  `
11111
11276
  `,
11112
11277
  )
11113
- : process.stderr.write(`${a.red('Error:')} ${E(r).join(`
11278
+ : process.stderr.write(`${a.red('Error:')} ${E(i).join(`
11114
11279
  `)}
11115
11280
  `),
11116
- process.exit(r.exitCode)),
11117
- process.stderr.write(`${a.red('Error:')} ${r instanceof Error ? r.message : String(r)}
11281
+ process.exit(i.exitCode)),
11282
+ process.stderr.write(`${a.red('Error:')} ${i instanceof Error ? i.message : String(i)}
11118
11283
  `),
11119
11284
  process.exit(T));
11120
11285
  }
11121
11286
  }
11122
11287
  function dt(e) {
11123
- let t = e[0].map((i, n) => Math.max(...e.map((s) => s[n].length))),
11124
- r = (i) => e.slice(1).every((n) => /^[-+$\d]/.test(n[i]));
11288
+ let t = e[0].map((r, n) => Math.max(...e.map((s) => s[n].length))),
11289
+ i = (r) => e.slice(1).every((n) => /^[-+$\d]/.test(n[r]));
11125
11290
  return e.map(
11126
- (i) =>
11127
- ` ${i
11128
- .map((n, s) => (s > 0 && r(s) ? n.padStart(t[s]) : n.padEnd(t[s])))
11291
+ (r) =>
11292
+ ` ${r
11293
+ .map((n, s) => (s > 0 && i(s) ? n.padStart(t[s]) : n.padEnd(t[s])))
11129
11294
  .join(' ')
11130
11295
  .trimEnd()}`,
11131
11296
  );
11132
11297
  }
11133
- function Ga(e) {
11298
+ function Ja(e) {
11134
11299
  let t = e.summary,
11135
- r = [
11300
+ i = [
11136
11301
  ` Window ${e.from.slice(0, 10)} to ${e.to.slice(0, 10)} (${e.range})${e.filters.model ? `, model ${e.filters.model}` : ''}${e.filters.channel ? `, channel ${e.filters.channel}` : ''}`,
11137
11302
  ` Spent ${P(t.spend)} on ${t.requests} requests (${t.succeeded} succeeded, ${t.failed} failed${t.running ? `, ${t.running} running` : ''})`,
11138
11303
  ` Daily burn ${P(t.daily_burn)}`,
@@ -11140,31 +11305,31 @@ function Ga(e) {
11140
11305
  ];
11141
11306
  return (
11142
11307
  e.by_channel.length &&
11143
- (r.push('', a.bold('By channel')),
11144
- r.push(
11308
+ (i.push('', a.bold('By channel')),
11309
+ i.push(
11145
11310
  ...dt([
11146
11311
  ['Channel', 'Spend', 'Requests'],
11147
- ...e.by_channel.map((i) => [i.channel, P(i.spend), String(i.requests)]),
11312
+ ...e.by_channel.map((r) => [r.channel, P(r.spend), String(r.requests)]),
11148
11313
  ]),
11149
11314
  )),
11150
11315
  e.by_model.length &&
11151
- (r.push('', a.bold('By model')),
11152
- r.push(
11316
+ (i.push('', a.bold('By model')),
11317
+ i.push(
11153
11318
  ...dt([
11154
11319
  ['Model', 'Spend', 'Requests', 'Failed'],
11155
- ...e.by_model.map((i) => [i.name, P(i.spend), String(i.requests), String(i.failed)]),
11320
+ ...e.by_model.map((r) => [r.name, P(r.spend), String(r.requests), String(r.failed)]),
11156
11321
  ]),
11157
11322
  )),
11158
- r
11323
+ i
11159
11324
  );
11160
11325
  }
11161
- async function Gr(e) {
11326
+ async function zi(e) {
11162
11327
  let t = !!e.json,
11163
- r = Fr(e),
11164
- i = await jr(t, () => r.getUsage(Br(e, ['range', 'from', 'to', 'model', 'channel'])));
11328
+ i = ji(e),
11329
+ r = await Hi(t, () => i.getUsage(Gi(e, ['range', 'from', 'to', 'model', 'channel'])));
11165
11330
  if (t) {
11166
11331
  process.stdout.write(
11167
- JSON.stringify(i, null, 2) +
11332
+ JSON.stringify(r, null, 2) +
11168
11333
  `
11169
11334
  `,
11170
11335
  );
@@ -11172,12 +11337,12 @@ async function Gr(e) {
11172
11337
  }
11173
11338
  process.stdout.write(`
11174
11339
  ${a.bold('Tein usage')}
11175
- ${Ga(i).join(`
11340
+ ${Ja(r).join(`
11176
11341
  `)}
11177
11342
 
11178
11343
  `);
11179
11344
  }
11180
- function Ha(e) {
11345
+ function Ya(e) {
11181
11346
  return e.data.length
11182
11347
  ? dt([
11183
11348
  ['When (UTC)', 'Amount', 'Balance after', 'What'],
@@ -11190,37 +11355,37 @@ function Ha(e) {
11190
11355
  ])
11191
11356
  : [' No transactions yet.'];
11192
11357
  }
11193
- async function Hr(e) {
11358
+ async function Wi(e) {
11194
11359
  let t = !!e.json,
11195
- r = Fr(e),
11196
- i = await jr(t, () => r.getTransactions(Br(e, ['limit', 'type', 'after'])));
11360
+ i = ji(e),
11361
+ r = await Hi(t, () => i.getTransactions(Gi(e, ['limit', 'type', 'after'])));
11197
11362
  if (t) {
11198
11363
  process.stdout.write(
11199
- JSON.stringify(i, null, 2) +
11364
+ JSON.stringify(r, null, 2) +
11200
11365
  `
11201
11366
  `,
11202
11367
  );
11203
11368
  return;
11204
11369
  }
11205
11370
  let n =
11206
- i.has_more && i.next_cursor
11371
+ r.has_more && r.next_cursor
11207
11372
  ? `
11208
- More: tein transactions --after ${i.next_cursor}`
11373
+ More: tein transactions --after ${r.next_cursor}`
11209
11374
  : '';
11210
11375
  process.stdout.write(`
11211
11376
  ${a.bold('Tein balance history')}
11212
- ${Ha(i).join(`
11377
+ ${Ya(r).join(`
11213
11378
  `)}${n}
11214
11379
 
11215
11380
  `);
11216
11381
  }
11217
11382
  R();
11218
11383
  Ae();
11219
- ie();
11384
+ re();
11220
11385
  R();
11221
11386
  ct();
11222
- var za = 1e4,
11223
- zr = {
11387
+ var Xa = 1e4,
11388
+ Ji = {
11224
11389
  price: '',
11225
11390
  creativeMode: 'Creative mode',
11226
11391
  priority: 'Priority',
@@ -11230,27 +11395,27 @@ var za = 1e4,
11230
11395
  priorityDraft: 'Priority + Draft',
11231
11396
  creativeModePriorityDraft: 'Creative mode + Priority + Draft',
11232
11397
  },
11233
- Wa = Object.keys(zr),
11234
- Ja = {
11398
+ Qa = Object.keys(Ji),
11399
+ Za = {
11235
11400
  creativeMode: 'unfiltered',
11236
11401
  creativeModePriority: 'unfilteredPriority',
11237
11402
  creativeModeDraft: 'unfilteredDraft',
11238
11403
  creativeModePriorityDraft: 'unfilteredPriorityDraft',
11239
11404
  };
11240
- function Ya(e, t) {
11241
- let r = Ja[t];
11242
- return e[t] ?? (r ? e[r] : void 0);
11405
+ function en(e, t) {
11406
+ let i = Za[t];
11407
+ return e[t] ?? (i ? e[i] : void 0);
11243
11408
  }
11244
- async function Xa(e, t, r = _()) {
11245
- let i = `${x(e)}${Ie(t)}`,
11409
+ async function tn(e, t, i = _()) {
11410
+ let r = `${x(e)}${Ie(t)}`,
11246
11411
  n;
11247
11412
  try {
11248
- n = await fetch(i, {
11249
- signal: AbortSignal.timeout(za),
11250
- ...(r ? { headers: { Authorization: `Bearer ${r}` } } : {}),
11413
+ n = await fetch(r, {
11414
+ signal: AbortSignal.timeout(Xa),
11415
+ ...(i ? { headers: { Authorization: `Bearer ${i}` } } : {}),
11251
11416
  });
11252
11417
  } catch {
11253
- throw new Error(`Could not reach ${i}`);
11418
+ throw new Error(`Could not reach ${r}`);
11254
11419
  }
11255
11420
  let s = await n.json().catch(() => null);
11256
11421
  if (!n.ok || !s || s.object !== 'list' || !s.board) {
@@ -11266,64 +11431,64 @@ async function Xa(e, t, r = _()) {
11266
11431
  }
11267
11432
  function Te(e) {
11268
11433
  let t = e.toFixed(4).replace(/0+$/, '').replace(/\.$/, ''),
11269
- [r, i = ''] = t.split('.');
11270
- return `$${r}.${i.padEnd(2, '0')}`;
11434
+ [i, r = ''] = t.split('.');
11435
+ return `$${i}.${r.padEnd(2, '0')}`;
11271
11436
  }
11272
11437
  function X(e) {
11273
11438
  if (!e || typeof e.starter != 'number') return null;
11274
11439
  let t = typeof e.plus == 'number' ? e.plus : e.starter,
11275
- r = typeof e.scale == 'number' ? e.scale : t;
11276
- return `Starter ${Te(e.starter)} Plus ${Te(t)} Scale ${Te(r)}`;
11440
+ i = typeof e.scale == 'number' ? e.scale : t;
11441
+ return `Starter ${Te(e.starter)} Plus ${Te(t)} Scale ${Te(i)}`;
11277
11442
  }
11278
- function Wr(e) {
11279
- let t = zr[e];
11443
+ function Yi(e) {
11444
+ let t = Ji[e];
11280
11445
  return t ? ` (${t})` : '';
11281
11446
  }
11282
11447
  function ut(e) {
11283
11448
  let t = X(e.price) ?? '',
11284
- r = e.public ? ` ${a.dim(`(published Starter ${Te(e.public.starter)})`)}` : '';
11285
- return `${e.label}${Wr(e.table)} ${t}${r}`;
11449
+ i = e.public ? ` ${a.dim(`(published Starter ${Te(e.public.starter)})`)}` : '';
11450
+ return `${e.label}${Yi(e.table)} ${t}${i}`;
11286
11451
  }
11287
- function mt(e, t, r, i = !1) {
11288
- return `${e}|${i ? 'edit/' : ''}${t}|${r}`;
11452
+ function mt(e, t, i, r = !1) {
11453
+ return `${e}|${r ? 'edit/' : ''}${t}|${i}`;
11289
11454
  }
11290
- function Qa(e) {
11455
+ function rn(e) {
11291
11456
  let t = new Map();
11292
- for (let r of e ?? []) {
11293
- let i = r.addon ? `addon/${r.addon}` : (r.variant ?? '');
11294
- t.set(mt(r.slug, i, r.table, r.edit === !0), r);
11457
+ for (let i of e ?? []) {
11458
+ let r = i.addon ? `addon/${i.addon}` : (i.variant ?? '');
11459
+ t.set(mt(i.slug, r, i.table, i.edit === !0), i);
11295
11460
  }
11296
11461
  return t;
11297
11462
  }
11298
- function Za(e) {
11463
+ function an(e) {
11299
11464
  if (typeof e.label == 'string' && e.label.trim()) return e.label.trim();
11300
11465
  let t = [];
11301
- for (let r of ['endpoint', 'resolution', 'quality', 'mode', 'task', 'component', 'token']) {
11302
- let i = e[r];
11303
- i != null && i !== '' && t.push(String(i));
11466
+ for (let i of ['endpoint', 'resolution', 'quality', 'mode', 'task', 'component', 'token']) {
11467
+ let r = e[i];
11468
+ r != null && r !== '' && t.push(String(r));
11304
11469
  }
11305
11470
  return (
11306
11471
  e.withVideo === !0 && t.push('with video'),
11307
11472
  t.length ? t.join(' \xB7 ') : String(e.id ?? 'default')
11308
11473
  );
11309
11474
  }
11310
- function en(e, t, r, i, n) {
11311
- let s = Za(t);
11312
- for (let o of Wa) {
11313
- let p = X(Ya(t, o));
11475
+ function nn(e, t, i, r, n) {
11476
+ let s = an(t);
11477
+ for (let o of Qa) {
11478
+ let p = X(en(t, o));
11314
11479
  if (!p) continue;
11315
- let l = Wr(o);
11316
- r.push(` ${s}${l} ${p}`);
11317
- let c = i.get(mt(e, String(t.id ?? ''), o));
11318
- c && (n.add(c), r.push(` ${a.yellow('Your price')} ${X(c.price) ?? ''}`));
11480
+ let l = Yi(o);
11481
+ i.push(` ${s}${l} ${p}`);
11482
+ let c = r.get(mt(e, String(t.id ?? ''), o));
11483
+ c && (n.add(c), i.push(` ${a.yellow('Your price')} ${X(c.price) ?? ''}`));
11319
11484
  }
11320
11485
  }
11321
- function tn(e, t, r, i) {
11486
+ function sn(e, t, i, r) {
11322
11487
  let n = e.quality ? ` quality=${e.quality}` : '';
11323
11488
  t.push(
11324
11489
  ` ${a.bold(e.slug.padEnd(26))} ${a.gray(e.name)} ${a.dim(`${e.kind} ${e.unit} model=${e.model}${n}`)}`,
11325
11490
  );
11326
- for (let o of e.variants ?? []) en(e.slug, o, t, r, i);
11491
+ for (let o of e.variants ?? []) nn(e.slug, o, t, i, r);
11327
11492
  let s = e.addons;
11328
11493
  if (Array.isArray(s))
11329
11494
  for (let o of s) {
@@ -11332,27 +11497,27 @@ function tn(e, t, r, i) {
11332
11497
  l = typeof p.label == 'string' ? p.label : String(p.id ?? 'add-on'),
11333
11498
  c = X(p.price);
11334
11499
  c && t.push(` ${l} (add-on) ${c}`);
11335
- let d = r.get(mt(e.slug, `addon/${String(p.id ?? '')}`, 'price'));
11336
- c && d && (i.add(d), t.push(` ${a.yellow('Your price')} ${X(d.price) ?? ''}`));
11500
+ let d = i.get(mt(e.slug, `addon/${String(p.id ?? '')}`, 'price'));
11501
+ c && d && (r.add(d), t.push(` ${a.yellow('Your price')} ${X(d.price) ?? ''}`));
11337
11502
  }
11338
11503
  for (let o of Array.isArray(e.notes) ? e.notes : [])
11339
11504
  typeof o == 'string' && o.trim() && t.push(` ${a.dim(o.trim())}`);
11340
11505
  t.push('');
11341
11506
  }
11342
- function rn(e) {
11507
+ function on(e) {
11343
11508
  let t = [],
11344
- r = e.board.checked ? ` \xB7 checked ${e.board.checked}` : '';
11345
- (t.push(`${a.bold('Tein prices')} ${a.green(e.currency)} ${e.count} models${r}`),
11509
+ i = e.board.checked ? ` \xB7 checked ${e.board.checked}` : '';
11510
+ (t.push(`${a.bold('Tein prices')} ${a.green(e.currency)} ${e.count} models${i}`),
11346
11511
  t.push(
11347
11512
  `${a.dim('Starter, Plus and Scale. Creative mode, Priority and draft show only where published.')}`,
11348
11513
  ));
11349
- let i = e.your_prices?.rows ?? [];
11350
- (i.length &&
11514
+ let r = e.your_prices?.rows ?? [];
11515
+ (r.length &&
11351
11516
  t.push(
11352
11517
  `${a.yellow('Your price')} ${a.dim('rows are the prices your workspace pays instead of the published ones.')}`,
11353
11518
  ),
11354
11519
  t.push(''));
11355
- let n = Qa(i),
11520
+ let n = rn(r),
11356
11521
  s = new Set(),
11357
11522
  o = new Map();
11358
11523
  for (let m of e.board.models) {
@@ -11368,9 +11533,9 @@ function rn(e) {
11368
11533
  });
11369
11534
  for (let m of l) {
11370
11535
  t.push(`${a.bold(a.cyan(`\u2500\u2500 ${m} \u2500\u2500`))}`);
11371
- for (let g of o.get(m) ?? []) tn(g, t, n, s);
11536
+ for (let g of o.get(m) ?? []) sn(g, t, n, s);
11372
11537
  }
11373
- let c = i.filter((m) => !s.has(m));
11538
+ let c = r.filter((m) => !s.has(m));
11374
11539
  if (c.length) {
11375
11540
  t.push(`${a.bold(a.cyan('\u2500\u2500 your prices \u2500\u2500'))}`);
11376
11541
  for (let m of c)
@@ -11391,9 +11556,9 @@ function rn(e) {
11391
11556
  for (let [g, f] of m) {
11392
11557
  let A = String(f[0]?.modelName ?? g);
11393
11558
  t.push(` ${a.bold(g.padEnd(26))} ${a.gray(A)}`);
11394
- for (let U of f) {
11395
- let w = String(U.displayLabel ?? U.billingUnit ?? 'price'),
11396
- h = X(U.prices);
11559
+ for (let V of f) {
11560
+ let w = String(V.displayLabel ?? V.billingUnit ?? 'price'),
11561
+ h = X(V.prices);
11397
11562
  h && t.push(` ${w} ${h}`);
11398
11563
  }
11399
11564
  t.push('');
@@ -11406,13 +11571,13 @@ function rn(e) {
11406
11571
  `
11407
11572
  );
11408
11573
  }
11409
- async function Jr(e) {
11574
+ async function Xi(e) {
11410
11575
  let t;
11411
11576
  try {
11412
- t = await Xa(e.apiUrl, e.model);
11413
- } catch (r) {
11414
- let i = r instanceof Error ? r.message : String(r);
11415
- (process.stderr.write(`${a.red('Error:')} ${i}
11577
+ t = await tn(e.apiUrl, e.model);
11578
+ } catch (i) {
11579
+ let r = i instanceof Error ? i.message : String(i);
11580
+ (process.stderr.write(`${a.red('Error:')} ${r}
11416
11581
  `),
11417
11582
  process.exit(1));
11418
11583
  }
@@ -11420,58 +11585,58 @@ async function Jr(e) {
11420
11585
  e.json
11421
11586
  ? `${JSON.stringify(t, null, 2)}
11422
11587
  `
11423
- : rn(t),
11588
+ : on(t),
11424
11589
  );
11425
11590
  }
11426
- var an = 3e3;
11427
- async function Yr(e, t) {
11428
- let r = t ?? _();
11591
+ var ln = 3e3;
11592
+ async function Qi(e, t) {
11593
+ let i = t ?? _();
11429
11594
  try {
11430
- let i = await fetch(`${x(e)}/v1/pricing`, {
11431
- signal: AbortSignal.timeout(an),
11432
- ...(r ? { headers: { Authorization: `Bearer ${r}` } } : {}),
11595
+ let r = await fetch(`${x(e)}/v1/pricing`, {
11596
+ signal: AbortSignal.timeout(ln),
11597
+ ...(i ? { headers: { Authorization: `Bearer ${i}` } } : {}),
11433
11598
  });
11434
- if (!i.ok) return { live: !1, yourPrices: null };
11435
- let n = await i.json(),
11599
+ if (!r.ok) return { live: !1, yourPrices: null };
11600
+ let n = await r.json(),
11436
11601
  s = {};
11437
11602
  for (let p of n.configs ?? []) {
11438
11603
  let l = String(p.modelSlug ?? '');
11439
11604
  ce.has(l) && (s[l] ??= []).push(Number(p.starterPrice));
11440
11605
  }
11441
- (vr(s), Rr(n.price_texts));
11606
+ (Ti(s), qi(n.price_texts));
11442
11607
  let o = n.your_prices?.rows;
11443
11608
  return { live: !0, yourPrices: Array.isArray(o) ? o : null };
11444
11609
  } catch {
11445
11610
  return { live: !1, yourPrices: null };
11446
11611
  }
11447
11612
  }
11448
- function nn(e) {
11613
+ function pn(e) {
11449
11614
  return j(e.slug) ? e.slug : e.model;
11450
11615
  }
11451
- function Xr(e, t) {
11452
- return (t ?? []).filter((r) => r && nn(r) === e);
11616
+ function Zi(e, t) {
11617
+ return (t ?? []).filter((i) => i && pn(i) === e);
11453
11618
  }
11454
- var sn = new Set(['video', 'image', 'text', 'audio', '3d']),
11455
- on = { llm: 'text', chat: 'text', reasoning: 'text' };
11456
- async function Qr(e, t) {
11457
- let r = await Yr(t),
11458
- i = D();
11619
+ var dn = new Set(['video', 'image', 'text', 'audio', '3d']),
11620
+ cn = { llm: 'text', chat: 'text', reasoning: 'text' };
11621
+ async function er(e, t) {
11622
+ let i = await Qi(t),
11623
+ r = D();
11459
11624
  if (e) {
11460
11625
  let o = e.toLowerCase(),
11461
- p = on[o] ?? o;
11462
- i = sn.has(p)
11463
- ? i.filter((l) => l.category.toLowerCase() === p)
11464
- : i.filter((l) => l.kind.toLowerCase().includes(o) || l.slug.toLowerCase().includes(o));
11626
+ p = cn[o] ?? o;
11627
+ r = dn.has(p)
11628
+ ? r.filter((l) => l.category.toLowerCase() === p)
11629
+ : r.filter((l) => l.kind.toLowerCase().includes(o) || l.slug.toLowerCase().includes(o));
11465
11630
  }
11466
11631
  (process.stdout.write(`
11467
- ${a.bold('Tein AI Models Catalog')} (${i.length} available)
11632
+ ${a.bold('Tein AI Models Catalog')} (${r.length} available)
11468
11633
  `),
11469
11634
  process.stdout
11470
11635
  .write(`${a.dim('Run `tein info <model-slug>` to see detailed parameters and options.')}
11471
11636
 
11472
11637
  `));
11473
11638
  let n = {};
11474
- for (let o of i) {
11639
+ for (let o of r) {
11475
11640
  let p = o.category;
11476
11641
  (n[p] || (n[p] = []), n[p].push(o));
11477
11642
  }
@@ -11485,7 +11650,7 @@ ${a.bold('Tein AI Models Catalog')} (${i.length} available)
11485
11650
  let c = l.slug.padEnd(24),
11486
11651
  d = l.name.padEnd(22),
11487
11652
  u = l.priceFormatted.padEnd(22),
11488
- m = Xr(l.slug, r.yourPrices).length ? ` ${a.yellow('Your price')}` : '';
11653
+ m = Zi(l.slug, i.yourPrices).length ? ` ${a.yellow('Your price')}` : '';
11489
11654
  process.stdout.write(` ${a.bold(c)} ${a.gray(d)} ${a.green(u)} ${a.dim(l.vendor)}${m}
11490
11655
  `);
11491
11656
  }
@@ -11493,11 +11658,11 @@ ${a.bold('Tein AI Models Catalog')} (${i.length} available)
11493
11658
  `);
11494
11659
  }
11495
11660
  }
11496
- (r.yourPrices?.length &&
11661
+ (i.yourPrices?.length &&
11497
11662
  process.stdout
11498
11663
  .write(`${a.yellow('Your price:')} your workspace has its own prices on these models. See ${a.cyan('tein info <model-slug>')} or ${a.cyan('tein pricing <model-slug>')}.
11499
11664
  `),
11500
- r.live ||
11665
+ i.live ||
11501
11666
  process.stdout
11502
11667
  .write(`${a.dim('Prices could not be checked online; showing the prices this CLI was built with.')}
11503
11668
  `),
@@ -11506,47 +11671,47 @@ ${a.bold('Tein AI Models Catalog')} (${i.length} available)
11506
11671
 
11507
11672
  `));
11508
11673
  }
11509
- async function Zr(e, t) {
11510
- let r = j(e);
11511
- r ||
11674
+ async function tr(e, t) {
11675
+ let i = j(e);
11676
+ i ||
11512
11677
  (process.stderr.write(`${a.red('Error:')} Model "${e}" not found in Tein AI registry.
11513
11678
  `),
11514
11679
  process.stderr.write(`Run ${a.cyan('tein models')} to see all available model slugs.
11515
11680
  `),
11516
11681
  process.exit(1));
11517
- let i = await Yr(t);
11682
+ let r = await Qi(t);
11518
11683
  (process.stdout.write(`
11519
- ${a.bold(a.cyan(r.name))} (${a.bold(r.slug)})
11684
+ ${a.bold(a.cyan(i.name))} (${a.bold(i.slug)})
11520
11685
  `),
11521
- process.stdout.write(` ${a.gray(r.description)}
11686
+ process.stdout.write(` ${a.gray(i.description)}
11522
11687
 
11523
11688
  `),
11524
11689
  process.stdout.write(`${a.bold('Metadata:')}
11525
11690
  `),
11526
- process.stdout.write(` Category: ${a.yellow(r.category)}
11691
+ process.stdout.write(` Category: ${a.yellow(i.category)}
11527
11692
  `),
11528
- process.stdout.write(` Kind: ${r.kind}
11693
+ process.stdout.write(` Kind: ${i.kind}
11529
11694
  `),
11530
- process.stdout.write(` Vendor: ${r.vendor}
11695
+ process.stdout.write(` Vendor: ${i.vendor}
11531
11696
  `),
11532
- process.stdout.write(` Pricing: ${a.green(r.priceFormatted)}
11697
+ process.stdout.write(` Pricing: ${a.green(i.priceFormatted)}
11533
11698
  `));
11534
- for (let n of r.priceNotes ?? [])
11699
+ for (let n of i.priceNotes ?? [])
11535
11700
  process.stdout.write(` ${a.dim(n)}
11536
11701
  `);
11537
- for (let n of Xr(r.slug, i.yourPrices)) {
11538
- let s = n.slug === r.slug ? n : { ...n, label: `${n.name} \xB7 ${n.label}` };
11702
+ for (let n of Zi(i.slug, r.yourPrices)) {
11703
+ let s = n.slug === i.slug ? n : { ...n, label: `${n.name} \xB7 ${n.label}` };
11539
11704
  process.stdout.write(` ${a.yellow('Your price:')} ${ut(s)}
11540
11705
  `);
11541
11706
  }
11542
- (i.live ||
11707
+ (r.live ||
11543
11708
  process.stdout.write(` ${a.dim('(the price this CLI was built with: offline)')}
11544
11709
  `),
11545
11710
  process.stdout.write(`
11546
11711
  `),
11547
11712
  process.stdout.write(`${a.bold('Parameters:')}
11548
11713
  `));
11549
- for (let n of r.parameters) {
11714
+ for (let n of i.parameters) {
11550
11715
  let s = n.required ? a.red('(required)') : a.dim('(optional)'),
11551
11716
  o = n.default !== void 0 ? a.dim(` [default: ${n.default}]`) : '';
11552
11717
  (process.stdout
@@ -11566,7 +11731,7 @@ ${a.bold(a.cyan(r.name))} (${a.bold(r.slug)})
11566
11731
  `));
11567
11732
  }
11568
11733
  if (
11569
- (r.parameters.some((n) => n.name === 'callback_url') ||
11734
+ (i.parameters.some((n) => n.name === 'callback_url') ||
11570
11735
  (process.stdout
11571
11736
  .write(` ${a.bold('--callback-url')} ${a.yellow('<string>')} ${a.dim('(optional)')}
11572
11737
  `),
@@ -11576,35 +11741,35 @@ ${a.bold(a.cyan(r.name))} (${a.bold(r.slug)})
11576
11741
  `)),
11577
11742
  process.stdout.write(`${a.bold('Sample CLI Usage:')}
11578
11743
  `),
11579
- r.category === 'Video')
11744
+ i.category === 'Video')
11580
11745
  )
11581
11746
  process.stdout
11582
- .write(` ${a.cyan(`tein run ${r.slug} --prompt "Cinematic camera drone shot of a coastline" --aspect-ratio 16:9 --duration 5 -o output.mp4`)}
11747
+ .write(` ${a.cyan(`tein run ${i.slug} --prompt "Cinematic camera drone shot of a coastline" --aspect-ratio 16:9 --duration 5 -o output.mp4`)}
11583
11748
 
11584
11749
  `);
11585
- else if (r.category === 'Image') {
11586
- let n = r.parameters.some((s) => s.name === 'aspect_ratio') ? ' --aspect-ratio 16:9' : '';
11750
+ else if (i.category === 'Image') {
11751
+ let n = i.parameters.some((s) => s.name === 'aspect_ratio') ? ' --aspect-ratio 16:9' : '';
11587
11752
  process.stdout
11588
- .write(` ${a.cyan(`tein run ${r.slug} --prompt "Cyberpunk city in the rain, 8k render"${n} -o output.png`)}
11753
+ .write(` ${a.cyan(`tein run ${i.slug} --prompt "Cyberpunk city in the rain, 8k render"${n} -o output.png`)}
11589
11754
 
11590
11755
  `);
11591
11756
  } else
11592
- r.category === 'Audio'
11757
+ i.category === 'Audio'
11593
11758
  ? process.stdout
11594
- .write(` ${a.cyan(`tein run ${r.slug} --prompt "Hello world from Tein AI" --speaker en_female_warm -o speech.wav`)}
11759
+ .write(` ${a.cyan(`tein run ${i.slug} --prompt "Hello world from Tein AI" --speaker en_female_warm -o speech.wav`)}
11595
11760
 
11596
11761
  `)
11597
11762
  : process.stdout
11598
- .write(` ${a.cyan(`tein run ${r.slug} --prompt "Explain quantum computing in simple terms"`)}
11763
+ .write(` ${a.cyan(`tein run ${i.slug} --prompt "Explain quantum computing in simple terms"`)}
11599
11764
 
11600
11765
  `);
11601
11766
  }
11602
- var ei = M(require('node:path'));
11767
+ var ir = M(require('node:path'));
11603
11768
  R();
11604
- async function ti(e, t) {
11605
- let r = _(typeof t.api_key == 'string' ? t.api_key : void 0),
11606
- i = x(typeof t.api_url == 'string' ? t.api_url : void 0);
11607
- (r ||
11769
+ async function rr(e, t) {
11770
+ let i = _(typeof t.api_key == 'string' ? t.api_key : void 0),
11771
+ r = x(typeof t.api_url == 'string' ? t.api_url : void 0);
11772
+ (i ||
11608
11773
  (process.stderr.write(`${a.red('Error:')} Authentication required.
11609
11774
  `),
11610
11775
  process.stderr
@@ -11620,7 +11785,7 @@ async function ti(e, t) {
11620
11785
  let n = !!t.json,
11621
11786
  s = !!t.wait,
11622
11787
  o = typeof t.output == 'string' ? t.output : void 0,
11623
- p = new K(r, i),
11788
+ p = new K(i, r),
11624
11789
  l = new C(`Checking status of ${a.bold(e)}...`);
11625
11790
  n || l.start();
11626
11791
  let c;
@@ -11696,7 +11861,7 @@ ${a.bold('Outputs:')}
11696
11861
  ) {
11697
11862
  let u = new C(`Downloading output to ${o}...`).start();
11698
11863
  try {
11699
- (await p.downloadOutput(d.url, ei.default.resolve(process.cwd(), o)),
11864
+ (await p.downloadOutput(d.url, ir.default.resolve(process.cwd(), o)),
11700
11865
  u.succeed(`Saved to ${a.bold(o)}`));
11701
11866
  } catch (m) {
11702
11867
  u.fail(`Failed to download: ${m instanceof Error ? m.message : m}`);
@@ -11714,11 +11879,11 @@ ${d.text}
11714
11879
  var ft = M(require('node:fs')),
11715
11880
  gt = M(require('node:path'));
11716
11881
  R();
11717
- async function ri(e, t = {}) {
11718
- let r = _(typeof t.api_key == 'string' ? t.api_key : void 0),
11719
- i = x(typeof t.api_url == 'string' ? t.api_url : void 0),
11882
+ async function ar(e, t = {}) {
11883
+ let i = _(typeof t.api_key == 'string' ? t.api_key : void 0),
11884
+ r = x(typeof t.api_url == 'string' ? t.api_url : void 0),
11720
11885
  n = !!t.json;
11721
- (r ||
11886
+ (i ||
11722
11887
  (process.stderr.write(`${a.red('Error:')} Authentication required.
11723
11888
  `),
11724
11889
  process.stderr
@@ -11738,7 +11903,7 @@ async function ri(e, t = {}) {
11738
11903
  process.exit(1));
11739
11904
  let o = gt.default.basename(s),
11740
11905
  l = ft.default.readFileSync(s).toString('base64'),
11741
- c = new K(r, i),
11906
+ c = new K(i, r),
11742
11907
  d = new C(`Uploading ${a.bold(o)} to Tein AI CDN...`);
11743
11908
  n || d.start();
11744
11909
  try {
@@ -11779,9 +11944,9 @@ ${a.bold('CDN URL:')} ${a.green(u.url)}
11779
11944
  }
11780
11945
  }
11781
11946
  oe();
11782
- ie();
11947
+ re();
11783
11948
  Fe();
11784
- function bi() {
11949
+ function xr() {
11785
11950
  process.stdout.write(`
11786
11951
  ${a.bold(a.cyan('Tein AI CLI'))} - Official Command-Line Interface for Tein AI models
11787
11952
 
@@ -11863,11 +12028,11 @@ ${a.bold('EXAMPLES:')}
11863
12028
 
11864
12029
  `);
11865
12030
  }
11866
- async function Sn() {
12031
+ async function Cn() {
11867
12032
  let e = process.argv.slice(2),
11868
- t = Dr(e);
12033
+ t = Vi(e);
11869
12034
  if (t.flags.has('help') || t.options.help || t.command === 'help') {
11870
- bi();
12035
+ xr();
11871
12036
  return;
11872
12037
  }
11873
12038
  if (t.flags.has('version') || t.options.version || t.command === 'version') {
@@ -11894,15 +12059,15 @@ async function Sn() {
11894
12059
  }
11895
12060
  case 'models':
11896
12061
  case 'list': {
11897
- await Qr(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0);
12062
+ await er(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0);
11898
12063
  break;
11899
12064
  }
11900
12065
  case 'pricing':
11901
12066
  case 'prices': {
11902
- let r = t.options.model,
11903
- i = t.subcommand || (typeof r == 'string' ? r : void 0);
11904
- await Jr({
11905
- model: i,
12067
+ let i = t.options.model,
12068
+ r = t.subcommand || (typeof i == 'string' ? i : void 0);
12069
+ await Xi({
12070
+ model: r,
11906
12071
  json: !!t.options.json,
11907
12072
  apiUrl: typeof t.options.api_url == 'string' ? t.options.api_url : void 0,
11908
12073
  });
@@ -11916,41 +12081,41 @@ async function Sn() {
11916
12081
  process.stderr.write(`Usage: ${a.cyan('tein info <model-slug>')}
11917
12082
  `),
11918
12083
  process.exit(1)),
11919
- await Zr(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0));
12084
+ await tr(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0));
11920
12085
  break;
11921
12086
  }
11922
12087
  case 'upload': {
11923
- let r = t.subcommand || '';
11924
- await ri(r, t.options);
12088
+ let i = t.subcommand || '';
12089
+ await ar(i, t.options);
11925
12090
  break;
11926
12091
  }
11927
12092
  case 'run':
11928
12093
  case 'generate': {
11929
- let r = t.subcommand || '';
11930
- await pt(r, t.options);
12094
+ let i = t.subcommand || '';
12095
+ await pt(i, t.options);
11931
12096
  break;
11932
12097
  }
11933
12098
  case 'status': {
11934
- let r = t.subcommand || '';
11935
- await ti(r, t.options);
12099
+ let i = t.subcommand || '';
12100
+ await rr(i, t.options);
11936
12101
  break;
11937
12102
  }
11938
12103
  case 'balance': {
11939
- await Vr(t.options);
12104
+ await Bi(t.options);
11940
12105
  break;
11941
12106
  }
11942
12107
  case 'usage': {
11943
- await Gr(t.options);
12108
+ await zi(t.options);
11944
12109
  break;
11945
12110
  }
11946
12111
  case 'transactions':
11947
12112
  case 'history': {
11948
- await Hr(t.options);
12113
+ await Wi(t.options);
11949
12114
  break;
11950
12115
  }
11951
12116
  case 'mcp': {
11952
- let { startStdioServer: r } = await Promise.resolve().then(() => (yi(), hi));
11953
- await r();
12117
+ let { startStdioServer: i } = await Promise.resolve().then(() => (wr(), br));
12118
+ await i();
11954
12119
  break;
11955
12120
  }
11956
12121
  default: {
@@ -11965,12 +12130,12 @@ Run ${a.cyan('tein --help')} for the commands, or ${a.cyan('tein models')} for t
11965
12130
  await pt(t.command, t.options));
11966
12131
  return;
11967
12132
  }
11968
- bi();
12133
+ xr();
11969
12134
  break;
11970
12135
  }
11971
12136
  }
11972
12137
  }
11973
- Sn().catch((e) => {
12138
+ Cn().catch((e) => {
11974
12139
  (e instanceof b &&
11975
12140
  (process.stderr.write(`
11976
12141
  ${a.red('Error:')} ${E(e).join(`