@teinai/cli 1.1.17 → 1.1.18
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.
- package/index.js +556 -519
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
3
|
+
var ri = Object.create;
|
|
4
|
+
var he = Object.defineProperty;
|
|
5
|
+
var ai = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var ni = Object.getOwnPropertyNames;
|
|
7
|
+
var si = Object.getPrototypeOf,
|
|
8
|
+
oi = Object.prototype.hasOwnProperty;
|
|
9
9
|
var b = (e, t, i) => () => {
|
|
10
10
|
if (i) throw i[0];
|
|
11
11
|
try {
|
|
@@ -14,96 +14,96 @@ var b = (e, t, i) => () => {
|
|
|
14
14
|
throw ((i = [r]), r);
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
var
|
|
18
|
-
for (var i in t)
|
|
17
|
+
var li = (e, t) => {
|
|
18
|
+
for (var i in t) he(e, i, { get: t[i], enumerable: !0 });
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
pi = (e, t, i, r) => {
|
|
21
21
|
if ((t && typeof t == 'object') || typeof t == 'function')
|
|
22
|
-
for (let n of
|
|
23
|
-
!
|
|
22
|
+
for (let n of ni(t))
|
|
23
|
+
!oi.call(e, n) &&
|
|
24
24
|
n !== i &&
|
|
25
|
-
|
|
25
|
+
he(e, n, { get: () => t[n], enumerable: !(r = ai(t, n)) || r.enumerable });
|
|
26
26
|
return e;
|
|
27
27
|
};
|
|
28
|
-
var
|
|
29
|
-
(i = e != null ?
|
|
30
|
-
|
|
28
|
+
var _ = (e, t, i) => (
|
|
29
|
+
(i = e != null ? ri(si(e)) : {}),
|
|
30
|
+
pi(t || !e || !e.__esModule ? he(i, 'default', { value: e, enumerable: !0 }) : i, e)
|
|
31
31
|
);
|
|
32
|
-
function
|
|
32
|
+
function V() {
|
|
33
33
|
try {
|
|
34
|
-
if (C.default.existsSync(
|
|
35
|
-
let e = C.default.readFileSync(
|
|
34
|
+
if (C.default.existsSync(L)) {
|
|
35
|
+
let e = C.default.readFileSync(L, 'utf-8');
|
|
36
36
|
return JSON.parse(e);
|
|
37
37
|
}
|
|
38
38
|
} catch {}
|
|
39
39
|
return {};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function be(e) {
|
|
42
42
|
try {
|
|
43
43
|
C.default.existsSync(te) || C.default.mkdirSync(te, { recursive: !0, mode: 448 });
|
|
44
|
-
let i = { ...
|
|
45
|
-
(C.default.writeFileSync(
|
|
44
|
+
let i = { ...V(), ...e };
|
|
45
|
+
(C.default.writeFileSync(L, JSON.stringify(i, null, 2), { encoding: 'utf-8', mode: 384 }),
|
|
46
46
|
C.default.chmodSync(te, 448),
|
|
47
|
-
C.default.chmodSync(
|
|
47
|
+
C.default.chmodSync(L, 384));
|
|
48
48
|
} catch (t) {
|
|
49
|
-
throw new Error(`Failed to save config to ${
|
|
49
|
+
throw new Error(`Failed to save config to ${L}: ${t}`);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
function S(e) {
|
|
53
53
|
if (e && e.trim()) return e.trim();
|
|
54
54
|
let t = process.env.TEIN_API_KEY || process.env.TEIN_KEY;
|
|
55
55
|
if (t && t.trim()) return t.trim();
|
|
56
|
-
let i =
|
|
56
|
+
let i = V();
|
|
57
57
|
return i.apiKey && i.apiKey.trim() ? i.apiKey.trim() : '';
|
|
58
58
|
}
|
|
59
59
|
function x(e) {
|
|
60
60
|
if (e && e.trim()) return e.trim().replace(/\/+$/, '');
|
|
61
61
|
let t = process.env.TEIN_API_URL;
|
|
62
62
|
if (t && t.trim()) return t.trim().replace(/\/+$/, '');
|
|
63
|
-
let i =
|
|
63
|
+
let i = V();
|
|
64
64
|
return i.apiUrl && i.apiUrl.trim() ? i.apiUrl.trim().replace(/\/+$/, '') : 'https://api.tein.ai';
|
|
65
65
|
}
|
|
66
66
|
function ie() {
|
|
67
|
-
return
|
|
67
|
+
return L;
|
|
68
68
|
}
|
|
69
69
|
var C,
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
Qe,
|
|
71
|
+
ye,
|
|
72
72
|
te,
|
|
73
|
-
|
|
73
|
+
L,
|
|
74
74
|
E = b(() => {
|
|
75
75
|
'use strict';
|
|
76
|
-
((C =
|
|
77
|
-
(
|
|
78
|
-
(
|
|
79
|
-
(te =
|
|
80
|
-
(
|
|
76
|
+
((C = _(require('node:fs'))),
|
|
77
|
+
(Qe = _(require('node:os'))),
|
|
78
|
+
(ye = _(require('node:path'))),
|
|
79
|
+
(te = ye.default.join(Qe.default.homedir(), '.tein')),
|
|
80
|
+
(L = ye.default.join(te, 'config.json')));
|
|
81
81
|
});
|
|
82
|
-
var
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
var gi,
|
|
83
|
+
Xe,
|
|
84
|
+
Ze,
|
|
85
|
+
et = b(() => {
|
|
86
86
|
'use strict';
|
|
87
|
-
((
|
|
88
|
-
(
|
|
89
|
-
(
|
|
87
|
+
((gi = ['1:1', '16:9', '9:16', '21:9', '3:2', '2:3', '4:3', '3:4']),
|
|
88
|
+
(Xe = [...gi, 'auto']),
|
|
89
|
+
(Ze =
|
|
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
92
|
var F,
|
|
93
|
-
|
|
93
|
+
ke = b(() => {
|
|
94
94
|
'use strict';
|
|
95
95
|
F = new Set(['nano-banana-2.1', 'seedance-2-lite', 'seedance-2-5-lite']);
|
|
96
96
|
});
|
|
97
|
-
function
|
|
97
|
+
function re(e) {
|
|
98
98
|
return !1;
|
|
99
99
|
}
|
|
100
|
-
var
|
|
100
|
+
var tt = b(() => {
|
|
101
101
|
'use strict';
|
|
102
102
|
});
|
|
103
|
-
var
|
|
104
|
-
|
|
103
|
+
var ae,
|
|
104
|
+
it = b(() => {
|
|
105
105
|
'use strict';
|
|
106
|
-
|
|
106
|
+
ae = {
|
|
107
107
|
source: 'TEIN Price Board',
|
|
108
108
|
checked: '17 Sep 2026',
|
|
109
109
|
generated: '2026-10-01',
|
|
@@ -4659,10 +4659,16 @@ var re,
|
|
|
4659
4659
|
],
|
|
4660
4660
|
};
|
|
4661
4661
|
});
|
|
4662
|
-
|
|
4662
|
+
var rt,
|
|
4663
|
+
ne,
|
|
4664
|
+
xe = b(() => {
|
|
4665
|
+
'use strict';
|
|
4666
|
+
((rt = { slug: 'tein', name: 'Tein', models: [] }), (ne = []));
|
|
4667
|
+
});
|
|
4668
|
+
function Te(e, t) {
|
|
4663
4669
|
return `${e.trim().toLowerCase()}|${(t ?? '').trim().toLowerCase()}`;
|
|
4664
4670
|
}
|
|
4665
|
-
function
|
|
4671
|
+
function bi(e, t) {
|
|
4666
4672
|
if (e === 'seedance-2-mini') return 'mini';
|
|
4667
4673
|
if (e !== 'seedance-2') return;
|
|
4668
4674
|
let i = typeof t?.quality == 'string' ? t.quality.trim().toLowerCase() : '';
|
|
@@ -4672,81 +4678,88 @@ function ui(e, t) {
|
|
|
4672
4678
|
? 'fast'
|
|
4673
4679
|
: 'standard';
|
|
4674
4680
|
}
|
|
4675
|
-
function
|
|
4681
|
+
function wi(e, t) {
|
|
4676
4682
|
let i = e
|
|
4677
4683
|
.trim()
|
|
4678
4684
|
.toLowerCase()
|
|
4679
4685
|
.replace(/-(?:unfiltered|uncensored)$/, '');
|
|
4680
4686
|
if (i === 'seedance-2' || i === 'seedance-2-mini') {
|
|
4681
|
-
let n =
|
|
4682
|
-
s =
|
|
4687
|
+
let n = bi(i, t),
|
|
4688
|
+
s = Ie.get(Te('seedance-2', n));
|
|
4683
4689
|
return s ? s.slug : null;
|
|
4684
4690
|
}
|
|
4685
|
-
let r =
|
|
4691
|
+
let r = se.get(i) ?? Ie.get(Te(i));
|
|
4686
4692
|
return r ? r.slug : null;
|
|
4687
4693
|
}
|
|
4688
|
-
function
|
|
4689
|
-
return
|
|
4694
|
+
function xi(e, t) {
|
|
4695
|
+
return se.has(e) && !(ki.has(e) && t) ? e : wi(e, t);
|
|
4690
4696
|
}
|
|
4691
4697
|
function G(e, t) {
|
|
4692
|
-
let i =
|
|
4693
|
-
return i ? (
|
|
4698
|
+
let i = xi(e, t);
|
|
4699
|
+
return i ? (se.get(i) ?? null) : null;
|
|
4694
4700
|
}
|
|
4695
|
-
function
|
|
4696
|
-
return
|
|
4701
|
+
function oe() {
|
|
4702
|
+
return nt;
|
|
4697
4703
|
}
|
|
4698
|
-
var
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4704
|
+
var ve,
|
|
4705
|
+
_e,
|
|
4706
|
+
nt,
|
|
4707
|
+
hi,
|
|
4708
|
+
se,
|
|
4709
|
+
Ie,
|
|
4710
|
+
at,
|
|
4711
|
+
yi,
|
|
4712
|
+
Pe,
|
|
4713
|
+
ki,
|
|
4714
|
+
N = b(() => {
|
|
4706
4715
|
'use strict';
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
(
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
models:
|
|
4716
|
+
tt();
|
|
4717
|
+
it();
|
|
4718
|
+
xe();
|
|
4719
|
+
((ve = {
|
|
4720
|
+
...ae,
|
|
4721
|
+
families: ae.families.map((e) => ({ ...e, models: e.models.filter((t) => !re(t)) })),
|
|
4722
|
+
models: ae.models.filter((e) => !re(e.slug)),
|
|
4713
4723
|
}),
|
|
4714
|
-
(
|
|
4715
|
-
(
|
|
4716
|
-
(
|
|
4717
|
-
(
|
|
4718
|
-
(
|
|
4719
|
-
|
|
4720
|
-
(
|
|
4721
|
-
|
|
4724
|
+
(_e = ne.filter((e) => !re(e.slug))),
|
|
4725
|
+
(nt = [...ve.models, ..._e]),
|
|
4726
|
+
(hi = _e.length ? [...ve.families, { ...rt, models: _e.map((e) => e.slug) }] : ve.families),
|
|
4727
|
+
(se = new Map()),
|
|
4728
|
+
(Ie = new Map()),
|
|
4729
|
+
(at = new Map()),
|
|
4730
|
+
(yi = new Map()),
|
|
4731
|
+
(Pe = new Map()));
|
|
4732
|
+
for (let e of nt) {
|
|
4733
|
+
(se.set(e.slug, e), Ie.set(Te(e.api.model, e.api.quality), e));
|
|
4734
|
+
for (let t of e.variants) at.set(`${e.slug}/${t.id}`, { model: e, variant: t, edit: !1 });
|
|
4722
4735
|
for (let t of e.editVariants ?? [])
|
|
4723
|
-
|
|
4724
|
-
for (let t of e.addons ?? [])
|
|
4725
|
-
|
|
4736
|
+
at.set(`${e.slug}/edit/${t.id}`, { model: e, variant: t, edit: !0 });
|
|
4737
|
+
for (let t of e.addons ?? []) yi.set(`${e.slug}/addon/${t.id}`, { model: e, addon: t });
|
|
4738
|
+
Pe.set(e.slug, e.family);
|
|
4726
4739
|
}
|
|
4727
|
-
for (let e of
|
|
4728
|
-
|
|
4740
|
+
for (let e of hi) for (let t of e.models) Pe.has(t) || Pe.set(t, e.slug);
|
|
4741
|
+
ki = new Set(['seedance-2']);
|
|
4729
4742
|
});
|
|
4730
|
-
function
|
|
4743
|
+
function le(e) {
|
|
4731
4744
|
let t = e.from?.variant;
|
|
4732
4745
|
return (t && e.variants.find((i) => i.id === t)) || e.variants[0];
|
|
4733
4746
|
}
|
|
4734
|
-
function
|
|
4747
|
+
function Me(e) {
|
|
4735
4748
|
if (e.endpoints?.length)
|
|
4736
|
-
return e.editVariants?.length && e.endpoints.some((t) => t.id ===
|
|
4737
|
-
?
|
|
4749
|
+
return e.editVariants?.length && e.endpoints.some((t) => t.id === st)
|
|
4750
|
+
? st
|
|
4738
4751
|
: (e.defaultEndpoint ?? e.endpoints[0].id);
|
|
4739
4752
|
}
|
|
4740
|
-
var
|
|
4741
|
-
|
|
4753
|
+
var st,
|
|
4754
|
+
Ke = b(() => {
|
|
4742
4755
|
'use strict';
|
|
4743
|
-
|
|
4744
|
-
|
|
4756
|
+
N();
|
|
4757
|
+
st = 'dynamic';
|
|
4745
4758
|
});
|
|
4746
|
-
var
|
|
4747
|
-
|
|
4759
|
+
var pe,
|
|
4760
|
+
Se = b(() => {
|
|
4748
4761
|
'use strict';
|
|
4749
|
-
|
|
4762
|
+
pe = {
|
|
4750
4763
|
'gemini-3-8-flash': 'gemini-3.8-flash',
|
|
4751
4764
|
'gemini-3-7-flash': 'gemini-3.7-flash',
|
|
4752
4765
|
'gemini-3-1-pro-preview': 'gemini-3.1-pro-preview',
|
|
@@ -4754,29 +4767,29 @@ var oe,
|
|
|
4754
4767
|
'gpt-image-2-5-sunburst': 'gpt-image-2.5-sunburst',
|
|
4755
4768
|
};
|
|
4756
4769
|
});
|
|
4757
|
-
var
|
|
4770
|
+
var ot = b(() => {
|
|
4758
4771
|
'use strict';
|
|
4759
4772
|
});
|
|
4760
|
-
function
|
|
4761
|
-
return typeof t == 'string' && (
|
|
4773
|
+
function lt(e, t) {
|
|
4774
|
+
return typeof t == 'string' && (vi[e]?.includes(t) ?? !1);
|
|
4762
4775
|
}
|
|
4763
|
-
var
|
|
4764
|
-
|
|
4776
|
+
var vi,
|
|
4777
|
+
pt = b(() => {
|
|
4765
4778
|
'use strict';
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4779
|
+
N();
|
|
4780
|
+
Ke();
|
|
4781
|
+
ot();
|
|
4782
|
+
vi = {};
|
|
4770
4783
|
});
|
|
4771
|
-
function
|
|
4772
|
-
return e === 'nano-banana-pro' ?
|
|
4784
|
+
function dt(e) {
|
|
4785
|
+
return e === 'nano-banana-pro' ? _i : Ii;
|
|
4773
4786
|
}
|
|
4774
|
-
var
|
|
4775
|
-
|
|
4776
|
-
|
|
4787
|
+
var _i,
|
|
4788
|
+
Ii,
|
|
4789
|
+
ct = b(() => {
|
|
4777
4790
|
'use strict';
|
|
4778
|
-
((
|
|
4779
|
-
(
|
|
4791
|
+
((_i = ['auto', '1:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9']),
|
|
4792
|
+
(Ii = [
|
|
4780
4793
|
'auto',
|
|
4781
4794
|
'1:1',
|
|
4782
4795
|
'1:4',
|
|
@@ -4794,10 +4807,10 @@ var yi,
|
|
|
4794
4807
|
'21:9',
|
|
4795
4808
|
]));
|
|
4796
4809
|
});
|
|
4797
|
-
var
|
|
4798
|
-
|
|
4810
|
+
var ut,
|
|
4811
|
+
mt = b(() => {
|
|
4799
4812
|
'use strict';
|
|
4800
|
-
|
|
4813
|
+
ut = [
|
|
4801
4814
|
'prompt',
|
|
4802
4815
|
'system',
|
|
4803
4816
|
'messages',
|
|
@@ -4811,10 +4824,10 @@ var ot,
|
|
|
4811
4824
|
'endpoint',
|
|
4812
4825
|
];
|
|
4813
4826
|
});
|
|
4814
|
-
var
|
|
4815
|
-
|
|
4827
|
+
var ft,
|
|
4828
|
+
gt = b(() => {
|
|
4816
4829
|
'use strict';
|
|
4817
|
-
|
|
4830
|
+
ft = [
|
|
4818
4831
|
{
|
|
4819
4832
|
slug: 'claude-fable-5-1',
|
|
4820
4833
|
family: 'fable-5-1',
|
|
@@ -4883,13 +4896,13 @@ var pt,
|
|
|
4883
4896
|
},
|
|
4884
4897
|
];
|
|
4885
4898
|
});
|
|
4886
|
-
function
|
|
4899
|
+
function ht(e) {
|
|
4887
4900
|
return `$${e}`;
|
|
4888
4901
|
}
|
|
4889
|
-
function
|
|
4902
|
+
function $e(e, t, i) {
|
|
4890
4903
|
return G(e)?.variants.find((n) => n.endpoint === t && n.component === i)?.price.starter ?? null;
|
|
4891
4904
|
}
|
|
4892
|
-
function
|
|
4905
|
+
function Pi(e) {
|
|
4893
4906
|
return [
|
|
4894
4907
|
{
|
|
4895
4908
|
name: 'prompt',
|
|
@@ -4955,13 +4968,13 @@ function wi(e) {
|
|
|
4955
4968
|
},
|
|
4956
4969
|
];
|
|
4957
4970
|
}
|
|
4958
|
-
function
|
|
4971
|
+
function yt() {
|
|
4959
4972
|
return Object.fromEntries(
|
|
4960
|
-
|
|
4961
|
-
let t =
|
|
4962
|
-
i =
|
|
4963
|
-
r =
|
|
4964
|
-
n = t != null && i != null ? `${
|
|
4973
|
+
ft.map((e) => {
|
|
4974
|
+
let t = $e(e.slug, 'cheap', 'input'),
|
|
4975
|
+
i = $e(e.slug, 'cheap', 'output'),
|
|
4976
|
+
r = $e(e.slug, 'stable', 'input') != null,
|
|
4977
|
+
n = t != null && i != null ? `${ht(t)}/M in \xB7 ${ht(i)}/M out` : '',
|
|
4965
4978
|
s = {
|
|
4966
4979
|
slug: e.slug,
|
|
4967
4980
|
name: e.name,
|
|
@@ -4972,20 +4985,20 @@ function ut() {
|
|
|
4972
4985
|
priceFormatted: n,
|
|
4973
4986
|
unit: '/M tokens',
|
|
4974
4987
|
primaryToolName: 'run_task',
|
|
4975
|
-
parameters:
|
|
4988
|
+
parameters: Pi(r),
|
|
4976
4989
|
};
|
|
4977
4990
|
return [e.slug, s];
|
|
4978
4991
|
}),
|
|
4979
4992
|
);
|
|
4980
4993
|
}
|
|
4981
|
-
var
|
|
4994
|
+
var bt = b(() => {
|
|
4982
4995
|
'use strict';
|
|
4983
|
-
|
|
4984
|
-
|
|
4996
|
+
gt();
|
|
4997
|
+
N();
|
|
4985
4998
|
});
|
|
4986
4999
|
var J,
|
|
4987
|
-
|
|
4988
|
-
|
|
5000
|
+
de,
|
|
5001
|
+
Ce = b(() => {
|
|
4989
5002
|
'use strict';
|
|
4990
5003
|
((J = [
|
|
4991
5004
|
'seedance-2-5',
|
|
@@ -4995,13 +5008,13 @@ var J,
|
|
|
4995
5008
|
'wan-3-0',
|
|
4996
5009
|
'z-image-pro',
|
|
4997
5010
|
]),
|
|
4998
|
-
(
|
|
5011
|
+
(de =
|
|
4999
5012
|
'a request with creative_mode: true answers 503 checkpoint_unavailable and nothing is charged'));
|
|
5000
5013
|
});
|
|
5001
5014
|
function z(e) {
|
|
5002
5015
|
return `$${Number(e.toFixed(5))}`;
|
|
5003
5016
|
}
|
|
5004
|
-
function
|
|
5017
|
+
function Si(e) {
|
|
5005
5018
|
if (e.kind === 'llm') {
|
|
5006
5019
|
let t = e.defaultEndpoint,
|
|
5007
5020
|
i = (s) =>
|
|
@@ -5015,40 +5028,40 @@ function Ii(e) {
|
|
|
5015
5028
|
n = i('output');
|
|
5016
5029
|
return r && n
|
|
5017
5030
|
? `${z(r.price.starter)}/M in \xB7 ${z(n.price.starter)}/M out`
|
|
5018
|
-
: `from ${z(
|
|
5031
|
+
: `from ${z(le(e).price.starter)}/M tokens`;
|
|
5019
5032
|
}
|
|
5020
|
-
return `from ${z(
|
|
5033
|
+
return `from ${z(le(e).price.starter)}${e.unit}`;
|
|
5021
5034
|
}
|
|
5022
|
-
function
|
|
5035
|
+
function $i(e, t) {
|
|
5023
5036
|
let i = t.filter((r) => Number.isFinite(r) && r > 0);
|
|
5024
5037
|
return i.length ? `from ${z(Math.min(...i))}${e}` : null;
|
|
5025
5038
|
}
|
|
5026
|
-
function
|
|
5039
|
+
function _t(e) {
|
|
5027
5040
|
for (let t of F) {
|
|
5028
|
-
let i =
|
|
5029
|
-
r = i ?
|
|
5041
|
+
let i = ue[t],
|
|
5042
|
+
r = i ? $i(i.unit, e[t] ?? []) : null;
|
|
5030
5043
|
i && r && (i.priceFormatted = r);
|
|
5031
5044
|
}
|
|
5032
5045
|
}
|
|
5033
|
-
function
|
|
5046
|
+
function O(e, t) {
|
|
5034
5047
|
let i = e.axes?.resolution ?? [
|
|
5035
5048
|
...new Set(e.variants.map((r) => r.resolution).filter((r) => !!r)),
|
|
5036
5049
|
];
|
|
5037
5050
|
return {
|
|
5038
5051
|
name: 'resolution',
|
|
5039
5052
|
type: 'select',
|
|
5040
|
-
default:
|
|
5053
|
+
default: le(e).resolution ?? i[0],
|
|
5041
5054
|
options: i,
|
|
5042
5055
|
...(t ? { description: t } : {}),
|
|
5043
5056
|
};
|
|
5044
5057
|
}
|
|
5045
|
-
function
|
|
5058
|
+
function It(e) {
|
|
5046
5059
|
if (!e.endpoints?.length) return null;
|
|
5047
|
-
let t = e.endpoints.filter((i) =>
|
|
5060
|
+
let t = e.endpoints.filter((i) => lt(e.slug, i.id));
|
|
5048
5061
|
return {
|
|
5049
5062
|
name: 'endpoint',
|
|
5050
5063
|
type: 'select',
|
|
5051
|
-
default:
|
|
5064
|
+
default: Me(e),
|
|
5052
5065
|
options: e.endpoints.filter((i) => !t.includes(i)).map((i) => i.id),
|
|
5053
5066
|
description:
|
|
5054
5067
|
(e.slug === 'gemini-3.1-pro-preview'
|
|
@@ -5057,20 +5070,20 @@ function wt(e) {
|
|
|
5057
5070
|
(t.length ? ` ${t.map((i) => i.label).join(' and ')}: coming soon.` : ''),
|
|
5058
5071
|
};
|
|
5059
5072
|
}
|
|
5060
|
-
function
|
|
5073
|
+
function qi(e, t) {
|
|
5061
5074
|
if (e.unfiltered == null || t.some((r) => r.name === 'creative_mode')) return t;
|
|
5062
5075
|
let i = J.includes(e.api.model);
|
|
5063
|
-
return [...t.filter((r) => !
|
|
5076
|
+
return [...t.filter((r) => !Re.has(r.name)), i ? Pt : Ci];
|
|
5064
5077
|
}
|
|
5065
|
-
function
|
|
5066
|
-
let i = e.filter((n) => !
|
|
5067
|
-
r = [
|
|
5068
|
-
return (r.push(
|
|
5078
|
+
function Ee(e, t) {
|
|
5079
|
+
let i = e.filter((n) => !Re.has(n.name)),
|
|
5080
|
+
r = [Pt, Ei];
|
|
5081
|
+
return (r.push(Tt, Mt), [...i, ...r]);
|
|
5069
5082
|
}
|
|
5070
|
-
function
|
|
5083
|
+
function wt(e, t = {}) {
|
|
5071
5084
|
return [
|
|
5072
5085
|
...e
|
|
5073
|
-
.filter((i) => !
|
|
5086
|
+
.filter((i) => !Ai.has(i.name) && !Re.has(i.name))
|
|
5074
5087
|
.map((i) =>
|
|
5075
5088
|
i.name === 'prompt'
|
|
5076
5089
|
? { ...i, required: !0 }
|
|
@@ -5080,7 +5093,7 @@ function ft(e, t = {}) {
|
|
|
5080
5093
|
...(t.no4k && i.options
|
|
5081
5094
|
? { options: i.options.filter((r) => String(r).toLowerCase() !== '4k') }
|
|
5082
5095
|
: {}),
|
|
5083
|
-
description: `Output resolution. TEIN LITE is the lower-priced endpoint for getting started. Stability and reliability are not guaranteed. ${
|
|
5096
|
+
description: `Output resolution. TEIN LITE is the lower-priced endpoint for getting started. Stability and reliability are not guaranteed. ${ce}`,
|
|
5084
5097
|
}
|
|
5085
5098
|
: i,
|
|
5086
5099
|
),
|
|
@@ -5091,11 +5104,11 @@ function ft(e, t = {}) {
|
|
|
5091
5104
|
options: ['standard'],
|
|
5092
5105
|
description: 'LITE uses standard bitrate. High bitrate is on the standard endpoint.',
|
|
5093
5106
|
},
|
|
5094
|
-
|
|
5095
|
-
|
|
5107
|
+
Tt,
|
|
5108
|
+
Mt,
|
|
5096
5109
|
];
|
|
5097
5110
|
}
|
|
5098
|
-
function
|
|
5111
|
+
function qe(e, t) {
|
|
5099
5112
|
return [
|
|
5100
5113
|
$('Text prompt describing the video.'),
|
|
5101
5114
|
{ name: 'mode', type: 'select', required: !0, default: t.modes[0], options: t.modes },
|
|
@@ -5107,7 +5120,7 @@ function $e(e, t) {
|
|
|
5107
5120
|
max: t.maxSec,
|
|
5108
5121
|
description: `Video length in seconds (${t.minSec} to ${t.maxSec}).`,
|
|
5109
5122
|
},
|
|
5110
|
-
|
|
5123
|
+
O(e),
|
|
5111
5124
|
{ name: 'aspect_ratio', type: 'select', default: t.aspects[0], options: t.aspects },
|
|
5112
5125
|
...t.references.map((i) =>
|
|
5113
5126
|
i.endsWith('s')
|
|
@@ -5124,8 +5137,8 @@ function $e(e, t) {
|
|
|
5124
5137
|
),
|
|
5125
5138
|
];
|
|
5126
5139
|
}
|
|
5127
|
-
function
|
|
5128
|
-
let t =
|
|
5140
|
+
function Ri(e) {
|
|
5141
|
+
let t = It(e);
|
|
5129
5142
|
return [
|
|
5130
5143
|
$('Image prompt text. Supports complex composition and text instructions.'),
|
|
5131
5144
|
...(t ? [t] : []),
|
|
@@ -5135,17 +5148,17 @@ function Si(e) {
|
|
|
5135
5148
|
default: 'low',
|
|
5136
5149
|
options: e.axes?.quality ?? ['low', 'medium', 'high'],
|
|
5137
5150
|
},
|
|
5138
|
-
|
|
5151
|
+
O(
|
|
5139
5152
|
e,
|
|
5140
5153
|
e.slug === 'gpt-image-2'
|
|
5141
|
-
? `1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count. ${
|
|
5154
|
+
? `1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count. ${Ze}`
|
|
5142
5155
|
: '1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count.',
|
|
5143
5156
|
),
|
|
5144
5157
|
{
|
|
5145
5158
|
name: 'aspect_ratio',
|
|
5146
5159
|
type: 'select',
|
|
5147
5160
|
default: 'auto',
|
|
5148
|
-
options: [...
|
|
5161
|
+
options: [...Xe],
|
|
5149
5162
|
description:
|
|
5150
5163
|
"The frame. auto: an edit keeps its first input image's ratio (the nearest listed one), text to image is 1:1. The image is delivered at exactly the size for the ratio and resolution.",
|
|
5151
5164
|
},
|
|
@@ -5192,7 +5205,7 @@ function Si(e) {
|
|
|
5192
5205
|
},
|
|
5193
5206
|
];
|
|
5194
5207
|
}
|
|
5195
|
-
function
|
|
5208
|
+
function Oi(e) {
|
|
5196
5209
|
return [
|
|
5197
5210
|
$('Image prompt text.'),
|
|
5198
5211
|
{
|
|
@@ -5200,8 +5213,8 @@ function $i(e) {
|
|
|
5200
5213
|
type: 'string[]',
|
|
5201
5214
|
description: 'Images to edit or use as reference (up to 14).',
|
|
5202
5215
|
},
|
|
5203
|
-
{ name: 'aspect_ratio', type: 'select', default: '1:1', options: [...
|
|
5204
|
-
|
|
5216
|
+
{ name: 'aspect_ratio', type: 'select', default: '1:1', options: [...dt(e.slug)] },
|
|
5217
|
+
O(e),
|
|
5205
5218
|
{
|
|
5206
5219
|
name: 'n',
|
|
5207
5220
|
type: 'slider',
|
|
@@ -5226,10 +5239,10 @@ function $i(e) {
|
|
|
5226
5239
|
},
|
|
5227
5240
|
];
|
|
5228
5241
|
}
|
|
5229
|
-
function
|
|
5230
|
-
let e =
|
|
5242
|
+
function Ni() {
|
|
5243
|
+
let e = ut,
|
|
5231
5244
|
t = [];
|
|
5232
|
-
for (let i of
|
|
5245
|
+
for (let i of Oe(!0))
|
|
5233
5246
|
e.includes(i.name) &&
|
|
5234
5247
|
(t.push({
|
|
5235
5248
|
...i,
|
|
@@ -5251,12 +5264,12 @@ function Ai() {
|
|
|
5251
5264
|
}));
|
|
5252
5265
|
return t;
|
|
5253
5266
|
}
|
|
5254
|
-
function
|
|
5255
|
-
return
|
|
5267
|
+
function Ui() {
|
|
5268
|
+
return Oe(!0).map((e) =>
|
|
5256
5269
|
e.name === 'max_tokens' || e.name === 'max_completion_tokens' ? { ...e, min: 128 } : e,
|
|
5257
5270
|
);
|
|
5258
5271
|
}
|
|
5259
|
-
function
|
|
5272
|
+
function Oe(e) {
|
|
5260
5273
|
return [
|
|
5261
5274
|
$('The user message or task.'),
|
|
5262
5275
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
@@ -5351,44 +5364,67 @@ function qe(e) {
|
|
|
5351
5364
|
},
|
|
5352
5365
|
];
|
|
5353
5366
|
}
|
|
5354
|
-
function
|
|
5355
|
-
if (e.slug === 'seed-2-1-turbo') return
|
|
5356
|
-
let t =
|
|
5367
|
+
function Bi(e) {
|
|
5368
|
+
if (e.slug === 'seed-2-1-turbo') return Li;
|
|
5369
|
+
let t = It(e);
|
|
5357
5370
|
return [
|
|
5358
5371
|
...(e.slug === 'gemini-3.1-pro-preview'
|
|
5359
|
-
?
|
|
5372
|
+
? Ni()
|
|
5360
5373
|
: e.slug === 'gemini-3.7-flash'
|
|
5361
|
-
?
|
|
5362
|
-
: e.slug === 'gpt-6-astra' ||
|
|
5363
|
-
?
|
|
5364
|
-
:
|
|
5374
|
+
? Ui()
|
|
5375
|
+
: e.slug === 'gpt-6-astra' || Vi.includes(e.slug)
|
|
5376
|
+
? Oe(e.slug !== 'gpt-6-astra')
|
|
5377
|
+
: Di),
|
|
5365
5378
|
...(t ? [t] : []),
|
|
5366
5379
|
];
|
|
5367
5380
|
}
|
|
5368
|
-
function
|
|
5381
|
+
function ji(e) {
|
|
5382
|
+
return [
|
|
5383
|
+
{
|
|
5384
|
+
name: 'video_url',
|
|
5385
|
+
type: 'string',
|
|
5386
|
+
required: !0,
|
|
5387
|
+
description:
|
|
5388
|
+
'The video to upscale (up to 30 seconds): a Tein upload link, or any public https link.',
|
|
5389
|
+
},
|
|
5390
|
+
O(
|
|
5391
|
+
e,
|
|
5392
|
+
'Size of the result: 1080p, 2k or 4k. A video already near a size cannot be upscaled to it.',
|
|
5393
|
+
),
|
|
5394
|
+
{
|
|
5395
|
+
name: 'grain',
|
|
5396
|
+
type: 'select',
|
|
5397
|
+
default: 'off',
|
|
5398
|
+
options: ['off', 'light', 'medium', 'heavy'],
|
|
5399
|
+
description: 'Film grain added to the result.',
|
|
5400
|
+
},
|
|
5401
|
+
];
|
|
5402
|
+
}
|
|
5403
|
+
function Fi(e) {
|
|
5369
5404
|
let t = e.slug;
|
|
5370
|
-
if (
|
|
5371
|
-
if (e.
|
|
5405
|
+
if (ne.some((i) => i.slug === t)) return ji(e);
|
|
5406
|
+
if (e.kind === 'llm') return Bi(e);
|
|
5407
|
+
if (e.editVariants?.length) return Ri(e);
|
|
5372
5408
|
switch (t) {
|
|
5373
5409
|
case 'seedance-2-5':
|
|
5374
|
-
return
|
|
5410
|
+
return Ee(kt, t);
|
|
5375
5411
|
case 'seedance-2-5-lite':
|
|
5376
|
-
return
|
|
5412
|
+
return wt(kt, { no4k: !0 });
|
|
5377
5413
|
case 'seedance-2':
|
|
5378
|
-
return
|
|
5414
|
+
return Ee(xt, t);
|
|
5379
5415
|
case 'seedance-2-lite':
|
|
5380
|
-
return
|
|
5416
|
+
return wt(xt);
|
|
5381
5417
|
case 'seedance-2-mini':
|
|
5382
|
-
return
|
|
5418
|
+
return Ee(Gi, t);
|
|
5383
5419
|
case 'nano-banana-2':
|
|
5384
5420
|
case 'nano-banana-2.1':
|
|
5385
5421
|
case 'nano-banana-pro':
|
|
5386
|
-
return
|
|
5422
|
+
return Oi(e);
|
|
5387
5423
|
case 'seedream-5-pro':
|
|
5388
5424
|
return [
|
|
5389
5425
|
$('Detailed description of the image to generate.'),
|
|
5390
5426
|
{ name: 'images', type: 'string[]', description: 'Reference images (the first is free).' },
|
|
5391
|
-
|
|
5427
|
+
O(e),
|
|
5392
5428
|
{
|
|
5393
5429
|
name: 'aspect_ratio',
|
|
5394
5430
|
type: 'select',
|
|
@@ -5406,7 +5442,7 @@ function Di(e) {
|
|
|
5406
5442
|
type: 'string[]',
|
|
5407
5443
|
description: 'Up to 3 reference images, each billed at the published add-on price.',
|
|
5408
5444
|
},
|
|
5409
|
-
|
|
5445
|
+
O(e),
|
|
5410
5446
|
{
|
|
5411
5447
|
name: 'aspect_ratio',
|
|
5412
5448
|
type: 'select',
|
|
@@ -5425,7 +5461,7 @@ function Di(e) {
|
|
|
5425
5461
|
case 'z-image-pro':
|
|
5426
5462
|
return [
|
|
5427
5463
|
$('Image prompt text: subject, scene, style, composition and lighting.'),
|
|
5428
|
-
|
|
5464
|
+
O(e, 'Long edge: 1K is 1024 px, 2K is 2048 px. Same price.'),
|
|
5429
5465
|
{
|
|
5430
5466
|
name: 'aspect_ratio',
|
|
5431
5467
|
type: 'select',
|
|
@@ -5478,7 +5514,7 @@ function Di(e) {
|
|
|
5478
5514
|
];
|
|
5479
5515
|
case 'wan-3-0':
|
|
5480
5516
|
case 'wan-3-0-prime':
|
|
5481
|
-
return
|
|
5517
|
+
return qe(e, {
|
|
5482
5518
|
modes: ['text_to_video', 'first_n_last_frames', 'multi_reference'],
|
|
5483
5519
|
aspects: ['16:9', '9:16', '4:3', '3:4', '1:1', 'adaptive'],
|
|
5484
5520
|
minSec: 2,
|
|
@@ -5488,7 +5524,7 @@ function Di(e) {
|
|
|
5488
5524
|
});
|
|
5489
5525
|
case 'happy-horse-1-1':
|
|
5490
5526
|
case 'happy-horse-1-0':
|
|
5491
|
-
return
|
|
5527
|
+
return qe(e, {
|
|
5492
5528
|
modes:
|
|
5493
5529
|
t === 'happy-horse-1-0'
|
|
5494
5530
|
? ['text-to-video', 'single-image', 'multi-reference', 'video-editing']
|
|
@@ -5499,7 +5535,7 @@ function Di(e) {
|
|
|
5499
5535
|
references: t === 'happy-horse-1-0' ? ['images', 'videos'] : ['images'],
|
|
5500
5536
|
});
|
|
5501
5537
|
case 'minimax-h3':
|
|
5502
|
-
return
|
|
5538
|
+
return qe(e, {
|
|
5503
5539
|
modes: ['text_to_video', 'first_n_last_frames', 'multi_reference'],
|
|
5504
5540
|
aspects: ['16:9', '21:9', '4:3', '1:1', '3:4', '9:16', 'adaptive'],
|
|
5505
5541
|
minSec: 4,
|
|
@@ -5510,155 +5546,156 @@ function Di(e) {
|
|
|
5510
5546
|
return [$('Prompt text.')];
|
|
5511
5547
|
}
|
|
5512
5548
|
}
|
|
5513
|
-
function
|
|
5549
|
+
function Ae(e, t = e.api.model) {
|
|
5514
5550
|
return {
|
|
5515
5551
|
slug: t,
|
|
5516
5552
|
name: e.name,
|
|
5517
|
-
category:
|
|
5518
|
-
kind:
|
|
5553
|
+
category: Ti[e.kind],
|
|
5554
|
+
kind: Ki[e.kind],
|
|
5519
5555
|
vendor: e.vendor ?? '',
|
|
5520
5556
|
description: e.desc ?? e.name,
|
|
5521
|
-
priceFormatted:
|
|
5557
|
+
priceFormatted: Si(e),
|
|
5522
5558
|
unit: e.unit,
|
|
5523
|
-
primaryToolName:
|
|
5524
|
-
parameters:
|
|
5559
|
+
primaryToolName: Mi[e.kind],
|
|
5560
|
+
parameters: qi(e, Fi(e)),
|
|
5525
5561
|
};
|
|
5526
5562
|
}
|
|
5527
|
-
function
|
|
5563
|
+
function Ji() {
|
|
5528
5564
|
let e = {};
|
|
5529
|
-
for (let t of
|
|
5565
|
+
for (let t of oe())
|
|
5530
5566
|
if (t.slug !== 'seedance-2-fast') {
|
|
5531
5567
|
if (t.slug === 'seedance-2-mini') {
|
|
5532
|
-
e['seedance-2-mini'] =
|
|
5568
|
+
e['seedance-2-mini'] = Ae(t, 'seedance-2-mini');
|
|
5533
5569
|
continue;
|
|
5534
5570
|
}
|
|
5535
5571
|
if (t.slug === 'seedance-2') {
|
|
5536
|
-
let i =
|
|
5572
|
+
let i = Ae(t);
|
|
5537
5573
|
((i.description = `${t.desc ?? t.name} Send quality fast or mini for Seedance 2.0 Fast or Mini.`),
|
|
5538
5574
|
(e['seedance-2'] = i));
|
|
5539
5575
|
continue;
|
|
5540
5576
|
}
|
|
5541
|
-
t.slug.startsWith('claude-') || (e[t.api.model] =
|
|
5577
|
+
t.slug.startsWith('claude-') || (e[t.api.model] = Ae(t));
|
|
5542
5578
|
}
|
|
5543
|
-
Object.assign(e,
|
|
5544
|
-
for (let [t, i] of Object.entries(
|
|
5579
|
+
Object.assign(e, yt());
|
|
5580
|
+
for (let [t, i] of Object.entries(pe))
|
|
5545
5581
|
e[i] && Object.defineProperty(e, t, { value: e[i], enumerable: !1 });
|
|
5546
5582
|
return e;
|
|
5547
5583
|
}
|
|
5548
5584
|
function U(e) {
|
|
5549
|
-
return
|
|
5585
|
+
return ue[e] ?? null;
|
|
5550
5586
|
}
|
|
5551
|
-
function
|
|
5587
|
+
function zi(e, t, i) {
|
|
5552
5588
|
if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite') && t === 'duration') {
|
|
5553
5589
|
let r = (n) => (typeof n == 'string' ? n.trim().toLowerCase() : '');
|
|
5554
5590
|
if (r(i.mode) === 'edit' || r(i.omni_reference_task_type) === 'edit') return !1;
|
|
5555
5591
|
}
|
|
5556
5592
|
return !(
|
|
5557
|
-
(t === 'max_tokens' &&
|
|
5558
|
-
(t === 'max_completion_tokens' &&
|
|
5593
|
+
(t === 'max_tokens' && vt(i.max_completion_tokens)) ||
|
|
5594
|
+
(t === 'max_completion_tokens' && vt(i.max_tokens))
|
|
5559
5595
|
);
|
|
5560
5596
|
}
|
|
5561
|
-
function
|
|
5597
|
+
function vt(e) {
|
|
5562
5598
|
return e != null && e !== '';
|
|
5563
5599
|
}
|
|
5564
|
-
function
|
|
5600
|
+
function $t(e, t) {
|
|
5565
5601
|
let i = { ...t };
|
|
5566
5602
|
if (e?.slug === 'seedance-2-5') {
|
|
5567
5603
|
let r = (n) => typeof n != 'string' || !n.trim();
|
|
5568
|
-
for (let n of
|
|
5604
|
+
for (let n of Hi) (r(i.finalize) && !r(i[n]) && (i.finalize = i[n]), delete i[n]);
|
|
5569
5605
|
if (!r(i.finalize)) return i;
|
|
5570
5606
|
}
|
|
5571
5607
|
for (let r of e?.parameters ?? [])
|
|
5572
5608
|
r.default !== void 0 &&
|
|
5573
5609
|
i[r.name] === void 0 &&
|
|
5574
|
-
|
|
5610
|
+
zi(e.slug, r.name, t) &&
|
|
5575
5611
|
(i[r.name] = r.default);
|
|
5576
5612
|
return i;
|
|
5577
5613
|
}
|
|
5578
5614
|
function q() {
|
|
5579
|
-
return Object.values(
|
|
5615
|
+
return Object.values(ue);
|
|
5580
5616
|
}
|
|
5581
|
-
var
|
|
5582
|
-
|
|
5583
|
-
vi,
|
|
5584
|
-
$,
|
|
5585
|
-
kt,
|
|
5586
|
-
Pi,
|
|
5587
|
-
Ti,
|
|
5588
|
-
xt,
|
|
5589
|
-
vt,
|
|
5590
|
-
Ee,
|
|
5617
|
+
var Ti,
|
|
5618
|
+
Mi,
|
|
5591
5619
|
Ki,
|
|
5620
|
+
$,
|
|
5621
|
+
Pt,
|
|
5592
5622
|
Ci,
|
|
5593
5623
|
Ei,
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
ht,
|
|
5624
|
+
Tt,
|
|
5625
|
+
Mt,
|
|
5626
|
+
Re,
|
|
5627
|
+
Ai,
|
|
5628
|
+
Di,
|
|
5600
5629
|
Li,
|
|
5601
|
-
|
|
5602
|
-
|
|
5630
|
+
Vi,
|
|
5631
|
+
ce,
|
|
5632
|
+
kt,
|
|
5633
|
+
Kt,
|
|
5634
|
+
St,
|
|
5635
|
+
xt,
|
|
5636
|
+
Gi,
|
|
5637
|
+
ue,
|
|
5638
|
+
Hi,
|
|
5603
5639
|
H = b(() => {
|
|
5604
5640
|
'use strict';
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
Pe();
|
|
5609
|
-
Te();
|
|
5610
|
-
at();
|
|
5611
|
-
st();
|
|
5612
|
-
lt();
|
|
5613
|
-
mt();
|
|
5641
|
+
et();
|
|
5642
|
+
ke();
|
|
5643
|
+
N();
|
|
5614
5644
|
Ke();
|
|
5615
|
-
(
|
|
5616
|
-
|
|
5645
|
+
xe();
|
|
5646
|
+
Se();
|
|
5647
|
+
pt();
|
|
5648
|
+
ct();
|
|
5649
|
+
mt();
|
|
5650
|
+
bt();
|
|
5651
|
+
Ce();
|
|
5652
|
+
((Ti = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
|
|
5653
|
+
(Mi = {
|
|
5617
5654
|
video: 'generate_video',
|
|
5618
5655
|
image: 'generate_image',
|
|
5619
5656
|
audio: 'generate_audio',
|
|
5620
5657
|
llm: 'run_task',
|
|
5621
5658
|
}),
|
|
5622
|
-
(
|
|
5659
|
+
(Ki = {
|
|
5623
5660
|
video: 'Text-to-Video',
|
|
5624
5661
|
image: 'Text-to-Image',
|
|
5625
5662
|
audio: 'Text-to-Audio',
|
|
5626
5663
|
llm: 'Reasoning (LLM)',
|
|
5627
5664
|
}));
|
|
5628
5665
|
$ = (e) => ({ name: 'prompt', type: 'string', required: !0, description: e });
|
|
5629
|
-
((
|
|
5666
|
+
((Pt = {
|
|
5630
5667
|
name: 'creative_mode',
|
|
5631
5668
|
type: 'boolean',
|
|
5632
5669
|
default: !1,
|
|
5633
5670
|
description:
|
|
5634
5671
|
'Runs the Creative mode checkpoint at its published price (+5%). The Acceptable Use Policy applies.',
|
|
5635
5672
|
}),
|
|
5636
|
-
(
|
|
5673
|
+
(Ci = {
|
|
5637
5674
|
name: 'creative_mode',
|
|
5638
5675
|
type: 'boolean',
|
|
5639
5676
|
default: !1,
|
|
5640
|
-
description: `Not available yet on this model: ${
|
|
5677
|
+
description: `Not available yet on this model: ${de}.`,
|
|
5641
5678
|
}),
|
|
5642
|
-
(
|
|
5679
|
+
(Ei = {
|
|
5643
5680
|
name: 'priority',
|
|
5644
5681
|
type: 'boolean',
|
|
5645
5682
|
default: !1,
|
|
5646
5683
|
description: 'Guaranteed speed and no queue, at the published Priority price (+6%).',
|
|
5647
5684
|
}),
|
|
5648
|
-
(
|
|
5685
|
+
(Tt = {
|
|
5649
5686
|
name: 'reference_roles',
|
|
5650
5687
|
type: 'json',
|
|
5651
5688
|
description: `Omni Reference only. Role of each reference, by tag { "@Image1": "prop" } or by kind { "image": ["prop"] }. Image: appearance, clothing, prop, scene_layout, lighting, first_frame, last_frame; Seedance 2.5 also keyframe, storyboard. Video: motion, camera, style; Seedance 2.5 also blockout_coarse, blockout_fine. Audio: voice, ambience, music, sound_effect. On a tag, the value image, video or audio uses that kind's default (appearance, motion, voice).`,
|
|
5652
5689
|
}),
|
|
5653
|
-
(
|
|
5690
|
+
(Mt = {
|
|
5654
5691
|
name: 'auto_fit_images',
|
|
5655
5692
|
type: 'boolean',
|
|
5656
5693
|
default: !1,
|
|
5657
5694
|
description:
|
|
5658
5695
|
'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.',
|
|
5659
5696
|
}),
|
|
5660
|
-
(
|
|
5661
|
-
|
|
5697
|
+
(Re = new Set(['full_access', 'is_uncensored', 'unfiltered', 'verificationSignature'])));
|
|
5698
|
+
Ai = new Set([
|
|
5662
5699
|
'quality',
|
|
5663
5700
|
'bitrate_mode',
|
|
5664
5701
|
'draft',
|
|
@@ -5667,7 +5704,7 @@ var ki,
|
|
|
5667
5704
|
'draft_generation_id',
|
|
5668
5705
|
'pass_faces',
|
|
5669
5706
|
]);
|
|
5670
|
-
((
|
|
5707
|
+
((Di = [
|
|
5671
5708
|
$('The user message or task.'),
|
|
5672
5709
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
5673
5710
|
{
|
|
@@ -5685,7 +5722,7 @@ var ki,
|
|
|
5685
5722
|
{ name: 'temperature', type: 'slider', min: 0, max: 1, step: 0.1 },
|
|
5686
5723
|
{ name: 'top_p', type: 'slider', min: 0, max: 1, step: 0.05 },
|
|
5687
5724
|
]),
|
|
5688
|
-
(
|
|
5725
|
+
(Li = [
|
|
5689
5726
|
$('The user message or task.'),
|
|
5690
5727
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
5691
5728
|
{
|
|
@@ -5767,9 +5804,9 @@ var ki,
|
|
|
5767
5804
|
description: 'Video frames read a second.',
|
|
5768
5805
|
},
|
|
5769
5806
|
]),
|
|
5770
|
-
(
|
|
5771
|
-
((
|
|
5772
|
-
(
|
|
5807
|
+
(Vi = ['gemini-3.8-flash', 'gemini-3.7-flash']));
|
|
5808
|
+
((ce = 'Left out: 480p, the same default as the API, the playground and workflow steps.'),
|
|
5809
|
+
(kt = [
|
|
5773
5810
|
{
|
|
5774
5811
|
name: 'prompt',
|
|
5775
5812
|
type: 'string',
|
|
@@ -5807,7 +5844,7 @@ var ki,
|
|
|
5807
5844
|
type: 'select',
|
|
5808
5845
|
default: '480p',
|
|
5809
5846
|
options: ['480p', '720p', '1080p', '4k'],
|
|
5810
|
-
description: `Output resolution. 480p and 720p are 8-bit. 1080p and 4k are 10-bit H.265/HEVC. 4k is 3840x2160 at 16:9, works with Creative mode, and runs on one dedicated endpoint with no fallback, so it can be busy. ${
|
|
5847
|
+
description: `Output resolution. 480p and 720p are 8-bit. 1080p and 4k are 10-bit H.265/HEVC. 4k is 3840x2160 at 16:9, works with Creative mode, and runs on one dedicated endpoint with no fallback, so it can be busy. ${ce}`,
|
|
5811
5848
|
},
|
|
5812
5849
|
{
|
|
5813
5850
|
name: 'aspect_ratio',
|
|
@@ -5918,19 +5955,19 @@ var ki,
|
|
|
5918
5955
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
5919
5956
|
},
|
|
5920
5957
|
]),
|
|
5921
|
-
(
|
|
5958
|
+
(Kt = {
|
|
5922
5959
|
name: 'images',
|
|
5923
5960
|
type: 'string[]',
|
|
5924
5961
|
description:
|
|
5925
5962
|
'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.',
|
|
5926
5963
|
}),
|
|
5927
|
-
(
|
|
5964
|
+
(St = {
|
|
5928
5965
|
name: 'audios',
|
|
5929
5966
|
type: 'string[]',
|
|
5930
5967
|
description:
|
|
5931
5968
|
'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.',
|
|
5932
5969
|
}),
|
|
5933
|
-
(
|
|
5970
|
+
(xt = [
|
|
5934
5971
|
{
|
|
5935
5972
|
name: 'prompt',
|
|
5936
5973
|
type: 'string',
|
|
@@ -5974,7 +6011,7 @@ var ki,
|
|
|
5974
6011
|
type: 'select',
|
|
5975
6012
|
default: '480p',
|
|
5976
6013
|
options: ['480p', '720p', '1080p', '4k'],
|
|
5977
|
-
description: `Standard: 480p, 720p, 1080p (8-bit) and 4k (10-bit H.265). Fast and Mini: 480p and 720p only. ${
|
|
6014
|
+
description: `Standard: 480p, 720p, 1080p (8-bit) and 4k (10-bit H.265). Fast and Mini: 480p and 720p only. ${ce}`,
|
|
5978
6015
|
},
|
|
5979
6016
|
{
|
|
5980
6017
|
name: 'bitrate_mode',
|
|
@@ -6008,8 +6045,8 @@ var ki,
|
|
|
6008
6045
|
description:
|
|
6009
6046
|
'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
|
|
6010
6047
|
},
|
|
6011
|
-
|
|
6012
|
-
|
|
6048
|
+
Kt,
|
|
6049
|
+
St,
|
|
6013
6050
|
{
|
|
6014
6051
|
name: 'first_frame_image',
|
|
6015
6052
|
type: 'string',
|
|
@@ -6030,7 +6067,7 @@ var ki,
|
|
|
6030
6067
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
6031
6068
|
},
|
|
6032
6069
|
]),
|
|
6033
|
-
(
|
|
6070
|
+
(Gi = [
|
|
6034
6071
|
{
|
|
6035
6072
|
name: 'prompt',
|
|
6036
6073
|
type: 'string',
|
|
@@ -6051,7 +6088,7 @@ var ki,
|
|
|
6051
6088
|
type: 'select',
|
|
6052
6089
|
default: '480p',
|
|
6053
6090
|
options: ['480p', '720p'],
|
|
6054
|
-
description: `480p and 720p, both 8-bit. Mini does not serve 1080p or 4k. ${
|
|
6091
|
+
description: `480p and 720p, both 8-bit. Mini does not serve 1080p or 4k. ${ce}`,
|
|
6055
6092
|
},
|
|
6056
6093
|
{
|
|
6057
6094
|
name: 'bitrate_mode',
|
|
@@ -6085,8 +6122,8 @@ var ki,
|
|
|
6085
6122
|
description:
|
|
6086
6123
|
'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
|
|
6087
6124
|
},
|
|
6088
|
-
|
|
6089
|
-
|
|
6125
|
+
Kt,
|
|
6126
|
+
St,
|
|
6090
6127
|
{
|
|
6091
6128
|
name: 'first_frame_image',
|
|
6092
6129
|
type: 'string',
|
|
@@ -6101,53 +6138,53 @@ var ki,
|
|
|
6101
6138
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
6102
6139
|
},
|
|
6103
6140
|
]));
|
|
6104
|
-
|
|
6105
|
-
|
|
6141
|
+
ue = Ji();
|
|
6142
|
+
Hi = ['draft_task_id', 'draft_generation_id'];
|
|
6106
6143
|
});
|
|
6107
|
-
function
|
|
6144
|
+
function me(e) {
|
|
6108
6145
|
let t = '/v1/pricing/models',
|
|
6109
6146
|
i = e?.trim();
|
|
6110
6147
|
return i ? `${t}?model=${encodeURIComponent(i)}` : t;
|
|
6111
6148
|
}
|
|
6112
|
-
var
|
|
6149
|
+
var Le = b(() => {
|
|
6113
6150
|
'use strict';
|
|
6114
6151
|
});
|
|
6115
|
-
function
|
|
6152
|
+
function Ut(e) {
|
|
6116
6153
|
return e.length <= 1 ? (e[0] ?? '') : `${e.slice(0, -1).join(', ')} and ${e[e.length - 1]}`;
|
|
6117
6154
|
}
|
|
6118
|
-
function
|
|
6119
|
-
let t =
|
|
6155
|
+
function Bt(e) {
|
|
6156
|
+
let t = oe().filter((s) => s.kind === e && s.unfiltered != null),
|
|
6120
6157
|
i = t.filter((s) => J.includes(s.api.model)).map((s) => s.name),
|
|
6121
6158
|
r = t.filter((s) => !J.includes(s.api.model)).map((s) => s.name);
|
|
6122
6159
|
return [
|
|
6123
6160
|
...(i.length
|
|
6124
|
-
? [`${
|
|
6161
|
+
? [`${Ut(i)}: runs the Creative mode checkpoint at its published price (+5%).`]
|
|
6125
6162
|
: []),
|
|
6126
|
-
...(r.length ? [`Not available yet on ${
|
|
6163
|
+
...(r.length ? [`Not available yet on ${Ut(r)}: ${de}.`] : []),
|
|
6127
6164
|
'The Acceptable Use Policy applies.',
|
|
6128
6165
|
].join(' ');
|
|
6129
6166
|
}
|
|
6130
|
-
function
|
|
6131
|
-
if (
|
|
6167
|
+
function yr(e) {
|
|
6168
|
+
if (gr.has(e.name)) return e;
|
|
6132
6169
|
let t = e.inputSchema.properties;
|
|
6133
6170
|
return !t || t.callback_url
|
|
6134
6171
|
? e
|
|
6135
|
-
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url:
|
|
6172
|
+
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url: fr } } };
|
|
6136
6173
|
}
|
|
6137
|
-
function
|
|
6174
|
+
function br(e) {
|
|
6138
6175
|
let t = e.inputSchema.properties;
|
|
6139
6176
|
if (!t) return e;
|
|
6140
6177
|
let i = !1,
|
|
6141
6178
|
r = {};
|
|
6142
6179
|
for (let [n, s] of Object.entries(t))
|
|
6143
|
-
|
|
6180
|
+
jt.has(n) && s.type === 'string' && !s.format
|
|
6144
6181
|
? ((r[n] = { ...s, format: 'uri' }), (i = !0))
|
|
6145
|
-
:
|
|
6182
|
+
: jt.has(n) && s.type === 'array' && s.items?.type === 'string' && !s.items.format
|
|
6146
6183
|
? ((r[n] = { ...s, items: { ...s.items, format: 'uri' } }), (i = !0))
|
|
6147
6184
|
: (r[n] = s);
|
|
6148
6185
|
return i ? { ...e, inputSchema: { ...e.inputSchema, properties: r } } : e;
|
|
6149
6186
|
}
|
|
6150
|
-
function
|
|
6187
|
+
function wr(e) {
|
|
6151
6188
|
switch (e.type) {
|
|
6152
6189
|
case 'string':
|
|
6153
6190
|
return {
|
|
@@ -6202,11 +6239,11 @@ function ur(e) {
|
|
|
6202
6239
|
return { type: 'string', description: e.description };
|
|
6203
6240
|
}
|
|
6204
6241
|
}
|
|
6205
|
-
function
|
|
6242
|
+
function kr(e, t) {
|
|
6206
6243
|
let i = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
|
|
6207
6244
|
r = {},
|
|
6208
6245
|
n = [];
|
|
6209
|
-
for (let o of e.parameters) ((r[o.name] =
|
|
6246
|
+
for (let o of e.parameters) ((r[o.name] = wr(o)), o.required && n.push(o.name));
|
|
6210
6247
|
let s = {
|
|
6211
6248
|
type: 'object',
|
|
6212
6249
|
properties: r,
|
|
@@ -6219,7 +6256,7 @@ function mr(e, t) {
|
|
|
6219
6256
|
inputSchema: s,
|
|
6220
6257
|
};
|
|
6221
6258
|
}
|
|
6222
|
-
function
|
|
6259
|
+
function xr() {
|
|
6223
6260
|
let e = q().filter((d) => d.category === 'Image'),
|
|
6224
6261
|
t = q().filter((d) => d.category === 'Video'),
|
|
6225
6262
|
i = q().filter((d) => d.category === 'Text'),
|
|
@@ -6315,7 +6352,7 @@ function fr() {
|
|
|
6315
6352
|
maximum: 2147483647,
|
|
6316
6353
|
description: 'Nano Banana 2 and Nano Banana Pro. Omit it for a new image each time.',
|
|
6317
6354
|
},
|
|
6318
|
-
creative_mode: { type: 'boolean', default: !1, description:
|
|
6355
|
+
creative_mode: { type: 'boolean', default: !1, description: Bt('image') },
|
|
6319
6356
|
},
|
|
6320
6357
|
required: ['prompt'],
|
|
6321
6358
|
additionalProperties: !0,
|
|
@@ -6352,7 +6389,7 @@ function fr() {
|
|
|
6352
6389
|
default: '480p',
|
|
6353
6390
|
description: 'Video resolution (the lowest price is the default; see each model tool).',
|
|
6354
6391
|
},
|
|
6355
|
-
creative_mode: { type: 'boolean', default: !1, description:
|
|
6392
|
+
creative_mode: { type: 'boolean', default: !1, description: Bt('video') },
|
|
6356
6393
|
priority: {
|
|
6357
6394
|
type: 'boolean',
|
|
6358
6395
|
default: !1,
|
|
@@ -6474,10 +6511,10 @@ function fr() {
|
|
|
6474
6511
|
additionalProperties: !0,
|
|
6475
6512
|
},
|
|
6476
6513
|
},
|
|
6477
|
-
p =
|
|
6478
|
-
return [n, s, o, u, l, p, c,
|
|
6514
|
+
p = vr();
|
|
6515
|
+
return [n, s, o, u, l, p, c, hr];
|
|
6479
6516
|
}
|
|
6480
|
-
function
|
|
6517
|
+
function vr() {
|
|
6481
6518
|
return {
|
|
6482
6519
|
name: 'upload_asset',
|
|
6483
6520
|
description:
|
|
@@ -6524,26 +6561,26 @@ function gr() {
|
|
|
6524
6561
|
},
|
|
6525
6562
|
};
|
|
6526
6563
|
}
|
|
6527
|
-
function
|
|
6528
|
-
let e =
|
|
6529
|
-
t = q().map((i) =>
|
|
6530
|
-
return [...e, ...t].map(
|
|
6564
|
+
function Fe() {
|
|
6565
|
+
let e = xr(),
|
|
6566
|
+
t = q().map((i) => kr(i));
|
|
6567
|
+
return [...e, ...t].map(yr).map(br);
|
|
6531
6568
|
}
|
|
6532
|
-
var
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6569
|
+
var fr,
|
|
6570
|
+
gr,
|
|
6571
|
+
hr,
|
|
6572
|
+
jt,
|
|
6573
|
+
Ft = b(() => {
|
|
6537
6574
|
'use strict';
|
|
6538
|
-
|
|
6539
|
-
|
|
6575
|
+
N();
|
|
6576
|
+
Ce();
|
|
6540
6577
|
H();
|
|
6541
|
-
((
|
|
6578
|
+
((fr = {
|
|
6542
6579
|
type: 'string',
|
|
6543
6580
|
description:
|
|
6544
6581
|
'Optional HTTPS URL. Tein POSTs the finished job here when it succeeds, fails, expires, or is cancelled. The body matches GET /v1/jobs/:id and is signed with X-Tein-Signature.',
|
|
6545
6582
|
}),
|
|
6546
|
-
(
|
|
6583
|
+
(gr = new Set([
|
|
6547
6584
|
'upload_asset',
|
|
6548
6585
|
'upload_media',
|
|
6549
6586
|
'upload_image',
|
|
@@ -6551,7 +6588,7 @@ var or,
|
|
|
6551
6588
|
'check_status',
|
|
6552
6589
|
'get_pricing',
|
|
6553
6590
|
])),
|
|
6554
|
-
(
|
|
6591
|
+
(hr = {
|
|
6555
6592
|
name: 'get_pricing',
|
|
6556
6593
|
description:
|
|
6557
6594
|
'Published USD prices for every Tein model: Starter, Plus and Scale on each variant, plus Creative mode, Priority and draft tables where they are published, and Admin prices for models that are not on the board. No API key is required. Pass model to keep one catalog slug or API model id (for example seedance-2-5). The same payload as GET /v1/pricing/models.',
|
|
@@ -6566,7 +6603,7 @@ var or,
|
|
|
6566
6603
|
additionalProperties: !1,
|
|
6567
6604
|
},
|
|
6568
6605
|
}));
|
|
6569
|
-
|
|
6606
|
+
jt = new Set([
|
|
6570
6607
|
'image',
|
|
6571
6608
|
'images',
|
|
6572
6609
|
'image_url',
|
|
@@ -6583,19 +6620,19 @@ var or,
|
|
|
6583
6620
|
'lipsyncing_audio',
|
|
6584
6621
|
]);
|
|
6585
6622
|
});
|
|
6586
|
-
var
|
|
6587
|
-
|
|
6588
|
-
forgetToolSchemas: () =>
|
|
6589
|
-
jsonRpcAnswer: () =>
|
|
6590
|
-
preprocessLocalFiles: () =>
|
|
6591
|
-
startStdioServer: () =>
|
|
6623
|
+
var ei = {};
|
|
6624
|
+
li(ei, {
|
|
6625
|
+
forgetToolSchemas: () => Mr,
|
|
6626
|
+
jsonRpcAnswer: () => Ht,
|
|
6627
|
+
preprocessLocalFiles: () => Xt,
|
|
6628
|
+
startStdioServer: () => Zt,
|
|
6592
6629
|
});
|
|
6593
|
-
function
|
|
6630
|
+
function _r(e) {
|
|
6594
6631
|
let t = (i) =>
|
|
6595
6632
|
!!i && typeof i == 'object' && i.jsonrpc === '2.0' && ('result' in i || 'error' in i);
|
|
6596
6633
|
return Array.isArray(e) ? e.length > 0 && e.every(t) : t(e);
|
|
6597
6634
|
}
|
|
6598
|
-
function
|
|
6635
|
+
function Ht(e, t, i) {
|
|
6599
6636
|
let r = e?.id,
|
|
6600
6637
|
n = r == null,
|
|
6601
6638
|
s = null;
|
|
@@ -6604,7 +6641,7 @@ function Bt(e, t, i) {
|
|
|
6604
6641
|
} catch {
|
|
6605
6642
|
s = null;
|
|
6606
6643
|
}
|
|
6607
|
-
if (s !== null &&
|
|
6644
|
+
if (s !== null && _r(s)) return n ? null : s;
|
|
6608
6645
|
if (n) return null;
|
|
6609
6646
|
if (!i && t >= 200 && t < 300) return;
|
|
6610
6647
|
let o = s?.error,
|
|
@@ -6625,13 +6662,13 @@ function Bt(e, t, i) {
|
|
|
6625
6662
|
},
|
|
6626
6663
|
};
|
|
6627
6664
|
}
|
|
6628
|
-
function
|
|
6665
|
+
function Ir() {
|
|
6629
6666
|
let e = process.argv.slice(2),
|
|
6630
6667
|
t = e.indexOf('--api-key');
|
|
6631
6668
|
return S(t >= 0 ? e[t + 1] : void 0);
|
|
6632
6669
|
}
|
|
6633
|
-
async function
|
|
6634
|
-
let r =
|
|
6670
|
+
async function Wt(e, t, i) {
|
|
6671
|
+
let r = B.default.resolve(e);
|
|
6635
6672
|
if (!R.default.existsSync(r) || !R.default.statSync(r).isFile())
|
|
6636
6673
|
throw new Error(`File not found: ${e}`);
|
|
6637
6674
|
let n = R.default.readFileSync(r),
|
|
@@ -6659,15 +6696,15 @@ async function Ft(e, t, i) {
|
|
|
6659
6696
|
mimeType: c.mime_type || c.mimeType || 'image/png',
|
|
6660
6697
|
};
|
|
6661
6698
|
}
|
|
6662
|
-
function
|
|
6663
|
-
return
|
|
6699
|
+
function Yt(e) {
|
|
6700
|
+
return Pr.has(B.default.extname(e).toLowerCase());
|
|
6664
6701
|
}
|
|
6665
|
-
function
|
|
6702
|
+
function Qt(e) {
|
|
6666
6703
|
return new Error(
|
|
6667
|
-
`Tein uploads image, video and audio files only, and ${
|
|
6704
|
+
`Tein uploads image, video and audio files only, and ${B.default.basename(e)} is not one.`,
|
|
6668
6705
|
);
|
|
6669
6706
|
}
|
|
6670
|
-
function
|
|
6707
|
+
function Tr(e) {
|
|
6671
6708
|
let t = e.trim();
|
|
6672
6709
|
if (
|
|
6673
6710
|
!t ||
|
|
@@ -6677,10 +6714,10 @@ function wr(e) {
|
|
|
6677
6714
|
`)
|
|
6678
6715
|
)
|
|
6679
6716
|
return null;
|
|
6680
|
-
let i =
|
|
6717
|
+
let i = B.default.resolve(t);
|
|
6681
6718
|
return R.default.existsSync(i) && R.default.statSync(i).isFile() ? i : null;
|
|
6682
6719
|
}
|
|
6683
|
-
function
|
|
6720
|
+
function Je(e) {
|
|
6684
6721
|
if (Array.isArray(e))
|
|
6685
6722
|
for (let t of e) {
|
|
6686
6723
|
let i = t;
|
|
@@ -6690,12 +6727,12 @@ function Be(e) {
|
|
|
6690
6727
|
Q.set(i.name, i.inputSchema);
|
|
6691
6728
|
}
|
|
6692
6729
|
}
|
|
6693
|
-
function
|
|
6694
|
-
(Q.clear(), (
|
|
6730
|
+
function Mr() {
|
|
6731
|
+
(Q.clear(), (Ge = 0));
|
|
6695
6732
|
}
|
|
6696
|
-
async function
|
|
6697
|
-
if (!(Date.now() -
|
|
6698
|
-
|
|
6733
|
+
async function Kr(e, t) {
|
|
6734
|
+
if (!(Date.now() - Ge < 6e4)) {
|
|
6735
|
+
Ge = Date.now();
|
|
6699
6736
|
try {
|
|
6700
6737
|
let r = await (
|
|
6701
6738
|
await fetch(e, {
|
|
@@ -6705,39 +6742,39 @@ async function xr(e, t) {
|
|
|
6705
6742
|
signal: AbortSignal.timeout(1e4),
|
|
6706
6743
|
})
|
|
6707
6744
|
).json();
|
|
6708
|
-
|
|
6745
|
+
Je(r.result?.tools);
|
|
6709
6746
|
} catch {}
|
|
6710
6747
|
}
|
|
6711
6748
|
}
|
|
6712
|
-
function
|
|
6749
|
+
function Sr(e) {
|
|
6713
6750
|
return e
|
|
6714
6751
|
? e.type === 'string'
|
|
6715
6752
|
? e.format === 'uri'
|
|
6716
6753
|
: e.type === 'array' && e.items?.format === 'uri'
|
|
6717
6754
|
: !1;
|
|
6718
6755
|
}
|
|
6719
|
-
async function
|
|
6756
|
+
async function Gt(e, t, i) {
|
|
6720
6757
|
if (typeof e != 'string') return e;
|
|
6721
|
-
let r =
|
|
6758
|
+
let r = Tr(e);
|
|
6722
6759
|
if (!r) return e;
|
|
6723
|
-
if (!
|
|
6724
|
-
return (await
|
|
6760
|
+
if (!Yt(r)) throw Qt(r);
|
|
6761
|
+
return (await Wt(r, t, i)).url;
|
|
6725
6762
|
}
|
|
6726
|
-
async function
|
|
6727
|
-
(Q.size === 0 &&
|
|
6763
|
+
async function Xt(e, t, i, r, n) {
|
|
6764
|
+
(Q.size === 0 && Je(Fe()), Q.has(e) || (await Kr(n, i)));
|
|
6728
6765
|
let s = Q.get(e)?.properties;
|
|
6729
6766
|
if (!s) return t;
|
|
6730
6767
|
let o = { ...t };
|
|
6731
6768
|
for (let [u, l] of Object.entries(t))
|
|
6732
|
-
if (
|
|
6769
|
+
if (Sr(s[u]))
|
|
6733
6770
|
if (Array.isArray(l)) {
|
|
6734
6771
|
let c = [];
|
|
6735
|
-
for (let p of l) c.push(await
|
|
6772
|
+
for (let p of l) c.push(await Gt(p, i, r));
|
|
6736
6773
|
o[u] = c;
|
|
6737
|
-
} else o[u] = await
|
|
6774
|
+
} else o[u] = await Gt(l, i, r);
|
|
6738
6775
|
return o;
|
|
6739
6776
|
}
|
|
6740
|
-
function
|
|
6777
|
+
function $r(e) {
|
|
6741
6778
|
let t = e.id ?? null;
|
|
6742
6779
|
switch (e.method) {
|
|
6743
6780
|
case 'initialize':
|
|
@@ -6755,7 +6792,7 @@ function Ir(e) {
|
|
|
6755
6792
|
case 'ping':
|
|
6756
6793
|
return { jsonrpc: '2.0', id: t, result: {} };
|
|
6757
6794
|
case 'tools/list':
|
|
6758
|
-
return { jsonrpc: '2.0', id: t, result: { tools:
|
|
6795
|
+
return { jsonrpc: '2.0', id: t, result: { tools: Fe() } };
|
|
6759
6796
|
case 'tools/call':
|
|
6760
6797
|
return {
|
|
6761
6798
|
jsonrpc: '2.0',
|
|
@@ -6778,13 +6815,13 @@ function Ir(e) {
|
|
|
6778
6815
|
};
|
|
6779
6816
|
}
|
|
6780
6817
|
}
|
|
6781
|
-
async function
|
|
6782
|
-
if (
|
|
6783
|
-
|
|
6784
|
-
let e =
|
|
6818
|
+
async function Zt() {
|
|
6819
|
+
if (Jt) return;
|
|
6820
|
+
Jt = !0;
|
|
6821
|
+
let e = Ir(),
|
|
6785
6822
|
t = x(),
|
|
6786
6823
|
i = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
|
|
6787
|
-
(
|
|
6824
|
+
(zt.default
|
|
6788
6825
|
.createInterface({ input: process.stdin, output: process.stdout, terminal: !1 })
|
|
6789
6826
|
.on('line', async (n) => {
|
|
6790
6827
|
let s = n.trim();
|
|
@@ -6796,7 +6833,7 @@ async function Ht() {
|
|
|
6796
6833
|
c = o.params.arguments || {};
|
|
6797
6834
|
if (l === 'get_pricing') {
|
|
6798
6835
|
let p = typeof c.model == 'string' ? c.model.trim() : '',
|
|
6799
|
-
d = `${t.replace(/\/+$/, '')}${
|
|
6836
|
+
d = `${t.replace(/\/+$/, '')}${me(p)}`;
|
|
6800
6837
|
try {
|
|
6801
6838
|
let m = await fetch(d, { signal: AbortSignal.timeout(1e4) }),
|
|
6802
6839
|
h = await m.text();
|
|
@@ -6843,19 +6880,19 @@ async function Ht() {
|
|
|
6843
6880
|
!p.startsWith('data:')
|
|
6844
6881
|
)
|
|
6845
6882
|
try {
|
|
6846
|
-
let d =
|
|
6883
|
+
let d = B.default.resolve(p.trim());
|
|
6847
6884
|
if (R.default.existsSync(d) && R.default.statSync(d).isFile() && e) {
|
|
6848
|
-
if (!
|
|
6849
|
-
let m = await
|
|
6885
|
+
if (!Yt(d)) throw Qt(d);
|
|
6886
|
+
let m = await Wt(d, e, t),
|
|
6850
6887
|
h = (m.sizeBytes / 1024).toFixed(1),
|
|
6851
|
-
|
|
6888
|
+
fe =
|
|
6852
6889
|
m.mimeType.startsWith('image/') ||
|
|
6853
6890
|
/\.(png|jpe?g|webp|gif|svg)$/i.test(m.url)
|
|
6854
6891
|
? `
|
|
6855
6892
|
|
|
6856
6893
|
`
|
|
6857
6894
|
: '',
|
|
6858
|
-
|
|
6895
|
+
ge = {
|
|
6859
6896
|
jsonrpc: '2.0',
|
|
6860
6897
|
id: o.id,
|
|
6861
6898
|
result: {
|
|
@@ -6866,7 +6903,7 @@ async function Ht() {
|
|
|
6866
6903
|
|
|
6867
6904
|
- **URL:** ${m.url}
|
|
6868
6905
|
- **Type:** \`${m.mimeType}\`
|
|
6869
|
-
- **Size:** ${h} KB${
|
|
6906
|
+
- **Size:** ${h} KB${fe}
|
|
6870
6907
|
|
|
6871
6908
|
Pass this URL to any Tein generation tool.`,
|
|
6872
6909
|
},
|
|
@@ -6875,7 +6912,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
6875
6912
|
},
|
|
6876
6913
|
};
|
|
6877
6914
|
process.stdout.write(
|
|
6878
|
-
JSON.stringify(
|
|
6915
|
+
JSON.stringify(ge) +
|
|
6879
6916
|
`
|
|
6880
6917
|
`,
|
|
6881
6918
|
);
|
|
@@ -6902,7 +6939,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
6902
6939
|
}
|
|
6903
6940
|
if (e)
|
|
6904
6941
|
try {
|
|
6905
|
-
o.params.arguments = await
|
|
6942
|
+
o.params.arguments = await Xt(String(l), c, e, t, i);
|
|
6906
6943
|
} catch (p) {
|
|
6907
6944
|
let d = p instanceof Error ? p.message : String(p);
|
|
6908
6945
|
process.stdout.write(
|
|
@@ -6933,10 +6970,10 @@ Pass this URL to any Tein generation tool.`,
|
|
|
6933
6970
|
body: JSON.stringify(o),
|
|
6934
6971
|
}),
|
|
6935
6972
|
c = await l.text(),
|
|
6936
|
-
p =
|
|
6973
|
+
p = Ht(o, l.status, c);
|
|
6937
6974
|
if (p === null) return;
|
|
6938
6975
|
if (p) {
|
|
6939
|
-
(o?.method === 'tools/list' &&
|
|
6976
|
+
(o?.method === 'tools/list' && Je(p.result?.tools),
|
|
6940
6977
|
process.stdout.write(
|
|
6941
6978
|
JSON.stringify(p) +
|
|
6942
6979
|
`
|
|
@@ -6945,7 +6982,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
6945
6982
|
return;
|
|
6946
6983
|
}
|
|
6947
6984
|
} catch {}
|
|
6948
|
-
let u =
|
|
6985
|
+
let u = $r(o);
|
|
6949
6986
|
u !== null &&
|
|
6950
6987
|
process.stdout.write(
|
|
6951
6988
|
JSON.stringify(u) +
|
|
@@ -6969,21 +7006,21 @@ Pass this URL to any Tein generation tool.`,
|
|
|
6969
7006
|
`));
|
|
6970
7007
|
}
|
|
6971
7008
|
var R,
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
7009
|
+
B,
|
|
7010
|
+
zt,
|
|
7011
|
+
Pr,
|
|
6975
7012
|
Q,
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
7013
|
+
Ge,
|
|
7014
|
+
Jt,
|
|
7015
|
+
ti = b(() => {
|
|
6979
7016
|
'use strict';
|
|
6980
|
-
((R =
|
|
6981
|
-
(
|
|
6982
|
-
(
|
|
6983
|
-
|
|
6984
|
-
|
|
7017
|
+
((R = _(require('node:fs'))),
|
|
7018
|
+
(B = _(require('node:path'))),
|
|
7019
|
+
(zt = _(require('node:readline'))));
|
|
7020
|
+
Le();
|
|
7021
|
+
Ft();
|
|
6985
7022
|
E();
|
|
6986
|
-
|
|
7023
|
+
Pr = new Set([
|
|
6987
7024
|
'.png',
|
|
6988
7025
|
'.jpg',
|
|
6989
7026
|
'.jpeg',
|
|
@@ -7009,20 +7046,20 @@ var R,
|
|
|
7009
7046
|
'.flac',
|
|
7010
7047
|
'.opus',
|
|
7011
7048
|
]);
|
|
7012
|
-
((Q = new Map()), (
|
|
7013
|
-
|
|
7049
|
+
((Q = new Map()), (Ge = 0));
|
|
7050
|
+
Jt = !1;
|
|
7014
7051
|
require.main === module &&
|
|
7015
|
-
|
|
7052
|
+
Zt().catch((e) => {
|
|
7016
7053
|
(process.stderr.write(`Fatal error in Tein MCP CLI: ${e}
|
|
7017
7054
|
`),
|
|
7018
7055
|
process.exit(1));
|
|
7019
7056
|
});
|
|
7020
7057
|
});
|
|
7021
|
-
var
|
|
7058
|
+
var di =
|
|
7022
7059
|
!process.env.NO_COLOR &&
|
|
7023
7060
|
(process.stdout.isTTY || process.env.FORCE_COLOR === '1' || process.env.TERM !== 'dumb');
|
|
7024
7061
|
function w(e, t) {
|
|
7025
|
-
return (i) => (
|
|
7062
|
+
return (i) => (di ? `\x1B[${e}m${i}\x1B[${t}m` : String(i));
|
|
7026
7063
|
}
|
|
7027
7064
|
var a = {
|
|
7028
7065
|
bold: w(1, 22),
|
|
@@ -7106,21 +7143,21 @@ var a = {
|
|
|
7106
7143
|
process.stdout.isTTY && process.stdout.write('\r\x1B[K'));
|
|
7107
7144
|
}
|
|
7108
7145
|
};
|
|
7109
|
-
var
|
|
7110
|
-
A =
|
|
7111
|
-
var ee =
|
|
7112
|
-
|
|
7113
|
-
|
|
7146
|
+
var D = _(require('node:fs')),
|
|
7147
|
+
A = _(require('node:path'));
|
|
7148
|
+
var ee = _(require('node:fs')),
|
|
7149
|
+
We = _(require('node:path')),
|
|
7150
|
+
Ye = require('node:stream/promises');
|
|
7114
7151
|
var Z = '1.1.7';
|
|
7115
|
-
var
|
|
7152
|
+
var ci = new Set([
|
|
7116
7153
|
'account_suspended',
|
|
7117
7154
|
'account_terminated',
|
|
7118
7155
|
'creative_mode_restricted',
|
|
7119
7156
|
'unfiltered_restricted',
|
|
7120
7157
|
'workspace_paused',
|
|
7121
7158
|
]),
|
|
7122
|
-
|
|
7123
|
-
|
|
7159
|
+
I = 1,
|
|
7160
|
+
ui = 3,
|
|
7124
7161
|
k = class extends Error {
|
|
7125
7162
|
constructor(t, i, r, n = {}) {
|
|
7126
7163
|
(super(i),
|
|
@@ -7130,10 +7167,10 @@ var si = new Set([
|
|
|
7130
7167
|
(this.fields = n));
|
|
7131
7168
|
}
|
|
7132
7169
|
get exitCode() {
|
|
7133
|
-
return this.code &&
|
|
7170
|
+
return this.code && ci.has(this.code) ? ui : I;
|
|
7134
7171
|
}
|
|
7135
7172
|
};
|
|
7136
|
-
function
|
|
7173
|
+
function mi(e, t, i) {
|
|
7137
7174
|
let r = `HTTP ${e}${t ? ` ${t}` : ''}`;
|
|
7138
7175
|
if (!i || typeof i != 'object') return new k(e, r);
|
|
7139
7176
|
let n = i;
|
|
@@ -7146,13 +7183,13 @@ function li(e, t, i) {
|
|
|
7146
7183
|
c = (typeof s == 'string' && s) || (typeof u == 'string' && u) || r;
|
|
7147
7184
|
return new k(e, c, typeof o == 'string' ? o : void 0, l);
|
|
7148
7185
|
}
|
|
7149
|
-
function
|
|
7186
|
+
function ze(e) {
|
|
7150
7187
|
return typeof e == 'number' && Number.isFinite(e) ? `$${e.toFixed(4)}` : null;
|
|
7151
7188
|
}
|
|
7152
7189
|
function K(e) {
|
|
7153
7190
|
let t = [e.message],
|
|
7154
|
-
i =
|
|
7155
|
-
r =
|
|
7191
|
+
i = ze(e.fields.required),
|
|
7192
|
+
r = ze(e.fields.balance);
|
|
7156
7193
|
(i || r) &&
|
|
7157
7194
|
t.push([i ? `Required: ${i}` : '', r ? `Balance: ${r}` : ''].filter(Boolean).join(' '));
|
|
7158
7195
|
let n = e.fields.org_name ?? e.fields.orgName;
|
|
@@ -7160,19 +7197,19 @@ function K(e) {
|
|
|
7160
7197
|
let s = e.fields.url ?? e.fields.appeal_url ?? e.fields.top_up_url;
|
|
7161
7198
|
return (typeof s == 'string' && s && t.push(s), e.code && t.push(`(${e.code})`), t);
|
|
7162
7199
|
}
|
|
7163
|
-
function
|
|
7200
|
+
function fi(e) {
|
|
7164
7201
|
return /\.(mp4|webm|mov)(\?|$)/i.test(e)
|
|
7165
7202
|
? 'video'
|
|
7166
7203
|
: /\.(mp3|wav|ogg|flac)(\?|$)/i.test(e)
|
|
7167
7204
|
? 'audio'
|
|
7168
7205
|
: 'image';
|
|
7169
7206
|
}
|
|
7170
|
-
function
|
|
7207
|
+
function He(e) {
|
|
7171
7208
|
let t = [];
|
|
7172
7209
|
for (let i of e.data ?? [])
|
|
7173
7210
|
typeof i.message?.content == 'string'
|
|
7174
7211
|
? t.push({ type: 'text', text: i.message.content })
|
|
7175
|
-
: i.url && t.push({ type:
|
|
7212
|
+
: i.url && t.push({ type: fi(i.url), url: i.url });
|
|
7176
7213
|
return t;
|
|
7177
7214
|
}
|
|
7178
7215
|
var M = class {
|
|
@@ -7198,7 +7235,7 @@ var M = class {
|
|
|
7198
7235
|
try {
|
|
7199
7236
|
s = await n.json();
|
|
7200
7237
|
} catch {}
|
|
7201
|
-
throw
|
|
7238
|
+
throw mi(n.status, n.statusText, s);
|
|
7202
7239
|
}
|
|
7203
7240
|
return await n.json();
|
|
7204
7241
|
}
|
|
@@ -7212,7 +7249,7 @@ var M = class {
|
|
|
7212
7249
|
n === 'succeeded' || n === 'failed' || n === 'expired' || n === 'cancelled'
|
|
7213
7250
|
? n
|
|
7214
7251
|
: 'processing',
|
|
7215
|
-
o =
|
|
7252
|
+
o = He(r);
|
|
7216
7253
|
return {
|
|
7217
7254
|
request_id: r.request_id || r.id || '',
|
|
7218
7255
|
model: r.model,
|
|
@@ -7230,7 +7267,7 @@ var M = class {
|
|
|
7230
7267
|
r === 'succeeded' || r === 'failed' || r === 'expired' || r === 'cancelled'
|
|
7231
7268
|
? r
|
|
7232
7269
|
: 'processing',
|
|
7233
|
-
s =
|
|
7270
|
+
s = He(i),
|
|
7234
7271
|
o = i.error && typeof i.error.message == 'string' ? i.error.message : null;
|
|
7235
7272
|
return {
|
|
7236
7273
|
request_id: i.id || t,
|
|
@@ -7248,14 +7285,14 @@ var M = class {
|
|
|
7248
7285
|
async downloadOutput(t, i) {
|
|
7249
7286
|
let r = await fetch(t);
|
|
7250
7287
|
if (!r.ok) throw new Error(`The file could not be downloaded (HTTP ${r.status})`);
|
|
7251
|
-
let n =
|
|
7288
|
+
let n = We.default.dirname(i);
|
|
7252
7289
|
ee.default.existsSync(n) || ee.default.mkdirSync(n, { recursive: !0 });
|
|
7253
7290
|
let s = ee.default.createWriteStream(i);
|
|
7254
|
-
return (await (0,
|
|
7291
|
+
return (await (0, Ye.pipeline)(r.body, s), i);
|
|
7255
7292
|
}
|
|
7256
7293
|
};
|
|
7257
7294
|
E();
|
|
7258
|
-
function
|
|
7295
|
+
function we(e) {
|
|
7259
7296
|
if (typeof e != 'number' || !Number.isFinite(e)) return '';
|
|
7260
7297
|
if (Math.abs(e) >= 1 || Math.abs(Number(e.toFixed(4)) - e) < 1e-12) return `$${e.toFixed(4)}`;
|
|
7261
7298
|
let t = Math.max(0, 3 - Number(e.toExponential(3).split('e')[1])),
|
|
@@ -7264,29 +7301,29 @@ function ye(e) {
|
|
|
7264
7301
|
return r >= 1 ? `$${r.toFixed(4)}` : `$${r.toFixed(t).replace(/0+$/, '')}`;
|
|
7265
7302
|
}
|
|
7266
7303
|
H();
|
|
7267
|
-
var
|
|
7268
|
-
function
|
|
7269
|
-
for (let t of
|
|
7304
|
+
var Ct = ['images', 'input_images', 'videos', 'audios'];
|
|
7305
|
+
function Wi(e) {
|
|
7306
|
+
for (let t of Ct) typeof e[t] == 'string' && (e[t] = [e[t]]);
|
|
7270
7307
|
}
|
|
7271
|
-
function
|
|
7308
|
+
function Yi(e) {
|
|
7272
7309
|
if (e.startsWith('http://') || e.startsWith('https://')) return null;
|
|
7273
7310
|
let t = A.default.resolve(e);
|
|
7274
|
-
return
|
|
7311
|
+
return D.default.existsSync(t) && D.default.statSync(t).isFile() ? t : null;
|
|
7275
7312
|
}
|
|
7276
|
-
async function
|
|
7277
|
-
for (let i of
|
|
7313
|
+
async function Qi(e, t) {
|
|
7314
|
+
for (let i of Ct) {
|
|
7278
7315
|
if (!Array.isArray(e[i])) continue;
|
|
7279
7316
|
let r = [];
|
|
7280
7317
|
for (let n of e[i]) {
|
|
7281
7318
|
if (typeof n != 'string') continue;
|
|
7282
|
-
let s =
|
|
7319
|
+
let s = Yi(n);
|
|
7283
7320
|
r.push(s ? await t(s) : n);
|
|
7284
7321
|
}
|
|
7285
7322
|
e[i] = r;
|
|
7286
7323
|
}
|
|
7287
7324
|
}
|
|
7288
7325
|
var W = { starter: 10, plus: 25, scale: 40, enterprise: 300 };
|
|
7289
|
-
function
|
|
7326
|
+
function Xi(e) {
|
|
7290
7327
|
if (e.count === void 0 || e.count === !0) return 1;
|
|
7291
7328
|
let t = typeof e.count == 'number' ? e.count : Number(e.count),
|
|
7292
7329
|
i = W.enterprise;
|
|
@@ -7299,7 +7336,7 @@ function Gi(e) {
|
|
|
7299
7336
|
t
|
|
7300
7337
|
);
|
|
7301
7338
|
}
|
|
7302
|
-
async function
|
|
7339
|
+
async function Zi(e, t, i, r, n) {
|
|
7303
7340
|
n.isJson ||
|
|
7304
7341
|
process.stderr.write(`Starting ${r} ${t} jobs together...
|
|
7305
7342
|
`);
|
|
@@ -7361,7 +7398,7 @@ async function Ji(e, t, i, r, n) {
|
|
|
7361
7398
|
else {
|
|
7362
7399
|
for (let l of o)
|
|
7363
7400
|
(process.stdout.write(`${l.request_id} ${l.status}`),
|
|
7364
|
-
l.usage?.cost !== void 0 && process.stdout.write(` ${
|
|
7401
|
+
l.usage?.cost !== void 0 && process.stdout.write(` ${we(l.usage.cost)}`),
|
|
7365
7402
|
l.error && process.stdout.write(` ${l.error}`),
|
|
7366
7403
|
process.stdout.write(`
|
|
7367
7404
|
`));
|
|
@@ -7372,9 +7409,9 @@ async function Ji(e, t, i, r, n) {
|
|
|
7372
7409
|
}
|
|
7373
7410
|
(u.length ||
|
|
7374
7411
|
o.some((l) => l.status === 'failed' || l.status === 'expired' || l.status === 'cancelled')) &&
|
|
7375
|
-
process.exit(
|
|
7412
|
+
process.exit(I);
|
|
7376
7413
|
}
|
|
7377
|
-
function
|
|
7414
|
+
function Et(e) {
|
|
7378
7415
|
let t = {},
|
|
7379
7416
|
i = new Set(),
|
|
7380
7417
|
r = [];
|
|
@@ -7419,7 +7456,7 @@ function Mt(e) {
|
|
|
7419
7456
|
}
|
|
7420
7457
|
return { command: r[0] || '', subcommand: r[1], modelSlug: r[1] || r[0], options: t, flags: i };
|
|
7421
7458
|
}
|
|
7422
|
-
async function
|
|
7459
|
+
async function De(e, t) {
|
|
7423
7460
|
let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
7424
7461
|
r = x(typeof t.api_url == 'string' ? t.api_url : void 0);
|
|
7425
7462
|
(i ||
|
|
@@ -7441,7 +7478,7 @@ async function Ae(e, t) {
|
|
|
7441
7478
|
s = !!t.json,
|
|
7442
7479
|
o = !!(t.async || t.no_wait),
|
|
7443
7480
|
u = typeof t.output == 'string' ? t.output : void 0,
|
|
7444
|
-
l =
|
|
7481
|
+
l = Xi(t),
|
|
7445
7482
|
c = { ...t };
|
|
7446
7483
|
(delete c.json,
|
|
7447
7484
|
delete c.async,
|
|
@@ -7450,8 +7487,8 @@ async function Ae(e, t) {
|
|
|
7450
7487
|
delete c.api_key,
|
|
7451
7488
|
delete c.api_url,
|
|
7452
7489
|
delete c.count);
|
|
7453
|
-
let p =
|
|
7454
|
-
(
|
|
7490
|
+
let p = $t(n, c);
|
|
7491
|
+
(Wi(p),
|
|
7455
7492
|
typeof p.image == 'string' && !p.images && ((p.images = [p.image]), delete p.image),
|
|
7456
7493
|
p.image_url &&
|
|
7457
7494
|
!p.first_frame_image &&
|
|
@@ -7463,15 +7500,15 @@ async function Ae(e, t) {
|
|
|
7463
7500
|
let f = p[y];
|
|
7464
7501
|
if (typeof f == 'string' && !f.startsWith('http://') && !f.startsWith('https://')) {
|
|
7465
7502
|
let v = A.default.resolve(f);
|
|
7466
|
-
if (
|
|
7503
|
+
if (D.default.existsSync(v) && D.default.statSync(v).isFile()) {
|
|
7467
7504
|
let P = new T(`Uploading local file ${A.default.basename(v)} to CDN...`);
|
|
7468
7505
|
s || P.start();
|
|
7469
7506
|
try {
|
|
7470
|
-
let
|
|
7471
|
-
X = await d.uploadAsset(
|
|
7507
|
+
let j = D.default.readFileSync(v),
|
|
7508
|
+
X = await d.uploadAsset(j.toString('base64'));
|
|
7472
7509
|
((p[y] = X.url), s || P.succeed(`Uploaded ${A.default.basename(v)} to CDN`));
|
|
7473
|
-
} catch (
|
|
7474
|
-
let X =
|
|
7510
|
+
} catch (j) {
|
|
7511
|
+
let X = j instanceof Error ? j.message : String(j);
|
|
7475
7512
|
(s
|
|
7476
7513
|
? process.stdout.write(
|
|
7477
7514
|
JSON.stringify({ error: X }) +
|
|
@@ -7484,11 +7521,11 @@ async function Ae(e, t) {
|
|
|
7484
7521
|
}
|
|
7485
7522
|
}
|
|
7486
7523
|
}
|
|
7487
|
-
await
|
|
7524
|
+
await Qi(p, async (y) => {
|
|
7488
7525
|
let f = new T(`Uploading local file ${A.default.basename(y)} to CDN...`);
|
|
7489
7526
|
s || f.start();
|
|
7490
7527
|
try {
|
|
7491
|
-
let v =
|
|
7528
|
+
let v = D.default.readFileSync(y),
|
|
7492
7529
|
P = await d.uploadAsset(v.toString('base64'));
|
|
7493
7530
|
return (s || f.succeed(`Uploaded ${A.default.basename(y)} to CDN`), P.url);
|
|
7494
7531
|
} catch (v) {
|
|
@@ -7508,7 +7545,7 @@ async function Ae(e, t) {
|
|
|
7508
7545
|
let g;
|
|
7509
7546
|
try {
|
|
7510
7547
|
if (l > 1) {
|
|
7511
|
-
await
|
|
7548
|
+
await Zi(d, e, p, l, { isJson: s, isAsync: o });
|
|
7512
7549
|
return;
|
|
7513
7550
|
}
|
|
7514
7551
|
g = await d.queueJob(e, p);
|
|
@@ -7532,7 +7569,7 @@ async function Ae(e, t) {
|
|
|
7532
7569
|
`)
|
|
7533
7570
|
: `Failed to start generation: ${y instanceof Error ? y.message : y}`,
|
|
7534
7571
|
),
|
|
7535
|
-
process.exit(f ? f.exitCode :
|
|
7572
|
+
process.exit(f ? f.exitCode : I));
|
|
7536
7573
|
}
|
|
7537
7574
|
if (o) {
|
|
7538
7575
|
s
|
|
@@ -7546,17 +7583,17 @@ async function Ae(e, t) {
|
|
|
7546
7583
|
`));
|
|
7547
7584
|
return;
|
|
7548
7585
|
}
|
|
7549
|
-
let
|
|
7550
|
-
|
|
7586
|
+
let fe = Date.now(),
|
|
7587
|
+
ge = 1500;
|
|
7551
7588
|
for (; g.status === 'processing';) {
|
|
7552
|
-
let y = Math.round((Date.now() -
|
|
7589
|
+
let y = Math.round((Date.now() - fe) / 1e3);
|
|
7553
7590
|
(s || h.update(`Rendering ${a.bold(e)} (${y}s elapsed)... [ID: ${g.request_id}]`),
|
|
7554
|
-
await new Promise((f) => setTimeout(f,
|
|
7591
|
+
await new Promise((f) => setTimeout(f, ge)));
|
|
7555
7592
|
try {
|
|
7556
7593
|
g = await d.getStatus(g.request_id);
|
|
7557
7594
|
} catch (f) {
|
|
7558
7595
|
f instanceof k &&
|
|
7559
|
-
f.exitCode !==
|
|
7596
|
+
f.exitCode !== I &&
|
|
7560
7597
|
(s ||
|
|
7561
7598
|
h.fail(
|
|
7562
7599
|
K(f).join(`
|
|
@@ -7574,7 +7611,7 @@ async function Ae(e, t) {
|
|
|
7574
7611
|
`,
|
|
7575
7612
|
)
|
|
7576
7613
|
: h.fail(`Generation ${g.status}: ${g.error || 'Something failed on our side.'}`),
|
|
7577
|
-
process.exit(
|
|
7614
|
+
process.exit(I)),
|
|
7578
7615
|
s || h.succeed(`Generation completed for ${a.bold(n?.name || e)}!`),
|
|
7579
7616
|
s)
|
|
7580
7617
|
) {
|
|
@@ -7593,7 +7630,7 @@ async function Ae(e, t) {
|
|
|
7593
7630
|
process.stdout.write(` ${a.bold('Request ID:')} ${g.request_id}
|
|
7594
7631
|
`),
|
|
7595
7632
|
g.usage?.cost !== void 0 &&
|
|
7596
|
-
process.stdout.write(` ${a.bold('Cost:')} ${
|
|
7633
|
+
process.stdout.write(` ${a.bold('Cost:')} ${we(g.usage.cost)}
|
|
7597
7634
|
`),
|
|
7598
7635
|
g.output && g.output.length > 0)
|
|
7599
7636
|
) {
|
|
@@ -7626,9 +7663,9 @@ ${f.text}
|
|
|
7626
7663
|
process.stdout.write(`
|
|
7627
7664
|
`);
|
|
7628
7665
|
}
|
|
7629
|
-
var
|
|
7666
|
+
var qt = _(require('node:readline'));
|
|
7630
7667
|
E();
|
|
7631
|
-
async function
|
|
7668
|
+
async function er(e) {
|
|
7632
7669
|
try {
|
|
7633
7670
|
return (await new M(e, x()).checkKey(), 'ok');
|
|
7634
7671
|
} catch (t) {
|
|
@@ -7639,8 +7676,8 @@ async function zi(e) {
|
|
|
7639
7676
|
return 'unchecked';
|
|
7640
7677
|
}
|
|
7641
7678
|
}
|
|
7642
|
-
function
|
|
7643
|
-
let t =
|
|
7679
|
+
function tr(e) {
|
|
7680
|
+
let t = qt.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
7644
7681
|
return new Promise((i) => {
|
|
7645
7682
|
t.question(e, (r) => {
|
|
7646
7683
|
(t.close(), i(r.trim()));
|
|
@@ -7659,20 +7696,20 @@ ${a.bold('Tein AI Authentication')}
|
|
|
7659
7696
|
process.stdout.write(`Get your API key at: ${a.cyan('https://tein.ai/dashboard/keys')}
|
|
7660
7697
|
|
|
7661
7698
|
`),
|
|
7662
|
-
(i = await
|
|
7699
|
+
(i = await tr('Enter your Tein API Key (sk_live_...): '))),
|
|
7663
7700
|
!i.startsWith('sk_live_') &&
|
|
7664
7701
|
!i.startsWith('sk_test_') &&
|
|
7665
7702
|
(process.stderr
|
|
7666
7703
|
.write(`${a.red('Error:')} Invalid key format. Tein API keys start with 'sk_live_' or 'sk_test_'.
|
|
7667
7704
|
`),
|
|
7668
7705
|
process.exit(1)));
|
|
7669
|
-
let r = await
|
|
7706
|
+
let r = await er(i);
|
|
7670
7707
|
(r === 'invalid' &&
|
|
7671
7708
|
(process.stderr
|
|
7672
7709
|
.write(`${a.red('Error:')} Tein did not accept this key. Copy it again from ${a.cyan('https://tein.ai/dashboard/keys')}. Nothing was saved.
|
|
7673
7710
|
`),
|
|
7674
7711
|
process.exit(1)),
|
|
7675
|
-
|
|
7712
|
+
be({ apiKey: i }),
|
|
7676
7713
|
process.stdout.write(`
|
|
7677
7714
|
${a.green('\u2713')} API key saved to ${a.dim(ie())}
|
|
7678
7715
|
`),
|
|
@@ -7691,13 +7728,13 @@ ${a.green('\u2713')} API key saved to ${a.dim(ie())}
|
|
|
7691
7728
|
break;
|
|
7692
7729
|
}
|
|
7693
7730
|
case 'logout': {
|
|
7694
|
-
if (!
|
|
7731
|
+
if (!V().apiKey) {
|
|
7695
7732
|
process.stdout
|
|
7696
7733
|
.write(`${a.yellow('\u2139')} No active API key found. You are already logged out.
|
|
7697
7734
|
`);
|
|
7698
7735
|
break;
|
|
7699
7736
|
}
|
|
7700
|
-
(
|
|
7737
|
+
(be({ apiKey: '' }),
|
|
7701
7738
|
process.stdout
|
|
7702
7739
|
.write(`${a.green('\u2713')} Logged out successfully. Stored API key has been cleared from ${a.dim(ie())}
|
|
7703
7740
|
`));
|
|
@@ -7706,7 +7743,7 @@ ${a.green('\u2713')} API key saved to ${a.dim(ie())}
|
|
|
7706
7743
|
default: {
|
|
7707
7744
|
let i = S(),
|
|
7708
7745
|
r = x(),
|
|
7709
|
-
n =
|
|
7746
|
+
n = V();
|
|
7710
7747
|
if (
|
|
7711
7748
|
(process.stdout.write(`
|
|
7712
7749
|
${a.bold('Tein AI CLI Configuration')}
|
|
@@ -7736,12 +7773,12 @@ ${a.bold('Tein AI CLI Configuration')}
|
|
|
7736
7773
|
}
|
|
7737
7774
|
}
|
|
7738
7775
|
E();
|
|
7739
|
-
|
|
7776
|
+
ke();
|
|
7740
7777
|
H();
|
|
7741
|
-
var
|
|
7742
|
-
async function
|
|
7778
|
+
var ir = 3e3;
|
|
7779
|
+
async function At(e) {
|
|
7743
7780
|
try {
|
|
7744
|
-
let t = await fetch(`${x(e)}/v1/pricing`, { signal: AbortSignal.timeout(
|
|
7781
|
+
let t = await fetch(`${x(e)}/v1/pricing`, { signal: AbortSignal.timeout(ir) });
|
|
7745
7782
|
if (!t.ok) return;
|
|
7746
7783
|
let i = await t.json(),
|
|
7747
7784
|
r = {};
|
|
@@ -7749,18 +7786,18 @@ async function St(e) {
|
|
|
7749
7786
|
let s = String(n.modelSlug ?? '');
|
|
7750
7787
|
F.has(s) && (r[s] ??= []).push(Number(n.starterPrice));
|
|
7751
7788
|
}
|
|
7752
|
-
|
|
7789
|
+
_t(r);
|
|
7753
7790
|
} catch {}
|
|
7754
7791
|
}
|
|
7755
|
-
var
|
|
7756
|
-
|
|
7757
|
-
async function
|
|
7758
|
-
await
|
|
7792
|
+
var rr = new Set(['video', 'image', 'text', 'audio', '3d']),
|
|
7793
|
+
ar = { llm: 'text', chat: 'text', reasoning: 'text' };
|
|
7794
|
+
async function Rt(e, t) {
|
|
7795
|
+
await At(t);
|
|
7759
7796
|
let i = q();
|
|
7760
7797
|
if (e) {
|
|
7761
7798
|
let s = e.toLowerCase(),
|
|
7762
|
-
o =
|
|
7763
|
-
i =
|
|
7799
|
+
o = ar[s] ?? s;
|
|
7800
|
+
i = rr.has(o)
|
|
7764
7801
|
? i.filter((u) => u.category.toLowerCase() === o)
|
|
7765
7802
|
: i.filter((u) => u.kind.toLowerCase().includes(s) || u.slug.toLowerCase().includes(s));
|
|
7766
7803
|
}
|
|
@@ -7798,8 +7835,8 @@ ${a.bold('Tein AI Models Catalog')} (${i.length} available)
|
|
|
7798
7835
|
|
|
7799
7836
|
`);
|
|
7800
7837
|
}
|
|
7801
|
-
async function
|
|
7802
|
-
F.has(e) && (await
|
|
7838
|
+
async function Ot(e, t) {
|
|
7839
|
+
F.has(e) && (await At(t));
|
|
7803
7840
|
let i = U(e);
|
|
7804
7841
|
(i ||
|
|
7805
7842
|
(process.stderr.write(`${a.red('Error:')} Model "${e}" not found in Tein AI registry.
|
|
@@ -7880,9 +7917,9 @@ ${a.bold(a.cyan(i.name))} (${a.bold(i.slug)})
|
|
|
7880
7917
|
`);
|
|
7881
7918
|
}
|
|
7882
7919
|
E();
|
|
7883
|
-
|
|
7884
|
-
var
|
|
7885
|
-
|
|
7920
|
+
Le();
|
|
7921
|
+
var nr = 1e4,
|
|
7922
|
+
Ne = {
|
|
7886
7923
|
price: '',
|
|
7887
7924
|
creativeMode: 'Creative mode',
|
|
7888
7925
|
priority: 'Priority',
|
|
@@ -7892,22 +7929,22 @@ var Xi = 1e4,
|
|
|
7892
7929
|
priorityDraft: 'Priority + Draft',
|
|
7893
7930
|
creativeModePriorityDraft: 'Creative mode + Priority + Draft',
|
|
7894
7931
|
},
|
|
7895
|
-
|
|
7896
|
-
|
|
7932
|
+
sr = Object.keys(Ne),
|
|
7933
|
+
or = {
|
|
7897
7934
|
creativeMode: 'unfiltered',
|
|
7898
7935
|
creativeModePriority: 'unfilteredPriority',
|
|
7899
7936
|
creativeModeDraft: 'unfilteredDraft',
|
|
7900
7937
|
creativeModePriorityDraft: 'unfilteredPriorityDraft',
|
|
7901
7938
|
};
|
|
7902
|
-
function
|
|
7903
|
-
let i =
|
|
7939
|
+
function lr(e, t) {
|
|
7940
|
+
let i = or[t];
|
|
7904
7941
|
return e[t] ?? (i ? e[i] : void 0);
|
|
7905
7942
|
}
|
|
7906
|
-
async function
|
|
7907
|
-
let i = `${x(e)}${
|
|
7943
|
+
async function pr(e, t) {
|
|
7944
|
+
let i = `${x(e)}${me(t)}`,
|
|
7908
7945
|
r;
|
|
7909
7946
|
try {
|
|
7910
|
-
r = await fetch(i, { signal: AbortSignal.timeout(
|
|
7947
|
+
r = await fetch(i, { signal: AbortSignal.timeout(nr) });
|
|
7911
7948
|
} catch {
|
|
7912
7949
|
throw new Error(`Could not reach ${i}`);
|
|
7913
7950
|
}
|
|
@@ -7923,18 +7960,18 @@ async function ir(e, t) {
|
|
|
7923
7960
|
}
|
|
7924
7961
|
return n;
|
|
7925
7962
|
}
|
|
7926
|
-
function
|
|
7963
|
+
function Ve(e) {
|
|
7927
7964
|
let t = e.toFixed(4).replace(/0+$/, '').replace(/\.$/, ''),
|
|
7928
7965
|
[i, r = ''] = t.split('.');
|
|
7929
7966
|
return `$${i}.${r.padEnd(2, '0')}`;
|
|
7930
7967
|
}
|
|
7931
|
-
function
|
|
7968
|
+
function Ue(e) {
|
|
7932
7969
|
if (!e || typeof e.starter != 'number') return null;
|
|
7933
7970
|
let t = typeof e.plus == 'number' ? e.plus : e.starter,
|
|
7934
7971
|
i = typeof e.scale == 'number' ? e.scale : t;
|
|
7935
|
-
return `Starter ${
|
|
7972
|
+
return `Starter ${Ve(e.starter)} Plus ${Ve(t)} Scale ${Ve(i)}`;
|
|
7936
7973
|
}
|
|
7937
|
-
function
|
|
7974
|
+
function dr(e) {
|
|
7938
7975
|
if (typeof e.label == 'string' && e.label.trim()) return e.label.trim();
|
|
7939
7976
|
let t = [];
|
|
7940
7977
|
for (let i of ['endpoint', 'resolution', 'quality', 'mode', 'task', 'component', 'token']) {
|
|
@@ -7946,33 +7983,33 @@ function rr(e) {
|
|
|
7946
7983
|
t.length ? t.join(' \xB7 ') : String(e.id ?? 'default')
|
|
7947
7984
|
);
|
|
7948
7985
|
}
|
|
7949
|
-
function
|
|
7950
|
-
let i =
|
|
7951
|
-
for (let r of
|
|
7952
|
-
let n =
|
|
7986
|
+
function cr(e, t) {
|
|
7987
|
+
let i = dr(e);
|
|
7988
|
+
for (let r of sr) {
|
|
7989
|
+
let n = Ue(lr(e, r));
|
|
7953
7990
|
if (!n) continue;
|
|
7954
|
-
let s =
|
|
7991
|
+
let s = Ne[r] ? ` (${Ne[r]})` : '';
|
|
7955
7992
|
t.push(` ${i}${s} ${n}`);
|
|
7956
7993
|
}
|
|
7957
7994
|
}
|
|
7958
|
-
function
|
|
7995
|
+
function ur(e, t) {
|
|
7959
7996
|
let i = e.quality ? ` quality=${e.quality}` : '';
|
|
7960
7997
|
t.push(
|
|
7961
7998
|
` ${a.bold(e.slug.padEnd(26))} ${a.gray(e.name)} ${a.dim(`${e.kind} ${e.unit} model=${e.model}${i}`)}`,
|
|
7962
7999
|
);
|
|
7963
|
-
for (let n of e.variants ?? [])
|
|
8000
|
+
for (let n of e.variants ?? []) cr(n, t);
|
|
7964
8001
|
let r = e.addons;
|
|
7965
8002
|
if (Array.isArray(r))
|
|
7966
8003
|
for (let n of r) {
|
|
7967
8004
|
if (!n || typeof n != 'object') continue;
|
|
7968
8005
|
let s = n,
|
|
7969
8006
|
o = typeof s.label == 'string' ? s.label : String(s.id ?? 'add-on'),
|
|
7970
|
-
u =
|
|
8007
|
+
u = Ue(s.price);
|
|
7971
8008
|
u && t.push(` ${o} (add-on) ${u}`);
|
|
7972
8009
|
}
|
|
7973
8010
|
t.push('');
|
|
7974
8011
|
}
|
|
7975
|
-
function
|
|
8012
|
+
function mr(e) {
|
|
7976
8013
|
let t = [],
|
|
7977
8014
|
i = e.board.checked ? ` \xB7 checked ${e.board.checked}` : '';
|
|
7978
8015
|
(t.push(`${a.bold('Tein prices')} ${a.green(e.currency)} ${e.count} models${i}`),
|
|
@@ -7994,7 +8031,7 @@ function sr(e) {
|
|
|
7994
8031
|
});
|
|
7995
8032
|
for (let l of s) {
|
|
7996
8033
|
t.push(`${a.bold(a.cyan(`\u2500\u2500 ${l} \u2500\u2500`))}`);
|
|
7997
|
-
for (let c of r.get(l) ?? [])
|
|
8034
|
+
for (let c of r.get(l) ?? []) ur(c, t);
|
|
7998
8035
|
}
|
|
7999
8036
|
let o = new Set(e.board.models.map((l) => l.slug.toLowerCase())),
|
|
8000
8037
|
u = (e.configs ?? []).filter((l) => !o.has(String(l.modelSlug ?? '').toLowerCase()));
|
|
@@ -8011,7 +8048,7 @@ function sr(e) {
|
|
|
8011
8048
|
t.push(` ${a.bold(c.padEnd(26))} ${a.gray(d)}`);
|
|
8012
8049
|
for (let m of p) {
|
|
8013
8050
|
let h = String(m.displayLabel ?? m.billingUnit ?? 'price'),
|
|
8014
|
-
g =
|
|
8051
|
+
g = Ue(m.prices);
|
|
8015
8052
|
g && t.push(` ${h} ${g}`);
|
|
8016
8053
|
}
|
|
8017
8054
|
t.push('');
|
|
@@ -8024,10 +8061,10 @@ function sr(e) {
|
|
|
8024
8061
|
`
|
|
8025
8062
|
);
|
|
8026
8063
|
}
|
|
8027
|
-
async function
|
|
8064
|
+
async function Dt(e) {
|
|
8028
8065
|
let t;
|
|
8029
8066
|
try {
|
|
8030
|
-
t = await
|
|
8067
|
+
t = await pr(e.apiUrl, e.model);
|
|
8031
8068
|
} catch (i) {
|
|
8032
8069
|
let r = i instanceof Error ? i.message : String(i);
|
|
8033
8070
|
(process.stderr.write(`${a.red('Error:')} ${r}
|
|
@@ -8038,12 +8075,12 @@ async function Et(e) {
|
|
|
8038
8075
|
e.json
|
|
8039
8076
|
? `${JSON.stringify(t, null, 2)}
|
|
8040
8077
|
`
|
|
8041
|
-
:
|
|
8078
|
+
: mr(t),
|
|
8042
8079
|
);
|
|
8043
8080
|
}
|
|
8044
|
-
var
|
|
8081
|
+
var Lt = _(require('node:path'));
|
|
8045
8082
|
E();
|
|
8046
|
-
async function
|
|
8083
|
+
async function Vt(e, t) {
|
|
8047
8084
|
let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
8048
8085
|
r = x(typeof t.api_url == 'string' ? t.api_url : void 0);
|
|
8049
8086
|
(i ||
|
|
@@ -8086,7 +8123,7 @@ async function At(e, t) {
|
|
|
8086
8123
|
),
|
|
8087
8124
|
process.exit(p.exitCode)),
|
|
8088
8125
|
n || l.fail(p instanceof Error ? p.message : String(p)),
|
|
8089
|
-
process.exit(
|
|
8126
|
+
process.exit(I));
|
|
8090
8127
|
}
|
|
8091
8128
|
if (s && c.status === 'processing') {
|
|
8092
8129
|
let p = Date.now();
|
|
@@ -8138,7 +8175,7 @@ ${a.bold('Outputs:')}
|
|
|
8138
8175
|
) {
|
|
8139
8176
|
let d = new T(`Downloading output to ${o}...`).start();
|
|
8140
8177
|
try {
|
|
8141
|
-
(await u.downloadOutput(p.url,
|
|
8178
|
+
(await u.downloadOutput(p.url, Lt.default.resolve(process.cwd(), o)),
|
|
8142
8179
|
d.succeed(`Saved to ${a.bold(o)}`));
|
|
8143
8180
|
} catch (m) {
|
|
8144
8181
|
d.fail(`Failed to download: ${m instanceof Error ? m.message : m}`);
|
|
@@ -8153,10 +8190,10 @@ ${p.text}
|
|
|
8153
8190
|
process.stdout.write(`
|
|
8154
8191
|
`);
|
|
8155
8192
|
}
|
|
8156
|
-
var
|
|
8157
|
-
|
|
8193
|
+
var Be = _(require('node:fs')),
|
|
8194
|
+
je = _(require('node:path'));
|
|
8158
8195
|
E();
|
|
8159
|
-
async function
|
|
8196
|
+
async function Nt(e, t = {}) {
|
|
8160
8197
|
let i = S(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
8161
8198
|
r = x(typeof t.api_url == 'string' ? t.api_url : void 0),
|
|
8162
8199
|
n = !!t.json;
|
|
@@ -8173,13 +8210,13 @@ async function Rt(e, t = {}) {
|
|
|
8173
8210
|
process.stderr.write(`Usage: ${a.cyan('tein upload <image.png|video.mp4>')}
|
|
8174
8211
|
`),
|
|
8175
8212
|
process.exit(1)));
|
|
8176
|
-
let s =
|
|
8177
|
-
|
|
8213
|
+
let s = je.default.resolve(e);
|
|
8214
|
+
Be.default.existsSync(s) ||
|
|
8178
8215
|
(process.stderr.write(`${a.red('Error:')} File not found: ${s}
|
|
8179
8216
|
`),
|
|
8180
8217
|
process.exit(1));
|
|
8181
|
-
let o =
|
|
8182
|
-
l =
|
|
8218
|
+
let o = je.default.basename(s),
|
|
8219
|
+
l = Be.default.readFileSync(s).toString('base64'),
|
|
8183
8220
|
c = new M(i, r),
|
|
8184
8221
|
p = new T(`Uploading ${a.bold(o)} to Tein AI CDN...`);
|
|
8185
8222
|
n || p.start();
|
|
@@ -8217,12 +8254,12 @@ ${a.bold('CDN URL:')} ${a.green(d.url)}
|
|
|
8217
8254
|
`,
|
|
8218
8255
|
)
|
|
8219
8256
|
: p.fail(`Upload failed: ${h}`),
|
|
8220
|
-
process.exit(m ? m.exitCode :
|
|
8257
|
+
process.exit(m ? m.exitCode : I));
|
|
8221
8258
|
}
|
|
8222
8259
|
}
|
|
8223
8260
|
H();
|
|
8224
|
-
|
|
8225
|
-
function
|
|
8261
|
+
Se();
|
|
8262
|
+
function ii() {
|
|
8226
8263
|
process.stdout.write(`
|
|
8227
8264
|
${a.bold(a.cyan('Tein AI CLI'))} - Official Command-Line Interface for Tein AI models
|
|
8228
8265
|
|
|
@@ -8282,11 +8319,11 @@ ${a.bold('EXAMPLES:')}
|
|
|
8282
8319
|
|
|
8283
8320
|
`);
|
|
8284
8321
|
}
|
|
8285
|
-
async function
|
|
8322
|
+
async function Cr() {
|
|
8286
8323
|
let e = process.argv.slice(2),
|
|
8287
|
-
t =
|
|
8324
|
+
t = Et(e);
|
|
8288
8325
|
if (t.flags.has('help') || t.options.help || t.command === 'help') {
|
|
8289
|
-
|
|
8326
|
+
ii();
|
|
8290
8327
|
return;
|
|
8291
8328
|
}
|
|
8292
8329
|
if (t.flags.has('version') || t.options.version || t.command === 'version') {
|
|
@@ -8313,14 +8350,14 @@ async function _r() {
|
|
|
8313
8350
|
}
|
|
8314
8351
|
case 'models':
|
|
8315
8352
|
case 'list': {
|
|
8316
|
-
await
|
|
8353
|
+
await Rt(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0);
|
|
8317
8354
|
break;
|
|
8318
8355
|
}
|
|
8319
8356
|
case 'pricing':
|
|
8320
8357
|
case 'prices': {
|
|
8321
8358
|
let i = t.options.model,
|
|
8322
8359
|
r = t.subcommand || (typeof i == 'string' ? i : void 0);
|
|
8323
|
-
await
|
|
8360
|
+
await Dt({
|
|
8324
8361
|
model: r,
|
|
8325
8362
|
json: !!t.options.json,
|
|
8326
8363
|
apiUrl: typeof t.options.api_url == 'string' ? t.options.api_url : void 0,
|
|
@@ -8335,48 +8372,48 @@ async function _r() {
|
|
|
8335
8372
|
process.stderr.write(`Usage: ${a.cyan('tein info <model-slug>')}
|
|
8336
8373
|
`),
|
|
8337
8374
|
process.exit(1)),
|
|
8338
|
-
await
|
|
8375
|
+
await Ot(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0));
|
|
8339
8376
|
break;
|
|
8340
8377
|
}
|
|
8341
8378
|
case 'upload': {
|
|
8342
8379
|
let i = t.subcommand || '';
|
|
8343
|
-
await
|
|
8380
|
+
await Nt(i, t.options);
|
|
8344
8381
|
break;
|
|
8345
8382
|
}
|
|
8346
8383
|
case 'run':
|
|
8347
8384
|
case 'generate': {
|
|
8348
8385
|
let i = t.subcommand || '';
|
|
8349
|
-
await
|
|
8386
|
+
await De(i, t.options);
|
|
8350
8387
|
break;
|
|
8351
8388
|
}
|
|
8352
8389
|
case 'status': {
|
|
8353
8390
|
let i = t.subcommand || '';
|
|
8354
|
-
await
|
|
8391
|
+
await Vt(i, t.options);
|
|
8355
8392
|
break;
|
|
8356
8393
|
}
|
|
8357
8394
|
case 'mcp': {
|
|
8358
|
-
let { startStdioServer: i } = await Promise.resolve().then(() => (
|
|
8395
|
+
let { startStdioServer: i } = await Promise.resolve().then(() => (ti(), ei));
|
|
8359
8396
|
await i();
|
|
8360
8397
|
break;
|
|
8361
8398
|
}
|
|
8362
8399
|
default: {
|
|
8363
8400
|
if (t.command && !t.command.startsWith('-')) {
|
|
8364
8401
|
(!U(t.command) &&
|
|
8365
|
-
!
|
|
8402
|
+
!pe[t.command] &&
|
|
8366
8403
|
(process.stderr.write(`
|
|
8367
8404
|
${a.red('Error:')} Unknown command or model "${t.command}".
|
|
8368
8405
|
Run ${a.cyan('tein --help')} for the commands, or ${a.cyan('tein models')} for the model slugs.
|
|
8369
8406
|
`),
|
|
8370
|
-
process.exit(
|
|
8371
|
-
await
|
|
8407
|
+
process.exit(I)),
|
|
8408
|
+
await De(t.command, t.options));
|
|
8372
8409
|
return;
|
|
8373
8410
|
}
|
|
8374
|
-
|
|
8411
|
+
ii();
|
|
8375
8412
|
break;
|
|
8376
8413
|
}
|
|
8377
8414
|
}
|
|
8378
8415
|
}
|
|
8379
|
-
|
|
8416
|
+
Cr().catch((e) => {
|
|
8380
8417
|
(e instanceof k &&
|
|
8381
8418
|
(process.stderr.write(`
|
|
8382
8419
|
${a.red('Error:')} ${K(e).join(`
|
|
@@ -8386,5 +8423,5 @@ ${a.red('Error:')} ${K(e).join(`
|
|
|
8386
8423
|
process.stderr.write(`
|
|
8387
8424
|
${a.red('Fatal error:')} ${e instanceof Error ? e.message : e}
|
|
8388
8425
|
`),
|
|
8389
|
-
process.exit(
|
|
8426
|
+
process.exit(I));
|
|
8390
8427
|
});
|