@teinai/cli 1.1.32 → 1.1.34

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 +829 -779
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,44 +1,44 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
- var 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(dt.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'),
@@ -47,12 +47,12 @@ function Wa() {
47
47
  }
48
48
  var dt,
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
+ ((dt = 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,13 +104,13 @@ 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
  });
@@ -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',
@@ -6169,7 +6200,7 @@ var pe,
6169
6200
  });
6170
6201
  var de,
6171
6202
  xt,
6172
- Ee = h(() => {
6203
+ $e = h(() => {
6173
6204
  'use strict';
6174
6205
  ((de = [
6175
6206
  {
@@ -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,18 +6318,18 @@ 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
6334
  ...pe,
6304
6335
  families: pe.families.map((e) => ({ ...e, models: e.models.filter((t) => !le(t)) })),
@@ -6306,31 +6337,31 @@ var Pt,
6306
6337
  }),
6307
6338
  (It = de.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' ? pa : da;
6376
6407
  }
6377
- var li,
6378
- pi,
6379
- Et = h(() => {
6408
+ var pa,
6409
+ da,
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
+ ((pa = ['auto', '1:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9']),
6413
+ (da = [
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,13 +6877,15 @@ 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
- n = [
6886
+ n = e.modeRequired ? void 0 : e.modes[0],
6887
+ s = n != null && e.sourceFramedModes?.includes(n),
6888
+ o = [
6831
6889
  {
6832
6890
  name: 'duration',
6833
6891
  type: t.allowed ? 'select' : 'slider',
@@ -6840,79 +6898,79 @@ function bi(e) {
6840
6898
  {
6841
6899
  name: 'resolution',
6842
6900
  type: 'select',
6843
- default: a[0],
6844
- options: a,
6901
+ default: i[0],
6902
+ options: i,
6845
6903
  description: `Output resolution. Higher resolutions cost more per second.${e.modes.includes('motion_control') ? ' motion_control: 720p or 1080p.' : ''}`,
6846
6904
  },
6847
6905
  {
6848
6906
  name: 'aspect_ratio',
6849
6907
  type: 'select',
6850
- default: e.aspects[0],
6908
+ ...(s ? {} : { default: e.aspects[0] }),
6851
6909
  options: [...e.aspects, ...(e.adaptiveModes?.length ? ['adaptive'] : [])],
6852
- 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}`,
6853
6911
  },
6854
6912
  ];
6855
6913
  if (
6856
6914
  (e.audio === 'priced'
6857
- ? n.push({
6915
+ ? o.push({
6858
6916
  name: 'generate_audio',
6859
6917
  type: 'boolean',
6860
6918
  default: !1,
6861
6919
  description: 'Add sound. Clips with sound are billed at the higher rate.',
6862
6920
  })
6863
6921
  : e.audio === 'free' &&
6864
- n.push({
6922
+ o.push({
6865
6923
  name: 'generate_audio',
6866
6924
  type: 'boolean',
6867
6925
  default: !0,
6868
6926
  description: 'Add sound. Same price on or off.',
6869
6927
  }),
6870
6928
  e.reference?.maxImages &&
6871
- n.push({
6929
+ o.push({
6872
6930
  name: 'images',
6873
6931
  type: 'string[]',
6874
6932
  description: `multi_reference: up to ${e.reference.maxImages} reference images.${e.referenceHandles ? ' In the prompt, name them @Image1, @Image2, ... in this order.' : ''} ${L}`,
6875
6933
  }),
6876
6934
  (e.modes.includes('image_to_video') || e.modes.includes('first_n_last_frames')) &&
6877
- n.push({
6935
+ o.push({
6878
6936
  name: 'first_frame_image',
6879
6937
  type: 'string',
6880
6938
  description: `The start frame (image_to_video, first_n_last_frames), ${L}`,
6881
6939
  }),
6882
6940
  (e.lastFrameOnImageToVideo || e.modes.includes('first_n_last_frames')) &&
6883
- n.push({
6941
+ o.push({
6884
6942
  name: 'last_frame_image',
6885
6943
  type: 'string',
6886
6944
  description: `Last frame (optional on image_to_video), ${L}`,
6887
6945
  }),
6888
6946
  e.reference?.maxVideos)
6889
6947
  ) {
6890
- let s = e.reference,
6891
- o = e.videoInputBilling
6948
+ let u = e.reference,
6949
+ l = e.videoInputBilling
6892
6950
  ? ` Billed as input plus output seconds${e.videoInputBilling.minOutputMultiple > 1 ? `, at least ${e.videoInputBilling.minOutputMultiple}x the output` : ''}.`
6893
6951
  : '';
6894
- n.push({
6952
+ o.push({
6895
6953
  name: 'videos',
6896
6954
  type: 'string[]',
6897
- description: `multi_reference: up to ${s.maxVideos} reference videos${s.maxVideoSeconds ? `, ${s.maxVideoSeconds} s in all` : ''}.${e.referenceHandles ? ' In the prompt, name them @Video1, @Video2, ... in this order.' : ''}${o} ${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}`,
6898
6956
  });
6899
6957
  }
6900
6958
  if (e.reference?.maxAudios) {
6901
- let s = e.reference,
6902
- o = s.audioClipSeconds
6903
- ? `, each ${s.audioClipSeconds.min} to ${s.audioClipSeconds.max} s`
6904
- : s.maxAudioSeconds
6905
- ? `, ${s.maxAudioSeconds} s in all`
6959
+ let u = e.reference,
6960
+ l = u.audioClipSeconds
6961
+ ? `, each ${u.audioClipSeconds.min} to ${u.audioClipSeconds.max} s`
6962
+ : u.maxAudioSeconds
6963
+ ? `, ${u.maxAudioSeconds} s in all`
6906
6964
  : '';
6907
- n.push({
6965
+ o.push({
6908
6966
  name: 'audios',
6909
6967
  type: 'string[]',
6910
- description: `multi_reference: up to ${s.maxAudios} reference audios${o}, with at least one image or video. ${L}`,
6968
+ description: `multi_reference: up to ${u.maxAudios} reference audios${l}, with at least one image or video. ${L}`,
6911
6969
  });
6912
6970
  }
6913
- return n;
6971
+ return o;
6914
6972
  }
6915
- function ki(e) {
6973
+ function ka(e) {
6916
6974
  let t = Object.keys(e.sizes);
6917
6975
  return [
6918
6976
  {
@@ -6929,13 +6987,13 @@ function ki(e) {
6929
6987
  },
6930
6988
  ];
6931
6989
  }
6932
- function xi() {
6990
+ function xa() {
6933
6991
  return [
6934
6992
  {
6935
6993
  name: 'voice_id',
6936
6994
  type: 'string',
6937
- default: Nt,
6938
- 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}.`,
6939
6997
  },
6940
6998
  {
6941
6999
  name: 'turns',
@@ -6954,9 +7012,9 @@ function xi() {
6954
7012
  },
6955
7013
  ];
6956
7014
  }
6957
- function Bt(e) {
7015
+ function jt(e) {
6958
7016
  let t = e.promptOptionalModes?.length ? ` Optional on ${e.promptOptionalModes.join(', ')}.` : '',
6959
- a = [
7017
+ i = [
6960
7018
  {
6961
7019
  name: 'prompt',
6962
7020
  type: 'string',
@@ -6969,26 +7027,26 @@ function Bt(e) {
6969
7027
  required: !0,
6970
7028
  ...(e.modeRequired ? {} : { default: e.modes[0] }),
6971
7029
  options: [...e.modes],
6972
- description: `${e.modeRequired ? 'Required. ' : ''}${e.modes.map((i) => hi[i]).join(' ')}`,
7030
+ description: `${e.modeRequired ? 'Required. ' : ''}${e.modes.map((a) => ha[a]).join(' ')}`,
6973
7031
  },
6974
7032
  ];
6975
7033
  return (
6976
- e.kind === 'video' ? a.push(...bi(e)) : e.kind === 'image' ? a.push(...ki(e)) : a.push(...xi()),
6977
- 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()),
6978
7036
  e.seed &&
6979
- a.push({ name: 'seed', type: 'number', min: 0, description: 'Seed for repeatable runs.' }),
6980
- a
7037
+ i.push({ name: 'seed', type: 'number', min: 0, description: 'Seed for repeatable runs.' }),
7038
+ i
6981
7039
  );
6982
7040
  }
6983
7041
  var L,
6984
- hi,
6985
- wi,
6986
- jt = h(() => {
7042
+ ha,
7043
+ wa,
7044
+ Gt = h(() => {
6987
7045
  'use strict';
6988
7046
  Ue();
6989
7047
  ((L =
6990
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.'),
6991
- (hi = {
7049
+ (ha = {
6992
7050
  text_to_video: 'text_to_video: from the prompt alone.',
6993
7051
  image_to_video: 'image_to_video: a start image in first_frame_image.',
6994
7052
  first_n_last_frames: 'first_n_last_frames: first_frame_image and last_frame_image.',
@@ -7000,24 +7058,24 @@ var L,
7000
7058
  motion_control:
7001
7059
  'motion_control: the character in image_url performs the motion of video_url; length and frame follow the video.',
7002
7060
  }));
7003
- wi = Object.entries(Ve)
7061
+ wa = Object.entries(Ve)
7004
7062
  .map(([e, t]) => `${e} (${t})`)
7005
7063
  .join(', ');
7006
7064
  });
7007
7065
  var he,
7008
- Gt,
7009
- Y,
7010
7066
  Ht,
7067
+ Y,
7068
+ zt,
7011
7069
  Pn,
7012
7070
  In,
7013
7071
  vn,
7014
7072
  Tn,
7015
- zt = h(() => {
7073
+ Jt = h(() => {
7016
7074
  'use strict';
7017
7075
  ((he = 'enhancor-ultrafine'),
7018
- (Gt = 'Enhancor Ultrafine'),
7076
+ (Ht = 'Enhancor Ultrafine'),
7019
7077
  (Y = { skin: [2, 3, 4], noSkin: [2, 3, 4, 8, 16] }),
7020
- (Ht = 2),
7078
+ (zt = 2),
7021
7079
  (Pn = 24 * 1024 * 1024),
7022
7080
  (In = 4096 * 4096),
7023
7081
  (vn = 30 * 6e4),
@@ -7045,123 +7103,123 @@ var X,
7045
7103
  function Q(e) {
7046
7104
  return `$${Number(e.toFixed(5))}`;
7047
7105
  }
7048
- function Ii(e) {
7106
+ function Ia(e) {
7049
7107
  if (e.kind === 'llm') {
7050
7108
  let t = e.defaultEndpoint,
7051
- a = (s) =>
7109
+ i = (s) =>
7052
7110
  e.variants.find(
7053
7111
  (o) =>
7054
7112
  o.component === s &&
7055
7113
  (!t || !o.endpoint || o.endpoint === t) &&
7056
7114
  (!o.context || o.context === '0\u201332K'),
7057
7115
  ),
7058
- i = a('input'),
7059
- n = a('output');
7060
- return i && n
7061
- ? `${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`
7062
7120
  : `from ${Q(me(e).price.starter)}/M tokens`;
7063
7121
  }
7064
7122
  return `from ${Q(me(e).price.starter)}${e.unit}`;
7065
7123
  }
7066
- function vi(e, t) {
7067
- let a = t.filter((i) => Number.isFinite(i) && i > 0);
7068
- 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;
7069
7127
  }
7070
- function Qt(e) {
7128
+ function Zt(e) {
7071
7129
  for (let t of J) {
7072
- let a = ke[t],
7073
- i = a ? vi(a.unit, e[t] ?? []) : null;
7074
- 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);
7075
7133
  }
7076
7134
  }
7077
7135
  function A(e, t) {
7078
- let a = e.axes?.resolution ?? [
7079
- ...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)),
7080
7138
  ];
7081
7139
  return {
7082
7140
  name: 'resolution',
7083
7141
  type: 'select',
7084
- default: me(e).resolution ?? a[0],
7085
- options: a,
7142
+ default: me(e).resolution ?? i[0],
7143
+ options: i,
7086
7144
  ...(t ? { description: t } : {}),
7087
7145
  };
7088
7146
  }
7089
- function Zt(e) {
7147
+ function ei(e) {
7090
7148
  if (!e.endpoints?.length) return null;
7091
- let t = e.endpoints.filter((a) => Kt(e.slug, a.id));
7149
+ let t = e.endpoints.filter((i) => Kt(e.slug, i.id));
7092
7150
  return {
7093
7151
  name: 'endpoint',
7094
7152
  type: 'select',
7095
7153
  default: Oe(e),
7096
- 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),
7097
7155
  description:
7098
7156
  (e.slug === 'gemini-3.1-pro-preview'
7099
7157
  ? 'Where the request is served; a missing endpoint is the default, the lowest price, and an unknown one is refused.'
7100
7158
  : 'Where the request is served; a missing or unknown endpoint is the default, the lowest price.') +
7101
- (t.length ? ` ${t.map((a) => a.label).join(' and ')}: coming soon.` : ''),
7159
+ (t.length ? ` ${t.map((i) => i.label).join(' and ')}: coming soon.` : ''),
7102
7160
  };
7103
7161
  }
7104
- function Mi(e, t) {
7105
- if (e.unfiltered == null || t.some((i) => i.name === 'creative_mode')) return t;
7106
- let a = X.includes(e.api.model);
7107
- 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];
7108
7166
  }
7109
7167
  function Be(e, t) {
7110
- let a = e.filter((n) => !be.has(n.name)),
7111
- i = [Je, ea];
7112
- 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]);
7113
7171
  }
7114
- function Ei(e) {
7172
+ function $a(e) {
7115
7173
  return [
7116
7174
  ...e
7117
- .filter((t) => !Si.has(t.name) && !be.has(t.name))
7175
+ .filter((t) => !Sa.has(t.name) && !be.has(t.name))
7118
7176
  .map((t) => {
7119
7177
  if (t.name === 'resolution')
7120
7178
  return {
7121
7179
  ...t,
7122
7180
  ...(t.options
7123
7181
  ? {
7124
- options: t.options.filter((i) =>
7125
- ['480p', '720p'].includes(String(i).toLowerCase()),
7182
+ options: t.options.filter((a) =>
7183
+ ['480p', '720p'].includes(String(a).toLowerCase()),
7126
7184
  ),
7127
7185
  }
7128
7186
  : {}),
7129
7187
  description: `Output resolution: 480p or 720p (8-bit). This tier has no 1080p or 4k. ${Z}`,
7130
7188
  };
7131
- let a = Ci[t.name];
7132
- return a && typeof t.description == 'string'
7133
- ? { ...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})`) }
7134
7192
  : t;
7135
7193
  }),
7136
7194
  Je,
7137
- ea,
7195
+ ti,
7138
7196
  We,
7139
7197
  Ye,
7140
7198
  ];
7141
7199
  }
7142
- function ta(e) {
7200
+ function ii(e) {
7143
7201
  return (
7144
7202
  e.startsWith('seedance-2-5-') &&
7145
7203
  e !== 'seedance-2-5-lite' &&
7146
7204
  !/-(creative-mode|unfiltered|uncensored)$/.test(e)
7147
7205
  );
7148
7206
  }
7149
- function Jt(e, t = {}) {
7207
+ function Wt(e, t = {}) {
7150
7208
  return [
7151
7209
  ...e
7152
- .filter((a) => !Ki.has(a.name) && !be.has(a.name))
7153
- .map((a) =>
7154
- a.name === 'prompt'
7155
- ? { ...a, required: !0 }
7156
- : 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'
7157
7215
  ? {
7158
- ...a,
7159
- ...(t.no4k && a.options
7160
- ? { 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') }
7161
7219
  : {}),
7162
7220
  description: `Output resolution. TEIN LITE is the lower-priced endpoint for getting started. Stability and reliability are not guaranteed. ${Z}`,
7163
7221
  }
7164
- : a,
7222
+ : i,
7165
7223
  ),
7166
7224
  {
7167
7225
  name: 'bitrate_mode',
@@ -7188,23 +7246,23 @@ function je(e, t) {
7188
7246
  },
7189
7247
  A(e),
7190
7248
  { name: 'aspect_ratio', type: 'select', default: t.aspects[0], options: t.aspects },
7191
- ...t.references.map((a) =>
7192
- a.endsWith('s')
7249
+ ...t.references.map((i) =>
7250
+ i.endsWith('s')
7193
7251
  ? {
7194
- name: a,
7252
+ name: i,
7195
7253
  type: 'string[]',
7196
- 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.`,
7197
7255
  }
7198
7256
  : {
7199
- name: a,
7257
+ name: i,
7200
7258
  type: 'string',
7201
- 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.`,
7202
7260
  },
7203
7261
  ),
7204
7262
  ];
7205
7263
  }
7206
- function $i(e) {
7207
- let t = Zt(e);
7264
+ function Ea(e) {
7265
+ let t = ei(e);
7208
7266
  return [
7209
7267
  C('Image prompt text. Supports complex composition and text instructions.'),
7210
7268
  ...(t ? [t] : []),
@@ -7271,7 +7329,7 @@ function $i(e) {
7271
7329
  },
7272
7330
  ];
7273
7331
  }
7274
- function Ai(e) {
7332
+ function Aa(e) {
7275
7333
  return [
7276
7334
  C('Image prompt text.'),
7277
7335
  {
@@ -7305,22 +7363,22 @@ function Ai(e) {
7305
7363
  },
7306
7364
  ];
7307
7365
  }
7308
- function Li() {
7309
- let e = $t,
7366
+ function La() {
7367
+ let e = Et,
7310
7368
  t = [];
7311
- for (let a of Xe(!0))
7312
- e.includes(a.name) &&
7369
+ for (let i of Xe(!0))
7370
+ e.includes(i.name) &&
7313
7371
  (t.push({
7314
- ...a,
7315
- ...(a.name === 'max_tokens' ? { min: 64 } : {}),
7316
- ...(a.name === 'messages'
7372
+ ...i,
7373
+ ...(i.name === 'max_tokens' ? { min: 64 } : {}),
7374
+ ...(i.name === 'messages'
7317
7375
  ? {
7318
7376
  description:
7319
7377
  'Chat history: system, developer, user (text and image_url parts) and assistant turns; no tool turns.',
7320
7378
  }
7321
7379
  : {}),
7322
7380
  }),
7323
- a.name === 'top_p' &&
7381
+ i.name === 'top_p' &&
7324
7382
  t.push({
7325
7383
  name: 'top_k',
7326
7384
  type: 'number',
@@ -7330,7 +7388,7 @@ function Li() {
7330
7388
  }));
7331
7389
  return t;
7332
7390
  }
7333
- function Di() {
7391
+ function Da() {
7334
7392
  return Xe(!0).map((e) =>
7335
7393
  e.name === 'max_tokens' || e.name === 'max_completion_tokens' ? { ...e, min: 128 } : e,
7336
7394
  );
@@ -7430,17 +7488,17 @@ function Xe(e) {
7430
7488
  },
7431
7489
  ];
7432
7490
  }
7433
- function Vi(e) {
7434
- if (e.slug === 'seed-2-1-turbo') return Oi;
7435
- let t = Zt(e);
7491
+ function Va(e) {
7492
+ if (e.slug === 'seed-2-1-turbo') return Oa;
7493
+ let t = ei(e);
7436
7494
  return [
7437
7495
  ...(e.slug === 'gemini-3.1-pro-preview'
7438
- ? Li()
7496
+ ? La()
7439
7497
  : e.slug === 'gemini-3.7-flash'
7440
- ? Di()
7441
- : e.slug === 'gpt-6-astra' || Ri.includes(e.slug)
7498
+ ? Da()
7499
+ : e.slug === 'gpt-6-astra' || Ra.includes(e.slug)
7442
7500
  ? Xe(e.slug !== 'gpt-6-astra')
7443
- : qi),
7501
+ : qa),
7444
7502
  ...(t ? [t] : []),
7445
7503
  ];
7446
7504
  }
@@ -7452,7 +7510,7 @@ function Ge() {
7452
7510
  description: 'The photo to fix: one JPEG or PNG URL.',
7453
7511
  };
7454
7512
  }
7455
- function Ui(e) {
7513
+ function Ua(e) {
7456
7514
  return [
7457
7515
  {
7458
7516
  name: 'video_url',
@@ -7474,7 +7532,7 @@ function Ui(e) {
7474
7532
  },
7475
7533
  ];
7476
7534
  }
7477
- function Fi() {
7535
+ function Fa() {
7478
7536
  return [
7479
7537
  {
7480
7538
  name: 'mode',
@@ -7545,30 +7603,30 @@ function Fi() {
7545
7603
  },
7546
7604
  ];
7547
7605
  }
7548
- function Bi(e) {
7606
+ function Ba(e) {
7549
7607
  let t = e.slug;
7550
- if (e.family === 'tein-labs' && e.kind === 'image') return Fi();
7551
- if (de.some((i) => i.slug === t)) return Ui(e);
7552
- if (e.kind === 'llm') return Vi(e);
7553
- if (e.editVariants?.length) return $i(e);
7554
- let a = ge(t);
7555
- if (a) return Bt(a);
7556
- if (ta(t)) return Ei(He);
7608
+ if (e.family === 'tein-labs' && e.kind === 'image') return Fa();
7609
+ if (de.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);
7557
7615
  switch (t) {
7558
7616
  case 'seedance-2-5':
7559
7617
  return Be(He, t);
7560
7618
  case 'seedance-2-5-lite':
7561
- return Jt(He, { no4k: !0 });
7619
+ return Wt(He, { no4k: !0 });
7562
7620
  case 'seedance-2':
7563
- return Be(Wt, t);
7621
+ return Be(Yt, t);
7564
7622
  case 'seedance-2-lite':
7565
- return Jt(Wt);
7623
+ return Wt(Yt);
7566
7624
  case 'seedance-2-mini':
7567
- return Be(ji, t);
7625
+ return Be(ja, t);
7568
7626
  case 'nano-banana-2':
7569
7627
  case 'nano-banana-2.1':
7570
7628
  case 'nano-banana-pro':
7571
- return Ai(e);
7629
+ return Aa(e);
7572
7630
  case 'seedream-5-pro':
7573
7631
  return [
7574
7632
  C('Detailed description of the image to generate.'),
@@ -7835,7 +7893,7 @@ function Bi(e) {
7835
7893
  max: 0.4,
7836
7894
  description: 'Portrait depth. Heavy only.',
7837
7895
  },
7838
- ...Ni,
7896
+ ...Na,
7839
7897
  ];
7840
7898
  case 'enhancor-skin-fix-v3':
7841
7899
  return [
@@ -7942,10 +8000,10 @@ function Bi(e) {
7942
8000
  return [C('Prompt text.')];
7943
8001
  }
7944
8002
  }
7945
- function Gi() {
8003
+ function Ga() {
7946
8004
  return {
7947
8005
  slug: he,
7948
- name: Gt,
8006
+ name: Ht,
7949
8007
  category: 'Image',
7950
8008
  kind: 'Image-to-Image',
7951
8009
  vendor: 'Enhancor',
@@ -7953,7 +8011,7 @@ function Gi() {
7953
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).',
7954
8012
  priceFormatted: '',
7955
8013
  unit: '/img',
7956
- primaryToolName: Xt.image,
8014
+ primaryToolName: Qt.image,
7957
8015
  parameters: [
7958
8016
  {
7959
8017
  name: 'image',
@@ -7979,7 +8037,7 @@ function Gi() {
7979
8037
  {
7980
8038
  name: 'scale',
7981
8039
  type: 'select',
7982
- default: String(Ht),
8040
+ default: String(zt),
7983
8041
  options: Y.noSkin.map(String),
7984
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.`,
7985
8043
  },
@@ -7990,17 +8048,17 @@ function ze(e, t = e.api.model) {
7990
8048
  return {
7991
8049
  slug: t,
7992
8050
  name: e.name,
7993
- category: _i[e.kind],
7994
- 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],
7995
8053
  vendor: e.vendor ?? '',
7996
8054
  description: e.desc ?? e.name,
7997
- priceFormatted: Ii(e),
8055
+ priceFormatted: Ia(e),
7998
8056
  unit: e.unit,
7999
- primaryToolName: Xt[e.kind],
8000
- parameters: Mi(e, Bi(e)),
8057
+ primaryToolName: Qt[e.kind],
8058
+ parameters: Ma(e, Ba(e)),
8001
8059
  };
8002
8060
  }
8003
- function Hi() {
8061
+ function Ha() {
8004
8062
  let e = {};
8005
8063
  for (let t of ue())
8006
8064
  if (t.slug !== 'seedance-2-fast') {
@@ -8009,16 +8067,16 @@ function Hi() {
8009
8067
  continue;
8010
8068
  }
8011
8069
  if (t.slug === 'seedance-2') {
8012
- let a = ze(t);
8013
- ((a.description = `${t.desc ?? t.name} Send quality fast or mini for Seedance 2.0 Fast or Mini.`),
8014
- (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));
8015
8073
  continue;
8016
8074
  }
8017
8075
  t.slug.startsWith('claude-') || (e[t.api.model] = ze(t));
8018
8076
  }
8019
- (Object.assign(e, Lt()), (e[he] = Gi()));
8020
- for (let [t, a] of Object.entries(fe))
8021
- 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 });
8022
8080
  return e;
8023
8081
  }
8024
8082
  function we(e) {
@@ -8027,102 +8085,102 @@ function we(e) {
8027
8085
  function H(e) {
8028
8086
  return ke[e] ?? null;
8029
8087
  }
8030
- function zi(e, t, a) {
8088
+ function za(e, t, i) {
8031
8089
  if (e.startsWith('enhancor-skin-fix-') || e === he) return !1;
8032
- 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') {
8033
8091
  let n = (s) => (typeof s == 'string' ? s.trim().toLowerCase() : '');
8034
- 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;
8035
8093
  }
8036
8094
  if (
8037
- (t === 'max_tokens' && Yt(a.max_completion_tokens)) ||
8038
- (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))
8039
8097
  )
8040
8098
  return !1;
8041
8099
  if (t === 'aspect_ratio') {
8042
8100
  let n = ge(e);
8043
8101
  if (n) {
8044
- let s = typeof a.mode == 'string' ? a.mode.trim().toLowerCase() : '',
8102
+ let s = typeof i.mode == 'string' ? i.mode.trim().toLowerCase() : '',
8045
8103
  o = s ? s.replace(/-/g, '_') : n.modes[0];
8046
- if (n.modes.includes(o) && !Ut(n, o)) return !1;
8104
+ if (n.modes.includes(o) && !Ft(n, o)) return !1;
8047
8105
  }
8048
8106
  }
8049
- let i = ge(e);
8050
- if (i) {
8051
- let n = typeof a.mode == 'string' ? a.mode.trim().toLowerCase() : '',
8052
- s = n ? n.replace(/-/g, '_') : i.modes[0];
8053
- 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;
8054
8112
  }
8055
8113
  return !0;
8056
8114
  }
8057
- function Yt(e) {
8115
+ function Xt(e) {
8058
8116
  return e != null && e !== '';
8059
8117
  }
8060
- function ra(e, t) {
8061
- let a = { ...t };
8118
+ function ni(e, t) {
8119
+ let i = { ...t };
8062
8120
  if (e?.slug === 'seedance-2-5') {
8063
- let i = (n) => typeof n != 'string' || !n.trim();
8064
- for (let n of Ji) (i(a.finalize) && !i(a[n]) && (a.finalize = a[n]), delete a[n]);
8065
- 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;
8066
8124
  }
8067
- for (let i of e?.parameters ?? [])
8068
- i.default !== void 0 &&
8069
- a[i.name] === void 0 &&
8070
- zi(e.slug, i.name, t) &&
8071
- (a[i.name] = i.default);
8072
- 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;
8073
8131
  }
8074
8132
  function D() {
8075
8133
  return Object.values(ke);
8076
8134
  }
8077
- var _i,
8078
- Xt,
8079
- Pi,
8135
+ var _a,
8136
+ Qt,
8137
+ Pa,
8080
8138
  C,
8081
8139
  Je,
8082
- Ti,
8083
- ea,
8140
+ Ta,
8141
+ ti,
8084
8142
  We,
8085
8143
  Ye,
8086
8144
  be,
8087
- Ki,
8088
- Si,
8089
- Ci,
8090
- qi,
8091
- Oi,
8092
- Ri,
8093
- Ni,
8145
+ Ka,
8146
+ Sa,
8147
+ Ca,
8148
+ qa,
8149
+ Oa,
8150
+ Ra,
8151
+ Na,
8094
8152
  Z,
8095
8153
  He,
8096
- aa,
8097
- ia,
8098
- Wt,
8099
- ji,
8154
+ ai,
8155
+ ri,
8156
+ Yt,
8157
+ ja,
8100
8158
  ke,
8101
- Ji,
8159
+ Ja,
8102
8160
  ee = h(() => {
8103
8161
  'use strict';
8104
8162
  bt();
8105
8163
  Ce();
8106
8164
  G();
8107
8165
  Re();
8108
- Ee();
8166
+ $e();
8109
8167
  Le();
8110
8168
  St();
8111
- Et();
8169
+ $t();
8112
8170
  At();
8113
8171
  Dt();
8114
8172
  Ue();
8115
- jt();
8116
- zt();
8173
+ Gt();
8174
+ Jt();
8117
8175
  Fe();
8118
- ((_i = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
8119
- (Xt = {
8176
+ ((_a = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
8177
+ (Qt = {
8120
8178
  video: 'generate_video',
8121
8179
  image: 'generate_image',
8122
8180
  audio: 'generate_audio',
8123
8181
  llm: 'run_task',
8124
8182
  }),
8125
- (Pi = {
8183
+ (Pa = {
8126
8184
  video: 'Text-to-Video',
8127
8185
  image: 'Text-to-Image',
8128
8186
  audio: 'Text-to-Audio',
@@ -8136,13 +8194,13 @@ var _i,
8136
8194
  description:
8137
8195
  'Runs the Creative mode checkpoint at its published price (+5%). The Acceptable Use Policy applies.',
8138
8196
  }),
8139
- (Ti = {
8197
+ (Ta = {
8140
8198
  name: 'creative_mode',
8141
8199
  type: 'boolean',
8142
8200
  default: !1,
8143
8201
  description: `Not available yet on this model: ${ye}.`,
8144
8202
  }),
8145
- (ea = {
8203
+ (ti = {
8146
8204
  name: 'priority',
8147
8205
  type: 'boolean',
8148
8206
  default: !1,
@@ -8156,12 +8214,11 @@ var _i,
8156
8214
  (Ye = {
8157
8215
  name: 'auto_fit_images',
8158
8216
  type: 'boolean',
8159
- default: !1,
8160
8217
  description:
8161
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.',
8162
8219
  }),
8163
8220
  (be = new Set(['full_access', 'is_uncensored', 'unfiltered', 'verificationSignature'])));
8164
- ((Ki = new Set([
8221
+ ((Ka = new Set([
8165
8222
  'quality',
8166
8223
  'bitrate_mode',
8167
8224
  'draft',
@@ -8170,7 +8227,7 @@ var _i,
8170
8227
  'draft_generation_id',
8171
8228
  'pass_faces',
8172
8229
  ])),
8173
- (Si = new Set([
8230
+ (Sa = new Set([
8174
8231
  'quality',
8175
8232
  'bitrate_mode',
8176
8233
  'draft',
@@ -8178,12 +8235,12 @@ var _i,
8178
8235
  'draft_task_id',
8179
8236
  'draft_generation_id',
8180
8237
  ])),
8181
- (Ci = {
8238
+ (Ca = {
8182
8239
  images: 'up to 10',
8183
8240
  videos: 'up to 5; combined duration < 30s',
8184
8241
  audios: 'up to 5; combined duration < 30s',
8185
8242
  }));
8186
- ((qi = [
8243
+ ((qa = [
8187
8244
  C('The user message or task.'),
8188
8245
  { name: 'system', type: 'string', description: 'Optional system instructions.' },
8189
8246
  {
@@ -8201,7 +8258,7 @@ var _i,
8201
8258
  { name: 'temperature', type: 'slider', min: 0, max: 1, step: 0.1 },
8202
8259
  { name: 'top_p', type: 'slider', min: 0, max: 1, step: 0.05 },
8203
8260
  ]),
8204
- (Oi = [
8261
+ (Oa = [
8205
8262
  C('The user message or task.'),
8206
8263
  { name: 'system', type: 'string', description: 'Optional system instructions.' },
8207
8264
  {
@@ -8283,8 +8340,8 @@ var _i,
8283
8340
  description: 'Video frames read a second.',
8284
8341
  },
8285
8342
  ]),
8286
- (Ri = ['gemini-3.8-flash', 'gemini-3.7-flash']));
8287
- Ni = Object.entries({
8343
+ (Ra = ['gemini-3.8-flash', 'gemini-3.7-flash']));
8344
+ Na = Object.entries({
8288
8345
  background: !1,
8289
8346
  skin: !1,
8290
8347
  nose: !1,
@@ -8460,19 +8517,19 @@ var _i,
8460
8517
  'Keeps real faces in reference images. On by default. Send false to turn it off.',
8461
8518
  },
8462
8519
  ]),
8463
- (aa = {
8520
+ (ai = {
8464
8521
  name: 'images',
8465
8522
  type: 'string[]',
8466
8523
  description:
8467
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.',
8468
8525
  }),
8469
- (ia = {
8526
+ (ri = {
8470
8527
  name: 'audios',
8471
8528
  type: 'string[]',
8472
8529
  description:
8473
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.',
8474
8531
  }),
8475
- (Wt = [
8532
+ (Yt = [
8476
8533
  {
8477
8534
  name: 'prompt',
8478
8535
  type: 'string',
@@ -8550,8 +8607,8 @@ var _i,
8550
8607
  description:
8551
8608
  'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
8552
8609
  },
8553
- aa,
8554
- ia,
8610
+ ai,
8611
+ ri,
8555
8612
  {
8556
8613
  name: 'first_frame_image',
8557
8614
  type: 'string',
@@ -8572,7 +8629,7 @@ var _i,
8572
8629
  'Keeps real faces in reference images. On by default. Send false to turn it off.',
8573
8630
  },
8574
8631
  ]),
8575
- (ji = [
8632
+ (ja = [
8576
8633
  {
8577
8634
  name: 'prompt',
8578
8635
  type: 'string',
@@ -8627,8 +8684,8 @@ var _i,
8627
8684
  description:
8628
8685
  'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
8629
8686
  },
8630
- aa,
8631
- ia,
8687
+ ai,
8688
+ ri,
8632
8689
  {
8633
8690
  name: 'first_frame_image',
8634
8691
  type: 'string',
@@ -8643,29 +8700,29 @@ var _i,
8643
8700
  'Keeps real faces in reference images. On by default. Send false to turn it off.',
8644
8701
  },
8645
8702
  ]));
8646
- ke = Hi();
8647
- Ji = ['draft_task_id', 'draft_generation_id'];
8703
+ ke = Ha();
8704
+ Ja = ['draft_task_id', 'draft_generation_id'];
8648
8705
  });
8649
8706
  function xe(e) {
8650
8707
  let t = '/v1/pricing/models',
8651
- a = e?.trim();
8652
- return a ? `${t}?model=${encodeURIComponent(a)}` : t;
8708
+ i = e?.trim();
8709
+ return i ? `${t}?model=${encodeURIComponent(i)}` : t;
8653
8710
  }
8654
8711
  var et = h(() => {
8655
8712
  'use strict';
8656
8713
  });
8657
- function _a(e) {
8714
+ function Pi(e) {
8658
8715
  return e.length <= 1 ? (e[0] ?? '') : `${e.slice(0, -1).join(', ')} and ${e[e.length - 1]}`;
8659
8716
  }
8660
- function Pa(e) {
8717
+ function Ii(e) {
8661
8718
  let t = ue().filter((s) => s.kind === e && s.unfiltered != null),
8662
- a = t.filter((s) => X.includes(s.api.model)).map((s) => s.name),
8663
- 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);
8664
8721
  return [
8665
- ...(a.length
8666
- ? [`${_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%).`]
8667
8724
  : []),
8668
- ...(i.length ? [`Not available yet on ${_a(i)}: ${ye}.`] : []),
8725
+ ...(a.length ? [`Not available yet on ${Pi(a)}: ${ye}.`] : []),
8669
8726
  'The Acceptable Use Policy applies.',
8670
8727
  ].join(' ');
8671
8728
  }
@@ -8679,15 +8736,15 @@ function Ir(e) {
8679
8736
  function vr(e) {
8680
8737
  let t = e.inputSchema.properties;
8681
8738
  if (!t) return e;
8682
- let a = !1,
8683
- i = {};
8739
+ let i = !1,
8740
+ a = {};
8684
8741
  for (let [n, s] of Object.entries(t))
8685
- Ia.has(n) && s.type === 'string' && !s.format
8686
- ? ((i[n] = { ...s, format: 'uri' }), (a = !0))
8687
- : Ia.has(n) && s.type === 'array' && s.items?.type === 'string' && !s.items.format
8688
- ? ((i[n] = { ...s, items: { ...s.items, format: 'uri' } }), (a = !0))
8689
- : (i[n] = s);
8690
- 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;
8691
8748
  }
8692
8749
  function Tr(e) {
8693
8750
  switch (e.type) {
@@ -8745,18 +8802,18 @@ function Tr(e) {
8745
8802
  }
8746
8803
  }
8747
8804
  function Mr(e, t) {
8748
- let a = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
8749
- i = {},
8805
+ let i = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
8806
+ a = {},
8750
8807
  n = [];
8751
- 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));
8752
8809
  let s = {
8753
8810
  type: 'object',
8754
- properties: i,
8811
+ properties: a,
8755
8812
  ...(n.length > 0 ? { required: n } : {}),
8756
8813
  additionalProperties: !0,
8757
8814
  };
8758
8815
  return {
8759
- name: a,
8816
+ name: i,
8760
8817
  description: `[Tein AI - ${e.name} (${e.category})] ${e.description} (Pricing: ${e.priceFormatted})`,
8761
8818
  inputSchema: s,
8762
8819
  };
@@ -8764,12 +8821,12 @@ function Mr(e, t) {
8764
8821
  function Kr() {
8765
8822
  let e = D().filter((d) => d.category === 'Image' && !we(d)),
8766
8823
  t = D().filter((d) => d.category === 'Video'),
8767
- a = D().filter((d) => d.category === 'Text'),
8768
- i = D().filter((d) => d.category === 'Audio'),
8824
+ i = D().filter((d) => d.category === 'Text'),
8825
+ a = D().filter((d) => d.category === 'Audio'),
8769
8826
  n = {
8770
8827
  name: 'generate_image',
8771
8828
  description:
8772
- 'Generate or edit images with Tein AI image models (GPT Image 2 and 2.5, Nano Banana 2 and Pro, Seedream 5.5 and 5.0 Pro, Qwen Image 3.0, Hailuo 3 Image). Billed per image at the published price.',
8829
+ "Generate or edit images with Tein AI image models (GPT Image 2 and 2.5, Nano Banana 2 and Pro, Seedream 5.5 and 5.0 Pro, Qwen Image 3.0, Hailuo 3 Image). Billed per image at the published price. A field left out takes the chosen model's own default (see its own tool); send only the fields that model takes.",
8773
8830
  inputSchema: {
8774
8831
  type: 'object',
8775
8832
  properties: {
@@ -8791,8 +8848,8 @@ function Kr() {
8791
8848
  resolution: {
8792
8849
  type: 'string',
8793
8850
  enum: ['1K', '2K', '4K'],
8794
- default: '1K',
8795
- description: 'Output resolution (1K, 2K, or 4K where supported).',
8851
+ description:
8852
+ "Output resolution (1K, 2K, or 4K where supported). Left out: the model's own default.",
8796
8853
  },
8797
8854
  images: {
8798
8855
  type: 'array',
@@ -8803,20 +8860,17 @@ function Kr() {
8803
8860
  endpoint: {
8804
8861
  type: 'string',
8805
8862
  enum: ['dynamic', 'token', 'flat', 'medium'],
8806
- default: 'dynamic',
8807
8863
  description:
8808
8864
  'GPT Image models only. dynamic: lowest price for this request; token: billed by tokens within published limits; flat: one price at any quality or prompt length; medium: gpt-image-2 only, medium quality at one price for any resolution (non-square ratios at 1K only).',
8809
8865
  },
8810
8866
  quality: {
8811
8867
  type: 'string',
8812
8868
  enum: ['low', 'medium', 'high', 'xhigh', 'max'],
8813
- default: 'low',
8814
8869
  description:
8815
8870
  'GPT Image models only. gpt-image-2 supports low, medium and high; the 2.5 models also xhigh and max.',
8816
8871
  },
8817
8872
  n: {
8818
8873
  type: 'number',
8819
- default: 1,
8820
8874
  minimum: 1,
8821
8875
  maximum: 10,
8822
8876
  description:
@@ -8825,7 +8879,6 @@ function Kr() {
8825
8879
  output_format: {
8826
8880
  type: 'string',
8827
8881
  enum: ['png', 'jpeg', 'webp'],
8828
- default: 'png',
8829
8882
  description:
8830
8883
  'GPT Image 2 and Nano Banana. jpeg and webp on GPT Image take output_compression.',
8831
8884
  },
@@ -8838,7 +8891,6 @@ function Kr() {
8838
8891
  background: {
8839
8892
  type: 'string',
8840
8893
  enum: ['auto', 'opaque', 'transparent'],
8841
- default: 'auto',
8842
8894
  description: 'GPT Image 2 only. transparent asks for no backdrop.',
8843
8895
  },
8844
8896
  input_fidelity: {
@@ -8857,7 +8909,7 @@ function Kr() {
8857
8909
  maximum: 2147483647,
8858
8910
  description: 'Nano Banana 2 and Nano Banana Pro. Omit it for a new image each time.',
8859
8911
  },
8860
- creative_mode: { type: 'boolean', default: !1, description: Pa('image') },
8912
+ creative_mode: { type: 'boolean', description: Ii('image') },
8861
8913
  },
8862
8914
  required: ['prompt'],
8863
8915
  additionalProperties: !0,
@@ -8866,14 +8918,14 @@ function Kr() {
8866
8918
  s = {
8867
8919
  name: 'generate_video',
8868
8920
  description:
8869
- 'Generate video with Tein AI video models (Seedance 2.5, Seedance 2.0 with quality standard, fast or mini, Wan 3.0, HappyHorse, Hailuo 3). Seedance and Wan take creative_mode; Seedance takes priority.',
8921
+ "Generate video with Tein AI video models (Seedance 2.5, Seedance 2.0 with quality standard, fast or mini, Wan 3.0, HappyHorse, Hailuo 3). Seedance and Wan take creative_mode; Seedance takes priority. A field left out takes the chosen model's own default (see its own tool); send only the fields that model takes. A model that takes no prompt (Tein Video Upscaler) is called without one.",
8870
8922
  inputSchema: {
8871
8923
  type: 'object',
8872
8924
  properties: {
8873
8925
  prompt: {
8874
8926
  type: 'string',
8875
8927
  description:
8876
- 'Detailed description of the video scene, character motion, lighting, and camera movement.',
8928
+ 'Detailed description of the video scene, character motion, lighting, and camera movement. Required by every model that takes a prompt; leave it out for a model that takes none.',
8877
8929
  },
8878
8930
  model: {
8879
8931
  type: 'string',
@@ -8883,29 +8935,28 @@ function Kr() {
8883
8935
  },
8884
8936
  duration: {
8885
8937
  type: 'number',
8886
- default: 5,
8887
8938
  minimum: 4,
8888
8939
  maximum: 30,
8889
- description: 'Duration in seconds (4 to 30 depending on model).',
8940
+ description:
8941
+ "Duration in seconds (4 to 30 depending on model). Left out: the model's own default.",
8890
8942
  },
8891
8943
  resolution: {
8892
8944
  type: 'string',
8893
8945
  enum: ['480p', '720p', '768p', '1080p', '2k', '4k'],
8894
- default: '480p',
8895
- description: 'Video resolution (the lowest price is the default; see each model tool).',
8946
+ description:
8947
+ "Video resolution, where the model takes it (see each model tool). Left out: the model's own default, its lowest price.",
8896
8948
  },
8897
- creative_mode: { type: 'boolean', default: !1, description: Pa('video') },
8949
+ creative_mode: { type: 'boolean', description: Ii('video') },
8898
8950
  priority: {
8899
8951
  type: 'boolean',
8900
- default: !1,
8901
8952
  description:
8902
8953
  'Seedance models only: guaranteed speed and no queue, at the published Priority price (+6%).',
8903
8954
  },
8904
8955
  aspect_ratio: {
8905
8956
  type: 'string',
8906
8957
  enum: ['16:9', '9:16', '1:1', '4:3', '3:4', '21:9', 'adaptive'],
8907
- default: '16:9',
8908
- description: 'Aspect ratio of the video.',
8958
+ description:
8959
+ "Aspect ratio of the video, where the model takes one. Left out: the model's own default.",
8909
8960
  },
8910
8961
  first_frame_image: {
8911
8962
  type: 'string',
@@ -8914,8 +8965,8 @@ function Kr() {
8914
8965
  },
8915
8966
  generate_audio: {
8916
8967
  type: 'boolean',
8917
- default: !0,
8918
- description: 'Generate synchronized sound effects and dialogue (Seedance 2.5).',
8968
+ description:
8969
+ "Generate synchronized sound, on the models that take it (see each model tool). Left out: the model's own default.",
8919
8970
  },
8920
8971
  images: {
8921
8972
  type: 'array',
@@ -8924,7 +8975,6 @@ function Kr() {
8924
8975
  'Optional reference images 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.',
8925
8976
  },
8926
8977
  },
8927
- required: ['prompt'],
8928
8978
  additionalProperties: !0,
8929
8979
  },
8930
8980
  },
@@ -8962,7 +9012,7 @@ function Kr() {
8962
9012
  prompt: { type: 'string', description: 'The reasoning task or query to execute.' },
8963
9013
  model: {
8964
9014
  type: 'string',
8965
- enum: a.map((d) => d.slug),
9015
+ enum: i.map((d) => d.slug),
8966
9016
  default: 'gpt-6-astra',
8967
9017
  description: 'The reasoning model to use (default: gpt-6-astra).',
8968
9018
  },
@@ -9033,7 +9083,7 @@ function Kr() {
9033
9083
  },
9034
9084
  },
9035
9085
  p = Sr();
9036
- return [n, s, o, u, l, p, c, wr, ...va];
9086
+ return [n, s, o, u, l, p, c, wr, ...Ti];
9037
9087
  }
9038
9088
  function Sr() {
9039
9089
  return {
@@ -9084,7 +9134,7 @@ function Sr() {
9084
9134
  }
9085
9135
  function st() {
9086
9136
  let e = Kr(),
9087
- t = D().map((a) => Mr(a));
9137
+ t = D().map((i) => Mr(i));
9088
9138
  return [...e, ...t].map(Ir).map(vr);
9089
9139
  }
9090
9140
  var br,
@@ -9093,10 +9143,10 @@ var br,
9093
9143
  xr,
9094
9144
  _r,
9095
9145
  Pr,
9096
- va,
9146
+ Ti,
9097
9147
  Cs,
9098
- Ia,
9099
- Ta = h(() => {
9148
+ vi,
9149
+ Mi = h(() => {
9100
9150
  'use strict';
9101
9151
  G();
9102
9152
  Fe();
@@ -9187,9 +9237,9 @@ var br,
9187
9237
  additionalProperties: !1,
9188
9238
  },
9189
9239
  }),
9190
- (va = [xr, _r, Pr]),
9191
- (Cs = new Set(va.map((e) => e.name))));
9192
- Ia = new Set([
9240
+ (Ti = [xr, _r, Pr]),
9241
+ (Cs = new Set(Ti.map((e) => e.name))));
9242
+ vi = new Set([
9193
9243
  'image',
9194
9244
  'images',
9195
9245
  'image_url',
@@ -9206,30 +9256,30 @@ var br,
9206
9256
  'lipsyncing_audio',
9207
9257
  ]);
9208
9258
  });
9209
- var Ra = {};
9210
- ja(Ra, {
9259
+ var Li = {};
9260
+ Gi(Li, {
9211
9261
  forgetToolSchemas: () => qr,
9212
- jsonRpcAnswer: () => Ca,
9213
- preprocessLocalFiles: () => qa,
9214
- startStdioServer: () => Oa,
9262
+ jsonRpcAnswer: () => $i,
9263
+ preprocessLocalFiles: () => Oi,
9264
+ startStdioServer: () => Ri,
9215
9265
  });
9216
9266
  function Cr(e) {
9217
- let t = (a) =>
9218
- !!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);
9219
9269
  return Array.isArray(e) ? e.length > 0 && e.every(t) : t(e);
9220
9270
  }
9221
- function Ca(e, t, a) {
9222
- let i = e?.id,
9223
- n = i == null,
9271
+ function $i(e, t, i) {
9272
+ let a = e?.id,
9273
+ n = a == null,
9224
9274
  s = null;
9225
9275
  try {
9226
- s = a ? JSON.parse(a) : null;
9276
+ s = i ? JSON.parse(i) : null;
9227
9277
  } catch {
9228
9278
  s = null;
9229
9279
  }
9230
9280
  if (s !== null && Cr(s)) return n ? null : s;
9231
9281
  if (n) return null;
9232
- if (!a && t >= 200 && t < 300) return;
9282
+ if (!i && t >= 200 && t < 300) return;
9233
9283
  let o = s?.error,
9234
9284
  u =
9235
9285
  typeof o == 'string'
@@ -9240,7 +9290,7 @@ function Ca(e, t, a) {
9240
9290
  l = o && typeof o == 'object' && typeof o.code == 'string' ? o.code : null;
9241
9291
  return {
9242
9292
  jsonrpc: '2.0',
9243
- id: i,
9293
+ id: a,
9244
9294
  error: {
9245
9295
  code: t === 401 ? -32001 : -32603,
9246
9296
  message: u,
@@ -9248,19 +9298,19 @@ function Ca(e, t, a) {
9248
9298
  },
9249
9299
  };
9250
9300
  }
9251
- function Er() {
9301
+ function $r() {
9252
9302
  let e = process.argv.slice(2),
9253
9303
  t = e.indexOf('--api-key');
9254
9304
  return S(t >= 0 ? e[t + 1] : void 0);
9255
9305
  }
9256
- async function Ea(e, t, a) {
9257
- let i = z.default.resolve(e);
9258
- 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())
9259
9309
  throw new Error(`File not found: ${e}`);
9260
- let n = V.default.readFileSync(i),
9310
+ let n = V.default.readFileSync(a),
9261
9311
  s = n.toString('base64'),
9262
9312
  o = n.length,
9263
- u = `${a.replace(/\/$/, '')}/v1/upload`,
9313
+ u = `${i.replace(/\/$/, '')}/v1/upload`,
9264
9314
  l = await fetch(u, {
9265
9315
  method: 'POST',
9266
9316
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${t}` },
@@ -9282,10 +9332,10 @@ async function Ea(e, t, a) {
9282
9332
  mimeType: c.mime_type || c.mimeType || 'image/png',
9283
9333
  };
9284
9334
  }
9285
- function $a(e) {
9286
- return $r.has(z.default.extname(e).toLowerCase());
9335
+ function Ai(e) {
9336
+ return Er.has(z.default.extname(e).toLowerCase());
9287
9337
  }
9288
- function Aa(e) {
9338
+ function qi(e) {
9289
9339
  return new Error(
9290
9340
  `Tein uploads image, video and audio files only, and ${z.default.basename(e)} is not one.`,
9291
9341
  );
@@ -9300,27 +9350,27 @@ function Ar(e) {
9300
9350
  `)
9301
9351
  )
9302
9352
  return null;
9303
- let a = z.default.resolve(t);
9304
- 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;
9305
9355
  }
9306
9356
  function lt(e) {
9307
9357
  if (Array.isArray(e))
9308
9358
  for (let t of e) {
9309
- let a = t;
9310
- typeof a.name == 'string' &&
9311
- a.inputSchema &&
9312
- typeof a.inputSchema == 'object' &&
9313
- 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);
9314
9364
  }
9315
9365
  }
9316
9366
  function qr() {
9317
- (ie.clear(), (ot = 0));
9367
+ (ae.clear(), (ot = 0));
9318
9368
  }
9319
9369
  async function Or(e, t) {
9320
9370
  if (!(Date.now() - ot < 6e4)) {
9321
9371
  ot = Date.now();
9322
9372
  try {
9323
- let i = await (
9373
+ let a = await (
9324
9374
  await fetch(e, {
9325
9375
  method: 'POST',
9326
9376
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${t}` },
@@ -9328,7 +9378,7 @@ async function Or(e, t) {
9328
9378
  signal: AbortSignal.timeout(1e4),
9329
9379
  })
9330
9380
  ).json();
9331
- lt(i.result?.tools);
9381
+ lt(a.result?.tools);
9332
9382
  } catch {}
9333
9383
  }
9334
9384
  }
@@ -9339,25 +9389,25 @@ function Rr(e) {
9339
9389
  : e.type === 'array' && e.items?.format === 'uri'
9340
9390
  : !1;
9341
9391
  }
9342
- async function Ma(e, t, a) {
9392
+ async function Ki(e, t, i) {
9343
9393
  if (typeof e != 'string') return e;
9344
- let i = Ar(e);
9345
- if (!i) return e;
9346
- if (!$a(i)) throw Aa(i);
9347
- return (await Ea(i, t, a)).url;
9348
- }
9349
- async function qa(e, t, a, i, n) {
9350
- (ie.size === 0 && lt(st()), ie.has(e) || (await Or(n, a)));
9351
- 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;
9352
9402
  if (!s) return t;
9353
9403
  let o = { ...t };
9354
9404
  for (let [u, l] of Object.entries(t))
9355
9405
  if (Rr(s[u]))
9356
9406
  if (Array.isArray(l)) {
9357
9407
  let c = [];
9358
- for (let p of l) c.push(await Ma(p, a, i));
9408
+ for (let p of l) c.push(await Ki(p, i, a));
9359
9409
  o[u] = c;
9360
- } else o[u] = await Ma(l, a, i);
9410
+ } else o[u] = await Ki(l, i, a);
9361
9411
  return o;
9362
9412
  }
9363
9413
  function Lr(e) {
@@ -9401,13 +9451,13 @@ function Lr(e) {
9401
9451
  };
9402
9452
  }
9403
9453
  }
9404
- async function Oa() {
9405
- if (Ka) return;
9406
- Ka = !0;
9407
- let e = Er(),
9454
+ async function Ri() {
9455
+ if (Si) return;
9456
+ Si = !0;
9457
+ let e = $r(),
9408
9458
  t = w(),
9409
- a = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
9410
- (Sa.default
9459
+ i = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
9460
+ (Ci.default
9411
9461
  .createInterface({ input: process.stdin, output: process.stdout, terminal: !1 })
9412
9462
  .on('line', async (n) => {
9413
9463
  let s = n.trim();
@@ -9468,8 +9518,8 @@ async function Oa() {
9468
9518
  try {
9469
9519
  let d = z.default.resolve(p.trim());
9470
9520
  if (V.default.existsSync(d) && V.default.statSync(d).isFile() && e) {
9471
- if (!$a(d)) throw Aa(d);
9472
- let m = await Ea(d, e, t),
9521
+ if (!Ai(d)) throw qi(d);
9522
+ let m = await Ei(d, e, t),
9473
9523
  y = (m.sizeBytes / 1024).toFixed(1),
9474
9524
  _e =
9475
9525
  m.mimeType.startsWith('image/') ||
@@ -9525,7 +9575,7 @@ Pass this URL to any Tein generation tool.`,
9525
9575
  }
9526
9576
  if (e)
9527
9577
  try {
9528
- o.params.arguments = await qa(String(l), c, e, t, a);
9578
+ o.params.arguments = await Oi(String(l), c, e, t, i);
9529
9579
  } catch (p) {
9530
9580
  let d = p instanceof Error ? p.message : String(p);
9531
9581
  process.stdout.write(
@@ -9550,13 +9600,13 @@ Pass this URL to any Tein generation tool.`,
9550
9600
  }
9551
9601
  if (e)
9552
9602
  try {
9553
- let l = await fetch(a, {
9603
+ let l = await fetch(i, {
9554
9604
  method: 'POST',
9555
9605
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${e}` },
9556
9606
  body: JSON.stringify(o),
9557
9607
  }),
9558
9608
  c = await l.text(),
9559
- p = Ca(o, l.status, c);
9609
+ p = $i(o, l.status, c);
9560
9610
  if (p === null) return;
9561
9611
  if (p) {
9562
9612
  (o?.method === 'tools/list' && lt(p.result?.tools),
@@ -9593,21 +9643,21 @@ Pass this URL to any Tein generation tool.`,
9593
9643
  }
9594
9644
  var V,
9595
9645
  z,
9596
- Sa,
9597
- $r,
9598
- ie,
9646
+ Ci,
9647
+ Er,
9648
+ ae,
9599
9649
  ot,
9600
- Ka,
9601
- La = h(() => {
9650
+ Si,
9651
+ Di = h(() => {
9602
9652
  'use strict';
9603
9653
  ((V = T(require('node:fs'))),
9604
9654
  (z = T(require('node:path'))),
9605
- (Sa = T(require('node:readline'))));
9655
+ (Ci = T(require('node:readline'))));
9606
9656
  et();
9607
- Ta();
9608
- $();
9657
+ Mi();
9658
+ E();
9609
9659
  re();
9610
- $r = new Set([
9660
+ Er = new Set([
9611
9661
  '.png',
9612
9662
  '.jpg',
9613
9663
  '.jpeg',
@@ -9633,20 +9683,20 @@ var V,
9633
9683
  '.flac',
9634
9684
  '.opus',
9635
9685
  ]);
9636
- ((ie = new Map()), (ot = 0));
9637
- Ka = !1;
9686
+ ((ae = new Map()), (ot = 0));
9687
+ Si = !1;
9638
9688
  require.main === module &&
9639
- Oa().catch((e) => {
9689
+ Ri().catch((e) => {
9640
9690
  (process.stderr.write(`Fatal error in Tein MCP CLI: ${e}
9641
9691
  `),
9642
9692
  process.exit(1));
9643
9693
  });
9644
9694
  });
9645
- var Ha =
9695
+ var zi =
9646
9696
  !process.env.NO_COLOR &&
9647
9697
  (process.stdout.isTTY || process.env.FORCE_COLOR === '1' || process.env.TERM !== 'dumb');
9648
9698
  function x(e, t) {
9649
- 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));
9650
9700
  }
9651
9701
  var r = {
9652
9702
  bold: x(1, 22),
@@ -9668,7 +9718,7 @@ var r = {
9668
9718
  bgCyan: x(46, 49),
9669
9719
  bgGreen: x(42, 49),
9670
9720
  },
9671
- E = class {
9721
+ $ = class {
9672
9722
  constructor(t = '') {
9673
9723
  this.frames = [
9674
9724
  '\u280B',
@@ -9692,8 +9742,8 @@ var r = {
9692
9742
  process.stdout.isTTY
9693
9743
  ? (this.stop(),
9694
9744
  (this.timer = setInterval(() => {
9695
- let a = r.cyan(this.frames[this.current]);
9696
- (process.stdout.write(`\r${a} ${this.text} `),
9745
+ let i = r.cyan(this.frames[this.current]);
9746
+ (process.stdout.write(`\r${i} ${this.text} `),
9697
9747
  (this.current = (this.current + 1) % this.frames.length));
9698
9748
  }, 80)),
9699
9749
  this)
@@ -9707,20 +9757,20 @@ var r = {
9707
9757
  }
9708
9758
  succeed(t) {
9709
9759
  this.stop();
9710
- let a = t || this.text;
9760
+ let i = t || this.text;
9711
9761
  process.stdout.isTTY
9712
- ? process.stdout.write(`\r${r.green('\u2713')} ${a}
9762
+ ? process.stdout.write(`\r${r.green('\u2713')} ${i}
9713
9763
  `)
9714
- : process.stdout.write(`[\u2713] ${a}
9764
+ : process.stdout.write(`[\u2713] ${i}
9715
9765
  `);
9716
9766
  }
9717
9767
  fail(t) {
9718
9768
  this.stop();
9719
- let a = t || this.text;
9769
+ let i = t || this.text;
9720
9770
  process.stdout.isTTY
9721
- ? process.stdout.write(`\r${r.red('\u2717')} ${a}
9771
+ ? process.stdout.write(`\r${r.red('\u2717')} ${i}
9722
9772
  `)
9723
- : process.stdout.write(`[\u2717] ${a}
9773
+ : process.stdout.write(`[\u2717] ${i}
9724
9774
  `);
9725
9775
  }
9726
9776
  stop() {
@@ -9736,7 +9786,7 @@ var ne = T(require('node:fs')),
9736
9786
  mt = T(require('node:path')),
9737
9787
  ft = require('node:stream/promises');
9738
9788
  re();
9739
- var Ya = new Set([
9789
+ var Xi = new Set([
9740
9790
  'account_suspended',
9741
9791
  'account_terminated',
9742
9792
  'creative_mode_restricted',
@@ -9744,30 +9794,30 @@ var Ya = new Set([
9744
9794
  'workspace_paused',
9745
9795
  ]),
9746
9796
  v = 1,
9747
- Xa = 3,
9797
+ Qi = 3,
9748
9798
  b = class extends Error {
9749
- constructor(t, a, i, n = {}) {
9750
- (super(a),
9799
+ constructor(t, i, a, n = {}) {
9800
+ (super(i),
9751
9801
  (this.name = 'TeinApiError'),
9752
9802
  (this.status = t),
9753
- i && (this.code = i),
9803
+ a && (this.code = a),
9754
9804
  (this.fields = n));
9755
9805
  }
9756
9806
  get exitCode() {
9757
- return this.code && Ya.has(this.code) ? Xa : v;
9807
+ return this.code && Xi.has(this.code) ? Qi : v;
9758
9808
  }
9759
9809
  };
9760
- function Qa(e, t, a) {
9761
- let i = `HTTP ${e}${t ? ` ${t}` : ''}`;
9762
- if (!a || typeof a != 'object') return new b(e, i);
9763
- 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;
9764
9814
  if (n.error && typeof n.error == 'object' && !Array.isArray(n.error)) {
9765
9815
  let p = n.error,
9766
9816
  { code: d, message: m, ...y } = p;
9767
- return new b(e, typeof m == 'string' && m ? m : i, typeof d == 'string' ? d : void 0, y);
9817
+ return new b(e, typeof m == 'string' && m ? m : a, typeof d == 'string' ? d : void 0, y);
9768
9818
  }
9769
9819
  let { error: s, code: o, message: u, ...l } = n,
9770
- c = (typeof s == 'string' && s) || (typeof u == 'string' && u) || i;
9820
+ c = (typeof s == 'string' && s) || (typeof u == 'string' && u) || a;
9771
9821
  return new b(e, c, typeof o == 'string' ? o : void 0, l);
9772
9822
  }
9773
9823
  function ct(e) {
@@ -9775,16 +9825,16 @@ function ct(e) {
9775
9825
  }
9776
9826
  function K(e) {
9777
9827
  let t = [e.message],
9778
- a = ct(e.fields.required),
9779
- i = ct(e.fields.balance);
9780
- (a || i) &&
9781
- 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(' '));
9782
9832
  let n = e.fields.org_name ?? e.fields.orgName;
9783
9833
  typeof n == 'string' && n && t.push(`Workspace: ${n}`);
9784
9834
  let s = e.fields.url ?? e.fields.appeal_url ?? e.fields.top_up_url;
9785
9835
  return (typeof s == 'string' && s && t.push(s), e.code && t.push(`(${e.code})`), t);
9786
9836
  }
9787
- function Za(e) {
9837
+ function ea(e) {
9788
9838
  return /\.(mp4|webm|mov)(\?|$)/i.test(e)
9789
9839
  ? 'video'
9790
9840
  : /\.(mp3|wav|ogg|flac)(\?|$)/i.test(e)
@@ -9793,15 +9843,15 @@ function Za(e) {
9793
9843
  }
9794
9844
  function ut(e) {
9795
9845
  let t = [];
9796
- for (let a of e.data ?? [])
9797
- typeof a.message?.content == 'string'
9798
- ? t.push({ type: 'text', text: a.message.content })
9799
- : 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 } : {}) });
9800
9850
  return t;
9801
9851
  }
9802
9852
  var M = class {
9803
- constructor(t, a) {
9804
- ((this.apiKey = t), (this.baseUrl = a.replace(/\/+$/, '')));
9853
+ constructor(t, i) {
9854
+ ((this.apiKey = t), (this.baseUrl = i.replace(/\/+$/, '')));
9805
9855
  }
9806
9856
  getHeaders() {
9807
9857
  return {
@@ -9811,58 +9861,58 @@ var M = class {
9811
9861
  'X-Tein-Client': 'cli',
9812
9862
  };
9813
9863
  }
9814
- async send(t, a, i) {
9815
- let n = await fetch(`${this.baseUrl}${a}`, {
9864
+ async send(t, i, a) {
9865
+ let n = await fetch(`${this.baseUrl}${i}`, {
9816
9866
  method: t,
9817
9867
  headers: this.getHeaders(),
9818
- ...(i === void 0 ? {} : { body: JSON.stringify(i) }),
9868
+ ...(a === void 0 ? {} : { body: JSON.stringify(a) }),
9819
9869
  });
9820
9870
  if (!n.ok) {
9821
9871
  let s = null;
9822
9872
  try {
9823
9873
  s = await n.json();
9824
9874
  } catch {}
9825
- throw Qa(n.status, n.statusText, s);
9875
+ throw Zi(n.status, n.statusText, s);
9826
9876
  }
9827
9877
  return await n.json();
9828
9878
  }
9829
9879
  async checkKey() {
9830
9880
  await this.send('GET', '/v1/jobs?limit=1');
9831
9881
  }
9832
- queueJob(t, a) {
9833
- return this.send('POST', '/v1/generate', { model: t, ...a }).then((i) => {
9834
- 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,
9835
9885
  s =
9836
9886
  n === 'succeeded' || n === 'failed' || n === 'expired' || n === 'cancelled'
9837
9887
  ? n
9838
9888
  : 'processing',
9839
- o = ut(i);
9889
+ o = ut(a);
9840
9890
  return {
9841
- request_id: i.request_id || i.id || '',
9842
- model: i.model,
9891
+ request_id: a.request_id || a.id || '',
9892
+ model: a.model,
9843
9893
  status: s,
9844
9894
  ...(o.length ? { output: o } : {}),
9845
- error: i.error && typeof i.error.message == 'string' ? i.error.message : null,
9846
- ...(i.usage ? { usage: i.usage } : {}),
9895
+ error: a.error && typeof a.error.message == 'string' ? a.error.message : null,
9896
+ ...(a.usage ? { usage: a.usage } : {}),
9847
9897
  };
9848
9898
  });
9849
9899
  }
9850
9900
  getStatus(t) {
9851
- return this.send('GET', `/v1/jobs/${encodeURIComponent(t)}`).then((a) => {
9852
- let i = a.status,
9901
+ return this.send('GET', `/v1/jobs/${encodeURIComponent(t)}`).then((i) => {
9902
+ let a = i.status,
9853
9903
  n =
9854
- i === 'succeeded' || i === 'failed' || i === 'expired' || i === 'cancelled'
9855
- ? i
9904
+ a === 'succeeded' || a === 'failed' || a === 'expired' || a === 'cancelled'
9905
+ ? a
9856
9906
  : 'processing',
9857
- s = ut(a),
9858
- 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;
9859
9909
  return {
9860
- request_id: a.id || t,
9861
- model: a.model,
9910
+ request_id: i.id || t,
9911
+ model: i.model,
9862
9912
  status: n,
9863
9913
  ...(s.length ? { output: s } : {}),
9864
9914
  error: o,
9865
- ...(a.usage ? { usage: a.usage } : {}),
9915
+ ...(i.usage ? { usage: i.usage } : {}),
9866
9916
  };
9867
9917
  });
9868
9918
  }
@@ -9870,78 +9920,78 @@ var M = class {
9870
9920
  return this.send('GET', '/v1/balance');
9871
9921
  }
9872
9922
  getUsage(t) {
9873
- let a = new URLSearchParams(t).toString();
9874
- return this.send('GET', `/v1/usage${a ? `?${a}` : ''}`);
9923
+ let i = new URLSearchParams(t).toString();
9924
+ return this.send('GET', `/v1/usage${i ? `?${i}` : ''}`);
9875
9925
  }
9876
9926
  getTransactions(t) {
9877
- let a = new URLSearchParams(t).toString();
9878
- 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}` : ''}`);
9879
9929
  }
9880
9930
  uploadAsset(t) {
9881
9931
  return this.send('POST', '/v1/upload', { data: t });
9882
9932
  }
9883
- async downloadOutput(t, a) {
9884
- let i = await fetch(t);
9885
- if (!i.ok) throw new Error(`The file could not be downloaded (HTTP ${i.status})`);
9886
- 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);
9887
9937
  ne.default.existsSync(n) || ne.default.mkdirSync(n, { recursive: !0 });
9888
- let s = ne.default.createWriteStream(a);
9889
- 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);
9890
9940
  }
9891
9941
  };
9892
- $();
9942
+ E();
9893
9943
  function Se(e) {
9894
9944
  if (typeof e != 'number' || !Number.isFinite(e)) return '';
9895
9945
  if (Math.abs(e) >= 1 || Math.abs(Number(e.toFixed(4)) - e) < 1e-12) return `$${e.toFixed(4)}`;
9896
9946
  let t = Math.max(0, 3 - Number(e.toExponential(3).split('e')[1])),
9897
- a = 10 ** t,
9898
- i = Math.round(Number((e * a).toFixed(6))) / a;
9899
- 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+$/, '')}`;
9900
9950
  }
9901
9951
  ee();
9902
- var na = ['images', 'input_images', 'videos', 'audios'];
9903
- function Wi(e) {
9904
- 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]]);
9905
9955
  }
9906
- function Yi(e) {
9956
+ function Ya(e) {
9907
9957
  if (e.startsWith('http://') || e.startsWith('https://')) return null;
9908
9958
  let t = q.default.resolve(e);
9909
9959
  return U.default.existsSync(t) && U.default.statSync(t).isFile() ? t : null;
9910
9960
  }
9911
- async function Xi(e, t) {
9912
- for (let a of na) {
9913
- if (!Array.isArray(e[a])) continue;
9914
- let i = [];
9915
- 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]) {
9916
9966
  if (typeof n != 'string') continue;
9917
- let s = Yi(n);
9918
- i.push(s ? await t(s) : n);
9967
+ let s = Ya(n);
9968
+ a.push(s ? await t(s) : n);
9919
9969
  }
9920
- e[a] = i;
9970
+ e[i] = a;
9921
9971
  }
9922
9972
  }
9923
9973
  var te = { starter: 10, plus: 25, scale: 40, enterprise: 200 };
9924
- function Qi(e) {
9974
+ function Qa(e) {
9925
9975
  if (e.count === void 0 || e.count === !0) return 1;
9926
9976
  let t = typeof e.count == 'number' ? e.count : Number(e.count),
9927
- a = te.enterprise;
9977
+ i = te.enterprise;
9928
9978
  return (
9929
- (!Number.isInteger(t) || t < 1 || t > a) &&
9979
+ (!Number.isInteger(t) || t < 1 || t > i) &&
9930
9980
  (process.stderr
9931
- .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.
9932
9982
  `),
9933
9983
  process.exit(1)),
9934
9984
  t
9935
9985
  );
9936
9986
  }
9937
- async function Zi(e, t, a, i, n) {
9987
+ async function Za(e, t, i, a, n) {
9938
9988
  n.isJson ||
9939
- process.stderr.write(`Starting ${i} ${t} jobs together...
9989
+ process.stderr.write(`Starting ${a} ${t} jobs together...
9940
9990
  `);
9941
9991
  let s = await Promise.all(
9942
- Array.from({ length: i }, async () => {
9992
+ Array.from({ length: a }, async () => {
9943
9993
  try {
9944
- return { job: await e.queueJob(t, a) };
9994
+ return { job: await e.queueJob(t, i) };
9945
9995
  } catch (l) {
9946
9996
  return { err: l };
9947
9997
  }
@@ -9964,7 +10014,7 @@ async function Zi(e, t, a, i, n) {
9964
10014
  for (; c.length;) {
9965
10015
  if ((await new Promise((d) => setTimeout(d, 2e3)), !n.isJson)) {
9966
10016
  let d = Math.round((Date.now() - l) / 1e3);
9967
- process.stderr.write(`Waiting on ${c.length} of ${i} (${d}s)...
10017
+ process.stderr.write(`Waiting on ${c.length} of ${a} (${d}s)...
9968
10018
  `);
9969
10019
  }
9970
10020
  let p = await Promise.all(
@@ -10009,15 +10059,15 @@ async function Zi(e, t, a, i, n) {
10009
10059
  o.some((l) => l.status === 'failed' || l.status === 'expired' || l.status === 'cancelled')) &&
10010
10060
  process.exit(v);
10011
10061
  }
10012
- function er(e, t, a) {
10013
- if (a <= 1) return e;
10014
- let i = q.default.extname(e);
10015
- 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}`;
10016
10066
  }
10017
- function sa(e) {
10067
+ function oi(e) {
10018
10068
  let t = {},
10019
- a = new Set(),
10020
- i = [];
10069
+ i = new Set(),
10070
+ a = [];
10021
10071
  for (let n = 0; n < e.length; n++) {
10022
10072
  let s = e[n];
10023
10073
  if (s.startsWith('--')) {
@@ -10035,7 +10085,7 @@ function sa(e) {
10035
10085
  ? (t[o.replace(/-/g, '_')] = Number(u))
10036
10086
  : (t[o.replace(/-/g, '_')] = u),
10037
10087
  n++);
10038
- } else ((t[o.replace(/-/g, '_')] = !0), a.add(o));
10088
+ } else ((t[o.replace(/-/g, '_')] = !0), i.add(o));
10039
10089
  } else if (s.startsWith('-') && s.length === 2) {
10040
10090
  let o = s[1],
10041
10091
  l =
@@ -10051,18 +10101,18 @@ function sa(e) {
10051
10101
  v: 'version',
10052
10102
  }[o] || o;
10053
10103
  o === 'j' || o === 'h' || o === 'v'
10054
- ? ((t[l] = !0), a.add(l))
10104
+ ? ((t[l] = !0), i.add(l))
10055
10105
  : n + 1 < e.length && !e[n + 1].startsWith('-')
10056
10106
  ? ((t[l] = e[n + 1]), n++)
10057
10107
  : (t[l] = !0);
10058
- } else i.push(s);
10108
+ } else a.push(s);
10059
10109
  }
10060
- 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 };
10061
10111
  }
10062
10112
  async function Qe(e, t) {
10063
- let a = S(typeof t.api_key == 'string' ? t.api_key : void 0),
10064
- i = w(typeof t.api_url == 'string' ? t.api_url : void 0);
10065
- (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 ||
10066
10116
  (process.stderr.write(`${r.red('Error:')} Authentication required.
10067
10117
  `),
10068
10118
  process.stderr
@@ -10081,7 +10131,7 @@ async function Qe(e, t) {
10081
10131
  s = !!t.json,
10082
10132
  o = !!(t.async || t.no_wait),
10083
10133
  u = typeof t.output == 'string' ? t.output : void 0,
10084
- l = Qi(t),
10134
+ l = Qa(t),
10085
10135
  c = { ...t };
10086
10136
  (delete c.json,
10087
10137
  delete c.async,
@@ -10090,14 +10140,14 @@ async function Qe(e, t) {
10090
10140
  delete c.api_key,
10091
10141
  delete c.api_url,
10092
10142
  delete c.count);
10093
- let p = ra(n, c);
10094
- (Wi(p),
10143
+ let p = ni(n, c);
10144
+ (Wa(p),
10095
10145
  typeof p.image == 'string' && !p.images && !we(n) && ((p.images = [p.image]), delete p.image),
10096
10146
  p.image_url &&
10097
10147
  !p.first_frame_image &&
10098
10148
  (e.startsWith('seedance') || e.startsWith('happy-horse')) &&
10099
10149
  (p.first_frame_image = p.image_url));
10100
- let d = new M(a, i),
10150
+ let d = new M(i, a),
10101
10151
  m = [
10102
10152
  'image',
10103
10153
  'mask_image',
@@ -10114,7 +10164,7 @@ async function Qe(e, t) {
10114
10164
  if (typeof g == 'string' && !g.startsWith('http://') && !g.startsWith('https://')) {
10115
10165
  let P = q.default.resolve(g);
10116
10166
  if (U.default.existsSync(P) && U.default.statSync(P).isFile()) {
10117
- 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...`);
10118
10168
  s || I.start();
10119
10169
  try {
10120
10170
  let N = U.default.readFileSync(P),
@@ -10134,8 +10184,8 @@ async function Qe(e, t) {
10134
10184
  }
10135
10185
  }
10136
10186
  }
10137
- await Xi(p, async (k) => {
10138
- let g = new E(`Uploading local file ${q.default.basename(k)} to CDN...`);
10187
+ await Xa(p, async (k) => {
10188
+ let g = new $(`Uploading local file ${q.default.basename(k)} to CDN...`);
10139
10189
  s || g.start();
10140
10190
  try {
10141
10191
  let P = U.default.readFileSync(k),
@@ -10153,12 +10203,12 @@ async function Qe(e, t) {
10153
10203
  process.exit(1));
10154
10204
  }
10155
10205
  });
10156
- let y = new E(`Submitting task for ${r.bold(e)}...`);
10206
+ let y = new $(`Submitting task for ${r.bold(e)}...`);
10157
10207
  s || y.start();
10158
10208
  let f;
10159
10209
  try {
10160
10210
  if (l > 1) {
10161
- await Zi(d, e, p, l, { isJson: s, isAsync: o });
10211
+ await Za(d, e, p, l, { isJson: s, isAsync: o });
10162
10212
  return;
10163
10213
  }
10164
10214
  f = await d.queueJob(e, p);
@@ -10262,7 +10312,7 @@ ${r.bold('Outputs:')}
10262
10312
  u)
10263
10313
  ) {
10264
10314
  let O = er(u, g++, k),
10265
- pt = new E(`Downloading output to ${O}...`).start();
10315
+ pt = new $(`Downloading output to ${O}...`).start();
10266
10316
  try {
10267
10317
  (await d.downloadOutput(I.url, q.default.resolve(process.cwd(), O)),
10268
10318
  pt.succeed(`Saved to ${r.bold(O)}`));
@@ -10280,8 +10330,8 @@ ${I.text}
10280
10330
  process.stdout.write(`
10281
10331
  `);
10282
10332
  }
10283
- var oa = T(require('node:readline'));
10284
- $();
10333
+ var li = T(require('node:readline'));
10334
+ E();
10285
10335
  async function tr(e) {
10286
10336
  try {
10287
10337
  return (await new M(e, w()).checkKey(), 'ok');
@@ -10293,48 +10343,48 @@ async function tr(e) {
10293
10343
  return 'unchecked';
10294
10344
  }
10295
10345
  }
10296
- function ar(e) {
10297
- let t = oa.default.createInterface({ input: process.stdin, output: process.stdout });
10298
- return new Promise((a) => {
10299
- t.question(e, (i) => {
10300
- (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()));
10301
10351
  });
10302
10352
  });
10303
10353
  }
10304
- async function ae(e, t) {
10354
+ async function ie(e, t) {
10305
10355
  switch (e) {
10306
10356
  case 'login':
10307
10357
  case 'set-key': {
10308
- let a = t?.trim() || '';
10309
- (a ||
10358
+ let i = t?.trim() || '';
10359
+ (i ||
10310
10360
  (process.stdout.write(`
10311
10361
  ${r.bold('Tein AI Authentication')}
10312
10362
  `),
10313
10363
  process.stdout.write(`Get your API key at: ${r.cyan('https://tein.ai/dashboard/keys')}
10314
10364
 
10315
10365
  `),
10316
- (a = await ar('Enter your Tein API Key (sk_live_...): '))),
10317
- !a.startsWith('sk_live_') &&
10318
- !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_') &&
10319
10369
  (process.stderr
10320
10370
  .write(`${r.red('Error:')} Invalid key format. Tein API keys start with 'sk_live_' or 'sk_test_'.
10321
10371
  `),
10322
10372
  process.exit(1)));
10323
- let i = await tr(a);
10324
- (i === 'invalid' &&
10373
+ let a = await tr(i);
10374
+ (a === 'invalid' &&
10325
10375
  (process.stderr
10326
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.
10327
10377
  `),
10328
10378
  process.exit(1)),
10329
- Ke({ apiKey: a }),
10379
+ Ke({ apiKey: i }),
10330
10380
  process.stdout.write(`
10331
10381
  ${r.green('\u2713')} API key saved to ${r.dim(oe())}
10332
10382
  `),
10333
- i === 'blocked'
10383
+ a === 'blocked'
10334
10384
  ? process.stdout
10335
10385
  .write(`${r.yellow('\u2139')} The key is valid, but this account cannot run requests right now. Check your dashboard.
10336
10386
  `)
10337
- : i === 'unchecked' &&
10387
+ : a === 'unchecked' &&
10338
10388
  process.stdout
10339
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.
10340
10390
  `),
@@ -10358,8 +10408,8 @@ ${r.green('\u2713')} API key saved to ${r.dim(oe())}
10358
10408
  break;
10359
10409
  }
10360
10410
  default: {
10361
- let a = S(),
10362
- i = w(),
10411
+ let i = S(),
10412
+ a = w(),
10363
10413
  n = j();
10364
10414
  if (
10365
10415
  (process.stdout.write(`
@@ -10367,9 +10417,9 @@ ${r.bold('Tein AI CLI Configuration')}
10367
10417
  `),
10368
10418
  process.stdout.write(` Config file: ${r.dim(oe())}
10369
10419
  `),
10370
- process.stdout.write(` API URL: ${r.cyan(i)}
10420
+ process.stdout.write(` API URL: ${r.cyan(a)}
10371
10421
  `),
10372
- !a)
10422
+ !i)
10373
10423
  )
10374
10424
  (process.stdout.write(` API Key: ${r.red('Not configured')}
10375
10425
 
@@ -10379,9 +10429,9 @@ ${r.bold('Tein AI CLI Configuration')}
10379
10429
 
10380
10430
  `));
10381
10431
  else {
10382
- let s = `${a.slice(0, 10)}...${a.slice(-4)}`;
10432
+ let s = `${i.slice(0, 10)}...${i.slice(-4)}`;
10383
10433
  process.stdout
10384
- .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'})
10385
10435
 
10386
10436
  `);
10387
10437
  }
@@ -10389,16 +10439,16 @@ ${r.bold('Tein AI CLI Configuration')}
10389
10439
  }
10390
10440
  }
10391
10441
  }
10392
- $();
10442
+ E();
10393
10443
  function _(e) {
10394
10444
  return e !== 0 && Math.abs(e) < 0.01
10395
10445
  ? `$${e.toFixed(6).replace(/0+$/, '').replace(/\.$/, '')}`
10396
10446
  : `$${e.toFixed(2)}`;
10397
10447
  }
10398
- function la(e) {
10448
+ function pi(e) {
10399
10449
  return `${e} ${e === 1 ? 'request' : 'requests'}`;
10400
10450
  }
10401
- function ir(e) {
10451
+ function ar(e) {
10402
10452
  let t = [
10403
10453
  ['Balance', _(e.balance)],
10404
10454
  ['Available to this key', _(e.available)],
@@ -10411,15 +10461,15 @@ function ir(e) {
10411
10461
  : '';
10412
10462
  t.push(['Credits from Tein', `${_(e.credits_from_tein.amount)}${n}`]);
10413
10463
  }
10414
- let a = e.key.spending_limit;
10415
- (a &&
10464
+ let i = e.key.spending_limit;
10465
+ (i &&
10416
10466
  t.push([
10417
- `Key limit (${a.period})`,
10418
- `${_(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)}` : ''}`,
10419
10469
  ]),
10420
10470
  t.push(
10421
- ['This month', `${_(e.usage.this_month.spend)} on ${la(e.usage.this_month.requests)}`],
10422
- ['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 ${pi(e.usage.this_month.requests)}`],
10472
+ ['Last 30 days', `${_(e.usage.last_30_days.spend)} on ${pi(e.usage.last_30_days.requests)}`],
10423
10473
  [
10424
10474
  'Auto top up',
10425
10475
  e.auto_top_up.enabled
@@ -10429,13 +10479,13 @@ function ir(e) {
10429
10479
  ['Workspace', `${e.workspace.name} (${e.workspace.plan.name})`],
10430
10480
  ['Key', `${e.key.name} (${e.key.env})`],
10431
10481
  ));
10432
- let i = Math.max(...t.map(([n]) => n.length));
10433
- 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}`);
10434
10484
  }
10435
- async function pa(e) {
10485
+ async function di(e) {
10436
10486
  let t = S(typeof e.api_key == 'string' ? e.api_key : void 0),
10437
- a = w(typeof e.api_url == 'string' ? e.api_url : void 0),
10438
- i = !!e.json;
10487
+ i = w(typeof e.api_url == 'string' ? e.api_url : void 0),
10488
+ a = !!e.json;
10439
10489
  t ||
10440
10490
  (process.stderr.write(`${r.red('Error:')} Authentication required.
10441
10491
  `),
@@ -10445,10 +10495,10 @@ async function pa(e) {
10445
10495
  process.exit(1));
10446
10496
  let n;
10447
10497
  try {
10448
- n = await new M(t, a).getBalance();
10498
+ n = await new M(t, i).getBalance();
10449
10499
  } catch (s) {
10450
10500
  (s instanceof b &&
10451
- (i
10501
+ (a
10452
10502
  ? process.stdout.write(
10453
10503
  JSON.stringify(
10454
10504
  { error: { code: s.code ?? null, message: s.message, ...s.fields } },
@@ -10466,7 +10516,7 @@ async function pa(e) {
10466
10516
  `),
10467
10517
  process.exit(v));
10468
10518
  }
10469
- if (i) {
10519
+ if (a) {
10470
10520
  process.stdout.write(
10471
10521
  JSON.stringify(n, null, 2) +
10472
10522
  `
@@ -10476,15 +10526,15 @@ async function pa(e) {
10476
10526
  }
10477
10527
  process.stdout.write(`
10478
10528
  ${r.bold('Tein balance')}
10479
- ${ir(n).join(`
10529
+ ${ar(n).join(`
10480
10530
  `)}
10481
10531
 
10482
10532
  `);
10483
10533
  }
10484
- $();
10485
- function da(e) {
10534
+ E();
10535
+ function ci(e) {
10486
10536
  let t = S(typeof e.api_key == 'string' ? e.api_key : void 0),
10487
- 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);
10488
10538
  return (
10489
10539
  t ||
10490
10540
  (process.stderr.write(`${r.red('Error:')} Authentication required.
@@ -10493,55 +10543,55 @@ function da(e) {
10493
10543
  .write(`Please run ${r.cyan('tein auth login')} or set ${r.cyan('TEIN_API_KEY')} environment variable.
10494
10544
  `),
10495
10545
  process.exit(1)),
10496
- new M(t, a)
10546
+ new M(t, i)
10497
10547
  );
10498
10548
  }
10499
- function ca(e, t) {
10500
- let a = {};
10501
- for (let i of t) {
10502
- let n = e[i];
10503
- (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));
10504
10554
  }
10505
- return a;
10555
+ return i;
10506
10556
  }
10507
- async function ua(e, t) {
10557
+ async function mi(e, t) {
10508
10558
  try {
10509
10559
  return await t();
10510
- } catch (a) {
10511
- (a instanceof b &&
10560
+ } catch (i) {
10561
+ (i instanceof b &&
10512
10562
  (e
10513
10563
  ? process.stdout.write(
10514
10564
  JSON.stringify(
10515
- { error: { code: a.code ?? null, message: a.message, ...a.fields } },
10565
+ { error: { code: i.code ?? null, message: i.message, ...i.fields } },
10516
10566
  null,
10517
10567
  2,
10518
10568
  ) +
10519
10569
  `
10520
10570
  `,
10521
10571
  )
10522
- : process.stderr.write(`${r.red('Error:')} ${K(a).join(`
10572
+ : process.stderr.write(`${r.red('Error:')} ${K(i).join(`
10523
10573
  `)}
10524
10574
  `),
10525
- process.exit(a.exitCode)),
10526
- 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)}
10527
10577
  `),
10528
10578
  process.exit(v));
10529
10579
  }
10530
10580
  }
10531
10581
  function Ze(e) {
10532
- let t = e[0].map((i, n) => Math.max(...e.map((s) => s[n].length))),
10533
- 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]));
10534
10584
  return e.map(
10535
- (i) =>
10536
- ` ${i
10537
- .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])))
10538
10588
  .join(' ')
10539
10589
  .trimEnd()}`,
10540
10590
  );
10541
10591
  }
10542
10592
  function rr(e) {
10543
10593
  let t = e.summary,
10544
- a = [
10594
+ i = [
10545
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}` : ''}`,
10546
10596
  ` Spent ${_(t.spend)} on ${t.requests} requests (${t.succeeded} succeeded, ${t.failed} failed${t.running ? `, ${t.running} running` : ''})`,
10547
10597
  ` Daily burn ${_(t.daily_burn)}`,
@@ -10549,31 +10599,31 @@ function rr(e) {
10549
10599
  ];
10550
10600
  return (
10551
10601
  e.by_channel.length &&
10552
- (a.push('', r.bold('By channel')),
10553
- a.push(
10602
+ (i.push('', r.bold('By channel')),
10603
+ i.push(
10554
10604
  ...Ze([
10555
10605
  ['Channel', 'Spend', 'Requests'],
10556
- ...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)]),
10557
10607
  ]),
10558
10608
  )),
10559
10609
  e.by_model.length &&
10560
- (a.push('', r.bold('By model')),
10561
- a.push(
10610
+ (i.push('', r.bold('By model')),
10611
+ i.push(
10562
10612
  ...Ze([
10563
10613
  ['Model', 'Spend', 'Requests', 'Failed'],
10564
- ...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)]),
10565
10615
  ]),
10566
10616
  )),
10567
- a
10617
+ i
10568
10618
  );
10569
10619
  }
10570
- async function ma(e) {
10620
+ async function fi(e) {
10571
10621
  let t = !!e.json,
10572
- a = da(e),
10573
- 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'])));
10574
10624
  if (t) {
10575
10625
  process.stdout.write(
10576
- JSON.stringify(i, null, 2) +
10626
+ JSON.stringify(a, null, 2) +
10577
10627
  `
10578
10628
  `,
10579
10629
  );
@@ -10581,7 +10631,7 @@ async function ma(e) {
10581
10631
  }
10582
10632
  process.stdout.write(`
10583
10633
  ${r.bold('Tein usage')}
10584
- ${rr(i).join(`
10634
+ ${rr(a).join(`
10585
10635
  `)}
10586
10636
 
10587
10637
  `);
@@ -10599,74 +10649,74 @@ function nr(e) {
10599
10649
  ])
10600
10650
  : [' No transactions yet.'];
10601
10651
  }
10602
- async function fa(e) {
10652
+ async function gi(e) {
10603
10653
  let t = !!e.json,
10604
- a = da(e),
10605
- 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'])));
10606
10656
  if (t) {
10607
10657
  process.stdout.write(
10608
- JSON.stringify(i, null, 2) +
10658
+ JSON.stringify(a, null, 2) +
10609
10659
  `
10610
10660
  `,
10611
10661
  );
10612
10662
  return;
10613
10663
  }
10614
10664
  let n =
10615
- i.has_more && i.next_cursor
10665
+ a.has_more && a.next_cursor
10616
10666
  ? `
10617
- More: tein transactions --after ${i.next_cursor}`
10667
+ More: tein transactions --after ${a.next_cursor}`
10618
10668
  : '';
10619
10669
  process.stdout.write(`
10620
10670
  ${r.bold('Tein balance history')}
10621
- ${nr(i).join(`
10671
+ ${nr(a).join(`
10622
10672
  `)}${n}
10623
10673
 
10624
10674
  `);
10625
10675
  }
10626
- $();
10676
+ E();
10627
10677
  Ce();
10628
10678
  ee();
10629
10679
  var sr = 3e3;
10630
- async function ga(e) {
10680
+ async function hi(e) {
10631
10681
  try {
10632
10682
  let t = await fetch(`${w(e)}/v1/pricing`, { signal: AbortSignal.timeout(sr) });
10633
10683
  if (!t.ok) return;
10634
- let a = await t.json(),
10635
- i = {};
10636
- for (let n of a.configs ?? []) {
10684
+ let i = await t.json(),
10685
+ a = {};
10686
+ for (let n of i.configs ?? []) {
10637
10687
  let s = String(n.modelSlug ?? '');
10638
- J.has(s) && (i[s] ??= []).push(Number(n.starterPrice));
10688
+ J.has(s) && (a[s] ??= []).push(Number(n.starterPrice));
10639
10689
  }
10640
- Qt(i);
10690
+ Zt(a);
10641
10691
  } catch {}
10642
10692
  }
10643
10693
  var or = new Set(['video', 'image', 'text', 'audio', '3d']),
10644
10694
  lr = { llm: 'text', chat: 'text', reasoning: 'text' };
10645
- async function ha(e, t) {
10646
- await ga(t);
10647
- let a = D();
10695
+ async function yi(e, t) {
10696
+ await hi(t);
10697
+ let i = D();
10648
10698
  if (e) {
10649
10699
  let s = e.toLowerCase(),
10650
10700
  o = lr[s] ?? s;
10651
- a = or.has(o)
10652
- ? a.filter((u) => u.category.toLowerCase() === o)
10653
- : 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));
10654
10704
  }
10655
10705
  (process.stdout.write(`
10656
- ${r.bold('Tein AI Models Catalog')} (${a.length} available)
10706
+ ${r.bold('Tein AI Models Catalog')} (${i.length} available)
10657
10707
  `),
10658
10708
  process.stdout
10659
10709
  .write(`${r.dim('Run `tein info <model-slug>` to see detailed parameters and options.')}
10660
10710
 
10661
10711
  `));
10662
- let i = {};
10663
- for (let s of a) {
10712
+ let a = {};
10713
+ for (let s of i) {
10664
10714
  let o = s.category;
10665
- (i[o] || (i[o] = []), i[o].push(s));
10715
+ (a[o] || (a[o] = []), a[o].push(s));
10666
10716
  }
10667
10717
  let n = ['Video', 'Image', 'Text', 'Audio', '3D'];
10668
10718
  for (let s of n) {
10669
- let o = i[s];
10719
+ let o = a[s];
10670
10720
  if (!(!o || o.length === 0)) {
10671
10721
  process.stdout.write(`${r.bold(r.cyan(`\u2500\u2500 ${s} Models \u2500\u2500`))}
10672
10722
  `);
@@ -10686,55 +10736,55 @@ ${r.bold('Tein AI Models Catalog')} (${a.length} available)
10686
10736
 
10687
10737
  `);
10688
10738
  }
10689
- async function ya(e, t) {
10690
- J.has(e) && (await ga(t));
10691
- let a = H(e);
10692
- (a ||
10739
+ async function bi(e, t) {
10740
+ J.has(e) && (await hi(t));
10741
+ let i = H(e);
10742
+ (i ||
10693
10743
  (process.stderr.write(`${r.red('Error:')} Model "${e}" not found in Tein AI registry.
10694
10744
  `),
10695
10745
  process.stderr.write(`Run ${r.cyan('tein models')} to see all available model slugs.
10696
10746
  `),
10697
10747
  process.exit(1)),
10698
10748
  process.stdout.write(`
10699
- ${r.bold(r.cyan(a.name))} (${r.bold(a.slug)})
10749
+ ${r.bold(r.cyan(i.name))} (${r.bold(i.slug)})
10700
10750
  `),
10701
- process.stdout.write(` ${r.gray(a.description)}
10751
+ process.stdout.write(` ${r.gray(i.description)}
10702
10752
 
10703
10753
  `),
10704
10754
  process.stdout.write(`${r.bold('Metadata:')}
10705
10755
  `),
10706
- process.stdout.write(` Category: ${r.yellow(a.category)}
10756
+ process.stdout.write(` Category: ${r.yellow(i.category)}
10707
10757
  `),
10708
- process.stdout.write(` Kind: ${a.kind}
10758
+ process.stdout.write(` Kind: ${i.kind}
10709
10759
  `),
10710
- process.stdout.write(` Vendor: ${a.vendor}
10760
+ process.stdout.write(` Vendor: ${i.vendor}
10711
10761
  `),
10712
- process.stdout.write(` Pricing: ${r.green(a.priceFormatted)}
10762
+ process.stdout.write(` Pricing: ${r.green(i.priceFormatted)}
10713
10763
 
10714
10764
  `),
10715
10765
  process.stdout.write(`${r.bold('Parameters:')}
10716
10766
  `));
10717
- for (let i of a.parameters) {
10718
- let n = i.required ? r.red('(required)') : r.dim('(optional)'),
10719
- 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}]`) : '';
10720
10770
  (process.stdout
10721
- .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}
10722
10772
  `),
10723
- i.description &&
10724
- process.stdout.write(` ${r.gray(i.description)}
10773
+ a.description &&
10774
+ process.stdout.write(` ${r.gray(a.description)}
10725
10775
  `),
10726
- i.options &&
10727
- i.options.length > 0 &&
10728
- 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(', '))}
10729
10779
  `),
10730
- (i.min !== void 0 || i.max !== void 0) &&
10731
- 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 ?? ''}
10732
10782
  `),
10733
10783
  process.stdout.write(`
10734
10784
  `));
10735
10785
  }
10736
10786
  if (
10737
- (a.parameters.some((i) => i.name === 'callback_url') ||
10787
+ (i.parameters.some((a) => a.name === 'callback_url') ||
10738
10788
  (process.stdout
10739
10789
  .write(` ${r.bold('--callback-url')} ${r.yellow('<string>')} ${r.dim('(optional)')}
10740
10790
  `),
@@ -10744,33 +10794,33 @@ ${r.bold(r.cyan(a.name))} (${r.bold(a.slug)})
10744
10794
  `)),
10745
10795
  process.stdout.write(`${r.bold('Sample CLI Usage:')}
10746
10796
  `),
10747
- a.category === 'Video')
10797
+ i.category === 'Video')
10748
10798
  )
10749
10799
  process.stdout
10750
- .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`)}
10751
10801
 
10752
10802
  `);
10753
- else if (a.category === 'Image') {
10754
- 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' : '';
10755
10805
  process.stdout
10756
- .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`)}
10757
10807
 
10758
10808
  `);
10759
10809
  } else
10760
- a.category === 'Audio'
10810
+ i.category === 'Audio'
10761
10811
  ? process.stdout
10762
- .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`)}
10763
10813
 
10764
10814
  `)
10765
10815
  : process.stdout
10766
- .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"`)}
10767
10817
 
10768
10818
  `);
10769
10819
  }
10770
- $();
10820
+ E();
10771
10821
  et();
10772
10822
  var pr = 1e4,
10773
- at = {
10823
+ it = {
10774
10824
  price: '',
10775
10825
  creativeMode: 'Creative mode',
10776
10826
  priority: 'Priority',
@@ -10780,7 +10830,7 @@ var pr = 1e4,
10780
10830
  priorityDraft: 'Priority + Draft',
10781
10831
  creativeModePriorityDraft: 'Creative mode + Priority + Draft',
10782
10832
  },
10783
- dr = Object.keys(at),
10833
+ dr = Object.keys(it),
10784
10834
  cr = {
10785
10835
  creativeMode: 'unfiltered',
10786
10836
  creativeModePriority: 'unfilteredPriority',
@@ -10788,46 +10838,46 @@ var pr = 1e4,
10788
10838
  creativeModePriorityDraft: 'unfilteredPriorityDraft',
10789
10839
  };
10790
10840
  function ur(e, t) {
10791
- let a = cr[t];
10792
- return e[t] ?? (a ? e[a] : void 0);
10841
+ let i = cr[t];
10842
+ return e[t] ?? (i ? e[i] : void 0);
10793
10843
  }
10794
10844
  async function mr(e, t) {
10795
- let a = `${w(e)}${xe(t)}`,
10796
- i;
10845
+ let i = `${w(e)}${xe(t)}`,
10846
+ a;
10797
10847
  try {
10798
- i = await fetch(a, { signal: AbortSignal.timeout(pr) });
10848
+ a = await fetch(i, { signal: AbortSignal.timeout(pr) });
10799
10849
  } catch {
10800
- throw new Error(`Could not reach ${a}`);
10850
+ throw new Error(`Could not reach ${i}`);
10801
10851
  }
10802
- let n = await i.json().catch(() => null);
10803
- 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) {
10804
10854
  let s =
10805
10855
  n && typeof n.error == 'string'
10806
10856
  ? n.error
10807
10857
  : n && typeof n.error == 'object' && n.error?.message
10808
10858
  ? n.error.message
10809
- : `Pricing request failed (${i.status})`;
10859
+ : `Pricing request failed (${a.status})`;
10810
10860
  throw new Error(s);
10811
10861
  }
10812
10862
  return n;
10813
10863
  }
10814
10864
  function tt(e) {
10815
10865
  let t = e.toFixed(4).replace(/0+$/, '').replace(/\.$/, ''),
10816
- [a, i = ''] = t.split('.');
10817
- return `$${a}.${i.padEnd(2, '0')}`;
10866
+ [i, a = ''] = t.split('.');
10867
+ return `$${i}.${a.padEnd(2, '0')}`;
10818
10868
  }
10819
- function it(e) {
10869
+ function at(e) {
10820
10870
  if (!e || typeof e.starter != 'number') return null;
10821
10871
  let t = typeof e.plus == 'number' ? e.plus : e.starter,
10822
- a = typeof e.scale == 'number' ? e.scale : t;
10823
- 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)}`;
10824
10874
  }
10825
10875
  function fr(e) {
10826
10876
  if (typeof e.label == 'string' && e.label.trim()) return e.label.trim();
10827
10877
  let t = [];
10828
- for (let a of ['endpoint', 'resolution', 'quality', 'mode', 'task', 'component', 'token']) {
10829
- let i = e[a];
10830
- 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));
10831
10881
  }
10832
10882
  return (
10833
10883
  e.withVideo === !0 && t.push('with video'),
@@ -10835,54 +10885,54 @@ function fr(e) {
10835
10885
  );
10836
10886
  }
10837
10887
  function gr(e, t) {
10838
- let a = fr(e);
10839
- for (let i of dr) {
10840
- let n = it(ur(e, i));
10888
+ let i = fr(e);
10889
+ for (let a of dr) {
10890
+ let n = at(ur(e, a));
10841
10891
  if (!n) continue;
10842
- let s = at[i] ? ` (${at[i]})` : '';
10843
- t.push(` ${a}${s} ${n}`);
10892
+ let s = it[a] ? ` (${it[a]})` : '';
10893
+ t.push(` ${i}${s} ${n}`);
10844
10894
  }
10845
10895
  }
10846
10896
  function hr(e, t) {
10847
- let a = e.quality ? ` quality=${e.quality}` : '';
10897
+ let i = e.quality ? ` quality=${e.quality}` : '';
10848
10898
  t.push(
10849
- ` ${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}`)}`,
10850
10900
  );
10851
10901
  for (let n of e.variants ?? []) gr(n, t);
10852
- let i = e.addons;
10853
- if (Array.isArray(i))
10854
- for (let n of i) {
10902
+ let a = e.addons;
10903
+ if (Array.isArray(a))
10904
+ for (let n of a) {
10855
10905
  if (!n || typeof n != 'object') continue;
10856
10906
  let s = n,
10857
10907
  o = typeof s.label == 'string' ? s.label : String(s.id ?? 'add-on'),
10858
- u = it(s.price);
10908
+ u = at(s.price);
10859
10909
  u && t.push(` ${o} (add-on) ${u}`);
10860
10910
  }
10861
10911
  t.push('');
10862
10912
  }
10863
10913
  function yr(e) {
10864
10914
  let t = [],
10865
- a = e.board.checked ? ` \xB7 checked ${e.board.checked}` : '';
10866
- (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}`),
10867
10917
  t.push(
10868
10918
  `${r.dim('Starter, Plus and Scale. Creative mode, Priority and draft show only where published.')}`,
10869
10919
  ),
10870
10920
  t.push(''));
10871
- let i = new Map();
10921
+ let a = new Map();
10872
10922
  for (let l of e.board.models) {
10873
10923
  let c = l.kind || 'other',
10874
- p = i.get(c) ?? [];
10875
- (p.push(l), i.set(c, p));
10924
+ p = a.get(c) ?? [];
10925
+ (p.push(l), a.set(c, p));
10876
10926
  }
10877
10927
  let n = ['video', 'image', 'audio', 'llm', 'text', '3d'],
10878
- s = [...i.keys()].sort((l, c) => {
10928
+ s = [...a.keys()].sort((l, c) => {
10879
10929
  let p = n.indexOf(l),
10880
10930
  d = n.indexOf(c);
10881
10931
  return (p === -1 ? 99 : p) - (d === -1 ? 99 : d);
10882
10932
  });
10883
10933
  for (let l of s) {
10884
10934
  t.push(`${r.bold(r.cyan(`\u2500\u2500 ${l} \u2500\u2500`))}`);
10885
- for (let c of i.get(l) ?? []) hr(c, t);
10935
+ for (let c of a.get(l) ?? []) hr(c, t);
10886
10936
  }
10887
10937
  let o = new Set(e.board.models.map((l) => l.slug.toLowerCase())),
10888
10938
  u = (e.configs ?? []).filter((l) => !o.has(String(l.modelSlug ?? '').toLowerCase()));
@@ -10899,7 +10949,7 @@ function yr(e) {
10899
10949
  t.push(` ${r.bold(c.padEnd(26))} ${r.gray(d)}`);
10900
10950
  for (let m of p) {
10901
10951
  let y = String(m.displayLabel ?? m.billingUnit ?? 'price'),
10902
- f = it(m.prices);
10952
+ f = at(m.prices);
10903
10953
  f && t.push(` ${y} ${f}`);
10904
10954
  }
10905
10955
  t.push('');
@@ -10912,13 +10962,13 @@ function yr(e) {
10912
10962
  `
10913
10963
  );
10914
10964
  }
10915
- async function ba(e) {
10965
+ async function ki(e) {
10916
10966
  let t;
10917
10967
  try {
10918
10968
  t = await mr(e.apiUrl, e.model);
10919
- } catch (a) {
10920
- let i = a instanceof Error ? a.message : String(a);
10921
- (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}
10922
10972
  `),
10923
10973
  process.exit(1));
10924
10974
  }
@@ -10929,12 +10979,12 @@ async function ba(e) {
10929
10979
  : yr(t),
10930
10980
  );
10931
10981
  }
10932
- var ka = T(require('node:path'));
10933
- $();
10934
- async function wa(e, t) {
10935
- let a = S(typeof t.api_key == 'string' ? t.api_key : void 0),
10936
- i = w(typeof t.api_url == 'string' ? t.api_url : void 0);
10937
- (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 ||
10938
10988
  (process.stderr.write(`${r.red('Error:')} Authentication required.
10939
10989
  `),
10940
10990
  process.stderr
@@ -10950,8 +11000,8 @@ async function wa(e, t) {
10950
11000
  let n = !!t.json,
10951
11001
  s = !!t.wait,
10952
11002
  o = typeof t.output == 'string' ? t.output : void 0,
10953
- u = new M(a, i),
10954
- l = new E(`Checking status of ${r.bold(e)}...`);
11003
+ u = new M(i, a),
11004
+ l = new $(`Checking status of ${r.bold(e)}...`);
10955
11005
  n || l.start();
10956
11006
  let c;
10957
11007
  try {
@@ -11024,9 +11074,9 @@ ${r.bold('Outputs:')}
11024
11074
  `),
11025
11075
  o)
11026
11076
  ) {
11027
- let d = new E(`Downloading output to ${o}...`).start();
11077
+ let d = new $(`Downloading output to ${o}...`).start();
11028
11078
  try {
11029
- (await u.downloadOutput(p.url, ka.default.resolve(process.cwd(), o)),
11079
+ (await u.downloadOutput(p.url, wi.default.resolve(process.cwd(), o)),
11030
11080
  d.succeed(`Saved to ${r.bold(o)}`));
11031
11081
  } catch (m) {
11032
11082
  d.fail(`Failed to download: ${m instanceof Error ? m.message : m}`);
@@ -11043,12 +11093,12 @@ ${p.text}
11043
11093
  }
11044
11094
  var rt = T(require('node:fs')),
11045
11095
  nt = T(require('node:path'));
11046
- $();
11047
- async function xa(e, t = {}) {
11048
- let a = S(typeof t.api_key == 'string' ? t.api_key : void 0),
11049
- 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),
11050
11100
  n = !!t.json;
11051
- (a ||
11101
+ (i ||
11052
11102
  (process.stderr.write(`${r.red('Error:')} Authentication required.
11053
11103
  `),
11054
11104
  process.stderr
@@ -11068,8 +11118,8 @@ async function xa(e, t = {}) {
11068
11118
  process.exit(1));
11069
11119
  let o = nt.default.basename(s),
11070
11120
  l = rt.default.readFileSync(s).toString('base64'),
11071
- c = new M(a, i),
11072
- p = new E(`Uploading ${r.bold(o)} to Tein AI CDN...`);
11121
+ c = new M(i, a),
11122
+ p = new $(`Uploading ${r.bold(o)} to Tein AI CDN...`);
11073
11123
  n || p.start();
11074
11124
  try {
11075
11125
  let d = await c.uploadAsset(l);
@@ -11111,7 +11161,7 @@ ${r.bold('CDN URL:')} ${r.green(d.url)}
11111
11161
  re();
11112
11162
  ee();
11113
11163
  Le();
11114
- function Da() {
11164
+ function Vi() {
11115
11165
  process.stdout.write(`
11116
11166
  ${r.bold(r.cyan('Tein AI CLI'))} - Official Command-Line Interface for Tein AI models
11117
11167
 
@@ -11195,9 +11245,9 @@ ${r.bold('EXAMPLES:')}
11195
11245
  }
11196
11246
  async function Dr() {
11197
11247
  let e = process.argv.slice(2),
11198
- t = sa(e);
11248
+ t = oi(e);
11199
11249
  if (t.flags.has('help') || t.options.help || t.command === 'help') {
11200
- Da();
11250
+ Vi();
11201
11251
  return;
11202
11252
  }
11203
11253
  if (t.flags.has('version') || t.options.version || t.command === 'version') {
@@ -11207,32 +11257,32 @@ async function Dr() {
11207
11257
  }
11208
11258
  switch (t.command) {
11209
11259
  case 'auth': {
11210
- await ae(t.subcommand, t.options.key);
11260
+ await ie(t.subcommand, t.options.key);
11211
11261
  break;
11212
11262
  }
11213
11263
  case 'login': {
11214
- await ae('login', t.options.key);
11264
+ await ie('login', t.options.key);
11215
11265
  break;
11216
11266
  }
11217
11267
  case 'logout': {
11218
- await ae('logout');
11268
+ await ie('logout');
11219
11269
  break;
11220
11270
  }
11221
11271
  case 'whoami': {
11222
- await ae('status');
11272
+ await ie('status');
11223
11273
  break;
11224
11274
  }
11225
11275
  case 'models':
11226
11276
  case 'list': {
11227
- 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);
11228
11278
  break;
11229
11279
  }
11230
11280
  case 'pricing':
11231
11281
  case 'prices': {
11232
- let a = t.options.model,
11233
- i = t.subcommand || (typeof a == 'string' ? a : void 0);
11234
- await ba({
11235
- model: i,
11282
+ let i = t.options.model,
11283
+ a = t.subcommand || (typeof i == 'string' ? i : void 0);
11284
+ await ki({
11285
+ model: a,
11236
11286
  json: !!t.options.json,
11237
11287
  apiUrl: typeof t.options.api_url == 'string' ? t.options.api_url : void 0,
11238
11288
  });
@@ -11246,41 +11296,41 @@ async function Dr() {
11246
11296
  process.stderr.write(`Usage: ${r.cyan('tein info <model-slug>')}
11247
11297
  `),
11248
11298
  process.exit(1)),
11249
- 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));
11250
11300
  break;
11251
11301
  }
11252
11302
  case 'upload': {
11253
- let a = t.subcommand || '';
11254
- await xa(a, t.options);
11303
+ let i = t.subcommand || '';
11304
+ await _i(i, t.options);
11255
11305
  break;
11256
11306
  }
11257
11307
  case 'run':
11258
11308
  case 'generate': {
11259
- let a = t.subcommand || '';
11260
- await Qe(a, t.options);
11309
+ let i = t.subcommand || '';
11310
+ await Qe(i, t.options);
11261
11311
  break;
11262
11312
  }
11263
11313
  case 'status': {
11264
- let a = t.subcommand || '';
11265
- await wa(a, t.options);
11314
+ let i = t.subcommand || '';
11315
+ await xi(i, t.options);
11266
11316
  break;
11267
11317
  }
11268
11318
  case 'balance': {
11269
- await pa(t.options);
11319
+ await di(t.options);
11270
11320
  break;
11271
11321
  }
11272
11322
  case 'usage': {
11273
- await ma(t.options);
11323
+ await fi(t.options);
11274
11324
  break;
11275
11325
  }
11276
11326
  case 'transactions':
11277
11327
  case 'history': {
11278
- await fa(t.options);
11328
+ await gi(t.options);
11279
11329
  break;
11280
11330
  }
11281
11331
  case 'mcp': {
11282
- let { startStdioServer: a } = await Promise.resolve().then(() => (La(), Ra));
11283
- await a();
11332
+ let { startStdioServer: i } = await Promise.resolve().then(() => (Di(), Li));
11333
+ await i();
11284
11334
  break;
11285
11335
  }
11286
11336
  default: {
@@ -11295,7 +11345,7 @@ Run ${r.cyan('tein --help')} for the commands, or ${r.cyan('tein models')} for t
11295
11345
  await Qe(t.command, t.options));
11296
11346
  return;
11297
11347
  }
11298
- Da();
11348
+ Vi();
11299
11349
  break;
11300
11350
  }
11301
11351
  }