@teinai/cli 1.1.33 → 1.1.35

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 +902 -846
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,58 +1,58 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
- var Va = Object.create;
3
+ var Ni = Object.create;
4
4
  var ve = Object.defineProperty;
5
- var Na = Object.getOwnPropertyDescriptor;
6
- var Ua = Object.getOwnPropertyNames;
7
- var Fa = Object.getPrototypeOf,
8
- Ba = Object.prototype.hasOwnProperty;
9
- var h = (e, t, a) => () => {
10
- if (a) throw a[0];
5
+ var Ui = Object.getOwnPropertyDescriptor;
6
+ var Fi = Object.getOwnPropertyNames;
7
+ var Bi = Object.getPrototypeOf,
8
+ ji = Object.prototype.hasOwnProperty;
9
+ var h = (e, t, i) => () => {
10
+ if (i) throw i[0];
11
11
  try {
12
12
  return (e && (t = e((e = 0))), t);
13
- } catch (i) {
14
- throw ((a = [i]), i);
13
+ } catch (a) {
14
+ throw ((i = [a]), a);
15
15
  }
16
16
  };
17
- var ja = (e, t) => {
18
- for (var a in t) ve(e, a, { get: t[a], enumerable: !0 });
17
+ var Gi = (e, t) => {
18
+ for (var i in t) ve(e, i, { get: t[i], enumerable: !0 });
19
19
  },
20
- Ga = (e, t, a, i) => {
20
+ Hi = (e, t, i, a) => {
21
21
  if ((t && typeof t == 'object') || typeof t == 'function')
22
- for (let n of Ua(t))
23
- !Ba.call(e, n) &&
24
- n !== a &&
25
- ve(e, n, { get: () => t[n], enumerable: !(i = Na(t, n)) || i.enumerable });
22
+ for (let n of Fi(t))
23
+ !ji.call(e, n) &&
24
+ n !== i &&
25
+ ve(e, n, { get: () => t[n], enumerable: !(a = Ui(t, n)) || a.enumerable });
26
26
  return e;
27
27
  };
28
- var T = (e, t, a) => (
29
- (a = e != null ? Va(Fa(e)) : {}),
30
- Ga(t || !e || !e.__esModule ? ve(a, 'default', { value: e, enumerable: !0 }) : a, e)
28
+ var T = (e, t, i) => (
29
+ (i = e != null ? Ni(Bi(e)) : {}),
30
+ Hi(t || !e || !e.__esModule ? ve(i, 'default', { value: e, enumerable: !0 }) : i, e)
31
31
  );
32
- function Ja(e) {
32
+ function Wi(e) {
33
33
  for (let t of e)
34
34
  try {
35
- let a = JSON.parse(dt.default.readFileSync(t, 'utf8'));
36
- if (a.name === '@teinai/cli' && typeof a.version == 'string' && a.version.trim())
37
- return a.version.trim();
35
+ let i = JSON.parse(pt.default.readFileSync(t, 'utf8'));
36
+ if (i.name === '@teinai/cli' && typeof i.version == 'string' && i.version.trim())
37
+ return i.version.trim();
38
38
  } catch {}
39
- return za;
39
+ return Ji;
40
40
  }
41
- function Wa() {
41
+ function Yi() {
42
42
  let e = typeof __dirname == 'string' ? __dirname : process.cwd();
43
43
  return [
44
44
  Te.default.join(e, 'package.json'),
45
45
  Te.default.join(e, '..', '..', 'cli-package', 'package.json'),
46
46
  ];
47
47
  }
48
- var dt,
48
+ var pt,
49
49
  Te,
50
- za,
50
+ Ji,
51
51
  F,
52
52
  re = h(() => {
53
53
  'use strict';
54
- ((dt = T(require('node:fs'))), (Te = T(require('node:path'))), (za = '0.0.0-dev'));
55
- F = Ja(Wa());
54
+ ((pt = T(require('node:fs'))), (Te = T(require('node:path'))), (Ji = '0.0.0-dev'));
55
+ F = Wi(Yi());
56
56
  });
57
57
  function j() {
58
58
  try {
@@ -66,8 +66,8 @@ function j() {
66
66
  function Ke(e) {
67
67
  try {
68
68
  R.default.existsSync(se) || R.default.mkdirSync(se, { recursive: !0, mode: 448 });
69
- let a = { ...j(), ...e };
70
- (R.default.writeFileSync(B, JSON.stringify(a, null, 2), { encoding: 'utf-8', mode: 384 }),
69
+ let i = { ...j(), ...e };
70
+ (R.default.writeFileSync(B, JSON.stringify(i, null, 2), { encoding: 'utf-8', mode: 384 }),
71
71
  R.default.chmodSync(se, 448),
72
72
  R.default.chmodSync(B, 384));
73
73
  } catch (t) {
@@ -78,15 +78,15 @@ function S(e) {
78
78
  if (e && e.trim()) return e.trim();
79
79
  let t = process.env.TEIN_API_KEY || process.env.TEIN_KEY;
80
80
  if (t && t.trim()) return t.trim();
81
- let a = j();
82
- return a.apiKey && a.apiKey.trim() ? a.apiKey.trim() : '';
81
+ let i = j();
82
+ return i.apiKey && i.apiKey.trim() ? i.apiKey.trim() : '';
83
83
  }
84
84
  function w(e) {
85
85
  if (e && e.trim()) return e.trim().replace(/\/+$/, '');
86
86
  let t = process.env.TEIN_API_URL;
87
87
  if (t && t.trim()) return t.trim().replace(/\/+$/, '');
88
- let a = j();
89
- return a.apiUrl && a.apiUrl.trim() ? a.apiUrl.trim().replace(/\/+$/, '') : 'https://api.tein.ai';
88
+ let i = j();
89
+ return i.apiUrl && i.apiUrl.trim() ? i.apiUrl.trim().replace(/\/+$/, '') : 'https://api.tein.ai';
90
90
  }
91
91
  function oe() {
92
92
  return B;
@@ -96,7 +96,7 @@ var R,
96
96
  Me,
97
97
  se,
98
98
  B,
99
- $ = h(() => {
99
+ E = h(() => {
100
100
  'use strict';
101
101
  ((R = T(require('node:fs'))),
102
102
  (gt = T(require('node:os'))),
@@ -104,20 +104,20 @@ var R,
104
104
  (se = Me.default.join(gt.default.homedir(), '.tein')),
105
105
  (B = Me.default.join(se, 'config.json')));
106
106
  });
107
- var ei,
107
+ var ta,
108
108
  ht,
109
109
  yt,
110
110
  bt = h(() => {
111
111
  'use strict';
112
- ((ei = ['1:1', '16:9', '9:16', '21:9', '3:2', '2:3', '4:3', '3:4', '4:5', '5:4']),
113
- (ht = [...ei, 'auto']),
112
+ ((ta = ['1:1', '16:9', '9:16', '21:9', '3:2', '2:3', '4:3', '3:4', '4:5', '5:4']),
113
+ (ht = [...ta, 'auto']),
114
114
  (yt =
115
115
  'The medium endpoint renders non-square images at 1K only. Use resolution 1K, aspect_ratio 1:1, or the dynamic endpoint for a non-square 2K or 4K image.'));
116
116
  });
117
117
  var J,
118
118
  Ce = h(() => {
119
119
  'use strict';
120
- J = new Set(['nano-banana-2.1', 'seedance-2-lite', 'seedance-2-5-lite']);
120
+ J = new Set([]);
121
121
  });
122
122
  function le(e) {
123
123
  return !1;
@@ -125,10 +125,10 @@ function le(e) {
125
125
  var kt = h(() => {
126
126
  'use strict';
127
127
  });
128
- var pe,
128
+ var de,
129
129
  wt = h(() => {
130
130
  'use strict';
131
- pe = {
131
+ de = {
132
132
  source: 'TEIN Price Board',
133
133
  checked: '17 Sep 2026',
134
134
  generated: '2026-10-01',
@@ -216,7 +216,7 @@ var pe,
216
216
  'claude-haiku-4-5',
217
217
  ],
218
218
  },
219
- { slug: 'kling', name: 'Kling', models: ['kling-v4', 'kling-v3-video'] },
219
+ { slug: 'kling', name: 'Kling', models: ['kling-v4', 'kling-v4-flash', 'kling-v3-video'] },
220
220
  { slug: 'ltx', name: 'LTX', models: ['ltx-2.3-pro'] },
221
221
  { slug: 'vidu', name: 'Vidu', models: ['vidu-q4-preview'] },
222
222
  { slug: 'flux', name: 'FLUX', models: ['flux-2-dev'] },
@@ -5761,6 +5761,37 @@ var pe,
5761
5761
  axes: { resolution: ['720p', '1080p'] },
5762
5762
  from: { variant: '720p' },
5763
5763
  },
5764
+ {
5765
+ slug: 'kling-v4-flash',
5766
+ name: 'Kling Video 4.0 Flash',
5767
+ family: 'kling',
5768
+ vendor: 'Kuaishou',
5769
+ desc: 'Kling 4.0, faster and cheaper: text, a start frame, or up to 10 images and 5 videos, at 720p for 3 to 20 seconds.',
5770
+ kind: 'video',
5771
+ unit: '/sec',
5772
+ api: { model: 'kling-v4-flash' },
5773
+ variants: [
5774
+ {
5775
+ id: '720p',
5776
+ price: { starter: 0.1175, plus: 0.1116, scale: 0.1045 },
5777
+ label: '720p',
5778
+ resolution: '720p',
5779
+ withVideo: !1,
5780
+ },
5781
+ {
5782
+ id: '720p-video',
5783
+ price: { starter: 0.0788, plus: 0.0748, scale: 0.07 },
5784
+ label: '720p \xB7 with reference video',
5785
+ resolution: '720p',
5786
+ withVideo: !0,
5787
+ },
5788
+ ],
5789
+ unfiltered: null,
5790
+ priority: null,
5791
+ draft: null,
5792
+ axes: { resolution: ['720p'] },
5793
+ from: { variant: '720p' },
5794
+ },
5764
5795
  {
5765
5796
  slug: 'kling-v3-video',
5766
5797
  name: 'Kling Video 3.0',
@@ -6167,11 +6198,11 @@ var pe,
6167
6198
  ],
6168
6199
  };
6169
6200
  });
6170
- var de,
6201
+ var pe,
6171
6202
  xt,
6172
- Ee = h(() => {
6203
+ $e = h(() => {
6173
6204
  'use strict';
6174
- ((de = [
6205
+ ((pe = [
6175
6206
  {
6176
6207
  slug: 'tein-video-upscaler',
6177
6208
  name: 'Tein Video Upscaler',
@@ -6251,35 +6282,35 @@ var de,
6251
6282
  function qe(e, t) {
6252
6283
  return `${e.trim().toLowerCase()}|${(t ?? '').trim().toLowerCase()}`;
6253
6284
  }
6254
- function ii(e, t) {
6285
+ function ra(e, t) {
6255
6286
  if (e === 'seedance-2-mini') return 'mini';
6256
6287
  if (e !== 'seedance-2') return;
6257
- let a = typeof t?.quality == 'string' ? t.quality.trim().toLowerCase() : '';
6258
- return a === 'fast' || a === 'mini' || a === 'standard'
6259
- ? a
6288
+ let i = typeof t?.quality == 'string' ? t.quality.trim().toLowerCase() : '';
6289
+ return i === 'fast' || i === 'mini' || i === 'standard'
6290
+ ? i
6260
6291
  : t?.fast_mode === !0
6261
6292
  ? 'fast'
6262
6293
  : 'standard';
6263
6294
  }
6264
- function ri(e, t) {
6265
- let a = e
6295
+ function na(e, t) {
6296
+ let i = e
6266
6297
  .trim()
6267
6298
  .toLowerCase()
6268
6299
  .replace(/-(?:unfiltered|uncensored)$/, '');
6269
- if (a === 'seedance-2' || a === 'seedance-2-mini') {
6270
- let n = ii(a, t),
6271
- s = $e.get(qe('seedance-2', n));
6300
+ if (i === 'seedance-2' || i === 'seedance-2-mini') {
6301
+ let n = ra(i, t),
6302
+ s = Ee.get(qe('seedance-2', n));
6272
6303
  return s ? s.slug : null;
6273
6304
  }
6274
- let i = ce.get(a) ?? $e.get(qe(a));
6275
- return i ? i.slug : null;
6305
+ let a = ce.get(i) ?? Ee.get(qe(i));
6306
+ return a ? a.slug : null;
6276
6307
  }
6277
- function si(e, t) {
6278
- return ce.has(e) && !(ni.has(e) && t) ? e : ri(e, t);
6308
+ function oa(e, t) {
6309
+ return ce.has(e) && !(sa.has(e) && t) ? e : na(e, t);
6279
6310
  }
6280
6311
  function W(e, t) {
6281
- let a = si(e, t);
6282
- return a ? (ce.get(a) ?? null) : null;
6312
+ let i = oa(e, t);
6313
+ return i ? (ce.get(i) ?? null) : null;
6283
6314
  }
6284
6315
  function ue() {
6285
6316
  return vt;
@@ -6287,50 +6318,50 @@ function ue() {
6287
6318
  var Pt,
6288
6319
  It,
6289
6320
  vt,
6290
- ti,
6321
+ ia,
6291
6322
  ce,
6292
- $e,
6323
+ Ee,
6293
6324
  _t,
6294
- ai,
6325
+ aa,
6295
6326
  Ae,
6296
- ni,
6327
+ sa,
6297
6328
  G = h(() => {
6298
6329
  'use strict';
6299
6330
  kt();
6300
6331
  wt();
6301
- Ee();
6332
+ $e();
6302
6333
  ((Pt = {
6303
- ...pe,
6304
- families: pe.families.map((e) => ({ ...e, models: e.models.filter((t) => !le(t)) })),
6305
- models: pe.models.filter((e) => !le(e.slug)),
6334
+ ...de,
6335
+ families: de.families.map((e) => ({ ...e, models: e.models.filter((t) => !le(t)) })),
6336
+ models: de.models.filter((e) => !le(e.slug)),
6306
6337
  }),
6307
- (It = de.filter((e) => !le(e.slug))),
6338
+ (It = pe.filter((e) => !le(e.slug))),
6308
6339
  (vt = [...Pt.models, ...It]),
6309
- (ti = [
6340
+ (ia = [
6310
6341
  ...Pt.families,
6311
6342
  ...xt
6312
6343
  .map((e) => ({ ...e, models: It.filter((t) => t.family === e.slug).map((t) => t.slug) }))
6313
6344
  .filter((e) => e.models.length > 0),
6314
6345
  ]),
6315
6346
  (ce = new Map()),
6316
- ($e = new Map()),
6347
+ (Ee = new Map()),
6317
6348
  (_t = new Map()),
6318
- (ai = new Map()),
6349
+ (aa = new Map()),
6319
6350
  (Ae = new Map()));
6320
6351
  for (let e of vt) {
6321
- (ce.set(e.slug, e), $e.set(qe(e.api.model, e.api.quality), e));
6352
+ (ce.set(e.slug, e), Ee.set(qe(e.api.model, e.api.quality), e));
6322
6353
  for (let t of e.variants) _t.set(`${e.slug}/${t.id}`, { model: e, variant: t, edit: !1 });
6323
6354
  for (let t of e.editVariants ?? [])
6324
6355
  _t.set(`${e.slug}/edit/${t.id}`, { model: e, variant: t, edit: !0 });
6325
- for (let t of e.addons ?? []) ai.set(`${e.slug}/addon/${t.id}`, { model: e, addon: t });
6356
+ for (let t of e.addons ?? []) aa.set(`${e.slug}/addon/${t.id}`, { model: e, addon: t });
6326
6357
  Ae.set(e.slug, e.family);
6327
6358
  }
6328
- for (let e of ti) for (let t of e.models) Ae.has(t) || Ae.set(t, e.slug);
6329
- ni = new Set(['seedance-2']);
6359
+ for (let e of ia) for (let t of e.models) Ae.has(t) || Ae.set(t, e.slug);
6360
+ sa = new Set(['seedance-2']);
6330
6361
  });
6331
6362
  function me(e) {
6332
6363
  let t = e.from?.variant;
6333
- return (t && e.variants.find((a) => a.id === t)) || e.variants[0];
6364
+ return (t && e.variants.find((i) => i.id === t)) || e.variants[0];
6334
6365
  }
6335
6366
  function Oe(e) {
6336
6367
  if (e.endpoints?.length)
@@ -6361,25 +6392,25 @@ var Mt = h(() => {
6361
6392
  'use strict';
6362
6393
  });
6363
6394
  function Kt(e, t) {
6364
- return typeof t == 'string' && (oi[e]?.includes(t) ?? !1);
6395
+ return typeof t == 'string' && (la[e]?.includes(t) ?? !1);
6365
6396
  }
6366
- var oi,
6397
+ var la,
6367
6398
  St = h(() => {
6368
6399
  'use strict';
6369
6400
  G();
6370
6401
  Re();
6371
6402
  Mt();
6372
- oi = {};
6403
+ la = {};
6373
6404
  });
6374
6405
  function Ct(e) {
6375
- return e === 'nano-banana-pro' ? li : pi;
6406
+ return e === 'nano-banana-pro' ? da : pa;
6376
6407
  }
6377
- var li,
6378
- pi,
6379
- Et = h(() => {
6408
+ var da,
6409
+ pa,
6410
+ $t = h(() => {
6380
6411
  'use strict';
6381
- ((li = ['auto', '1:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9']),
6382
- (pi = [
6412
+ ((da = ['auto', '1:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9']),
6413
+ (pa = [
6383
6414
  'auto',
6384
6415
  '1:1',
6385
6416
  '1:4',
@@ -6397,10 +6428,10 @@ var li,
6397
6428
  '21:9',
6398
6429
  ]));
6399
6430
  });
6400
- var $t,
6431
+ var Et,
6401
6432
  At = h(() => {
6402
6433
  'use strict';
6403
- $t = [
6434
+ Et = [
6404
6435
  'prompt',
6405
6436
  'system',
6406
6437
  'messages',
@@ -6489,10 +6520,10 @@ var qt,
6489
6520
  function Rt(e) {
6490
6521
  return `$${e}`;
6491
6522
  }
6492
- function De(e, t, a) {
6493
- return W(e)?.variants.find((n) => n.endpoint === t && n.component === a)?.price.starter ?? null;
6523
+ function De(e, t, i) {
6524
+ return W(e)?.variants.find((n) => n.endpoint === t && n.component === i)?.price.starter ?? null;
6494
6525
  }
6495
- function di(e) {
6526
+ function ca(e) {
6496
6527
  return [
6497
6528
  {
6498
6529
  name: 'prompt',
@@ -6562,9 +6593,9 @@ function Lt() {
6562
6593
  return Object.fromEntries(
6563
6594
  qt.map((e) => {
6564
6595
  let t = De(e.slug, 'cheap', 'input'),
6565
- a = De(e.slug, 'cheap', 'output'),
6566
- i = De(e.slug, 'stable', 'input') != null,
6567
- n = t != null && a != null ? `${Rt(t)}/M in \xB7 ${Rt(a)}/M out` : '',
6596
+ i = De(e.slug, 'cheap', 'output'),
6597
+ a = De(e.slug, 'stable', 'input') != null,
6598
+ n = t != null && i != null ? `${Rt(t)}/M in \xB7 ${Rt(i)}/M out` : '',
6568
6599
  s = {
6569
6600
  slug: e.slug,
6570
6601
  name: e.name,
@@ -6575,7 +6606,7 @@ function Lt() {
6575
6606
  priceFormatted: n,
6576
6607
  unit: '/M tokens',
6577
6608
  primaryToolName: 'run_task',
6578
- parameters: di(i),
6609
+ parameters: ca(a),
6579
6610
  };
6580
6611
  return [e.slug, s];
6581
6612
  }),
@@ -6587,38 +6618,38 @@ var Dt = h(() => {
6587
6618
  G();
6588
6619
  });
6589
6620
  function ge(e) {
6590
- return e ? mi.get(e) : void 0;
6621
+ return e ? ma.get(e) : void 0;
6591
6622
  }
6592
- function Ut(e, t) {
6623
+ function Ft(e, t) {
6593
6624
  return !e.aspects?.length || e.sourceFramedModes?.includes(t)
6594
6625
  ? null
6595
6626
  : e.adaptiveModes?.includes(t)
6596
6627
  ? [...e.aspects, 'adaptive']
6597
6628
  : [...e.aspects];
6598
6629
  }
6599
- function Ft(e, t, a) {
6630
+ function Bt(e, t, i) {
6600
6631
  return e.modes.includes('motion_control')
6601
6632
  ? t === 'motion_control'
6602
- ? !gi.includes(a)
6603
- : !fi.includes(a)
6633
+ ? !ga.includes(i)
6634
+ : !fa.includes(i)
6604
6635
  : !0;
6605
6636
  }
6606
- var ci,
6607
- ui,
6608
- Vt,
6609
- bn,
6610
- mi,
6637
+ var Vt,
6638
+ ua,
6611
6639
  Nt,
6640
+ bn,
6641
+ ma,
6642
+ Ut,
6612
6643
  Ve,
6613
6644
  kn,
6614
6645
  Ne,
6615
- fi,
6616
- gi,
6646
+ fa,
6647
+ ga,
6617
6648
  Ue = h(() => {
6618
6649
  'use strict';
6619
- ((ci = ['16:9', '9:16', '1:1', '21:9']),
6620
- (ui = ['16:9', '9:16', '1:1', '4:3', '3:4', '21:9']),
6621
- (Vt = [
6650
+ ((Vt = ['16:9', '9:16', '1:1', '21:9']),
6651
+ (ua = ['16:9', '9:16', '1:1', '4:3', '3:4', '21:9']),
6652
+ (Nt = [
6622
6653
  {
6623
6654
  slug: 'kling-v4',
6624
6655
  kind: 'video',
@@ -6626,7 +6657,7 @@ var ci,
6626
6657
  promptMax: 26e3,
6627
6658
  duration: { min: 3, max: 30, default: 5 },
6628
6659
  heights: { '720p': 720, '1080p': 1080 },
6629
- aspects: ci,
6660
+ aspects: Vt,
6630
6661
  sourceFramedModes: ['image_to_video'],
6631
6662
  adaptiveModes: ['multi_reference'],
6632
6663
  fps: 24,
@@ -6643,6 +6674,31 @@ var ci,
6643
6674
  },
6644
6675
  videoInputBilling: { minOutputMultiple: 2, withVideoRows: !0 },
6645
6676
  },
6677
+ {
6678
+ slug: 'kling-v4-flash',
6679
+ kind: 'video',
6680
+ modes: ['text_to_video', 'image_to_video', 'multi_reference'],
6681
+ promptMax: 26e3,
6682
+ duration: { min: 3, max: 20, default: 5 },
6683
+ heights: { '720p': 720 },
6684
+ aspects: [...Vt, '4:3', '3:4'],
6685
+ sourceFramedModes: ['image_to_video'],
6686
+ adaptiveModes: ['multi_reference'],
6687
+ fps: 24,
6688
+ audio: 'none',
6689
+ seed: !1,
6690
+ referenceHandles: !0,
6691
+ reference: {
6692
+ maxImages: 10,
6693
+ maxVideos: 5,
6694
+ maxAudios: 0,
6695
+ maxFiles: 15,
6696
+ maxVideoSeconds: 20,
6697
+ videoClipMinSeconds: 3,
6698
+ videoSides: { min: 700, max: 4553, maxPixels: 8294400, maxRatio: 2.5 },
6699
+ },
6700
+ videoInputBilling: { minOutputMultiple: 2, withVideoRows: !0 },
6701
+ },
6646
6702
  {
6647
6703
  slug: 'kling-v3-video',
6648
6704
  kind: 'video',
@@ -6665,7 +6721,7 @@ var ci,
6665
6721
  promptMax: 65535,
6666
6722
  duration: { min: 5, max: 15, default: 5 },
6667
6723
  heights: { '480p': 480, '768p': 768 },
6668
- aspects: ui,
6724
+ aspects: ua,
6669
6725
  fps: 24,
6670
6726
  audio: 'free',
6671
6727
  seed: !0,
@@ -6740,9 +6796,9 @@ var ci,
6740
6796
  seed: !0,
6741
6797
  },
6742
6798
  ]),
6743
- (bn = Vt.map((e) => e.slug)),
6744
- (mi = new Map(Vt.map((e) => [e.slug, e]))));
6745
- ((Nt = 'EXAVITQu4vr4xnSDxMaL'),
6799
+ (bn = Nt.map((e) => e.slug)),
6800
+ (ma = new Map(Nt.map((e) => [e.slug, e]))));
6801
+ ((Ut = 'EXAVITQu4vr4xnSDxMaL'),
6746
6802
  (Ve = {
6747
6803
  hpp4J3VqNfWAUOO0d1Us: 'Bella',
6748
6804
  CwhRBWXzGAHq8TQ4Fs17: 'Roger',
@@ -6780,8 +6836,8 @@ var ci,
6780
6836
  'opus_48000_128',
6781
6837
  'opus_48000_192',
6782
6838
  ]));
6783
- ((fi = ['image_url', 'video_url', 'character_orientation', 'keep_original_sound']),
6784
- (gi = [
6839
+ ((fa = ['image_url', 'video_url', 'character_orientation', 'keep_original_sound']),
6840
+ (ga = [
6785
6841
  'duration',
6786
6842
  'aspect_ratio',
6787
6843
  'generate_audio',
@@ -6793,7 +6849,7 @@ var ci,
6793
6849
  'audios',
6794
6850
  ]));
6795
6851
  });
6796
- function yi() {
6852
+ function ya() {
6797
6853
  return [
6798
6854
  {
6799
6855
  name: 'image_url',
@@ -6821,10 +6877,10 @@ function yi() {
6821
6877
  },
6822
6878
  ];
6823
6879
  }
6824
- function bi(e) {
6880
+ function ba(e) {
6825
6881
  let t = e.duration,
6826
- a = Object.keys(e.heights),
6827
- i = e.sourceFramedModes?.length
6882
+ i = Object.keys(e.heights),
6883
+ a = e.sourceFramedModes?.length
6828
6884
  ? ` Not taken by ${e.sourceFramedModes.join(', ')}: the source image sets the frame.`
6829
6885
  : '',
6830
6886
  n = e.modeRequired ? void 0 : e.modes[0],
@@ -6842,8 +6898,8 @@ function bi(e) {
6842
6898
  {
6843
6899
  name: 'resolution',
6844
6900
  type: 'select',
6845
- default: a[0],
6846
- options: a,
6901
+ default: i[0],
6902
+ options: i,
6847
6903
  description: `Output resolution. Higher resolutions cost more per second.${e.modes.includes('motion_control') ? ' motion_control: 720p or 1080p.' : ''}`,
6848
6904
  },
6849
6905
  {
@@ -6851,7 +6907,7 @@ function bi(e) {
6851
6907
  type: 'select',
6852
6908
  ...(s ? {} : { default: e.aspects[0] }),
6853
6909
  options: [...e.aspects, ...(e.adaptiveModes?.length ? ['adaptive'] : [])],
6854
- description: `The frame.${e.adaptiveModes?.length ? ` adaptive: ${e.adaptiveModes.join(', ')} only.` : ''}${i}`,
6910
+ description: `The frame.${e.adaptiveModes?.length ? ` adaptive: ${e.adaptiveModes.join(', ')} only.` : ''}${a}`,
6855
6911
  },
6856
6912
  ];
6857
6913
  if (
@@ -6896,7 +6952,7 @@ function bi(e) {
6896
6952
  o.push({
6897
6953
  name: 'videos',
6898
6954
  type: 'string[]',
6899
- description: `multi_reference: up to ${u.maxVideos} reference videos${u.maxVideoSeconds ? `, ${u.maxVideoSeconds} s in all` : ''}.${e.referenceHandles ? ' In the prompt, name them @Video1, @Video2, ... in this order.' : ''}${l} ${L}`,
6955
+ description: `multi_reference: up to ${u.maxVideos} reference videos${u.videoClipMinSeconds ? `, each longer than ${u.videoClipMinSeconds} s` : ''}${u.videoSides ? `, ${u.videoSides.min} to ${u.videoSides.max} px tall and wide` : ''}${u.maxVideoSeconds ? `, ${u.maxVideoSeconds} s in all` : ''}.${e.referenceHandles ? ' In the prompt, name them @Video1, @Video2, ... in this order.' : ''}${l} ${L}`,
6900
6956
  });
6901
6957
  }
6902
6958
  if (e.reference?.maxAudios) {
@@ -6914,7 +6970,7 @@ function bi(e) {
6914
6970
  }
6915
6971
  return o;
6916
6972
  }
6917
- function ki(e) {
6973
+ function ka(e) {
6918
6974
  let t = Object.keys(e.sizes);
6919
6975
  return [
6920
6976
  {
@@ -6931,13 +6987,13 @@ function ki(e) {
6931
6987
  },
6932
6988
  ];
6933
6989
  }
6934
- function xi() {
6990
+ function xa() {
6935
6991
  return [
6936
6992
  {
6937
6993
  name: 'voice_id',
6938
6994
  type: 'string',
6939
- default: Nt,
6940
- description: `text_to_speech: the ElevenLabs voice id, one of: ${wi}.`,
6995
+ default: Ut,
6996
+ description: `text_to_speech: the ElevenLabs voice id, one of: ${wa}.`,
6941
6997
  },
6942
6998
  {
6943
6999
  name: 'turns',
@@ -6956,9 +7012,9 @@ function xi() {
6956
7012
  },
6957
7013
  ];
6958
7014
  }
6959
- function Bt(e) {
7015
+ function jt(e) {
6960
7016
  let t = e.promptOptionalModes?.length ? ` Optional on ${e.promptOptionalModes.join(', ')}.` : '',
6961
- a = [
7017
+ i = [
6962
7018
  {
6963
7019
  name: 'prompt',
6964
7020
  type: 'string',
@@ -6971,26 +7027,26 @@ function Bt(e) {
6971
7027
  required: !0,
6972
7028
  ...(e.modeRequired ? {} : { default: e.modes[0] }),
6973
7029
  options: [...e.modes],
6974
- description: `${e.modeRequired ? 'Required. ' : ''}${e.modes.map((i) => hi[i]).join(' ')}`,
7030
+ description: `${e.modeRequired ? 'Required. ' : ''}${e.modes.map((a) => ha[a]).join(' ')}`,
6975
7031
  },
6976
7032
  ];
6977
7033
  return (
6978
- e.kind === 'video' ? a.push(...bi(e)) : e.kind === 'image' ? a.push(...ki(e)) : a.push(...xi()),
6979
- e.modes.includes('motion_control') && a.push(...yi()),
7034
+ e.kind === 'video' ? i.push(...ba(e)) : e.kind === 'image' ? i.push(...ka(e)) : i.push(...xa()),
7035
+ e.modes.includes('motion_control') && i.push(...ya()),
6980
7036
  e.seed &&
6981
- a.push({ name: 'seed', type: 'number', min: 0, description: 'Seed for repeatable runs.' }),
6982
- a
7037
+ i.push({ name: 'seed', type: 'number', min: 0, description: 'Seed for repeatable runs.' }),
7038
+ i
6983
7039
  );
6984
7040
  }
6985
7041
  var L,
6986
- hi,
6987
- wi,
6988
- jt = h(() => {
7042
+ ha,
7043
+ wa,
7044
+ Gt = h(() => {
6989
7045
  'use strict';
6990
7046
  Ue();
6991
7047
  ((L =
6992
7048
  'as public http(s) URLs or data URIs. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.'),
6993
- (hi = {
7049
+ (ha = {
6994
7050
  text_to_video: 'text_to_video: from the prompt alone.',
6995
7051
  image_to_video: 'image_to_video: a start image in first_frame_image.',
6996
7052
  first_n_last_frames: 'first_n_last_frames: first_frame_image and last_frame_image.',
@@ -7002,24 +7058,24 @@ var L,
7002
7058
  motion_control:
7003
7059
  'motion_control: the character in image_url performs the motion of video_url; length and frame follow the video.',
7004
7060
  }));
7005
- wi = Object.entries(Ve)
7061
+ wa = Object.entries(Ve)
7006
7062
  .map(([e, t]) => `${e} (${t})`)
7007
7063
  .join(', ');
7008
7064
  });
7009
7065
  var he,
7010
- Gt,
7011
- Y,
7012
7066
  Ht,
7067
+ Y,
7068
+ zt,
7013
7069
  Pn,
7014
7070
  In,
7015
7071
  vn,
7016
7072
  Tn,
7017
- zt = h(() => {
7073
+ Jt = h(() => {
7018
7074
  'use strict';
7019
7075
  ((he = 'enhancor-ultrafine'),
7020
- (Gt = 'Enhancor Ultrafine'),
7076
+ (Ht = 'Enhancor Ultrafine'),
7021
7077
  (Y = { skin: [2, 3, 4], noSkin: [2, 3, 4, 8, 16] }),
7022
- (Ht = 2),
7078
+ (zt = 2),
7023
7079
  (Pn = 24 * 1024 * 1024),
7024
7080
  (In = 4096 * 4096),
7025
7081
  (vn = 30 * 6e4),
@@ -7047,123 +7103,123 @@ var X,
7047
7103
  function Q(e) {
7048
7104
  return `$${Number(e.toFixed(5))}`;
7049
7105
  }
7050
- function Ii(e) {
7106
+ function Ia(e) {
7051
7107
  if (e.kind === 'llm') {
7052
7108
  let t = e.defaultEndpoint,
7053
- a = (s) =>
7109
+ i = (s) =>
7054
7110
  e.variants.find(
7055
7111
  (o) =>
7056
7112
  o.component === s &&
7057
7113
  (!t || !o.endpoint || o.endpoint === t) &&
7058
7114
  (!o.context || o.context === '0\u201332K'),
7059
7115
  ),
7060
- i = a('input'),
7061
- n = a('output');
7062
- return i && n
7063
- ? `${Q(i.price.starter)}/M in \xB7 ${Q(n.price.starter)}/M out`
7116
+ a = i('input'),
7117
+ n = i('output');
7118
+ return a && n
7119
+ ? `${Q(a.price.starter)}/M in \xB7 ${Q(n.price.starter)}/M out`
7064
7120
  : `from ${Q(me(e).price.starter)}/M tokens`;
7065
7121
  }
7066
7122
  return `from ${Q(me(e).price.starter)}${e.unit}`;
7067
7123
  }
7068
- function vi(e, t) {
7069
- let a = t.filter((i) => Number.isFinite(i) && i > 0);
7070
- return a.length ? `from ${Q(Math.min(...a))}${e}` : null;
7124
+ function va(e, t) {
7125
+ let i = t.filter((a) => Number.isFinite(a) && a > 0);
7126
+ return i.length ? `from ${Q(Math.min(...i))}${e}` : null;
7071
7127
  }
7072
- function Qt(e) {
7128
+ function Zt(e) {
7073
7129
  for (let t of J) {
7074
- let a = ke[t],
7075
- i = a ? vi(a.unit, e[t] ?? []) : null;
7076
- a && i && (a.priceFormatted = i);
7130
+ let i = ke[t],
7131
+ a = i ? va(i.unit, e[t] ?? []) : null;
7132
+ i && a && (i.priceFormatted = a);
7077
7133
  }
7078
7134
  }
7079
7135
  function A(e, t) {
7080
- let a = e.axes?.resolution ?? [
7081
- ...new Set(e.variants.map((i) => i.resolution).filter((i) => !!i)),
7136
+ let i = e.axes?.resolution ?? [
7137
+ ...new Set(e.variants.map((a) => a.resolution).filter((a) => !!a)),
7082
7138
  ];
7083
7139
  return {
7084
7140
  name: 'resolution',
7085
7141
  type: 'select',
7086
- default: me(e).resolution ?? a[0],
7087
- options: a,
7142
+ default: me(e).resolution ?? i[0],
7143
+ options: i,
7088
7144
  ...(t ? { description: t } : {}),
7089
7145
  };
7090
7146
  }
7091
- function Zt(e) {
7147
+ function ei(e) {
7092
7148
  if (!e.endpoints?.length) return null;
7093
- let t = e.endpoints.filter((a) => Kt(e.slug, a.id));
7149
+ let t = e.endpoints.filter((i) => Kt(e.slug, i.id));
7094
7150
  return {
7095
7151
  name: 'endpoint',
7096
7152
  type: 'select',
7097
7153
  default: Oe(e),
7098
- options: e.endpoints.filter((a) => !t.includes(a)).map((a) => a.id),
7154
+ options: e.endpoints.filter((i) => !t.includes(i)).map((i) => i.id),
7099
7155
  description:
7100
7156
  (e.slug === 'gemini-3.1-pro-preview'
7101
7157
  ? 'Where the request is served; a missing endpoint is the default, the lowest price, and an unknown one is refused.'
7102
7158
  : 'Where the request is served; a missing or unknown endpoint is the default, the lowest price.') +
7103
- (t.length ? ` ${t.map((a) => a.label).join(' and ')}: coming soon.` : ''),
7159
+ (t.length ? ` ${t.map((i) => i.label).join(' and ')}: coming soon.` : ''),
7104
7160
  };
7105
7161
  }
7106
- function Mi(e, t) {
7107
- if (e.unfiltered == null || t.some((i) => i.name === 'creative_mode')) return t;
7108
- let a = X.includes(e.api.model);
7109
- return [...t.filter((i) => !be.has(i.name)), a ? Je : Ti];
7162
+ function Ma(e, t) {
7163
+ if (e.unfiltered == null || t.some((a) => a.name === 'creative_mode')) return t;
7164
+ let i = X.includes(e.api.model);
7165
+ return [...t.filter((a) => !be.has(a.name)), i ? Je : Ta];
7110
7166
  }
7111
7167
  function Be(e, t) {
7112
- let a = e.filter((n) => !be.has(n.name)),
7113
- i = [Je, ea];
7114
- return (i.push(We, Ye), [...a, ...i]);
7168
+ let i = e.filter((n) => !be.has(n.name)),
7169
+ a = [Je, ti];
7170
+ return (a.push(We, Ye), [...i, ...a]);
7115
7171
  }
7116
- function Ei(e) {
7172
+ function $a(e) {
7117
7173
  return [
7118
7174
  ...e
7119
- .filter((t) => !Si.has(t.name) && !be.has(t.name))
7175
+ .filter((t) => !Sa.has(t.name) && !be.has(t.name))
7120
7176
  .map((t) => {
7121
7177
  if (t.name === 'resolution')
7122
7178
  return {
7123
7179
  ...t,
7124
7180
  ...(t.options
7125
7181
  ? {
7126
- options: t.options.filter((i) =>
7127
- ['480p', '720p'].includes(String(i).toLowerCase()),
7182
+ options: t.options.filter((a) =>
7183
+ ['480p', '720p'].includes(String(a).toLowerCase()),
7128
7184
  ),
7129
7185
  }
7130
7186
  : {}),
7131
7187
  description: `Output resolution: 480p or 720p (8-bit). This tier has no 1080p or 4k. ${Z}`,
7132
7188
  };
7133
- let a = Ci[t.name];
7134
- return a && typeof t.description == 'string'
7135
- ? { ...t, description: t.description.replace(/\(up to [^)]*\)/, `(${a})`) }
7189
+ let i = Ca[t.name];
7190
+ return i && typeof t.description == 'string'
7191
+ ? { ...t, description: t.description.replace(/\(up to [^)]*\)/, `(${i})`) }
7136
7192
  : t;
7137
7193
  }),
7138
7194
  Je,
7139
- ea,
7195
+ ti,
7140
7196
  We,
7141
7197
  Ye,
7142
7198
  ];
7143
7199
  }
7144
- function ta(e) {
7200
+ function ii(e) {
7145
7201
  return (
7146
7202
  e.startsWith('seedance-2-5-') &&
7147
7203
  e !== 'seedance-2-5-lite' &&
7148
7204
  !/-(creative-mode|unfiltered|uncensored)$/.test(e)
7149
7205
  );
7150
7206
  }
7151
- function Jt(e, t = {}) {
7207
+ function Wt(e, t = {}) {
7152
7208
  return [
7153
7209
  ...e
7154
- .filter((a) => !Ki.has(a.name) && !be.has(a.name))
7155
- .map((a) =>
7156
- a.name === 'prompt'
7157
- ? { ...a, required: !0 }
7158
- : a.name === 'resolution'
7210
+ .filter((i) => !Ka.has(i.name) && !be.has(i.name))
7211
+ .map((i) =>
7212
+ i.name === 'prompt'
7213
+ ? { ...i, required: !0 }
7214
+ : i.name === 'resolution'
7159
7215
  ? {
7160
- ...a,
7161
- ...(t.no4k && a.options
7162
- ? { options: a.options.filter((i) => String(i).toLowerCase() !== '4k') }
7216
+ ...i,
7217
+ ...(t.no4k && i.options
7218
+ ? { options: i.options.filter((a) => String(a).toLowerCase() !== '4k') }
7163
7219
  : {}),
7164
7220
  description: `Output resolution. TEIN LITE is the lower-priced endpoint for getting started. Stability and reliability are not guaranteed. ${Z}`,
7165
7221
  }
7166
- : a,
7222
+ : i,
7167
7223
  ),
7168
7224
  {
7169
7225
  name: 'bitrate_mode',
@@ -7190,23 +7246,23 @@ function je(e, t) {
7190
7246
  },
7191
7247
  A(e),
7192
7248
  { name: 'aspect_ratio', type: 'select', default: t.aspects[0], options: t.aspects },
7193
- ...t.references.map((a) =>
7194
- a.endsWith('s')
7249
+ ...t.references.map((i) =>
7250
+ i.endsWith('s')
7195
7251
  ? {
7196
- name: a,
7252
+ name: i,
7197
7253
  type: 'string[]',
7198
- description: `${a} as public http(s) URLs or data URIs. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.`,
7254
+ description: `${i} as public http(s) URLs or data URIs. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.`,
7199
7255
  }
7200
7256
  : {
7201
- name: a,
7257
+ name: i,
7202
7258
  type: 'string',
7203
- description: `${a} as a public http(s) URL or data URI. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.`,
7259
+ description: `${i} as a public http(s) URL or data URI. The Tein CLI and local MCP client read a file path on your machine and upload it before the request is sent.`,
7204
7260
  },
7205
7261
  ),
7206
7262
  ];
7207
7263
  }
7208
- function $i(e) {
7209
- let t = Zt(e);
7264
+ function Ea(e) {
7265
+ let t = ei(e);
7210
7266
  return [
7211
7267
  C('Image prompt text. Supports complex composition and text instructions.'),
7212
7268
  ...(t ? [t] : []),
@@ -7273,7 +7329,7 @@ function $i(e) {
7273
7329
  },
7274
7330
  ];
7275
7331
  }
7276
- function Ai(e) {
7332
+ function Aa(e) {
7277
7333
  return [
7278
7334
  C('Image prompt text.'),
7279
7335
  {
@@ -7307,22 +7363,22 @@ function Ai(e) {
7307
7363
  },
7308
7364
  ];
7309
7365
  }
7310
- function Li() {
7311
- let e = $t,
7366
+ function La() {
7367
+ let e = Et,
7312
7368
  t = [];
7313
- for (let a of Xe(!0))
7314
- e.includes(a.name) &&
7369
+ for (let i of Xe(!0))
7370
+ e.includes(i.name) &&
7315
7371
  (t.push({
7316
- ...a,
7317
- ...(a.name === 'max_tokens' ? { min: 64 } : {}),
7318
- ...(a.name === 'messages'
7372
+ ...i,
7373
+ ...(i.name === 'max_tokens' ? { min: 64 } : {}),
7374
+ ...(i.name === 'messages'
7319
7375
  ? {
7320
7376
  description:
7321
7377
  'Chat history: system, developer, user (text and image_url parts) and assistant turns; no tool turns.',
7322
7378
  }
7323
7379
  : {}),
7324
7380
  }),
7325
- a.name === 'top_p' &&
7381
+ i.name === 'top_p' &&
7326
7382
  t.push({
7327
7383
  name: 'top_k',
7328
7384
  type: 'number',
@@ -7332,7 +7388,7 @@ function Li() {
7332
7388
  }));
7333
7389
  return t;
7334
7390
  }
7335
- function Di() {
7391
+ function Da() {
7336
7392
  return Xe(!0).map((e) =>
7337
7393
  e.name === 'max_tokens' || e.name === 'max_completion_tokens' ? { ...e, min: 128 } : e,
7338
7394
  );
@@ -7432,17 +7488,17 @@ function Xe(e) {
7432
7488
  },
7433
7489
  ];
7434
7490
  }
7435
- function Vi(e) {
7436
- if (e.slug === 'seed-2-1-turbo') return Oi;
7437
- let t = Zt(e);
7491
+ function Va(e) {
7492
+ if (e.slug === 'seed-2-1-turbo') return Oa;
7493
+ let t = ei(e);
7438
7494
  return [
7439
7495
  ...(e.slug === 'gemini-3.1-pro-preview'
7440
- ? Li()
7496
+ ? La()
7441
7497
  : e.slug === 'gemini-3.7-flash'
7442
- ? Di()
7443
- : e.slug === 'gpt-6-astra' || Ri.includes(e.slug)
7498
+ ? Da()
7499
+ : e.slug === 'gpt-6-astra' || Ra.includes(e.slug)
7444
7500
  ? Xe(e.slug !== 'gpt-6-astra')
7445
- : qi),
7501
+ : qa),
7446
7502
  ...(t ? [t] : []),
7447
7503
  ];
7448
7504
  }
@@ -7454,7 +7510,7 @@ function Ge() {
7454
7510
  description: 'The photo to fix: one JPEG or PNG URL.',
7455
7511
  };
7456
7512
  }
7457
- function Ui(e) {
7513
+ function Ua(e) {
7458
7514
  return [
7459
7515
  {
7460
7516
  name: 'video_url',
@@ -7476,7 +7532,7 @@ function Ui(e) {
7476
7532
  },
7477
7533
  ];
7478
7534
  }
7479
- function Fi() {
7535
+ function Fa() {
7480
7536
  return [
7481
7537
  {
7482
7538
  name: 'mode',
@@ -7547,30 +7603,30 @@ function Fi() {
7547
7603
  },
7548
7604
  ];
7549
7605
  }
7550
- function Bi(e) {
7606
+ function Ba(e) {
7551
7607
  let t = e.slug;
7552
- if (e.family === 'tein-labs' && e.kind === 'image') return Fi();
7553
- if (de.some((i) => i.slug === t)) return Ui(e);
7554
- if (e.kind === 'llm') return Vi(e);
7555
- if (e.editVariants?.length) return $i(e);
7556
- let a = ge(t);
7557
- if (a) return Bt(a);
7558
- if (ta(t)) return Ei(He);
7608
+ if (e.family === 'tein-labs' && e.kind === 'image') return Fa();
7609
+ if (pe.some((a) => a.slug === t)) return Ua(e);
7610
+ if (e.kind === 'llm') return Va(e);
7611
+ if (e.editVariants?.length) return Ea(e);
7612
+ let i = ge(t);
7613
+ if (i) return jt(i);
7614
+ if (ii(t)) return $a(He);
7559
7615
  switch (t) {
7560
7616
  case 'seedance-2-5':
7561
7617
  return Be(He, t);
7562
7618
  case 'seedance-2-5-lite':
7563
- return Jt(He, { no4k: !0 });
7619
+ return Wt(He, { no4k: !0 });
7564
7620
  case 'seedance-2':
7565
- return Be(Wt, t);
7621
+ return Be(Yt, t);
7566
7622
  case 'seedance-2-lite':
7567
- return Jt(Wt);
7623
+ return Wt(Yt);
7568
7624
  case 'seedance-2-mini':
7569
- return Be(ji, t);
7625
+ return Be(ja, t);
7570
7626
  case 'nano-banana-2':
7571
7627
  case 'nano-banana-2.1':
7572
7628
  case 'nano-banana-pro':
7573
- return Ai(e);
7629
+ return Aa(e);
7574
7630
  case 'seedream-5-pro':
7575
7631
  return [
7576
7632
  C('Detailed description of the image to generate.'),
@@ -7837,7 +7893,7 @@ function Bi(e) {
7837
7893
  max: 0.4,
7838
7894
  description: 'Portrait depth. Heavy only.',
7839
7895
  },
7840
- ...Ni,
7896
+ ...Na,
7841
7897
  ];
7842
7898
  case 'enhancor-skin-fix-v3':
7843
7899
  return [
@@ -7944,10 +8000,10 @@ function Bi(e) {
7944
8000
  return [C('Prompt text.')];
7945
8001
  }
7946
8002
  }
7947
- function Gi() {
8003
+ function Ga() {
7948
8004
  return {
7949
8005
  slug: he,
7950
- name: Gt,
8006
+ name: Ht,
7951
8007
  category: 'Image',
7952
8008
  kind: 'Image-to-Image',
7953
8009
  vendor: 'Enhancor',
@@ -7955,7 +8011,7 @@ function Gi() {
7955
8011
  'Upscales a photo, with an optional skin fix. Full makes the photo its size times the scale; Fast makes a fixed size (long side 2432 px).',
7956
8012
  priceFormatted: '',
7957
8013
  unit: '/img',
7958
- primaryToolName: Xt.image,
8014
+ primaryToolName: Qt.image,
7959
8015
  parameters: [
7960
8016
  {
7961
8017
  name: 'image',
@@ -7981,7 +8037,7 @@ function Gi() {
7981
8037
  {
7982
8038
  name: 'scale',
7983
8039
  type: 'select',
7984
- default: String(Ht),
8040
+ default: String(zt),
7985
8041
  options: Y.noSkin.map(String),
7986
8042
  description: `Full only. ${Y.skin.join(', ')} with skin_fix on; also ${Y.noSkin.filter((e) => !Y.skin.includes(e)).join(' and ')} with it off. The output is at most 48 megapixels.`,
7987
8043
  },
@@ -7992,17 +8048,17 @@ function ze(e, t = e.api.model) {
7992
8048
  return {
7993
8049
  slug: t,
7994
8050
  name: e.name,
7995
- category: _i[e.kind],
7996
- kind: t.startsWith('enhancor-skin-fix-') ? 'Image-to-Image' : Pi[e.kind],
8051
+ category: _a[e.kind],
8052
+ kind: t.startsWith('enhancor-skin-fix-') ? 'Image-to-Image' : Pa[e.kind],
7997
8053
  vendor: e.vendor ?? '',
7998
8054
  description: e.desc ?? e.name,
7999
- priceFormatted: Ii(e),
8055
+ priceFormatted: Ia(e),
8000
8056
  unit: e.unit,
8001
- primaryToolName: Xt[e.kind],
8002
- parameters: Mi(e, Bi(e)),
8057
+ primaryToolName: Qt[e.kind],
8058
+ parameters: Ma(e, Ba(e)),
8003
8059
  };
8004
8060
  }
8005
- function Hi() {
8061
+ function Ha() {
8006
8062
  let e = {};
8007
8063
  for (let t of ue())
8008
8064
  if (t.slug !== 'seedance-2-fast') {
@@ -8011,16 +8067,16 @@ function Hi() {
8011
8067
  continue;
8012
8068
  }
8013
8069
  if (t.slug === 'seedance-2') {
8014
- let a = ze(t);
8015
- ((a.description = `${t.desc ?? t.name} Send quality fast or mini for Seedance 2.0 Fast or Mini.`),
8016
- (e['seedance-2'] = a));
8070
+ let i = ze(t);
8071
+ ((i.description = `${t.desc ?? t.name} Send quality fast or mini for Seedance 2.0 Fast or Mini.`),
8072
+ (e['seedance-2'] = i));
8017
8073
  continue;
8018
8074
  }
8019
8075
  t.slug.startsWith('claude-') || (e[t.api.model] = ze(t));
8020
8076
  }
8021
- (Object.assign(e, Lt()), (e[he] = Gi()));
8022
- for (let [t, a] of Object.entries(fe))
8023
- e[a] && Object.defineProperty(e, t, { value: e[a], enumerable: !1 });
8077
+ (Object.assign(e, Lt()), (e[he] = Ga()));
8078
+ for (let [t, i] of Object.entries(fe))
8079
+ e[i] && Object.defineProperty(e, t, { value: e[i], enumerable: !1 });
8024
8080
  return e;
8025
8081
  }
8026
8082
  function we(e) {
@@ -8029,102 +8085,102 @@ function we(e) {
8029
8085
  function H(e) {
8030
8086
  return ke[e] ?? null;
8031
8087
  }
8032
- function zi(e, t, a) {
8088
+ function za(e, t, i) {
8033
8089
  if (e.startsWith('enhancor-skin-fix-') || e === he) return !1;
8034
- if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite' || ta(e)) && t === 'duration') {
8090
+ if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite' || ii(e)) && t === 'duration') {
8035
8091
  let n = (s) => (typeof s == 'string' ? s.trim().toLowerCase() : '');
8036
- if (n(a.mode) === 'edit' || n(a.omni_reference_task_type) === 'edit') return !1;
8092
+ if (n(i.mode) === 'edit' || n(i.omni_reference_task_type) === 'edit') return !1;
8037
8093
  }
8038
8094
  if (
8039
- (t === 'max_tokens' && Yt(a.max_completion_tokens)) ||
8040
- (t === 'max_completion_tokens' && Yt(a.max_tokens))
8095
+ (t === 'max_tokens' && Xt(i.max_completion_tokens)) ||
8096
+ (t === 'max_completion_tokens' && Xt(i.max_tokens))
8041
8097
  )
8042
8098
  return !1;
8043
8099
  if (t === 'aspect_ratio') {
8044
8100
  let n = ge(e);
8045
8101
  if (n) {
8046
- let s = typeof a.mode == 'string' ? a.mode.trim().toLowerCase() : '',
8102
+ let s = typeof i.mode == 'string' ? i.mode.trim().toLowerCase() : '',
8047
8103
  o = s ? s.replace(/-/g, '_') : n.modes[0];
8048
- if (n.modes.includes(o) && !Ut(n, o)) return !1;
8104
+ if (n.modes.includes(o) && !Ft(n, o)) return !1;
8049
8105
  }
8050
8106
  }
8051
- let i = ge(e);
8052
- if (i) {
8053
- let n = typeof a.mode == 'string' ? a.mode.trim().toLowerCase() : '',
8054
- s = n ? n.replace(/-/g, '_') : i.modes[0];
8055
- if (i.modes.includes(s) && !Ft(i, s, t)) return !1;
8107
+ let a = ge(e);
8108
+ if (a) {
8109
+ let n = typeof i.mode == 'string' ? i.mode.trim().toLowerCase() : '',
8110
+ s = n ? n.replace(/-/g, '_') : a.modes[0];
8111
+ if (a.modes.includes(s) && !Bt(a, s, t)) return !1;
8056
8112
  }
8057
8113
  return !0;
8058
8114
  }
8059
- function Yt(e) {
8115
+ function Xt(e) {
8060
8116
  return e != null && e !== '';
8061
8117
  }
8062
- function ra(e, t) {
8063
- let a = { ...t };
8118
+ function ni(e, t) {
8119
+ let i = { ...t };
8064
8120
  if (e?.slug === 'seedance-2-5') {
8065
- let i = (n) => typeof n != 'string' || !n.trim();
8066
- for (let n of Ji) (i(a.finalize) && !i(a[n]) && (a.finalize = a[n]), delete a[n]);
8067
- if (!i(a.finalize)) return a;
8121
+ let a = (n) => typeof n != 'string' || !n.trim();
8122
+ for (let n of Ja) (a(i.finalize) && !a(i[n]) && (i.finalize = i[n]), delete i[n]);
8123
+ if (!a(i.finalize)) return i;
8068
8124
  }
8069
- for (let i of e?.parameters ?? [])
8070
- i.default !== void 0 &&
8071
- a[i.name] === void 0 &&
8072
- zi(e.slug, i.name, t) &&
8073
- (a[i.name] = i.default);
8074
- return a;
8125
+ for (let a of e?.parameters ?? [])
8126
+ a.default !== void 0 &&
8127
+ i[a.name] === void 0 &&
8128
+ za(e.slug, a.name, t) &&
8129
+ (i[a.name] = a.default);
8130
+ return i;
8075
8131
  }
8076
8132
  function D() {
8077
8133
  return Object.values(ke);
8078
8134
  }
8079
- var _i,
8080
- Xt,
8081
- Pi,
8135
+ var _a,
8136
+ Qt,
8137
+ Pa,
8082
8138
  C,
8083
8139
  Je,
8084
- Ti,
8085
- ea,
8140
+ Ta,
8141
+ ti,
8086
8142
  We,
8087
8143
  Ye,
8088
8144
  be,
8089
- Ki,
8090
- Si,
8091
- Ci,
8092
- qi,
8093
- Oi,
8094
- Ri,
8095
- Ni,
8145
+ Ka,
8146
+ Sa,
8147
+ Ca,
8148
+ qa,
8149
+ Oa,
8150
+ Ra,
8151
+ Na,
8096
8152
  Z,
8097
8153
  He,
8098
- aa,
8099
- ia,
8100
- Wt,
8101
- ji,
8154
+ ai,
8155
+ ri,
8156
+ Yt,
8157
+ ja,
8102
8158
  ke,
8103
- Ji,
8159
+ Ja,
8104
8160
  ee = h(() => {
8105
8161
  'use strict';
8106
8162
  bt();
8107
8163
  Ce();
8108
8164
  G();
8109
8165
  Re();
8110
- Ee();
8166
+ $e();
8111
8167
  Le();
8112
8168
  St();
8113
- Et();
8169
+ $t();
8114
8170
  At();
8115
8171
  Dt();
8116
8172
  Ue();
8117
- jt();
8118
- zt();
8173
+ Gt();
8174
+ Jt();
8119
8175
  Fe();
8120
- ((_i = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
8121
- (Xt = {
8176
+ ((_a = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
8177
+ (Qt = {
8122
8178
  video: 'generate_video',
8123
8179
  image: 'generate_image',
8124
8180
  audio: 'generate_audio',
8125
8181
  llm: 'run_task',
8126
8182
  }),
8127
- (Pi = {
8183
+ (Pa = {
8128
8184
  video: 'Text-to-Video',
8129
8185
  image: 'Text-to-Image',
8130
8186
  audio: 'Text-to-Audio',
@@ -8138,13 +8194,13 @@ var _i,
8138
8194
  description:
8139
8195
  'Runs the Creative mode checkpoint at its published price (+5%). The Acceptable Use Policy applies.',
8140
8196
  }),
8141
- (Ti = {
8197
+ (Ta = {
8142
8198
  name: 'creative_mode',
8143
8199
  type: 'boolean',
8144
8200
  default: !1,
8145
8201
  description: `Not available yet on this model: ${ye}.`,
8146
8202
  }),
8147
- (ea = {
8203
+ (ti = {
8148
8204
  name: 'priority',
8149
8205
  type: 'boolean',
8150
8206
  default: !1,
@@ -8162,7 +8218,7 @@ var _i,
8162
8218
  '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.',
8163
8219
  }),
8164
8220
  (be = new Set(['full_access', 'is_uncensored', 'unfiltered', 'verificationSignature'])));
8165
- ((Ki = new Set([
8221
+ ((Ka = new Set([
8166
8222
  'quality',
8167
8223
  'bitrate_mode',
8168
8224
  'draft',
@@ -8171,7 +8227,7 @@ var _i,
8171
8227
  'draft_generation_id',
8172
8228
  'pass_faces',
8173
8229
  ])),
8174
- (Si = new Set([
8230
+ (Sa = new Set([
8175
8231
  'quality',
8176
8232
  'bitrate_mode',
8177
8233
  'draft',
@@ -8179,12 +8235,12 @@ var _i,
8179
8235
  'draft_task_id',
8180
8236
  'draft_generation_id',
8181
8237
  ])),
8182
- (Ci = {
8238
+ (Ca = {
8183
8239
  images: 'up to 10',
8184
8240
  videos: 'up to 5; combined duration < 30s',
8185
8241
  audios: 'up to 5; combined duration < 30s',
8186
8242
  }));
8187
- ((qi = [
8243
+ ((qa = [
8188
8244
  C('The user message or task.'),
8189
8245
  { name: 'system', type: 'string', description: 'Optional system instructions.' },
8190
8246
  {
@@ -8202,7 +8258,7 @@ var _i,
8202
8258
  { name: 'temperature', type: 'slider', min: 0, max: 1, step: 0.1 },
8203
8259
  { name: 'top_p', type: 'slider', min: 0, max: 1, step: 0.05 },
8204
8260
  ]),
8205
- (Oi = [
8261
+ (Oa = [
8206
8262
  C('The user message or task.'),
8207
8263
  { name: 'system', type: 'string', description: 'Optional system instructions.' },
8208
8264
  {
@@ -8284,8 +8340,8 @@ var _i,
8284
8340
  description: 'Video frames read a second.',
8285
8341
  },
8286
8342
  ]),
8287
- (Ri = ['gemini-3.8-flash', 'gemini-3.7-flash']));
8288
- Ni = Object.entries({
8343
+ (Ra = ['gemini-3.8-flash', 'gemini-3.7-flash']));
8344
+ Na = Object.entries({
8289
8345
  background: !1,
8290
8346
  skin: !1,
8291
8347
  nose: !1,
@@ -8461,19 +8517,19 @@ var _i,
8461
8517
  'Keeps real faces in reference images. On by default. Send false to turn it off.',
8462
8518
  },
8463
8519
  ]),
8464
- (aa = {
8520
+ (ai = {
8465
8521
  name: 'images',
8466
8522
  type: 'string[]',
8467
8523
  description:
8468
8524
  '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.',
8469
8525
  }),
8470
- (ia = {
8526
+ (ri = {
8471
8527
  name: 'audios',
8472
8528
  type: 'string[]',
8473
8529
  description:
8474
8530
  '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.',
8475
8531
  }),
8476
- (Wt = [
8532
+ (Yt = [
8477
8533
  {
8478
8534
  name: 'prompt',
8479
8535
  type: 'string',
@@ -8551,8 +8607,8 @@ var _i,
8551
8607
  description:
8552
8608
  'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
8553
8609
  },
8554
- aa,
8555
- ia,
8610
+ ai,
8611
+ ri,
8556
8612
  {
8557
8613
  name: 'first_frame_image',
8558
8614
  type: 'string',
@@ -8573,7 +8629,7 @@ var _i,
8573
8629
  'Keeps real faces in reference images. On by default. Send false to turn it off.',
8574
8630
  },
8575
8631
  ]),
8576
- (ji = [
8632
+ (ja = [
8577
8633
  {
8578
8634
  name: 'prompt',
8579
8635
  type: 'string',
@@ -8628,8 +8684,8 @@ var _i,
8628
8684
  description:
8629
8685
  'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
8630
8686
  },
8631
- aa,
8632
- ia,
8687
+ ai,
8688
+ ri,
8633
8689
  {
8634
8690
  name: 'first_frame_image',
8635
8691
  type: 'string',
@@ -8644,29 +8700,29 @@ var _i,
8644
8700
  'Keeps real faces in reference images. On by default. Send false to turn it off.',
8645
8701
  },
8646
8702
  ]));
8647
- ke = Hi();
8648
- Ji = ['draft_task_id', 'draft_generation_id'];
8703
+ ke = Ha();
8704
+ Ja = ['draft_task_id', 'draft_generation_id'];
8649
8705
  });
8650
8706
  function xe(e) {
8651
8707
  let t = '/v1/pricing/models',
8652
- a = e?.trim();
8653
- return a ? `${t}?model=${encodeURIComponent(a)}` : t;
8708
+ i = e?.trim();
8709
+ return i ? `${t}?model=${encodeURIComponent(i)}` : t;
8654
8710
  }
8655
8711
  var et = h(() => {
8656
8712
  'use strict';
8657
8713
  });
8658
- function _a(e) {
8714
+ function Pi(e) {
8659
8715
  return e.length <= 1 ? (e[0] ?? '') : `${e.slice(0, -1).join(', ')} and ${e[e.length - 1]}`;
8660
8716
  }
8661
- function Pa(e) {
8717
+ function Ii(e) {
8662
8718
  let t = ue().filter((s) => s.kind === e && s.unfiltered != null),
8663
- a = t.filter((s) => X.includes(s.api.model)).map((s) => s.name),
8664
- i = t.filter((s) => !X.includes(s.api.model)).map((s) => s.name);
8719
+ i = t.filter((s) => X.includes(s.api.model)).map((s) => s.name),
8720
+ a = t.filter((s) => !X.includes(s.api.model)).map((s) => s.name);
8665
8721
  return [
8666
- ...(a.length
8667
- ? [`${_a(a)}: runs the Creative mode checkpoint at its published price (+5%).`]
8722
+ ...(i.length
8723
+ ? [`${Pi(i)}: runs the Creative mode checkpoint at its published price (+5%).`]
8668
8724
  : []),
8669
- ...(i.length ? [`Not available yet on ${_a(i)}: ${ye}.`] : []),
8725
+ ...(a.length ? [`Not available yet on ${Pi(a)}: ${ye}.`] : []),
8670
8726
  'The Acceptable Use Policy applies.',
8671
8727
  ].join(' ');
8672
8728
  }
@@ -8680,15 +8736,15 @@ function Ir(e) {
8680
8736
  function vr(e) {
8681
8737
  let t = e.inputSchema.properties;
8682
8738
  if (!t) return e;
8683
- let a = !1,
8684
- i = {};
8739
+ let i = !1,
8740
+ a = {};
8685
8741
  for (let [n, s] of Object.entries(t))
8686
- Ia.has(n) && s.type === 'string' && !s.format
8687
- ? ((i[n] = { ...s, format: 'uri' }), (a = !0))
8688
- : Ia.has(n) && s.type === 'array' && s.items?.type === 'string' && !s.items.format
8689
- ? ((i[n] = { ...s, items: { ...s.items, format: 'uri' } }), (a = !0))
8690
- : (i[n] = s);
8691
- return a ? { ...e, inputSchema: { ...e.inputSchema, properties: i } } : e;
8742
+ vi.has(n) && s.type === 'string' && !s.format
8743
+ ? ((a[n] = { ...s, format: 'uri' }), (i = !0))
8744
+ : vi.has(n) && s.type === 'array' && s.items?.type === 'string' && !s.items.format
8745
+ ? ((a[n] = { ...s, items: { ...s.items, format: 'uri' } }), (i = !0))
8746
+ : (a[n] = s);
8747
+ return i ? { ...e, inputSchema: { ...e.inputSchema, properties: a } } : e;
8692
8748
  }
8693
8749
  function Tr(e) {
8694
8750
  switch (e.type) {
@@ -8746,27 +8802,27 @@ function Tr(e) {
8746
8802
  }
8747
8803
  }
8748
8804
  function Mr(e, t) {
8749
- let a = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
8750
- i = {},
8805
+ let i = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
8806
+ a = {},
8751
8807
  n = [];
8752
- for (let o of e.parameters) ((i[o.name] = Tr(o)), o.required && n.push(o.name));
8808
+ for (let o of e.parameters) ((a[o.name] = Tr(o)), o.required && n.push(o.name));
8753
8809
  let s = {
8754
8810
  type: 'object',
8755
- properties: i,
8811
+ properties: a,
8756
8812
  ...(n.length > 0 ? { required: n } : {}),
8757
8813
  additionalProperties: !0,
8758
8814
  };
8759
8815
  return {
8760
- name: a,
8816
+ name: i,
8761
8817
  description: `[Tein AI - ${e.name} (${e.category})] ${e.description} (Pricing: ${e.priceFormatted})`,
8762
8818
  inputSchema: s,
8763
8819
  };
8764
8820
  }
8765
8821
  function Kr() {
8766
- let e = D().filter((d) => d.category === 'Image' && !we(d)),
8767
- t = D().filter((d) => d.category === 'Video'),
8768
- a = D().filter((d) => d.category === 'Text'),
8769
- i = D().filter((d) => d.category === 'Audio'),
8822
+ let e = D().filter((p) => p.category === 'Image' && !we(p)),
8823
+ t = D().filter((p) => p.category === 'Video'),
8824
+ i = D().filter((p) => p.category === 'Text'),
8825
+ a = D().filter((p) => p.category === 'Audio'),
8770
8826
  n = {
8771
8827
  name: 'generate_image',
8772
8828
  description:
@@ -8780,7 +8836,7 @@ function Kr() {
8780
8836
  },
8781
8837
  model: {
8782
8838
  type: 'string',
8783
- enum: e.map((d) => d.slug),
8839
+ enum: e.map((p) => p.slug),
8784
8840
  default: 'gpt-image-2',
8785
8841
  description: 'The image model to use (default: gpt-image-2).',
8786
8842
  },
@@ -8853,7 +8909,7 @@ function Kr() {
8853
8909
  maximum: 2147483647,
8854
8910
  description: 'Nano Banana 2 and Nano Banana Pro. Omit it for a new image each time.',
8855
8911
  },
8856
- creative_mode: { type: 'boolean', description: Pa('image') },
8912
+ creative_mode: { type: 'boolean', description: Ii('image') },
8857
8913
  },
8858
8914
  required: ['prompt'],
8859
8915
  additionalProperties: !0,
@@ -8873,7 +8929,7 @@ function Kr() {
8873
8929
  },
8874
8930
  model: {
8875
8931
  type: 'string',
8876
- enum: t.map((d) => d.slug),
8932
+ enum: t.map((p) => p.slug),
8877
8933
  default: 'seedance-2-5',
8878
8934
  description: 'The video model to use (default: seedance-2-5).',
8879
8935
  },
@@ -8890,7 +8946,7 @@ function Kr() {
8890
8946
  description:
8891
8947
  "Video resolution, where the model takes it (see each model tool). Left out: the model's own default, its lowest price.",
8892
8948
  },
8893
- creative_mode: { type: 'boolean', description: Pa('video') },
8949
+ creative_mode: { type: 'boolean', description: Ii('video') },
8894
8950
  priority: {
8895
8951
  type: 'boolean',
8896
8952
  description:
@@ -8956,7 +9012,7 @@ function Kr() {
8956
9012
  prompt: { type: 'string', description: 'The reasoning task or query to execute.' },
8957
9013
  model: {
8958
9014
  type: 'string',
8959
- enum: a.map((d) => d.slug),
9015
+ enum: i.map((p) => p.slug),
8960
9016
  default: 'gpt-6-astra',
8961
9017
  description: 'The reasoning model to use (default: gpt-6-astra).',
8962
9018
  },
@@ -9026,8 +9082,8 @@ function Kr() {
9026
9082
  additionalProperties: !0,
9027
9083
  },
9028
9084
  },
9029
- p = Sr();
9030
- return [n, s, o, u, l, p, c, wr, ...va];
9085
+ d = Sr();
9086
+ return [n, s, o, u, l, d, c, wr, ...Ti];
9031
9087
  }
9032
9088
  function Sr() {
9033
9089
  return {
@@ -9078,7 +9134,7 @@ function Sr() {
9078
9134
  }
9079
9135
  function st() {
9080
9136
  let e = Kr(),
9081
- t = D().map((a) => Mr(a));
9137
+ t = D().map((i) => Mr(i));
9082
9138
  return [...e, ...t].map(Ir).map(vr);
9083
9139
  }
9084
9140
  var br,
@@ -9087,10 +9143,10 @@ var br,
9087
9143
  xr,
9088
9144
  _r,
9089
9145
  Pr,
9090
- va,
9146
+ Ti,
9091
9147
  Cs,
9092
- Ia,
9093
- Ta = h(() => {
9148
+ vi,
9149
+ Mi = h(() => {
9094
9150
  'use strict';
9095
9151
  G();
9096
9152
  Fe();
@@ -9181,9 +9237,9 @@ var br,
9181
9237
  additionalProperties: !1,
9182
9238
  },
9183
9239
  }),
9184
- (va = [xr, _r, Pr]),
9185
- (Cs = new Set(va.map((e) => e.name))));
9186
- Ia = new Set([
9240
+ (Ti = [xr, _r, Pr]),
9241
+ (Cs = new Set(Ti.map((e) => e.name))));
9242
+ vi = new Set([
9187
9243
  'image',
9188
9244
  'images',
9189
9245
  'image_url',
@@ -9200,30 +9256,30 @@ var br,
9200
9256
  'lipsyncing_audio',
9201
9257
  ]);
9202
9258
  });
9203
- var Ra = {};
9204
- ja(Ra, {
9259
+ var Li = {};
9260
+ Gi(Li, {
9205
9261
  forgetToolSchemas: () => qr,
9206
- jsonRpcAnswer: () => Ca,
9207
- preprocessLocalFiles: () => qa,
9208
- startStdioServer: () => Oa,
9262
+ jsonRpcAnswer: () => $i,
9263
+ preprocessLocalFiles: () => Oi,
9264
+ startStdioServer: () => Ri,
9209
9265
  });
9210
9266
  function Cr(e) {
9211
- let t = (a) =>
9212
- !!a && typeof a == 'object' && a.jsonrpc === '2.0' && ('result' in a || 'error' in a);
9267
+ let t = (i) =>
9268
+ !!i && typeof i == 'object' && i.jsonrpc === '2.0' && ('result' in i || 'error' in i);
9213
9269
  return Array.isArray(e) ? e.length > 0 && e.every(t) : t(e);
9214
9270
  }
9215
- function Ca(e, t, a) {
9216
- let i = e?.id,
9217
- n = i == null,
9271
+ function $i(e, t, i) {
9272
+ let a = e?.id,
9273
+ n = a == null,
9218
9274
  s = null;
9219
9275
  try {
9220
- s = a ? JSON.parse(a) : null;
9276
+ s = i ? JSON.parse(i) : null;
9221
9277
  } catch {
9222
9278
  s = null;
9223
9279
  }
9224
9280
  if (s !== null && Cr(s)) return n ? null : s;
9225
9281
  if (n) return null;
9226
- if (!a && t >= 200 && t < 300) return;
9282
+ if (!i && t >= 200 && t < 300) return;
9227
9283
  let o = s?.error,
9228
9284
  u =
9229
9285
  typeof o == 'string'
@@ -9234,7 +9290,7 @@ function Ca(e, t, a) {
9234
9290
  l = o && typeof o == 'object' && typeof o.code == 'string' ? o.code : null;
9235
9291
  return {
9236
9292
  jsonrpc: '2.0',
9237
- id: i,
9293
+ id: a,
9238
9294
  error: {
9239
9295
  code: t === 401 ? -32001 : -32603,
9240
9296
  message: u,
@@ -9242,31 +9298,31 @@ function Ca(e, t, a) {
9242
9298
  },
9243
9299
  };
9244
9300
  }
9245
- function Er() {
9301
+ function $r() {
9246
9302
  let e = process.argv.slice(2),
9247
9303
  t = e.indexOf('--api-key');
9248
9304
  return S(t >= 0 ? e[t + 1] : void 0);
9249
9305
  }
9250
- async function Ea(e, t, a) {
9251
- let i = z.default.resolve(e);
9252
- if (!V.default.existsSync(i) || !V.default.statSync(i).isFile())
9306
+ async function Ei(e, t, i) {
9307
+ let a = z.default.resolve(e);
9308
+ if (!V.default.existsSync(a) || !V.default.statSync(a).isFile())
9253
9309
  throw new Error(`File not found: ${e}`);
9254
- let n = V.default.readFileSync(i),
9310
+ let n = V.default.readFileSync(a),
9255
9311
  s = n.toString('base64'),
9256
9312
  o = n.length,
9257
- u = `${a.replace(/\/$/, '')}/v1/upload`,
9313
+ u = `${i.replace(/\/$/, '')}/v1/upload`,
9258
9314
  l = await fetch(u, {
9259
9315
  method: 'POST',
9260
9316
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${t}` },
9261
9317
  body: JSON.stringify({ data: s }),
9262
9318
  });
9263
9319
  if (!l.ok) {
9264
- let p = `Upload failed (HTTP ${l.status})`;
9320
+ let d = `Upload failed (HTTP ${l.status})`;
9265
9321
  try {
9266
- let d = await l.json();
9267
- p = (typeof d.error == 'string' ? d.error : d.error?.message) || d.message || p;
9322
+ let p = await l.json();
9323
+ d = (typeof p.error == 'string' ? p.error : p.error?.message) || p.message || d;
9268
9324
  } catch {}
9269
- throw new Error(p);
9325
+ throw new Error(d);
9270
9326
  }
9271
9327
  let c = await l.json();
9272
9328
  return {
@@ -9276,10 +9332,10 @@ async function Ea(e, t, a) {
9276
9332
  mimeType: c.mime_type || c.mimeType || 'image/png',
9277
9333
  };
9278
9334
  }
9279
- function $a(e) {
9280
- return $r.has(z.default.extname(e).toLowerCase());
9335
+ function Ai(e) {
9336
+ return Er.has(z.default.extname(e).toLowerCase());
9281
9337
  }
9282
- function Aa(e) {
9338
+ function qi(e) {
9283
9339
  return new Error(
9284
9340
  `Tein uploads image, video and audio files only, and ${z.default.basename(e)} is not one.`,
9285
9341
  );
@@ -9294,27 +9350,27 @@ function Ar(e) {
9294
9350
  `)
9295
9351
  )
9296
9352
  return null;
9297
- let a = z.default.resolve(t);
9298
- return V.default.existsSync(a) && V.default.statSync(a).isFile() ? a : null;
9353
+ let i = z.default.resolve(t);
9354
+ return V.default.existsSync(i) && V.default.statSync(i).isFile() ? i : null;
9299
9355
  }
9300
9356
  function lt(e) {
9301
9357
  if (Array.isArray(e))
9302
9358
  for (let t of e) {
9303
- let a = t;
9304
- typeof a.name == 'string' &&
9305
- a.inputSchema &&
9306
- typeof a.inputSchema == 'object' &&
9307
- ie.set(a.name, a.inputSchema);
9359
+ let i = t;
9360
+ typeof i.name == 'string' &&
9361
+ i.inputSchema &&
9362
+ typeof i.inputSchema == 'object' &&
9363
+ ae.set(i.name, i.inputSchema);
9308
9364
  }
9309
9365
  }
9310
9366
  function qr() {
9311
- (ie.clear(), (ot = 0));
9367
+ (ae.clear(), (ot = 0));
9312
9368
  }
9313
9369
  async function Or(e, t) {
9314
9370
  if (!(Date.now() - ot < 6e4)) {
9315
9371
  ot = Date.now();
9316
9372
  try {
9317
- let i = await (
9373
+ let a = await (
9318
9374
  await fetch(e, {
9319
9375
  method: 'POST',
9320
9376
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${t}` },
@@ -9322,7 +9378,7 @@ async function Or(e, t) {
9322
9378
  signal: AbortSignal.timeout(1e4),
9323
9379
  })
9324
9380
  ).json();
9325
- lt(i.result?.tools);
9381
+ lt(a.result?.tools);
9326
9382
  } catch {}
9327
9383
  }
9328
9384
  }
@@ -9333,25 +9389,25 @@ function Rr(e) {
9333
9389
  : e.type === 'array' && e.items?.format === 'uri'
9334
9390
  : !1;
9335
9391
  }
9336
- async function Ma(e, t, a) {
9392
+ async function Ki(e, t, i) {
9337
9393
  if (typeof e != 'string') return e;
9338
- let i = Ar(e);
9339
- if (!i) return e;
9340
- if (!$a(i)) throw Aa(i);
9341
- return (await Ea(i, t, a)).url;
9342
- }
9343
- async function qa(e, t, a, i, n) {
9344
- (ie.size === 0 && lt(st()), ie.has(e) || (await Or(n, a)));
9345
- let s = ie.get(e)?.properties;
9394
+ let a = Ar(e);
9395
+ if (!a) return e;
9396
+ if (!Ai(a)) throw qi(a);
9397
+ return (await Ei(a, t, i)).url;
9398
+ }
9399
+ async function Oi(e, t, i, a, n) {
9400
+ (ae.size === 0 && lt(st()), ae.has(e) || (await Or(n, i)));
9401
+ let s = ae.get(e)?.properties;
9346
9402
  if (!s) return t;
9347
9403
  let o = { ...t };
9348
9404
  for (let [u, l] of Object.entries(t))
9349
9405
  if (Rr(s[u]))
9350
9406
  if (Array.isArray(l)) {
9351
9407
  let c = [];
9352
- for (let p of l) c.push(await Ma(p, a, i));
9408
+ for (let d of l) c.push(await Ki(d, i, a));
9353
9409
  o[u] = c;
9354
- } else o[u] = await Ma(l, a, i);
9410
+ } else o[u] = await Ki(l, i, a);
9355
9411
  return o;
9356
9412
  }
9357
9413
  function Lr(e) {
@@ -9395,13 +9451,13 @@ function Lr(e) {
9395
9451
  };
9396
9452
  }
9397
9453
  }
9398
- async function Oa() {
9399
- if (Ka) return;
9400
- Ka = !0;
9401
- let e = Er(),
9454
+ async function Ri() {
9455
+ if (Si) return;
9456
+ Si = !0;
9457
+ let e = $r(),
9402
9458
  t = w(),
9403
- a = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
9404
- (Sa.default
9459
+ i = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
9460
+ (Ci.default
9405
9461
  .createInterface({ input: process.stdin, output: process.stdout, terminal: !1 })
9406
9462
  .on('line', async (n) => {
9407
9463
  let s = n.trim();
@@ -9412,10 +9468,10 @@ async function Oa() {
9412
9468
  let l = o.params.name,
9413
9469
  c = o.params.arguments || {};
9414
9470
  if (l === 'get_pricing') {
9415
- let p = typeof c.model == 'string' ? c.model.trim() : '',
9416
- d = `${t.replace(/\/+$/, '')}${xe(p)}`;
9471
+ let d = typeof c.model == 'string' ? c.model.trim() : '',
9472
+ p = `${t.replace(/\/+$/, '')}${xe(d)}`;
9417
9473
  try {
9418
- let m = await fetch(d, { signal: AbortSignal.timeout(1e4) }),
9474
+ let m = await fetch(p, { signal: AbortSignal.timeout(1e4) }),
9419
9475
  y = await m.text();
9420
9476
  process.stdout.write(
9421
9477
  JSON.stringify({
@@ -9452,18 +9508,18 @@ async function Oa() {
9452
9508
  return;
9453
9509
  }
9454
9510
  if (l === 'upload_asset' || l === 'upload_media' || l === 'upload_image') {
9455
- let p = c.path || c.filepath || c.file_path || c.file || c.data;
9511
+ let d = c.path || c.filepath || c.file_path || c.file || c.data;
9456
9512
  if (
9457
- typeof p == 'string' &&
9458
- !p.startsWith('http://') &&
9459
- !p.startsWith('https://') &&
9460
- !p.startsWith('data:')
9513
+ typeof d == 'string' &&
9514
+ !d.startsWith('http://') &&
9515
+ !d.startsWith('https://') &&
9516
+ !d.startsWith('data:')
9461
9517
  )
9462
9518
  try {
9463
- let d = z.default.resolve(p.trim());
9464
- if (V.default.existsSync(d) && V.default.statSync(d).isFile() && e) {
9465
- if (!$a(d)) throw Aa(d);
9466
- let m = await Ea(d, e, t),
9519
+ let p = z.default.resolve(d.trim());
9520
+ if (V.default.existsSync(p) && V.default.statSync(p).isFile() && e) {
9521
+ if (!Ai(p)) throw qi(p);
9522
+ let m = await Ei(p, e, t),
9467
9523
  y = (m.sizeBytes / 1024).toFixed(1),
9468
9524
  _e =
9469
9525
  m.mimeType.startsWith('image/') ||
@@ -9498,8 +9554,8 @@ Pass this URL to any Tein generation tool.`,
9498
9554
  );
9499
9555
  return;
9500
9556
  }
9501
- } catch (d) {
9502
- let m = d instanceof Error ? d.message : String(d);
9557
+ } catch (p) {
9558
+ let m = p instanceof Error ? p.message : String(p);
9503
9559
  process.stdout.write(
9504
9560
  JSON.stringify({
9505
9561
  jsonrpc: '2.0',
@@ -9519,9 +9575,9 @@ Pass this URL to any Tein generation tool.`,
9519
9575
  }
9520
9576
  if (e)
9521
9577
  try {
9522
- o.params.arguments = await qa(String(l), c, e, t, a);
9523
- } catch (p) {
9524
- let d = p instanceof Error ? p.message : String(p);
9578
+ o.params.arguments = await Oi(String(l), c, e, t, i);
9579
+ } catch (d) {
9580
+ let p = d instanceof Error ? d.message : String(d);
9525
9581
  process.stdout.write(
9526
9582
  JSON.stringify({
9527
9583
  jsonrpc: '2.0',
@@ -9530,7 +9586,7 @@ Pass this URL to any Tein generation tool.`,
9530
9586
  content: [
9531
9587
  {
9532
9588
  type: 'text',
9533
- text: `Failed to read or upload a local file before calling Tein: ${d}`,
9589
+ text: `Failed to read or upload a local file before calling Tein: ${p}`,
9534
9590
  },
9535
9591
  ],
9536
9592
  isError: !0,
@@ -9544,18 +9600,18 @@ Pass this URL to any Tein generation tool.`,
9544
9600
  }
9545
9601
  if (e)
9546
9602
  try {
9547
- let l = await fetch(a, {
9603
+ let l = await fetch(i, {
9548
9604
  method: 'POST',
9549
9605
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${e}` },
9550
9606
  body: JSON.stringify(o),
9551
9607
  }),
9552
9608
  c = await l.text(),
9553
- p = Ca(o, l.status, c);
9554
- if (p === null) return;
9555
- if (p) {
9556
- (o?.method === 'tools/list' && lt(p.result?.tools),
9609
+ d = $i(o, l.status, c);
9610
+ if (d === null) return;
9611
+ if (d) {
9612
+ (o?.method === 'tools/list' && lt(d.result?.tools),
9557
9613
  process.stdout.write(
9558
- JSON.stringify(p) +
9614
+ JSON.stringify(d) +
9559
9615
  `
9560
9616
  `,
9561
9617
  ));
@@ -9587,21 +9643,21 @@ Pass this URL to any Tein generation tool.`,
9587
9643
  }
9588
9644
  var V,
9589
9645
  z,
9590
- Sa,
9591
- $r,
9592
- ie,
9646
+ Ci,
9647
+ Er,
9648
+ ae,
9593
9649
  ot,
9594
- Ka,
9595
- La = h(() => {
9650
+ Si,
9651
+ Di = h(() => {
9596
9652
  'use strict';
9597
9653
  ((V = T(require('node:fs'))),
9598
9654
  (z = T(require('node:path'))),
9599
- (Sa = T(require('node:readline'))));
9655
+ (Ci = T(require('node:readline'))));
9600
9656
  et();
9601
- Ta();
9602
- $();
9657
+ Mi();
9658
+ E();
9603
9659
  re();
9604
- $r = new Set([
9660
+ Er = new Set([
9605
9661
  '.png',
9606
9662
  '.jpg',
9607
9663
  '.jpeg',
@@ -9627,20 +9683,20 @@ var V,
9627
9683
  '.flac',
9628
9684
  '.opus',
9629
9685
  ]);
9630
- ((ie = new Map()), (ot = 0));
9631
- Ka = !1;
9686
+ ((ae = new Map()), (ot = 0));
9687
+ Si = !1;
9632
9688
  require.main === module &&
9633
- Oa().catch((e) => {
9689
+ Ri().catch((e) => {
9634
9690
  (process.stderr.write(`Fatal error in Tein MCP CLI: ${e}
9635
9691
  `),
9636
9692
  process.exit(1));
9637
9693
  });
9638
9694
  });
9639
- var Ha =
9695
+ var zi =
9640
9696
  !process.env.NO_COLOR &&
9641
9697
  (process.stdout.isTTY || process.env.FORCE_COLOR === '1' || process.env.TERM !== 'dumb');
9642
9698
  function x(e, t) {
9643
- return (a) => (Ha ? `\x1B[${e}m${a}\x1B[${t}m` : String(a));
9699
+ return (i) => (zi ? `\x1B[${e}m${i}\x1B[${t}m` : String(i));
9644
9700
  }
9645
9701
  var r = {
9646
9702
  bold: x(1, 22),
@@ -9662,7 +9718,7 @@ var r = {
9662
9718
  bgCyan: x(46, 49),
9663
9719
  bgGreen: x(42, 49),
9664
9720
  },
9665
- E = class {
9721
+ $ = class {
9666
9722
  constructor(t = '') {
9667
9723
  this.frames = [
9668
9724
  '\u280B',
@@ -9686,8 +9742,8 @@ var r = {
9686
9742
  process.stdout.isTTY
9687
9743
  ? (this.stop(),
9688
9744
  (this.timer = setInterval(() => {
9689
- let a = r.cyan(this.frames[this.current]);
9690
- (process.stdout.write(`\r${a} ${this.text} `),
9745
+ let i = r.cyan(this.frames[this.current]);
9746
+ (process.stdout.write(`\r${i} ${this.text} `),
9691
9747
  (this.current = (this.current + 1) % this.frames.length));
9692
9748
  }, 80)),
9693
9749
  this)
@@ -9701,20 +9757,20 @@ var r = {
9701
9757
  }
9702
9758
  succeed(t) {
9703
9759
  this.stop();
9704
- let a = t || this.text;
9760
+ let i = t || this.text;
9705
9761
  process.stdout.isTTY
9706
- ? process.stdout.write(`\r${r.green('\u2713')} ${a}
9762
+ ? process.stdout.write(`\r${r.green('\u2713')} ${i}
9707
9763
  `)
9708
- : process.stdout.write(`[\u2713] ${a}
9764
+ : process.stdout.write(`[\u2713] ${i}
9709
9765
  `);
9710
9766
  }
9711
9767
  fail(t) {
9712
9768
  this.stop();
9713
- let a = t || this.text;
9769
+ let i = t || this.text;
9714
9770
  process.stdout.isTTY
9715
- ? process.stdout.write(`\r${r.red('\u2717')} ${a}
9771
+ ? process.stdout.write(`\r${r.red('\u2717')} ${i}
9716
9772
  `)
9717
- : process.stdout.write(`[\u2717] ${a}
9773
+ : process.stdout.write(`[\u2717] ${i}
9718
9774
  `);
9719
9775
  }
9720
9776
  stop() {
@@ -9730,7 +9786,7 @@ var ne = T(require('node:fs')),
9730
9786
  mt = T(require('node:path')),
9731
9787
  ft = require('node:stream/promises');
9732
9788
  re();
9733
- var Ya = new Set([
9789
+ var Xi = new Set([
9734
9790
  'account_suspended',
9735
9791
  'account_terminated',
9736
9792
  'creative_mode_restricted',
@@ -9738,30 +9794,30 @@ var Ya = new Set([
9738
9794
  'workspace_paused',
9739
9795
  ]),
9740
9796
  v = 1,
9741
- Xa = 3,
9797
+ Qi = 3,
9742
9798
  b = class extends Error {
9743
- constructor(t, a, i, n = {}) {
9744
- (super(a),
9799
+ constructor(t, i, a, n = {}) {
9800
+ (super(i),
9745
9801
  (this.name = 'TeinApiError'),
9746
9802
  (this.status = t),
9747
- i && (this.code = i),
9803
+ a && (this.code = a),
9748
9804
  (this.fields = n));
9749
9805
  }
9750
9806
  get exitCode() {
9751
- return this.code && Ya.has(this.code) ? Xa : v;
9807
+ return this.code && Xi.has(this.code) ? Qi : v;
9752
9808
  }
9753
9809
  };
9754
- function Qa(e, t, a) {
9755
- let i = `HTTP ${e}${t ? ` ${t}` : ''}`;
9756
- if (!a || typeof a != 'object') return new b(e, i);
9757
- let n = a;
9810
+ function Zi(e, t, i) {
9811
+ let a = `HTTP ${e}${t ? ` ${t}` : ''}`;
9812
+ if (!i || typeof i != 'object') return new b(e, a);
9813
+ let n = i;
9758
9814
  if (n.error && typeof n.error == 'object' && !Array.isArray(n.error)) {
9759
- let p = n.error,
9760
- { code: d, message: m, ...y } = p;
9761
- return new b(e, typeof m == 'string' && m ? m : i, typeof d == 'string' ? d : void 0, y);
9815
+ let d = n.error,
9816
+ { code: p, message: m, ...y } = d;
9817
+ return new b(e, typeof m == 'string' && m ? m : a, typeof p == 'string' ? p : void 0, y);
9762
9818
  }
9763
9819
  let { error: s, code: o, message: u, ...l } = n,
9764
- c = (typeof s == 'string' && s) || (typeof u == 'string' && u) || i;
9820
+ c = (typeof s == 'string' && s) || (typeof u == 'string' && u) || a;
9765
9821
  return new b(e, c, typeof o == 'string' ? o : void 0, l);
9766
9822
  }
9767
9823
  function ct(e) {
@@ -9769,16 +9825,16 @@ function ct(e) {
9769
9825
  }
9770
9826
  function K(e) {
9771
9827
  let t = [e.message],
9772
- a = ct(e.fields.required),
9773
- i = ct(e.fields.balance);
9774
- (a || i) &&
9775
- t.push([a ? `Required: ${a}` : '', i ? `Balance: ${i}` : ''].filter(Boolean).join(' '));
9828
+ i = ct(e.fields.required),
9829
+ a = ct(e.fields.balance);
9830
+ (i || a) &&
9831
+ t.push([i ? `Required: ${i}` : '', a ? `Balance: ${a}` : ''].filter(Boolean).join(' '));
9776
9832
  let n = e.fields.org_name ?? e.fields.orgName;
9777
9833
  typeof n == 'string' && n && t.push(`Workspace: ${n}`);
9778
9834
  let s = e.fields.url ?? e.fields.appeal_url ?? e.fields.top_up_url;
9779
9835
  return (typeof s == 'string' && s && t.push(s), e.code && t.push(`(${e.code})`), t);
9780
9836
  }
9781
- function Za(e) {
9837
+ function ea(e) {
9782
9838
  return /\.(mp4|webm|mov)(\?|$)/i.test(e)
9783
9839
  ? 'video'
9784
9840
  : /\.(mp3|wav|ogg|flac)(\?|$)/i.test(e)
@@ -9787,15 +9843,15 @@ function Za(e) {
9787
9843
  }
9788
9844
  function ut(e) {
9789
9845
  let t = [];
9790
- for (let a of e.data ?? [])
9791
- typeof a.message?.content == 'string'
9792
- ? t.push({ type: 'text', text: a.message.content })
9793
- : a.url && t.push({ type: Za(a.url), url: a.url, ...(a.layer ? { layer: a.layer } : {}) });
9846
+ for (let i of e.data ?? [])
9847
+ typeof i.message?.content == 'string'
9848
+ ? t.push({ type: 'text', text: i.message.content })
9849
+ : i.url && t.push({ type: ea(i.url), url: i.url, ...(i.layer ? { layer: i.layer } : {}) });
9794
9850
  return t;
9795
9851
  }
9796
9852
  var M = class {
9797
- constructor(t, a) {
9798
- ((this.apiKey = t), (this.baseUrl = a.replace(/\/+$/, '')));
9853
+ constructor(t, i) {
9854
+ ((this.apiKey = t), (this.baseUrl = i.replace(/\/+$/, '')));
9799
9855
  }
9800
9856
  getHeaders() {
9801
9857
  return {
@@ -9805,58 +9861,58 @@ var M = class {
9805
9861
  'X-Tein-Client': 'cli',
9806
9862
  };
9807
9863
  }
9808
- async send(t, a, i) {
9809
- let n = await fetch(`${this.baseUrl}${a}`, {
9864
+ async send(t, i, a) {
9865
+ let n = await fetch(`${this.baseUrl}${i}`, {
9810
9866
  method: t,
9811
9867
  headers: this.getHeaders(),
9812
- ...(i === void 0 ? {} : { body: JSON.stringify(i) }),
9868
+ ...(a === void 0 ? {} : { body: JSON.stringify(a) }),
9813
9869
  });
9814
9870
  if (!n.ok) {
9815
9871
  let s = null;
9816
9872
  try {
9817
9873
  s = await n.json();
9818
9874
  } catch {}
9819
- throw Qa(n.status, n.statusText, s);
9875
+ throw Zi(n.status, n.statusText, s);
9820
9876
  }
9821
9877
  return await n.json();
9822
9878
  }
9823
9879
  async checkKey() {
9824
9880
  await this.send('GET', '/v1/jobs?limit=1');
9825
9881
  }
9826
- queueJob(t, a) {
9827
- return this.send('POST', '/v1/generate', { model: t, ...a }).then((i) => {
9828
- let n = i.status,
9882
+ queueJob(t, i) {
9883
+ return this.send('POST', '/v1/generate', { model: t, ...i }).then((a) => {
9884
+ let n = a.status,
9829
9885
  s =
9830
9886
  n === 'succeeded' || n === 'failed' || n === 'expired' || n === 'cancelled'
9831
9887
  ? n
9832
9888
  : 'processing',
9833
- o = ut(i);
9889
+ o = ut(a);
9834
9890
  return {
9835
- request_id: i.request_id || i.id || '',
9836
- model: i.model,
9891
+ request_id: a.request_id || a.id || '',
9892
+ model: a.model,
9837
9893
  status: s,
9838
9894
  ...(o.length ? { output: o } : {}),
9839
- error: i.error && typeof i.error.message == 'string' ? i.error.message : null,
9840
- ...(i.usage ? { usage: i.usage } : {}),
9895
+ error: a.error && typeof a.error.message == 'string' ? a.error.message : null,
9896
+ ...(a.usage ? { usage: a.usage } : {}),
9841
9897
  };
9842
9898
  });
9843
9899
  }
9844
9900
  getStatus(t) {
9845
- return this.send('GET', `/v1/jobs/${encodeURIComponent(t)}`).then((a) => {
9846
- let i = a.status,
9901
+ return this.send('GET', `/v1/jobs/${encodeURIComponent(t)}`).then((i) => {
9902
+ let a = i.status,
9847
9903
  n =
9848
- i === 'succeeded' || i === 'failed' || i === 'expired' || i === 'cancelled'
9849
- ? i
9904
+ a === 'succeeded' || a === 'failed' || a === 'expired' || a === 'cancelled'
9905
+ ? a
9850
9906
  : 'processing',
9851
- s = ut(a),
9852
- o = a.error && typeof a.error.message == 'string' ? a.error.message : null;
9907
+ s = ut(i),
9908
+ o = i.error && typeof i.error.message == 'string' ? i.error.message : null;
9853
9909
  return {
9854
- request_id: a.id || t,
9855
- model: a.model,
9910
+ request_id: i.id || t,
9911
+ model: i.model,
9856
9912
  status: n,
9857
9913
  ...(s.length ? { output: s } : {}),
9858
9914
  error: o,
9859
- ...(a.usage ? { usage: a.usage } : {}),
9915
+ ...(i.usage ? { usage: i.usage } : {}),
9860
9916
  };
9861
9917
  });
9862
9918
  }
@@ -9864,78 +9920,78 @@ var M = class {
9864
9920
  return this.send('GET', '/v1/balance');
9865
9921
  }
9866
9922
  getUsage(t) {
9867
- let a = new URLSearchParams(t).toString();
9868
- return this.send('GET', `/v1/usage${a ? `?${a}` : ''}`);
9923
+ let i = new URLSearchParams(t).toString();
9924
+ return this.send('GET', `/v1/usage${i ? `?${i}` : ''}`);
9869
9925
  }
9870
9926
  getTransactions(t) {
9871
- let a = new URLSearchParams(t).toString();
9872
- return this.send('GET', `/v1/balance/transactions${a ? `?${a}` : ''}`);
9927
+ let i = new URLSearchParams(t).toString();
9928
+ return this.send('GET', `/v1/balance/transactions${i ? `?${i}` : ''}`);
9873
9929
  }
9874
9930
  uploadAsset(t) {
9875
9931
  return this.send('POST', '/v1/upload', { data: t });
9876
9932
  }
9877
- async downloadOutput(t, a) {
9878
- let i = await fetch(t);
9879
- if (!i.ok) throw new Error(`The file could not be downloaded (HTTP ${i.status})`);
9880
- let n = mt.default.dirname(a);
9933
+ async downloadOutput(t, i) {
9934
+ let a = await fetch(t);
9935
+ if (!a.ok) throw new Error(`The file could not be downloaded (HTTP ${a.status})`);
9936
+ let n = mt.default.dirname(i);
9881
9937
  ne.default.existsSync(n) || ne.default.mkdirSync(n, { recursive: !0 });
9882
- let s = ne.default.createWriteStream(a);
9883
- return (await (0, ft.pipeline)(i.body, s), a);
9938
+ let s = ne.default.createWriteStream(i);
9939
+ return (await (0, ft.pipeline)(a.body, s), i);
9884
9940
  }
9885
9941
  };
9886
- $();
9942
+ E();
9887
9943
  function Se(e) {
9888
9944
  if (typeof e != 'number' || !Number.isFinite(e)) return '';
9889
9945
  if (Math.abs(e) >= 1 || Math.abs(Number(e.toFixed(4)) - e) < 1e-12) return `$${e.toFixed(4)}`;
9890
9946
  let t = Math.max(0, 3 - Number(e.toExponential(3).split('e')[1])),
9891
- a = 10 ** t,
9892
- i = Math.round(Number((e * a).toFixed(6))) / a;
9893
- return i >= 1 ? `$${i.toFixed(4)}` : `$${i.toFixed(t).replace(/0+$/, '')}`;
9947
+ i = 10 ** t,
9948
+ a = Math.round(Number((e * i).toFixed(6))) / i;
9949
+ return a >= 1 ? `$${a.toFixed(4)}` : `$${a.toFixed(t).replace(/0+$/, '')}`;
9894
9950
  }
9895
9951
  ee();
9896
- var na = ['images', 'input_images', 'videos', 'audios'];
9897
- function Wi(e) {
9898
- for (let t of na) typeof e[t] == 'string' && (e[t] = [e[t]]);
9952
+ var si = ['images', 'input_images', 'videos', 'audios'];
9953
+ function Wa(e) {
9954
+ for (let t of si) typeof e[t] == 'string' && (e[t] = [e[t]]);
9899
9955
  }
9900
- function Yi(e) {
9956
+ function Ya(e) {
9901
9957
  if (e.startsWith('http://') || e.startsWith('https://')) return null;
9902
9958
  let t = q.default.resolve(e);
9903
9959
  return U.default.existsSync(t) && U.default.statSync(t).isFile() ? t : null;
9904
9960
  }
9905
- async function Xi(e, t) {
9906
- for (let a of na) {
9907
- if (!Array.isArray(e[a])) continue;
9908
- let i = [];
9909
- for (let n of e[a]) {
9961
+ async function Xa(e, t) {
9962
+ for (let i of si) {
9963
+ if (!Array.isArray(e[i])) continue;
9964
+ let a = [];
9965
+ for (let n of e[i]) {
9910
9966
  if (typeof n != 'string') continue;
9911
- let s = Yi(n);
9912
- i.push(s ? await t(s) : n);
9967
+ let s = Ya(n);
9968
+ a.push(s ? await t(s) : n);
9913
9969
  }
9914
- e[a] = i;
9970
+ e[i] = a;
9915
9971
  }
9916
9972
  }
9917
9973
  var te = { starter: 10, plus: 25, scale: 40, enterprise: 200 };
9918
- function Qi(e) {
9974
+ function Qa(e) {
9919
9975
  if (e.count === void 0 || e.count === !0) return 1;
9920
9976
  let t = typeof e.count == 'number' ? e.count : Number(e.count),
9921
- a = te.enterprise;
9977
+ i = te.enterprise;
9922
9978
  return (
9923
- (!Number.isInteger(t) || t < 1 || t > a) &&
9979
+ (!Number.isInteger(t) || t < 1 || t > i) &&
9924
9980
  (process.stderr
9925
- .write(`${r.red('Error:')} --count must be a whole number from 1 to ${a}. The API allows Starter ${te.starter}, Plus ${te.plus}, Scale ${te.scale}, Enterprise ${te.enterprise} at once, including polling.
9981
+ .write(`${r.red('Error:')} --count must be a whole number from 1 to ${i}. The API allows Starter ${te.starter}, Plus ${te.plus}, Scale ${te.scale}, Enterprise ${te.enterprise} at once, including polling.
9926
9982
  `),
9927
9983
  process.exit(1)),
9928
9984
  t
9929
9985
  );
9930
9986
  }
9931
- async function Zi(e, t, a, i, n) {
9987
+ async function Za(e, t, i, a, n) {
9932
9988
  n.isJson ||
9933
- process.stderr.write(`Starting ${i} ${t} jobs together...
9989
+ process.stderr.write(`Starting ${a} ${t} jobs together...
9934
9990
  `);
9935
9991
  let s = await Promise.all(
9936
- Array.from({ length: i }, async () => {
9992
+ Array.from({ length: a }, async () => {
9937
9993
  try {
9938
- return { job: await e.queueJob(t, a) };
9994
+ return { job: await e.queueJob(t, i) };
9939
9995
  } catch (l) {
9940
9996
  return { err: l };
9941
9997
  }
@@ -9954,27 +10010,27 @@ async function Zi(e, t, a, i, n) {
9954
10010
  );
9955
10011
  if (!n.isAsync) {
9956
10012
  let l = Date.now(),
9957
- c = o.filter((p) => p.status === 'processing' && p.request_id);
10013
+ c = o.filter((d) => d.status === 'processing' && d.request_id);
9958
10014
  for (; c.length;) {
9959
- if ((await new Promise((d) => setTimeout(d, 2e3)), !n.isJson)) {
9960
- let d = Math.round((Date.now() - l) / 1e3);
9961
- process.stderr.write(`Waiting on ${c.length} of ${i} (${d}s)...
10015
+ if ((await new Promise((p) => setTimeout(p, 2e3)), !n.isJson)) {
10016
+ let p = Math.round((Date.now() - l) / 1e3);
10017
+ process.stderr.write(`Waiting on ${c.length} of ${a} (${p}s)...
9962
10018
  `);
9963
10019
  }
9964
- let p = await Promise.all(
9965
- c.map(async (d) => {
10020
+ let d = await Promise.all(
10021
+ c.map(async (p) => {
9966
10022
  try {
9967
- return await e.getStatus(d.request_id);
10023
+ return await e.getStatus(p.request_id);
9968
10024
  } catch {
9969
- return d;
10025
+ return p;
9970
10026
  }
9971
10027
  }),
9972
10028
  );
9973
- for (let d of p) {
9974
- let m = o.findIndex((y) => y.request_id === d.request_id);
9975
- m >= 0 && (o[m] = d);
10029
+ for (let p of d) {
10030
+ let m = o.findIndex((y) => y.request_id === p.request_id);
10031
+ m >= 0 && (o[m] = p);
9976
10032
  }
9977
- c = o.filter((d) => d.status === 'processing' && d.request_id);
10033
+ c = o.filter((p) => p.status === 'processing' && p.request_id);
9978
10034
  }
9979
10035
  }
9980
10036
  if (n.isJson)
@@ -10003,15 +10059,15 @@ async function Zi(e, t, a, i, n) {
10003
10059
  o.some((l) => l.status === 'failed' || l.status === 'expired' || l.status === 'cancelled')) &&
10004
10060
  process.exit(v);
10005
10061
  }
10006
- function er(e, t, a) {
10007
- if (a <= 1) return e;
10008
- let i = q.default.extname(e);
10009
- return `${e.slice(0, e.length - i.length)}-${t + 1}${i}`;
10062
+ function er(e, t, i) {
10063
+ if (i <= 1) return e;
10064
+ let a = q.default.extname(e);
10065
+ return `${e.slice(0, e.length - a.length)}-${t + 1}${a}`;
10010
10066
  }
10011
- function sa(e) {
10067
+ function oi(e) {
10012
10068
  let t = {},
10013
- a = new Set(),
10014
- i = [];
10069
+ i = new Set(),
10070
+ a = [];
10015
10071
  for (let n = 0; n < e.length; n++) {
10016
10072
  let s = e[n];
10017
10073
  if (s.startsWith('--')) {
@@ -10029,7 +10085,7 @@ function sa(e) {
10029
10085
  ? (t[o.replace(/-/g, '_')] = Number(u))
10030
10086
  : (t[o.replace(/-/g, '_')] = u),
10031
10087
  n++);
10032
- } else ((t[o.replace(/-/g, '_')] = !0), a.add(o));
10088
+ } else ((t[o.replace(/-/g, '_')] = !0), i.add(o));
10033
10089
  } else if (s.startsWith('-') && s.length === 2) {
10034
10090
  let o = s[1],
10035
10091
  l =
@@ -10045,18 +10101,18 @@ function sa(e) {
10045
10101
  v: 'version',
10046
10102
  }[o] || o;
10047
10103
  o === 'j' || o === 'h' || o === 'v'
10048
- ? ((t[l] = !0), a.add(l))
10104
+ ? ((t[l] = !0), i.add(l))
10049
10105
  : n + 1 < e.length && !e[n + 1].startsWith('-')
10050
10106
  ? ((t[l] = e[n + 1]), n++)
10051
10107
  : (t[l] = !0);
10052
- } else i.push(s);
10108
+ } else a.push(s);
10053
10109
  }
10054
- return { command: i[0] || '', subcommand: i[1], modelSlug: i[1] || i[0], options: t, flags: a };
10110
+ return { command: a[0] || '', subcommand: a[1], modelSlug: a[1] || a[0], options: t, flags: i };
10055
10111
  }
10056
10112
  async function Qe(e, t) {
10057
- let a = S(typeof t.api_key == 'string' ? t.api_key : void 0),
10058
- i = w(typeof t.api_url == 'string' ? t.api_url : void 0);
10059
- (a ||
10113
+ let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
10114
+ a = w(typeof t.api_url == 'string' ? t.api_url : void 0);
10115
+ (i ||
10060
10116
  (process.stderr.write(`${r.red('Error:')} Authentication required.
10061
10117
  `),
10062
10118
  process.stderr
@@ -10075,7 +10131,7 @@ async function Qe(e, t) {
10075
10131
  s = !!t.json,
10076
10132
  o = !!(t.async || t.no_wait),
10077
10133
  u = typeof t.output == 'string' ? t.output : void 0,
10078
- l = Qi(t),
10134
+ l = Qa(t),
10079
10135
  c = { ...t };
10080
10136
  (delete c.json,
10081
10137
  delete c.async,
@@ -10084,14 +10140,14 @@ async function Qe(e, t) {
10084
10140
  delete c.api_key,
10085
10141
  delete c.api_url,
10086
10142
  delete c.count);
10087
- let p = ra(n, c);
10088
- (Wi(p),
10089
- typeof p.image == 'string' && !p.images && !we(n) && ((p.images = [p.image]), delete p.image),
10090
- p.image_url &&
10091
- !p.first_frame_image &&
10143
+ let d = ni(n, c);
10144
+ (Wa(d),
10145
+ typeof d.image == 'string' && !d.images && !we(n) && ((d.images = [d.image]), delete d.image),
10146
+ d.image_url &&
10147
+ !d.first_frame_image &&
10092
10148
  (e.startsWith('seedance') || e.startsWith('happy-horse')) &&
10093
- (p.first_frame_image = p.image_url));
10094
- let d = new M(a, i),
10149
+ (d.first_frame_image = d.image_url));
10150
+ let p = new M(i, a),
10095
10151
  m = [
10096
10152
  'image',
10097
10153
  'mask_image',
@@ -10104,16 +10160,16 @@ async function Qe(e, t) {
10104
10160
  'video_url',
10105
10161
  ];
10106
10162
  for (let k of m) {
10107
- let g = p[k];
10163
+ let g = d[k];
10108
10164
  if (typeof g == 'string' && !g.startsWith('http://') && !g.startsWith('https://')) {
10109
10165
  let P = q.default.resolve(g);
10110
10166
  if (U.default.existsSync(P) && U.default.statSync(P).isFile()) {
10111
- let I = new E(`Uploading local file ${q.default.basename(P)} to CDN...`);
10167
+ let I = new $(`Uploading local file ${q.default.basename(P)} to CDN...`);
10112
10168
  s || I.start();
10113
10169
  try {
10114
10170
  let N = U.default.readFileSync(P),
10115
- O = await d.uploadAsset(N.toString('base64'));
10116
- ((p[k] = O.url), s || I.succeed(`Uploaded ${q.default.basename(P)} to CDN`));
10171
+ O = await p.uploadAsset(N.toString('base64'));
10172
+ ((d[k] = O.url), s || I.succeed(`Uploaded ${q.default.basename(P)} to CDN`));
10117
10173
  } catch (N) {
10118
10174
  let O = N instanceof Error ? N.message : String(N);
10119
10175
  (s
@@ -10128,12 +10184,12 @@ async function Qe(e, t) {
10128
10184
  }
10129
10185
  }
10130
10186
  }
10131
- await Xi(p, async (k) => {
10132
- let g = new E(`Uploading local file ${q.default.basename(k)} to CDN...`);
10187
+ await Xa(d, async (k) => {
10188
+ let g = new $(`Uploading local file ${q.default.basename(k)} to CDN...`);
10133
10189
  s || g.start();
10134
10190
  try {
10135
10191
  let P = U.default.readFileSync(k),
10136
- I = await d.uploadAsset(P.toString('base64'));
10192
+ I = await p.uploadAsset(P.toString('base64'));
10137
10193
  return (s || g.succeed(`Uploaded ${q.default.basename(k)} to CDN`), I.url);
10138
10194
  } catch (P) {
10139
10195
  let I = P instanceof Error ? P.message : String(P);
@@ -10147,15 +10203,15 @@ async function Qe(e, t) {
10147
10203
  process.exit(1));
10148
10204
  }
10149
10205
  });
10150
- let y = new E(`Submitting task for ${r.bold(e)}...`);
10206
+ let y = new $(`Submitting task for ${r.bold(e)}...`);
10151
10207
  s || y.start();
10152
10208
  let f;
10153
10209
  try {
10154
10210
  if (l > 1) {
10155
- await Zi(d, e, p, l, { isJson: s, isAsync: o });
10211
+ await Za(p, e, d, l, { isJson: s, isAsync: o });
10156
10212
  return;
10157
10213
  }
10158
- f = await d.queueJob(e, p);
10214
+ f = await p.queueJob(e, d);
10159
10215
  } catch (k) {
10160
10216
  let g = k instanceof b ? k : null;
10161
10217
  (s
@@ -10197,7 +10253,7 @@ async function Qe(e, t) {
10197
10253
  (s || y.update(`Rendering ${r.bold(e)} (${k}s elapsed)... [ID: ${f.request_id}]`),
10198
10254
  await new Promise((g) => setTimeout(g, Pe)));
10199
10255
  try {
10200
- f = await d.getStatus(f.request_id);
10256
+ f = await p.getStatus(f.request_id);
10201
10257
  } catch (g) {
10202
10258
  g instanceof b &&
10203
10259
  g.exitCode !== v &&
@@ -10256,12 +10312,12 @@ ${r.bold('Outputs:')}
10256
10312
  u)
10257
10313
  ) {
10258
10314
  let O = er(u, g++, k),
10259
- pt = new E(`Downloading output to ${O}...`).start();
10315
+ dt = new $(`Downloading output to ${O}...`).start();
10260
10316
  try {
10261
- (await d.downloadOutput(I.url, q.default.resolve(process.cwd(), O)),
10262
- pt.succeed(`Saved to ${r.bold(O)}`));
10317
+ (await p.downloadOutput(I.url, q.default.resolve(process.cwd(), O)),
10318
+ dt.succeed(`Saved to ${r.bold(O)}`));
10263
10319
  } catch (Ie) {
10264
- pt.fail(`Failed to download: ${Ie instanceof Error ? Ie.message : Ie}`);
10320
+ dt.fail(`Failed to download: ${Ie instanceof Error ? Ie.message : Ie}`);
10265
10321
  }
10266
10322
  }
10267
10323
  } else
@@ -10274,8 +10330,8 @@ ${I.text}
10274
10330
  process.stdout.write(`
10275
10331
  `);
10276
10332
  }
10277
- var oa = T(require('node:readline'));
10278
- $();
10333
+ var li = T(require('node:readline'));
10334
+ E();
10279
10335
  async function tr(e) {
10280
10336
  try {
10281
10337
  return (await new M(e, w()).checkKey(), 'ok');
@@ -10287,48 +10343,48 @@ async function tr(e) {
10287
10343
  return 'unchecked';
10288
10344
  }
10289
10345
  }
10290
- function ar(e) {
10291
- let t = oa.default.createInterface({ input: process.stdin, output: process.stdout });
10292
- return new Promise((a) => {
10293
- t.question(e, (i) => {
10294
- (t.close(), a(i.trim()));
10346
+ function ir(e) {
10347
+ let t = li.default.createInterface({ input: process.stdin, output: process.stdout });
10348
+ return new Promise((i) => {
10349
+ t.question(e, (a) => {
10350
+ (t.close(), i(a.trim()));
10295
10351
  });
10296
10352
  });
10297
10353
  }
10298
- async function ae(e, t) {
10354
+ async function ie(e, t) {
10299
10355
  switch (e) {
10300
10356
  case 'login':
10301
10357
  case 'set-key': {
10302
- let a = t?.trim() || '';
10303
- (a ||
10358
+ let i = t?.trim() || '';
10359
+ (i ||
10304
10360
  (process.stdout.write(`
10305
10361
  ${r.bold('Tein AI Authentication')}
10306
10362
  `),
10307
10363
  process.stdout.write(`Get your API key at: ${r.cyan('https://tein.ai/dashboard/keys')}
10308
10364
 
10309
10365
  `),
10310
- (a = await ar('Enter your Tein API Key (sk_live_...): '))),
10311
- !a.startsWith('sk_live_') &&
10312
- !a.startsWith('sk_test_') &&
10366
+ (i = await ir('Enter your Tein API Key (sk_live_...): '))),
10367
+ !i.startsWith('sk_live_') &&
10368
+ !i.startsWith('sk_test_') &&
10313
10369
  (process.stderr
10314
10370
  .write(`${r.red('Error:')} Invalid key format. Tein API keys start with 'sk_live_' or 'sk_test_'.
10315
10371
  `),
10316
10372
  process.exit(1)));
10317
- let i = await tr(a);
10318
- (i === 'invalid' &&
10373
+ let a = await tr(i);
10374
+ (a === 'invalid' &&
10319
10375
  (process.stderr
10320
10376
  .write(`${r.red('Error:')} Tein did not accept this key. Copy it again from ${r.cyan('https://tein.ai/dashboard/keys')}. Nothing was saved.
10321
10377
  `),
10322
10378
  process.exit(1)),
10323
- Ke({ apiKey: a }),
10379
+ Ke({ apiKey: i }),
10324
10380
  process.stdout.write(`
10325
10381
  ${r.green('\u2713')} API key saved to ${r.dim(oe())}
10326
10382
  `),
10327
- i === 'blocked'
10383
+ a === 'blocked'
10328
10384
  ? process.stdout
10329
10385
  .write(`${r.yellow('\u2139')} The key is valid, but this account cannot run requests right now. Check your dashboard.
10330
10386
  `)
10331
- : i === 'unchecked' &&
10387
+ : a === 'unchecked' &&
10332
10388
  process.stdout
10333
10389
  .write(`${r.yellow('\u2139')} Could not reach Tein to check the key. It is saved; run ${r.cyan('tein auth set-key')} again once you are online to check it.
10334
10390
  `),
@@ -10352,8 +10408,8 @@ ${r.green('\u2713')} API key saved to ${r.dim(oe())}
10352
10408
  break;
10353
10409
  }
10354
10410
  default: {
10355
- let a = S(),
10356
- i = w(),
10411
+ let i = S(),
10412
+ a = w(),
10357
10413
  n = j();
10358
10414
  if (
10359
10415
  (process.stdout.write(`
@@ -10361,9 +10417,9 @@ ${r.bold('Tein AI CLI Configuration')}
10361
10417
  `),
10362
10418
  process.stdout.write(` Config file: ${r.dim(oe())}
10363
10419
  `),
10364
- process.stdout.write(` API URL: ${r.cyan(i)}
10420
+ process.stdout.write(` API URL: ${r.cyan(a)}
10365
10421
  `),
10366
- !a)
10422
+ !i)
10367
10423
  )
10368
10424
  (process.stdout.write(` API Key: ${r.red('Not configured')}
10369
10425
 
@@ -10373,9 +10429,9 @@ ${r.bold('Tein AI CLI Configuration')}
10373
10429
 
10374
10430
  `));
10375
10431
  else {
10376
- let s = `${a.slice(0, 10)}...${a.slice(-4)}`;
10432
+ let s = `${i.slice(0, 10)}...${i.slice(-4)}`;
10377
10433
  process.stdout
10378
- .write(` API Key: ${r.green(s)} (${a.startsWith('sk_live_') ? 'Live Key' : 'Test Key'})
10434
+ .write(` API Key: ${r.green(s)} (${i.startsWith('sk_live_') ? 'Live Key' : 'Test Key'})
10379
10435
 
10380
10436
  `);
10381
10437
  }
@@ -10383,16 +10439,16 @@ ${r.bold('Tein AI CLI Configuration')}
10383
10439
  }
10384
10440
  }
10385
10441
  }
10386
- $();
10442
+ E();
10387
10443
  function _(e) {
10388
10444
  return e !== 0 && Math.abs(e) < 0.01
10389
10445
  ? `$${e.toFixed(6).replace(/0+$/, '').replace(/\.$/, '')}`
10390
10446
  : `$${e.toFixed(2)}`;
10391
10447
  }
10392
- function la(e) {
10448
+ function di(e) {
10393
10449
  return `${e} ${e === 1 ? 'request' : 'requests'}`;
10394
10450
  }
10395
- function ir(e) {
10451
+ function ar(e) {
10396
10452
  let t = [
10397
10453
  ['Balance', _(e.balance)],
10398
10454
  ['Available to this key', _(e.available)],
@@ -10405,15 +10461,15 @@ function ir(e) {
10405
10461
  : '';
10406
10462
  t.push(['Credits from Tein', `${_(e.credits_from_tein.amount)}${n}`]);
10407
10463
  }
10408
- let a = e.key.spending_limit;
10409
- (a &&
10464
+ let i = e.key.spending_limit;
10465
+ (i &&
10410
10466
  t.push([
10411
- `Key limit (${a.period})`,
10412
- `${_(a.remaining)} left of ${_(a.amount)}${a.resets_at ? `, resets ${a.resets_at.slice(0, 10)}` : ''}`,
10467
+ `Key limit (${i.period})`,
10468
+ `${_(i.remaining)} left of ${_(i.amount)}${i.resets_at ? `, resets ${i.resets_at.slice(0, 10)}` : ''}`,
10413
10469
  ]),
10414
10470
  t.push(
10415
- ['This month', `${_(e.usage.this_month.spend)} on ${la(e.usage.this_month.requests)}`],
10416
- ['Last 30 days', `${_(e.usage.last_30_days.spend)} on ${la(e.usage.last_30_days.requests)}`],
10471
+ ['This month', `${_(e.usage.this_month.spend)} on ${di(e.usage.this_month.requests)}`],
10472
+ ['Last 30 days', `${_(e.usage.last_30_days.spend)} on ${di(e.usage.last_30_days.requests)}`],
10417
10473
  [
10418
10474
  'Auto top up',
10419
10475
  e.auto_top_up.enabled
@@ -10423,13 +10479,13 @@ function ir(e) {
10423
10479
  ['Workspace', `${e.workspace.name} (${e.workspace.plan.name})`],
10424
10480
  ['Key', `${e.key.name} (${e.key.env})`],
10425
10481
  ));
10426
- let i = Math.max(...t.map(([n]) => n.length));
10427
- return t.map(([n, s]) => ` ${n.padEnd(i)} ${s}`);
10482
+ let a = Math.max(...t.map(([n]) => n.length));
10483
+ return t.map(([n, s]) => ` ${n.padEnd(a)} ${s}`);
10428
10484
  }
10429
- async function pa(e) {
10485
+ async function pi(e) {
10430
10486
  let t = S(typeof e.api_key == 'string' ? e.api_key : void 0),
10431
- a = w(typeof e.api_url == 'string' ? e.api_url : void 0),
10432
- i = !!e.json;
10487
+ i = w(typeof e.api_url == 'string' ? e.api_url : void 0),
10488
+ a = !!e.json;
10433
10489
  t ||
10434
10490
  (process.stderr.write(`${r.red('Error:')} Authentication required.
10435
10491
  `),
@@ -10439,10 +10495,10 @@ async function pa(e) {
10439
10495
  process.exit(1));
10440
10496
  let n;
10441
10497
  try {
10442
- n = await new M(t, a).getBalance();
10498
+ n = await new M(t, i).getBalance();
10443
10499
  } catch (s) {
10444
10500
  (s instanceof b &&
10445
- (i
10501
+ (a
10446
10502
  ? process.stdout.write(
10447
10503
  JSON.stringify(
10448
10504
  { error: { code: s.code ?? null, message: s.message, ...s.fields } },
@@ -10460,7 +10516,7 @@ async function pa(e) {
10460
10516
  `),
10461
10517
  process.exit(v));
10462
10518
  }
10463
- if (i) {
10519
+ if (a) {
10464
10520
  process.stdout.write(
10465
10521
  JSON.stringify(n, null, 2) +
10466
10522
  `
@@ -10470,15 +10526,15 @@ async function pa(e) {
10470
10526
  }
10471
10527
  process.stdout.write(`
10472
10528
  ${r.bold('Tein balance')}
10473
- ${ir(n).join(`
10529
+ ${ar(n).join(`
10474
10530
  `)}
10475
10531
 
10476
10532
  `);
10477
10533
  }
10478
- $();
10479
- function da(e) {
10534
+ E();
10535
+ function ci(e) {
10480
10536
  let t = S(typeof e.api_key == 'string' ? e.api_key : void 0),
10481
- a = w(typeof e.api_url == 'string' ? e.api_url : void 0);
10537
+ i = w(typeof e.api_url == 'string' ? e.api_url : void 0);
10482
10538
  return (
10483
10539
  t ||
10484
10540
  (process.stderr.write(`${r.red('Error:')} Authentication required.
@@ -10487,55 +10543,55 @@ function da(e) {
10487
10543
  .write(`Please run ${r.cyan('tein auth login')} or set ${r.cyan('TEIN_API_KEY')} environment variable.
10488
10544
  `),
10489
10545
  process.exit(1)),
10490
- new M(t, a)
10546
+ new M(t, i)
10491
10547
  );
10492
10548
  }
10493
- function ca(e, t) {
10494
- let a = {};
10495
- for (let i of t) {
10496
- let n = e[i];
10497
- (typeof n == 'string' || typeof n == 'number') && (a[i] = String(n));
10549
+ function ui(e, t) {
10550
+ let i = {};
10551
+ for (let a of t) {
10552
+ let n = e[a];
10553
+ (typeof n == 'string' || typeof n == 'number') && (i[a] = String(n));
10498
10554
  }
10499
- return a;
10555
+ return i;
10500
10556
  }
10501
- async function ua(e, t) {
10557
+ async function mi(e, t) {
10502
10558
  try {
10503
10559
  return await t();
10504
- } catch (a) {
10505
- (a instanceof b &&
10560
+ } catch (i) {
10561
+ (i instanceof b &&
10506
10562
  (e
10507
10563
  ? process.stdout.write(
10508
10564
  JSON.stringify(
10509
- { error: { code: a.code ?? null, message: a.message, ...a.fields } },
10565
+ { error: { code: i.code ?? null, message: i.message, ...i.fields } },
10510
10566
  null,
10511
10567
  2,
10512
10568
  ) +
10513
10569
  `
10514
10570
  `,
10515
10571
  )
10516
- : process.stderr.write(`${r.red('Error:')} ${K(a).join(`
10572
+ : process.stderr.write(`${r.red('Error:')} ${K(i).join(`
10517
10573
  `)}
10518
10574
  `),
10519
- process.exit(a.exitCode)),
10520
- process.stderr.write(`${r.red('Error:')} ${a instanceof Error ? a.message : String(a)}
10575
+ process.exit(i.exitCode)),
10576
+ process.stderr.write(`${r.red('Error:')} ${i instanceof Error ? i.message : String(i)}
10521
10577
  `),
10522
10578
  process.exit(v));
10523
10579
  }
10524
10580
  }
10525
10581
  function Ze(e) {
10526
- let t = e[0].map((i, n) => Math.max(...e.map((s) => s[n].length))),
10527
- a = (i) => e.slice(1).every((n) => /^[-+$\d]/.test(n[i]));
10582
+ let t = e[0].map((a, n) => Math.max(...e.map((s) => s[n].length))),
10583
+ i = (a) => e.slice(1).every((n) => /^[-+$\d]/.test(n[a]));
10528
10584
  return e.map(
10529
- (i) =>
10530
- ` ${i
10531
- .map((n, s) => (s > 0 && a(s) ? n.padStart(t[s]) : n.padEnd(t[s])))
10585
+ (a) =>
10586
+ ` ${a
10587
+ .map((n, s) => (s > 0 && i(s) ? n.padStart(t[s]) : n.padEnd(t[s])))
10532
10588
  .join(' ')
10533
10589
  .trimEnd()}`,
10534
10590
  );
10535
10591
  }
10536
10592
  function rr(e) {
10537
10593
  let t = e.summary,
10538
- a = [
10594
+ i = [
10539
10595
  ` Window ${e.from.slice(0, 10)} to ${e.to.slice(0, 10)} (${e.range})${e.filters.model ? `, model ${e.filters.model}` : ''}${e.filters.channel ? `, channel ${e.filters.channel}` : ''}`,
10540
10596
  ` Spent ${_(t.spend)} on ${t.requests} requests (${t.succeeded} succeeded, ${t.failed} failed${t.running ? `, ${t.running} running` : ''})`,
10541
10597
  ` Daily burn ${_(t.daily_burn)}`,
@@ -10543,31 +10599,31 @@ function rr(e) {
10543
10599
  ];
10544
10600
  return (
10545
10601
  e.by_channel.length &&
10546
- (a.push('', r.bold('By channel')),
10547
- a.push(
10602
+ (i.push('', r.bold('By channel')),
10603
+ i.push(
10548
10604
  ...Ze([
10549
10605
  ['Channel', 'Spend', 'Requests'],
10550
- ...e.by_channel.map((i) => [i.channel, _(i.spend), String(i.requests)]),
10606
+ ...e.by_channel.map((a) => [a.channel, _(a.spend), String(a.requests)]),
10551
10607
  ]),
10552
10608
  )),
10553
10609
  e.by_model.length &&
10554
- (a.push('', r.bold('By model')),
10555
- a.push(
10610
+ (i.push('', r.bold('By model')),
10611
+ i.push(
10556
10612
  ...Ze([
10557
10613
  ['Model', 'Spend', 'Requests', 'Failed'],
10558
- ...e.by_model.map((i) => [i.name, _(i.spend), String(i.requests), String(i.failed)]),
10614
+ ...e.by_model.map((a) => [a.name, _(a.spend), String(a.requests), String(a.failed)]),
10559
10615
  ]),
10560
10616
  )),
10561
- a
10617
+ i
10562
10618
  );
10563
10619
  }
10564
- async function ma(e) {
10620
+ async function fi(e) {
10565
10621
  let t = !!e.json,
10566
- a = da(e),
10567
- i = await ua(t, () => a.getUsage(ca(e, ['range', 'from', 'to', 'model', 'channel'])));
10622
+ i = ci(e),
10623
+ a = await mi(t, () => i.getUsage(ui(e, ['range', 'from', 'to', 'model', 'channel'])));
10568
10624
  if (t) {
10569
10625
  process.stdout.write(
10570
- JSON.stringify(i, null, 2) +
10626
+ JSON.stringify(a, null, 2) +
10571
10627
  `
10572
10628
  `,
10573
10629
  );
@@ -10575,7 +10631,7 @@ async function ma(e) {
10575
10631
  }
10576
10632
  process.stdout.write(`
10577
10633
  ${r.bold('Tein usage')}
10578
- ${rr(i).join(`
10634
+ ${rr(a).join(`
10579
10635
  `)}
10580
10636
 
10581
10637
  `);
@@ -10593,82 +10649,82 @@ function nr(e) {
10593
10649
  ])
10594
10650
  : [' No transactions yet.'];
10595
10651
  }
10596
- async function fa(e) {
10652
+ async function gi(e) {
10597
10653
  let t = !!e.json,
10598
- a = da(e),
10599
- i = await ua(t, () => a.getTransactions(ca(e, ['limit', 'type', 'after'])));
10654
+ i = ci(e),
10655
+ a = await mi(t, () => i.getTransactions(ui(e, ['limit', 'type', 'after'])));
10600
10656
  if (t) {
10601
10657
  process.stdout.write(
10602
- JSON.stringify(i, null, 2) +
10658
+ JSON.stringify(a, null, 2) +
10603
10659
  `
10604
10660
  `,
10605
10661
  );
10606
10662
  return;
10607
10663
  }
10608
10664
  let n =
10609
- i.has_more && i.next_cursor
10665
+ a.has_more && a.next_cursor
10610
10666
  ? `
10611
- More: tein transactions --after ${i.next_cursor}`
10667
+ More: tein transactions --after ${a.next_cursor}`
10612
10668
  : '';
10613
10669
  process.stdout.write(`
10614
10670
  ${r.bold('Tein balance history')}
10615
- ${nr(i).join(`
10671
+ ${nr(a).join(`
10616
10672
  `)}${n}
10617
10673
 
10618
10674
  `);
10619
10675
  }
10620
- $();
10676
+ E();
10621
10677
  Ce();
10622
10678
  ee();
10623
10679
  var sr = 3e3;
10624
- async function ga(e) {
10680
+ async function hi(e) {
10625
10681
  try {
10626
10682
  let t = await fetch(`${w(e)}/v1/pricing`, { signal: AbortSignal.timeout(sr) });
10627
10683
  if (!t.ok) return;
10628
- let a = await t.json(),
10629
- i = {};
10630
- for (let n of a.configs ?? []) {
10684
+ let i = await t.json(),
10685
+ a = {};
10686
+ for (let n of i.configs ?? []) {
10631
10687
  let s = String(n.modelSlug ?? '');
10632
- J.has(s) && (i[s] ??= []).push(Number(n.starterPrice));
10688
+ J.has(s) && (a[s] ??= []).push(Number(n.starterPrice));
10633
10689
  }
10634
- Qt(i);
10690
+ Zt(a);
10635
10691
  } catch {}
10636
10692
  }
10637
10693
  var or = new Set(['video', 'image', 'text', 'audio', '3d']),
10638
10694
  lr = { llm: 'text', chat: 'text', reasoning: 'text' };
10639
- async function ha(e, t) {
10640
- await ga(t);
10641
- let a = D();
10695
+ async function yi(e, t) {
10696
+ await hi(t);
10697
+ let i = D();
10642
10698
  if (e) {
10643
10699
  let s = e.toLowerCase(),
10644
10700
  o = lr[s] ?? s;
10645
- a = or.has(o)
10646
- ? a.filter((u) => u.category.toLowerCase() === o)
10647
- : a.filter((u) => u.kind.toLowerCase().includes(s) || u.slug.toLowerCase().includes(s));
10701
+ i = or.has(o)
10702
+ ? i.filter((u) => u.category.toLowerCase() === o)
10703
+ : i.filter((u) => u.kind.toLowerCase().includes(s) || u.slug.toLowerCase().includes(s));
10648
10704
  }
10649
10705
  (process.stdout.write(`
10650
- ${r.bold('Tein AI Models Catalog')} (${a.length} available)
10706
+ ${r.bold('Tein AI Models Catalog')} (${i.length} available)
10651
10707
  `),
10652
10708
  process.stdout
10653
10709
  .write(`${r.dim('Run `tein info <model-slug>` to see detailed parameters and options.')}
10654
10710
 
10655
10711
  `));
10656
- let i = {};
10657
- for (let s of a) {
10712
+ let a = {};
10713
+ for (let s of i) {
10658
10714
  let o = s.category;
10659
- (i[o] || (i[o] = []), i[o].push(s));
10715
+ (a[o] || (a[o] = []), a[o].push(s));
10660
10716
  }
10661
10717
  let n = ['Video', 'Image', 'Text', 'Audio', '3D'];
10662
10718
  for (let s of n) {
10663
- let o = i[s];
10719
+ let o = a[s];
10664
10720
  if (!(!o || o.length === 0)) {
10665
10721
  process.stdout.write(`${r.bold(r.cyan(`\u2500\u2500 ${s} Models \u2500\u2500`))}
10666
10722
  `);
10667
10723
  for (let u of o) {
10668
10724
  let l = u.slug.padEnd(24),
10669
10725
  c = u.name.padEnd(22),
10670
- p = u.priceFormatted.padEnd(22);
10671
- process.stdout.write(` ${r.bold(l)} ${r.gray(c)} ${r.green(p)} ${r.dim(u.vendor)}
10726
+ d = u.priceFormatted.padEnd(22);
10727
+ process.stdout.write(` ${r.bold(l)} ${r.gray(c)} ${r.green(d)} ${r.dim(u.vendor)}
10672
10728
  `);
10673
10729
  }
10674
10730
  process.stdout.write(`
@@ -10680,55 +10736,55 @@ ${r.bold('Tein AI Models Catalog')} (${a.length} available)
10680
10736
 
10681
10737
  `);
10682
10738
  }
10683
- async function ya(e, t) {
10684
- J.has(e) && (await ga(t));
10685
- let a = H(e);
10686
- (a ||
10739
+ async function bi(e, t) {
10740
+ J.has(e) && (await hi(t));
10741
+ let i = H(e);
10742
+ (i ||
10687
10743
  (process.stderr.write(`${r.red('Error:')} Model "${e}" not found in Tein AI registry.
10688
10744
  `),
10689
10745
  process.stderr.write(`Run ${r.cyan('tein models')} to see all available model slugs.
10690
10746
  `),
10691
10747
  process.exit(1)),
10692
10748
  process.stdout.write(`
10693
- ${r.bold(r.cyan(a.name))} (${r.bold(a.slug)})
10749
+ ${r.bold(r.cyan(i.name))} (${r.bold(i.slug)})
10694
10750
  `),
10695
- process.stdout.write(` ${r.gray(a.description)}
10751
+ process.stdout.write(` ${r.gray(i.description)}
10696
10752
 
10697
10753
  `),
10698
10754
  process.stdout.write(`${r.bold('Metadata:')}
10699
10755
  `),
10700
- process.stdout.write(` Category: ${r.yellow(a.category)}
10756
+ process.stdout.write(` Category: ${r.yellow(i.category)}
10701
10757
  `),
10702
- process.stdout.write(` Kind: ${a.kind}
10758
+ process.stdout.write(` Kind: ${i.kind}
10703
10759
  `),
10704
- process.stdout.write(` Vendor: ${a.vendor}
10760
+ process.stdout.write(` Vendor: ${i.vendor}
10705
10761
  `),
10706
- process.stdout.write(` Pricing: ${r.green(a.priceFormatted)}
10762
+ process.stdout.write(` Pricing: ${r.green(i.priceFormatted)}
10707
10763
 
10708
10764
  `),
10709
10765
  process.stdout.write(`${r.bold('Parameters:')}
10710
10766
  `));
10711
- for (let i of a.parameters) {
10712
- let n = i.required ? r.red('(required)') : r.dim('(optional)'),
10713
- s = i.default !== void 0 ? r.dim(` [default: ${i.default}]`) : '';
10767
+ for (let a of i.parameters) {
10768
+ let n = a.required ? r.red('(required)') : r.dim('(optional)'),
10769
+ s = a.default !== void 0 ? r.dim(` [default: ${a.default}]`) : '';
10714
10770
  (process.stdout
10715
- .write(` ${r.bold(`--${i.name.replace(/_/g, '-')}`)} ${r.yellow(`<${i.type}>`)} ${n}${s}
10771
+ .write(` ${r.bold(`--${a.name.replace(/_/g, '-')}`)} ${r.yellow(`<${a.type}>`)} ${n}${s}
10716
10772
  `),
10717
- i.description &&
10718
- process.stdout.write(` ${r.gray(i.description)}
10773
+ a.description &&
10774
+ process.stdout.write(` ${r.gray(a.description)}
10719
10775
  `),
10720
- i.options &&
10721
- i.options.length > 0 &&
10722
- process.stdout.write(` Allowed values: ${r.dim(i.options.join(', '))}
10776
+ a.options &&
10777
+ a.options.length > 0 &&
10778
+ process.stdout.write(` Allowed values: ${r.dim(a.options.join(', '))}
10723
10779
  `),
10724
- (i.min !== void 0 || i.max !== void 0) &&
10725
- process.stdout.write(` Range: ${i.min ?? ''} to ${i.max ?? ''}
10780
+ (a.min !== void 0 || a.max !== void 0) &&
10781
+ process.stdout.write(` Range: ${a.min ?? ''} to ${a.max ?? ''}
10726
10782
  `),
10727
10783
  process.stdout.write(`
10728
10784
  `));
10729
10785
  }
10730
10786
  if (
10731
- (a.parameters.some((i) => i.name === 'callback_url') ||
10787
+ (i.parameters.some((a) => a.name === 'callback_url') ||
10732
10788
  (process.stdout
10733
10789
  .write(` ${r.bold('--callback-url')} ${r.yellow('<string>')} ${r.dim('(optional)')}
10734
10790
  `),
@@ -10738,33 +10794,33 @@ ${r.bold(r.cyan(a.name))} (${r.bold(a.slug)})
10738
10794
  `)),
10739
10795
  process.stdout.write(`${r.bold('Sample CLI Usage:')}
10740
10796
  `),
10741
- a.category === 'Video')
10797
+ i.category === 'Video')
10742
10798
  )
10743
10799
  process.stdout
10744
- .write(` ${r.cyan(`tein run ${a.slug} --prompt "Cinematic camera drone shot of a coastline" --aspect-ratio 16:9 --duration 5 -o output.mp4`)}
10800
+ .write(` ${r.cyan(`tein run ${i.slug} --prompt "Cinematic camera drone shot of a coastline" --aspect-ratio 16:9 --duration 5 -o output.mp4`)}
10745
10801
 
10746
10802
  `);
10747
- else if (a.category === 'Image') {
10748
- let i = a.parameters.some((n) => n.name === 'aspect_ratio') ? ' --aspect-ratio 16:9' : '';
10803
+ else if (i.category === 'Image') {
10804
+ let a = i.parameters.some((n) => n.name === 'aspect_ratio') ? ' --aspect-ratio 16:9' : '';
10749
10805
  process.stdout
10750
- .write(` ${r.cyan(`tein run ${a.slug} --prompt "Cyberpunk city in the rain, 8k render"${i} -o output.png`)}
10806
+ .write(` ${r.cyan(`tein run ${i.slug} --prompt "Cyberpunk city in the rain, 8k render"${a} -o output.png`)}
10751
10807
 
10752
10808
  `);
10753
10809
  } else
10754
- a.category === 'Audio'
10810
+ i.category === 'Audio'
10755
10811
  ? process.stdout
10756
- .write(` ${r.cyan(`tein run ${a.slug} --prompt "Hello world from Tein AI" --speaker en_female_warm -o speech.wav`)}
10812
+ .write(` ${r.cyan(`tein run ${i.slug} --prompt "Hello world from Tein AI" --speaker en_female_warm -o speech.wav`)}
10757
10813
 
10758
10814
  `)
10759
10815
  : process.stdout
10760
- .write(` ${r.cyan(`tein run ${a.slug} --prompt "Explain quantum computing in simple terms"`)}
10816
+ .write(` ${r.cyan(`tein run ${i.slug} --prompt "Explain quantum computing in simple terms"`)}
10761
10817
 
10762
10818
  `);
10763
10819
  }
10764
- $();
10820
+ E();
10765
10821
  et();
10766
- var pr = 1e4,
10767
- at = {
10822
+ var dr = 1e4,
10823
+ it = {
10768
10824
  price: '',
10769
10825
  creativeMode: 'Creative mode',
10770
10826
  priority: 'Priority',
@@ -10774,7 +10830,7 @@ var pr = 1e4,
10774
10830
  priorityDraft: 'Priority + Draft',
10775
10831
  creativeModePriorityDraft: 'Creative mode + Priority + Draft',
10776
10832
  },
10777
- dr = Object.keys(at),
10833
+ pr = Object.keys(it),
10778
10834
  cr = {
10779
10835
  creativeMode: 'unfiltered',
10780
10836
  creativeModePriority: 'unfilteredPriority',
@@ -10782,46 +10838,46 @@ var pr = 1e4,
10782
10838
  creativeModePriorityDraft: 'unfilteredPriorityDraft',
10783
10839
  };
10784
10840
  function ur(e, t) {
10785
- let a = cr[t];
10786
- return e[t] ?? (a ? e[a] : void 0);
10841
+ let i = cr[t];
10842
+ return e[t] ?? (i ? e[i] : void 0);
10787
10843
  }
10788
10844
  async function mr(e, t) {
10789
- let a = `${w(e)}${xe(t)}`,
10790
- i;
10845
+ let i = `${w(e)}${xe(t)}`,
10846
+ a;
10791
10847
  try {
10792
- i = await fetch(a, { signal: AbortSignal.timeout(pr) });
10848
+ a = await fetch(i, { signal: AbortSignal.timeout(dr) });
10793
10849
  } catch {
10794
- throw new Error(`Could not reach ${a}`);
10850
+ throw new Error(`Could not reach ${i}`);
10795
10851
  }
10796
- let n = await i.json().catch(() => null);
10797
- if (!i.ok || !n || n.object !== 'list' || !n.board) {
10852
+ let n = await a.json().catch(() => null);
10853
+ if (!a.ok || !n || n.object !== 'list' || !n.board) {
10798
10854
  let s =
10799
10855
  n && typeof n.error == 'string'
10800
10856
  ? n.error
10801
10857
  : n && typeof n.error == 'object' && n.error?.message
10802
10858
  ? n.error.message
10803
- : `Pricing request failed (${i.status})`;
10859
+ : `Pricing request failed (${a.status})`;
10804
10860
  throw new Error(s);
10805
10861
  }
10806
10862
  return n;
10807
10863
  }
10808
10864
  function tt(e) {
10809
10865
  let t = e.toFixed(4).replace(/0+$/, '').replace(/\.$/, ''),
10810
- [a, i = ''] = t.split('.');
10811
- return `$${a}.${i.padEnd(2, '0')}`;
10866
+ [i, a = ''] = t.split('.');
10867
+ return `$${i}.${a.padEnd(2, '0')}`;
10812
10868
  }
10813
- function it(e) {
10869
+ function at(e) {
10814
10870
  if (!e || typeof e.starter != 'number') return null;
10815
10871
  let t = typeof e.plus == 'number' ? e.plus : e.starter,
10816
- a = typeof e.scale == 'number' ? e.scale : t;
10817
- return `Starter ${tt(e.starter)} Plus ${tt(t)} Scale ${tt(a)}`;
10872
+ i = typeof e.scale == 'number' ? e.scale : t;
10873
+ return `Starter ${tt(e.starter)} Plus ${tt(t)} Scale ${tt(i)}`;
10818
10874
  }
10819
10875
  function fr(e) {
10820
10876
  if (typeof e.label == 'string' && e.label.trim()) return e.label.trim();
10821
10877
  let t = [];
10822
- for (let a of ['endpoint', 'resolution', 'quality', 'mode', 'task', 'component', 'token']) {
10823
- let i = e[a];
10824
- i != null && i !== '' && t.push(String(i));
10878
+ for (let i of ['endpoint', 'resolution', 'quality', 'mode', 'task', 'component', 'token']) {
10879
+ let a = e[i];
10880
+ a != null && a !== '' && t.push(String(a));
10825
10881
  }
10826
10882
  return (
10827
10883
  e.withVideo === !0 && t.push('with video'),
@@ -10829,54 +10885,54 @@ function fr(e) {
10829
10885
  );
10830
10886
  }
10831
10887
  function gr(e, t) {
10832
- let a = fr(e);
10833
- for (let i of dr) {
10834
- let n = it(ur(e, i));
10888
+ let i = fr(e);
10889
+ for (let a of pr) {
10890
+ let n = at(ur(e, a));
10835
10891
  if (!n) continue;
10836
- let s = at[i] ? ` (${at[i]})` : '';
10837
- t.push(` ${a}${s} ${n}`);
10892
+ let s = it[a] ? ` (${it[a]})` : '';
10893
+ t.push(` ${i}${s} ${n}`);
10838
10894
  }
10839
10895
  }
10840
10896
  function hr(e, t) {
10841
- let a = e.quality ? ` quality=${e.quality}` : '';
10897
+ let i = e.quality ? ` quality=${e.quality}` : '';
10842
10898
  t.push(
10843
- ` ${r.bold(e.slug.padEnd(26))} ${r.gray(e.name)} ${r.dim(`${e.kind} ${e.unit} model=${e.model}${a}`)}`,
10899
+ ` ${r.bold(e.slug.padEnd(26))} ${r.gray(e.name)} ${r.dim(`${e.kind} ${e.unit} model=${e.model}${i}`)}`,
10844
10900
  );
10845
10901
  for (let n of e.variants ?? []) gr(n, t);
10846
- let i = e.addons;
10847
- if (Array.isArray(i))
10848
- for (let n of i) {
10902
+ let a = e.addons;
10903
+ if (Array.isArray(a))
10904
+ for (let n of a) {
10849
10905
  if (!n || typeof n != 'object') continue;
10850
10906
  let s = n,
10851
10907
  o = typeof s.label == 'string' ? s.label : String(s.id ?? 'add-on'),
10852
- u = it(s.price);
10908
+ u = at(s.price);
10853
10909
  u && t.push(` ${o} (add-on) ${u}`);
10854
10910
  }
10855
10911
  t.push('');
10856
10912
  }
10857
10913
  function yr(e) {
10858
10914
  let t = [],
10859
- a = e.board.checked ? ` \xB7 checked ${e.board.checked}` : '';
10860
- (t.push(`${r.bold('Tein prices')} ${r.green(e.currency)} ${e.count} models${a}`),
10915
+ i = e.board.checked ? ` \xB7 checked ${e.board.checked}` : '';
10916
+ (t.push(`${r.bold('Tein prices')} ${r.green(e.currency)} ${e.count} models${i}`),
10861
10917
  t.push(
10862
10918
  `${r.dim('Starter, Plus and Scale. Creative mode, Priority and draft show only where published.')}`,
10863
10919
  ),
10864
10920
  t.push(''));
10865
- let i = new Map();
10921
+ let a = new Map();
10866
10922
  for (let l of e.board.models) {
10867
10923
  let c = l.kind || 'other',
10868
- p = i.get(c) ?? [];
10869
- (p.push(l), i.set(c, p));
10924
+ d = a.get(c) ?? [];
10925
+ (d.push(l), a.set(c, d));
10870
10926
  }
10871
10927
  let n = ['video', 'image', 'audio', 'llm', 'text', '3d'],
10872
- s = [...i.keys()].sort((l, c) => {
10873
- let p = n.indexOf(l),
10874
- d = n.indexOf(c);
10875
- return (p === -1 ? 99 : p) - (d === -1 ? 99 : d);
10928
+ s = [...a.keys()].sort((l, c) => {
10929
+ let d = n.indexOf(l),
10930
+ p = n.indexOf(c);
10931
+ return (d === -1 ? 99 : d) - (p === -1 ? 99 : p);
10876
10932
  });
10877
10933
  for (let l of s) {
10878
10934
  t.push(`${r.bold(r.cyan(`\u2500\u2500 ${l} \u2500\u2500`))}`);
10879
- for (let c of i.get(l) ?? []) hr(c, t);
10935
+ for (let c of a.get(l) ?? []) hr(c, t);
10880
10936
  }
10881
10937
  let o = new Set(e.board.models.map((l) => l.slug.toLowerCase())),
10882
10938
  u = (e.configs ?? []).filter((l) => !o.has(String(l.modelSlug ?? '').toLowerCase()));
@@ -10884,16 +10940,16 @@ function yr(e) {
10884
10940
  t.push(`${r.bold(r.cyan('\u2500\u2500 other prices \u2500\u2500'))}`);
10885
10941
  let l = new Map();
10886
10942
  for (let c of u) {
10887
- let p = String(c.modelSlug ?? ''),
10888
- d = l.get(p) ?? [];
10889
- (d.push(c), l.set(p, d));
10943
+ let d = String(c.modelSlug ?? ''),
10944
+ p = l.get(d) ?? [];
10945
+ (p.push(c), l.set(d, p));
10890
10946
  }
10891
- for (let [c, p] of l) {
10892
- let d = String(p[0]?.modelName ?? c);
10893
- t.push(` ${r.bold(c.padEnd(26))} ${r.gray(d)}`);
10894
- for (let m of p) {
10947
+ for (let [c, d] of l) {
10948
+ let p = String(d[0]?.modelName ?? c);
10949
+ t.push(` ${r.bold(c.padEnd(26))} ${r.gray(p)}`);
10950
+ for (let m of d) {
10895
10951
  let y = String(m.displayLabel ?? m.billingUnit ?? 'price'),
10896
- f = it(m.prices);
10952
+ f = at(m.prices);
10897
10953
  f && t.push(` ${y} ${f}`);
10898
10954
  }
10899
10955
  t.push('');
@@ -10906,13 +10962,13 @@ function yr(e) {
10906
10962
  `
10907
10963
  );
10908
10964
  }
10909
- async function ba(e) {
10965
+ async function ki(e) {
10910
10966
  let t;
10911
10967
  try {
10912
10968
  t = await mr(e.apiUrl, e.model);
10913
- } catch (a) {
10914
- let i = a instanceof Error ? a.message : String(a);
10915
- (process.stderr.write(`${r.red('Error:')} ${i}
10969
+ } catch (i) {
10970
+ let a = i instanceof Error ? i.message : String(i);
10971
+ (process.stderr.write(`${r.red('Error:')} ${a}
10916
10972
  `),
10917
10973
  process.exit(1));
10918
10974
  }
@@ -10923,12 +10979,12 @@ async function ba(e) {
10923
10979
  : yr(t),
10924
10980
  );
10925
10981
  }
10926
- var ka = T(require('node:path'));
10927
- $();
10928
- async function wa(e, t) {
10929
- let a = S(typeof t.api_key == 'string' ? t.api_key : void 0),
10930
- i = w(typeof t.api_url == 'string' ? t.api_url : void 0);
10931
- (a ||
10982
+ var wi = T(require('node:path'));
10983
+ E();
10984
+ async function xi(e, t) {
10985
+ let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
10986
+ a = w(typeof t.api_url == 'string' ? t.api_url : void 0);
10987
+ (i ||
10932
10988
  (process.stderr.write(`${r.red('Error:')} Authentication required.
10933
10989
  `),
10934
10990
  process.stderr
@@ -10944,18 +11000,18 @@ async function wa(e, t) {
10944
11000
  let n = !!t.json,
10945
11001
  s = !!t.wait,
10946
11002
  o = typeof t.output == 'string' ? t.output : void 0,
10947
- u = new M(a, i),
10948
- l = new E(`Checking status of ${r.bold(e)}...`);
11003
+ u = new M(i, a),
11004
+ l = new $(`Checking status of ${r.bold(e)}...`);
10949
11005
  n || l.start();
10950
11006
  let c;
10951
11007
  try {
10952
11008
  c = await u.getStatus(e);
10953
- } catch (p) {
10954
- (p instanceof b &&
11009
+ } catch (d) {
11010
+ (d instanceof b &&
10955
11011
  (n
10956
11012
  ? process.stdout.write(
10957
11013
  JSON.stringify(
10958
- { error: { code: p.code ?? null, message: p.message, ...p.fields } },
11014
+ { error: { code: d.code ?? null, message: d.message, ...d.fields } },
10959
11015
  null,
10960
11016
  2,
10961
11017
  ) +
@@ -10963,18 +11019,18 @@ async function wa(e, t) {
10963
11019
  `,
10964
11020
  )
10965
11021
  : l.fail(
10966
- K(p).join(`
11022
+ K(d).join(`
10967
11023
  `),
10968
11024
  ),
10969
- process.exit(p.exitCode)),
10970
- n || l.fail(p instanceof Error ? p.message : String(p)),
11025
+ process.exit(d.exitCode)),
11026
+ n || l.fail(d instanceof Error ? d.message : String(d)),
10971
11027
  process.exit(v));
10972
11028
  }
10973
11029
  if (s && c.status === 'processing') {
10974
- let p = Date.now();
11030
+ let d = Date.now();
10975
11031
  for (; c.status === 'processing';) {
10976
- let d = Math.round((Date.now() - p) / 1e3);
10977
- (n || l.update(`Waiting for ${r.bold(c.model)} (${d}s elapsed)...`),
11032
+ let p = Math.round((Date.now() - d) / 1e3);
11033
+ (n || l.update(`Waiting for ${r.bold(c.model)} (${p}s elapsed)...`),
10978
11034
  await new Promise((m) => setTimeout(m, 1500)));
10979
11035
  try {
10980
11036
  c = await u.getStatus(e);
@@ -11011,25 +11067,25 @@ async function wa(e, t) {
11011
11067
  process.stdout.write(`
11012
11068
  ${r.bold('Outputs:')}
11013
11069
  `);
11014
- for (let p of c.output)
11015
- if (p.url) {
11070
+ for (let d of c.output)
11071
+ if (d.url) {
11016
11072
  if (
11017
- (process.stdout.write(` [${p.type.toUpperCase()}] ${r.cyan(r.underline(p.url))}
11073
+ (process.stdout.write(` [${d.type.toUpperCase()}] ${r.cyan(r.underline(d.url))}
11018
11074
  `),
11019
11075
  o)
11020
11076
  ) {
11021
- let d = new E(`Downloading output to ${o}...`).start();
11077
+ let p = new $(`Downloading output to ${o}...`).start();
11022
11078
  try {
11023
- (await u.downloadOutput(p.url, ka.default.resolve(process.cwd(), o)),
11024
- d.succeed(`Saved to ${r.bold(o)}`));
11079
+ (await u.downloadOutput(d.url, wi.default.resolve(process.cwd(), o)),
11080
+ p.succeed(`Saved to ${r.bold(o)}`));
11025
11081
  } catch (m) {
11026
- d.fail(`Failed to download: ${m instanceof Error ? m.message : m}`);
11082
+ p.fail(`Failed to download: ${m instanceof Error ? m.message : m}`);
11027
11083
  }
11028
11084
  }
11029
11085
  } else
11030
- p.text &&
11086
+ d.text &&
11031
11087
  process.stdout.write(`
11032
- ${p.text}
11088
+ ${d.text}
11033
11089
  `);
11034
11090
  }
11035
11091
  process.stdout.write(`
@@ -11037,12 +11093,12 @@ ${p.text}
11037
11093
  }
11038
11094
  var rt = T(require('node:fs')),
11039
11095
  nt = T(require('node:path'));
11040
- $();
11041
- async function xa(e, t = {}) {
11042
- let a = S(typeof t.api_key == 'string' ? t.api_key : void 0),
11043
- i = w(typeof t.api_url == 'string' ? t.api_url : void 0),
11096
+ E();
11097
+ async function _i(e, t = {}) {
11098
+ let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
11099
+ a = w(typeof t.api_url == 'string' ? t.api_url : void 0),
11044
11100
  n = !!t.json;
11045
- (a ||
11101
+ (i ||
11046
11102
  (process.stderr.write(`${r.red('Error:')} Authentication required.
11047
11103
  `),
11048
11104
  process.stderr
@@ -11062,50 +11118,50 @@ async function xa(e, t = {}) {
11062
11118
  process.exit(1));
11063
11119
  let o = nt.default.basename(s),
11064
11120
  l = rt.default.readFileSync(s).toString('base64'),
11065
- c = new M(a, i),
11066
- p = new E(`Uploading ${r.bold(o)} to Tein AI CDN...`);
11067
- n || p.start();
11121
+ c = new M(i, a),
11122
+ d = new $(`Uploading ${r.bold(o)} to Tein AI CDN...`);
11123
+ n || d.start();
11068
11124
  try {
11069
- let d = await c.uploadAsset(l);
11125
+ let p = await c.uploadAsset(l);
11070
11126
  n
11071
11127
  ? process.stdout.write(
11072
- JSON.stringify(d, null, 2) +
11128
+ JSON.stringify(p, null, 2) +
11073
11129
  `
11074
11130
  `,
11075
11131
  )
11076
- : (p.succeed('Upload successful!'),
11132
+ : (d.succeed('Upload successful!'),
11077
11133
  process.stdout.write(`
11078
- ${r.bold('CDN URL:')} ${r.green(d.url)}
11134
+ ${r.bold('CDN URL:')} ${r.green(p.url)}
11079
11135
  `),
11080
- process.stdout.write(`${r.dim(`Key: ${d.key}`)}
11136
+ process.stdout.write(`${r.dim(`Key: ${p.key}`)}
11081
11137
 
11082
11138
  `),
11083
11139
  process.stdout.write(`Use this CDN URL directly in your CLI runs:
11084
- ${r.cyan(`tein run seedance-2-5 --prompt "Animate this scene" --image "${d.url}"`)}
11140
+ ${r.cyan(`tein run seedance-2-5 --prompt "Animate this scene" --image "${p.url}"`)}
11085
11141
 
11086
11142
  `));
11087
- } catch (d) {
11088
- let m = d instanceof b ? d : null,
11143
+ } catch (p) {
11144
+ let m = p instanceof b ? p : null,
11089
11145
  y = m
11090
11146
  ? K(m).join(`
11091
11147
  `)
11092
- : d instanceof Error
11093
- ? d.message
11094
- : String(d);
11148
+ : p instanceof Error
11149
+ ? p.message
11150
+ : String(p);
11095
11151
  (n
11096
11152
  ? process.stdout.write(
11097
11153
  JSON.stringify({ error: { code: m?.code ?? null, message: m?.message ?? y } }, null, 2) +
11098
11154
  `
11099
11155
  `,
11100
11156
  )
11101
- : p.fail(`Upload failed: ${y}`),
11157
+ : d.fail(`Upload failed: ${y}`),
11102
11158
  process.exit(m ? m.exitCode : v));
11103
11159
  }
11104
11160
  }
11105
11161
  re();
11106
11162
  ee();
11107
11163
  Le();
11108
- function Da() {
11164
+ function Vi() {
11109
11165
  process.stdout.write(`
11110
11166
  ${r.bold(r.cyan('Tein AI CLI'))} - Official Command-Line Interface for Tein AI models
11111
11167
 
@@ -11189,9 +11245,9 @@ ${r.bold('EXAMPLES:')}
11189
11245
  }
11190
11246
  async function Dr() {
11191
11247
  let e = process.argv.slice(2),
11192
- t = sa(e);
11248
+ t = oi(e);
11193
11249
  if (t.flags.has('help') || t.options.help || t.command === 'help') {
11194
- Da();
11250
+ Vi();
11195
11251
  return;
11196
11252
  }
11197
11253
  if (t.flags.has('version') || t.options.version || t.command === 'version') {
@@ -11201,32 +11257,32 @@ async function Dr() {
11201
11257
  }
11202
11258
  switch (t.command) {
11203
11259
  case 'auth': {
11204
- await ae(t.subcommand, t.options.key);
11260
+ await ie(t.subcommand, t.options.key);
11205
11261
  break;
11206
11262
  }
11207
11263
  case 'login': {
11208
- await ae('login', t.options.key);
11264
+ await ie('login', t.options.key);
11209
11265
  break;
11210
11266
  }
11211
11267
  case 'logout': {
11212
- await ae('logout');
11268
+ await ie('logout');
11213
11269
  break;
11214
11270
  }
11215
11271
  case 'whoami': {
11216
- await ae('status');
11272
+ await ie('status');
11217
11273
  break;
11218
11274
  }
11219
11275
  case 'models':
11220
11276
  case 'list': {
11221
- await ha(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0);
11277
+ await yi(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0);
11222
11278
  break;
11223
11279
  }
11224
11280
  case 'pricing':
11225
11281
  case 'prices': {
11226
- let a = t.options.model,
11227
- i = t.subcommand || (typeof a == 'string' ? a : void 0);
11228
- await ba({
11229
- model: i,
11282
+ let i = t.options.model,
11283
+ a = t.subcommand || (typeof i == 'string' ? i : void 0);
11284
+ await ki({
11285
+ model: a,
11230
11286
  json: !!t.options.json,
11231
11287
  apiUrl: typeof t.options.api_url == 'string' ? t.options.api_url : void 0,
11232
11288
  });
@@ -11240,41 +11296,41 @@ async function Dr() {
11240
11296
  process.stderr.write(`Usage: ${r.cyan('tein info <model-slug>')}
11241
11297
  `),
11242
11298
  process.exit(1)),
11243
- await ya(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0));
11299
+ await bi(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0));
11244
11300
  break;
11245
11301
  }
11246
11302
  case 'upload': {
11247
- let a = t.subcommand || '';
11248
- await xa(a, t.options);
11303
+ let i = t.subcommand || '';
11304
+ await _i(i, t.options);
11249
11305
  break;
11250
11306
  }
11251
11307
  case 'run':
11252
11308
  case 'generate': {
11253
- let a = t.subcommand || '';
11254
- await Qe(a, t.options);
11309
+ let i = t.subcommand || '';
11310
+ await Qe(i, t.options);
11255
11311
  break;
11256
11312
  }
11257
11313
  case 'status': {
11258
- let a = t.subcommand || '';
11259
- await wa(a, t.options);
11314
+ let i = t.subcommand || '';
11315
+ await xi(i, t.options);
11260
11316
  break;
11261
11317
  }
11262
11318
  case 'balance': {
11263
- await pa(t.options);
11319
+ await pi(t.options);
11264
11320
  break;
11265
11321
  }
11266
11322
  case 'usage': {
11267
- await ma(t.options);
11323
+ await fi(t.options);
11268
11324
  break;
11269
11325
  }
11270
11326
  case 'transactions':
11271
11327
  case 'history': {
11272
- await fa(t.options);
11328
+ await gi(t.options);
11273
11329
  break;
11274
11330
  }
11275
11331
  case 'mcp': {
11276
- let { startStdioServer: a } = await Promise.resolve().then(() => (La(), Ra));
11277
- await a();
11332
+ let { startStdioServer: i } = await Promise.resolve().then(() => (Di(), Li));
11333
+ await i();
11278
11334
  break;
11279
11335
  }
11280
11336
  default: {
@@ -11289,7 +11345,7 @@ Run ${r.cyan('tein --help')} for the commands, or ${r.cyan('tein models')} for t
11289
11345
  await Qe(t.command, t.options));
11290
11346
  return;
11291
11347
  }
11292
- Da();
11348
+ Vi();
11293
11349
  break;
11294
11350
  }
11295
11351
  }