@teinai/cli 1.1.35 → 1.1.36
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 +131 -107
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -6637,11 +6637,11 @@ function Bt(e, t, i) {
|
|
|
6637
6637
|
var Vt,
|
|
6638
6638
|
ua,
|
|
6639
6639
|
Nt,
|
|
6640
|
-
|
|
6640
|
+
kn,
|
|
6641
6641
|
ma,
|
|
6642
6642
|
Ut,
|
|
6643
6643
|
Ve,
|
|
6644
|
-
|
|
6644
|
+
wn,
|
|
6645
6645
|
Ne,
|
|
6646
6646
|
fa,
|
|
6647
6647
|
ga,
|
|
@@ -6796,7 +6796,7 @@ var Vt,
|
|
|
6796
6796
|
seed: !0,
|
|
6797
6797
|
},
|
|
6798
6798
|
]),
|
|
6799
|
-
(
|
|
6799
|
+
(kn = Nt.map((e) => e.slug)),
|
|
6800
6800
|
(ma = new Map(Nt.map((e) => [e.slug, e]))));
|
|
6801
6801
|
((Ut = 'EXAVITQu4vr4xnSDxMaL'),
|
|
6802
6802
|
(Ve = {
|
|
@@ -6821,7 +6821,7 @@ var Vt,
|
|
|
6821
6821
|
pqHfZKP75CvOlQylNhV4: 'Bill',
|
|
6822
6822
|
pNInz6obpgDQGcFmaJgB: 'Adam',
|
|
6823
6823
|
}),
|
|
6824
|
-
(
|
|
6824
|
+
(wn = Object.keys(Ve)),
|
|
6825
6825
|
(Ne = [
|
|
6826
6826
|
'mp3_44100_128',
|
|
6827
6827
|
'mp3_22050_32',
|
|
@@ -7066,20 +7066,20 @@ var he,
|
|
|
7066
7066
|
Ht,
|
|
7067
7067
|
Y,
|
|
7068
7068
|
zt,
|
|
7069
|
-
Pn,
|
|
7070
7069
|
In,
|
|
7071
7070
|
vn,
|
|
7072
7071
|
Tn,
|
|
7072
|
+
Mn,
|
|
7073
7073
|
Jt = h(() => {
|
|
7074
7074
|
'use strict';
|
|
7075
7075
|
((he = 'enhancor-ultrafine'),
|
|
7076
7076
|
(Ht = 'Enhancor Ultrafine'),
|
|
7077
7077
|
(Y = { skin: [2, 3, 4], noSkin: [2, 3, 4, 8, 16] }),
|
|
7078
7078
|
(zt = 2),
|
|
7079
|
-
(
|
|
7080
|
-
(
|
|
7081
|
-
(
|
|
7082
|
-
(
|
|
7079
|
+
(In = 24 * 1024 * 1024),
|
|
7080
|
+
(vn = 4096 * 4096),
|
|
7081
|
+
(Tn = 30 * 6e4),
|
|
7082
|
+
(Mn = 120 * 6e4));
|
|
7083
7083
|
});
|
|
7084
7084
|
var X,
|
|
7085
7085
|
ye,
|
|
@@ -8001,6 +8001,29 @@ function Ba(e) {
|
|
|
8001
8001
|
}
|
|
8002
8002
|
}
|
|
8003
8003
|
function Ga() {
|
|
8004
|
+
let e = (t, i) => ({
|
|
8005
|
+
name: t,
|
|
8006
|
+
type: 'slider',
|
|
8007
|
+
default: 50,
|
|
8008
|
+
min: 0,
|
|
8009
|
+
max: 100,
|
|
8010
|
+
step: 1,
|
|
8011
|
+
description: `${i} 0 to 100. 50 is the default look.`,
|
|
8012
|
+
});
|
|
8013
|
+
return [
|
|
8014
|
+
e('skin_strength', 'Strength: how much the skin is repainted. Only with skin_fix on.'),
|
|
8015
|
+
e('skin_texture', 'Texture: how much fine pore detail is added. Only with skin_fix on.'),
|
|
8016
|
+
e(
|
|
8017
|
+
'grain',
|
|
8018
|
+
'Grain: fine noise over the photo. Works in Fast and Full, with or without skin_fix.',
|
|
8019
|
+
),
|
|
8020
|
+
e(
|
|
8021
|
+
'sharpness',
|
|
8022
|
+
'Sharpness: how crisp the edges are. Works in Fast and Full, with or without skin_fix.',
|
|
8023
|
+
),
|
|
8024
|
+
];
|
|
8025
|
+
}
|
|
8026
|
+
function Ha() {
|
|
8004
8027
|
return {
|
|
8005
8028
|
slug: he,
|
|
8006
8029
|
name: Ht,
|
|
@@ -8041,6 +8064,7 @@ function Ga() {
|
|
|
8041
8064
|
options: Y.noSkin.map(String),
|
|
8042
8065
|
description: `Full only. ${Y.skin.join(', ')} with skin_fix on; also ${Y.noSkin.filter((e) => !Y.skin.includes(e)).join(' and ')} with it off. The output is at most 48 megapixels.`,
|
|
8043
8066
|
},
|
|
8067
|
+
...Ga(),
|
|
8044
8068
|
],
|
|
8045
8069
|
};
|
|
8046
8070
|
}
|
|
@@ -8058,7 +8082,7 @@ function ze(e, t = e.api.model) {
|
|
|
8058
8082
|
parameters: Ma(e, Ba(e)),
|
|
8059
8083
|
};
|
|
8060
8084
|
}
|
|
8061
|
-
function
|
|
8085
|
+
function za() {
|
|
8062
8086
|
let e = {};
|
|
8063
8087
|
for (let t of ue())
|
|
8064
8088
|
if (t.slug !== 'seedance-2-fast') {
|
|
@@ -8074,7 +8098,7 @@ function Ha() {
|
|
|
8074
8098
|
}
|
|
8075
8099
|
t.slug.startsWith('claude-') || (e[t.api.model] = ze(t));
|
|
8076
8100
|
}
|
|
8077
|
-
(Object.assign(e, Lt()), (e[he] =
|
|
8101
|
+
(Object.assign(e, Lt()), (e[he] = Ha()));
|
|
8078
8102
|
for (let [t, i] of Object.entries(fe))
|
|
8079
8103
|
e[i] && Object.defineProperty(e, t, { value: e[i], enumerable: !1 });
|
|
8080
8104
|
return e;
|
|
@@ -8085,7 +8109,7 @@ function we(e) {
|
|
|
8085
8109
|
function H(e) {
|
|
8086
8110
|
return ke[e] ?? null;
|
|
8087
8111
|
}
|
|
8088
|
-
function
|
|
8112
|
+
function Ja(e, t, i) {
|
|
8089
8113
|
if (e.startsWith('enhancor-skin-fix-') || e === he) return !1;
|
|
8090
8114
|
if ((e === 'seedance-2-5' || e === 'seedance-2-5-lite' || ii(e)) && t === 'duration') {
|
|
8091
8115
|
let n = (s) => (typeof s == 'string' ? s.trim().toLowerCase() : '');
|
|
@@ -8119,13 +8143,13 @@ function ni(e, t) {
|
|
|
8119
8143
|
let i = { ...t };
|
|
8120
8144
|
if (e?.slug === 'seedance-2-5') {
|
|
8121
8145
|
let a = (n) => typeof n != 'string' || !n.trim();
|
|
8122
|
-
for (let n of
|
|
8146
|
+
for (let n of Wa) (a(i.finalize) && !a(i[n]) && (i.finalize = i[n]), delete i[n]);
|
|
8123
8147
|
if (!a(i.finalize)) return i;
|
|
8124
8148
|
}
|
|
8125
8149
|
for (let a of e?.parameters ?? [])
|
|
8126
8150
|
a.default !== void 0 &&
|
|
8127
8151
|
i[a.name] === void 0 &&
|
|
8128
|
-
|
|
8152
|
+
Ja(e.slug, a.name, t) &&
|
|
8129
8153
|
(i[a.name] = a.default);
|
|
8130
8154
|
return i;
|
|
8131
8155
|
}
|
|
@@ -8156,7 +8180,7 @@ var _a,
|
|
|
8156
8180
|
Yt,
|
|
8157
8181
|
ja,
|
|
8158
8182
|
ke,
|
|
8159
|
-
|
|
8183
|
+
Wa,
|
|
8160
8184
|
ee = h(() => {
|
|
8161
8185
|
'use strict';
|
|
8162
8186
|
bt();
|
|
@@ -8700,8 +8724,8 @@ var _a,
|
|
|
8700
8724
|
'Keeps real faces in reference images. On by default. Send false to turn it off.',
|
|
8701
8725
|
},
|
|
8702
8726
|
]));
|
|
8703
|
-
ke =
|
|
8704
|
-
|
|
8727
|
+
ke = za();
|
|
8728
|
+
Wa = ['draft_task_id', 'draft_generation_id'];
|
|
8705
8729
|
});
|
|
8706
8730
|
function xe(e) {
|
|
8707
8731
|
let t = '/v1/pricing/models',
|
|
@@ -8726,14 +8750,14 @@ function Ii(e) {
|
|
|
8726
8750
|
'The Acceptable Use Policy applies.',
|
|
8727
8751
|
].join(' ');
|
|
8728
8752
|
}
|
|
8729
|
-
function
|
|
8730
|
-
if (
|
|
8753
|
+
function vr(e) {
|
|
8754
|
+
if (wr.has(e.name)) return e;
|
|
8731
8755
|
let t = e.inputSchema.properties;
|
|
8732
8756
|
return !t || t.callback_url
|
|
8733
8757
|
? e
|
|
8734
|
-
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url:
|
|
8758
|
+
: { ...e, inputSchema: { ...e.inputSchema, properties: { ...t, callback_url: kr } } };
|
|
8735
8759
|
}
|
|
8736
|
-
function
|
|
8760
|
+
function Tr(e) {
|
|
8737
8761
|
let t = e.inputSchema.properties;
|
|
8738
8762
|
if (!t) return e;
|
|
8739
8763
|
let i = !1,
|
|
@@ -8746,7 +8770,7 @@ function vr(e) {
|
|
|
8746
8770
|
: (a[n] = s);
|
|
8747
8771
|
return i ? { ...e, inputSchema: { ...e.inputSchema, properties: a } } : e;
|
|
8748
8772
|
}
|
|
8749
|
-
function
|
|
8773
|
+
function Mr(e) {
|
|
8750
8774
|
switch (e.type) {
|
|
8751
8775
|
case 'string':
|
|
8752
8776
|
return {
|
|
@@ -8801,11 +8825,11 @@ function Tr(e) {
|
|
|
8801
8825
|
return { type: 'string', description: e.description };
|
|
8802
8826
|
}
|
|
8803
8827
|
}
|
|
8804
|
-
function
|
|
8828
|
+
function Kr(e, t) {
|
|
8805
8829
|
let i = t || e.slug.replace(/[^a-zA-Z0-9_-]/g, '_'),
|
|
8806
8830
|
a = {},
|
|
8807
8831
|
n = [];
|
|
8808
|
-
for (let o of e.parameters) ((a[o.name] =
|
|
8832
|
+
for (let o of e.parameters) ((a[o.name] = Mr(o)), o.required && n.push(o.name));
|
|
8809
8833
|
let s = {
|
|
8810
8834
|
type: 'object',
|
|
8811
8835
|
properties: a,
|
|
@@ -8818,7 +8842,7 @@ function Mr(e, t) {
|
|
|
8818
8842
|
inputSchema: s,
|
|
8819
8843
|
};
|
|
8820
8844
|
}
|
|
8821
|
-
function
|
|
8845
|
+
function Sr() {
|
|
8822
8846
|
let e = D().filter((p) => p.category === 'Image' && !we(p)),
|
|
8823
8847
|
t = D().filter((p) => p.category === 'Video'),
|
|
8824
8848
|
i = D().filter((p) => p.category === 'Text'),
|
|
@@ -9082,10 +9106,10 @@ function Kr() {
|
|
|
9082
9106
|
additionalProperties: !0,
|
|
9083
9107
|
},
|
|
9084
9108
|
},
|
|
9085
|
-
d =
|
|
9086
|
-
return [n, s, o, u, l, d, c,
|
|
9109
|
+
d = Cr();
|
|
9110
|
+
return [n, s, o, u, l, d, c, xr, ...Ti];
|
|
9087
9111
|
}
|
|
9088
|
-
function
|
|
9112
|
+
function Cr() {
|
|
9089
9113
|
return {
|
|
9090
9114
|
name: 'upload_asset',
|
|
9091
9115
|
description:
|
|
@@ -9133,30 +9157,30 @@ function Sr() {
|
|
|
9133
9157
|
};
|
|
9134
9158
|
}
|
|
9135
9159
|
function st() {
|
|
9136
|
-
let e =
|
|
9137
|
-
t = D().map((i) =>
|
|
9138
|
-
return [...e, ...t].map(
|
|
9160
|
+
let e = Sr(),
|
|
9161
|
+
t = D().map((i) => Kr(i));
|
|
9162
|
+
return [...e, ...t].map(vr).map(Tr);
|
|
9139
9163
|
}
|
|
9140
|
-
var
|
|
9141
|
-
kr,
|
|
9164
|
+
var kr,
|
|
9142
9165
|
wr,
|
|
9143
9166
|
xr,
|
|
9144
9167
|
_r,
|
|
9145
9168
|
Pr,
|
|
9169
|
+
Ir,
|
|
9146
9170
|
Ti,
|
|
9147
|
-
|
|
9171
|
+
$s,
|
|
9148
9172
|
vi,
|
|
9149
9173
|
Mi = h(() => {
|
|
9150
9174
|
'use strict';
|
|
9151
9175
|
G();
|
|
9152
9176
|
Fe();
|
|
9153
9177
|
ee();
|
|
9154
|
-
((
|
|
9178
|
+
((kr = {
|
|
9155
9179
|
type: 'string',
|
|
9156
9180
|
description:
|
|
9157
9181
|
'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.',
|
|
9158
9182
|
}),
|
|
9159
|
-
(
|
|
9183
|
+
(wr = new Set([
|
|
9160
9184
|
'upload_asset',
|
|
9161
9185
|
'upload_media',
|
|
9162
9186
|
'upload_image',
|
|
@@ -9167,7 +9191,7 @@ var br,
|
|
|
9167
9191
|
'get_usage',
|
|
9168
9192
|
'get_balance_history',
|
|
9169
9193
|
])),
|
|
9170
|
-
(
|
|
9194
|
+
(xr = {
|
|
9171
9195
|
name: 'get_pricing',
|
|
9172
9196
|
description:
|
|
9173
9197
|
'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.',
|
|
@@ -9182,13 +9206,13 @@ var br,
|
|
|
9182
9206
|
additionalProperties: !1,
|
|
9183
9207
|
},
|
|
9184
9208
|
}),
|
|
9185
|
-
(
|
|
9209
|
+
(_r = {
|
|
9186
9210
|
name: 'get_balance',
|
|
9187
9211
|
description:
|
|
9188
9212
|
"Your Tein workspace's balance right now, what this API key can still spend (the balance, or less when the key has its own spending limit), credits on hold, and the workspace's usage this month and in the last 30 days from every channel (website, API, MCP, CLI, workflows). Use it before a run to check the balance covers it, or to show the balance in an app. Nothing runs and nothing is charged. The same payload as GET /v1/balance.",
|
|
9189
9213
|
inputSchema: { type: 'object', properties: {}, additionalProperties: !1 },
|
|
9190
9214
|
}),
|
|
9191
|
-
(
|
|
9215
|
+
(Pr = {
|
|
9192
9216
|
name: 'get_usage',
|
|
9193
9217
|
description:
|
|
9194
9218
|
"Your Tein workspace's usage in detail, the same numbers as the dashboard's Usage page: total spend and requests (succeeded, failed, running), this API key's own share, and breakdowns by model, by channel (website, api, mcp, cli), by API key, and over time. Covers every run of the workspace, wherever it was started. Nothing runs and nothing is charged. The same payload as GET /v1/usage.",
|
|
@@ -9219,7 +9243,7 @@ var br,
|
|
|
9219
9243
|
additionalProperties: !1,
|
|
9220
9244
|
},
|
|
9221
9245
|
}),
|
|
9222
|
-
(
|
|
9246
|
+
(Ir = {
|
|
9223
9247
|
name: 'get_balance_history',
|
|
9224
9248
|
description:
|
|
9225
9249
|
"Your Tein balance's history, newest first, the same list as the Billing page: top ups, each run's charge (with its job_id and model), refunds, credits from Tein and adjustments, each with the balance after it. Nothing runs and nothing is charged. The same payload as GET /v1/balance/transactions.",
|
|
@@ -9237,8 +9261,8 @@ var br,
|
|
|
9237
9261
|
additionalProperties: !1,
|
|
9238
9262
|
},
|
|
9239
9263
|
}),
|
|
9240
|
-
(Ti = [
|
|
9241
|
-
(
|
|
9264
|
+
(Ti = [_r, Pr, Ir]),
|
|
9265
|
+
($s = new Set(Ti.map((e) => e.name))));
|
|
9242
9266
|
vi = new Set([
|
|
9243
9267
|
'image',
|
|
9244
9268
|
'images',
|
|
@@ -9258,12 +9282,12 @@ var br,
|
|
|
9258
9282
|
});
|
|
9259
9283
|
var Li = {};
|
|
9260
9284
|
Gi(Li, {
|
|
9261
|
-
forgetToolSchemas: () =>
|
|
9285
|
+
forgetToolSchemas: () => Or,
|
|
9262
9286
|
jsonRpcAnswer: () => $i,
|
|
9263
9287
|
preprocessLocalFiles: () => Oi,
|
|
9264
9288
|
startStdioServer: () => Ri,
|
|
9265
9289
|
});
|
|
9266
|
-
function
|
|
9290
|
+
function $r(e) {
|
|
9267
9291
|
let t = (i) =>
|
|
9268
9292
|
!!i && typeof i == 'object' && i.jsonrpc === '2.0' && ('result' in i || 'error' in i);
|
|
9269
9293
|
return Array.isArray(e) ? e.length > 0 && e.every(t) : t(e);
|
|
@@ -9277,7 +9301,7 @@ function $i(e, t, i) {
|
|
|
9277
9301
|
} catch {
|
|
9278
9302
|
s = null;
|
|
9279
9303
|
}
|
|
9280
|
-
if (s !== null &&
|
|
9304
|
+
if (s !== null && $r(s)) return n ? null : s;
|
|
9281
9305
|
if (n) return null;
|
|
9282
9306
|
if (!i && t >= 200 && t < 300) return;
|
|
9283
9307
|
let o = s?.error,
|
|
@@ -9298,7 +9322,7 @@ function $i(e, t, i) {
|
|
|
9298
9322
|
},
|
|
9299
9323
|
};
|
|
9300
9324
|
}
|
|
9301
|
-
function
|
|
9325
|
+
function Er() {
|
|
9302
9326
|
let e = process.argv.slice(2),
|
|
9303
9327
|
t = e.indexOf('--api-key');
|
|
9304
9328
|
return S(t >= 0 ? e[t + 1] : void 0);
|
|
@@ -9333,14 +9357,14 @@ async function Ei(e, t, i) {
|
|
|
9333
9357
|
};
|
|
9334
9358
|
}
|
|
9335
9359
|
function Ai(e) {
|
|
9336
|
-
return
|
|
9360
|
+
return Ar.has(z.default.extname(e).toLowerCase());
|
|
9337
9361
|
}
|
|
9338
9362
|
function qi(e) {
|
|
9339
9363
|
return new Error(
|
|
9340
9364
|
`Tein uploads image, video and audio files only, and ${z.default.basename(e)} is not one.`,
|
|
9341
9365
|
);
|
|
9342
9366
|
}
|
|
9343
|
-
function
|
|
9367
|
+
function qr(e) {
|
|
9344
9368
|
let t = e.trim();
|
|
9345
9369
|
if (
|
|
9346
9370
|
!t ||
|
|
@@ -9363,10 +9387,10 @@ function lt(e) {
|
|
|
9363
9387
|
ae.set(i.name, i.inputSchema);
|
|
9364
9388
|
}
|
|
9365
9389
|
}
|
|
9366
|
-
function
|
|
9390
|
+
function Or() {
|
|
9367
9391
|
(ae.clear(), (ot = 0));
|
|
9368
9392
|
}
|
|
9369
|
-
async function
|
|
9393
|
+
async function Rr(e, t) {
|
|
9370
9394
|
if (!(Date.now() - ot < 6e4)) {
|
|
9371
9395
|
ot = Date.now();
|
|
9372
9396
|
try {
|
|
@@ -9382,7 +9406,7 @@ async function Or(e, t) {
|
|
|
9382
9406
|
} catch {}
|
|
9383
9407
|
}
|
|
9384
9408
|
}
|
|
9385
|
-
function
|
|
9409
|
+
function Lr(e) {
|
|
9386
9410
|
return e
|
|
9387
9411
|
? e.type === 'string'
|
|
9388
9412
|
? e.format === 'uri'
|
|
@@ -9391,18 +9415,18 @@ function Rr(e) {
|
|
|
9391
9415
|
}
|
|
9392
9416
|
async function Ki(e, t, i) {
|
|
9393
9417
|
if (typeof e != 'string') return e;
|
|
9394
|
-
let a =
|
|
9418
|
+
let a = qr(e);
|
|
9395
9419
|
if (!a) return e;
|
|
9396
9420
|
if (!Ai(a)) throw qi(a);
|
|
9397
9421
|
return (await Ei(a, t, i)).url;
|
|
9398
9422
|
}
|
|
9399
9423
|
async function Oi(e, t, i, a, n) {
|
|
9400
|
-
(ae.size === 0 && lt(st()), ae.has(e) || (await
|
|
9424
|
+
(ae.size === 0 && lt(st()), ae.has(e) || (await Rr(n, i)));
|
|
9401
9425
|
let s = ae.get(e)?.properties;
|
|
9402
9426
|
if (!s) return t;
|
|
9403
9427
|
let o = { ...t };
|
|
9404
9428
|
for (let [u, l] of Object.entries(t))
|
|
9405
|
-
if (
|
|
9429
|
+
if (Lr(s[u]))
|
|
9406
9430
|
if (Array.isArray(l)) {
|
|
9407
9431
|
let c = [];
|
|
9408
9432
|
for (let d of l) c.push(await Ki(d, i, a));
|
|
@@ -9410,7 +9434,7 @@ async function Oi(e, t, i, a, n) {
|
|
|
9410
9434
|
} else o[u] = await Ki(l, i, a);
|
|
9411
9435
|
return o;
|
|
9412
9436
|
}
|
|
9413
|
-
function
|
|
9437
|
+
function Dr(e) {
|
|
9414
9438
|
let t = e.id ?? null;
|
|
9415
9439
|
switch (e.method) {
|
|
9416
9440
|
case 'initialize':
|
|
@@ -9454,7 +9478,7 @@ function Lr(e) {
|
|
|
9454
9478
|
async function Ri() {
|
|
9455
9479
|
if (Si) return;
|
|
9456
9480
|
Si = !0;
|
|
9457
|
-
let e =
|
|
9481
|
+
let e = Er(),
|
|
9458
9482
|
t = w(),
|
|
9459
9483
|
i = process.env.TEIN_MCP_URL || 'https://mcp.tein.ai/mcp';
|
|
9460
9484
|
(Ci.default
|
|
@@ -9618,7 +9642,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9618
9642
|
return;
|
|
9619
9643
|
}
|
|
9620
9644
|
} catch {}
|
|
9621
|
-
let u =
|
|
9645
|
+
let u = Dr(o);
|
|
9622
9646
|
u !== null &&
|
|
9623
9647
|
process.stdout.write(
|
|
9624
9648
|
JSON.stringify(u) +
|
|
@@ -9644,7 +9668,7 @@ Pass this URL to any Tein generation tool.`,
|
|
|
9644
9668
|
var V,
|
|
9645
9669
|
z,
|
|
9646
9670
|
Ci,
|
|
9647
|
-
|
|
9671
|
+
Ar,
|
|
9648
9672
|
ae,
|
|
9649
9673
|
ot,
|
|
9650
9674
|
Si,
|
|
@@ -9657,7 +9681,7 @@ var V,
|
|
|
9657
9681
|
Mi();
|
|
9658
9682
|
E();
|
|
9659
9683
|
re();
|
|
9660
|
-
|
|
9684
|
+
Ar = new Set([
|
|
9661
9685
|
'.png',
|
|
9662
9686
|
'.jpg',
|
|
9663
9687
|
'.jpeg',
|
|
@@ -9950,28 +9974,28 @@ function Se(e) {
|
|
|
9950
9974
|
}
|
|
9951
9975
|
ee();
|
|
9952
9976
|
var si = ['images', 'input_images', 'videos', 'audios'];
|
|
9953
|
-
function
|
|
9977
|
+
function Ya(e) {
|
|
9954
9978
|
for (let t of si) typeof e[t] == 'string' && (e[t] = [e[t]]);
|
|
9955
9979
|
}
|
|
9956
|
-
function
|
|
9980
|
+
function Xa(e) {
|
|
9957
9981
|
if (e.startsWith('http://') || e.startsWith('https://')) return null;
|
|
9958
9982
|
let t = q.default.resolve(e);
|
|
9959
9983
|
return U.default.existsSync(t) && U.default.statSync(t).isFile() ? t : null;
|
|
9960
9984
|
}
|
|
9961
|
-
async function
|
|
9985
|
+
async function Qa(e, t) {
|
|
9962
9986
|
for (let i of si) {
|
|
9963
9987
|
if (!Array.isArray(e[i])) continue;
|
|
9964
9988
|
let a = [];
|
|
9965
9989
|
for (let n of e[i]) {
|
|
9966
9990
|
if (typeof n != 'string') continue;
|
|
9967
|
-
let s =
|
|
9991
|
+
let s = Xa(n);
|
|
9968
9992
|
a.push(s ? await t(s) : n);
|
|
9969
9993
|
}
|
|
9970
9994
|
e[i] = a;
|
|
9971
9995
|
}
|
|
9972
9996
|
}
|
|
9973
9997
|
var te = { starter: 10, plus: 25, scale: 40, enterprise: 200 };
|
|
9974
|
-
function
|
|
9998
|
+
function Za(e) {
|
|
9975
9999
|
if (e.count === void 0 || e.count === !0) return 1;
|
|
9976
10000
|
let t = typeof e.count == 'number' ? e.count : Number(e.count),
|
|
9977
10001
|
i = te.enterprise;
|
|
@@ -9984,7 +10008,7 @@ function Qa(e) {
|
|
|
9984
10008
|
t
|
|
9985
10009
|
);
|
|
9986
10010
|
}
|
|
9987
|
-
async function
|
|
10011
|
+
async function er(e, t, i, a, n) {
|
|
9988
10012
|
n.isJson ||
|
|
9989
10013
|
process.stderr.write(`Starting ${a} ${t} jobs together...
|
|
9990
10014
|
`);
|
|
@@ -10059,7 +10083,7 @@ async function Za(e, t, i, a, n) {
|
|
|
10059
10083
|
o.some((l) => l.status === 'failed' || l.status === 'expired' || l.status === 'cancelled')) &&
|
|
10060
10084
|
process.exit(v);
|
|
10061
10085
|
}
|
|
10062
|
-
function
|
|
10086
|
+
function tr(e, t, i) {
|
|
10063
10087
|
if (i <= 1) return e;
|
|
10064
10088
|
let a = q.default.extname(e);
|
|
10065
10089
|
return `${e.slice(0, e.length - a.length)}-${t + 1}${a}`;
|
|
@@ -10131,7 +10155,7 @@ async function Qe(e, t) {
|
|
|
10131
10155
|
s = !!t.json,
|
|
10132
10156
|
o = !!(t.async || t.no_wait),
|
|
10133
10157
|
u = typeof t.output == 'string' ? t.output : void 0,
|
|
10134
|
-
l =
|
|
10158
|
+
l = Za(t),
|
|
10135
10159
|
c = { ...t };
|
|
10136
10160
|
(delete c.json,
|
|
10137
10161
|
delete c.async,
|
|
@@ -10141,7 +10165,7 @@ async function Qe(e, t) {
|
|
|
10141
10165
|
delete c.api_url,
|
|
10142
10166
|
delete c.count);
|
|
10143
10167
|
let d = ni(n, c);
|
|
10144
|
-
(
|
|
10168
|
+
(Ya(d),
|
|
10145
10169
|
typeof d.image == 'string' && !d.images && !we(n) && ((d.images = [d.image]), delete d.image),
|
|
10146
10170
|
d.image_url &&
|
|
10147
10171
|
!d.first_frame_image &&
|
|
@@ -10184,7 +10208,7 @@ async function Qe(e, t) {
|
|
|
10184
10208
|
}
|
|
10185
10209
|
}
|
|
10186
10210
|
}
|
|
10187
|
-
await
|
|
10211
|
+
await Qa(d, async (k) => {
|
|
10188
10212
|
let g = new $(`Uploading local file ${q.default.basename(k)} to CDN...`);
|
|
10189
10213
|
s || g.start();
|
|
10190
10214
|
try {
|
|
@@ -10208,7 +10232,7 @@ async function Qe(e, t) {
|
|
|
10208
10232
|
let f;
|
|
10209
10233
|
try {
|
|
10210
10234
|
if (l > 1) {
|
|
10211
|
-
await
|
|
10235
|
+
await er(p, e, d, l, { isJson: s, isAsync: o });
|
|
10212
10236
|
return;
|
|
10213
10237
|
}
|
|
10214
10238
|
f = await p.queueJob(e, d);
|
|
@@ -10311,7 +10335,7 @@ ${r.bold('Outputs:')}
|
|
|
10311
10335
|
`),
|
|
10312
10336
|
u)
|
|
10313
10337
|
) {
|
|
10314
|
-
let O =
|
|
10338
|
+
let O = tr(u, g++, k),
|
|
10315
10339
|
dt = new $(`Downloading output to ${O}...`).start();
|
|
10316
10340
|
try {
|
|
10317
10341
|
(await p.downloadOutput(I.url, q.default.resolve(process.cwd(), O)),
|
|
@@ -10332,7 +10356,7 @@ ${I.text}
|
|
|
10332
10356
|
}
|
|
10333
10357
|
var li = T(require('node:readline'));
|
|
10334
10358
|
E();
|
|
10335
|
-
async function
|
|
10359
|
+
async function ir(e) {
|
|
10336
10360
|
try {
|
|
10337
10361
|
return (await new M(e, w()).checkKey(), 'ok');
|
|
10338
10362
|
} catch (t) {
|
|
@@ -10343,7 +10367,7 @@ async function tr(e) {
|
|
|
10343
10367
|
return 'unchecked';
|
|
10344
10368
|
}
|
|
10345
10369
|
}
|
|
10346
|
-
function
|
|
10370
|
+
function ar(e) {
|
|
10347
10371
|
let t = li.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
10348
10372
|
return new Promise((i) => {
|
|
10349
10373
|
t.question(e, (a) => {
|
|
@@ -10363,14 +10387,14 @@ ${r.bold('Tein AI Authentication')}
|
|
|
10363
10387
|
process.stdout.write(`Get your API key at: ${r.cyan('https://tein.ai/dashboard/keys')}
|
|
10364
10388
|
|
|
10365
10389
|
`),
|
|
10366
|
-
(i = await
|
|
10390
|
+
(i = await ar('Enter your Tein API Key (sk_live_...): '))),
|
|
10367
10391
|
!i.startsWith('sk_live_') &&
|
|
10368
10392
|
!i.startsWith('sk_test_') &&
|
|
10369
10393
|
(process.stderr
|
|
10370
10394
|
.write(`${r.red('Error:')} Invalid key format. Tein API keys start with 'sk_live_' or 'sk_test_'.
|
|
10371
10395
|
`),
|
|
10372
10396
|
process.exit(1)));
|
|
10373
|
-
let a = await
|
|
10397
|
+
let a = await ir(i);
|
|
10374
10398
|
(a === 'invalid' &&
|
|
10375
10399
|
(process.stderr
|
|
10376
10400
|
.write(`${r.red('Error:')} Tein did not accept this key. Copy it again from ${r.cyan('https://tein.ai/dashboard/keys')}. Nothing was saved.
|
|
@@ -10448,7 +10472,7 @@ function _(e) {
|
|
|
10448
10472
|
function di(e) {
|
|
10449
10473
|
return `${e} ${e === 1 ? 'request' : 'requests'}`;
|
|
10450
10474
|
}
|
|
10451
|
-
function
|
|
10475
|
+
function rr(e) {
|
|
10452
10476
|
let t = [
|
|
10453
10477
|
['Balance', _(e.balance)],
|
|
10454
10478
|
['Available to this key', _(e.available)],
|
|
@@ -10526,7 +10550,7 @@ async function pi(e) {
|
|
|
10526
10550
|
}
|
|
10527
10551
|
process.stdout.write(`
|
|
10528
10552
|
${r.bold('Tein balance')}
|
|
10529
|
-
${
|
|
10553
|
+
${rr(n).join(`
|
|
10530
10554
|
`)}
|
|
10531
10555
|
|
|
10532
10556
|
`);
|
|
@@ -10589,7 +10613,7 @@ function Ze(e) {
|
|
|
10589
10613
|
.trimEnd()}`,
|
|
10590
10614
|
);
|
|
10591
10615
|
}
|
|
10592
|
-
function
|
|
10616
|
+
function nr(e) {
|
|
10593
10617
|
let t = e.summary,
|
|
10594
10618
|
i = [
|
|
10595
10619
|
` Window ${e.from.slice(0, 10)} to ${e.to.slice(0, 10)} (${e.range})${e.filters.model ? `, model ${e.filters.model}` : ''}${e.filters.channel ? `, channel ${e.filters.channel}` : ''}`,
|
|
@@ -10631,12 +10655,12 @@ async function fi(e) {
|
|
|
10631
10655
|
}
|
|
10632
10656
|
process.stdout.write(`
|
|
10633
10657
|
${r.bold('Tein usage')}
|
|
10634
|
-
${
|
|
10658
|
+
${nr(a).join(`
|
|
10635
10659
|
`)}
|
|
10636
10660
|
|
|
10637
10661
|
`);
|
|
10638
10662
|
}
|
|
10639
|
-
function
|
|
10663
|
+
function sr(e) {
|
|
10640
10664
|
return e.data.length
|
|
10641
10665
|
? Ze([
|
|
10642
10666
|
['When (UTC)', 'Amount', 'Balance after', 'What'],
|
|
@@ -10668,7 +10692,7 @@ async function gi(e) {
|
|
|
10668
10692
|
: '';
|
|
10669
10693
|
process.stdout.write(`
|
|
10670
10694
|
${r.bold('Tein balance history')}
|
|
10671
|
-
${
|
|
10695
|
+
${sr(a).join(`
|
|
10672
10696
|
`)}${n}
|
|
10673
10697
|
|
|
10674
10698
|
`);
|
|
@@ -10676,10 +10700,10 @@ ${nr(a).join(`
|
|
|
10676
10700
|
E();
|
|
10677
10701
|
Ce();
|
|
10678
10702
|
ee();
|
|
10679
|
-
var
|
|
10703
|
+
var or = 3e3;
|
|
10680
10704
|
async function hi(e) {
|
|
10681
10705
|
try {
|
|
10682
|
-
let t = await fetch(`${w(e)}/v1/pricing`, { signal: AbortSignal.timeout(
|
|
10706
|
+
let t = await fetch(`${w(e)}/v1/pricing`, { signal: AbortSignal.timeout(or) });
|
|
10683
10707
|
if (!t.ok) return;
|
|
10684
10708
|
let i = await t.json(),
|
|
10685
10709
|
a = {};
|
|
@@ -10690,15 +10714,15 @@ async function hi(e) {
|
|
|
10690
10714
|
Zt(a);
|
|
10691
10715
|
} catch {}
|
|
10692
10716
|
}
|
|
10693
|
-
var
|
|
10694
|
-
|
|
10717
|
+
var lr = new Set(['video', 'image', 'text', 'audio', '3d']),
|
|
10718
|
+
dr = { llm: 'text', chat: 'text', reasoning: 'text' };
|
|
10695
10719
|
async function yi(e, t) {
|
|
10696
10720
|
await hi(t);
|
|
10697
10721
|
let i = D();
|
|
10698
10722
|
if (e) {
|
|
10699
10723
|
let s = e.toLowerCase(),
|
|
10700
|
-
o =
|
|
10701
|
-
i =
|
|
10724
|
+
o = dr[s] ?? s;
|
|
10725
|
+
i = lr.has(o)
|
|
10702
10726
|
? i.filter((u) => u.category.toLowerCase() === o)
|
|
10703
10727
|
: i.filter((u) => u.kind.toLowerCase().includes(s) || u.slug.toLowerCase().includes(s));
|
|
10704
10728
|
}
|
|
@@ -10819,7 +10843,7 @@ ${r.bold(r.cyan(i.name))} (${r.bold(i.slug)})
|
|
|
10819
10843
|
}
|
|
10820
10844
|
E();
|
|
10821
10845
|
et();
|
|
10822
|
-
var
|
|
10846
|
+
var pr = 1e4,
|
|
10823
10847
|
it = {
|
|
10824
10848
|
price: '',
|
|
10825
10849
|
creativeMode: 'Creative mode',
|
|
@@ -10830,22 +10854,22 @@ var dr = 1e4,
|
|
|
10830
10854
|
priorityDraft: 'Priority + Draft',
|
|
10831
10855
|
creativeModePriorityDraft: 'Creative mode + Priority + Draft',
|
|
10832
10856
|
},
|
|
10833
|
-
|
|
10834
|
-
|
|
10857
|
+
cr = Object.keys(it),
|
|
10858
|
+
ur = {
|
|
10835
10859
|
creativeMode: 'unfiltered',
|
|
10836
10860
|
creativeModePriority: 'unfilteredPriority',
|
|
10837
10861
|
creativeModeDraft: 'unfilteredDraft',
|
|
10838
10862
|
creativeModePriorityDraft: 'unfilteredPriorityDraft',
|
|
10839
10863
|
};
|
|
10840
|
-
function
|
|
10841
|
-
let i =
|
|
10864
|
+
function mr(e, t) {
|
|
10865
|
+
let i = ur[t];
|
|
10842
10866
|
return e[t] ?? (i ? e[i] : void 0);
|
|
10843
10867
|
}
|
|
10844
|
-
async function
|
|
10868
|
+
async function fr(e, t) {
|
|
10845
10869
|
let i = `${w(e)}${xe(t)}`,
|
|
10846
10870
|
a;
|
|
10847
10871
|
try {
|
|
10848
|
-
a = await fetch(i, { signal: AbortSignal.timeout(
|
|
10872
|
+
a = await fetch(i, { signal: AbortSignal.timeout(pr) });
|
|
10849
10873
|
} catch {
|
|
10850
10874
|
throw new Error(`Could not reach ${i}`);
|
|
10851
10875
|
}
|
|
@@ -10872,7 +10896,7 @@ function at(e) {
|
|
|
10872
10896
|
i = typeof e.scale == 'number' ? e.scale : t;
|
|
10873
10897
|
return `Starter ${tt(e.starter)} Plus ${tt(t)} Scale ${tt(i)}`;
|
|
10874
10898
|
}
|
|
10875
|
-
function
|
|
10899
|
+
function gr(e) {
|
|
10876
10900
|
if (typeof e.label == 'string' && e.label.trim()) return e.label.trim();
|
|
10877
10901
|
let t = [];
|
|
10878
10902
|
for (let i of ['endpoint', 'resolution', 'quality', 'mode', 'task', 'component', 'token']) {
|
|
@@ -10884,21 +10908,21 @@ function fr(e) {
|
|
|
10884
10908
|
t.length ? t.join(' \xB7 ') : String(e.id ?? 'default')
|
|
10885
10909
|
);
|
|
10886
10910
|
}
|
|
10887
|
-
function
|
|
10888
|
-
let i =
|
|
10889
|
-
for (let a of
|
|
10890
|
-
let n = at(
|
|
10911
|
+
function hr(e, t) {
|
|
10912
|
+
let i = gr(e);
|
|
10913
|
+
for (let a of cr) {
|
|
10914
|
+
let n = at(mr(e, a));
|
|
10891
10915
|
if (!n) continue;
|
|
10892
10916
|
let s = it[a] ? ` (${it[a]})` : '';
|
|
10893
10917
|
t.push(` ${i}${s} ${n}`);
|
|
10894
10918
|
}
|
|
10895
10919
|
}
|
|
10896
|
-
function
|
|
10920
|
+
function yr(e, t) {
|
|
10897
10921
|
let i = e.quality ? ` quality=${e.quality}` : '';
|
|
10898
10922
|
t.push(
|
|
10899
10923
|
` ${r.bold(e.slug.padEnd(26))} ${r.gray(e.name)} ${r.dim(`${e.kind} ${e.unit} model=${e.model}${i}`)}`,
|
|
10900
10924
|
);
|
|
10901
|
-
for (let n of e.variants ?? [])
|
|
10925
|
+
for (let n of e.variants ?? []) hr(n, t);
|
|
10902
10926
|
let a = e.addons;
|
|
10903
10927
|
if (Array.isArray(a))
|
|
10904
10928
|
for (let n of a) {
|
|
@@ -10910,7 +10934,7 @@ function hr(e, t) {
|
|
|
10910
10934
|
}
|
|
10911
10935
|
t.push('');
|
|
10912
10936
|
}
|
|
10913
|
-
function
|
|
10937
|
+
function br(e) {
|
|
10914
10938
|
let t = [],
|
|
10915
10939
|
i = e.board.checked ? ` \xB7 checked ${e.board.checked}` : '';
|
|
10916
10940
|
(t.push(`${r.bold('Tein prices')} ${r.green(e.currency)} ${e.count} models${i}`),
|
|
@@ -10932,7 +10956,7 @@ function yr(e) {
|
|
|
10932
10956
|
});
|
|
10933
10957
|
for (let l of s) {
|
|
10934
10958
|
t.push(`${r.bold(r.cyan(`\u2500\u2500 ${l} \u2500\u2500`))}`);
|
|
10935
|
-
for (let c of a.get(l) ?? [])
|
|
10959
|
+
for (let c of a.get(l) ?? []) yr(c, t);
|
|
10936
10960
|
}
|
|
10937
10961
|
let o = new Set(e.board.models.map((l) => l.slug.toLowerCase())),
|
|
10938
10962
|
u = (e.configs ?? []).filter((l) => !o.has(String(l.modelSlug ?? '').toLowerCase()));
|
|
@@ -10965,7 +10989,7 @@ function yr(e) {
|
|
|
10965
10989
|
async function ki(e) {
|
|
10966
10990
|
let t;
|
|
10967
10991
|
try {
|
|
10968
|
-
t = await
|
|
10992
|
+
t = await fr(e.apiUrl, e.model);
|
|
10969
10993
|
} catch (i) {
|
|
10970
10994
|
let a = i instanceof Error ? i.message : String(i);
|
|
10971
10995
|
(process.stderr.write(`${r.red('Error:')} ${a}
|
|
@@ -10976,7 +11000,7 @@ async function ki(e) {
|
|
|
10976
11000
|
e.json
|
|
10977
11001
|
? `${JSON.stringify(t, null, 2)}
|
|
10978
11002
|
`
|
|
10979
|
-
:
|
|
11003
|
+
: br(t),
|
|
10980
11004
|
);
|
|
10981
11005
|
}
|
|
10982
11006
|
var wi = T(require('node:path'));
|
|
@@ -11243,7 +11267,7 @@ ${r.bold('EXAMPLES:')}
|
|
|
11243
11267
|
|
|
11244
11268
|
`);
|
|
11245
11269
|
}
|
|
11246
|
-
async function
|
|
11270
|
+
async function Vr() {
|
|
11247
11271
|
let e = process.argv.slice(2),
|
|
11248
11272
|
t = oi(e);
|
|
11249
11273
|
if (t.flags.has('help') || t.options.help || t.command === 'help') {
|
|
@@ -11350,7 +11374,7 @@ Run ${r.cyan('tein --help')} for the commands, or ${r.cyan('tein models')} for t
|
|
|
11350
11374
|
}
|
|
11351
11375
|
}
|
|
11352
11376
|
}
|
|
11353
|
-
|
|
11377
|
+
Vr().catch((e) => {
|
|
11354
11378
|
(e instanceof b &&
|
|
11355
11379
|
(process.stderr.write(`
|
|
11356
11380
|
${r.red('Error:')} ${K(e).join(`
|