@teinai/cli 1.1.15 → 1.1.16

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 +129 -58
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -67,16 +67,16 @@ function ie() {
67
67
  return D;
68
68
  }
69
69
  var C,
70
- ze,
70
+ He,
71
71
  ge,
72
72
  te,
73
73
  D,
74
74
  E = b(() => {
75
75
  'use strict';
76
76
  ((C = I(require('node:fs'))),
77
- (ze = I(require('node:os'))),
77
+ (He = I(require('node:os'))),
78
78
  (ge = I(require('node:path'))),
79
- (te = ge.default.join(ze.default.homedir(), '.tein')),
79
+ (te = ge.default.join(He.default.homedir(), '.tein')),
80
80
  (D = ge.default.join(te, 'config.json')));
81
81
  });
82
82
  var pi,
@@ -89,10 +89,10 @@ var pi,
89
89
  (Ye =
90
90
  'The medium endpoint renders non-square images at 1K only. Use resolution 1K, aspect_ratio 1:1, or the dynamic endpoint for a non-square 2K or 4K image.'));
91
91
  });
92
- var B,
92
+ var F,
93
93
  be = b(() => {
94
94
  'use strict';
95
- B = new Set(['nano-banana-2.1', 'seedance-2-lite', 'seedance-2-5-lite']);
95
+ F = new Set(['nano-banana-2.1', 'seedance-2-lite', 'seedance-2-5-lite']);
96
96
  });
