@teinai/cli 1.1.19 → 1.1.20

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 +768 -639
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
- var ir = Object.create;
4
- var he = Object.defineProperty;
5
- var ar = Object.getOwnPropertyDescriptor;
6
- var sr = Object.getOwnPropertyNames;
7
- var nr = Object.getPrototypeOf,
8
- or = Object.prototype.hasOwnProperty;
9
- var b = (e, t, r) => () => {
3
+ var sr = Object.create;
4
+ var ye = Object.defineProperty;
5
+ var nr = Object.getOwnPropertyDescriptor;
6
+ var or = Object.getOwnPropertyNames;
7
+ var lr = Object.getPrototypeOf,
8
+ pr = Object.prototype.hasOwnProperty;
9
+ var y = (e, t, r) => () => {
10
10
  if (r) throw r[0];
11
11
  try {
12
12
  return (e && (t = e((e = 0))), t);
@@ -14,94 +14,94 @@ var b = (e, t, r) => () => {
14
14
  throw ((r = [i]), i);
15
15
  }
16
16
  };
17
- var lr = (e, t) => {
18
- for (var r in t) he(e, r, { get: t[r], enumerable: !0 });
17
+ var dr = (e, t) => {
18
+ for (var r in t) ye(e, r, { get: t[r], enumerable: !0 });
19
19
  },
20
- pr = (e, t, r, i) => {
20
+ cr = (e, t, r, i) => {
21
21
  if ((t && typeof t == 'object') || typeof t == 'function')
22
- for (let s of sr(t))
23
- !or.call(e, s) &&
22
+ for (let s of or(t))
23
+ !pr.call(e, s) &&
24
24
  s !== r &&
25
- he(e, s, { get: () => t[s], enumerable: !(i = ar(t, s)) || i.enumerable });
25
+ ye(e, s, { get: () => t[s], enumerable: !(i = nr(t, s)) || i.enumerable });
26
26
  return e;
27
27
  };
28
- var P = (e, t, r) => (
29
- (r = e != null ? ir(nr(e)) : {}),
30
- pr(t || !e || !e.__esModule ? he(r, 'default', { value: e, enumerable: !0 }) : r, e)
28
+ var T = (e, t, r) => (
29
+ (r = e != null ? sr(lr(e)) : {}),
30
+ cr(t || !e || !e.__esModule ? ye(r, 'default', { value: e, enumerable: !0 }) : r, e)
31
31
  );
32
- function V() {
32
+ function U() {
33
33
  try {
34
- if ($.default.existsSync(L)) {
35
- let e = $.default.readFileSync(L, 'utf-8');
34
+ if (E.default.existsSync(N)) {
35
+ let e = E.default.readFileSync(N, 'utf-8');
36
36
  return JSON.parse(e);
37
37
  }
38
38
  } catch {}
39
39
  return {};
40
40
  }
41
- function be(e) {
41
+ function ke(e) {
42
42
  try {
43
- $.default.existsSync(te) || $.default.mkdirSync(te, { recursive: !0, mode: 448 });
44
- let r = { ...V(), ...e };
45
- ($.default.writeFileSync(L, JSON.stringify(r, null, 2), { encoding: 'utf-8', mode: 384 }),
46
- $.default.chmodSync(te, 448),
47
- $.default.chmodSync(L, 384));
43
+ E.default.existsSync(te) || E.default.mkdirSync(te, { recursive: !0, mode: 448 });
44
+ let r = { ...U(), ...e };
45
+ (E.default.writeFileSync(N, JSON.stringify(r, null, 2), { encoding: 'utf-8', mode: 384 }),
46
+ E.default.chmodSync(te, 448),
47
+ E.default.chmodSync(N, 384));
48
48
  } catch (t) {
49
- throw new Error(`Failed to save config to ${L}: ${t}`);
49
+ throw new Error(`Failed to save config to ${N}: ${t}`);
50
50
  }
51
51
  }
52
- function S(e) {
52
+ function q(e) {
53
53
  if (e && e.trim()) return e.trim();
54
54
  let t = process.env.TEIN_API_KEY || process.env.TEIN_KEY;
55
55
  if (t && t.trim()) return t.trim();
56
- let r = V();
56
+ let r = U();
57
57
  return r.apiKey && r.apiKey.trim() ? r.apiKey.trim() : '';
58
58
  }
59
- function x(e) {
59
+ function P(e) {
60
60
  if (e && e.trim()) return e.trim().replace(/\/+$/, '');
61
61
  let t = process.env.TEIN_API_URL;
62
62
  if (t && t.trim()) return t.trim().replace(/\/+$/, '');
63
- let r = V();
63
+ let r = U();
64
64
  return r.apiUrl && r.apiUrl.trim() ? r.apiUrl.trim().replace(/\/+$/, '') : 'https://api.tein.ai';
65
65
  }
66
66
  function re() {
67
- return L;
67
+ return N;
68
68
  }
69
- var $,
70
- Qe,
71
- ye,
69
+ var E,
70
+ Ze,
71
+ be,
72
72
  te,
73
- L,
74
- C = b(() => {
73
+ N,
74
+ A = y(() => {
75
75
  'use strict';
76
- (($ = P(require('node:fs'))),
77
- (Qe = P(require('node:os'))),
78
- (ye = P(require('node:path'))),
79
- (te = ye.default.join(Qe.default.homedir(), '.tein')),
80
- (L = ye.default.join(te, 'config.json')));
76
+ ((E = T(require('node:fs'))),
77
+ (Ze = T(require('node:os'))),
78
+ (be = T(require('node:path'))),
79
+ (te = be.default.join(Ze.default.homedir(), '.tein')),
80
+ (N = be.default.join(te, 'config.json')));
81
81
  });
82
- var gr,
83
- Xe,
84
- Ze,
85
- et = b(() => {
82
+ var yr,
83
+ et,
84
+ tt,
85
+ rt = y(() => {
86
86
  'use strict';
87
- ((gr = ['1:1', '16:9', '9:16', '21:9', '3:2', '2:3', '4:3', '3:4']),
88
- (Xe = [...gr, 'auto']),
89
- (Ze =
87
+ ((yr = ['1:1', '16:9', '9:16', '21:9', '3:2', '2:3', '4:3', '3:4']),
88
+ (et = [...yr, 'auto']),
89
+ (tt =
90
90
  'The medium endpoint renders non-square images at 1K only. Use resolution 1K, aspect_ratio 1:1, or the dynamic endpoint for a non-square 2K or 4K image.'));
91
91
  });
92
- var j,
93
- we = b(() => {
92
+ var G,
93
+ xe = y(() => {
94
94
  'use strict';
95
- j = new Set(['nano-banana-2.1', 'seedance-2-lite', 'seedance-2-5-lite']);
95
+ G = new Set(['nano-banana-2.1', 'seedance-2-lite', 'seedance-2-5-lite']);
96
96
  });
97
97
  function ie(e) {
98
98
  return !1;
99
99
  }
100
- var tt = b(() => {
100
+ var it = y(() => {
101
101
  'use strict';
102
102
  });
103
103
  var ae,
104
- rt = b(() => {
104
+ at = y(() => {
105
105
  'use strict';
106
106
  ae = {
107
107
  source: 'TEIN Price Board',
@@ -134,7 +134,7 @@ var ae,
134
134
  'seedance-2-mini',
135
135
  ],
136
136
  },
137
- { slug: 'seedream', name: 'Seedream', models: ['seedream-5-pro'] },
137
+ { slug: 'seedream', name: 'Seedream', models: ['seedream-5-pro', 'seedream-5-5'] },
138
138
  { slug: 'seed', name: 'Seed', models: ['seed-audio-1-0', 'seed-2-1-turbo'] },
139
139
  { slug: 'wan', name: 'Wan', models: ['wan-3-0', 'wan-3-0-prime'] },
140
140
  { slug: 'happy-horse', name: 'HappyHorse', models: ['happy-horse-1-1', 'happy-horse-1-0'] },
@@ -1256,6 +1256,53 @@ var ae,
1256
1256
  axes: { resolution: ['1K', '2K'] },
1257
1257
  from: { variant: '1k' },
1258
1258
  },
1259
+ {
1260
+ slug: 'seedream-5-5',
1261
+ name: 'Seedream 5.5',
1262
+ family: 'seedream',
1263
+ vendor: 'ByteDance',
1264
+ desc: "ByteDance's newest image model: sharper realism and steadier multi-turn edits than 5.0 Pro, native transparent PNGs, and layer decomposition into a base image and up to 99 editable layers with typeset-text recognition. Creative mode available. Every input image is billed.",
1265
+ kind: 'image',
1266
+ unit: '/img',
1267
+ api: { model: 'seedream-5-5' },
1268
+ variants: [
1269
+ {
1270
+ id: '1k',
1271
+ price: { starter: 0.012, plus: 0.0114, scale: 0.0102 },
1272
+ label: '1K',
1273
+ resolution: '1K',
1274
+ unfiltered: { starter: 0.0126, plus: 0.0119, scale: 0.0107 },
1275
+ },
1276
+ {
1277
+ id: '1.5k',
1278
+ price: { starter: 0.012, plus: 0.0114, scale: 0.0102 },
1279
+ label: '1.5K',
1280
+ resolution: '1.5K',
1281
+ unfiltered: { starter: 0.0126, plus: 0.0119, scale: 0.0107 },
1282
+ },
1283
+ {
1284
+ id: '2k',
1285
+ price: { starter: 0.021, plus: 0.0199, scale: 0.0178 },
1286
+ label: '2K',
1287
+ resolution: '2K',
1288
+ unfiltered: { starter: 0.022, plus: 0.0208, scale: 0.0186 },
1289
+ },
1290
+ ],
1291
+ unfiltered: 0.05,
1292
+ priority: null,
1293
+ draft: null,
1294
+ addons: [
1295
+ {
1296
+ id: 'image-input',
1297
+ price: { starter: 0.0048, plus: 0.0045, scale: 0.004 },
1298
+ label: 'Each input image',
1299
+ unit: '/input image',
1300
+ unfiltered: { starter: 0.005, plus: 0.0047, scale: 0.0042 },
1301
+ },
1302
+ ],
1303
+ axes: { resolution: ['1K', '1.5K', '2K'] },
1304
+ from: { variant: '1k' },
1305
+ },
1259
1306
  {
1260
1307
  slug: 'seed-audio-1-0',
1261
1308
  name: 'Seed Audio 1.0',
@@ -5555,11 +5602,11 @@ var ae,
5555
5602
  ],
5556
5603
  };
5557
5604
  });
5558
- var it,
5605
+ var st,
5559
5606
  se,
5560
- xe = b(() => {
5607
+ Ie = y(() => {
5561
5608
  'use strict';
5562
- ((it = { slug: 'tein', name: 'Tein', models: ['tein-video-upscaler'] }),
5609
+ ((st = { slug: 'tein', name: 'Tein', models: ['tein-video-upscaler'] }),
5563
5610
  (se = [
5564
5611
  {
5565
5612
  slug: 'tein-video-upscaler',
@@ -5598,10 +5645,10 @@ var it,
5598
5645
  },
5599
5646
  ]));
5600
5647
  });
5601
- function _e(e, t) {
5648
+ function Me(e, t) {
5602
5649
  return `${e.trim().toLowerCase()}|${(t ?? '').trim().toLowerCase()}`;
5603
5650
  }
5604
- function br(e, t) {
5651
+ function wr(e, t) {
5605
5652
  if (e === 'seedance-2-mini') return 'mini';
5606
5653
  if (e !== 'seedance-2') return;
5607
5654
  let r = typeof t?.quality == 'string' ? t.quality.trim().toLowerCase() : '';
@@ -5611,86 +5658,86 @@ function br(e, t) {
5611
5658
  ? 'fast'
5612
5659
  : 'standard';
5613
5660
  }
5614
- function kr(e, t) {
5661
+ function xr(e, t) {
5615
5662
  let r = e
5616
5663
  .trim()
5617
5664
  .toLowerCase()
5618
5665
  .replace(/-(?:unfiltered|uncensored)$/, '');
5619
5666
  if (r === 'seedance-2' || r === 'seedance-2-mini') {
5620
- let s = br(r, t),
5621
- n = Te.get(_e('seedance-2', s));
5667
+ let s = wr(r, t),
5668
+ n = ve.get(Me('seedance-2', s));
5622
5669
  return n ? n.slug : null;
5623
5670
  }
5624
- let i = ne.get(r) ?? Te.get(_e(r));
5671
+ let i = ne.get(r) ?? ve.get(Me(r));
5625
5672
  return i ? i.slug : null;
5626
5673
  }
5627
- function xr(e, t) {
5628
- return ne.has(e) && !(wr.has(e) && t) ? e : kr(e, t);
5674
+ function Pr(e, t) {
5675
+ return ne.has(e) && !(Ir.has(e) && t) ? e : xr(e, t);
5629
5676
  }
5630
- function G(e, t) {
5631
- let r = xr(e, t);
5677
+ function z(e, t) {
5678
+ let r = Pr(e, t);
5632
5679
  return r ? (ne.get(r) ?? null) : null;
5633
5680
  }
5634
5681
  function oe() {
5635
- return st;
5682
+ return ot;
5636
5683
  }
5637
- var Ie,
5638
- Pe,
5639
- st,
5640
- hr,
5641
- ne,
5684
+ var Pe,
5642
5685
  Te,
5643
- at,
5644
- yr,
5686
+ ot,
5687
+ br,
5688
+ ne,
5645
5689
  ve,
5646
- wr,
5647
- N = b(() => {
5690
+ nt,
5691
+ kr,
5692
+ _e,
5693
+ Ir,
5694
+ B = y(() => {
5648
5695
  'use strict';
5649
- tt();
5650
- rt();
5651
- xe();
5652
- ((Ie = {
5696
+ it();
5697
+ at();
5698
+ Ie();
5699
+ ((Pe = {
5653
5700
  ...ae,
5654
5701
  families: ae.families.map((e) => ({ ...e, models: e.models.filter((t) => !ie(t)) })),
5655
5702
  models: ae.models.filter((e) => !ie(e.slug)),
5656
5703
  }),
5657
- (Pe = se.filter((e) => !ie(e.slug))),
5658
- (st = [...Ie.models, ...Pe]),
5659
- (hr = Pe.length ? [...Ie.families, { ...it, models: Pe.map((e) => e.slug) }] : Ie.families),
5704
+ (Te = se.filter((e) => !ie(e.slug))),
5705
+ (ot = [...Pe.models, ...Te]),
5706
+ (br = Te.length ? [...Pe.families, { ...st, models: Te.map((e) => e.slug) }] : Pe.families),
5660
5707
  (ne = new Map()),
5661
- (Te = new Map()),
5662
- (at = new Map()),
5663
- (yr = new Map()),
5664
- (ve = new Map()));
5665
- for (let e of st) {
5666
- (ne.set(e.slug, e), Te.set(_e(e.api.model, e.api.quality), e));
5667
- for (let t of e.variants) at.set(`${e.slug}/${t.id}`, { model: e, variant: t, edit: !1 });
5708
+ (ve = new Map()),
5709
+ (nt = new Map()),
5710
+ (kr = new Map()),
5711
+ (_e = new Map()));
5712
+ for (let e of ot) {
5713
+ (ne.set(e.slug, e), ve.set(Me(e.api.model, e.api.quality), e));
5714
+ for (let t of e.variants) nt.set(`${e.slug}/${t.id}`, { model: e, variant: t, edit: !1 });
5668
5715
  for (let t of e.editVariants ?? [])
5669
- at.set(`${e.slug}/edit/${t.id}`, { model: e, variant: t, edit: !0 });
5670
- for (let t of e.addons ?? []) yr.set(`${e.slug}/addon/${t.id}`, { model: e, addon: t });
5671
- ve.set(e.slug, e.family);
5716
+ nt.set(`${e.slug}/edit/${t.id}`, { model: e, variant: t, edit: !0 });
5717
+ for (let t of e.addons ?? []) kr.set(`${e.slug}/addon/${t.id}`, { model: e, addon: t });
5718
+ _e.set(e.slug, e.family);
5672
5719
  }
5673
- for (let e of hr) for (let t of e.models) ve.has(t) || ve.set(t, e.slug);
5674
- wr = new Set(['seedance-2']);
5720
+ for (let e of br) for (let t of e.models) _e.has(t) || _e.set(t, e.slug);
5721
+ Ir = new Set(['seedance-2']);
5675
5722
  });
5676
5723
  function le(e) {
5677
5724
  let t = e.from?.variant;
5678
5725
  return (t && e.variants.find((r) => r.id === t)) || e.variants[0];
5679
5726
  }
5680
- function Me(e) {
5727
+ function Ke(e) {
5681
5728
  if (e.endpoints?.length)
5682
- return e.editVariants?.length && e.endpoints.some((t) => t.id === nt)
5683
- ? nt
5729
+ return e.editVariants?.length && e.endpoints.some((t) => t.id === lt)
5730
+ ? lt
5684
5731
  : (e.defaultEndpoint ?? e.endpoints[0].id);
5685
5732
  }
5686
- var nt,
5687
- Ke = b(() => {
5733
+ var lt,
5734
+ Se = y(() => {
5688
5735
  'use strict';
5689
- N();
5690
- nt = 'dynamic';
5736
+ B();
5737
+ lt = 'dynamic';
5691
5738
  });
5692
5739
  var pe,
5693
- Se = b(() => {
5740
+ qe = y(() => {
5694
5741
  'use strict';
5695
5742
  pe = {
5696
5743
  'gemini-3-8-flash': 'gemini-3.8-flash',
@@ -5702,29 +5749,29 @@ var pe,
5702
5749
  'gpt-image-2-6-sunburst': 'gpt-image-2.6-sunburst',
5703
5750
  };
5704
5751
  });
5705
- var ot = b(() => {
5752
+ var pt = y(() => {
5706
5753
  'use strict';
5707
5754
  });
5708
- function lt(e, t) {
5709
- return typeof t == 'string' && (Ir[e]?.includes(t) ?? !1);
5755
+ function dt(e, t) {
5756
+ return typeof t == 'string' && (Tr[e]?.includes(t) ?? !1);
5710
5757
  }
5711
- var Ir,
5712
- pt = b(() => {
5758
+ var Tr,
5759
+ ct = y(() => {
5713
5760
  'use strict';
5714
- N();
5715
- Ke();
5716
- ot();
5717
- Ir = {};
5761
+ B();
5762
+ Se();
5763
+ pt();
5764
+ Tr = {};
5718
5765
  });
5719
- function dt(e) {
5720
- return e === 'nano-banana-pro' ? Pr : Tr;
5766
+ function ut(e) {
5767
+ return e === 'nano-banana-pro' ? vr : _r;
5721
5768
  }
5722
- var Pr,
5723
- Tr,
5724
- ct = b(() => {
5769
+ var vr,
5770
+ _r,
5771
+ mt = y(() => {
5725
5772
  'use strict';
5726
- ((Pr = ['auto', '1:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9']),
5727
- (Tr = [
5773
+ ((vr = ['auto', '1:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9']),
5774
+ (_r = [
5728
5775
  'auto',
5729
5776
  '1:1',
5730
5777
  '1:4',
@@ -5742,10 +5789,10 @@ var Pr,
5742
5789
  '21:9',
5743
5790
  ]));
5744
5791
  });
5745
- var ut,
5746
- mt = b(() => {
5792
+ var ft,
5793
+ gt = y(() => {
5747
5794
  'use strict';
5748
- ut = [
5795
+ ft = [
5749
5796
  'prompt',
5750
5797
  'system',
5751
5798
  'messages',
@@ -5759,10 +5806,10 @@ var ut,
5759
5806
  'endpoint',
5760
5807
  ];
5761
5808
  });
5762
- var ft,
5763
- gt = b(() => {
5809
+ var ht,
5810
+ yt = y(() => {
5764
5811
  'use strict';
5765
- ft = [
5812
+ ht = [
5766
5813
  {
5767
5814
  slug: 'claude-fable-5-1',
5768
5815
  family: 'fable-5-1',
@@ -5831,13 +5878,13 @@ var ft,
5831
5878
  },
5832
5879
  ];
5833
5880
  });
5834
- function ht(e) {
5881
+ function bt(e) {
5835
5882
  return `$${e}`;
5836
5883
  }
5837
- function qe(e, t, r) {
5838
- return G(e)?.variants.find((s) => s.endpoint === t && s.component === r)?.price.starter ?? null;
5884
+ function $e(e, t, r) {
5885
+ return z(e)?.variants.find((s) => s.endpoint === t && s.component === r)?.price.starter ?? null;
5839
5886
  }
5840
- function vr(e) {
5887
+ function Mr(e) {
5841
5888
  return [
5842
5889
  {
5843
5890
  name: 'prompt',
@@ -5903,13 +5950,13 @@ function vr(e) {
5903
5950
  },
5904
5951
  ];
5905
5952
  }
5906
- function yt() {
5953
+ function kt() {
5907
5954
  return Object.fromEntries(
5908
- ft.map((e) => {
5909
- let t = qe(e.slug, 'cheap', 'input'),
5910
- r = qe(e.slug, 'cheap', 'output'),
5911
- i = qe(e.slug, 'stable', 'input') != null,
5912
- s = t != null && r != null ? `${ht(t)}/M in \xB7 ${ht(r)}/M out` : '',
5955
+ ht.map((e) => {
5956
+ let t = $e(e.slug, 'cheap', 'input'),
5957
+ r = $e(e.slug, 'cheap', 'output'),
5958
+ i = $e(e.slug, 'stable', 'input') != null,
5959
+ s = t != null && r != null ? `${bt(t)}/M in \xB7 ${bt(r)}/M out` : '',
5913
5960
  n = {
5914
5961
  slug: e.slug,
5915
5962
  name: e.name,
@@ -5920,36 +5967,37 @@ function yt() {
5920
5967
  priceFormatted: s,
5921
5968
  unit: '/M tokens',
5922
5969
  primaryToolName: 'run_task',
5923
- parameters: vr(i),
5970
+ parameters: Mr(i),
5924
5971
  };
5925
5972
  return [e.slug, n];
5926
5973
  }),
5927
5974
  );
5928
5975
  }
5929
- var bt = b(() => {
5976
+ var wt = y(() => {
5930
5977
  'use strict';
5931
- gt();
5932
- N();
5978
+ yt();
5979
+ B();
5933
5980
  });
5934
- var z,
5981
+ var J,
5935
5982
  de,
5936
- $e = b(() => {
5983
+ Ce = y(() => {
5937
5984
  'use strict';
5938
- ((z = [
5985
+ ((J = [
5939
5986
  'seedance-2-5',
5940
5987
  'seedance-2',
5941
5988
  'seedance-2-mini',
5942
5989
  'seedream-5-pro',
5990
+ 'seedream-5-5',
5943
5991
  'wan-3-0',
5944
5992
  'z-image-pro',
5945
5993
  ]),
5946
5994
  (de =
5947
5995
  'a request with creative_mode: true answers 503 checkpoint_unavailable and nothing is charged'));
5948
5996
  });
5949
- function J(e) {
5997
+ function H(e) {
5950
5998
  return `$${Number(e.toFixed(5))}`;
5951
5999
  }
5952
- function Sr(e) {
6000
+ function $r(e) {
5953
6001
  if (e.kind === 'llm') {
5954
6002
  let t = e.defaultEndpoint,
5955
6003
  r = (n) =>
@@ -5962,23 +6010,23 @@ function Sr(e) {
5962
6010
  i = r('input'),
5963
6011
  s = r('output');
5964
6012
  return i && s
5965
- ? `${J(i.price.starter)}/M in \xB7 ${J(s.price.starter)}/M out`
5966
- : `from ${J(le(e).price.starter)}/M tokens`;
6013
+ ? `${H(i.price.starter)}/M in \xB7 ${H(s.price.starter)}/M out`
6014
+ : `from ${H(le(e).price.starter)}/M tokens`;
5967
6015
  }
5968
- return `from ${J(le(e).price.starter)}${e.unit}`;
6016
+ return `from ${H(le(e).price.starter)}${e.unit}`;
5969
6017
  }
5970
- function qr(e, t) {
6018
+ function Cr(e, t) {
5971
6019
  let r = t.filter((i) => Number.isFinite(i) && i > 0);
5972
- return r.length ? `from ${J(Math.min(...r))}${e}` : null;
6020
+ return r.length ? `from ${H(Math.min(...r))}${e}` : null;
5973
6021
  }
5974
- function Pt(e) {
5975
- for (let t of j) {
6022
+ function vt(e) {
6023
+ for (let t of G) {
5976
6024
  let r = ue[t],
5977
- i = r ? qr(r.unit, e[t] ?? []) : null;
6025
+ i = r ? Cr(r.unit, e[t] ?? []) : null;
5978
6026
  r && i && (r.priceFormatted = i);
5979
6027
  }
5980
6028
  }
5981
- function R(e, t) {
6029
+ function O(e, t) {
5982
6030
  let r = e.axes?.resolution ?? [
5983
6031
  ...new Set(e.variants.map((i) => i.resolution).filter((i) => !!i)),
5984
6032
  ];
@@ -5990,13 +6038,13 @@ function R(e, t) {
5990
6038
  ...(t ? { description: t } : {}),
5991
6039
  };
5992
6040
  }
5993
- function Tt(e) {
6041
+ function _t(e) {
5994
6042
  if (!e.endpoints?.length) return null;
5995
- let t = e.endpoints.filter((r) => lt(e.slug, r.id));
6043
+ let t = e.endpoints.filter((r) => dt(e.slug, r.id));
5996
6044
  return {
5997
6045
  name: 'endpoint',
5998
6046
  type: 'select',
5999
- default: Me(e),
6047
+ default: Ke(e),
6000
6048
  options: e.endpoints.filter((r) => !t.includes(r)).map((r) => r.id),
6001
6049
  description:
6002
6050
  (e.slug === 'gemini-3.1-pro-preview'
@@ -6005,20 +6053,20 @@ function Tt(e) {
6005
6053
  (t.length ? ` ${t.map((r) => r.label).join(' and ')}: coming soon.` : ''),
6006
6054
  };
6007
6055
  }
6008
- function Er(e, t) {
6056
+ function Or(e, t) {
6009
6057
  if (e.unfiltered == null || t.some((i) => i.name === 'creative_mode')) return t;
6010
- let r = z.includes(e.api.model);
6011
- return [...t.filter((i) => !Oe.has(i.name)), r ? vt : $r];
6058
+ let r = J.includes(e.api.model);
6059
+ return [...t.filter((i) => !Re.has(i.name)), r ? Mt : Er];
6012
6060
  }
6013
- function Ce(e, t) {
6014
- let r = e.filter((s) => !Oe.has(s.name)),
6015
- i = [vt, Cr];
6016
- return (i.push(_t, Mt), [...r, ...i]);
6061
+ function Ee(e, t) {
6062
+ let r = e.filter((s) => !Re.has(s.name)),
6063
+ i = [Mt, Ar];
6064
+ return (i.push(Kt, St), [...r, ...i]);
6017
6065
  }
6018
- function kt(e, t = {}) {
6066
+ function xt(e, t = {}) {
6019
6067
  return [
6020
6068
  ...e
6021
- .filter((r) => !Ar.has(r.name) && !Oe.has(r.name))
6069
+ .filter((r) => !Rr.has(r.name) && !Re.has(r.name))
6022
6070
  .map((r) =>
6023
6071
  r.name === 'prompt'
6024
6072
  ? { ...r, required: !0 }
@@ -6039,13 +6087,13 @@ function kt(e, t = {}) {
6039
6087
  options: ['standard'],
6040
6088
  description: 'LITE uses standard bitrate. High bitrate is on the standard endpoint.',
6041
6089
  },
6042
- _t,
6043
- Mt,
6090
+ Kt,
6091
+ St,
6044
6092
  ];
6045
6093
  }
6046
- function Ee(e, t) {
6094
+ function Ae(e, t) {
6047
6095
  return [
6048
- q('Text prompt describing the video.'),
6096
+ M('Text prompt describing the video.'),
6049
6097
  { name: 'mode', type: 'select', required: !0, default: t.modes[0], options: t.modes },
6050
6098
  {
6051
6099
  name: 'duration',
@@ -6055,7 +6103,7 @@ function Ee(e, t) {
6055
6103
  max: t.maxSec,
6056
6104
  description: `Video length in seconds (${t.minSec} to ${t.maxSec}).`,
6057
6105
  },
6058
- R(e),
6106
+ O(e),
6059
6107
  { name: 'aspect_ratio', type: 'select', default: t.aspects[0], options: t.aspects },
6060
6108
  ...t.references.map((r) =>
6061
6109
  r.endsWith('s')
@@ -6072,10 +6120,10 @@ function Ee(e, t) {
6072
6120
  ),
6073
6121
  ];
6074
6122
  }
6075
- function Or(e) {
6076
- let t = Tt(e);
6123
+ function Dr(e) {
6124
+ let t = _t(e);
6077
6125
  return [
6078
- q('Image prompt text. Supports complex composition and text instructions.'),
6126
+ M('Image prompt text. Supports complex composition and text instructions.'),
6079
6127
  ...(t ? [t] : []),
6080
6128
  {
6081
6129
  name: 'quality',
@@ -6083,17 +6131,17 @@ function Or(e) {
6083
6131
  default: 'low',
6084
6132
  options: e.axes?.quality ?? ['low', 'medium', 'high'],
6085
6133
  },
6086
- R(
6134
+ O(
6087
6135
  e,
6088
6136
  e.slug === 'gpt-image-2'
6089
- ? `1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count. ${Ze}`
6137
+ ? `1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count. ${tt}`
6090
6138
  : '1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count.',
6091
6139
  ),
6092
6140
  {
6093
6141
  name: 'aspect_ratio',
6094
6142
  type: 'select',
6095
6143
  default: 'auto',
6096
- options: [...Xe],
6144
+ options: [...et],
6097
6145
  description:
6098
6146
  "The frame. auto: an edit keeps its first input image's ratio (the nearest listed one), text to image is 1:1. The image is delivered at exactly the size for the ratio and resolution.",
6099
6147
  },
@@ -6140,16 +6188,16 @@ function Or(e) {
6140
6188
  },
6141
6189
  ];
6142
6190
  }
6143
- function Rr(e) {
6191
+ function Lr(e) {
6144
6192
  return [
6145
- q('Image prompt text.'),
6193
+ M('Image prompt text.'),
6146
6194
  {
6147
6195
  name: 'input_images',
6148
6196
  type: 'string[]',
6149
6197
  description: 'Images to edit or use as reference (up to 14).',
6150
6198
  },
6151
- { name: 'aspect_ratio', type: 'select', default: '1:1', options: [...dt(e.slug)] },
6152
- R(e),
6199
+ { name: 'aspect_ratio', type: 'select', default: '1:1', options: [...ut(e.slug)] },
6200
+ O(e),
6153
6201
  {
6154
6202
  name: 'n',
6155
6203
  type: 'slider',
@@ -6174,10 +6222,10 @@ function Rr(e) {
6174
6222
  },
6175
6223
  ];
6176
6224
  }
6177
- function Nr() {
6178
- let e = ut,
6225
+ function Br() {
6226
+ let e = ft,
6179
6227
  t = [];
6180
- for (let r of Re(!0))
6228
+ for (let r of De(!0))
6181
6229
  e.includes(r.name) &&
6182
6230
  (t.push({
6183
6231
  ...r,
@@ -6199,14 +6247,14 @@ function Nr() {
6199
6247
  }));
6200
6248
  return t;
6201
6249
  }
6202
- function Ur() {
6203
- return Re(!0).map((e) =>
6250
+ function jr() {
6251
+ return De(!0).map((e) =>
6204
6252
  e.name === 'max_tokens' || e.name === 'max_completion_tokens' ? { ...e, min: 128 } : e,
6205
6253
  );
6206
6254
  }
6207
- function Re(e) {
6255
+ function De(e) {
6208
6256
  return [
6209
- q('The user message or task.'),
6257
+ M('The user message or task.'),
6210
6258
  { name: 'system', type: 'string', description: 'Optional system instructions.' },
6211
6259
  {
6212
6260
  name: 'messages',
@@ -6299,21 +6347,21 @@ function Re(e) {
6299
6347
  },
6300
6348
  ];
6301
6349
  }
6302
- function Br(e) {
6303
- if (e.slug === 'seed-2-1-turbo') return Lr;
6304
- let t = Tt(e);
6350
+ function Fr(e) {
6351
+ if (e.slug === 'seed-2-1-turbo') return Nr;
6352
+ let t = _t(e);
6305
6353
  return [
6306
6354
  ...(e.slug === 'gemini-3.1-pro-preview'
6307
- ? Nr()
6355
+ ? Br()
6308
6356
  : e.slug === 'gemini-3.7-flash'
6309
- ? Ur()
6310
- : e.slug === 'gpt-6-astra' || Vr.includes(e.slug)
6311
- ? Re(e.slug !== 'gpt-6-astra')
6312
- : Dr),
6357
+ ? jr()
6358
+ : e.slug === 'gpt-6-astra' || Ur.includes(e.slug)
6359
+ ? De(e.slug !== 'gpt-6-astra')
6360
+ : Vr),
6313
6361
  ...(t ? [t] : []),
6314
6362
  ];
6315
6363
  }
6316
- function Fr(e) {
6364
+ function Gr(e) {
6317
6365
  return [
6318
6366
  {
6319
6367
  name: 'video_url',
@@ -6322,7 +6370,7 @@ function Fr(e) {
6322
6370
  description:
6323
6371
  'The video to upscale (up to 30 seconds): a Tein upload link, or any public https link.',
6324
6372
  },
6325
- R(
6373
+ O(
6326
6374
  e,
6327
6375
  'Size of the result: 1080p, 2k or 4k. A video already near a size cannot be upscaled to it.',
6328
6376
  ),
@@ -6335,31 +6383,31 @@ function Fr(e) {
6335
6383
  },
6336
6384
  ];
6337
6385
  }
6338
- function jr(e) {
6386
+ function zr(e) {
6339
6387
  let t = e.slug;
6340
- if (se.some((r) => r.slug === t)) return Fr(e);
6341
- if (e.kind === 'llm') return Br(e);
6342
- if (e.editVariants?.length) return Or(e);
6388
+ if (se.some((r) => r.slug === t)) return Gr(e);
6389
+ if (e.kind === 'llm') return Fr(e);
6390
+ if (e.editVariants?.length) return Dr(e);
6343
6391
  switch (t) {
6344
6392
  case 'seedance-2-5':
6345
- return Ce(wt, t);
6393
+ return Ee(It, t);
6346
6394
  case 'seedance-2-5-lite':
6347
- return kt(wt, { no4k: !0 });
6395
+ return xt(It, { no4k: !0 });
6348
6396
  case 'seedance-2':
6349
- return Ce(xt, t);
6397
+ return Ee(Pt, t);
6350
6398
  case 'seedance-2-lite':
6351
- return kt(xt);
6399
+ return xt(Pt);
6352
6400
  case 'seedance-2-mini':
6353
- return Ce(Gr, t);
6401
+ return Ee(Jr, t);
6354
6402
  case 'nano-banana-2':
6355
6403
  case 'nano-banana-2.1':
6356
6404
  case 'nano-banana-pro':
6357
- return Rr(e);
6405
+ return Lr(e);
6358
6406
  case 'seedream-5-pro':
6359
6407
  return [
6360
- q('Detailed description of the image to generate.'),
6408
+ M('Detailed description of the image to generate.'),
6361
6409
  { name: 'images', type: 'string[]', description: 'Reference images (the first is free).' },
6362
- R(e),
6410
+ O(e),
6363
6411
  {
6364
6412
  name: 'aspect_ratio',
6365
6413
  type: 'select',
@@ -6368,16 +6416,72 @@ function jr(e) {
6368
6416
  },
6369
6417
  { name: 'output_format', type: 'select', default: 'jpeg', options: ['jpeg', 'png'] },
6370
6418
  ];
6419
+ case 'seedream-5-5':
6420
+ return [
6421
+ {
6422
+ name: 'mode',
6423
+ type: 'select',
6424
+ default: 'text_to_image',
6425
+ options: ['text_to_image', 'image_to_image', 'layer_decomposition'],
6426
+ description:
6427
+ 'text_to_image, image_to_image (up to 10 reference images) or layer_decomposition (split one image into a base image and editable transparent layers).',
6428
+ },
6429
+ M(
6430
+ 'What to make or change. Optional for layer_decomposition, where it can say how to split the image (for example "keep the logo as one layer").',
6431
+ ),
6432
+ {
6433
+ name: 'images',
6434
+ type: 'string[]',
6435
+ description:
6436
+ 'Reference images (up to 10), or for layer_decomposition the one JPEG or PNG to split (at least 512x512). Each input image is billed.',
6437
+ },
6438
+ O(
6439
+ e,
6440
+ '1K and 1.5K are one price, 2K the next. layer_decomposition also takes auto (keep the input size), billed at the 2K price.',
6441
+ ),
6442
+ {
6443
+ name: 'aspect_ratio',
6444
+ type: 'select',
6445
+ default: '1:1',
6446
+ options: ['1:1', '4:3', '3:4', '16:9', '9:16', '3:2', '2:3', '21:9', 'adaptive'],
6447
+ description: 'Not used by layer_decomposition. adaptive lets the prompt pick the shape.',
6448
+ },
6449
+ {
6450
+ name: 'background',
6451
+ type: 'select',
6452
+ default: 'auto',
6453
+ options: ['auto', 'transparent', 'opaque'],
6454
+ description:
6455
+ 'transparent makes a PNG with an alpha channel (needs output_format png). auto decides from the prompt. Not used by layer_decomposition.',
6456
+ },
6457
+ { name: 'output_format', type: 'select', default: 'png', options: ['png', 'jpeg'] },
6458
+ {
6459
+ name: 'max_layers',
6460
+ type: 'slider',
6461
+ default: 30,
6462
+ min: 2,
6463
+ max: 100,
6464
+ description:
6465
+ 'layer_decomposition only: most images to return, the base image included. Held for this many; you pay for the layers made.',
6466
+ },
6467
+ {
6468
+ name: 'text_recognition',
6469
+ type: 'boolean',
6470
+ default: !1,
6471
+ description:
6472
+ 'layer_decomposition only: return the text, lines, font and style of each typeset text layer (layer.text_recognition).',
6473
+ },
6474
+ ];
6371
6475
  case 'qwen-3':
6372
6476
  case 'qwen-3-pro':
6373
6477
  return [
6374
- q('Image prompt text; dense layouts and multilingual text work well.'),
6478
+ M('Image prompt text; dense layouts and multilingual text work well.'),
6375
6479
  {
6376
6480
  name: 'images',
6377
6481
  type: 'string[]',
6378
6482
  description: 'Up to 3 reference images, each billed at the published add-on price.',
6379
6483
  },
6380
- R(e),
6484
+ O(e),
6381
6485
  {
6382
6486
  name: 'aspect_ratio',
6383
6487
  type: 'select',
@@ -6395,8 +6499,8 @@ function jr(e) {
6395
6499
  ];
6396
6500
  case 'z-image-pro':
6397
6501
  return [
6398
- q('Image prompt text: subject, scene, style, composition and lighting.'),
6399
- R(e, 'Long edge: 1K is 1024 px, 2K is 2048 px. Same price.'),
6502
+ M('Image prompt text: subject, scene, style, composition and lighting.'),
6503
+ O(e, 'Long edge: 1K is 1024 px, 2K is 2048 px. Same price.'),
6400
6504
  {
6401
6505
  name: 'aspect_ratio',
6402
6506
  type: 'select',
@@ -6449,7 +6553,7 @@ function jr(e) {
6449
6553
  ];
6450
6554
  case 'wan-3-0':
6451
6555
  case 'wan-3-0-prime':
6452
- return Ee(e, {
6556
+ return Ae(e, {
6453
6557
  modes: ['text_to_video', 'first_n_last_frames', 'multi_reference'],
6454
6558
  aspects: ['16:9', '9:16', '4:3', '3:4', '1:1', 'adaptive'],
6455
6559
  minSec: 2,
@@ -6459,7 +6563,7 @@ function jr(e) {
6459
6563
  });
6460
6564
  case 'happy-horse-1-1':
6461
6565
  case 'happy-horse-1-0':
6462
- return Ee(e, {
6566
+ return Ae(e, {
6463
6567
  modes:
6464
6568
  t === 'happy-horse-1-0'
6465
6569
  ? ['text-to-video', 'single-image', 'multi-reference', 'video-editing']
@@ -6470,7 +6574,7 @@ function jr(e) {
6470
6574
  references: t === 'happy-horse-1-0' ? ['images', 'videos'] : ['images'],
6471
6575
  });
6472
6576
  case 'minimax-h3':
6473
- return Ee(e, {
6577
+ return Ae(e, {
6474
6578
  modes: ['text_to_video', 'first_n_last_frames', 'multi_reference'],
6475
6579
  aspects: ['16:9', '21:9', '4:3', '1:1', '3:4', '9:16', 'adaptive'],
6476
6580
  minSec: 4,
@@ -6478,159 +6582,159 @@ function jr(e) {
6478
6582
  references: ['images', 'videos', 'audios', 'first_frame_image', 'last_frame_image'],
6479
6583
  });
6480
6584
  default:
6481
- return [q('Prompt text.')];
6585
+ return [M('Prompt text.')];
6482
6586
  }
6483
6587
  }
6484
- function Ae(e, t = e.api.model) {
6588
+ function Oe(e, t = e.api.model) {
6485
6589
  return {
6486
6590
  slug: t,
6487
6591
  name: e.name,
6488
- category: _r[e.kind],
6489
- kind: Kr[e.kind],
6592
+ category: Kr[e.kind],
6593
+ kind: qr[e.kind],
6490
6594
  vendor: e.vendor ?? '',
6491
6595
  description: e.desc ?? e.name,
6492
- priceFormatted: Sr(e),
6596
+ priceFormatted: $r(e),
6493
6597
  unit: e.unit,
6494
- primaryToolName: Mr[e.kind],
6495
- parameters: Er(e, jr(e)),
6598
+ primaryToolName: Sr[e.kind],
6599
+ parameters: Or(e, zr(e)),
6496
6600
  };
6497
6601
  }
6498
- function zr() {
6602
+ function Hr() {
6499
6603
  let e = {};
6500
6604
  for (let t of oe())
6501
6605
  if (t.slug !== 'seedance-2-fast') {
6502
6606
  if (t.slug === 'seedance-2-mini') {
6503
- e['seedance-2-mini'] = Ae(t, 'seedance-2-mini');
6607
+ e['seedance-2-mini'] = Oe(t, 'seedance-2-mini');
6504
6608
  continue;
6505
6609
  }
6506
6610
  if (t.slug === 'seedance-2') {
6507
- let r = Ae(t);
6611
+ let r = Oe(t);
6508
6612
  ((r.description = `${t.desc ?? t.name} Send quality fast or mini for Seedance 2.0 Fast or Mini.`),
6509
6613
  (e['seedance-2'] = r));
6510
6614
  continue;
6511
6615
  }
6512
- t.slug.startsWith('claude-') || (e[t.api.model] = Ae(t));
6616
+ t.slug.startsWith('claude-') || (e[t.api.model] = Oe(t));
6513
6617
  }
6514
- Object.assign(e, yt());
6618
+ Object.assign(e, kt());
6515
6619
  for (let [t, r] of Object.entries(pe))
6516
6620
  e[r] && Object.defineProperty(e, t, { value: e[r], enumerable: !1 });
6517
6621
  return e;
6518
6622
  }
6519
- function U(e) {
6623
+ function j(e) {
6520
6624
  return ue[e] ?? null;
6521
6625
  }
6522
- function Jr(e, t, r) {
6626
+ function Wr(e, t, r) {
6523
6627
  if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite') && t === 'duration') {
6524
6628
  let i = (s) => (typeof s == 'string' ? s.trim().toLowerCase() : '');
6525
6629
  if (i(r.mode) === 'edit' || i(r.omni_reference_task_type) === 'edit') return !1;
6526
6630
  }
6527
6631
  return !(
6528
- (t === 'max_tokens' && It(r.max_completion_tokens)) ||
6529
- (t === 'max_completion_tokens' && It(r.max_tokens))
6632
+ (t === 'max_tokens' && Tt(r.max_completion_tokens)) ||
6633
+ (t === 'max_completion_tokens' && Tt(r.max_tokens))
6530
6634
  );
6531
6635
  }
6532
- function It(e) {
6636
+ function Tt(e) {
6533
6637
  return e != null && e !== '';
6534
6638
  }
6535
- function qt(e, t) {
6639
+ function Ct(e, t) {
6536
6640
  let r = { ...t };
6537
6641
  if (e?.slug === 'seedance-2-5') {
6538
6642
  let i = (s) => typeof s != 'string' || !s.trim();
6539
- for (let s of Hr) (i(r.finalize) && !i(r[s]) && (r.finalize = r[s]), delete r[s]);
6643
+ for (let s of Yr) (i(r.finalize) && !i(r[s]) && (r.finalize = r[s]), delete r[s]);
6540
6644
  if (!i(r.finalize)) return r;
6541
6645
  }
6542
6646
  for (let i of e?.parameters ?? [])
6543
6647
  i.default !== void 0 &&
6544
6648
  r[i.name] === void 0 &&
6545
- Jr(e.slug, i.name, t) &&
6649
+ Wr(e.slug, i.name, t) &&
6546
6650
  (r[i.name] = i.default);
6547
6651
  return r;
6548
6652
  }
6549
- function E() {
6653
+ function R() {
6550
6654
  return Object.values(ue);
6551
6655
  }
6552
- var _r,
6553
- Mr,
6554
- Kr,
6555
- q,
6556
- vt,
6557
- $r,
6558
- Cr,
6559
- _t,
6656
+ var Kr,
6657
+ Sr,
6658
+ qr,
6659
+ M,
6560
6660
  Mt,
6561
- Oe,
6661
+ Er,
6562
6662
  Ar,
6563
- Dr,
6564
- Lr,
6565
- Vr,
6566
- ce,
6567
- wt,
6568
6663
  Kt,
6569
6664
  St,
6570
- xt,
6571
- Gr,
6665
+ Re,
6666
+ Rr,
6667
+ Vr,
6668
+ Nr,
6669
+ Ur,
6670
+ ce,
6671
+ It,
6672
+ qt,
6673
+ $t,
6674
+ Pt,
6675
+ Jr,
6572
6676
  ue,
6573
- Hr,
6574
- H = b(() => {
6677
+ Yr,
6678
+ W = y(() => {
6575
6679
  'use strict';
6576
- et();
6577
- we();
6578
- N();
6579
- Ke();
6680
+ rt();
6580
6681
  xe();
6682
+ B();
6581
6683
  Se();
6582
- pt();
6684
+ Ie();
6685
+ qe();
6583
6686
  ct();
6584
6687
  mt();
6585
- bt();
6586
- $e();
6587
- ((_r = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
6588
- (Mr = {
6688
+ gt();
6689
+ wt();
6690
+ Ce();
6691
+ ((Kr = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
6692
+ (Sr = {
6589
6693
  video: 'generate_video',
6590
6694
  image: 'generate_image',
6591
6695
  audio: 'generate_audio',
6592
6696
  llm: 'run_task',
6593
6697
  }),
6594
- (Kr = {
6698
+ (qr = {
6595
6699
  video: 'Text-to-Video',
6596
6700
  image: 'Text-to-Image',
6597
6701
  audio: 'Text-to-Audio',
6598
6702
  llm: 'Reasoning (LLM)',
6599
6703
  }));
6600
- q = (e) => ({ name: 'prompt', type: 'string', required: !0, description: e });
6601
- ((vt = {
6704
+ M = (e) => ({ name: 'prompt', type: 'string', required: !0, description: e });
6705
+ ((Mt = {
6602
6706
  name: 'creative_mode',
6603
6707
  type: 'boolean',
6604
6708
  default: !1,
6605
6709
  description:
6606
6710
  'Runs the Creative mode checkpoint at its published price (+5%). The Acceptable Use Policy applies.',
6607
6711
  }),
6608
- ($r = {
6712
+ (Er = {
6609
6713
  name: 'creative_mode',
6610
6714
  type: 'boolean',
6611
6715
  default: !1,
6612
6716
  description: `Not available yet on this model: ${de}.`,
6613
6717
  }),
6614
- (Cr = {
6718
+ (Ar = {
6615
6719
  name: 'priority',
6616
6720
  type: 'boolean',
6617
6721
  default: !1,
6618
6722
  description: 'Guaranteed speed and no queue, at the published Priority price (+6%).',
6619
6723
  }),
6620
- (_t = {
6724
+ (Kt = {
6621
6725
  name: 'reference_roles',
6622
6726
  type: 'json',
6623
6727
  description: `Omni Reference only. Role of each reference, by tag { "@Image1": "prop" } or by kind { "image": ["prop"] }. Image: appearance, clothing, prop, scene_layout, lighting, first_frame, last_frame; Seedance 2.5 also keyframe, storyboard. Video: motion, camera, style; Seedance 2.5 also blockout_coarse, blockout_fine. Audio: voice, ambience, music, sound_effect. On a tag, the value image, video or audio uses that kind's default (appearance, motion, voice).`,
6624
6728
  }),
6625
- (Mt = {
6729
+ (St = {
6626
6730
  name: 'auto_fit_images',
6627
6731
  type: 'boolean',
6628
6732
  default: !1,
6629
6733
  description:
6630
6734
  '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.',
6631
6735
  }),
6632
- (Oe = new Set(['full_access', 'is_uncensored', 'unfiltered', 'verificationSignature'])));
6633
- Ar = new Set([
6736
+ (Re = new Set(['full_access', 'is_uncensored', 'unfiltered', 'verificationSignature'])));
6737
+ Rr = new Set([
6634
6738
  'quality',
6635
6739
  'bitrate_mode',
6636
6740
  'draft',
@@ -6639,8 +6743,8 @@ var _r,
6639
6743
  'draft_generation_id',
6640
6744
  'pass_faces',
6641
6745
  ]);
6642
- ((Dr = [
6643
- q('The user message or task.'),
6746
+ ((Vr = [
6747
+ M('The user message or task.'),
6644
6748
  { name: 'system', type: 'string', description: 'Optional system instructions.' },
6645
6749
  {
6646
6750
  name: 'messages',
@@ -6657,8 +6761,8 @@ var _r,
6657
6761
  { name: 'temperature', type: 'slider', min: 0, max: 1, step: 0.1 },
6658
6762
  { name: 'top_p', type: 'slider', min: 0, max: 1, step: 0.05 },
6659
6763
  ]),
6660
- (Lr = [
6661
- q('The user message or task.'),
6764
+ (Nr = [
6765
+ M('The user message or task.'),
6662
6766
  { name: 'system', type: 'string', description: 'Optional system instructions.' },
6663
6767
  {
6664
6768
  name: 'messages',
@@ -6739,9 +6843,9 @@ var _r,
6739
6843
  description: 'Video frames read a second.',
6740
6844
  },
6741
6845
  ]),
6742
- (Vr = ['gemini-3.8-flash', 'gemini-3.7-flash']));
6846
+ (Ur = ['gemini-3.8-flash', 'gemini-3.7-flash']));
6743
6847
  ((ce = 'Left out: 480p, the same default as the API, the playground and workflow steps.'),
6744
- (wt = [
6848
+ (It = [
6745
6849
  {
6746
6850
  name: 'prompt',
6747
6851
  type: 'string',
@@ -6890,19 +6994,19 @@ var _r,
6890
6994
  'Keeps real faces in reference images. On by default. Send false to turn it off.',
6891
6995
  },
6892
6996
  ]),
6893
- (Kt = {
6997
+ (qt = {
6894
6998
  name: 'images',
6895
6999
  type: 'string[]',
6896
7000
  description:
6897
7001
  '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.',
6898
7002
  }),
6899
- (St = {
7003
+ ($t = {
6900
7004
  name: 'audios',
6901
7005
  type: 'string[]',
6902
7006
  description:
6903
7007
  '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.',
6904
7008
  }),
6905
- (xt = [
7009
+ (Pt = [
6906
7010
  {
6907
7011
  name: 'prompt',
6908
7012
  type: 'string',
@@ -6980,8 +7084,8 @@ var _r,
6980
7084
  description:
6981
7085
  'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
6982
7086
  },
6983
- Kt,
6984
- St,
7087
+ qt,
7088
+ $t,
6985
7089
  {
6986
7090
  name: 'first_frame_image',
6987
7091
  type: 'string',
@@ -7002,7 +7106,7 @@ var _r,
7002
7106
  'Keeps real faces in reference images. On by default. Send false to turn it off.',
7003
7107
  },
7004
7108
  ]),
7005
- (Gr = [
7109
+ (Jr = [
7006
7110
  {
7007
7111
  name: 'prompt',
7008
7112
  type: 'string',
@@ -7057,8 +7161,8 @@ var _r,
7057
7161
  description:
7058
7162
  'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
7059
7163
  },
7060
- Kt,
7061
- St,
7164
+ qt,
7165
+ $t,
7062
7166
  {
7063
7167
  name: 'first_frame_image',
7064
7168
  type: 'string',
@@ -7073,53 +7177,53 @@ var _r,
7073
7177
  'Keeps real faces in reference images. On by default. Send false to turn it off.',
7074
7178
  },
7075
7179
  ]));
7076
- ue = zr();
7077
- Hr = ['draft_task_id', 'draft_generation_id'];
7180
+ ue = Hr();
7181
+ Yr = ['draft_task_id', 'draft_generation_id'];
7078
7182
  });
7079
7183
  function me(e) {
7080
7184
  let t = '/v1/pricing/models',
7081
7185
  r = e?.trim();
7082
7186
  return r ? `${t}?model=${encodeURIComponent(r)}` : t;
7083
7187
  }
7084
- var Le = b(() => {
7188
+ var Ve = y(() => {
7085
7189
  'use strict';
7086
7190
  });
7087
- function Ut(e) {
7191
+ function jt(e) {
7088
7192
  return e.length <= 1 ? (e[0] ?? '') : `${e.slice(0, -1).join(', ')} and ${e[e.length - 1]}`;
7089
7193
  }
7090
- function Bt(e) {
7194
+ function Ft(e) {
7091
7195
  let t = oe().filter((n) => n.kind === e && n.unfiltered != null),
7092
- r = t.filter((n) => z.includes(n.api.model)).map((n) => n.name),
7093
- i = t.filter((n) => !z.includes(n.api.model)).map((n) => n.name);
7196
+ r = t.filter((n) => J.includes(n.api.model)).map((n) => n.name),
7197
+ i = t.filter((n) => !J.includes(n.api.model)).map((n) => n.name);
7094
7198
  return [
7095
7199
  ...(r.length
7096
- ? [`${Ut(r)}: runs the Creative mode checkpoint at its published price (+5%).`]
7200
+ ? [`${jt(r)}: runs the Creative mode checkpoint at its published price (+5%).`]
7097
7201
  : []),
7098
- ...(i.length ? [`Not available yet on ${Ut(i)}: ${de}.`] : []),
7202
+ ...(i.length ? [`Not available yet on ${jt(i)}: ${de}.`] : []),
7099
7203
  'The Acceptable Use Policy applies.',
7100
7204
  ].join(' ');
7101
7205
  }
7102
- function yi(e) {
7103
- if (gi.has(e.name)) return e;
7206
+ function wi(e) {
7207
+ if (bi.has(e.name)) return e;
7104
7208
  let t = e.inputSchema.properties;
7105
7209
  return !t || t.callback_url
7106
7210
  ? e
7107
- : { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url: fi } } };
7211
+ : { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url: yi } } };
7108
7212
  }
7109
- function bi(e) {
7213
+ function xi(e) {
7110
7214
  let t = e.inputSchema.properties;
7111
7215
  if (!t) return e;
7112
7216
  let r = !1,
7113
7217
  i = {};
7114
7218
  for (let [s, n] of Object.entries(t))
7115
- Ft.has(s) && n.type === 'string' && !n.format
7219
+ Gt.has(s) && n.type === 'string' && !n.format
7116
7220
  ? ((i[s] = { ...n, format: 'uri' }), (r = !0))
7117
- : Ft.has(s) && n.type === 'array' && n.items?.type === 'string' && !n.items.format
7221
+ : Gt.has(s) && n.type === 'array' && n.items?.type === 'string' && !n.items.format
7118
7222
  ? ((i[s] = { ...n, items: { ...n.items, format: 'uri' } }), (r = !0))
7119
7223
  : (i[s] = n);
7120
7224
  return r ? { ...e, inputSchema: { ...e.inputSchema, properties: i } } : e;
7121
7225
  }
7122
- function ki(e) {
7226
+ function Ii(e) {
7123
7227
  switch (e.type) {
7124
7228
  case 'string':
7125
7229
  return {
@@ -7174,11 +7278,11 @@ function ki(e) {
7174
7278
  return { type: 'string', description: e.description };
7175
7279
  }
7176
7280
  }
7177
- function wi(e, t) {
7281
+ function Pi(e, t) {
7178
7282
  let r = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
7179
7283
  i = {},
7180
7284
  s = [];
7181
- for (let o of e.parameters) ((i[o.name] = ki(o)), o.required && s.push(o.name));
7285
+ for (let o of e.parameters) ((i[o.name] = Ii(o)), o.required && s.push(o.name));
7182
7286
  let n = {
7183
7287
  type: 'object',
7184
7288
  properties: i,
@@ -7191,15 +7295,15 @@ function wi(e, t) {
7191
7295
  inputSchema: n,
7192
7296
  };
7193
7297
  }
7194
- function xi() {
7195
- let e = E().filter((d) => d.category === 'Image'),
7196
- t = E().filter((d) => d.category === 'Video'),
7197
- r = E().filter((d) => d.category === 'Text'),
7198
- i = E().filter((d) => d.category === 'Audio'),
7298
+ function Ti() {
7299
+ let e = R().filter((d) => d.category === 'Image'),
7300
+ t = R().filter((d) => d.category === 'Video'),
7301
+ r = R().filter((d) => d.category === 'Text'),
7302
+ i = R().filter((d) => d.category === 'Audio'),
7199
7303
  s = {
7200
7304
  name: 'generate_image',
7201
7305
  description:
7202
- 'Generate or edit images with Tein AI image models (GPT Image 2 and 2.5, Nano Banana 2 and Pro, Seedream 5.0 Pro, Qwen Image 3.0). Billed per image at the published price.',
7306
+ 'Generate or edit images with Tein AI image models (GPT Image 2 and 2.5, Nano Banana 2 and Pro, Seedream 5.5 and 5.0 Pro, Qwen Image 3.0). Billed per image at the published price.',
7203
7307
  inputSchema: {
7204
7308
  type: 'object',
7205
7309
  properties: {
@@ -7287,7 +7391,7 @@ function xi() {
7287
7391
  maximum: 2147483647,
7288
7392
  description: 'Nano Banana 2 and Nano Banana Pro. Omit it for a new image each time.',
7289
7393
  },
7290
- creative_mode: { type: 'boolean', default: !1, description: Bt('image') },
7394
+ creative_mode: { type: 'boolean', default: !1, description: Ft('image') },
7291
7395
  },
7292
7396
  required: ['prompt'],
7293
7397
  additionalProperties: !0,
@@ -7324,7 +7428,7 @@ function xi() {
7324
7428
  default: '480p',
7325
7429
  description: 'Video resolution (the lowest price is the default; see each model tool).',
7326
7430
  },
7327
- creative_mode: { type: 'boolean', default: !1, description: Bt('video') },
7431
+ creative_mode: { type: 'boolean', default: !1, description: Ft('video') },
7328
7432
  priority: {
7329
7433
  type: 'boolean',
7330
7434
  default: !1,
@@ -7415,16 +7519,32 @@ function xi() {
7415
7519
  },
7416
7520
  l = {
7417
7521
  name: 'generate_mesh',
7418
- description: 'Split an image into layers with Seedream 5.0 Pro (layer decomposition).',
7522
+ description:
7523
+ 'Split an image into layers (layer decomposition): Seedream 5.0 Pro by default, or model seedream-5-5 for up to 100 transparent layers billed per layer made, with optional typeset-text recognition.',
7419
7524
  inputSchema: {
7420
7525
  type: 'object',
7421
7526
  properties: {
7527
+ model: {
7528
+ type: 'string',
7529
+ enum: ['seedream-5-pro', 'seedream-5-5'],
7530
+ description: 'seedream-5-pro (default) or seedream-5-5.',
7531
+ },
7422
7532
  prompt: { type: 'string', description: 'What to separate into layers.' },
7423
7533
  images: {
7424
7534
  type: 'array',
7425
7535
  items: { type: 'string' },
7426
7536
  description: 'The image to decompose (jpeg or png).',
7427
7537
  },
7538
+ max_layers: {
7539
+ type: 'number',
7540
+ description:
7541
+ 'seedream-5-5 only: most images to return, the base image included (2-100, default 30). You pay for the layers made.',
7542
+ },
7543
+ text_recognition: {
7544
+ type: 'boolean',
7545
+ description:
7546
+ 'seedream-5-5 only: return the text and style of each typeset text layer (layer.text_recognition).',
7547
+ },
7428
7548
  },
7429
7549
  required: ['prompt'],
7430
7550
  additionalProperties: !0,
@@ -7446,10 +7566,10 @@ function xi() {
7446
7566
  additionalProperties: !0,
7447
7567
  },
7448
7568
  },
7449
- p = Ii();
7450
- return [s, n, o, u, l, p, c, hi];
7569
+ p = vi();
7570
+ return [s, n, o, u, l, p, c, ki];
7451
7571
  }
7452
- function Ii() {
7572
+ function vi() {
7453
7573
  return {
7454
7574
  name: 'upload_asset',
7455
7575
  description:
@@ -7496,26 +7616,26 @@ function Ii() {
7496
7616
  },
7497
7617
  };
7498
7618
  }
7499
- function je() {
7500
- let e = xi(),
7501
- t = E().map((r) => wi(r));
7502
- return [...e, ...t].map(yi).map(bi);
7619
+ function Ge() {
7620
+ let e = Ti(),
7621
+ t = R().map((r) => Pi(r));
7622
+ return [...e, ...t].map(wi).map(xi);
7503
7623
  }
7504
- var fi,
7505
- gi,
7506
- hi,
7507
- Ft,
7508
- jt = b(() => {
7624
+ var yi,
7625
+ bi,
7626
+ ki,
7627
+ Gt,
7628
+ zt = y(() => {
7509
7629
  'use strict';
7510
- N();
7511
- $e();
7512
- H();
7513
- ((fi = {
7630
+ B();
7631
+ Ce();
7632
+ W();
7633
+ ((yi = {
7514
7634
  type: 'string',
7515
7635
  description:
7516
7636
  '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.',
7517
7637
  }),
7518
- (gi = new Set([
7638
+ (bi = new Set([
7519
7639
  'upload_asset',
7520
7640
  'upload_media',
7521
7641
  'upload_image',
@@ -7523,7 +7643,7 @@ var fi,
7523
7643
  'check_status',
7524
7644
  'get_pricing',
7525
7645
  ])),
7526
- (hi = {
7646
+ (ki = {
7527
7647
  name: 'get_pricing',
7528
7648
  description:
7529
7649
  'Published USD prices for every Tein model: Starter, Plus and Scale on each variant, plus Creative mode, Priority and draft tables where they are published, and Admin prices for models that are not on the board. No API key is required. Pass model to keep one catalog slug or API model id (for example seedance-2-5). The same payload as GET /v1/pricing/models.',
@@ -7538,7 +7658,7 @@ var fi,
7538
7658
  additionalProperties: !1,
7539
7659
  },
7540
7660
  }));
7541
- Ft = new Set([
7661
+ Gt = new Set([
7542
7662
  'image',
7543
7663
  'images',
7544
7664
  'image_url',
@@ -7555,19 +7675,19 @@ var fi,
7555
7675
  'lipsyncing_audio',
7556
7676
  ]);
7557
7677
  });
7558
- var er = {};
7559
- lr(er, {
7560
- forgetToolSchemas: () => Mi,
7561
- jsonRpcAnswer: () => Ht,
7562
- preprocessLocalFiles: () => Xt,
7563
- startStdioServer: () => Zt,
7678
+ var rr = {};
7679
+ dr(rr, {
7680
+ forgetToolSchemas: () => qi,
7681
+ jsonRpcAnswer: () => Yt,
7682
+ preprocessLocalFiles: () => er,
7683
+ startStdioServer: () => tr,
7564
7684
  });
7565
- function Pi(e) {
7685
+ function _i(e) {
7566
7686
  let t = (r) =>
7567
7687
  !!r && typeof r == 'object' && r.jsonrpc === '2.0' && ('result' in r || 'error' in r);
7568
7688
  return Array.isArray(e) ? e.length > 0 && e.every(t) : t(e);
7569
7689
  }
7570
- function Ht(e, t, r) {
7690
+ function Yt(e, t, r) {
7571
7691
  let i = e?.id,
7572
7692
  s = i == null,
7573
7693
  n = null;
@@ -7576,7 +7696,7 @@ function Ht(e, t, r) {
7576
7696
  } catch {
7577
7697
  n = null;
7578
7698
  }
7579
- if (n !== null && Pi(n)) return s ? null : n;
7699
+ if (n !== null && _i(n)) return s ? null : n;
7580
7700
  if (s) return null;
7581
7701
  if (!r && t >= 200 && t < 300) return;
7582
7702
  let o = n?.error,
@@ -7597,16 +7717,16 @@ function Ht(e, t, r) {
7597
7717
  },
7598
7718
  };
7599
7719
  }
7600
- function Ti() {
7720
+ function Mi() {
7601
7721
  let e = process.argv.slice(2),
7602
7722
  t = e.indexOf('--api-key');
7603
- return S(t >= 0 ? e[t + 1] : void 0);
7723
+ return q(t >= 0 ? e[t + 1] : void 0);
7604
7724
  }
7605
- async function Wt(e, t, r) {
7606
- let i = B.default.resolve(e);
7607
- if (!O.default.existsSync(i) || !O.default.statSync(i).isFile())
7725
+ async function Qt(e, t, r) {
7726
+ let i = F.default.resolve(e);
7727
+ if (!D.default.existsSync(i) || !D.default.statSync(i).isFile())
7608
7728
  throw new Error(`File not found: ${e}`);
7609
- let s = O.default.readFileSync(i),
7729
+ let s = D.default.readFileSync(i),
7610
7730
  n = s.toString('base64'),
7611
7731
  o = s.length,
7612
7732
  u = `${r.replace(/\/$/, '')}/v1/upload`,
@@ -7631,15 +7751,15 @@ async function Wt(e, t, r) {
7631
7751
  mimeType: c.mime_type || c.mimeType || 'image/png',
7632
7752
  };
7633
7753
  }
7634
- function Yt(e) {
7635
- return vi.has(B.default.extname(e).toLowerCase());
7754
+ function Xt(e) {
7755
+ return Ki.has(F.default.extname(e).toLowerCase());
7636
7756
  }
7637
- function Qt(e) {
7757
+ function Zt(e) {
7638
7758
  return new Error(
7639
- `Tein uploads image, video and audio files only, and ${B.default.basename(e)} is not one.`,
7759
+ `Tein uploads image, video and audio files only, and ${F.default.basename(e)} is not one.`,
7640
7760
  );
7641
7761
  }
7642
- function _i(e) {
7762
+ function Si(e) {
7643
7763
  let t = e.trim();
7644
7764
  if (
7645
7765
  !t ||
@@ -7649,25 +7769,25 @@ function _i(e) {
7649
7769
  `)
7650
7770
  )
7651
7771
  return null;
7652
- let r = B.default.resolve(t);
7653
- return O.default.existsSync(r) && O.default.statSync(r).isFile() ? r : null;
7772
+ let r = F.default.resolve(t);
7773
+ return D.default.existsSync(r) && D.default.statSync(r).isFile() ? r : null;
7654
7774
  }
7655
- function ze(e) {
7775
+ function Je(e) {
7656
7776
  if (Array.isArray(e))
7657
7777
  for (let t of e) {
7658
7778
  let r = t;
7659
7779
  typeof r.name == 'string' &&
7660
7780
  r.inputSchema &&
7661
7781
  typeof r.inputSchema == 'object' &&
7662
- Q.set(r.name, r.inputSchema);
7782
+ X.set(r.name, r.inputSchema);
7663
7783
  }
7664
7784
  }
7665
- function Mi() {
7666
- (Q.clear(), (Ge = 0));
7785
+ function qi() {
7786
+ (X.clear(), (ze = 0));
7667
7787
  }
7668
- async function Ki(e, t) {
7669
- if (!(Date.now() - Ge < 6e4)) {
7670
- Ge = Date.now();
7788
+ async function $i(e, t) {
7789
+ if (!(Date.now() - ze < 6e4)) {
7790
+ ze = Date.now();
7671
7791
  try {
7672
7792
  let i = await (
7673
7793
  await fetch(e, {
@@ -7677,39 +7797,39 @@ async function Ki(e, t) {
7677
7797
  signal: AbortSignal.timeout(1e4),
7678
7798
  })
7679
7799
  ).json();
7680
- ze(i.result?.tools);
7800
+ Je(i.result?.tools);
7681
7801
  } catch {}
7682
7802
  }
7683
7803
  }
7684
- function Si(e) {
7804
+ function Ci(e) {
7685
7805
  return e
7686
7806
  ? e.type === 'string'
7687
7807
  ? e.format === 'uri'
7688
7808
  : e.type === 'array' && e.items?.format === 'uri'
7689
7809
  : !1;
7690
7810
  }
7691
- async function Gt(e, t, r) {
7811
+ async function Jt(e, t, r) {
7692
7812
  if (typeof e != 'string') return e;
7693
- let i = _i(e);
7813
+ let i = Si(e);
7694
7814
  if (!i) return e;
7695
- if (!Yt(i)) throw Qt(i);
7696
- return (await Wt(i, t, r)).url;
7815
+ if (!Xt(i)) throw Zt(i);
7816
+ return (await Qt(i, t, r)).url;
7697
7817
  }
7698
- async function Xt(e, t, r, i, s) {
7699
- (Q.size === 0 && ze(je()), Q.has(e) || (await Ki(s, r)));
7700
- let n = Q.get(e)?.properties;
7818
+ async function er(e, t, r, i, s) {
7819
+ (X.size === 0 && Je(Ge()), X.has(e) || (await $i(s, r)));
7820
+ let n = X.get(e)?.properties;
7701
7821
  if (!n) return t;
7702
7822
  let o = { ...t };
7703
7823
  for (let [u, l] of Object.entries(t))
7704
- if (Si(n[u]))
7824
+ if (Ci(n[u]))
7705
7825
  if (Array.isArray(l)) {
7706
7826
  let c = [];
7707
- for (let p of l) c.push(await Gt(p, r, i));
7827
+ for (let p of l) c.push(await Jt(p, r, i));
7708
7828
  o[u] = c;
7709
- } else o[u] = await Gt(l, r, i);
7829
+ } else o[u] = await Jt(l, r, i);
7710
7830
  return o;
7711
7831
  }
7712
- function qi(e) {
7832
+ function Ei(e) {
7713
7833
  let t = e.id ?? null;
7714
7834
  switch (e.method) {
7715
7835
  case 'initialize':
@@ -7727,7 +7847,7 @@ function qi(e) {
7727
7847
  case 'ping':
7728
7848
  return { jsonrpc: '2.0', id: t, result: {} };
7729
7849
  case 'tools/list':
7730
- return { jsonrpc: '2.0', id: t, result: { tools: je() } };
7850
+ return { jsonrpc: '2.0', id: t, result: { tools: Ge() } };
7731
7851
  case 'tools/call':
7732
7852
  return {
7733
7853
  jsonrpc: '2.0',
@@ -7750,13 +7870,13 @@ function qi(e) {
7750
7870
  };
7751
7871
  }
7752
7872
  }
7753
- async function Zt() {
7754
- if (zt) return;
7755
- zt = !0;
7756
- let e = Ti(),
7757
- t = x(),
7873
+ async function tr() {
7874
+ if (Ht) return;
7875
+ Ht = !0;
7876
+ let e = Mi(),
7877
+ t = P(),
7758
7878
  r = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
7759
- (Jt.default
7879
+ (Wt.default
7760
7880
  .createInterface({ input: process.stdin, output: process.stdout, terminal: !1 })
7761
7881
  .on('line', async (s) => {
7762
7882
  let n = s.trim();
@@ -7815,10 +7935,10 @@ async function Zt() {
7815
7935
  !p.startsWith('data:')
7816
7936
  )
7817
7937
  try {
7818
- let d = B.default.resolve(p.trim());
7819
- if (O.default.existsSync(d) && O.default.statSync(d).isFile() && e) {
7820
- if (!Yt(d)) throw Qt(d);
7821
- let m = await Wt(d, e, t),
7938
+ let d = F.default.resolve(p.trim());
7939
+ if (D.default.existsSync(d) && D.default.statSync(d).isFile() && e) {
7940
+ if (!Xt(d)) throw Zt(d);
7941
+ let m = await Qt(d, e, t),
7822
7942
  h = (m.sizeBytes / 1024).toFixed(1),
7823
7943
  fe =
7824
7944
  m.mimeType.startsWith('image/') ||
@@ -7874,7 +7994,7 @@ Pass this URL to any Tein generation tool.`,
7874
7994
  }
7875
7995
  if (e)
7876
7996
  try {
7877
- o.params.arguments = await Xt(String(l), c, e, t, r);
7997
+ o.params.arguments = await er(String(l), c, e, t, r);
7878
7998
  } catch (p) {
7879
7999
  let d = p instanceof Error ? p.message : String(p);
7880
8000
  process.stdout.write(
@@ -7905,10 +8025,10 @@ Pass this URL to any Tein generation tool.`,
7905
8025
  body: JSON.stringify(o),
7906
8026
  }),
7907
8027
  c = await l.text(),
7908
- p = Ht(o, l.status, c);
8028
+ p = Yt(o, l.status, c);
7909
8029
  if (p === null) return;
7910
8030
  if (p) {
7911
- (o?.method === 'tools/list' && ze(p.result?.tools),
8031
+ (o?.method === 'tools/list' && Je(p.result?.tools),
7912
8032
  process.stdout.write(
7913
8033
  JSON.stringify(p) +
7914
8034
  `
@@ -7917,7 +8037,7 @@ Pass this URL to any Tein generation tool.`,
7917
8037
  return;
7918
8038
  }
7919
8039
  } catch {}
7920
- let u = qi(o);
8040
+ let u = Ei(o);
7921
8041
  u !== null &&
7922
8042
  process.stdout.write(
7923
8043
  JSON.stringify(u) +
@@ -7940,22 +8060,22 @@ Pass this URL to any Tein generation tool.`,
7940
8060
  process.stderr.write(`Tein AI MCP Server running on stdio transport.
7941
8061
  `));
7942
8062
  }
7943
- var O,
7944
- B,
7945
- Jt,
7946
- vi,
7947
- Q,
7948
- Ge,
7949
- zt,
7950
- tr = b(() => {
8063
+ var D,
8064
+ F,
8065
+ Wt,
8066
+ Ki,
8067
+ X,
8068
+ ze,
8069
+ Ht,
8070
+ ir = y(() => {
7951
8071
  'use strict';
7952
- ((O = P(require('node:fs'))),
7953
- (B = P(require('node:path'))),
7954
- (Jt = P(require('node:readline'))));
7955
- Le();
7956
- jt();
7957
- C();
7958
- vi = new Set([
8072
+ ((D = T(require('node:fs'))),
8073
+ (F = T(require('node:path'))),
8074
+ (Wt = T(require('node:readline'))));
8075
+ Ve();
8076
+ zt();
8077
+ A();
8078
+ Ki = new Set([
7959
8079
  '.png',
7960
8080
  '.jpg',
7961
8081
  '.jpeg',
@@ -7981,20 +8101,20 @@ var O,
7981
8101
  '.flac',
7982
8102
  '.opus',
7983
8103
  ]);
7984
- ((Q = new Map()), (Ge = 0));
7985
- zt = !1;
8104
+ ((X = new Map()), (ze = 0));
8105
+ Ht = !1;
7986
8106
  require.main === module &&
7987
- Zt().catch((e) => {
8107
+ tr().catch((e) => {
7988
8108
  (process.stderr.write(`Fatal error in Tein MCP CLI: ${e}
7989
8109
  `),
7990
8110
  process.exit(1));
7991
8111
  });
7992
8112
  });
7993
- var dr =
8113
+ var ur =
7994
8114
  !process.env.NO_COLOR &&
7995
8115
  (process.stdout.isTTY || process.env.FORCE_COLOR === '1' || process.env.TERM !== 'dumb');
7996
8116
  function k(e, t) {
7997
- return (r) => (dr ? `\x1B[${e}m${r}\x1B[${t}m` : String(r));
8117
+ return (r) => (ur ? `\x1B[${e}m${r}\x1B[${t}m` : String(r));
7998
8118
  }
7999
8119
  var a = {
8000
8120
  bold: k(1, 22),
@@ -8078,21 +8198,21 @@ var a = {
8078
8198
  process.stdout.isTTY && process.stdout.write('\r\x1B[K'));
8079
8199
  }
8080
8200
  };
8081
- var D = P(require('node:fs')),
8082
- A = P(require('node:path'));
8083
- var ee = P(require('node:fs')),
8084
- We = P(require('node:path')),
8085
- Ye = require('node:stream/promises');
8201
+ var V = T(require('node:fs')),
8202
+ $ = T(require('node:path'));
8203
+ var ee = T(require('node:fs')),
8204
+ Qe = T(require('node:path')),
8205
+ Xe = require('node:stream/promises');
8086
8206
  var Z = '1.1.7';
8087
- var cr = new Set([
8207
+ var mr = new Set([
8088
8208
  'account_suspended',
8089
8209
  'account_terminated',
8090
8210
  'creative_mode_restricted',
8091
8211
  'unfiltered_restricted',
8092
8212
  'workspace_paused',
8093
8213
  ]),
8094
- T = 1,
8095
- ur = 3,
8214
+ v = 1,
8215
+ fr = 3,
8096
8216
  w = class extends Error {
8097
8217
  constructor(t, r, i, s = {}) {
8098
8218
  (super(r),
@@ -8102,10 +8222,10 @@ var cr = new Set([
8102
8222
  (this.fields = s));
8103
8223
  }
8104
8224
  get exitCode() {
8105
- return this.code && cr.has(this.code) ? ur : T;
8225
+ return this.code && mr.has(this.code) ? fr : v;
8106
8226
  }
8107
8227
  };
8108
- function mr(e, t, r) {
8228
+ function gr(e, t, r) {
8109
8229
  let i = `HTTP ${e}${t ? ` ${t}` : ''}`;
8110
8230
  if (!r || typeof r != 'object') return new w(e, i);
8111
8231
  let s = r;
@@ -8118,13 +8238,13 @@ function mr(e, t, r) {
8118
8238
  c = (typeof n == 'string' && n) || (typeof u == 'string' && u) || i;
8119
8239
  return new w(e, c, typeof o == 'string' ? o : void 0, l);
8120
8240
  }
8121
- function Je(e) {
8241
+ function We(e) {
8122
8242
  return typeof e == 'number' && Number.isFinite(e) ? `$${e.toFixed(4)}` : null;
8123
8243
  }
8124
- function K(e) {
8244
+ function S(e) {
8125
8245
  let t = [e.message],
8126
- r = Je(e.fields.required),
8127
- i = Je(e.fields.balance);
8246
+ r = We(e.fields.required),
8247
+ i = We(e.fields.balance);
8128
8248
  (r || i) &&
8129
8249
  t.push([r ? `Required: ${r}` : '', i ? `Balance: ${i}` : ''].filter(Boolean).join(' '));
8130
8250
  let s = e.fields.org_name ?? e.fields.orgName;
@@ -8132,22 +8252,22 @@ function K(e) {
8132
8252
  let n = e.fields.url ?? e.fields.appeal_url ?? e.fields.top_up_url;
8133
8253
  return (typeof n == 'string' && n && t.push(n), e.code && t.push(`(${e.code})`), t);
8134
8254
  }
8135
- function fr(e) {
8255
+ function hr(e) {
8136
8256
  return /\.(mp4|webm|mov)(\?|$)/i.test(e)
8137
8257
  ? 'video'
8138
8258
  : /\.(mp3|wav|ogg|flac)(\?|$)/i.test(e)
8139
8259
  ? 'audio'
8140
8260
  : 'image';
8141
8261
  }
8142
- function He(e) {
8262
+ function Ye(e) {
8143
8263
  let t = [];
8144
8264
  for (let r of e.data ?? [])
8145
8265
  typeof r.message?.content == 'string'
8146
8266
  ? t.push({ type: 'text', text: r.message.content })
8147
- : r.url && t.push({ type: fr(r.url), url: r.url });
8267
+ : r.url && t.push({ type: hr(r.url), url: r.url, ...(r.layer ? { layer: r.layer } : {}) });
8148
8268
  return t;
8149
8269
  }
8150
- var M = class {
8270
+ var K = class {
8151
8271
  constructor(t, r) {
8152
8272
  ((this.apiKey = t), (this.baseUrl = r.replace(/\/+$/, '')));
8153
8273
  }
@@ -8170,7 +8290,7 @@ var M = class {
8170
8290
  try {
8171
8291
  n = await s.json();
8172
8292
  } catch {}
8173
- throw mr(s.status, s.statusText, n);
8293
+ throw gr(s.status, s.statusText, n);
8174
8294
  }
8175
8295
  return await s.json();
8176
8296
  }
@@ -8184,7 +8304,7 @@ var M = class {
8184
8304
  s === 'succeeded' || s === 'failed' || s === 'expired' || s === 'cancelled'
8185
8305
  ? s
8186
8306
  : 'processing',
8187
- o = He(i);
8307
+ o = Ye(i);
8188
8308
  return {
8189
8309
  request_id: i.request_id || i.id || '',
8190
8310
  model: i.model,
@@ -8202,7 +8322,7 @@ var M = class {
8202
8322
  i === 'succeeded' || i === 'failed' || i === 'expired' || i === 'cancelled'
8203
8323
  ? i
8204
8324
  : 'processing',
8205
- n = He(r),
8325
+ n = Ye(r),
8206
8326
  o = r.error && typeof r.error.message == 'string' ? r.error.message : null;
8207
8327
  return {
8208
8328
  request_id: r.id || t,
@@ -8220,14 +8340,14 @@ var M = class {
8220
8340
  async downloadOutput(t, r) {
8221
8341
  let i = await fetch(t);
8222
8342
  if (!i.ok) throw new Error(`The file could not be downloaded (HTTP ${i.status})`);
8223
- let s = We.default.dirname(r);
8343
+ let s = Qe.default.dirname(r);
8224
8344
  ee.default.existsSync(s) || ee.default.mkdirSync(s, { recursive: !0 });
8225
8345
  let n = ee.default.createWriteStream(r);
8226
- return (await (0, Ye.pipeline)(i.body, n), r);
8346
+ return (await (0, Xe.pipeline)(i.body, n), r);
8227
8347
  }
8228
8348
  };
8229
- C();
8230
- function ke(e) {
8349
+ A();
8350
+ function we(e) {
8231
8351
  if (typeof e != 'number' || !Number.isFinite(e)) return '';
8232
8352
  if (Math.abs(e) >= 1 || Math.abs(Number(e.toFixed(4)) - e) < 1e-12) return `$${e.toFixed(4)}`;
8233
8353
  let t = Math.max(0, 3 - Number(e.toExponential(3).split('e')[1])),
@@ -8235,43 +8355,43 @@ function ke(e) {
8235
8355
  i = Math.round(Number((e * r).toFixed(6))) / r;
8236
8356
  return i >= 1 ? `$${i.toFixed(4)}` : `$${i.toFixed(t).replace(/0+$/, '')}`;
8237
8357
  }
8238
- H();
8239
- var $t = ['images', 'input_images', 'videos', 'audios'];
8240
- function Wr(e) {
8241
- for (let t of $t) typeof e[t] == 'string' && (e[t] = [e[t]]);
8358
+ W();
8359
+ var Et = ['images', 'input_images', 'videos', 'audios'];
8360
+ function Qr(e) {
8361
+ for (let t of Et) typeof e[t] == 'string' && (e[t] = [e[t]]);
8242
8362
  }
8243
- function Yr(e) {
8363
+ function Xr(e) {
8244
8364
  if (e.startsWith('http://') || e.startsWith('https://')) return null;
8245
- let t = A.default.resolve(e);
8246
- return D.default.existsSync(t) && D.default.statSync(t).isFile() ? t : null;
8365
+ let t = $.default.resolve(e);
8366
+ return V.default.existsSync(t) && V.default.statSync(t).isFile() ? t : null;
8247
8367
  }
8248
- async function Qr(e, t) {
8249
- for (let r of $t) {
8368
+ async function Zr(e, t) {
8369
+ for (let r of Et) {
8250
8370
  if (!Array.isArray(e[r])) continue;
8251
8371
  let i = [];
8252
8372
  for (let s of e[r]) {
8253
8373
  if (typeof s != 'string') continue;
8254
- let n = Yr(s);
8374
+ let n = Xr(s);
8255
8375
  i.push(n ? await t(n) : s);
8256
8376
  }
8257
8377
  e[r] = i;
8258
8378
  }
8259
8379
  }
8260
- var W = { starter: 10, plus: 25, scale: 40, enterprise: 300 };
8261
- function Xr(e) {
8380
+ var Y = { starter: 10, plus: 25, scale: 40, enterprise: 300 };
8381
+ function ei(e) {
8262
8382
  if (e.count === void 0 || e.count === !0) return 1;
8263
8383
  let t = typeof e.count == 'number' ? e.count : Number(e.count),
8264
- r = W.enterprise;
8384
+ r = Y.enterprise;
8265
8385
  return (
8266
8386
  (!Number.isInteger(t) || t < 1 || t > r) &&
8267
8387
  (process.stderr
8268
- .write(`${a.red('Error:')} --count must be a whole number from 1 to ${r}. The API allows Starter ${W.starter}, Plus ${W.plus}, Scale ${W.scale}, Enterprise ${W.enterprise} at once, including polling.
8388
+ .write(`${a.red('Error:')} --count must be a whole number from 1 to ${r}. The API allows Starter ${Y.starter}, Plus ${Y.plus}, Scale ${Y.scale}, Enterprise ${Y.enterprise} at once, including polling.
8269
8389
  `),
8270
8390
  process.exit(1)),
8271
8391
  t
8272
8392
  );
8273
8393
  }
8274
- async function Zr(e, t, r, i, s) {
8394
+ async function ti(e, t, r, i, s) {
8275
8395
  s.isJson ||
8276
8396
  process.stderr.write(`Starting ${i} ${t} jobs together...
8277
8397
  `);
@@ -8333,20 +8453,25 @@ async function Zr(e, t, r, i, s) {
8333
8453
  else {
8334
8454
  for (let l of o)
8335
8455
  (process.stdout.write(`${l.request_id} ${l.status}`),
8336
- l.usage?.cost !== void 0 && process.stdout.write(` ${ke(l.usage.cost)}`),
8456
+ l.usage?.cost !== void 0 && process.stdout.write(` ${we(l.usage.cost)}`),
8337
8457
  l.error && process.stdout.write(` ${l.error}`),
8338
8458
  process.stdout.write(`
8339
8459
  `));
8340
8460
  for (let l of u)
8341
- process.stderr.write(`${K(l).join(`
8461
+ process.stderr.write(`${S(l).join(`
8342
8462
  `)}
8343
8463
  `);
8344
8464
  }
8345
8465
  (u.length ||
8346
8466
  o.some((l) => l.status === 'failed' || l.status === 'expired' || l.status === 'cancelled')) &&
8347
- process.exit(T);
8467
+ process.exit(v);
8468
+ }
8469
+ function ri(e, t, r) {
8470
+ if (r <= 1) return e;
8471
+ let i = $.default.extname(e);
8472
+ return `${e.slice(0, e.length - i.length)}-${t + 1}${i}`;
8348
8473
  }
8349
- function Ct(e) {
8474
+ function At(e) {
8350
8475
  let t = {},
8351
8476
  r = new Set(),
8352
8477
  i = [];
@@ -8391,9 +8516,9 @@ function Ct(e) {
8391
8516
  }
8392
8517
  return { command: i[0] || '', subcommand: i[1], modelSlug: i[1] || i[0], options: t, flags: r };
8393
8518
  }
8394
- async function De(e, t) {
8395
- let r = S(typeof t.api_key == 'string' ? t.api_key : void 0),
8396
- i = x(typeof t.api_url == 'string' ? t.api_url : void 0);
8519
+ async function Le(e, t) {
8520
+ let r = q(typeof t.api_key == 'string' ? t.api_key : void 0),
8521
+ i = P(typeof t.api_url == 'string' ? t.api_url : void 0);
8397
8522
  (r ||
8398
8523
  (process.stderr.write(`${a.red('Error:')} Authentication required.
8399
8524
  `),
@@ -8409,11 +8534,11 @@ async function De(e, t) {
8409
8534
  process.stderr.write(`Run ${a.cyan('tein models')} to list all available models.
8410
8535
  `),
8411
8536
  process.exit(1)));
8412
- let s = U(e),
8537
+ let s = j(e),
8413
8538
  n = !!t.json,
8414
8539
  o = !!(t.async || t.no_wait),
8415
8540
  u = typeof t.output == 'string' ? t.output : void 0,
8416
- l = Xr(t),
8541
+ l = ei(t),
8417
8542
  c = { ...t };
8418
8543
  (delete c.json,
8419
8544
  delete c.async,
@@ -8422,76 +8547,76 @@ async function De(e, t) {
8422
8547
  delete c.api_key,
8423
8548
  delete c.api_url,
8424
8549
  delete c.count);
8425
- let p = qt(s, c);
8426
- (Wr(p),
8550
+ let p = Ct(s, c);
8551
+ (Qr(p),
8427
8552
  typeof p.image == 'string' && !p.images && ((p.images = [p.image]), delete p.image),
8428
8553
  p.image_url &&
8429
8554
  !p.first_frame_image &&
8430
8555
  (e.startsWith('seedance') || e.startsWith('happy-horse')) &&
8431
8556
  (p.first_frame_image = p.image_url));
8432
- let d = new M(r, i),
8557
+ let d = new K(r, i),
8433
8558
  m = ['image', 'first_frame_image', 'last_frame_image', 'lipsyncing_audio', 'audio', 'video'];
8434
- for (let y of m) {
8435
- let f = p[y];
8436
- if (typeof f == 'string' && !f.startsWith('http://') && !f.startsWith('https://')) {
8437
- let I = A.default.resolve(f);
8438
- if (D.default.existsSync(I) && D.default.statSync(I).isFile()) {
8439
- let v = new _(`Uploading local file ${A.default.basename(I)} to CDN...`);
8440
- n || v.start();
8559
+ for (let b of m) {
8560
+ let g = p[b];
8561
+ if (typeof g == 'string' && !g.startsWith('http://') && !g.startsWith('https://')) {
8562
+ let x = $.default.resolve(g);
8563
+ if (V.default.existsSync(x) && V.default.statSync(x).isFile()) {
8564
+ let I = new _(`Uploading local file ${$.default.basename(x)} to CDN...`);
8565
+ n || I.start();
8441
8566
  try {
8442
- let F = D.default.readFileSync(I),
8443
- X = await d.uploadAsset(F.toString('base64'));
8444
- ((p[y] = X.url), n || v.succeed(`Uploaded ${A.default.basename(I)} to CDN`));
8445
- } catch (F) {
8446
- let X = F instanceof Error ? F.message : String(F);
8567
+ let L = V.default.readFileSync(x),
8568
+ C = await d.uploadAsset(L.toString('base64'));
8569
+ ((p[b] = C.url), n || I.succeed(`Uploaded ${$.default.basename(x)} to CDN`));
8570
+ } catch (L) {
8571
+ let C = L instanceof Error ? L.message : String(L);
8447
8572
  (n
8448
8573
  ? process.stdout.write(
8449
- JSON.stringify({ error: X }) +
8574
+ JSON.stringify({ error: C }) +
8450
8575
  `
8451
8576
  `,
8452
8577
  )
8453
- : v.fail(`Upload failed: ${X}`),
8578
+ : I.fail(`Upload failed: ${C}`),
8454
8579
  process.exit(1));
8455
8580
  }
8456
8581
  }
8457
8582
  }
8458
8583
  }
8459
- await Qr(p, async (y) => {
8460
- let f = new _(`Uploading local file ${A.default.basename(y)} to CDN...`);
8461
- n || f.start();
8584
+ await Zr(p, async (b) => {
8585
+ let g = new _(`Uploading local file ${$.default.basename(b)} to CDN...`);
8586
+ n || g.start();
8462
8587
  try {
8463
- let I = D.default.readFileSync(y),
8464
- v = await d.uploadAsset(I.toString('base64'));
8465
- return (n || f.succeed(`Uploaded ${A.default.basename(y)} to CDN`), v.url);
8466
- } catch (I) {
8467
- let v = I instanceof Error ? I.message : String(I);
8588
+ let x = V.default.readFileSync(b),
8589
+ I = await d.uploadAsset(x.toString('base64'));
8590
+ return (n || g.succeed(`Uploaded ${$.default.basename(b)} to CDN`), I.url);
8591
+ } catch (x) {
8592
+ let I = x instanceof Error ? x.message : String(x);
8468
8593
  (n
8469
8594
  ? process.stdout.write(
8470
- JSON.stringify({ error: v }) +
8595
+ JSON.stringify({ error: I }) +
8471
8596
  `
8472
8597
  `,
8473
8598
  )
8474
- : f.fail(`Upload failed: ${v}`),
8599
+ : g.fail(`Upload failed: ${I}`),
8475
8600
  process.exit(1));
8476
8601
  }
8477
8602
  });
8478
8603
  let h = new _(`Submitting task for ${a.bold(e)}...`);
8479
8604
  n || h.start();
8480
- let g;
8605
+ let f;
8481
8606
  try {
8482
8607
  if (l > 1) {
8483
- await Zr(d, e, p, l, { isJson: n, isAsync: o });
8608
+ await ti(d, e, p, l, { isJson: n, isAsync: o });
8484
8609
  return;
8485
8610
  }
8486
- g = await d.queueJob(e, p);
8487
- } catch (y) {
8488
- let f = y instanceof w ? y : null;
8611
+ f = await d.queueJob(e, p);
8612
+ } catch (b) {
8613
+ let g = b instanceof w ? b : null;
8489
8614
  (n
8490
8615
  ? process.stdout.write(
8491
8616
  JSON.stringify(
8492
- f
8493
- ? { error: { code: f.code ?? null, message: f.message, ...f.fields } }
8494
- : { error: { code: null, message: y instanceof Error ? y.message : String(y) } },
8617
+ g
8618
+ ? { error: { code: g.code ?? null, message: g.message, ...g.fields } }
8619
+ : { error: { code: null, message: b instanceof Error ? b.message : String(b) } },
8495
8620
  null,
8496
8621
  2,
8497
8622
  ) +
@@ -8499,59 +8624,59 @@ async function De(e, t) {
8499
8624
  `,
8500
8625
  )
8501
8626
  : h.fail(
8502
- f
8503
- ? K(f).join(`
8627
+ g
8628
+ ? S(g).join(`
8504
8629
  `)
8505
- : `Failed to start generation: ${y instanceof Error ? y.message : y}`,
8630
+ : `Failed to start generation: ${b instanceof Error ? b.message : b}`,
8506
8631
  ),
8507
- process.exit(f ? f.exitCode : T));
8632
+ process.exit(g ? g.exitCode : v));
8508
8633
  }
8509
8634
  if (o) {
8510
8635
  n
8511
8636
  ? process.stdout.write(
8512
- JSON.stringify(g, null, 2) +
8637
+ JSON.stringify(f, null, 2) +
8513
8638
  `
8514
8639
  `,
8515
8640
  )
8516
- : (h.succeed(`Queued successfully! Request ID: ${a.bold(g.request_id)}`),
8517
- process.stdout.write(`Check status anytime with: ${a.cyan(`tein status ${g.request_id}`)}
8641
+ : (h.succeed(`Queued successfully! Request ID: ${a.bold(f.request_id)}`),
8642
+ process.stdout.write(`Check status anytime with: ${a.cyan(`tein status ${f.request_id}`)}
8518
8643
  `));
8519
8644
  return;
8520
8645
  }
8521
8646
  let fe = Date.now(),
8522
8647
  ge = 1500;
8523
- for (; g.status === 'processing';) {
8524
- let y = Math.round((Date.now() - fe) / 1e3);
8525
- (n || h.update(`Rendering ${a.bold(e)} (${y}s elapsed)... [ID: ${g.request_id}]`),
8526
- await new Promise((f) => setTimeout(f, ge)));
8648
+ for (; f.status === 'processing';) {
8649
+ let b = Math.round((Date.now() - fe) / 1e3);
8650
+ (n || h.update(`Rendering ${a.bold(e)} (${b}s elapsed)... [ID: ${f.request_id}]`),
8651
+ await new Promise((g) => setTimeout(g, ge)));
8527
8652
  try {
8528
- g = await d.getStatus(g.request_id);
8529
- } catch (f) {
8530
- f instanceof w &&
8531
- f.exitCode !== T &&
8653
+ f = await d.getStatus(f.request_id);
8654
+ } catch (g) {
8655
+ g instanceof w &&
8656
+ g.exitCode !== v &&
8532
8657
  (n ||
8533
8658
  h.fail(
8534
- K(f).join(`
8659
+ S(g).join(`
8535
8660
  `),
8536
8661
  ),
8537
- process.exit(f.exitCode));
8662
+ process.exit(g.exitCode));
8538
8663
  }
8539
8664
  }
8540
8665
  if (
8541
- ((g.status === 'failed' || g.status === 'expired' || g.status === 'cancelled') &&
8666
+ ((f.status === 'failed' || f.status === 'expired' || f.status === 'cancelled') &&
8542
8667
  (n
8543
8668
  ? process.stdout.write(
8544
- JSON.stringify(g, null, 2) +
8669
+ JSON.stringify(f, null, 2) +
8545
8670
  `
8546
8671
  `,
8547
8672
  )
8548
- : h.fail(`Generation ${g.status}: ${g.error || 'Something failed on our side.'}`),
8549
- process.exit(T)),
8673
+ : h.fail(`Generation ${f.status}: ${f.error || 'Something failed on our side.'}`),
8674
+ process.exit(v)),
8550
8675
  n || h.succeed(`Generation completed for ${a.bold(s?.name || e)}!`),
8551
8676
  n)
8552
8677
  ) {
8553
8678
  process.stdout.write(
8554
- JSON.stringify(g, null, 2) +
8679
+ JSON.stringify(f, null, 2) +
8555
8680
  `
8556
8681
  `,
8557
8682
  );
@@ -8562,47 +8687,51 @@ async function De(e, t) {
8562
8687
  `),
8563
8688
  process.stdout.write(` ${a.bold('Status:')} ${a.green('Succeeded')}
8564
8689
  `),
8565
- process.stdout.write(` ${a.bold('Request ID:')} ${g.request_id}
8690
+ process.stdout.write(` ${a.bold('Request ID:')} ${f.request_id}
8566
8691
  `),
8567
- g.usage?.cost !== void 0 &&
8568
- process.stdout.write(` ${a.bold('Cost:')} ${ke(g.usage.cost)}
8692
+ f.usage?.cost !== void 0 &&
8693
+ process.stdout.write(` ${a.bold('Cost:')} ${we(f.usage.cost)}
8569
8694
  `),
8570
- g.output && g.output.length > 0)
8695
+ f.output && f.output.length > 0)
8571
8696
  ) {
8572
8697
  process.stdout.write(`
8573
8698
  ${a.bold('Outputs:')}
8574
8699
  `);
8575
- for (let y = 0; y < g.output.length; y++) {
8576
- let f = g.output[y];
8577
- if (f.url) {
8700
+ let b = f.output.filter((x) => x.url).length,
8701
+ g = 0;
8702
+ for (let x = 0; x < f.output.length; x++) {
8703
+ let I = f.output[x];
8704
+ if (I.url) {
8705
+ let L = I.layer?.name ? ` ${a.bold(I.layer.name)}` : '';
8578
8706
  if (
8579
- (process.stdout.write(` [${f.type.toUpperCase()}] ${a.cyan(a.underline(f.url))}
8707
+ (process.stdout.write(` [${I.type.toUpperCase()}]${L} ${a.cyan(a.underline(I.url))}
8580
8708
  `),
8581
8709
  u)
8582
8710
  ) {
8583
- let I = new _(`Downloading output to ${u}...`).start();
8711
+ let C = ri(u, g++, b),
8712
+ He = new _(`Downloading output to ${C}...`).start();
8584
8713
  try {
8585
- (await d.downloadOutput(f.url, A.default.resolve(process.cwd(), u)),
8586
- I.succeed(`Saved to ${a.bold(u)}`));
8587
- } catch (v) {
8588
- I.fail(`Failed to download: ${v instanceof Error ? v.message : v}`);
8714
+ (await d.downloadOutput(I.url, $.default.resolve(process.cwd(), C)),
8715
+ He.succeed(`Saved to ${a.bold(C)}`));
8716
+ } catch (he) {
8717
+ He.fail(`Failed to download: ${he instanceof Error ? he.message : he}`);
8589
8718
  }
8590
8719
  }
8591
8720
  } else
8592
- f.text &&
8721
+ I.text &&
8593
8722
  process.stdout.write(`
8594
- ${f.text}
8723
+ ${I.text}
8595
8724
  `);
8596
8725
  }
8597
8726
  }
8598
8727
  process.stdout.write(`
8599
8728
  `);
8600
8729
  }
8601
- var Et = P(require('node:readline'));
8602
- C();
8603
- async function ei(e) {
8730
+ var Ot = T(require('node:readline'));
8731
+ A();
8732
+ async function ii(e) {
8604
8733
  try {
8605
- return (await new M(e, x()).checkKey(), 'ok');
8734
+ return (await new K(e, P()).checkKey(), 'ok');
8606
8735
  } catch (t) {
8607
8736
  if (t instanceof w) {
8608
8737
  if (t.status === 401) return 'invalid';
@@ -8611,15 +8740,15 @@ async function ei(e) {
8611
8740
  return 'unchecked';
8612
8741
  }
8613
8742
  }
8614
- function ti(e) {
8615
- let t = Et.default.createInterface({ input: process.stdin, output: process.stdout });
8743
+ function ai(e) {
8744
+ let t = Ot.default.createInterface({ input: process.stdin, output: process.stdout });
8616
8745
  return new Promise((r) => {
8617
8746
  t.question(e, (i) => {
8618
8747
  (t.close(), r(i.trim()));
8619
8748
  });
8620
8749
  });
8621
8750
  }
8622
- async function Y(e, t) {
8751
+ async function Q(e, t) {
8623
8752
  switch (e) {
8624
8753
  case 'login':
8625
8754
  case 'set-key': {
@@ -8631,20 +8760,20 @@ ${a.bold('Tein AI Authentication')}
8631
8760
  process.stdout.write(`Get your API key at: ${a.cyan('https://tein.ai/dashboard/keys')}
8632
8761
 
8633
8762
  `),
8634
- (r = await ti('Enter your Tein API Key (sk_live_...): '))),
8763
+ (r = await ai('Enter your Tein API Key (sk_live_...): '))),
8635
8764
  !r.startsWith('sk_live_') &&
8636
8765
  !r.startsWith('sk_test_') &&
8637
8766
  (process.stderr
8638
8767
  .write(`${a.red('Error:')} Invalid key format. Tein API keys start with 'sk_live_' or 'sk_test_'.
8639
8768
  `),
8640
8769
  process.exit(1)));
8641
- let i = await ei(r);
8770
+ let i = await ii(r);
8642
8771
  (i === 'invalid' &&
8643
8772
  (process.stderr
8644
8773
  .write(`${a.red('Error:')} Tein did not accept this key. Copy it again from ${a.cyan('https://tein.ai/dashboard/keys')}. Nothing was saved.
8645
8774
  `),
8646
8775
  process.exit(1)),
8647
- be({ apiKey: r }),
8776
+ ke({ apiKey: r }),
8648
8777
  process.stdout.write(`
8649
8778
  ${a.green('\u2713')} API key saved to ${a.dim(re())}
8650
8779
  `),
@@ -8663,22 +8792,22 @@ ${a.green('\u2713')} API key saved to ${a.dim(re())}
8663
8792
  break;
8664
8793
  }
8665
8794
  case 'logout': {
8666
- if (!V().apiKey) {
8795
+ if (!U().apiKey) {
8667
8796
  process.stdout
8668
8797
  .write(`${a.yellow('\u2139')} No active API key found. You are already logged out.
8669
8798
  `);
8670
8799
  break;
8671
8800
  }
8672
- (be({ apiKey: '' }),
8801
+ (ke({ apiKey: '' }),
8673
8802
  process.stdout
8674
8803
  .write(`${a.green('\u2713')} Logged out successfully. Stored API key has been cleared from ${a.dim(re())}
8675
8804
  `));
8676
8805
  break;
8677
8806
  }
8678
8807
  default: {
8679
- let r = S(),
8680
- i = x(),
8681
- s = V();
8808
+ let r = q(),
8809
+ i = P(),
8810
+ s = U();
8682
8811
  if (
8683
8812
  (process.stdout.write(`
8684
8813
  ${a.bold('Tein AI CLI Configuration')}
@@ -8707,32 +8836,32 @@ ${a.bold('Tein AI CLI Configuration')}
8707
8836
  }
8708
8837
  }
8709
8838
  }
8710
- C();
8711
- we();
8712
- H();
8713
- var ri = 3e3;
8714
- async function At(e) {
8839
+ A();
8840
+ xe();
8841
+ W();
8842
+ var si = 3e3;
8843
+ async function Rt(e) {
8715
8844
  try {
8716
- let t = await fetch(`${x(e)}/v1/pricing`, { signal: AbortSignal.timeout(ri) });
8845
+ let t = await fetch(`${P(e)}/v1/pricing`, { signal: AbortSignal.timeout(si) });
8717
8846
  if (!t.ok) return;
8718
8847
  let r = await t.json(),
8719
8848
  i = {};
8720
8849
  for (let s of r.configs ?? []) {
8721
8850
  let n = String(s.modelSlug ?? '');
8722
- j.has(n) && (i[n] ??= []).push(Number(s.starterPrice));
8851
+ G.has(n) && (i[n] ??= []).push(Number(s.starterPrice));
8723
8852
  }
8724
- Pt(i);
8853
+ vt(i);
8725
8854
  } catch {}
8726
8855
  }
8727
- var ii = new Set(['video', 'image', 'text', 'audio', '3d']),
8728
- ai = { llm: 'text', chat: 'text', reasoning: 'text' };
8729
- async function Ot(e, t) {
8730
- await At(t);
8731
- let r = E();
8856
+ var ni = new Set(['video', 'image', 'text', 'audio', '3d']),
8857
+ oi = { llm: 'text', chat: 'text', reasoning: 'text' };
8858
+ async function Dt(e, t) {
8859
+ await Rt(t);
8860
+ let r = R();
8732
8861
  if (e) {
8733
8862
  let n = e.toLowerCase(),
8734
- o = ai[n] ?? n;
8735
- r = ii.has(o)
8863
+ o = oi[n] ?? n;
8864
+ r = ni.has(o)
8736
8865
  ? r.filter((u) => u.category.toLowerCase() === o)
8737
8866
  : r.filter((u) => u.kind.toLowerCase().includes(n) || u.slug.toLowerCase().includes(n));
8738
8867
  }
@@ -8770,9 +8899,9 @@ ${a.bold('Tein AI Models Catalog')} (${r.length} available)
8770
8899
 
8771
8900
  `);
8772
8901
  }
8773
- async function Rt(e, t) {
8774
- j.has(e) && (await At(t));
8775
- let r = U(e);
8902
+ async function Lt(e, t) {
8903
+ G.has(e) && (await Rt(t));
8904
+ let r = j(e);
8776
8905
  (r ||
8777
8906
  (process.stderr.write(`${a.red('Error:')} Model "${e}" not found in Tein AI registry.
8778
8907
  `),
@@ -8851,10 +8980,10 @@ ${a.bold(a.cyan(r.name))} (${a.bold(r.slug)})
8851
8980
 
8852
8981
  `);
8853
8982
  }
8854
- C();
8855
- Le();
8856
- var si = 1e4,
8857
- Ne = {
8983
+ A();
8984
+ Ve();
8985
+ var li = 1e4,
8986
+ Ue = {
8858
8987
  price: '',
8859
8988
  creativeMode: 'Creative mode',
8860
8989
  priority: 'Priority',
@@ -8864,22 +8993,22 @@ var si = 1e4,
8864
8993
  priorityDraft: 'Priority + Draft',
8865
8994
  creativeModePriorityDraft: 'Creative mode + Priority + Draft',
8866
8995
  },
8867
- ni = Object.keys(Ne),
8868
- oi = {
8996
+ pi = Object.keys(Ue),
8997
+ di = {
8869
8998
  creativeMode: 'unfiltered',
8870
8999
  creativeModePriority: 'unfilteredPriority',
8871
9000
  creativeModeDraft: 'unfilteredDraft',
8872
9001
  creativeModePriorityDraft: 'unfilteredPriorityDraft',
8873
9002
  };
8874
- function li(e, t) {
8875
- let r = oi[t];
9003
+ function ci(e, t) {
9004
+ let r = di[t];
8876
9005
  return e[t] ?? (r ? e[r] : void 0);
8877
9006
  }
8878
- async function pi(e, t) {
8879
- let r = `${x(e)}${me(t)}`,
9007
+ async function ui(e, t) {
9008
+ let r = `${P(e)}${me(t)}`,
8880
9009
  i;
8881
9010
  try {
8882
- i = await fetch(r, { signal: AbortSignal.timeout(si) });
9011
+ i = await fetch(r, { signal: AbortSignal.timeout(li) });
8883
9012
  } catch {
8884
9013
  throw new Error(`Could not reach ${r}`);
8885
9014
  }
@@ -8895,18 +9024,18 @@ async function pi(e, t) {
8895
9024
  }
8896
9025
  return s;
8897
9026
  }
8898
- function Ve(e) {
9027
+ function Ne(e) {
8899
9028
  let t = e.toFixed(4).replace(/0+$/, '').replace(/\.$/, ''),
8900
9029
  [r, i = ''] = t.split('.');
8901
9030
  return `$${r}.${i.padEnd(2, '0')}`;
8902
9031
  }
8903
- function Ue(e) {
9032
+ function Be(e) {
8904
9033
  if (!e || typeof e.starter != 'number') return null;
8905
9034
  let t = typeof e.plus == 'number' ? e.plus : e.starter,
8906
9035
  r = typeof e.scale == 'number' ? e.scale : t;
8907
- return `Starter ${Ve(e.starter)} Plus ${Ve(t)} Scale ${Ve(r)}`;
9036
+ return `Starter ${Ne(e.starter)} Plus ${Ne(t)} Scale ${Ne(r)}`;
8908
9037
  }
8909
- function di(e) {
9038
+ function mi(e) {
8910
9039
  if (typeof e.label == 'string' && e.label.trim()) return e.label.trim();
8911
9040
  let t = [];
8912
9041
  for (let r of ['endpoint', 'resolution', 'quality', 'mode', 'task', 'component', 'token']) {
@@ -8918,33 +9047,33 @@ function di(e) {
8918
9047
  t.length ? t.join(' \xB7 ') : String(e.id ?? 'default')
8919
9048
  );
8920
9049
  }
8921
- function ci(e, t) {
8922
- let r = di(e);
8923
- for (let i of ni) {
8924
- let s = Ue(li(e, i));
9050
+ function fi(e, t) {
9051
+ let r = mi(e);
9052
+ for (let i of pi) {
9053
+ let s = Be(ci(e, i));
8925
9054
  if (!s) continue;
8926
- let n = Ne[i] ? ` (${Ne[i]})` : '';
9055
+ let n = Ue[i] ? ` (${Ue[i]})` : '';
8927
9056
  t.push(` ${r}${n} ${s}`);
8928
9057
  }
8929
9058
  }
8930
- function ui(e, t) {
9059
+ function gi(e, t) {
8931
9060
  let r = e.quality ? ` quality=${e.quality}` : '';
8932
9061
  t.push(
8933
9062
  ` ${a.bold(e.slug.padEnd(26))} ${a.gray(e.name)} ${a.dim(`${e.kind} ${e.unit} model=${e.model}${r}`)}`,
8934
9063
  );
8935
- for (let s of e.variants ?? []) ci(s, t);
9064
+ for (let s of e.variants ?? []) fi(s, t);
8936
9065
  let i = e.addons;
8937
9066
  if (Array.isArray(i))
8938
9067
  for (let s of i) {
8939
9068
  if (!s || typeof s != 'object') continue;
8940
9069
  let n = s,
8941
9070
  o = typeof n.label == 'string' ? n.label : String(n.id ?? 'add-on'),
8942
- u = Ue(n.price);
9071
+ u = Be(n.price);
8943
9072
  u && t.push(` ${o} (add-on) ${u}`);
8944
9073
  }
8945
9074
  t.push('');
8946
9075
  }
8947
- function mi(e) {
9076
+ function hi(e) {
8948
9077
  let t = [],
8949
9078
  r = e.board.checked ? ` \xB7 checked ${e.board.checked}` : '';
8950
9079
  (t.push(`${a.bold('Tein prices')} ${a.green(e.currency)} ${e.count} models${r}`),
@@ -8966,7 +9095,7 @@ function mi(e) {
8966
9095
  });
8967
9096
  for (let l of n) {
8968
9097
  t.push(`${a.bold(a.cyan(`\u2500\u2500 ${l} \u2500\u2500`))}`);
8969
- for (let c of i.get(l) ?? []) ui(c, t);
9098
+ for (let c of i.get(l) ?? []) gi(c, t);
8970
9099
  }
8971
9100
  let o = new Set(e.board.models.map((l) => l.slug.toLowerCase())),
8972
9101
  u = (e.configs ?? []).filter((l) => !o.has(String(l.modelSlug ?? '').toLowerCase()));
@@ -8983,8 +9112,8 @@ function mi(e) {
8983
9112
  t.push(` ${a.bold(c.padEnd(26))} ${a.gray(d)}`);
8984
9113
  for (let m of p) {
8985
9114
  let h = String(m.displayLabel ?? m.billingUnit ?? 'price'),
8986
- g = Ue(m.prices);
8987
- g && t.push(` ${h} ${g}`);
9115
+ f = Be(m.prices);
9116
+ f && t.push(` ${h} ${f}`);
8988
9117
  }
8989
9118
  t.push('');
8990
9119
  }
@@ -8996,10 +9125,10 @@ function mi(e) {
8996
9125
  `
8997
9126
  );
8998
9127
  }
8999
- async function Dt(e) {
9128
+ async function Vt(e) {
9000
9129
  let t;
9001
9130
  try {
9002
- t = await pi(e.apiUrl, e.model);
9131
+ t = await ui(e.apiUrl, e.model);
9003
9132
  } catch (r) {
9004
9133
  let i = r instanceof Error ? r.message : String(r);
9005
9134
  (process.stderr.write(`${a.red('Error:')} ${i}
@@ -9010,14 +9139,14 @@ async function Dt(e) {
9010
9139
  e.json
9011
9140
  ? `${JSON.stringify(t, null, 2)}
9012
9141
  `
9013
- : mi(t),
9142
+ : hi(t),
9014
9143
  );
9015
9144
  }
9016
- var Lt = P(require('node:path'));
9017
- C();
9018
- async function Vt(e, t) {
9019
- let r = S(typeof t.api_key == 'string' ? t.api_key : void 0),
9020
- i = x(typeof t.api_url == 'string' ? t.api_url : void 0);
9145
+ var Nt = T(require('node:path'));
9146
+ A();
9147
+ async function Ut(e, t) {
9148
+ let r = q(typeof t.api_key == 'string' ? t.api_key : void 0),
9149
+ i = P(typeof t.api_url == 'string' ? t.api_url : void 0);
9021
9150
  (r ||
9022
9151
  (process.stderr.write(`${a.red('Error:')} Authentication required.
9023
9152
  `),
@@ -9034,7 +9163,7 @@ async function Vt(e, t) {
9034
9163
  let s = !!t.json,
9035
9164
  n = !!t.wait,
9036
9165
  o = typeof t.output == 'string' ? t.output : void 0,
9037
- u = new M(r, i),
9166
+ u = new K(r, i),
9038
9167
  l = new _(`Checking status of ${a.bold(e)}...`);
9039
9168
  s || l.start();
9040
9169
  let c;
@@ -9053,12 +9182,12 @@ async function Vt(e, t) {
9053
9182
  `,
9054
9183
  )
9055
9184
  : l.fail(
9056
- K(p).join(`
9185
+ S(p).join(`
9057
9186
  `),
9058
9187
  ),
9059
9188
  process.exit(p.exitCode)),
9060
9189
  s || l.fail(p instanceof Error ? p.message : String(p)),
9061
- process.exit(T));
9190
+ process.exit(v));
9062
9191
  }
9063
9192
  if (n && c.status === 'processing') {
9064
9193
  let p = Date.now();
@@ -9110,7 +9239,7 @@ ${a.bold('Outputs:')}
9110
9239
  ) {
9111
9240
  let d = new _(`Downloading output to ${o}...`).start();
9112
9241
  try {
9113
- (await u.downloadOutput(p.url, Lt.default.resolve(process.cwd(), o)),
9242
+ (await u.downloadOutput(p.url, Nt.default.resolve(process.cwd(), o)),
9114
9243
  d.succeed(`Saved to ${a.bold(o)}`));
9115
9244
  } catch (m) {
9116
9245
  d.fail(`Failed to download: ${m instanceof Error ? m.message : m}`);
@@ -9125,12 +9254,12 @@ ${p.text}
9125
9254
  process.stdout.write(`
9126
9255
  `);
9127
9256
  }
9128
- var Be = P(require('node:fs')),
9129
- Fe = P(require('node:path'));
9130
- C();
9131
- async function Nt(e, t = {}) {
9132
- let r = S(typeof t.api_key == 'string' ? t.api_key : void 0),
9133
- i = x(typeof t.api_url == 'string' ? t.api_url : void 0),
9257
+ var je = T(require('node:fs')),
9258
+ Fe = T(require('node:path'));
9259
+ A();
9260
+ async function Bt(e, t = {}) {
9261
+ let r = q(typeof t.api_key == 'string' ? t.api_key : void 0),
9262
+ i = P(typeof t.api_url == 'string' ? t.api_url : void 0),
9134
9263
  s = !!t.json;
9135
9264
  (r ||
9136
9265
  (process.stderr.write(`${a.red('Error:')} Authentication required.
@@ -9146,13 +9275,13 @@ async function Nt(e, t = {}) {
9146
9275
  `),
9147
9276
  process.exit(1)));
9148
9277
  let n = Fe.default.resolve(e);
9149
- Be.default.existsSync(n) ||
9278
+ je.default.existsSync(n) ||
9150
9279
  (process.stderr.write(`${a.red('Error:')} File not found: ${n}
9151
9280
  `),
9152
9281
  process.exit(1));
9153
9282
  let o = Fe.default.basename(n),
9154
- l = Be.default.readFileSync(n).toString('base64'),
9155
- c = new M(r, i),
9283
+ l = je.default.readFileSync(n).toString('base64'),
9284
+ c = new K(r, i),
9156
9285
  p = new _(`Uploading ${a.bold(o)} to Tein AI CDN...`);
9157
9286
  s || p.start();
9158
9287
  try {
@@ -9177,7 +9306,7 @@ ${a.bold('CDN URL:')} ${a.green(d.url)}
9177
9306
  } catch (d) {
9178
9307
  let m = d instanceof w ? d : null,
9179
9308
  h = m
9180
- ? K(m).join(`
9309
+ ? S(m).join(`
9181
9310
  `)
9182
9311
  : d instanceof Error
9183
9312
  ? d.message
@@ -9189,12 +9318,12 @@ ${a.bold('CDN URL:')} ${a.green(d.url)}
9189
9318
  `,
9190
9319
  )
9191
9320
  : p.fail(`Upload failed: ${h}`),
9192
- process.exit(m ? m.exitCode : T));
9321
+ process.exit(m ? m.exitCode : v));
9193
9322
  }
9194
9323
  }
9195
- H();
9196
- Se();
9197
- function rr() {
9324
+ W();
9325
+ qe();
9326
+ function ar() {
9198
9327
  process.stdout.write(`
9199
9328
  ${a.bold(a.cyan('Tein AI CLI'))} - Official Command-Line Interface for Tein AI models
9200
9329
 
@@ -9254,11 +9383,11 @@ ${a.bold('EXAMPLES:')}
9254
9383
 
9255
9384
  `);
9256
9385
  }
9257
- async function $i() {
9386
+ async function Ai() {
9258
9387
  let e = process.argv.slice(2),
9259
- t = Ct(e);
9388
+ t = At(e);
9260
9389
  if (t.flags.has('help') || t.options.help || t.command === 'help') {
9261
- rr();
9390
+ ar();
9262
9391
  return;
9263
9392
  }
9264
9393
  if (t.flags.has('version') || t.options.version || t.command === 'version') {
@@ -9268,31 +9397,31 @@ async function $i() {
9268
9397
  }
9269
9398
  switch (t.command) {
9270
9399
  case 'auth': {
9271
- await Y(t.subcommand, t.options.key);
9400
+ await Q(t.subcommand, t.options.key);
9272
9401
  break;
9273
9402
  }
9274
9403
  case 'login': {
9275
- await Y('login', t.options.key);
9404
+ await Q('login', t.options.key);
9276
9405
  break;
9277
9406
  }
9278
9407
  case 'logout': {
9279
- await Y('logout');
9408
+ await Q('logout');
9280
9409
  break;
9281
9410
  }
9282
9411
  case 'whoami': {
9283
- await Y('status');
9412
+ await Q('status');
9284
9413
  break;
9285
9414
  }
9286
9415
  case 'models':
9287
9416
  case 'list': {
9288
- await Ot(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0);
9417
+ await Dt(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0);
9289
9418
  break;
9290
9419
  }
9291
9420
  case 'pricing':
9292
9421
  case 'prices': {
9293
9422
  let r = t.options.model,
9294
9423
  i = t.subcommand || (typeof r == 'string' ? r : void 0);
9295
- await Dt({
9424
+ await Vt({
9296
9425
  model: i,
9297
9426
  json: !!t.options.json,
9298
9427
  apiUrl: typeof t.options.api_url == 'string' ? t.options.api_url : void 0,
@@ -9307,56 +9436,56 @@ async function $i() {
9307
9436
  process.stderr.write(`Usage: ${a.cyan('tein info <model-slug>')}
9308
9437
  `),
9309
9438
  process.exit(1)),
9310
- await Rt(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0));
9439
+ await Lt(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0));
9311
9440
  break;
9312
9441
  }
9313
9442
  case 'upload': {
9314
9443
  let r = t.subcommand || '';
9315
- await Nt(r, t.options);
9444
+ await Bt(r, t.options);
9316
9445
  break;
9317
9446
  }
9318
9447
  case 'run':
9319
9448
  case 'generate': {
9320
9449
  let r = t.subcommand || '';
9321
- await De(r, t.options);
9450
+ await Le(r, t.options);
9322
9451
  break;
9323
9452
  }
9324
9453
  case 'status': {
9325
9454
  let r = t.subcommand || '';
9326
- await Vt(r, t.options);
9455
+ await Ut(r, t.options);
9327
9456
  break;
9328
9457
  }
9329
9458
  case 'mcp': {
9330
- let { startStdioServer: r } = await Promise.resolve().then(() => (tr(), er));
9459
+ let { startStdioServer: r } = await Promise.resolve().then(() => (ir(), rr));
9331
9460
  await r();
9332
9461
  break;
9333
9462
  }
9334
9463
  default: {
9335
9464
  if (t.command && !t.command.startsWith('-')) {
9336
- (!U(t.command) &&
9465
+ (!j(t.command) &&
9337
9466
  !pe[t.command] &&
9338
9467
  (process.stderr.write(`
9339
9468
  ${a.red('Error:')} Unknown command or model "${t.command}".
9340
9469
  Run ${a.cyan('tein --help')} for the commands, or ${a.cyan('tein models')} for the model slugs.
9341
9470
  `),
9342
- process.exit(T)),
9343
- await De(t.command, t.options));
9471
+ process.exit(v)),
9472
+ await Le(t.command, t.options));
9344
9473
  return;
9345
9474
  }
9346
- rr();
9475
+ ar();
9347
9476
  break;
9348
9477
  }
9349
9478
  }
9350
9479
  }
9351
- $i().catch((e) => {
9480
+ Ai().catch((e) => {
9352
9481
  (e instanceof w &&
9353
9482
  (process.stderr.write(`
9354
- ${a.red('Error:')} ${K(e).join(`
9483
+ ${a.red('Error:')} ${S(e).join(`
9355
9484
  `)}
9356
9485
  `),
9357
9486
  process.exit(e.exitCode)),
9358
9487
  process.stderr.write(`
9359
9488
  ${a.red('Fatal error:')} ${e instanceof Error ? e.message : e}
9360
9489
  `),
9361
- process.exit(T));
9490
+ process.exit(v));
9362
9491
  });