@teinai/cli 1.1.26 → 1.1.27
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 +736 -621
- 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 gr = Object.create;
|
|
4
|
+
var xe = Object.defineProperty;
|
|
5
|
+
var hr = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var yr = Object.getOwnPropertyNames;
|
|
7
|
+
var br = Object.getPrototypeOf,
|
|
8
|
+
kr = Object.prototype.hasOwnProperty;
|
|
9
9
|
var y = (e, t, r) => () => {
|
|
10
10
|
if (r) throw r[0];
|
|
11
11
|
try {
|
|
@@ -14,96 +14,96 @@ var y = (e, t, r) => () => {
|
|
|
14
14
|
throw ((r = [a]), a);
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
var
|
|
18
|
-
for (var r in t)
|
|
17
|
+
var wr = (e, t) => {
|
|
18
|
+
for (var r in t) xe(e, r, { get: t[r], enumerable: !0 });
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
xr = (e, t, r, a) => {
|
|
21
21
|
if ((t && typeof t == 'object') || typeof t == 'function')
|
|
22
|
-
for (let n of
|
|
23
|
-
!
|
|
22
|
+
for (let n of yr(t))
|
|
23
|
+
!kr.call(e, n) &&
|
|
24
24
|
n !== r &&
|
|
25
|
-
|
|
25
|
+
xe(e, n, { get: () => t[n], enumerable: !(a = hr(t, n)) || a.enumerable });
|
|
26
26
|
return e;
|
|
27
27
|
};
|
|
28
28
|
var _ = (e, t, r) => (
|
|
29
|
-
(r = e != null ?
|
|
30
|
-
|
|
29
|
+
(r = e != null ? gr(br(e)) : {}),
|
|
30
|
+
xr(t || !e || !e.__esModule ? xe(r, 'default', { value: e, enumerable: !0 }) : r, e)
|
|
31
31
|
);
|
|
32
|
-
function
|
|
32
|
+
function V() {
|
|
33
33
|
try {
|
|
34
|
-
if (
|
|
35
|
-
let e =
|
|
34
|
+
if ($.default.existsSync(U)) {
|
|
35
|
+
let e = $.default.readFileSync(U, 'utf-8');
|
|
36
36
|
return JSON.parse(e);
|
|
37
37
|
}
|
|
38
38
|
} catch {}
|
|
39
39
|
return {};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function Ie(e) {
|
|
42
42
|
try {
|
|
43
|
-
|
|
44
|
-
let r = { ...
|
|
45
|
-
(
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
$.default.existsSync(ae) || $.default.mkdirSync(ae, { recursive: !0, mode: 448 });
|
|
44
|
+
let r = { ...V(), ...e };
|
|
45
|
+
($.default.writeFileSync(U, JSON.stringify(r, null, 2), { encoding: 'utf-8', mode: 384 }),
|
|
46
|
+
$.default.chmodSync(ae, 448),
|
|
47
|
+
$.default.chmodSync(U, 384));
|
|
48
48
|
} catch (t) {
|
|
49
|
-
throw new Error(`Failed to save config to ${
|
|
49
|
+
throw new Error(`Failed to save config to ${U}: ${t}`);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function E(e) {
|
|
53
53
|
if (e && e.trim()) return e.trim();
|
|
54
54
|
let t = process.env.TEIN_API_KEY || process.env.TEIN_KEY;
|
|
55
55
|
if (t && t.trim()) return t.trim();
|
|
56
|
-
let r =
|
|
56
|
+
let r = V();
|
|
57
57
|
return r.apiKey && r.apiKey.trim() ? r.apiKey.trim() : '';
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function I(e) {
|
|
60
60
|
if (e && e.trim()) return e.trim().replace(/\/+$/, '');
|
|
61
61
|
let t = process.env.TEIN_API_URL;
|
|
62
62
|
if (t && t.trim()) return t.trim().replace(/\/+$/, '');
|
|
63
|
-
let r =
|
|
63
|
+
let r = V();
|
|
64
64
|
return r.apiUrl && r.apiUrl.trim() ? r.apiUrl.trim().replace(/\/+$/, '') : 'https://api.tein.ai';
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
66
|
+
function ie() {
|
|
67
|
+
return U;
|
|
68
68
|
}
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
var $,
|
|
70
|
+
nt,
|
|
71
|
+
Pe,
|
|
72
|
+
ae,
|
|
73
|
+
U,
|
|
74
74
|
A = y(() => {
|
|
75
75
|
'use strict';
|
|
76
|
-
((
|
|
77
|
-
(
|
|
78
|
-
(
|
|
79
|
-
(
|
|
80
|
-
(
|
|
76
|
+
(($ = _(require('node:fs'))),
|
|
77
|
+
(nt = _(require('node:os'))),
|
|
78
|
+
(Pe = _(require('node:path'))),
|
|
79
|
+
(ae = Pe.default.join(nt.default.homedir(), '.tein')),
|
|
80
|
+
(U = Pe.default.join(ae, 'config.json')));
|
|
81
81
|
});
|
|
82
|
-
var
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
var Mr,
|
|
83
|
+
st,
|
|
84
|
+
ot,
|
|
85
|
+
lt = y(() => {
|
|
86
86
|
'use strict';
|
|
87
|
-
((
|
|
88
|
-
(
|
|
89
|
-
(
|
|
87
|
+
((Mr = ['1:1', '16:9', '9:16', '21:9', '3:2', '2:3', '4:3', '3:4']),
|
|
88
|
+
(st = [...Mr, 'auto']),
|
|
89
|
+
(ot =
|
|
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 G,
|
|
93
|
-
|
|
93
|
+
ve = y(() => {
|
|
94
94
|
'use strict';
|
|
95
95
|
G = new Set(['nano-banana-2.1', 'seedance-2-lite', 'seedance-2-5-lite']);
|
|
96
96
|
});
|
|
97
|
-
function
|
|
97
|
+
function ne(e) {
|
|
98
98
|
return !1;
|
|
99
99
|
}
|
|
100
|
-
var
|
|
100
|
+
var pt = y(() => {
|
|
101
101
|
'use strict';
|
|
102
102
|
});
|
|
103
|
-
var
|
|
104
|
-
|
|
103
|
+
var se,
|
|
104
|
+
dt = y(() => {
|
|
105
105
|
'use strict';
|
|
106
|
-
|
|
106
|
+
se = {
|
|
107
107
|
source: 'TEIN Price Board',
|
|
108
108
|
checked: '17 Sep 2026',
|
|
109
109
|
generated: '2026-10-01',
|
|
@@ -5842,11 +5842,11 @@ var ie,
|
|
|
5842
5842
|
],
|
|
5843
5843
|
};
|
|
5844
5844
|
});
|
|
5845
|
-
var
|
|
5846
|
-
|
|
5847
|
-
|
|
5845
|
+
var oe,
|
|
5846
|
+
ct,
|
|
5847
|
+
Te = y(() => {
|
|
5848
5848
|
'use strict';
|
|
5849
|
-
((
|
|
5849
|
+
((oe = [
|
|
5850
5850
|
{
|
|
5851
5851
|
slug: 'tein-video-upscaler',
|
|
5852
5852
|
name: 'Tein Video Upscaler',
|
|
@@ -5918,12 +5918,12 @@ var ne,
|
|
|
5918
5918
|
from: { variant: 'swap' },
|
|
5919
5919
|
},
|
|
5920
5920
|
]),
|
|
5921
|
-
(
|
|
5921
|
+
(ct = [{ slug: 'tein-labs', name: 'Tein Labs', models: ['tein-video-upscaler', 'doppel'] }]));
|
|
5922
5922
|
});
|
|
5923
|
-
function
|
|
5923
|
+
function Se(e, t) {
|
|
5924
5924
|
return `${e.trim().toLowerCase()}|${(t ?? '').trim().toLowerCase()}`;
|
|
5925
5925
|
}
|
|
5926
|
-
function
|
|
5926
|
+
function Er(e, t) {
|
|
5927
5927
|
if (e === 'seedance-2-mini') return 'mini';
|
|
5928
5928
|
if (e !== 'seedance-2') return;
|
|
5929
5929
|
let r = typeof t?.quality == 'string' ? t.quality.trim().toLowerCase() : '';
|
|
@@ -5933,93 +5933,93 @@ function Ir(e, t) {
|
|
|
5933
5933
|
? 'fast'
|
|
5934
5934
|
: 'standard';
|
|
5935
5935
|
}
|
|
5936
|
-
function
|
|
5936
|
+
function qr(e, t) {
|
|
5937
5937
|
let r = e
|
|
5938
5938
|
.trim()
|
|
5939
5939
|
.toLowerCase()
|
|
5940
5940
|
.replace(/-(?:unfiltered|uncensored)$/, '');
|
|
5941
5941
|
if (r === 'seedance-2' || r === 'seedance-2-mini') {
|
|
5942
|
-
let n =
|
|
5943
|
-
s =
|
|
5942
|
+
let n = Er(r, t),
|
|
5943
|
+
s = Me.get(Se('seedance-2', n));
|
|
5944
5944
|
return s ? s.slug : null;
|
|
5945
5945
|
}
|
|
5946
|
-
let a =
|
|
5946
|
+
let a = le.get(r) ?? Me.get(Se(r));
|
|
5947
5947
|
return a ? a.slug : null;
|
|
5948
5948
|
}
|
|
5949
|
-
function
|
|
5950
|
-
return
|
|
5949
|
+
function $r(e, t) {
|
|
5950
|
+
return le.has(e) && !(Cr.has(e) && t) ? e : qr(e, t);
|
|
5951
5951
|
}
|
|
5952
|
-
function
|
|
5953
|
-
let r =
|
|
5954
|
-
return r ? (
|
|
5952
|
+
function H(e, t) {
|
|
5953
|
+
let r = $r(e, t);
|
|
5954
|
+
return r ? (le.get(r) ?? null) : null;
|
|
5955
5955
|
}
|
|
5956
|
-
function
|
|
5957
|
-
return
|
|
5956
|
+
function pe() {
|
|
5957
|
+
return gt;
|
|
5958
5958
|
}
|
|
5959
|
-
var
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5959
|
+
var mt,
|
|
5960
|
+
ft,
|
|
5961
|
+
gt,
|
|
5962
|
+
Kr,
|
|
5963
|
+
le,
|
|
5964
|
+
Me,
|
|
5965
|
+
ut,
|
|
5966
|
+
Sr,
|
|
5967
|
+
Ke,
|
|
5968
|
+
Cr,
|
|
5969
|
+
F = y(() => {
|
|
5970
5970
|
'use strict';
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
((
|
|
5975
|
-
...
|
|
5976
|
-
families:
|
|
5977
|
-
models:
|
|
5971
|
+
pt();
|
|
5972
|
+
dt();
|
|
5973
|
+
Te();
|
|
5974
|
+
((mt = {
|
|
5975
|
+
...se,
|
|
5976
|
+
families: se.families.map((e) => ({ ...e, models: e.models.filter((t) => !ne(t)) })),
|
|
5977
|
+
models: se.models.filter((e) => !ne(e.slug)),
|
|
5978
5978
|
}),
|
|
5979
|
-
(
|
|
5980
|
-
(
|
|
5981
|
-
(
|
|
5982
|
-
...
|
|
5983
|
-
...
|
|
5984
|
-
.map((e) => ({ ...e, models:
|
|
5979
|
+
(ft = oe.filter((e) => !ne(e.slug))),
|
|
5980
|
+
(gt = [...mt.models, ...ft]),
|
|
5981
|
+
(Kr = [
|
|
5982
|
+
...mt.families,
|
|
5983
|
+
...ct
|
|
5984
|
+
.map((e) => ({ ...e, models: ft.filter((t) => t.family === e.slug).map((t) => t.slug) }))
|
|
5985
5985
|
.filter((e) => e.models.length > 0),
|
|
5986
5986
|
]),
|
|
5987
|
-
(
|
|
5988
|
-
(
|
|
5989
|
-
(
|
|
5990
|
-
(
|
|
5991
|
-
(
|
|
5992
|
-
for (let e of
|
|
5993
|
-
(
|
|
5994
|
-
for (let t of e.variants)
|
|
5987
|
+
(le = new Map()),
|
|
5988
|
+
(Me = new Map()),
|
|
5989
|
+
(ut = new Map()),
|
|
5990
|
+
(Sr = new Map()),
|
|
5991
|
+
(Ke = new Map()));
|
|
5992
|
+
for (let e of gt) {
|
|
5993
|
+
(le.set(e.slug, e), Me.set(Se(e.api.model, e.api.quality), e));
|
|
5994
|
+
for (let t of e.variants) ut.set(`${e.slug}/${t.id}`, { model: e, variant: t, edit: !1 });
|
|
5995
5995
|
for (let t of e.editVariants ?? [])
|
|
5996
|
-
|
|
5997
|
-
for (let t of e.addons ?? [])
|
|
5998
|
-
|
|
5996
|
+
ut.set(`${e.slug}/edit/${t.id}`, { model: e, variant: t, edit: !0 });
|
|
5997
|
+
for (let t of e.addons ?? []) Sr.set(`${e.slug}/addon/${t.id}`, { model: e, addon: t });
|
|
5998
|
+
Ke.set(e.slug, e.family);
|
|
5999
5999
|
}
|
|
6000
|
-
for (let e of
|
|
6001
|
-
|
|
6000
|
+
for (let e of Kr) for (let t of e.models) Ke.has(t) || Ke.set(t, e.slug);
|
|
6001
|
+
Cr = new Set(['seedance-2']);
|
|
6002
6002
|
});
|
|
6003
|
-
function
|
|
6003
|
+
function de(e) {
|
|
6004
6004
|
let t = e.from?.variant;
|
|
6005
6005
|
return (t && e.variants.find((r) => r.id === t)) || e.variants[0];
|
|
6006
6006
|
}
|
|
6007
|
-
function
|
|
6007
|
+
function Ee(e) {
|
|
6008
6008
|
if (e.endpoints?.length)
|
|
6009
|
-
return e.editVariants?.length && e.endpoints.some((t) => t.id ===
|
|
6010
|
-
?
|
|
6009
|
+
return e.editVariants?.length && e.endpoints.some((t) => t.id === ht)
|
|
6010
|
+
? ht
|
|
6011
6011
|
: (e.defaultEndpoint ?? e.endpoints[0].id);
|
|
6012
6012
|
}
|
|
6013
|
-
var
|
|
6014
|
-
|
|
6013
|
+
var ht,
|
|
6014
|
+
qe = y(() => {
|
|
6015
6015
|
'use strict';
|
|
6016
|
-
|
|
6017
|
-
|
|
6016
|
+
F();
|
|
6017
|
+
ht = 'dynamic';
|
|
6018
6018
|
});
|
|
6019
|
-
var
|
|
6020
|
-
|
|
6019
|
+
var ce,
|
|
6020
|
+
Ce = y(() => {
|
|
6021
6021
|
'use strict';
|
|
6022
|
-
|
|
6022
|
+
ce = {
|
|
6023
6023
|
'gemini-3-8-flash': 'gemini-3.8-flash',
|
|
6024
6024
|
'gemini-3-7-flash': 'gemini-3.7-flash',
|
|
6025
6025
|
'gemini-3-1-pro-preview': 'gemini-3.1-pro-preview',
|
|
@@ -6029,29 +6029,29 @@ var pe,
|
|
|
6029
6029
|
'gpt-image-2-6-sunburst': 'gpt-image-2.6-sunburst',
|
|
6030
6030
|
};
|
|
6031
6031
|
});
|
|
6032
|
-
var
|
|
6032
|
+
var yt = y(() => {
|
|
6033
6033
|
'use strict';
|
|
6034
6034
|
});
|
|
6035
|
-
function
|
|
6036
|
-
return typeof t == 'string' && (
|
|
6035
|
+
function bt(e, t) {
|
|
6036
|
+
return typeof t == 'string' && (Ar[e]?.includes(t) ?? !1);
|
|
6037
6037
|
}
|
|
6038
|
-
var
|
|
6039
|
-
|
|
6038
|
+
var Ar,
|
|
6039
|
+
kt = y(() => {
|
|
6040
6040
|
'use strict';
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6041
|
+
F();
|
|
6042
|
+
qe();
|
|
6043
|
+
yt();
|
|
6044
|
+
Ar = {};
|
|
6045
6045
|
});
|
|
6046
|
-
function
|
|
6047
|
-
return e === 'nano-banana-pro' ?
|
|
6046
|
+
function wt(e) {
|
|
6047
|
+
return e === 'nano-banana-pro' ? Rr : Or;
|
|
6048
6048
|
}
|
|
6049
|
-
var
|
|
6050
|
-
|
|
6051
|
-
|
|
6049
|
+
var Rr,
|
|
6050
|
+
Or,
|
|
6051
|
+
xt = y(() => {
|
|
6052
6052
|
'use strict';
|
|
6053
|
-
((
|
|
6054
|
-
(
|
|
6053
|
+
((Rr = ['auto', '1:1', '2:3', '3:2', '3:4', '4:3', '4:5', '5:4', '9:16', '16:9', '21:9']),
|
|
6054
|
+
(Or = [
|
|
6055
6055
|
'auto',
|
|
6056
6056
|
'1:1',
|
|
6057
6057
|
'1:4',
|
|
@@ -6069,10 +6069,10 @@ var Mr,
|
|
|
6069
6069
|
'21:9',
|
|
6070
6070
|
]));
|
|
6071
6071
|
});
|
|
6072
|
-
var
|
|
6073
|
-
|
|
6072
|
+
var Pt,
|
|
6073
|
+
It = y(() => {
|
|
6074
6074
|
'use strict';
|
|
6075
|
-
|
|
6075
|
+
Pt = [
|
|
6076
6076
|
'prompt',
|
|
6077
6077
|
'system',
|
|
6078
6078
|
'messages',
|
|
@@ -6086,10 +6086,10 @@ var ht,
|
|
|
6086
6086
|
'endpoint',
|
|
6087
6087
|
];
|
|
6088
6088
|
});
|
|
6089
|
-
var
|
|
6090
|
-
|
|
6089
|
+
var _t,
|
|
6090
|
+
vt = y(() => {
|
|
6091
6091
|
'use strict';
|
|
6092
|
-
|
|
6092
|
+
_t = [
|
|
6093
6093
|
{
|
|
6094
6094
|
slug: 'claude-fable-5-1',
|
|
6095
6095
|
family: 'fable-5-1',
|
|
@@ -6158,13 +6158,13 @@ var bt,
|
|
|
6158
6158
|
},
|
|
6159
6159
|
];
|
|
6160
6160
|
});
|
|
6161
|
-
function
|
|
6161
|
+
function Tt(e) {
|
|
6162
6162
|
return `$${e}`;
|
|
6163
6163
|
}
|
|
6164
|
-
function
|
|
6165
|
-
return
|
|
6164
|
+
function $e(e, t, r) {
|
|
6165
|
+
return H(e)?.variants.find((n) => n.endpoint === t && n.component === r)?.price.starter ?? null;
|
|
6166
6166
|
}
|
|
6167
|
-
function
|
|
6167
|
+
function Dr(e) {
|
|
6168
6168
|
return [
|
|
6169
6169
|
{
|
|
6170
6170
|
name: 'prompt',
|
|
@@ -6230,13 +6230,13 @@ function Sr(e) {
|
|
|
6230
6230
|
},
|
|
6231
6231
|
];
|
|
6232
6232
|
}
|
|
6233
|
-
function
|
|
6233
|
+
function Mt() {
|
|
6234
6234
|
return Object.fromEntries(
|
|
6235
|
-
|
|
6236
|
-
let t =
|
|
6237
|
-
r =
|
|
6238
|
-
a =
|
|
6239
|
-
n = t != null && r != null ? `${
|
|
6235
|
+
_t.map((e) => {
|
|
6236
|
+
let t = $e(e.slug, 'cheap', 'input'),
|
|
6237
|
+
r = $e(e.slug, 'cheap', 'output'),
|
|
6238
|
+
a = $e(e.slug, 'stable', 'input') != null,
|
|
6239
|
+
n = t != null && r != null ? `${Tt(t)}/M in \xB7 ${Tt(r)}/M out` : '',
|
|
6240
6240
|
s = {
|
|
6241
6241
|
slug: e.slug,
|
|
6242
6242
|
name: e.name,
|
|
@@ -6247,22 +6247,41 @@ function xt() {
|
|
|
6247
6247
|
priceFormatted: n,
|
|
6248
6248
|
unit: '/M tokens',
|
|
6249
6249
|
primaryToolName: 'run_task',
|
|
6250
|
-
parameters:
|
|
6250
|
+
parameters: Dr(a),
|
|
6251
6251
|
};
|
|
6252
6252
|
return [e.slug, s];
|
|
6253
6253
|
}),
|
|
6254
6254
|
);
|
|
6255
6255
|
}
|
|
6256
|
-
var
|
|
6256
|
+
var Kt = y(() => {
|
|
6257
6257
|
'use strict';
|
|
6258
|
-
|
|
6259
|
-
|
|
6258
|
+
vt();
|
|
6259
|
+
F();
|
|
6260
6260
|
});
|
|
6261
|
-
var
|
|
6262
|
-
|
|
6263
|
-
|
|
6261
|
+
var ue,
|
|
6262
|
+
St,
|
|
6263
|
+
z,
|
|
6264
|
+
Et,
|
|
6265
|
+
Mi,
|
|
6266
|
+
Ki,
|
|
6267
|
+
Si,
|
|
6268
|
+
Ei,
|
|
6269
|
+
qt = y(() => {
|
|
6264
6270
|
'use strict';
|
|
6265
|
-
((
|
|
6271
|
+
((ue = 'enhancor-ultrafine'),
|
|
6272
|
+
(St = 'Enhancor Ultrafine'),
|
|
6273
|
+
(z = { skin: [2, 3, 4], noSkin: [2, 3, 4, 8, 16] }),
|
|
6274
|
+
(Et = 2),
|
|
6275
|
+
(Mi = 24 * 1024 * 1024),
|
|
6276
|
+
(Ki = 4096 * 4096),
|
|
6277
|
+
(Si = 30 * 6e4),
|
|
6278
|
+
(Ei = 120 * 6e4));
|
|
6279
|
+
});
|
|
6280
|
+
var J,
|
|
6281
|
+
me,
|
|
6282
|
+
Ae = y(() => {
|
|
6283
|
+
'use strict';
|
|
6284
|
+
((J = [
|
|
6266
6285
|
'seedance-2-5',
|
|
6267
6286
|
'seedance-2',
|
|
6268
6287
|
'seedance-2-mini',
|
|
@@ -6271,13 +6290,13 @@ var H,
|
|
|
6271
6290
|
'wan-3-0',
|
|
6272
6291
|
'z-image-pro',
|
|
6273
6292
|
]),
|
|
6274
|
-
(
|
|
6293
|
+
(me =
|
|
6275
6294
|
'a request with creative_mode: true answers 503 checkpoint_unavailable and nothing is charged'));
|
|
6276
6295
|
});
|
|
6277
|
-
function
|
|
6296
|
+
function W(e) {
|
|
6278
6297
|
return `$${Number(e.toFixed(5))}`;
|
|
6279
6298
|
}
|
|
6280
|
-
function
|
|
6299
|
+
function Ur(e) {
|
|
6281
6300
|
if (e.kind === 'llm') {
|
|
6282
6301
|
let t = e.defaultEndpoint,
|
|
6283
6302
|
r = (s) =>
|
|
@@ -6290,41 +6309,41 @@ function Er(e) {
|
|
|
6290
6309
|
a = r('input'),
|
|
6291
6310
|
n = r('output');
|
|
6292
6311
|
return a && n
|
|
6293
|
-
? `${
|
|
6294
|
-
: `from ${
|
|
6312
|
+
? `${W(a.price.starter)}/M in \xB7 ${W(n.price.starter)}/M out`
|
|
6313
|
+
: `from ${W(de(e).price.starter)}/M tokens`;
|
|
6295
6314
|
}
|
|
6296
|
-
return `from ${
|
|
6315
|
+
return `from ${W(de(e).price.starter)}${e.unit}`;
|
|
6297
6316
|
}
|
|
6298
|
-
function
|
|
6317
|
+
function Vr(e, t) {
|
|
6299
6318
|
let r = t.filter((a) => Number.isFinite(a) && a > 0);
|
|
6300
|
-
return r.length ? `from ${
|
|
6319
|
+
return r.length ? `from ${W(Math.min(...r))}${e}` : null;
|
|
6301
6320
|
}
|
|
6302
|
-
function
|
|
6321
|
+
function Ot(e) {
|
|
6303
6322
|
for (let t of G) {
|
|
6304
|
-
let r =
|
|
6305
|
-
a = r ?
|
|
6323
|
+
let r = ge[t],
|
|
6324
|
+
a = r ? Vr(r.unit, e[t] ?? []) : null;
|
|
6306
6325
|
r && a && (r.priceFormatted = a);
|
|
6307
6326
|
}
|
|
6308
6327
|
}
|
|
6309
|
-
function
|
|
6328
|
+
function R(e, t) {
|
|
6310
6329
|
let r = e.axes?.resolution ?? [
|
|
6311
6330
|
...new Set(e.variants.map((a) => a.resolution).filter((a) => !!a)),
|
|
6312
6331
|
];
|
|
6313
6332
|
return {
|
|
6314
6333
|
name: 'resolution',
|
|
6315
6334
|
type: 'select',
|
|
6316
|
-
default:
|
|
6335
|
+
default: de(e).resolution ?? r[0],
|
|
6317
6336
|
options: r,
|
|
6318
6337
|
...(t ? { description: t } : {}),
|
|
6319
6338
|
};
|
|
6320
6339
|
}
|
|
6321
|
-
function
|
|
6340
|
+
function Dt(e) {
|
|
6322
6341
|
if (!e.endpoints?.length) return null;
|
|
6323
|
-
let t = e.endpoints.filter((r) =>
|
|
6342
|
+
let t = e.endpoints.filter((r) => bt(e.slug, r.id));
|
|
6324
6343
|
return {
|
|
6325
6344
|
name: 'endpoint',
|
|
6326
6345
|
type: 'select',
|
|
6327
|
-
default:
|
|
6346
|
+
default: Ee(e),
|
|
6328
6347
|
options: e.endpoints.filter((r) => !t.includes(r)).map((r) => r.id),
|
|
6329
6348
|
description:
|
|
6330
6349
|
(e.slug === 'gemini-3.1-pro-preview'
|
|
@@ -6333,20 +6352,55 @@ function Kt(e) {
|
|
|
6333
6352
|
(t.length ? ` ${t.map((r) => r.label).join(' and ')}: coming soon.` : ''),
|
|
6334
6353
|
};
|
|
6335
6354
|
}
|
|
6336
|
-
function
|
|
6355
|
+
function Br(e, t) {
|
|
6337
6356
|
if (e.unfiltered == null || t.some((a) => a.name === 'creative_mode')) return t;
|
|
6338
|
-
let r =
|
|
6339
|
-
return [...t.filter((a) => !
|
|
6357
|
+
let r = J.includes(e.api.model);
|
|
6358
|
+
return [...t.filter((a) => !fe.has(a.name)), r ? Ue : Fr];
|
|
6359
|
+
}
|
|
6360
|
+
function Re(e, t) {
|
|
6361
|
+
let r = e.filter((n) => !fe.has(n.name)),
|
|
6362
|
+
a = [Ue, Lt];
|
|
6363
|
+
return (a.push(Ve, Fe), [...r, ...a]);
|
|
6364
|
+
}
|
|
6365
|
+
function zr(e) {
|
|
6366
|
+
return [
|
|
6367
|
+
...e
|
|
6368
|
+
.filter((t) => !Gr.has(t.name) && !fe.has(t.name))
|
|
6369
|
+
.map((t) => {
|
|
6370
|
+
if (t.name === 'resolution')
|
|
6371
|
+
return {
|
|
6372
|
+
...t,
|
|
6373
|
+
...(t.options
|
|
6374
|
+
? {
|
|
6375
|
+
options: t.options.filter((a) =>
|
|
6376
|
+
['480p', '720p'].includes(String(a).toLowerCase()),
|
|
6377
|
+
),
|
|
6378
|
+
}
|
|
6379
|
+
: {}),
|
|
6380
|
+
description: `Output resolution: 480p or 720p (8-bit). This tier has no 1080p or 4k. ${Y}`,
|
|
6381
|
+
};
|
|
6382
|
+
let r = Hr[t.name];
|
|
6383
|
+
return r && typeof t.description == 'string'
|
|
6384
|
+
? { ...t, description: t.description.replace(/\(up to [^)]*\)/, `(${r})`) }
|
|
6385
|
+
: t;
|
|
6386
|
+
}),
|
|
6387
|
+
Ue,
|
|
6388
|
+
Lt,
|
|
6389
|
+
Ve,
|
|
6390
|
+
Fe,
|
|
6391
|
+
];
|
|
6340
6392
|
}
|
|
6341
|
-
function
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6393
|
+
function Nt(e) {
|
|
6394
|
+
return (
|
|
6395
|
+
e.startsWith('seedance-2-5-') &&
|
|
6396
|
+
e !== 'seedance-2-5-lite' &&
|
|
6397
|
+
!/-(creative-mode|unfiltered|uncensored)$/.test(e)
|
|
6398
|
+
);
|
|
6345
6399
|
}
|
|
6346
|
-
function
|
|
6400
|
+
function Ct(e, t = {}) {
|
|
6347
6401
|
return [
|
|
6348
6402
|
...e
|
|
6349
|
-
.filter((r) => !
|
|
6403
|
+
.filter((r) => !jr.has(r.name) && !fe.has(r.name))
|
|
6350
6404
|
.map((r) =>
|
|
6351
6405
|
r.name === 'prompt'
|
|
6352
6406
|
? { ...r, required: !0 }
|
|
@@ -6356,7 +6410,7 @@ function Pt(e, t = {}) {
|
|
|
6356
6410
|
...(t.no4k && r.options
|
|
6357
6411
|
? { options: r.options.filter((a) => String(a).toLowerCase() !== '4k') }
|
|
6358
6412
|
: {}),
|
|
6359
|
-
description: `Output resolution. TEIN LITE is the lower-priced endpoint for getting started. Stability and reliability are not guaranteed. ${
|
|
6413
|
+
description: `Output resolution. TEIN LITE is the lower-priced endpoint for getting started. Stability and reliability are not guaranteed. ${Y}`,
|
|
6360
6414
|
}
|
|
6361
6415
|
: r,
|
|
6362
6416
|
),
|
|
@@ -6367,11 +6421,11 @@ function Pt(e, t = {}) {
|
|
|
6367
6421
|
options: ['standard'],
|
|
6368
6422
|
description: 'LITE uses standard bitrate. High bitrate is on the standard endpoint.',
|
|
6369
6423
|
},
|
|
6370
|
-
|
|
6371
|
-
|
|
6424
|
+
Ve,
|
|
6425
|
+
Fe,
|
|
6372
6426
|
];
|
|
6373
6427
|
}
|
|
6374
|
-
function
|
|
6428
|
+
function Oe(e, t) {
|
|
6375
6429
|
return [
|
|
6376
6430
|
M('Text prompt describing the video.'),
|
|
6377
6431
|
{ name: 'mode', type: 'select', required: !0, default: t.modes[0], options: t.modes },
|
|
@@ -6383,7 +6437,7 @@ function Ee(e, t) {
|
|
|
6383
6437
|
max: t.maxSec,
|
|
6384
6438
|
description: `Video length in seconds (${t.minSec} to ${t.maxSec}).`,
|
|
6385
6439
|
},
|
|
6386
|
-
|
|
6440
|
+
R(e),
|
|
6387
6441
|
{ name: 'aspect_ratio', type: 'select', default: t.aspects[0], options: t.aspects },
|
|
6388
6442
|
...t.references.map((r) =>
|
|
6389
6443
|
r.endsWith('s')
|
|
@@ -6400,8 +6454,8 @@ function Ee(e, t) {
|
|
|
6400
6454
|
),
|
|
6401
6455
|
];
|
|
6402
6456
|
}
|
|
6403
|
-
function
|
|
6404
|
-
let t =
|
|
6457
|
+
function Jr(e) {
|
|
6458
|
+
let t = Dt(e);
|
|
6405
6459
|
return [
|
|
6406
6460
|
M('Image prompt text. Supports complex composition and text instructions.'),
|
|
6407
6461
|
...(t ? [t] : []),
|
|
@@ -6411,17 +6465,17 @@ function Vr(e) {
|
|
|
6411
6465
|
default: 'low',
|
|
6412
6466
|
options: e.axes?.quality ?? ['low', 'medium', 'high'],
|
|
6413
6467
|
},
|
|
6414
|
-
|
|
6468
|
+
R(
|
|
6415
6469
|
e,
|
|
6416
6470
|
e.slug === 'gpt-image-2'
|
|
6417
|
-
? `1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count. ${
|
|
6471
|
+
? `1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count. ${ot}`
|
|
6418
6472
|
: '1:1 is 1024, 2048 or 2880 px; other ratios keep about the same pixel count.',
|
|
6419
6473
|
),
|
|
6420
6474
|
{
|
|
6421
6475
|
name: 'aspect_ratio',
|
|
6422
6476
|
type: 'select',
|
|
6423
6477
|
default: 'auto',
|
|
6424
|
-
options: [...
|
|
6478
|
+
options: [...st],
|
|
6425
6479
|
description:
|
|
6426
6480
|
"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.",
|
|
6427
6481
|
},
|
|
@@ -6468,7 +6522,7 @@ function Vr(e) {
|
|
|
6468
6522
|
},
|
|
6469
6523
|
];
|
|
6470
6524
|
}
|
|
6471
|
-
function
|
|
6525
|
+
function Wr(e) {
|
|
6472
6526
|
return [
|
|
6473
6527
|
M('Image prompt text.'),
|
|
6474
6528
|
{
|
|
@@ -6476,8 +6530,8 @@ function Nr(e) {
|
|
|
6476
6530
|
type: 'string[]',
|
|
6477
6531
|
description: 'Images to edit or use as reference (up to 14).',
|
|
6478
6532
|
},
|
|
6479
|
-
{ name: 'aspect_ratio', type: 'select', default: '1:1', options: [...
|
|
6480
|
-
|
|
6533
|
+
{ name: 'aspect_ratio', type: 'select', default: '1:1', options: [...wt(e.slug)] },
|
|
6534
|
+
R(e),
|
|
6481
6535
|
{
|
|
6482
6536
|
name: 'n',
|
|
6483
6537
|
type: 'slider',
|
|
@@ -6502,10 +6556,10 @@ function Nr(e) {
|
|
|
6502
6556
|
},
|
|
6503
6557
|
];
|
|
6504
6558
|
}
|
|
6505
|
-
function
|
|
6506
|
-
let e =
|
|
6559
|
+
function Zr() {
|
|
6560
|
+
let e = Pt,
|
|
6507
6561
|
t = [];
|
|
6508
|
-
for (let r of
|
|
6562
|
+
for (let r of Be(!0))
|
|
6509
6563
|
e.includes(r.name) &&
|
|
6510
6564
|
(t.push({
|
|
6511
6565
|
...r,
|
|
@@ -6527,12 +6581,12 @@ function jr() {
|
|
|
6527
6581
|
}));
|
|
6528
6582
|
return t;
|
|
6529
6583
|
}
|
|
6530
|
-
function
|
|
6531
|
-
return
|
|
6584
|
+
function ea() {
|
|
6585
|
+
return Be(!0).map((e) =>
|
|
6532
6586
|
e.name === 'max_tokens' || e.name === 'max_completion_tokens' ? { ...e, min: 128 } : e,
|
|
6533
6587
|
);
|
|
6534
6588
|
}
|
|
6535
|
-
function
|
|
6589
|
+
function Be(e) {
|
|
6536
6590
|
return [
|
|
6537
6591
|
M('The user message or task.'),
|
|
6538
6592
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
@@ -6627,21 +6681,21 @@ function De(e) {
|
|
|
6627
6681
|
},
|
|
6628
6682
|
];
|
|
6629
6683
|
}
|
|
6630
|
-
function
|
|
6631
|
-
if (e.slug === 'seed-2-1-turbo') return
|
|
6632
|
-
let t =
|
|
6684
|
+
function ta(e) {
|
|
6685
|
+
if (e.slug === 'seed-2-1-turbo') return Xr;
|
|
6686
|
+
let t = Dt(e);
|
|
6633
6687
|
return [
|
|
6634
6688
|
...(e.slug === 'gemini-3.1-pro-preview'
|
|
6635
|
-
?
|
|
6689
|
+
? Zr()
|
|
6636
6690
|
: e.slug === 'gemini-3.7-flash'
|
|
6637
|
-
?
|
|
6638
|
-
: e.slug === 'gpt-6-astra' ||
|
|
6639
|
-
?
|
|
6640
|
-
:
|
|
6691
|
+
? ea()
|
|
6692
|
+
: e.slug === 'gpt-6-astra' || Qr.includes(e.slug)
|
|
6693
|
+
? Be(e.slug !== 'gpt-6-astra')
|
|
6694
|
+
: Yr),
|
|
6641
6695
|
...(t ? [t] : []),
|
|
6642
6696
|
];
|
|
6643
6697
|
}
|
|
6644
|
-
function
|
|
6698
|
+
function De() {
|
|
6645
6699
|
return {
|
|
6646
6700
|
name: 'image',
|
|
6647
6701
|
type: 'string',
|
|
@@ -6649,7 +6703,7 @@ function Ae() {
|
|
|
6649
6703
|
description: 'The photo to fix: one JPEG or PNG URL.',
|
|
6650
6704
|
};
|
|
6651
6705
|
}
|
|
6652
|
-
function
|
|
6706
|
+
function aa(e) {
|
|
6653
6707
|
return [
|
|
6654
6708
|
{
|
|
6655
6709
|
name: 'video_url',
|
|
@@ -6658,7 +6712,7 @@ function Jr(e) {
|
|
|
6658
6712
|
description:
|
|
6659
6713
|
'The video to upscale (up to 30 seconds): a Tein upload link, or any public https link.',
|
|
6660
6714
|
},
|
|
6661
|
-
|
|
6715
|
+
R(
|
|
6662
6716
|
e,
|
|
6663
6717
|
'Size of the result: 1080p, 2k or 4k. A video already near a size cannot be upscaled to it.',
|
|
6664
6718
|
),
|
|
@@ -6671,7 +6725,7 @@ function Jr(e) {
|
|
|
6671
6725
|
},
|
|
6672
6726
|
];
|
|
6673
6727
|
}
|
|
6674
|
-
function
|
|
6728
|
+
function ia() {
|
|
6675
6729
|
return [
|
|
6676
6730
|
{
|
|
6677
6731
|
name: 'mode',
|
|
@@ -6735,32 +6789,33 @@ function Wr() {
|
|
|
6735
6789
|
},
|
|
6736
6790
|
];
|
|
6737
6791
|
}
|
|
6738
|
-
function
|
|
6792
|
+
function na(e) {
|
|
6739
6793
|
let t = e.slug;
|
|
6740
|
-
if (e.family === 'tein-labs' && e.kind === 'image') return
|
|
6741
|
-
if (
|
|
6742
|
-
if (e.kind === 'llm') return
|
|
6743
|
-
if (e.editVariants?.length) return
|
|
6794
|
+
if (e.family === 'tein-labs' && e.kind === 'image') return ia();
|
|
6795
|
+
if (oe.some((r) => r.slug === t)) return aa(e);
|
|
6796
|
+
if (e.kind === 'llm') return ta(e);
|
|
6797
|
+
if (e.editVariants?.length) return Jr(e);
|
|
6798
|
+
if (Nt(t)) return zr(Le);
|
|
6744
6799
|
switch (t) {
|
|
6745
6800
|
case 'seedance-2-5':
|
|
6746
|
-
return
|
|
6801
|
+
return Re(Le, t);
|
|
6747
6802
|
case 'seedance-2-5-lite':
|
|
6748
|
-
return
|
|
6803
|
+
return Ct(Le, { no4k: !0 });
|
|
6749
6804
|
case 'seedance-2':
|
|
6750
|
-
return
|
|
6805
|
+
return Re($t, t);
|
|
6751
6806
|
case 'seedance-2-lite':
|
|
6752
|
-
return
|
|
6807
|
+
return Ct($t);
|
|
6753
6808
|
case 'seedance-2-mini':
|
|
6754
|
-
return
|
|
6809
|
+
return Re(sa, t);
|
|
6755
6810
|
case 'nano-banana-2':
|
|
6756
6811
|
case 'nano-banana-2.1':
|
|
6757
6812
|
case 'nano-banana-pro':
|
|
6758
|
-
return
|
|
6813
|
+
return Wr(e);
|
|
6759
6814
|
case 'seedream-5-pro':
|
|
6760
6815
|
return [
|
|
6761
6816
|
M('Detailed description of the image to generate.'),
|
|
6762
6817
|
{ name: 'images', type: 'string[]', description: 'Reference images (the first is free).' },
|
|
6763
|
-
|
|
6818
|
+
R(e),
|
|
6764
6819
|
{
|
|
6765
6820
|
name: 'aspect_ratio',
|
|
6766
6821
|
type: 'select',
|
|
@@ -6788,7 +6843,7 @@ function Yr(e) {
|
|
|
6788
6843
|
description:
|
|
6789
6844
|
'Reference images (up to 10), or for layer_decomposition the one JPEG or PNG to split (at least 512x512). Each input image is billed.',
|
|
6790
6845
|
},
|
|
6791
|
-
|
|
6846
|
+
R(
|
|
6792
6847
|
e,
|
|
6793
6848
|
'1K and 1.5K are one price, 2K the next. layer_decomposition also takes auto (keep the input size), billed at the 2K price.',
|
|
6794
6849
|
),
|
|
@@ -6834,7 +6889,7 @@ function Yr(e) {
|
|
|
6834
6889
|
type: 'string[]',
|
|
6835
6890
|
description: 'Up to 3 reference images, each billed at the published add-on price.',
|
|
6836
6891
|
},
|
|
6837
|
-
|
|
6892
|
+
R(e),
|
|
6838
6893
|
{
|
|
6839
6894
|
name: 'aspect_ratio',
|
|
6840
6895
|
type: 'select',
|
|
@@ -6853,7 +6908,7 @@ function Yr(e) {
|
|
|
6853
6908
|
case 'z-image-pro':
|
|
6854
6909
|
return [
|
|
6855
6910
|
M('Image prompt text: subject, scene, style, composition and lighting.'),
|
|
6856
|
-
|
|
6911
|
+
R(e, 'Long edge: 1K is 1024 px, 2K is 2048 px. Same price.'),
|
|
6857
6912
|
{
|
|
6858
6913
|
name: 'aspect_ratio',
|
|
6859
6914
|
type: 'select',
|
|
@@ -6906,7 +6961,7 @@ function Yr(e) {
|
|
|
6906
6961
|
];
|
|
6907
6962
|
case 'enhancor-skin-fix-v1':
|
|
6908
6963
|
return [
|
|
6909
|
-
|
|
6964
|
+
De(),
|
|
6910
6965
|
{
|
|
6911
6966
|
name: 'mode',
|
|
6912
6967
|
type: 'select',
|
|
@@ -6939,11 +6994,11 @@ function Yr(e) {
|
|
|
6939
6994
|
max: 0.4,
|
|
6940
6995
|
description: 'Portrait depth. Heavy only.',
|
|
6941
6996
|
},
|
|
6942
|
-
...
|
|
6997
|
+
...ra,
|
|
6943
6998
|
];
|
|
6944
6999
|
case 'enhancor-skin-fix-v3':
|
|
6945
7000
|
return [
|
|
6946
|
-
|
|
7001
|
+
De(),
|
|
6947
7002
|
{
|
|
6948
7003
|
name: 'mask_image',
|
|
6949
7004
|
type: 'string',
|
|
@@ -6983,7 +7038,7 @@ function Yr(e) {
|
|
|
6983
7038
|
];
|
|
6984
7039
|
case 'enhancor-skin-fix-v4':
|
|
6985
7040
|
return [
|
|
6986
|
-
|
|
7041
|
+
De(),
|
|
6987
7042
|
{
|
|
6988
7043
|
name: 'mode',
|
|
6989
7044
|
type: 'select',
|
|
@@ -7014,7 +7069,7 @@ function Yr(e) {
|
|
|
7014
7069
|
];
|
|
7015
7070
|
case 'wan-3-0':
|
|
7016
7071
|
case 'wan-3-0-prime':
|
|
7017
|
-
return
|
|
7072
|
+
return Oe(e, {
|
|
7018
7073
|
modes: ['text_to_video', 'first_n_last_frames', 'multi_reference'],
|
|
7019
7074
|
aspects: ['16:9', '9:16', '4:3', '3:4', '1:1', 'adaptive'],
|
|
7020
7075
|
minSec: 2,
|
|
@@ -7024,7 +7079,7 @@ function Yr(e) {
|
|
|
7024
7079
|
});
|
|
7025
7080
|
case 'happy-horse-1-1':
|
|
7026
7081
|
case 'happy-horse-1-0':
|
|
7027
|
-
return
|
|
7082
|
+
return Oe(e, {
|
|
7028
7083
|
modes:
|
|
7029
7084
|
t === 'happy-horse-1-0'
|
|
7030
7085
|
? ['text-to-video', 'single-image', 'multi-reference', 'video-editing']
|
|
@@ -7035,7 +7090,7 @@ function Yr(e) {
|
|
|
7035
7090
|
references: t === 'happy-horse-1-0' ? ['images', 'videos'] : ['images'],
|
|
7036
7091
|
});
|
|
7037
7092
|
case 'minimax-h3':
|
|
7038
|
-
return
|
|
7093
|
+
return Oe(e, {
|
|
7039
7094
|
modes: ['text_to_video', 'first_n_last_frames', 'multi_reference'],
|
|
7040
7095
|
aspects: ['16:9', '21:9', '4:3', '1:1', '3:4', '9:16', 'adaptive'],
|
|
7041
7096
|
minSec: 4,
|
|
@@ -7046,161 +7101,208 @@ function Yr(e) {
|
|
|
7046
7101
|
return [M('Prompt text.')];
|
|
7047
7102
|
}
|
|
7048
7103
|
}
|
|
7049
|
-
function
|
|
7104
|
+
function oa() {
|
|
7105
|
+
return {
|
|
7106
|
+
slug: ue,
|
|
7107
|
+
name: St,
|
|
7108
|
+
category: 'Image',
|
|
7109
|
+
kind: 'Image-to-Image',
|
|
7110
|
+
vendor: 'Enhancor',
|
|
7111
|
+
description:
|
|
7112
|
+
'Upscales a photo, with an optional skin fix. Full makes the photo its size times the scale; Fast makes a fixed size (long side 2432 px).',
|
|
7113
|
+
priceFormatted: '',
|
|
7114
|
+
unit: '/img',
|
|
7115
|
+
primaryToolName: Rt.image,
|
|
7116
|
+
parameters: [
|
|
7117
|
+
{
|
|
7118
|
+
name: 'image',
|
|
7119
|
+
type: 'string',
|
|
7120
|
+
required: !0,
|
|
7121
|
+
description:
|
|
7122
|
+
"The photo to upscale: one JPEG, PNG or WebP URL, up to 24 MB and 16.7 MP, with a shorter side of at least 256 px. HEIC/HEIF isn't supported.",
|
|
7123
|
+
},
|
|
7124
|
+
{
|
|
7125
|
+
name: 'skin_fix',
|
|
7126
|
+
type: 'boolean',
|
|
7127
|
+
default: !1,
|
|
7128
|
+
description: 'Also fixes the skin. Off by default.',
|
|
7129
|
+
},
|
|
7130
|
+
{
|
|
7131
|
+
name: 'mode',
|
|
7132
|
+
type: 'select',
|
|
7133
|
+
default: 'full',
|
|
7134
|
+
options: ['full', 'fast'],
|
|
7135
|
+
description:
|
|
7136
|
+
'Full: the photo times the scale. Fast: long side 2432 px. Both are priced per output megapixel, no minimum.',
|
|
7137
|
+
},
|
|
7138
|
+
{
|
|
7139
|
+
name: 'scale',
|
|
7140
|
+
type: 'select',
|
|
7141
|
+
default: String(Et),
|
|
7142
|
+
options: z.noSkin.map(String),
|
|
7143
|
+
description: `Full only. ${z.skin.join(', ')} with skin_fix on; also ${z.noSkin.filter((e) => !z.skin.includes(e)).join(' and ')} with it off. The output is at most 48 megapixels.`,
|
|
7144
|
+
},
|
|
7145
|
+
],
|
|
7146
|
+
};
|
|
7147
|
+
}
|
|
7148
|
+
function Ne(e, t = e.api.model) {
|
|
7050
7149
|
return {
|
|
7051
7150
|
slug: t,
|
|
7052
7151
|
name: e.name,
|
|
7053
|
-
category:
|
|
7054
|
-
kind: t.startsWith('enhancor-skin-fix-') ? 'Image-to-Image' :
|
|
7152
|
+
category: Lr[e.kind],
|
|
7153
|
+
kind: t.startsWith('enhancor-skin-fix-') ? 'Image-to-Image' : Nr[e.kind],
|
|
7055
7154
|
vendor: e.vendor ?? '',
|
|
7056
7155
|
description: e.desc ?? e.name,
|
|
7057
|
-
priceFormatted:
|
|
7156
|
+
priceFormatted: Ur(e),
|
|
7058
7157
|
unit: e.unit,
|
|
7059
|
-
primaryToolName:
|
|
7060
|
-
parameters:
|
|
7158
|
+
primaryToolName: Rt[e.kind],
|
|
7159
|
+
parameters: Br(e, na(e)),
|
|
7061
7160
|
};
|
|
7062
7161
|
}
|
|
7063
|
-
function
|
|
7162
|
+
function la() {
|
|
7064
7163
|
let e = {};
|
|
7065
|
-
for (let t of
|
|
7164
|
+
for (let t of pe())
|
|
7066
7165
|
if (t.slug !== 'seedance-2-fast') {
|
|
7067
7166
|
if (t.slug === 'seedance-2-mini') {
|
|
7068
|
-
e['seedance-2-mini'] =
|
|
7167
|
+
e['seedance-2-mini'] = Ne(t, 'seedance-2-mini');
|
|
7069
7168
|
continue;
|
|
7070
7169
|
}
|
|
7071
7170
|
if (t.slug === 'seedance-2') {
|
|
7072
|
-
let r =
|
|
7171
|
+
let r = Ne(t);
|
|
7073
7172
|
((r.description = `${t.desc ?? t.name} Send quality fast or mini for Seedance 2.0 Fast or Mini.`),
|
|
7074
7173
|
(e['seedance-2'] = r));
|
|
7075
7174
|
continue;
|
|
7076
7175
|
}
|
|
7077
|
-
t.slug.startsWith('claude-') || (e[t.api.model] =
|
|
7176
|
+
t.slug.startsWith('claude-') || (e[t.api.model] = Ne(t));
|
|
7078
7177
|
}
|
|
7079
|
-
Object.assign(e,
|
|
7080
|
-
for (let [t, r] of Object.entries(
|
|
7178
|
+
(Object.assign(e, Mt()), (e[ue] = oa()));
|
|
7179
|
+
for (let [t, r] of Object.entries(ce))
|
|
7081
7180
|
e[r] && Object.defineProperty(e, t, { value: e[r], enumerable: !1 });
|
|
7082
7181
|
return e;
|
|
7083
7182
|
}
|
|
7084
|
-
function
|
|
7183
|
+
function he(e) {
|
|
7085
7184
|
return !!e?.parameters.some((t) => t.name === 'image');
|
|
7086
7185
|
}
|
|
7087
|
-
function
|
|
7088
|
-
return
|
|
7186
|
+
function B(e) {
|
|
7187
|
+
return ge[e] ?? null;
|
|
7089
7188
|
}
|
|
7090
|
-
function
|
|
7091
|
-
if (e.startsWith('enhancor-skin-fix-')) return !1;
|
|
7092
|
-
if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite') && t === 'duration') {
|
|
7189
|
+
function pa(e, t, r) {
|
|
7190
|
+
if (e.startsWith('enhancor-skin-fix-') || e === ue) return !1;
|
|
7191
|
+
if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite' || Nt(e)) && t === 'duration') {
|
|
7093
7192
|
let a = (n) => (typeof n == 'string' ? n.trim().toLowerCase() : '');
|
|
7094
7193
|
if (a(r.mode) === 'edit' || a(r.omni_reference_task_type) === 'edit') return !1;
|
|
7095
7194
|
}
|
|
7096
7195
|
return !(
|
|
7097
|
-
(t === 'max_tokens' &&
|
|
7098
|
-
(t === 'max_completion_tokens' &&
|
|
7196
|
+
(t === 'max_tokens' && At(r.max_completion_tokens)) ||
|
|
7197
|
+
(t === 'max_completion_tokens' && At(r.max_tokens))
|
|
7099
7198
|
);
|
|
7100
7199
|
}
|
|
7101
|
-
function
|
|
7200
|
+
function At(e) {
|
|
7102
7201
|
return e != null && e !== '';
|
|
7103
7202
|
}
|
|
7104
|
-
function
|
|
7203
|
+
function Ft(e, t) {
|
|
7105
7204
|
let r = { ...t };
|
|
7106
7205
|
if (e?.slug === 'seedance-2-5') {
|
|
7107
7206
|
let a = (n) => typeof n != 'string' || !n.trim();
|
|
7108
|
-
for (let n of
|
|
7207
|
+
for (let n of da) (a(r.finalize) && !a(r[n]) && (r.finalize = r[n]), delete r[n]);
|
|
7109
7208
|
if (!a(r.finalize)) return r;
|
|
7110
7209
|
}
|
|
7111
7210
|
for (let a of e?.parameters ?? [])
|
|
7112
7211
|
a.default !== void 0 &&
|
|
7113
7212
|
r[a.name] === void 0 &&
|
|
7114
|
-
|
|
7213
|
+
pa(e.slug, a.name, t) &&
|
|
7115
7214
|
(r[a.name] = a.default);
|
|
7116
7215
|
return r;
|
|
7117
7216
|
}
|
|
7118
|
-
function
|
|
7119
|
-
return Object.values(
|
|
7217
|
+
function O() {
|
|
7218
|
+
return Object.values(ge);
|
|
7120
7219
|
}
|
|
7121
|
-
var
|
|
7122
|
-
|
|
7123
|
-
|
|
7220
|
+
var Lr,
|
|
7221
|
+
Rt,
|
|
7222
|
+
Nr,
|
|
7124
7223
|
M,
|
|
7125
|
-
|
|
7126
|
-
Or,
|
|
7127
|
-
Rr,
|
|
7128
|
-
qt,
|
|
7129
|
-
$t,
|
|
7130
|
-
Re,
|
|
7131
|
-
Lr,
|
|
7132
|
-
Ur,
|
|
7133
|
-
Br,
|
|
7224
|
+
Ue,
|
|
7134
7225
|
Fr,
|
|
7226
|
+
Lt,
|
|
7227
|
+
Ve,
|
|
7228
|
+
Fe,
|
|
7229
|
+
fe,
|
|
7230
|
+
jr,
|
|
7231
|
+
Gr,
|
|
7135
7232
|
Hr,
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
Ct,
|
|
7139
|
-
Et,
|
|
7140
|
-
vt,
|
|
7233
|
+
Yr,
|
|
7234
|
+
Xr,
|
|
7141
7235
|
Qr,
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7236
|
+
ra,
|
|
7237
|
+
Y,
|
|
7238
|
+
Le,
|
|
7239
|
+
Ut,
|
|
7240
|
+
Vt,
|
|
7241
|
+
$t,
|
|
7242
|
+
sa,
|
|
7243
|
+
ge,
|
|
7244
|
+
da,
|
|
7245
|
+
X = y(() => {
|
|
7145
7246
|
'use strict';
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
yt();
|
|
7247
|
+
lt();
|
|
7248
|
+
ve();
|
|
7249
|
+
F();
|
|
7250
|
+
qe();
|
|
7251
|
+
Te();
|
|
7252
|
+
Ce();
|
|
7253
|
+
kt();
|
|
7254
|
+
xt();
|
|
7155
7255
|
It();
|
|
7156
|
-
|
|
7157
|
-
(
|
|
7158
|
-
|
|
7256
|
+
Kt();
|
|
7257
|
+
qt();
|
|
7258
|
+
Ae();
|
|
7259
|
+
((Lr = { video: 'Video', image: 'Image', audio: 'Audio', llm: 'Text' }),
|
|
7260
|
+
(Rt = {
|
|
7159
7261
|
video: 'generate_video',
|
|
7160
7262
|
image: 'generate_image',
|
|
7161
7263
|
audio: 'generate_audio',
|
|
7162
7264
|
llm: 'run_task',
|
|
7163
7265
|
}),
|
|
7164
|
-
(
|
|
7266
|
+
(Nr = {
|
|
7165
7267
|
video: 'Text-to-Video',
|
|
7166
7268
|
image: 'Text-to-Image',
|
|
7167
7269
|
audio: 'Text-to-Audio',
|
|
7168
7270
|
llm: 'Reasoning (LLM)',
|
|
7169
7271
|
}));
|
|
7170
7272
|
M = (e) => ({ name: 'prompt', type: 'string', required: !0, description: e });
|
|
7171
|
-
((
|
|
7273
|
+
((Ue = {
|
|
7172
7274
|
name: 'creative_mode',
|
|
7173
7275
|
type: 'boolean',
|
|
7174
7276
|
default: !1,
|
|
7175
7277
|
description:
|
|
7176
7278
|
'Runs the Creative mode checkpoint at its published price (+5%). The Acceptable Use Policy applies.',
|
|
7177
7279
|
}),
|
|
7178
|
-
(
|
|
7280
|
+
(Fr = {
|
|
7179
7281
|
name: 'creative_mode',
|
|
7180
7282
|
type: 'boolean',
|
|
7181
7283
|
default: !1,
|
|
7182
|
-
description: `Not available yet on this model: ${
|
|
7284
|
+
description: `Not available yet on this model: ${me}.`,
|
|
7183
7285
|
}),
|
|
7184
|
-
(
|
|
7286
|
+
(Lt = {
|
|
7185
7287
|
name: 'priority',
|
|
7186
7288
|
type: 'boolean',
|
|
7187
7289
|
default: !1,
|
|
7188
7290
|
description: 'Guaranteed speed and no queue, at the published Priority price (+6%).',
|
|
7189
7291
|
}),
|
|
7190
|
-
(
|
|
7292
|
+
(Ve = {
|
|
7191
7293
|
name: 'reference_roles',
|
|
7192
7294
|
type: 'json',
|
|
7193
7295
|
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).`,
|
|
7194
7296
|
}),
|
|
7195
|
-
(
|
|
7297
|
+
(Fe = {
|
|
7196
7298
|
name: 'auto_fit_images',
|
|
7197
7299
|
type: 'boolean',
|
|
7198
7300
|
default: !1,
|
|
7199
7301
|
description:
|
|
7200
7302
|
'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.',
|
|
7201
7303
|
}),
|
|
7202
|
-
(
|
|
7203
|
-
|
|
7304
|
+
(fe = new Set(['full_access', 'is_uncensored', 'unfiltered', 'verificationSignature'])));
|
|
7305
|
+
((jr = new Set([
|
|
7204
7306
|
'quality',
|
|
7205
7307
|
'bitrate_mode',
|
|
7206
7308
|
'draft',
|
|
@@ -7208,8 +7310,21 @@ var qr,
|
|
|
7208
7310
|
'draft_task_id',
|
|
7209
7311
|
'draft_generation_id',
|
|
7210
7312
|
'pass_faces',
|
|
7211
|
-
])
|
|
7212
|
-
|
|
7313
|
+
])),
|
|
7314
|
+
(Gr = new Set([
|
|
7315
|
+
'quality',
|
|
7316
|
+
'bitrate_mode',
|
|
7317
|
+
'draft',
|
|
7318
|
+
'finalize',
|
|
7319
|
+
'draft_task_id',
|
|
7320
|
+
'draft_generation_id',
|
|
7321
|
+
])),
|
|
7322
|
+
(Hr = {
|
|
7323
|
+
images: 'up to 10',
|
|
7324
|
+
videos: 'up to 5; combined duration < 30s',
|
|
7325
|
+
audios: 'up to 5; combined duration < 30s',
|
|
7326
|
+
}));
|
|
7327
|
+
((Yr = [
|
|
7213
7328
|
M('The user message or task.'),
|
|
7214
7329
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
7215
7330
|
{
|
|
@@ -7227,7 +7342,7 @@ var qr,
|
|
|
7227
7342
|
{ name: 'temperature', type: 'slider', min: 0, max: 1, step: 0.1 },
|
|
7228
7343
|
{ name: 'top_p', type: 'slider', min: 0, max: 1, step: 0.05 },
|
|
7229
7344
|
]),
|
|
7230
|
-
(
|
|
7345
|
+
(Xr = [
|
|
7231
7346
|
M('The user message or task.'),
|
|
7232
7347
|
{ name: 'system', type: 'string', description: 'Optional system instructions.' },
|
|
7233
7348
|
{
|
|
@@ -7309,8 +7424,8 @@ var qr,
|
|
|
7309
7424
|
description: 'Video frames read a second.',
|
|
7310
7425
|
},
|
|
7311
7426
|
]),
|
|
7312
|
-
(
|
|
7313
|
-
|
|
7427
|
+
(Qr = ['gemini-3.8-flash', 'gemini-3.7-flash']));
|
|
7428
|
+
ra = Object.entries({
|
|
7314
7429
|
background: !1,
|
|
7315
7430
|
skin: !1,
|
|
7316
7431
|
nose: !1,
|
|
@@ -7336,8 +7451,8 @@ var qr,
|
|
|
7336
7451
|
default: t,
|
|
7337
7452
|
description: 'Keep this part out of the fix. Standard only.',
|
|
7338
7453
|
}));
|
|
7339
|
-
((
|
|
7340
|
-
(
|
|
7454
|
+
((Y = 'Left out: 480p, the same default as the API, the playground and workflow steps.'),
|
|
7455
|
+
(Le = [
|
|
7341
7456
|
{
|
|
7342
7457
|
name: 'prompt',
|
|
7343
7458
|
type: 'string',
|
|
@@ -7375,7 +7490,7 @@ var qr,
|
|
|
7375
7490
|
type: 'select',
|
|
7376
7491
|
default: '480p',
|
|
7377
7492
|
options: ['480p', '720p', '1080p', '4k'],
|
|
7378
|
-
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. ${
|
|
7493
|
+
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. ${Y}`,
|
|
7379
7494
|
},
|
|
7380
7495
|
{
|
|
7381
7496
|
name: 'aspect_ratio',
|
|
@@ -7486,19 +7601,19 @@ var qr,
|
|
|
7486
7601
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
7487
7602
|
},
|
|
7488
7603
|
]),
|
|
7489
|
-
(
|
|
7604
|
+
(Ut = {
|
|
7490
7605
|
name: 'images',
|
|
7491
7606
|
type: 'string[]',
|
|
7492
7607
|
description:
|
|
7493
7608
|
'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.',
|
|
7494
7609
|
}),
|
|
7495
|
-
(
|
|
7610
|
+
(Vt = {
|
|
7496
7611
|
name: 'audios',
|
|
7497
7612
|
type: 'string[]',
|
|
7498
7613
|
description:
|
|
7499
7614
|
'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.',
|
|
7500
7615
|
}),
|
|
7501
|
-
(
|
|
7616
|
+
($t = [
|
|
7502
7617
|
{
|
|
7503
7618
|
name: 'prompt',
|
|
7504
7619
|
type: 'string',
|
|
@@ -7542,7 +7657,7 @@ var qr,
|
|
|
7542
7657
|
type: 'select',
|
|
7543
7658
|
default: '480p',
|
|
7544
7659
|
options: ['480p', '720p', '1080p', '4k'],
|
|
7545
|
-
description: `Standard: 480p, 720p, 1080p (8-bit) and 4k (10-bit H.265). Fast and Mini: 480p and 720p only. ${
|
|
7660
|
+
description: `Standard: 480p, 720p, 1080p (8-bit) and 4k (10-bit H.265). Fast and Mini: 480p and 720p only. ${Y}`,
|
|
7546
7661
|
},
|
|
7547
7662
|
{
|
|
7548
7663
|
name: 'bitrate_mode',
|
|
@@ -7576,8 +7691,8 @@ var qr,
|
|
|
7576
7691
|
description:
|
|
7577
7692
|
'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
|
|
7578
7693
|
},
|
|
7579
|
-
|
|
7580
|
-
|
|
7694
|
+
Ut,
|
|
7695
|
+
Vt,
|
|
7581
7696
|
{
|
|
7582
7697
|
name: 'first_frame_image',
|
|
7583
7698
|
type: 'string',
|
|
@@ -7598,7 +7713,7 @@ var qr,
|
|
|
7598
7713
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
7599
7714
|
},
|
|
7600
7715
|
]),
|
|
7601
|
-
(
|
|
7716
|
+
(sa = [
|
|
7602
7717
|
{
|
|
7603
7718
|
name: 'prompt',
|
|
7604
7719
|
type: 'string',
|
|
@@ -7619,7 +7734,7 @@ var qr,
|
|
|
7619
7734
|
type: 'select',
|
|
7620
7735
|
default: '480p',
|
|
7621
7736
|
options: ['480p', '720p'],
|
|
7622
|
-
description: `480p and 720p, both 8-bit. Mini does not serve 1080p or 4k. ${
|
|
7737
|
+
description: `480p and 720p, both 8-bit. Mini does not serve 1080p or 4k. ${Y}`,
|
|
7623
7738
|
},
|
|
7624
7739
|
{
|
|
7625
7740
|
name: 'bitrate_mode',
|
|
@@ -7653,8 +7768,8 @@ var qr,
|
|
|
7653
7768
|
description:
|
|
7654
7769
|
'Also returns the last frame as a JPEG, the same size as the video and without a watermark.',
|
|
7655
7770
|
},
|
|
7656
|
-
|
|
7657
|
-
|
|
7771
|
+
Ut,
|
|
7772
|
+
Vt,
|
|
7658
7773
|
{
|
|
7659
7774
|
name: 'first_frame_image',
|
|
7660
7775
|
type: 'string',
|
|
@@ -7669,53 +7784,53 @@ var qr,
|
|
|
7669
7784
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
7670
7785
|
},
|
|
7671
7786
|
]));
|
|
7672
|
-
|
|
7673
|
-
|
|
7787
|
+
ge = la();
|
|
7788
|
+
da = ['draft_task_id', 'draft_generation_id'];
|
|
7674
7789
|
});
|
|
7675
|
-
function
|
|
7790
|
+
function ye(e) {
|
|
7676
7791
|
let t = '/v1/pricing/models',
|
|
7677
7792
|
r = e?.trim();
|
|
7678
7793
|
return r ? `${t}?model=${encodeURIComponent(r)}` : t;
|
|
7679
7794
|
}
|
|
7680
|
-
var
|
|
7795
|
+
var Ge = y(() => {
|
|
7681
7796
|
'use strict';
|
|
7682
7797
|
});
|
|
7683
|
-
function
|
|
7798
|
+
function Zt(e) {
|
|
7684
7799
|
return e.length <= 1 ? (e[0] ?? '') : `${e.slice(0, -1).join(', ')} and ${e[e.length - 1]}`;
|
|
7685
7800
|
}
|
|
7686
|
-
function
|
|
7687
|
-
let t =
|
|
7688
|
-
r = t.filter((s) =>
|
|
7689
|
-
a = t.filter((s) => !
|
|
7801
|
+
function er(e) {
|
|
7802
|
+
let t = pe().filter((s) => s.kind === e && s.unfiltered != null),
|
|
7803
|
+
r = t.filter((s) => J.includes(s.api.model)).map((s) => s.name),
|
|
7804
|
+
a = t.filter((s) => !J.includes(s.api.model)).map((s) => s.name);
|
|
7690
7805
|
return [
|
|
7691
7806
|
...(r.length
|
|
7692
|
-
? [`${
|
|
7807
|
+
? [`${Zt(r)}: runs the Creative mode checkpoint at its published price (+5%).`]
|
|
7693
7808
|
: []),
|
|
7694
|
-
...(a.length ? [`Not available yet on ${
|
|
7809
|
+
...(a.length ? [`Not available yet on ${Zt(a)}: ${me}.`] : []),
|
|
7695
7810
|
'The Acceptable Use Policy applies.',
|
|
7696
7811
|
].join(' ');
|
|
7697
7812
|
}
|
|
7698
|
-
function
|
|
7699
|
-
if (
|
|
7813
|
+
function Aa(e) {
|
|
7814
|
+
if (Ca.has(e.name)) return e;
|
|
7700
7815
|
let t = e.inputSchema.properties;
|
|
7701
7816
|
return !t || t.callback_url
|
|
7702
7817
|
? e
|
|
7703
|
-
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url:
|
|
7818
|
+
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url: qa } } };
|
|
7704
7819
|
}
|
|
7705
|
-
function
|
|
7820
|
+
function Ra(e) {
|
|
7706
7821
|
let t = e.inputSchema.properties;
|
|
7707
7822
|
if (!t) return e;
|
|
7708
7823
|
let r = !1,
|
|
7709
7824
|
a = {};
|
|
7710
7825
|
for (let [n, s] of Object.entries(t))
|
|
7711
|
-
|
|
7826
|
+
tr.has(n) && s.type === 'string' && !s.format
|
|
7712
7827
|
? ((a[n] = { ...s, format: 'uri' }), (r = !0))
|
|
7713
|
-
:
|
|
7828
|
+
: tr.has(n) && s.type === 'array' && s.items?.type === 'string' && !s.items.format
|
|
7714
7829
|
? ((a[n] = { ...s, items: { ...s.items, format: 'uri' } }), (r = !0))
|
|
7715
7830
|
: (a[n] = s);
|
|
7716
7831
|
return r ? { ...e, inputSchema: { ...e.inputSchema, properties: a } } : e;
|
|
7717
7832
|
}
|
|
7718
|
-
function
|
|
7833
|
+
function Oa(e) {
|
|
7719
7834
|
switch (e.type) {
|
|
7720
7835
|
case 'string':
|
|
7721
7836
|
return {
|
|
@@ -7770,11 +7885,11 @@ function Ta(e) {
|
|
|
7770
7885
|
return { type: 'string', description: e.description };
|
|
7771
7886
|
}
|
|
7772
7887
|
}
|
|
7773
|
-
function
|
|
7888
|
+
function Da(e, t) {
|
|
7774
7889
|
let r = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
|
|
7775
7890
|
a = {},
|
|
7776
7891
|
n = [];
|
|
7777
|
-
for (let o of e.parameters) ((a[o.name] =
|
|
7892
|
+
for (let o of e.parameters) ((a[o.name] = Oa(o)), o.required && n.push(o.name));
|
|
7778
7893
|
let s = {
|
|
7779
7894
|
type: 'object',
|
|
7780
7895
|
properties: a,
|
|
@@ -7787,11 +7902,11 @@ function Ma(e, t) {
|
|
|
7787
7902
|
inputSchema: s,
|
|
7788
7903
|
};
|
|
7789
7904
|
}
|
|
7790
|
-
function
|
|
7791
|
-
let e =
|
|
7792
|
-
t =
|
|
7793
|
-
r =
|
|
7794
|
-
a =
|
|
7905
|
+
function La() {
|
|
7906
|
+
let e = O().filter((d) => d.category === 'Image' && !he(d)),
|
|
7907
|
+
t = O().filter((d) => d.category === 'Video'),
|
|
7908
|
+
r = O().filter((d) => d.category === 'Text'),
|
|
7909
|
+
a = O().filter((d) => d.category === 'Audio'),
|
|
7795
7910
|
n = {
|
|
7796
7911
|
name: 'generate_image',
|
|
7797
7912
|
description:
|
|
@@ -7883,7 +7998,7 @@ function Ka() {
|
|
|
7883
7998
|
maximum: 2147483647,
|
|
7884
7999
|
description: 'Nano Banana 2 and Nano Banana Pro. Omit it for a new image each time.',
|
|
7885
8000
|
},
|
|
7886
|
-
creative_mode: { type: 'boolean', default: !1, description:
|
|
8001
|
+
creative_mode: { type: 'boolean', default: !1, description: er('image') },
|
|
7887
8002
|
},
|
|
7888
8003
|
required: ['prompt'],
|
|
7889
8004
|
additionalProperties: !0,
|
|
@@ -7920,7 +8035,7 @@ function Ka() {
|
|
|
7920
8035
|
default: '480p',
|
|
7921
8036
|
description: 'Video resolution (the lowest price is the default; see each model tool).',
|
|
7922
8037
|
},
|
|
7923
|
-
creative_mode: { type: 'boolean', default: !1, description:
|
|
8038
|
+
creative_mode: { type: 'boolean', default: !1, description: er('video') },
|
|
7924
8039
|
priority: {
|
|
7925
8040
|
type: 'boolean',
|
|
7926
8041
|
default: !1,
|
|
@@ -8058,10 +8173,10 @@ function Ka() {
|
|
|
8058
8173
|
additionalProperties: !0,
|
|
8059
8174
|
},
|
|
8060
8175
|
},
|
|
8061
|
-
p =
|
|
8062
|
-
return [n, s, o, u, l, p, c,
|
|
8176
|
+
p = Na();
|
|
8177
|
+
return [n, s, o, u, l, p, c, $a];
|
|
8063
8178
|
}
|
|
8064
|
-
function
|
|
8179
|
+
function Na() {
|
|
8065
8180
|
return {
|
|
8066
8181
|
name: 'upload_asset',
|
|
8067
8182
|
description:
|
|
@@ -8108,26 +8223,26 @@ function Sa() {
|
|
|
8108
8223
|
},
|
|
8109
8224
|
};
|
|
8110
8225
|
}
|
|
8111
|
-
function
|
|
8112
|
-
let e =
|
|
8113
|
-
t =
|
|
8114
|
-
return [...e, ...t].map(
|
|
8226
|
+
function Xe() {
|
|
8227
|
+
let e = La(),
|
|
8228
|
+
t = O().map((r) => Da(r));
|
|
8229
|
+
return [...e, ...t].map(Aa).map(Ra);
|
|
8115
8230
|
}
|
|
8116
|
-
var
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8231
|
+
var qa,
|
|
8232
|
+
Ca,
|
|
8233
|
+
$a,
|
|
8234
|
+
tr,
|
|
8235
|
+
rr = y(() => {
|
|
8121
8236
|
'use strict';
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
((
|
|
8237
|
+
F();
|
|
8238
|
+
Ae();
|
|
8239
|
+
X();
|
|
8240
|
+
((qa = {
|
|
8126
8241
|
type: 'string',
|
|
8127
8242
|
description:
|
|
8128
8243
|
'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.',
|
|
8129
8244
|
}),
|
|
8130
|
-
(
|
|
8245
|
+
(Ca = new Set([
|
|
8131
8246
|
'upload_asset',
|
|
8132
8247
|
'upload_media',
|
|
8133
8248
|
'upload_image',
|
|
@@ -8135,7 +8250,7 @@ var xa,
|
|
|
8135
8250
|
'check_status',
|
|
8136
8251
|
'get_pricing',
|
|
8137
8252
|
])),
|
|
8138
|
-
(
|
|
8253
|
+
($a = {
|
|
8139
8254
|
name: 'get_pricing',
|
|
8140
8255
|
description:
|
|
8141
8256
|
'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.',
|
|
@@ -8150,7 +8265,7 @@ var xa,
|
|
|
8150
8265
|
additionalProperties: !1,
|
|
8151
8266
|
},
|
|
8152
8267
|
}));
|
|
8153
|
-
|
|
8268
|
+
tr = new Set([
|
|
8154
8269
|
'image',
|
|
8155
8270
|
'images',
|
|
8156
8271
|
'image_url',
|
|
@@ -8167,19 +8282,19 @@ var xa,
|
|
|
8167
8282
|
'lipsyncing_audio',
|
|
8168
8283
|
]);
|
|
8169
8284
|
});
|
|
8170
|
-
var
|
|
8171
|
-
ur
|
|
8172
|
-
forgetToolSchemas: () =>
|
|
8173
|
-
jsonRpcAnswer: () =>
|
|
8174
|
-
preprocessLocalFiles: () =>
|
|
8175
|
-
startStdioServer: () =>
|
|
8285
|
+
var ur = {};
|
|
8286
|
+
wr(ur, {
|
|
8287
|
+
forgetToolSchemas: () => ja,
|
|
8288
|
+
jsonRpcAnswer: () => sr,
|
|
8289
|
+
preprocessLocalFiles: () => dr,
|
|
8290
|
+
startStdioServer: () => cr,
|
|
8176
8291
|
});
|
|
8177
|
-
function
|
|
8292
|
+
function Ua(e) {
|
|
8178
8293
|
let t = (r) =>
|
|
8179
8294
|
!!r && typeof r == 'object' && r.jsonrpc === '2.0' && ('result' in r || 'error' in r);
|
|
8180
8295
|
return Array.isArray(e) ? e.length > 0 && e.every(t) : t(e);
|
|
8181
8296
|
}
|
|
8182
|
-
function
|
|
8297
|
+
function sr(e, t, r) {
|
|
8183
8298
|
let a = e?.id,
|
|
8184
8299
|
n = a == null,
|
|
8185
8300
|
s = null;
|
|
@@ -8188,7 +8303,7 @@ function Xt(e, t, r) {
|
|
|
8188
8303
|
} catch {
|
|
8189
8304
|
s = null;
|
|
8190
8305
|
}
|
|
8191
|
-
if (s !== null &&
|
|
8306
|
+
if (s !== null && Ua(s)) return n ? null : s;
|
|
8192
8307
|
if (n) return null;
|
|
8193
8308
|
if (!r && t >= 200 && t < 300) return;
|
|
8194
8309
|
let o = s?.error,
|
|
@@ -8209,12 +8324,12 @@ function Xt(e, t, r) {
|
|
|
8209
8324
|
},
|
|
8210
8325
|
};
|
|
8211
8326
|
}
|
|
8212
|
-
function
|
|
8327
|
+
function Va() {
|
|
8213
8328
|
let e = process.argv.slice(2),
|
|
8214
8329
|
t = e.indexOf('--api-key');
|
|
8215
|
-
return
|
|
8330
|
+
return E(t >= 0 ? e[t + 1] : void 0);
|
|
8216
8331
|
}
|
|
8217
|
-
async function
|
|
8332
|
+
async function or(e, t, r) {
|
|
8218
8333
|
let a = j.default.resolve(e);
|
|
8219
8334
|
if (!D.default.existsSync(a) || !D.default.statSync(a).isFile())
|
|
8220
8335
|
throw new Error(`File not found: ${e}`);
|
|
@@ -8243,15 +8358,15 @@ async function Zt(e, t, r) {
|
|
|
8243
8358
|
mimeType: c.mime_type || c.mimeType || 'image/png',
|
|
8244
8359
|
};
|
|
8245
8360
|
}
|
|
8246
|
-
function
|
|
8247
|
-
return
|
|
8361
|
+
function lr(e) {
|
|
8362
|
+
return Fa.has(j.default.extname(e).toLowerCase());
|
|
8248
8363
|
}
|
|
8249
|
-
function
|
|
8364
|
+
function pr(e) {
|
|
8250
8365
|
return new Error(
|
|
8251
8366
|
`Tein uploads image, video and audio files only, and ${j.default.basename(e)} is not one.`,
|
|
8252
8367
|
);
|
|
8253
8368
|
}
|
|
8254
|
-
function
|
|
8369
|
+
function Ba(e) {
|
|
8255
8370
|
let t = e.trim();
|
|
8256
8371
|
if (
|
|
8257
8372
|
!t ||
|
|
@@ -8264,22 +8379,22 @@ function Ea(e) {
|
|
|
8264
8379
|
let r = j.default.resolve(t);
|
|
8265
8380
|
return D.default.existsSync(r) && D.default.statSync(r).isFile() ? r : null;
|
|
8266
8381
|
}
|
|
8267
|
-
function
|
|
8382
|
+
function Ze(e) {
|
|
8268
8383
|
if (Array.isArray(e))
|
|
8269
8384
|
for (let t of e) {
|
|
8270
8385
|
let r = t;
|
|
8271
8386
|
typeof r.name == 'string' &&
|
|
8272
8387
|
r.inputSchema &&
|
|
8273
8388
|
typeof r.inputSchema == 'object' &&
|
|
8274
|
-
|
|
8389
|
+
ee.set(r.name, r.inputSchema);
|
|
8275
8390
|
}
|
|
8276
8391
|
}
|
|
8277
|
-
function
|
|
8278
|
-
(
|
|
8392
|
+
function ja() {
|
|
8393
|
+
(ee.clear(), (Qe = 0));
|
|
8279
8394
|
}
|
|
8280
|
-
async function
|
|
8281
|
-
if (!(Date.now() -
|
|
8282
|
-
|
|
8395
|
+
async function Ga(e, t) {
|
|
8396
|
+
if (!(Date.now() - Qe < 6e4)) {
|
|
8397
|
+
Qe = Date.now();
|
|
8283
8398
|
try {
|
|
8284
8399
|
let a = await (
|
|
8285
8400
|
await fetch(e, {
|
|
@@ -8289,39 +8404,39 @@ async function Oa(e, t) {
|
|
|
8289
8404
|
signal: AbortSignal.timeout(1e4),
|
|
8290
8405
|
})
|
|
8291
8406
|
).json();
|
|
8292
|
-
|
|
8407
|
+
Ze(a.result?.tools);
|
|
8293
8408
|
} catch {}
|
|
8294
8409
|
}
|
|
8295
8410
|
}
|
|
8296
|
-
function
|
|
8411
|
+
function Ha(e) {
|
|
8297
8412
|
return e
|
|
8298
8413
|
? e.type === 'string'
|
|
8299
8414
|
? e.format === 'uri'
|
|
8300
8415
|
: e.type === 'array' && e.items?.format === 'uri'
|
|
8301
8416
|
: !1;
|
|
8302
8417
|
}
|
|
8303
|
-
async function
|
|
8418
|
+
async function ar(e, t, r) {
|
|
8304
8419
|
if (typeof e != 'string') return e;
|
|
8305
|
-
let a =
|
|
8420
|
+
let a = Ba(e);
|
|
8306
8421
|
if (!a) return e;
|
|
8307
|
-
if (!
|
|
8308
|
-
return (await
|
|
8422
|
+
if (!lr(a)) throw pr(a);
|
|
8423
|
+
return (await or(a, t, r)).url;
|
|
8309
8424
|
}
|
|
8310
|
-
async function
|
|
8311
|
-
(
|
|
8312
|
-
let s =
|
|
8425
|
+
async function dr(e, t, r, a, n) {
|
|
8426
|
+
(ee.size === 0 && Ze(Xe()), ee.has(e) || (await Ga(n, r)));
|
|
8427
|
+
let s = ee.get(e)?.properties;
|
|
8313
8428
|
if (!s) return t;
|
|
8314
8429
|
let o = { ...t };
|
|
8315
8430
|
for (let [u, l] of Object.entries(t))
|
|
8316
|
-
if (
|
|
8431
|
+
if (Ha(s[u]))
|
|
8317
8432
|
if (Array.isArray(l)) {
|
|
8318
8433
|
let c = [];
|
|
8319
|
-
for (let p of l) c.push(await
|
|
8434
|
+
for (let p of l) c.push(await ar(p, r, a));
|
|
8320
8435
|
o[u] = c;
|
|
8321
|
-
} else o[u] = await
|
|
8436
|
+
} else o[u] = await ar(l, r, a);
|
|
8322
8437
|
return o;
|
|
8323
8438
|
}
|
|
8324
|
-
function
|
|
8439
|
+
function za(e) {
|
|
8325
8440
|
let t = e.id ?? null;
|
|
8326
8441
|
switch (e.method) {
|
|
8327
8442
|
case 'initialize':
|
|
@@ -8339,7 +8454,7 @@ function Da(e) {
|
|
|
8339
8454
|
case 'ping':
|
|
8340
8455
|
return { jsonrpc: '2.0', id: t, result: {} };
|
|
8341
8456
|
case 'tools/list':
|
|
8342
|
-
return { jsonrpc: '2.0', id: t, result: { tools:
|
|
8457
|
+
return { jsonrpc: '2.0', id: t, result: { tools: Xe() } };
|
|
8343
8458
|
case 'tools/call':
|
|
8344
8459
|
return {
|
|
8345
8460
|
jsonrpc: '2.0',
|
|
@@ -8362,13 +8477,13 @@ function Da(e) {
|
|
|
8362
8477
|
};
|
|
8363
8478
|
}
|
|
8364
8479
|
}
|
|
8365
|
-
async function
|
|
8366
|
-
if (
|
|
8367
|
-
|
|
8368
|
-
let e =
|
|
8369
|
-
t =
|
|
8480
|
+
async function cr() {
|
|
8481
|
+
if (ir) return;
|
|
8482
|
+
ir = !0;
|
|
8483
|
+
let e = Va(),
|
|
8484
|
+
t = I(),
|
|
8370
8485
|
r = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
|
|
8371
|
-
(
|
|
8486
|
+
(nr.default
|
|
8372
8487
|
.createInterface({ input: process.stdin, output: process.stdout, terminal: !1 })
|
|
8373
8488
|
.on('line', async (n) => {
|
|
8374
8489
|
let s = n.trim();
|
|
@@ -8380,7 +8495,7 @@ async function ar() {
|
|
|
8380
8495
|
c = o.params.arguments || {};
|
|
8381
8496
|
if (l === 'get_pricing') {
|
|
8382
8497
|
let p = typeof c.model == 'string' ? c.model.trim() : '',
|
|
8383
|
-
d = `${t.replace(/\/+$/, '')}${
|
|
8498
|
+
d = `${t.replace(/\/+$/, '')}${ye(p)}`;
|
|
8384
8499
|
try {
|
|
8385
8500
|
let m = await fetch(d, { signal: AbortSignal.timeout(1e4) }),
|
|
8386
8501
|
h = await m.text();
|
|
@@ -8429,17 +8544,17 @@ async function ar() {
|
|
|
8429
8544
|
try {
|
|
8430
8545
|
let d = j.default.resolve(p.trim());
|
|
8431
8546
|
if (D.default.existsSync(d) && D.default.statSync(d).isFile() && e) {
|
|
8432
|
-
if (!
|
|
8433
|
-
let m = await
|
|
8547
|
+
if (!lr(d)) throw pr(d);
|
|
8548
|
+
let m = await or(d, e, t),
|
|
8434
8549
|
h = (m.sizeBytes / 1024).toFixed(1),
|
|
8435
|
-
|
|
8550
|
+
be =
|
|
8436
8551
|
m.mimeType.startsWith('image/') ||
|
|
8437
8552
|
/\.(png|jpe?g|webp|gif|svg)$/i.test(m.url)
|
|
8438
8553
|
? `
|
|
8439
8554
|
|
|
8440
8555
|
`
|
|
8441
8556
|
: '',
|
|
8442
|
-
|
|
8557
|
+
ke = {
|
|
8443
8558
|
jsonrpc: '2.0',
|
|
8444
8559
|
id: o.id,
|
|
8445
8560
|
result: {
|
|
@@ -8450,7 +8565,7 @@ async function ar() {
|
|
|
8450
8565
|
|
|
8451
8566
|
- **URL:** ${m.url}
|
|
8452
8567
|
- **Type:** \`${m.mimeType}\`
|
|
8453
|
-
- **Size:** ${h} KB${
|
|
8568
|
+
- **Size:** ${h} KB${be}
|
|
8454
8569
|
|
|
8455
8570
|
Pass this URL to any Tein generation tool.`,
|
|
8456
8571
|
},
|
|
@@ -8459,7 +8574,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
8459
8574
|
},
|
|
8460
8575
|
};
|
|
8461
8576
|
process.stdout.write(
|
|
8462
|
-
JSON.stringify(
|
|
8577
|
+
JSON.stringify(ke) +
|
|
8463
8578
|
`
|
|
8464
8579
|
`,
|
|
8465
8580
|
);
|
|
@@ -8486,7 +8601,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
8486
8601
|
}
|
|
8487
8602
|
if (e)
|
|
8488
8603
|
try {
|
|
8489
|
-
o.params.arguments = await
|
|
8604
|
+
o.params.arguments = await dr(String(l), c, e, t, r);
|
|
8490
8605
|
} catch (p) {
|
|
8491
8606
|
let d = p instanceof Error ? p.message : String(p);
|
|
8492
8607
|
process.stdout.write(
|
|
@@ -8517,10 +8632,10 @@ Pass this URL to any Tein generation tool.`,
|
|
|
8517
8632
|
body: JSON.stringify(o),
|
|
8518
8633
|
}),
|
|
8519
8634
|
c = await l.text(),
|
|
8520
|
-
p =
|
|
8635
|
+
p = sr(o, l.status, c);
|
|
8521
8636
|
if (p === null) return;
|
|
8522
8637
|
if (p) {
|
|
8523
|
-
(o?.method === 'tools/list' &&
|
|
8638
|
+
(o?.method === 'tools/list' && Ze(p.result?.tools),
|
|
8524
8639
|
process.stdout.write(
|
|
8525
8640
|
JSON.stringify(p) +
|
|
8526
8641
|
`
|
|
@@ -8529,7 +8644,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
8529
8644
|
return;
|
|
8530
8645
|
}
|
|
8531
8646
|
} catch {}
|
|
8532
|
-
let u =
|
|
8647
|
+
let u = za(o);
|
|
8533
8648
|
u !== null &&
|
|
8534
8649
|
process.stdout.write(
|
|
8535
8650
|
JSON.stringify(u) +
|
|
@@ -8554,20 +8669,20 @@ Pass this URL to any Tein generation tool.`,
|
|
|
8554
8669
|
}
|
|
8555
8670
|
var D,
|
|
8556
8671
|
j,
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8672
|
+
nr,
|
|
8673
|
+
Fa,
|
|
8674
|
+
ee,
|
|
8675
|
+
Qe,
|
|
8676
|
+
ir,
|
|
8677
|
+
mr = y(() => {
|
|
8563
8678
|
'use strict';
|
|
8564
8679
|
((D = _(require('node:fs'))),
|
|
8565
8680
|
(j = _(require('node:path'))),
|
|
8566
|
-
(
|
|
8567
|
-
|
|
8568
|
-
|
|
8681
|
+
(nr = _(require('node:readline'))));
|
|
8682
|
+
Ge();
|
|
8683
|
+
rr();
|
|
8569
8684
|
A();
|
|
8570
|
-
|
|
8685
|
+
Fa = new Set([
|
|
8571
8686
|
'.png',
|
|
8572
8687
|
'.jpg',
|
|
8573
8688
|
'.jpeg',
|
|
@@ -8593,20 +8708,20 @@ var D,
|
|
|
8593
8708
|
'.flac',
|
|
8594
8709
|
'.opus',
|
|
8595
8710
|
]);
|
|
8596
|
-
((
|
|
8597
|
-
|
|
8711
|
+
((ee = new Map()), (Qe = 0));
|
|
8712
|
+
ir = !1;
|
|
8598
8713
|
require.main === module &&
|
|
8599
|
-
|
|
8714
|
+
cr().catch((e) => {
|
|
8600
8715
|
(process.stderr.write(`Fatal error in Tein MCP CLI: ${e}
|
|
8601
8716
|
`),
|
|
8602
8717
|
process.exit(1));
|
|
8603
8718
|
});
|
|
8604
8719
|
});
|
|
8605
|
-
var
|
|
8720
|
+
var Pr =
|
|
8606
8721
|
!process.env.NO_COLOR &&
|
|
8607
8722
|
(process.stdout.isTTY || process.env.FORCE_COLOR === '1' || process.env.TERM !== 'dumb');
|
|
8608
8723
|
function k(e, t) {
|
|
8609
|
-
return (r) => (
|
|
8724
|
+
return (r) => (Pr ? `\x1B[${e}m${r}\x1B[${t}m` : String(r));
|
|
8610
8725
|
}
|
|
8611
8726
|
var i = {
|
|
8612
8727
|
bold: k(1, 22),
|
|
@@ -8690,13 +8805,13 @@ var i = {
|
|
|
8690
8805
|
process.stdout.isTTY && process.stdout.write('\r\x1B[K'));
|
|
8691
8806
|
}
|
|
8692
8807
|
};
|
|
8693
|
-
var
|
|
8694
|
-
|
|
8695
|
-
var
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
var
|
|
8699
|
-
var
|
|
8808
|
+
var N = _(require('node:fs')),
|
|
8809
|
+
q = _(require('node:path'));
|
|
8810
|
+
var re = _(require('node:fs')),
|
|
8811
|
+
at = _(require('node:path')),
|
|
8812
|
+
it = require('node:stream/promises');
|
|
8813
|
+
var te = '1.1.7';
|
|
8814
|
+
var Ir = new Set([
|
|
8700
8815
|
'account_suspended',
|
|
8701
8816
|
'account_terminated',
|
|
8702
8817
|
'creative_mode_restricted',
|
|
@@ -8704,7 +8819,7 @@ var gr = new Set([
|
|
|
8704
8819
|
'workspace_paused',
|
|
8705
8820
|
]),
|
|
8706
8821
|
v = 1,
|
|
8707
|
-
|
|
8822
|
+
_r = 3,
|
|
8708
8823
|
w = class extends Error {
|
|
8709
8824
|
constructor(t, r, a, n = {}) {
|
|
8710
8825
|
(super(r),
|
|
@@ -8714,10 +8829,10 @@ var gr = new Set([
|
|
|
8714
8829
|
(this.fields = n));
|
|
8715
8830
|
}
|
|
8716
8831
|
get exitCode() {
|
|
8717
|
-
return this.code &&
|
|
8832
|
+
return this.code && Ir.has(this.code) ? _r : v;
|
|
8718
8833
|
}
|
|
8719
8834
|
};
|
|
8720
|
-
function
|
|
8835
|
+
function vr(e, t, r) {
|
|
8721
8836
|
let a = `HTTP ${e}${t ? ` ${t}` : ''}`;
|
|
8722
8837
|
if (!r || typeof r != 'object') return new w(e, a);
|
|
8723
8838
|
let n = r;
|
|
@@ -8730,13 +8845,13 @@ function yr(e, t, r) {
|
|
|
8730
8845
|
c = (typeof s == 'string' && s) || (typeof u == 'string' && u) || a;
|
|
8731
8846
|
return new w(e, c, typeof o == 'string' ? o : void 0, l);
|
|
8732
8847
|
}
|
|
8733
|
-
function
|
|
8848
|
+
function tt(e) {
|
|
8734
8849
|
return typeof e == 'number' && Number.isFinite(e) ? `$${e.toFixed(4)}` : null;
|
|
8735
8850
|
}
|
|
8736
8851
|
function S(e) {
|
|
8737
8852
|
let t = [e.message],
|
|
8738
|
-
r =
|
|
8739
|
-
a =
|
|
8853
|
+
r = tt(e.fields.required),
|
|
8854
|
+
a = tt(e.fields.balance);
|
|
8740
8855
|
(r || a) &&
|
|
8741
8856
|
t.push([r ? `Required: ${r}` : '', a ? `Balance: ${a}` : ''].filter(Boolean).join(' '));
|
|
8742
8857
|
let n = e.fields.org_name ?? e.fields.orgName;
|
|
@@ -8744,19 +8859,19 @@ function S(e) {
|
|
|
8744
8859
|
let s = e.fields.url ?? e.fields.appeal_url ?? e.fields.top_up_url;
|
|
8745
8860
|
return (typeof s == 'string' && s && t.push(s), e.code && t.push(`(${e.code})`), t);
|
|
8746
8861
|
}
|
|
8747
|
-
function
|
|
8862
|
+
function Tr(e) {
|
|
8748
8863
|
return /\.(mp4|webm|mov)(\?|$)/i.test(e)
|
|
8749
8864
|
? 'video'
|
|
8750
8865
|
: /\.(mp3|wav|ogg|flac)(\?|$)/i.test(e)
|
|
8751
8866
|
? 'audio'
|
|
8752
8867
|
: 'image';
|
|
8753
8868
|
}
|
|
8754
|
-
function
|
|
8869
|
+
function rt(e) {
|
|
8755
8870
|
let t = [];
|
|
8756
8871
|
for (let r of e.data ?? [])
|
|
8757
8872
|
typeof r.message?.content == 'string'
|
|
8758
8873
|
? t.push({ type: 'text', text: r.message.content })
|
|
8759
|
-
: r.url && t.push({ type:
|
|
8874
|
+
: r.url && t.push({ type: Tr(r.url), url: r.url, ...(r.layer ? { layer: r.layer } : {}) });
|
|
8760
8875
|
return t;
|
|
8761
8876
|
}
|
|
8762
8877
|
var K = class {
|
|
@@ -8767,7 +8882,7 @@ var K = class {
|
|
|
8767
8882
|
return {
|
|
8768
8883
|
'Content-Type': 'application/json',
|
|
8769
8884
|
Authorization: `Bearer ${this.apiKey}`,
|
|
8770
|
-
'User-Agent': `Tein-CLI/${
|
|
8885
|
+
'User-Agent': `Tein-CLI/${te}`,
|
|
8771
8886
|
'X-Tein-Client': 'cli',
|
|
8772
8887
|
};
|
|
8773
8888
|
}
|
|
@@ -8782,7 +8897,7 @@ var K = class {
|
|
|
8782
8897
|
try {
|
|
8783
8898
|
s = await n.json();
|
|
8784
8899
|
} catch {}
|
|
8785
|
-
throw
|
|
8900
|
+
throw vr(n.status, n.statusText, s);
|
|
8786
8901
|
}
|
|
8787
8902
|
return await n.json();
|
|
8788
8903
|
}
|
|
@@ -8796,7 +8911,7 @@ var K = class {
|
|
|
8796
8911
|
n === 'succeeded' || n === 'failed' || n === 'expired' || n === 'cancelled'
|
|
8797
8912
|
? n
|
|
8798
8913
|
: 'processing',
|
|
8799
|
-
o =
|
|
8914
|
+
o = rt(a);
|
|
8800
8915
|
return {
|
|
8801
8916
|
request_id: a.request_id || a.id || '',
|
|
8802
8917
|
model: a.model,
|
|
@@ -8814,7 +8929,7 @@ var K = class {
|
|
|
8814
8929
|
a === 'succeeded' || a === 'failed' || a === 'expired' || a === 'cancelled'
|
|
8815
8930
|
? a
|
|
8816
8931
|
: 'processing',
|
|
8817
|
-
s =
|
|
8932
|
+
s = rt(r),
|
|
8818
8933
|
o = r.error && typeof r.error.message == 'string' ? r.error.message : null;
|
|
8819
8934
|
return {
|
|
8820
8935
|
request_id: r.id || t,
|
|
@@ -8832,14 +8947,14 @@ var K = class {
|
|
|
8832
8947
|
async downloadOutput(t, r) {
|
|
8833
8948
|
let a = await fetch(t);
|
|
8834
8949
|
if (!a.ok) throw new Error(`The file could not be downloaded (HTTP ${a.status})`);
|
|
8835
|
-
let n =
|
|
8836
|
-
|
|
8837
|
-
let s =
|
|
8838
|
-
return (await (0,
|
|
8950
|
+
let n = at.default.dirname(r);
|
|
8951
|
+
re.default.existsSync(n) || re.default.mkdirSync(n, { recursive: !0 });
|
|
8952
|
+
let s = re.default.createWriteStream(r);
|
|
8953
|
+
return (await (0, it.pipeline)(a.body, s), r);
|
|
8839
8954
|
}
|
|
8840
8955
|
};
|
|
8841
8956
|
A();
|
|
8842
|
-
function
|
|
8957
|
+
function _e(e) {
|
|
8843
8958
|
if (typeof e != 'number' || !Number.isFinite(e)) return '';
|
|
8844
8959
|
if (Math.abs(e) >= 1 || Math.abs(Number(e.toFixed(4)) - e) < 1e-12) return `$${e.toFixed(4)}`;
|
|
8845
8960
|
let t = Math.max(0, 3 - Number(e.toExponential(3).split('e')[1])),
|
|
@@ -8847,43 +8962,43 @@ function xe(e) {
|
|
|
8847
8962
|
a = Math.round(Number((e * r).toFixed(6))) / r;
|
|
8848
8963
|
return a >= 1 ? `$${a.toFixed(4)}` : `$${a.toFixed(t).replace(/0+$/, '')}`;
|
|
8849
8964
|
}
|
|
8850
|
-
|
|
8851
|
-
var
|
|
8852
|
-
function
|
|
8853
|
-
for (let t of
|
|
8965
|
+
X();
|
|
8966
|
+
var Bt = ['images', 'input_images', 'videos', 'audios'];
|
|
8967
|
+
function ca(e) {
|
|
8968
|
+
for (let t of Bt) typeof e[t] == 'string' && (e[t] = [e[t]]);
|
|
8854
8969
|
}
|
|
8855
|
-
function
|
|
8970
|
+
function ua(e) {
|
|
8856
8971
|
if (e.startsWith('http://') || e.startsWith('https://')) return null;
|
|
8857
|
-
let t =
|
|
8858
|
-
return
|
|
8972
|
+
let t = q.default.resolve(e);
|
|
8973
|
+
return N.default.existsSync(t) && N.default.statSync(t).isFile() ? t : null;
|
|
8859
8974
|
}
|
|
8860
|
-
async function
|
|
8861
|
-
for (let r of
|
|
8975
|
+
async function ma(e, t) {
|
|
8976
|
+
for (let r of Bt) {
|
|
8862
8977
|
if (!Array.isArray(e[r])) continue;
|
|
8863
8978
|
let a = [];
|
|
8864
8979
|
for (let n of e[r]) {
|
|
8865
8980
|
if (typeof n != 'string') continue;
|
|
8866
|
-
let s =
|
|
8981
|
+
let s = ua(n);
|
|
8867
8982
|
a.push(s ? await t(s) : n);
|
|
8868
8983
|
}
|
|
8869
8984
|
e[r] = a;
|
|
8870
8985
|
}
|
|
8871
8986
|
}
|
|
8872
|
-
var
|
|
8873
|
-
function
|
|
8987
|
+
var Q = { starter: 10, plus: 25, scale: 40, enterprise: 200 };
|
|
8988
|
+
function fa(e) {
|
|
8874
8989
|
if (e.count === void 0 || e.count === !0) return 1;
|
|
8875
8990
|
let t = typeof e.count == 'number' ? e.count : Number(e.count),
|
|
8876
|
-
r =
|
|
8991
|
+
r = Q.enterprise;
|
|
8877
8992
|
return (
|
|
8878
8993
|
(!Number.isInteger(t) || t < 1 || t > r) &&
|
|
8879
8994
|
(process.stderr
|
|
8880
|
-
.write(`${i.red('Error:')} --count must be a whole number from 1 to ${r}. The API allows Starter ${
|
|
8995
|
+
.write(`${i.red('Error:')} --count must be a whole number from 1 to ${r}. The API allows Starter ${Q.starter}, Plus ${Q.plus}, Scale ${Q.scale}, Enterprise ${Q.enterprise} at once, including polling.
|
|
8881
8996
|
`),
|
|
8882
8997
|
process.exit(1)),
|
|
8883
8998
|
t
|
|
8884
8999
|
);
|
|
8885
9000
|
}
|
|
8886
|
-
async function
|
|
9001
|
+
async function ga(e, t, r, a, n) {
|
|
8887
9002
|
n.isJson ||
|
|
8888
9003
|
process.stderr.write(`Starting ${a} ${t} jobs together...
|
|
8889
9004
|
`);
|
|
@@ -8945,7 +9060,7 @@ async function na(e, t, r, a, n) {
|
|
|
8945
9060
|
else {
|
|
8946
9061
|
for (let l of o)
|
|
8947
9062
|
(process.stdout.write(`${l.request_id} ${l.status}`),
|
|
8948
|
-
l.usage?.cost !== void 0 && process.stdout.write(` ${
|
|
9063
|
+
l.usage?.cost !== void 0 && process.stdout.write(` ${_e(l.usage.cost)}`),
|
|
8949
9064
|
l.error && process.stdout.write(` ${l.error}`),
|
|
8950
9065
|
process.stdout.write(`
|
|
8951
9066
|
`));
|
|
@@ -8958,12 +9073,12 @@ async function na(e, t, r, a, n) {
|
|
|
8958
9073
|
o.some((l) => l.status === 'failed' || l.status === 'expired' || l.status === 'cancelled')) &&
|
|
8959
9074
|
process.exit(v);
|
|
8960
9075
|
}
|
|
8961
|
-
function
|
|
9076
|
+
function ha(e, t, r) {
|
|
8962
9077
|
if (r <= 1) return e;
|
|
8963
|
-
let a =
|
|
9078
|
+
let a = q.default.extname(e);
|
|
8964
9079
|
return `${e.slice(0, e.length - a.length)}-${t + 1}${a}`;
|
|
8965
9080
|
}
|
|
8966
|
-
function
|
|
9081
|
+
function jt(e) {
|
|
8967
9082
|
let t = {},
|
|
8968
9083
|
r = new Set(),
|
|
8969
9084
|
a = [];
|
|
@@ -9008,9 +9123,9 @@ function Rt(e) {
|
|
|
9008
9123
|
}
|
|
9009
9124
|
return { command: a[0] || '', subcommand: a[1], modelSlug: a[1] || a[0], options: t, flags: r };
|
|
9010
9125
|
}
|
|
9011
|
-
async function
|
|
9012
|
-
let r =
|
|
9013
|
-
a =
|
|
9126
|
+
async function je(e, t) {
|
|
9127
|
+
let r = E(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
9128
|
+
a = I(typeof t.api_url == 'string' ? t.api_url : void 0);
|
|
9014
9129
|
(r ||
|
|
9015
9130
|
(process.stderr.write(`${i.red('Error:')} Authentication required.
|
|
9016
9131
|
`),
|
|
@@ -9026,11 +9141,11 @@ async function Le(e, t) {
|
|
|
9026
9141
|
process.stderr.write(`Run ${i.cyan('tein models')} to list all available models.
|
|
9027
9142
|
`),
|
|
9028
9143
|
process.exit(1)));
|
|
9029
|
-
let n =
|
|
9144
|
+
let n = B(e),
|
|
9030
9145
|
s = !!t.json,
|
|
9031
9146
|
o = !!(t.async || t.no_wait),
|
|
9032
9147
|
u = typeof t.output == 'string' ? t.output : void 0,
|
|
9033
|
-
l =
|
|
9148
|
+
l = fa(t),
|
|
9034
9149
|
c = { ...t };
|
|
9035
9150
|
(delete c.json,
|
|
9036
9151
|
delete c.async,
|
|
@@ -9039,9 +9154,9 @@ async function Le(e, t) {
|
|
|
9039
9154
|
delete c.api_key,
|
|
9040
9155
|
delete c.api_url,
|
|
9041
9156
|
delete c.count);
|
|
9042
|
-
let p =
|
|
9043
|
-
(
|
|
9044
|
-
typeof p.image == 'string' && !p.images && !
|
|
9157
|
+
let p = Ft(n, c);
|
|
9158
|
+
(ca(p),
|
|
9159
|
+
typeof p.image == 'string' && !p.images && !he(n) && ((p.images = [p.image]), delete p.image),
|
|
9045
9160
|
p.image_url &&
|
|
9046
9161
|
!p.first_frame_image &&
|
|
9047
9162
|
(e.startsWith('seedance') || e.startsWith('happy-horse')) &&
|
|
@@ -9059,14 +9174,14 @@ async function Le(e, t) {
|
|
|
9059
9174
|
for (let b of m) {
|
|
9060
9175
|
let g = p[b];
|
|
9061
9176
|
if (typeof g == 'string' && !g.startsWith('http://') && !g.startsWith('https://')) {
|
|
9062
|
-
let x =
|
|
9063
|
-
if (
|
|
9064
|
-
let
|
|
9065
|
-
s ||
|
|
9177
|
+
let x = q.default.resolve(g);
|
|
9178
|
+
if (N.default.existsSync(x) && N.default.statSync(x).isFile()) {
|
|
9179
|
+
let P = new T(`Uploading local file ${q.default.basename(x)} to CDN...`);
|
|
9180
|
+
s || P.start();
|
|
9066
9181
|
try {
|
|
9067
|
-
let L =
|
|
9182
|
+
let L = N.default.readFileSync(x),
|
|
9068
9183
|
C = await d.uploadAsset(L.toString('base64'));
|
|
9069
|
-
((p[b] = C.url), s ||
|
|
9184
|
+
((p[b] = C.url), s || P.succeed(`Uploaded ${q.default.basename(x)} to CDN`));
|
|
9070
9185
|
} catch (L) {
|
|
9071
9186
|
let C = L instanceof Error ? L.message : String(L);
|
|
9072
9187
|
(s
|
|
@@ -9075,28 +9190,28 @@ async function Le(e, t) {
|
|
|
9075
9190
|
`
|
|
9076
9191
|
`,
|
|
9077
9192
|
)
|
|
9078
|
-
:
|
|
9193
|
+
: P.fail(`Upload failed: ${C}`),
|
|
9079
9194
|
process.exit(1));
|
|
9080
9195
|
}
|
|
9081
9196
|
}
|
|
9082
9197
|
}
|
|
9083
9198
|
}
|
|
9084
|
-
await
|
|
9085
|
-
let g = new T(`Uploading local file ${
|
|
9199
|
+
await ma(p, async (b) => {
|
|
9200
|
+
let g = new T(`Uploading local file ${q.default.basename(b)} to CDN...`);
|
|
9086
9201
|
s || g.start();
|
|
9087
9202
|
try {
|
|
9088
|
-
let x =
|
|
9089
|
-
|
|
9090
|
-
return (s || g.succeed(`Uploaded ${
|
|
9203
|
+
let x = N.default.readFileSync(b),
|
|
9204
|
+
P = await d.uploadAsset(x.toString('base64'));
|
|
9205
|
+
return (s || g.succeed(`Uploaded ${q.default.basename(b)} to CDN`), P.url);
|
|
9091
9206
|
} catch (x) {
|
|
9092
|
-
let
|
|
9207
|
+
let P = x instanceof Error ? x.message : String(x);
|
|
9093
9208
|
(s
|
|
9094
9209
|
? process.stdout.write(
|
|
9095
|
-
JSON.stringify({ error:
|
|
9210
|
+
JSON.stringify({ error: P }) +
|
|
9096
9211
|
`
|
|
9097
9212
|
`,
|
|
9098
9213
|
)
|
|
9099
|
-
: g.fail(`Upload failed: ${
|
|
9214
|
+
: g.fail(`Upload failed: ${P}`),
|
|
9100
9215
|
process.exit(1));
|
|
9101
9216
|
}
|
|
9102
9217
|
});
|
|
@@ -9105,7 +9220,7 @@ async function Le(e, t) {
|
|
|
9105
9220
|
let f;
|
|
9106
9221
|
try {
|
|
9107
9222
|
if (l > 1) {
|
|
9108
|
-
await
|
|
9223
|
+
await ga(d, e, p, l, { isJson: s, isAsync: o });
|
|
9109
9224
|
return;
|
|
9110
9225
|
}
|
|
9111
9226
|
f = await d.queueJob(e, p);
|
|
@@ -9143,12 +9258,12 @@ async function Le(e, t) {
|
|
|
9143
9258
|
`));
|
|
9144
9259
|
return;
|
|
9145
9260
|
}
|
|
9146
|
-
let
|
|
9147
|
-
|
|
9261
|
+
let be = Date.now(),
|
|
9262
|
+
ke = 1500;
|
|
9148
9263
|
for (; f.status === 'processing';) {
|
|
9149
|
-
let b = Math.round((Date.now() -
|
|
9264
|
+
let b = Math.round((Date.now() - be) / 1e3);
|
|
9150
9265
|
(s || h.update(`Rendering ${i.bold(e)} (${b}s elapsed)... [ID: ${f.request_id}]`),
|
|
9151
|
-
await new Promise((g) => setTimeout(g,
|
|
9266
|
+
await new Promise((g) => setTimeout(g, ke)));
|
|
9152
9267
|
try {
|
|
9153
9268
|
f = await d.getStatus(f.request_id);
|
|
9154
9269
|
} catch (g) {
|
|
@@ -9190,7 +9305,7 @@ async function Le(e, t) {
|
|
|
9190
9305
|
process.stdout.write(` ${i.bold('Request ID:')} ${f.request_id}
|
|
9191
9306
|
`),
|
|
9192
9307
|
f.usage?.cost !== void 0 &&
|
|
9193
|
-
process.stdout.write(` ${i.bold('Cost:')} ${
|
|
9308
|
+
process.stdout.write(` ${i.bold('Cost:')} ${_e(f.usage.cost)}
|
|
9194
9309
|
`),
|
|
9195
9310
|
f.output && f.output.length > 0)
|
|
9196
9311
|
) {
|
|
@@ -9200,38 +9315,38 @@ ${i.bold('Outputs:')}
|
|
|
9200
9315
|
let b = f.output.filter((x) => x.url).length,
|
|
9201
9316
|
g = 0;
|
|
9202
9317
|
for (let x = 0; x < f.output.length; x++) {
|
|
9203
|
-
let
|
|
9204
|
-
if (
|
|
9205
|
-
let L =
|
|
9318
|
+
let P = f.output[x];
|
|
9319
|
+
if (P.url) {
|
|
9320
|
+
let L = P.layer?.name ? ` ${i.bold(P.layer.name)}` : '';
|
|
9206
9321
|
if (
|
|
9207
|
-
(process.stdout.write(` [${
|
|
9322
|
+
(process.stdout.write(` [${P.type.toUpperCase()}]${L} ${i.cyan(i.underline(P.url))}
|
|
9208
9323
|
`),
|
|
9209
9324
|
u)
|
|
9210
9325
|
) {
|
|
9211
|
-
let C =
|
|
9212
|
-
|
|
9326
|
+
let C = ha(u, g++, b),
|
|
9327
|
+
et = new T(`Downloading output to ${C}...`).start();
|
|
9213
9328
|
try {
|
|
9214
|
-
(await d.downloadOutput(
|
|
9215
|
-
|
|
9216
|
-
} catch (
|
|
9217
|
-
|
|
9329
|
+
(await d.downloadOutput(P.url, q.default.resolve(process.cwd(), C)),
|
|
9330
|
+
et.succeed(`Saved to ${i.bold(C)}`));
|
|
9331
|
+
} catch (we) {
|
|
9332
|
+
et.fail(`Failed to download: ${we instanceof Error ? we.message : we}`);
|
|
9218
9333
|
}
|
|
9219
9334
|
}
|
|
9220
9335
|
} else
|
|
9221
|
-
|
|
9336
|
+
P.text &&
|
|
9222
9337
|
process.stdout.write(`
|
|
9223
|
-
${
|
|
9338
|
+
${P.text}
|
|
9224
9339
|
`);
|
|
9225
9340
|
}
|
|
9226
9341
|
}
|
|
9227
9342
|
process.stdout.write(`
|
|
9228
9343
|
`);
|
|
9229
9344
|
}
|
|
9230
|
-
var
|
|
9345
|
+
var Gt = _(require('node:readline'));
|
|
9231
9346
|
A();
|
|
9232
|
-
async function
|
|
9347
|
+
async function ya(e) {
|
|
9233
9348
|
try {
|
|
9234
|
-
return (await new K(e,
|
|
9349
|
+
return (await new K(e, I()).checkKey(), 'ok');
|
|
9235
9350
|
} catch (t) {
|
|
9236
9351
|
if (t instanceof w) {
|
|
9237
9352
|
if (t.status === 401) return 'invalid';
|
|
@@ -9240,15 +9355,15 @@ async function oa(e) {
|
|
|
9240
9355
|
return 'unchecked';
|
|
9241
9356
|
}
|
|
9242
9357
|
}
|
|
9243
|
-
function
|
|
9244
|
-
let t =
|
|
9358
|
+
function ba(e) {
|
|
9359
|
+
let t = Gt.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
9245
9360
|
return new Promise((r) => {
|
|
9246
9361
|
t.question(e, (a) => {
|
|
9247
9362
|
(t.close(), r(a.trim()));
|
|
9248
9363
|
});
|
|
9249
9364
|
});
|
|
9250
9365
|
}
|
|
9251
|
-
async function
|
|
9366
|
+
async function Z(e, t) {
|
|
9252
9367
|
switch (e) {
|
|
9253
9368
|
case 'login':
|
|
9254
9369
|
case 'set-key': {
|
|
@@ -9260,22 +9375,22 @@ ${i.bold('Tein AI Authentication')}
|
|
|
9260
9375
|
process.stdout.write(`Get your API key at: ${i.cyan('https://tein.ai/dashboard/keys')}
|
|
9261
9376
|
|
|
9262
9377
|
`),
|
|
9263
|
-
(r = await
|
|
9378
|
+
(r = await ba('Enter your Tein API Key (sk_live_...): '))),
|
|
9264
9379
|
!r.startsWith('sk_live_') &&
|
|
9265
9380
|
!r.startsWith('sk_test_') &&
|
|
9266
9381
|
(process.stderr
|
|
9267
9382
|
.write(`${i.red('Error:')} Invalid key format. Tein API keys start with 'sk_live_' or 'sk_test_'.
|
|
9268
9383
|
`),
|
|
9269
9384
|
process.exit(1)));
|
|
9270
|
-
let a = await
|
|
9385
|
+
let a = await ya(r);
|
|
9271
9386
|
(a === 'invalid' &&
|
|
9272
9387
|
(process.stderr
|
|
9273
9388
|
.write(`${i.red('Error:')} Tein did not accept this key. Copy it again from ${i.cyan('https://tein.ai/dashboard/keys')}. Nothing was saved.
|
|
9274
9389
|
`),
|
|
9275
9390
|
process.exit(1)),
|
|
9276
|
-
|
|
9391
|
+
Ie({ apiKey: r }),
|
|
9277
9392
|
process.stdout.write(`
|
|
9278
|
-
${i.green('\u2713')} API key saved to ${i.dim(
|
|
9393
|
+
${i.green('\u2713')} API key saved to ${i.dim(ie())}
|
|
9279
9394
|
`),
|
|
9280
9395
|
a === 'blocked'
|
|
9281
9396
|
? process.stdout
|
|
@@ -9292,27 +9407,27 @@ ${i.green('\u2713')} API key saved to ${i.dim(re())}
|
|
|
9292
9407
|
break;
|
|
9293
9408
|
}
|
|
9294
9409
|
case 'logout': {
|
|
9295
|
-
if (!
|
|
9410
|
+
if (!V().apiKey) {
|
|
9296
9411
|
process.stdout
|
|
9297
9412
|
.write(`${i.yellow('\u2139')} No active API key found. You are already logged out.
|
|
9298
9413
|
`);
|
|
9299
9414
|
break;
|
|
9300
9415
|
}
|
|
9301
|
-
(
|
|
9416
|
+
(Ie({ apiKey: '' }),
|
|
9302
9417
|
process.stdout
|
|
9303
|
-
.write(`${i.green('\u2713')} Logged out successfully. Stored API key has been cleared from ${i.dim(
|
|
9418
|
+
.write(`${i.green('\u2713')} Logged out successfully. Stored API key has been cleared from ${i.dim(ie())}
|
|
9304
9419
|
`));
|
|
9305
9420
|
break;
|
|
9306
9421
|
}
|
|
9307
9422
|
default: {
|
|
9308
|
-
let r =
|
|
9309
|
-
a =
|
|
9310
|
-
n =
|
|
9423
|
+
let r = E(),
|
|
9424
|
+
a = I(),
|
|
9425
|
+
n = V();
|
|
9311
9426
|
if (
|
|
9312
9427
|
(process.stdout.write(`
|
|
9313
9428
|
${i.bold('Tein AI CLI Configuration')}
|
|
9314
9429
|
`),
|
|
9315
|
-
process.stdout.write(` Config file: ${i.dim(
|
|
9430
|
+
process.stdout.write(` Config file: ${i.dim(ie())}
|
|
9316
9431
|
`),
|
|
9317
9432
|
process.stdout.write(` API URL: ${i.cyan(a)}
|
|
9318
9433
|
`),
|
|
@@ -9337,12 +9452,12 @@ ${i.bold('Tein AI CLI Configuration')}
|
|
|
9337
9452
|
}
|
|
9338
9453
|
}
|
|
9339
9454
|
A();
|
|
9340
|
-
|
|
9341
|
-
|
|
9342
|
-
var
|
|
9343
|
-
async function
|
|
9455
|
+
ve();
|
|
9456
|
+
X();
|
|
9457
|
+
var ka = 3e3;
|
|
9458
|
+
async function Ht(e) {
|
|
9344
9459
|
try {
|
|
9345
|
-
let t = await fetch(`${
|
|
9460
|
+
let t = await fetch(`${I(e)}/v1/pricing`, { signal: AbortSignal.timeout(ka) });
|
|
9346
9461
|
if (!t.ok) return;
|
|
9347
9462
|
let r = await t.json(),
|
|
9348
9463
|
a = {};
|
|
@@ -9350,18 +9465,18 @@ async function Lt(e) {
|
|
|
9350
9465
|
let s = String(n.modelSlug ?? '');
|
|
9351
9466
|
G.has(s) && (a[s] ??= []).push(Number(n.starterPrice));
|
|
9352
9467
|
}
|
|
9353
|
-
|
|
9468
|
+
Ot(a);
|
|
9354
9469
|
} catch {}
|
|
9355
9470
|
}
|
|
9356
|
-
var
|
|
9357
|
-
|
|
9358
|
-
async function
|
|
9359
|
-
await
|
|
9360
|
-
let r =
|
|
9471
|
+
var wa = new Set(['video', 'image', 'text', 'audio', '3d']),
|
|
9472
|
+
xa = { llm: 'text', chat: 'text', reasoning: 'text' };
|
|
9473
|
+
async function zt(e, t) {
|
|
9474
|
+
await Ht(t);
|
|
9475
|
+
let r = O();
|
|
9361
9476
|
if (e) {
|
|
9362
9477
|
let s = e.toLowerCase(),
|
|
9363
|
-
o =
|
|
9364
|
-
r =
|
|
9478
|
+
o = xa[s] ?? s;
|
|
9479
|
+
r = wa.has(o)
|
|
9365
9480
|
? r.filter((u) => u.category.toLowerCase() === o)
|
|
9366
9481
|
: r.filter((u) => u.kind.toLowerCase().includes(s) || u.slug.toLowerCase().includes(s));
|
|
9367
9482
|
}
|
|
@@ -9399,9 +9514,9 @@ ${i.bold('Tein AI Models Catalog')} (${r.length} available)
|
|
|
9399
9514
|
|
|
9400
9515
|
`);
|
|
9401
9516
|
}
|
|
9402
|
-
async function
|
|
9403
|
-
G.has(e) && (await
|
|
9404
|
-
let r =
|
|
9517
|
+
async function Jt(e, t) {
|
|
9518
|
+
G.has(e) && (await Ht(t));
|
|
9519
|
+
let r = B(e);
|
|
9405
9520
|
(r ||
|
|
9406
9521
|
(process.stderr.write(`${i.red('Error:')} Model "${e}" not found in Tein AI registry.
|
|
9407
9522
|
`),
|
|
@@ -9481,9 +9596,9 @@ ${i.bold(i.cyan(r.name))} (${i.bold(r.slug)})
|
|
|
9481
9596
|
`);
|
|
9482
9597
|
}
|
|
9483
9598
|
A();
|
|
9484
|
-
|
|
9485
|
-
var
|
|
9486
|
-
|
|
9599
|
+
Ge();
|
|
9600
|
+
var Pa = 1e4,
|
|
9601
|
+
ze = {
|
|
9487
9602
|
price: '',
|
|
9488
9603
|
creativeMode: 'Creative mode',
|
|
9489
9604
|
priority: 'Priority',
|
|
@@ -9493,22 +9608,22 @@ var ua = 1e4,
|
|
|
9493
9608
|
priorityDraft: 'Priority + Draft',
|
|
9494
9609
|
creativeModePriorityDraft: 'Creative mode + Priority + Draft',
|
|
9495
9610
|
},
|
|
9496
|
-
|
|
9497
|
-
|
|
9611
|
+
Ia = Object.keys(ze),
|
|
9612
|
+
_a = {
|
|
9498
9613
|
creativeMode: 'unfiltered',
|
|
9499
9614
|
creativeModePriority: 'unfilteredPriority',
|
|
9500
9615
|
creativeModeDraft: 'unfilteredDraft',
|
|
9501
9616
|
creativeModePriorityDraft: 'unfilteredPriorityDraft',
|
|
9502
9617
|
};
|
|
9503
|
-
function
|
|
9504
|
-
let r =
|
|
9618
|
+
function va(e, t) {
|
|
9619
|
+
let r = _a[t];
|
|
9505
9620
|
return e[t] ?? (r ? e[r] : void 0);
|
|
9506
9621
|
}
|
|
9507
|
-
async function
|
|
9508
|
-
let r = `${
|
|
9622
|
+
async function Ta(e, t) {
|
|
9623
|
+
let r = `${I(e)}${ye(t)}`,
|
|
9509
9624
|
a;
|
|
9510
9625
|
try {
|
|
9511
|
-
a = await fetch(r, { signal: AbortSignal.timeout(
|
|
9626
|
+
a = await fetch(r, { signal: AbortSignal.timeout(Pa) });
|
|
9512
9627
|
} catch {
|
|
9513
9628
|
throw new Error(`Could not reach ${r}`);
|
|
9514
9629
|
}
|
|
@@ -9524,18 +9639,18 @@ async function ha(e, t) {
|
|
|
9524
9639
|
}
|
|
9525
9640
|
return n;
|
|
9526
9641
|
}
|
|
9527
|
-
function
|
|
9642
|
+
function He(e) {
|
|
9528
9643
|
let t = e.toFixed(4).replace(/0+$/, '').replace(/\.$/, ''),
|
|
9529
9644
|
[r, a = ''] = t.split('.');
|
|
9530
9645
|
return `$${r}.${a.padEnd(2, '0')}`;
|
|
9531
9646
|
}
|
|
9532
|
-
function
|
|
9647
|
+
function Je(e) {
|
|
9533
9648
|
if (!e || typeof e.starter != 'number') return null;
|
|
9534
9649
|
let t = typeof e.plus == 'number' ? e.plus : e.starter,
|
|
9535
9650
|
r = typeof e.scale == 'number' ? e.scale : t;
|
|
9536
|
-
return `Starter ${
|
|
9651
|
+
return `Starter ${He(e.starter)} Plus ${He(t)} Scale ${He(r)}`;
|
|
9537
9652
|
}
|
|
9538
|
-
function
|
|
9653
|
+
function Ma(e) {
|
|
9539
9654
|
if (typeof e.label == 'string' && e.label.trim()) return e.label.trim();
|
|
9540
9655
|
let t = [];
|
|
9541
9656
|
for (let r of ['endpoint', 'resolution', 'quality', 'mode', 'task', 'component', 'token']) {
|
|
@@ -9547,33 +9662,33 @@ function ya(e) {
|
|
|
9547
9662
|
t.length ? t.join(' \xB7 ') : String(e.id ?? 'default')
|
|
9548
9663
|
);
|
|
9549
9664
|
}
|
|
9550
|
-
function
|
|
9551
|
-
let r =
|
|
9552
|
-
for (let a of
|
|
9553
|
-
let n =
|
|
9665
|
+
function Ka(e, t) {
|
|
9666
|
+
let r = Ma(e);
|
|
9667
|
+
for (let a of Ia) {
|
|
9668
|
+
let n = Je(va(e, a));
|
|
9554
9669
|
if (!n) continue;
|
|
9555
|
-
let s =
|
|
9670
|
+
let s = ze[a] ? ` (${ze[a]})` : '';
|
|
9556
9671
|
t.push(` ${r}${s} ${n}`);
|
|
9557
9672
|
}
|
|
9558
9673
|
}
|
|
9559
|
-
function
|
|
9674
|
+
function Sa(e, t) {
|
|
9560
9675
|
let r = e.quality ? ` quality=${e.quality}` : '';
|
|
9561
9676
|
t.push(
|
|
9562
9677
|
` ${i.bold(e.slug.padEnd(26))} ${i.gray(e.name)} ${i.dim(`${e.kind} ${e.unit} model=${e.model}${r}`)}`,
|
|
9563
9678
|
);
|
|
9564
|
-
for (let n of e.variants ?? [])
|
|
9679
|
+
for (let n of e.variants ?? []) Ka(n, t);
|
|
9565
9680
|
let a = e.addons;
|
|
9566
9681
|
if (Array.isArray(a))
|
|
9567
9682
|
for (let n of a) {
|
|
9568
9683
|
if (!n || typeof n != 'object') continue;
|
|
9569
9684
|
let s = n,
|
|
9570
9685
|
o = typeof s.label == 'string' ? s.label : String(s.id ?? 'add-on'),
|
|
9571
|
-
u =
|
|
9686
|
+
u = Je(s.price);
|
|
9572
9687
|
u && t.push(` ${o} (add-on) ${u}`);
|
|
9573
9688
|
}
|
|
9574
9689
|
t.push('');
|
|
9575
9690
|
}
|
|
9576
|
-
function
|
|
9691
|
+
function Ea(e) {
|
|
9577
9692
|
let t = [],
|
|
9578
9693
|
r = e.board.checked ? ` \xB7 checked ${e.board.checked}` : '';
|
|
9579
9694
|
(t.push(`${i.bold('Tein prices')} ${i.green(e.currency)} ${e.count} models${r}`),
|
|
@@ -9595,7 +9710,7 @@ function wa(e) {
|
|
|
9595
9710
|
});
|
|
9596
9711
|
for (let l of s) {
|
|
9597
9712
|
t.push(`${i.bold(i.cyan(`\u2500\u2500 ${l} \u2500\u2500`))}`);
|
|
9598
|
-
for (let c of a.get(l) ?? [])
|
|
9713
|
+
for (let c of a.get(l) ?? []) Sa(c, t);
|
|
9599
9714
|
}
|
|
9600
9715
|
let o = new Set(e.board.models.map((l) => l.slug.toLowerCase())),
|
|
9601
9716
|
u = (e.configs ?? []).filter((l) => !o.has(String(l.modelSlug ?? '').toLowerCase()));
|
|
@@ -9612,7 +9727,7 @@ function wa(e) {
|
|
|
9612
9727
|
t.push(` ${i.bold(c.padEnd(26))} ${i.gray(d)}`);
|
|
9613
9728
|
for (let m of p) {
|
|
9614
9729
|
let h = String(m.displayLabel ?? m.billingUnit ?? 'price'),
|
|
9615
|
-
f =
|
|
9730
|
+
f = Je(m.prices);
|
|
9616
9731
|
f && t.push(` ${h} ${f}`);
|
|
9617
9732
|
}
|
|
9618
9733
|
t.push('');
|
|
@@ -9625,10 +9740,10 @@ function wa(e) {
|
|
|
9625
9740
|
`
|
|
9626
9741
|
);
|
|
9627
9742
|
}
|
|
9628
|
-
async function
|
|
9743
|
+
async function Wt(e) {
|
|
9629
9744
|
let t;
|
|
9630
9745
|
try {
|
|
9631
|
-
t = await
|
|
9746
|
+
t = await Ta(e.apiUrl, e.model);
|
|
9632
9747
|
} catch (r) {
|
|
9633
9748
|
let a = r instanceof Error ? r.message : String(r);
|
|
9634
9749
|
(process.stderr.write(`${i.red('Error:')} ${a}
|
|
@@ -9639,14 +9754,14 @@ async function Ut(e) {
|
|
|
9639
9754
|
e.json
|
|
9640
9755
|
? `${JSON.stringify(t, null, 2)}
|
|
9641
9756
|
`
|
|
9642
|
-
:
|
|
9757
|
+
: Ea(t),
|
|
9643
9758
|
);
|
|
9644
9759
|
}
|
|
9645
|
-
var
|
|
9760
|
+
var Yt = _(require('node:path'));
|
|
9646
9761
|
A();
|
|
9647
|
-
async function
|
|
9648
|
-
let r =
|
|
9649
|
-
a =
|
|
9762
|
+
async function Xt(e, t) {
|
|
9763
|
+
let r = E(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
9764
|
+
a = I(typeof t.api_url == 'string' ? t.api_url : void 0);
|
|
9650
9765
|
(r ||
|
|
9651
9766
|
(process.stderr.write(`${i.red('Error:')} Authentication required.
|
|
9652
9767
|
`),
|
|
@@ -9739,7 +9854,7 @@ ${i.bold('Outputs:')}
|
|
|
9739
9854
|
) {
|
|
9740
9855
|
let d = new T(`Downloading output to ${o}...`).start();
|
|
9741
9856
|
try {
|
|
9742
|
-
(await u.downloadOutput(p.url,
|
|
9857
|
+
(await u.downloadOutput(p.url, Yt.default.resolve(process.cwd(), o)),
|
|
9743
9858
|
d.succeed(`Saved to ${i.bold(o)}`));
|
|
9744
9859
|
} catch (m) {
|
|
9745
9860
|
d.fail(`Failed to download: ${m instanceof Error ? m.message : m}`);
|
|
@@ -9754,12 +9869,12 @@ ${p.text}
|
|
|
9754
9869
|
process.stdout.write(`
|
|
9755
9870
|
`);
|
|
9756
9871
|
}
|
|
9757
|
-
var
|
|
9758
|
-
|
|
9872
|
+
var We = _(require('node:fs')),
|
|
9873
|
+
Ye = _(require('node:path'));
|
|
9759
9874
|
A();
|
|
9760
|
-
async function
|
|
9761
|
-
let r =
|
|
9762
|
-
a =
|
|
9875
|
+
async function Qt(e, t = {}) {
|
|
9876
|
+
let r = E(typeof t.api_key == 'string' ? t.api_key : void 0),
|
|
9877
|
+
a = I(typeof t.api_url == 'string' ? t.api_url : void 0),
|
|
9763
9878
|
n = !!t.json;
|
|
9764
9879
|
(r ||
|
|
9765
9880
|
(process.stderr.write(`${i.red('Error:')} Authentication required.
|
|
@@ -9774,13 +9889,13 @@ async function jt(e, t = {}) {
|
|
|
9774
9889
|
process.stderr.write(`Usage: ${i.cyan('tein upload <image.png|video.mp4>')}
|
|
9775
9890
|
`),
|
|
9776
9891
|
process.exit(1)));
|
|
9777
|
-
let s =
|
|
9778
|
-
|
|
9892
|
+
let s = Ye.default.resolve(e);
|
|
9893
|
+
We.default.existsSync(s) ||
|
|
9779
9894
|
(process.stderr.write(`${i.red('Error:')} File not found: ${s}
|
|
9780
9895
|
`),
|
|
9781
9896
|
process.exit(1));
|
|
9782
|
-
let o =
|
|
9783
|
-
l =
|
|
9897
|
+
let o = Ye.default.basename(s),
|
|
9898
|
+
l = We.default.readFileSync(s).toString('base64'),
|
|
9784
9899
|
c = new K(r, a),
|
|
9785
9900
|
p = new T(`Uploading ${i.bold(o)} to Tein AI CDN...`);
|
|
9786
9901
|
n || p.start();
|
|
@@ -9821,9 +9936,9 @@ ${i.bold('CDN URL:')} ${i.green(d.url)}
|
|
|
9821
9936
|
process.exit(m ? m.exitCode : v));
|
|
9822
9937
|
}
|
|
9823
9938
|
}
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
function
|
|
9939
|
+
X();
|
|
9940
|
+
Ce();
|
|
9941
|
+
function fr() {
|
|
9827
9942
|
process.stdout.write(`
|
|
9828
9943
|
${i.bold(i.cyan('Tein AI CLI'))} - Official Command-Line Interface for Tein AI models
|
|
9829
9944
|
|
|
@@ -9883,45 +9998,45 @@ ${i.bold('EXAMPLES:')}
|
|
|
9883
9998
|
|
|
9884
9999
|
`);
|
|
9885
10000
|
}
|
|
9886
|
-
async function
|
|
10001
|
+
async function Ja() {
|
|
9887
10002
|
let e = process.argv.slice(2),
|
|
9888
|
-
t =
|
|
10003
|
+
t = jt(e);
|
|
9889
10004
|
if (t.flags.has('help') || t.options.help || t.command === 'help') {
|
|
9890
|
-
|
|
10005
|
+
fr();
|
|
9891
10006
|
return;
|
|
9892
10007
|
}
|
|
9893
10008
|
if (t.flags.has('version') || t.options.version || t.command === 'version') {
|
|
9894
|
-
process.stdout.write(`tein version ${
|
|
10009
|
+
process.stdout.write(`tein version ${te}
|
|
9895
10010
|
`);
|
|
9896
10011
|
return;
|
|
9897
10012
|
}
|
|
9898
10013
|
switch (t.command) {
|
|
9899
10014
|
case 'auth': {
|
|
9900
|
-
await
|
|
10015
|
+
await Z(t.subcommand, t.options.key);
|
|
9901
10016
|
break;
|
|
9902
10017
|
}
|
|
9903
10018
|
case 'login': {
|
|
9904
|
-
await
|
|
10019
|
+
await Z('login', t.options.key);
|
|
9905
10020
|
break;
|
|
9906
10021
|
}
|
|
9907
10022
|
case 'logout': {
|
|
9908
|
-
await
|
|
10023
|
+
await Z('logout');
|
|
9909
10024
|
break;
|
|
9910
10025
|
}
|
|
9911
10026
|
case 'whoami': {
|
|
9912
|
-
await
|
|
10027
|
+
await Z('status');
|
|
9913
10028
|
break;
|
|
9914
10029
|
}
|
|
9915
10030
|
case 'models':
|
|
9916
10031
|
case 'list': {
|
|
9917
|
-
await
|
|
10032
|
+
await zt(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0);
|
|
9918
10033
|
break;
|
|
9919
10034
|
}
|
|
9920
10035
|
case 'pricing':
|
|
9921
10036
|
case 'prices': {
|
|
9922
10037
|
let r = t.options.model,
|
|
9923
10038
|
a = t.subcommand || (typeof r == 'string' ? r : void 0);
|
|
9924
|
-
await
|
|
10039
|
+
await Wt({
|
|
9925
10040
|
model: a,
|
|
9926
10041
|
json: !!t.options.json,
|
|
9927
10042
|
apiUrl: typeof t.options.api_url == 'string' ? t.options.api_url : void 0,
|
|
@@ -9936,48 +10051,48 @@ async function La() {
|
|
|
9936
10051
|
process.stderr.write(`Usage: ${i.cyan('tein info <model-slug>')}
|
|
9937
10052
|
`),
|
|
9938
10053
|
process.exit(1)),
|
|
9939
|
-
await
|
|
10054
|
+
await Jt(t.subcommand, typeof t.options.api_url == 'string' ? t.options.api_url : void 0));
|
|
9940
10055
|
break;
|
|
9941
10056
|
}
|
|
9942
10057
|
case 'upload': {
|
|
9943
10058
|
let r = t.subcommand || '';
|
|
9944
|
-
await
|
|
10059
|
+
await Qt(r, t.options);
|
|
9945
10060
|
break;
|
|
9946
10061
|
}
|
|
9947
10062
|
case 'run':
|
|
9948
10063
|
case 'generate': {
|
|
9949
10064
|
let r = t.subcommand || '';
|
|
9950
|
-
await
|
|
10065
|
+
await je(r, t.options);
|
|
9951
10066
|
break;
|
|
9952
10067
|
}
|
|
9953
10068
|
case 'status': {
|
|
9954
10069
|
let r = t.subcommand || '';
|
|
9955
|
-
await
|
|
10070
|
+
await Xt(r, t.options);
|
|
9956
10071
|
break;
|
|
9957
10072
|
}
|
|
9958
10073
|
case 'mcp': {
|
|
9959
|
-
let { startStdioServer: r } = await Promise.resolve().then(() => (
|
|
10074
|
+
let { startStdioServer: r } = await Promise.resolve().then(() => (mr(), ur));
|
|
9960
10075
|
await r();
|
|
9961
10076
|
break;
|
|
9962
10077
|
}
|
|
9963
10078
|
default: {
|
|
9964
10079
|
if (t.command && !t.command.startsWith('-')) {
|
|
9965
|
-
(!
|
|
9966
|
-
!
|
|
10080
|
+
(!B(t.command) &&
|
|
10081
|
+
!ce[t.command] &&
|
|
9967
10082
|
(process.stderr.write(`
|
|
9968
10083
|
${i.red('Error:')} Unknown command or model "${t.command}".
|
|
9969
10084
|
Run ${i.cyan('tein --help')} for the commands, or ${i.cyan('tein models')} for the model slugs.
|
|
9970
10085
|
`),
|
|
9971
10086
|
process.exit(v)),
|
|
9972
|
-
await
|
|
10087
|
+
await je(t.command, t.options));
|
|
9973
10088
|
return;
|
|
9974
10089
|
}
|
|
9975
|
-
|
|
10090
|
+
fr();
|
|
9976
10091
|
break;
|
|
9977
10092
|
}
|
|
9978
10093
|
}
|
|
9979
10094
|
}
|
|
9980
|
-
|
|
10095
|
+
Ja().catch((e) => {
|
|
9981
10096
|
(e instanceof w &&
|
|
9982
10097
|
(process.stderr.write(`
|
|
9983
10098
|
${i.red('Error:')} ${S(e).join(`
|