97
97
  function we(e) {
98
98
  return !1;
@@ -140,6 +140,7 @@ var re,
140
140
  { slug: 'happy-horse', name: 'HappyHorse', models: ['happy-horse-1-1', 'happy-horse-1-0'] },
141
141
  { slug: 'minimax', name: 'Hailuo', models: ['minimax-h3', 'minimax-h3-turbo'] },
142
142
  { slug: 'qwen', name: 'Qwen', models: ['qwen-3', 'qwen-3-pro'] },
143
+ { slug: 'z-image', name: 'Z Image', models: ['z-image-pro'] },
143
144
  {
144
145
  slug: 'nano-banana',
145
146
  name: 'Nano Banana',
@@ -1562,6 +1563,37 @@ var re,
1562
1563
  axes: { resolution: ['1K', '2K'] },
1563
1564
  from: { variant: '1k' },
1564
1565
  },
1566
+ {
1567
+ slug: 'z-image-pro',
1568
+ name: 'Z Image Pro',
1569
+ family: 'z-image',
1570
+ vendor: 'Alibaba',
1571
+ desc: "Alibaba's Z Image Pro \u2014 photoreal text-to-image at 1K or 2K for the same price, with Creative mode. Text to image only: no reference images or edits.",
1572
+ kind: 'image',
1573
+ unit: '/img',
1574
+ api: { model: 'z-image-pro' },
1575
+ variants: [
1576
+ {
1577
+ id: '1k',
1578
+ price: { starter: 0.0232, plus: 0.022, scale: 0.0206 },
1579
+ label: '1K',
1580
+ resolution: '1K',
1581
+ unfiltered: { starter: 0.0243, plus: 0.0231, scale: 0.0216 },
1582
+ },
1583
+ {
1584
+ id: '2k',
1585
+ price: { starter: 0.0232, plus: 0.022, scale: 0.0206 },
1586
+ label: '2K',
1587
+ resolution: '2K',
1588
+ unfiltered: { starter: 0.0243, plus: 0.0231, scale: 0.0216 },
1589
+ },
1590
+ ],
1591
+ unfiltered: 0.05,
1592
+ priority: null,
1593
+ draft: null,
1594
+ axes: { resolution: ['1K', '2K'] },
1595
+ from: { variant: '1k' },
1596
+ },
1565
1597
  {
1566
1598
  slug: 'nano-banana-2',
1567
1599
  name: 'Nano Banana 2',
@@ -4656,7 +4688,7 @@ function ui(e, t) {
4656
4688
  function fi(e, t) {
4657
4689
  return ae.has(e) && !(mi.has(e) && t) ? e : ui(e, t);
4658
4690
  }
4659
- function F(e, t) {
4691
+ function G(e, t) {
4660
4692
  let i = fi(e, t);
4661
4693
  return i ? (ae.get(i) ?? null) : null;
4662
4694
  }
@@ -4855,7 +4887,7 @@ function ct(e) {
4855
4887
  return `$${e}`;
4856
4888
  }
4857
4889
  function Me(e, t, i) {
4858
- return F(e)?.variants.find((n) => n.endpoint === t && n.component === i)?.price.starter ?? null;
4890
+ return G(e)?.variants.find((n) => n.endpoint === t && n.component === i)?.price.starter ?? null;
4859
4891
  }
4860
4892
  function bi(e) {
4861
4893
  return [
@@ -4951,15 +4983,22 @@ var mt = b(() => {
4951
4983
  dt();
4952
4984
  V();
4953
4985
  });
4954
- var G,
4986
+ var J,
4955
4987
  le,
4956
4988
  Ke = b(() => {
4957
4989
  'use strict';
4958
- ((G = ['seedance-2-5', 'seedance-2', 'seedance-2-mini', 'seedream-5-pro', 'wan-3-0']),
4990
+ ((J = [
4991
+ 'seedance-2-5',
4992
+ 'seedance-2',
4993
+ 'seedance-2-mini',
4994
+ 'seedream-5-pro',
4995
+ 'wan-3-0',
4996
+ 'z-image-pro',
4997
+ ]),
4959
4998
  (le =
4960
4999
  'a request with creative_mode: true answers 503 checkpoint_unavailable and nothing is charged'));
4961
5000
  });
4962
- function J(e) {
5001
+ function z(e) {
4963
5002
  return `$${Number(e.toFixed(5))}`;
4964
5003
  }
4965
5004
  function vi(e) {
@@ -4975,23 +5014,23 @@ function vi(e) {
4975
5014
  r = i('input'),
4976
5015
  n = i('output');
4977
5016
  return r && n
4978
- ? `${J(r.price.starter)}/M in \xB7 ${J(n.price.starter)}/M out`
4979
- : `from ${J(se(e).price.starter)}/M tokens`;
5017
+ ? `${z(r.price.starter)}/M in \xB7 ${z(n.price.starter)}/M out`
5018
+ : `from ${z(se(e).price.starter)}/M tokens`;
4980
5019
  }
4981
- return `from ${J(se(e).price.starter)}${e.unit}`;
5020
+ return `from ${z(se(e).price.starter)}${e.unit}`;
4982
5021
  }
4983
5022
  function Ii(e, t) {
4984
5023
  let i = t.filter((r) => Number.isFinite(r) && r > 0);
4985
- return i.length ? `from ${J(Math.min(...i))}${e}` : null;
5024
+ return i.length ? `from ${z(Math.min(...i))}${e}` : null;
4986
5025
  }
4987
5026
  function yt(e) {
4988
- for (let t of B) {
5027
+ for (let t of F) {
4989
5028
  let i = de[t],
4990
5029
  r = i ? Ii(i.unit, e[t] ?? []) : null;
4991
5030
  i && r && (i.priceFormatted = r);
4992
5031
  }
4993
5032
  }
4994
- function H(e, t) {
5033
+ function N(e, t) {
4995
5034
  let i = e.axes?.resolution ?? [
4996
5035
  ...new Set(e.variants.map((r) => r.resolution).filter((r) => !!r)),
4997
5036
  ];
@@ -5020,7 +5059,7 @@ function bt(e) {
5020
5059
  }
5021
5060
  function Ti(e, t) {
5022
5061
  if (e.unfiltered == null || t.some((r) => r.name === 'creative_mode')) return t;
5023
- let i = G.includes(e.api.model);
5062
+ let i = J.includes(e.api.model);
5024
5063
  return [...t.filter((r) => !Ee.has(r.name)), i ? wt : _i];
5025
5064
  }
5026
5065
  function Se(e, t) {
@@ -5068,7 +5107,7 @@ function $e(e, t) {
5068
5107
  max: t.maxSec,
5069
5108
  description: `Video length in seconds (${t.minSec} to ${t.maxSec}).`,
5070
5109
  },
5071
- H(e),
5110
+ N(e),
5072
5111
  { name: 'aspect_ratio', type: 'select', default: t.aspects[0], options: t.aspects },
5073
5112
  ...t.references.map((i) =>
5074
5113
  i.endsWith('s')
@@ -5096,7 +5135,7 @@ function Ki(e) {
5096
5135
  default: 'low',
5097
5136
  options: e.axes?.quality ?? ['low', 'medium', 'high'],
5098
5137
  },
5099
- H(
5138
+ N(
5100
5139
  e,
5101
5140
  e.slug === 'gpt-image-2'
5102
5141
  ? `1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count. ${Ye}`
@@ -5162,7 +5201,7 @@ function Si(e) {
5162
5201
  description: 'Images to edit or use as reference (up to 14).',
5163
5202
  },
5164
5203
  { name: 'aspect_ratio', type: 'select', default: '1:1', options: [...nt(e.slug)] },
5165
- H(e),
5204
+ N(e),
5166
5205
  {
5167
5206
  name: 'n',
5168
5207
  type: 'slider',
@@ -5349,7 +5388,7 @@ function Oi(e) {
5349
5388
  return [
5350
5389
  $('Detailed description of the image to generate.'),
5351
5390
  { name: 'images', type: 'string[]', description: 'Reference images (the first is free).' },
5352
- H(e),
5391
+ N(e),
5353
5392
  {
5354
5393
  name: 'aspect_ratio',
5355
5394
  type: 'select',
@@ -5367,7 +5406,7 @@ function Oi(e) {
5367
5406
  type: 'string[]',
5368
5407
  description: 'Up to 3 reference images, each billed at the published add-on price.',
5369
5408
  },
5370
- H(e),
5409
+ N(e),
5371
5410
  {
5372
5411
  name: 'aspect_ratio',
5373
5412
  type: 'select',
@@ -5383,6 +5422,38 @@ function Oi(e) {
5383
5422
  description: 'Number of images. Each image is billed.',
5384
5423
  },
5385
5424
  ];
5425
+ case 'z-image-pro':
5426
+ return [
5427
+ $('Image prompt text: subject, scene, style, composition and lighting.'),
5428
+ N(e, 'Long edge: 1K is 1024 px, 2K is 2048 px. Same price.'),
5429
+ {
5430
+ name: 'aspect_ratio',
5431
+ type: 'select',
5432
+ default: '1:1',
5433
+ options: ['1:1', '16:9', '9:16', '4:3', '3:4', '3:2', '2:3', '21:9', '9:21'],
5434
+ },
5435
+ {
5436
+ name: 'n',
5437
+ type: 'slider',
5438
+ default: 1,
5439
+ min: 1,
5440
+ max: 10,
5441
+ description: 'Number of images (1-10). Each image is billed.',
5442
+ },
5443
+ {
5444
+ name: 'seed',
5445
+ type: 'number',
5446
+ min: 0,
5447
+ max: 2147483647,
5448
+ description: 'Random seed. The same seed does not guarantee identical results.',
5449
+ },
5450
+ {
5451
+ name: 'prompt_expansion',
5452
+ type: 'boolean',
5453
+ default: !1,
5454
+ description: 'Let the model expand and refine the prompt before generating.',
5455
+ },
5456
+ ];
5386
5457
  case 'seed-audio-1-0':
5387
5458
  return [
5388
5459
  {
@@ -5474,7 +5545,7 @@ function Li() {
5474
5545
  e[i] && Object.defineProperty(e, t, { value: e[i], enumerable: !1 });
5475
5546
  return e;
5476
5547
  }
5477
- function N(e) {
5548
+ function U(e) {
5478
5549
  return de[e] ?? null;
5479
5550
  }
5480
5551
  function Vi(e, t, i) {
@@ -5523,7 +5594,7 @@ var wi,
5523
5594
  Di,
5524
5595
  de,
5525
5596
  Ni,
5526
- z = b(() => {
5597
+ H = b(() => {
5527
5598
  'use strict';
5528
5599
  Qe();
5529
5600
  be();
@@ -6040,8 +6111,8 @@ function Rt(e) {
6040
6111
  }
6041
6112
  function Ot(e) {
6042
6113
  let t = ne().filter((s) => s.kind === e && s.unfiltered != null),
6043
- i = t.filter((s) => G.includes(s.api.model)).map((s) => s.name),
6044
- r = t.filter((s) => !G.includes(s.api.model)).map((s) => s.name);
6114
+ i = t.filter((s) => J.includes(s.api.model)).map((s) => s.name),
6115
+ r = t.filter((s) => !J.includes(s.api.model)).map((s) => s.name);
6045
6116
  return [
6046
6117
  ...(i.length
6047
6118
  ? [`${Rt(i)}: runs the Creative mode checkpoint at its published price (+5%).`]
@@ -6460,7 +6531,7 @@ var sr,
6460
6531
  'use strict';
6461
6532
  V();
6462
6533
  Ke();
6463
- z();
6534
+ H();
6464
6535
  ((sr = {
6465
6536
  type: 'string',
6466
6537
  description:
@@ -6506,12 +6577,12 @@ var sr,
6506
6577
  'lipsyncing_audio',
6507
6578
  ]);
6508
6579
  });
6509
- var zt = {};
6510
- ii(zt, {
6580
+ var Ht = {};
6581
+ ii(Ht, {
6511
6582
  forgetToolSchemas: () => wr,
6512
6583
  jsonRpcAnswer: () => jt,
6513
6584
  preprocessLocalFiles: () => Jt,
6514
- startStdioServer: () => Ht,
6585
+ startStdioServer: () => zt,
6515
6586
  });
6516
6587
  function gr(e) {
6517
6588
  let t = (i) =>
@@ -6554,7 +6625,7 @@ function hr() {
6554
6625
  return S(t >= 0 ? e[t + 1] : void 0);
6555
6626
  }
6556
6627
  async function Bt(e, t, i) {
6557
- let r = U.default.resolve(e);
6628
+ let r = j.default.resolve(e);
6558
6629
  if (!R.default.existsSync(r) || !R.default.statSync(r).isFile())
6559
6630
  throw new Error(`File not found: ${e}`);
6560
6631
  let n = R.default.readFileSync(r),
@@ -6583,11 +6654,11 @@ async function Bt(e, t, i) {
6583
6654
  };
6584
6655
  }
6585
6656
  function Ft(e) {
6586
- return yr.has(U.default.extname(e).toLowerCase());
6657
+ return yr.has(j.default.extname(e).toLowerCase());
6587
6658
  }
6588
6659
  function Gt(e) {
6589
6660
  return new Error(
6590
- `Tein uploads image, video and audio files only, and ${U.default.basename(e)} is not one.`,
6661
+ `Tein uploads image, video and audio files only, and ${j.default.basename(e)} is not one.`,
6591
6662
  );
6592
6663
  }
6593
6664
  function br(e) {
@@ -6600,7 +6671,7 @@ function br(e) {
6600
6671
  `)
6601
6672
  )
6602
6673
  return null;
6603
- let i = U.default.resolve(t);
6674
+ let i = j.default.resolve(t);
6604
6675
  return R.default.existsSync(i) && R.default.statSync(i).isFile() ? i : null;
6605
6676
  }
6606
6677
  function Be(e) {
@@ -6701,7 +6772,7 @@ function vr(e) {
6701
6772
  };
6702
6773
  }
6703
6774
  }
6704
- async function Ht() {
6775
+ async function zt() {
6705
6776
  if (Nt) return;
6706
6777
  Nt = !0;
6707
6778
  let e = hr(),
@@ -6766,7 +6837,7 @@ async function Ht() {
6766
6837
  !p.startsWith('data:')
6767
6838
  )
6768
6839
  try {
6769
- let d = U.default.resolve(p.trim());
6840
+ let d = j.default.resolve(p.trim());
6770
6841
  if (R.default.existsSync(d) && R.default.statSync(d).isFile() && e) {
6771
6842
  if (!Ft(d)) throw Gt(d);
6772
6843
  let m = await Bt(d, e, t),
@@ -6892,7 +6963,7 @@ Pass this URL to any Tein generation tool.`,
6892
6963
  `));
6893
6964
  }
6894
6965
  var R,
6895
- U,
6966
+ j,
6896
6967
  Ut,
6897
6968
  yr,
6898
6969
  Q,
@@ -6901,7 +6972,7 @@ var R,
6901
6972
  Wt = b(() => {
6902
6973
  'use strict';
6903
6974
  ((R = I(require('node:fs'))),
6904
- (U = I(require('node:path'))),
6975
+ (j = I(require('node:path'))),
6905
6976
  (Ut = I(require('node:readline'))));
6906
6977
  Re();
6907
6978
  Lt();
@@ -6935,7 +7006,7 @@ var R,
6935
7006
  ((Q = new Map()), (je = 0));
6936
7007
  Nt = !1;
6937
7008
  require.main === module &&
6938
- Ht().catch((e) => {
7009
+ zt().catch((e) => {
6939
7010
  (process.stderr.write(`Fatal error in Tein MCP CLI: ${e}
6940
7011
  `),
6941
7012
  process.exit(1));
@@ -7033,7 +7104,7 @@ var O = I(require('node:fs')),
7033
7104
  A = I(require('node:path'));
7034
7105
  var ee = I(require('node:fs')),
7035
7106
  Je = I(require('node:path')),
7036
- He = require('node:stream/promises');
7107
+ ze = require('node:stream/promises');
7037
7108
  var Z = '1.1.7';
7038
7109
  var ni = new Set([
7039
7110
  'account_suspended',
@@ -7174,7 +7245,7 @@ var M = class {
7174
7245
  let n = Je.default.dirname(i);
7175
7246
  ee.default.existsSync(n) || ee.default.mkdirSync(n, { recursive: !0 });
7176
7247
  let s = ee.default.createWriteStream(i);
7177
- return (await (0, He.pipeline)(r.body, s), i);
7248
+ return (await (0, ze.pipeline)(r.body, s), i);
7178
7249
  }
7179
7250
  };
7180
7251
  E();
@@ -7186,7 +7257,7 @@ function ye(e) {
7186
7257
  r = Math.round(Number((e * i).toFixed(6))) / i;
7187
7258
  return r >= 1 ? `$${r.toFixed(4)}` : `$${r.toFixed(t).replace(/0+$/, '')}`;
7188
7259
  }
7189
- z();
7260
+ H();
7190
7261
  var Pt = ['images', 'input_images', 'videos', 'audios'];
7191
7262
  function Ui(e) {
7192
7263
  for (let t of Pt) typeof e[t] == 'string' && (e[t] = [e[t]]);
@@ -7360,7 +7431,7 @@ async function Ae(e, t) {
7360
7431
  process.stderr.write(`Run ${a.cyan('tein models')} to list all available models.
7361
7432
  `),
7362
7433
  process.exit(1)));
7363
- let n = N(e),
7434
+ let n = U(e),
7364
7435
  s = !!t.json,
7365
7436
  o = !!(t.async || t.no_wait),
7366
7437
  u = typeof t.output == 'string' ? t.output : void 0,
@@ -7390,11 +7461,11 @@ async function Ae(e, t) {
7390
7461
  let P = new T(`Uploading local file ${A.default.basename(v)} to CDN...`);
7391
7462
  s || P.start();
7392
7463
  try {
7393
- let j = O.default.readFileSync(v),
7394
- X = await d.uploadAsset(j.toString('base64'));
7464
+ let B = O.default.readFileSync(v),
7465
+ X = await d.uploadAsset(B.toString('base64'));
7395
7466
  ((p[y] = X.url), s || P.succeed(`Uploaded ${A.default.basename(v)} to CDN`));
7396
- } catch (j) {
7397
- let X = j instanceof Error ? j.message : String(j);
7467
+ } catch (B) {
7468
+ let X = B instanceof Error ? B.message : String(B);
7398
7469
  (s
7399
7470
  ? process.stdout.write(
7400
7471
  JSON.stringify({ error: X }) +
@@ -7562,7 +7633,7 @@ async function Ji(e) {
7562
7633
  return 'unchecked';
7563
7634
  }
7564
7635
  }
7565
- function Hi(e) {
7636
+ function zi(e) {
7566
7637
  let t = Mt.default.createInterface({ input: process.stdin, output: process.stdout });
7567
7638
  return new Promise((i) => {
7568
7639
  t.question(e, (r) => {
@@ -7582,7 +7653,7 @@ ${a.bold('Tein AI Authentication')}
7582
7653
  process.stdout.write(`Get your API key at: ${a.cyan('https://tein.ai/dashboard/keys')}
7583
7654
 
7584
7655
  `),
7585
- (i = await Hi('Enter your Tein API Key (sk_live_...): '))),
7656
+ (i = await zi('Enter your Tein API Key (sk_live_...): '))),
7586
7657
  !i.startsWith('sk_live_') &&
7587
7658
  !i.startsWith('sk_test_') &&
7588
7659
  (process.stderr
@@ -7660,17 +7731,17 @@ ${a.bold('Tein AI CLI Configuration')}
7660
7731
  }
7661
7732
  E();
7662
7733
  be();
7663
- z();
7664
- var zi = 3e3;
7734
+ H();
7735
+ var Hi = 3e3;
7665
7736
  async function Kt(e) {
7666
7737
  try {
7667
- let t = await fetch(`${x(e)}/v1/pricing`, { signal: AbortSignal.timeout(zi) });
7738
+ let t = await fetch(`${x(e)}/v1/pricing`, { signal: AbortSignal.timeout(Hi) });
7668
7739
  if (!t.ok) return;
7669
7740
  let i = await t.json(),
7670
7741
  r = {};
7671
7742
  for (let n of i.configs ?? []) {
7672
7743
  let s = String(n.modelSlug ?? '');
7673
- B.has(s) && (r[s] ??= []).push(Number(n.starterPrice));
7744
+ F.has(s) && (r[s] ??= []).push(Number(n.starterPrice));
7674
7745
  }
7675
7746
  yt(r);
7676
7747
  } catch {}
@@ -7722,8 +7793,8 @@ ${a.bold('Tein AI Models Catalog')} (${i.length} available)
7722
7793
  `);
7723
7794
  }
7724
7795
  async function $t(e, t) {
7725
- B.has(e) && (await Kt(t));
7726
- let i = N(e);
7796
+ F.has(e) && (await Kt(t));
7797
+ let i = U(e);
7727
7798
  (i ||
7728
7799
  (process.stderr.write(`${a.red('Error:')} Model "${e}" not found in Tein AI registry.
7729
7800
  `),
@@ -8143,7 +8214,7 @@ ${a.bold('CDN URL:')} ${a.green(d.url)}
8143
8214
  process.exit(m ? m.exitCode : _));
8144
8215
  }
8145
8216
  }
8146
- z();
8217
+ H();
8147
8218
  Te();
8148
8219
  function Yt() {
8149
8220
  process.stdout.write(`
@@ -8278,13 +8349,13 @@ async function Ir() {
8278
8349
  break;
8279
8350
  }
8280
8351
  case 'mcp': {
8281
- let { startStdioServer: i } = await Promise.resolve().then(() => (Wt(), zt));
8352
+ let { startStdioServer: i } = await Promise.resolve().then(() => (Wt(), Ht));
8282
8353
  await i();
8283
8354
  break;
8284
8355
  }
8285
8356
  default: {
8286
8357
  if (t.command && !t.command.startsWith('-')) {
8287
- (!N(t.command) &&
8358
+ (!U(t.command) &&
8288
8359
  !oe[t.command] &&
8289
8360
  (process.stderr.write(`
8290
8361
  ${a.red('Error:')} Unknown command or model "${t.command}".
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teinai/cli",
3
- "version": "1.1.15",
3
+ "version": "1.1.16",
4
4
  "description": "Official CLI for Tein AI models (Video, Image, Audio, LLM, 3D)",
5
5
  "main": "index.js",
6
6
  "bin": {