@shop-os/modelkit 0.20.0 → 0.21.1
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/CHANGELOG.md +25 -0
- package/README.md +2 -1
- package/dist/catalog.cjs +55 -0
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +32 -1
- package/dist/catalog.d.ts +32 -1
- package/dist/catalog.js +55 -0
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +139 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.js +137 -62
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -43,6 +43,7 @@ __export(index_exports, {
|
|
|
43
43
|
DEFAULT_ADAPTERS: () => DEFAULT_ADAPTERS,
|
|
44
44
|
ExposureSchema: () => ExposureSchema,
|
|
45
45
|
IMAGE_INPUT_SPEC_KEYS: () => IMAGE_INPUT_SPEC_KEYS,
|
|
46
|
+
INPUT_BILLINGS: () => INPUT_BILLINGS,
|
|
46
47
|
INPUT_SPEC_SUPPORTS_KEYS: () => INPUT_SPEC_SUPPORTS_KEYS,
|
|
47
48
|
InputSpecSchema: () => InputSpecSchema,
|
|
48
49
|
JsonObjectSchema: () => JsonObjectSchema,
|
|
@@ -87,6 +88,7 @@ __export(index_exports, {
|
|
|
87
88
|
hasAwsCredentials: () => hasAwsCredentials,
|
|
88
89
|
higgsfieldAdapter: () => higgsfieldAdapter,
|
|
89
90
|
imageOutputFormats: () => imageOutputFormats,
|
|
91
|
+
inputBillingOf: () => inputBillingOf,
|
|
90
92
|
isArrayInputSpecKey: () => isArrayInputSpecKey,
|
|
91
93
|
isInputSpecKey: () => isInputSpecKey,
|
|
92
94
|
isListed: () => isListed,
|
|
@@ -5528,6 +5530,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5528
5530
|
lifecycle: "active",
|
|
5529
5531
|
exposure: ["cowork", "space_builder"],
|
|
5530
5532
|
constraints: {
|
|
5533
|
+
inputBilling: "kling-v4",
|
|
5531
5534
|
aspectRatios: ["adaptive", "16:9", "9:16", "1:1", "21:9"],
|
|
5532
5535
|
resolutions: ["720p", "1080p"],
|
|
5533
5536
|
durations: { min: 3, max: 30 },
|
|
@@ -5567,6 +5570,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5567
5570
|
lifecycle: "active",
|
|
5568
5571
|
exposure: ["cowork", "space_builder"],
|
|
5569
5572
|
constraints: {
|
|
5573
|
+
inputBilling: "kling-v4",
|
|
5570
5574
|
resolutions: ["720p", "1080p"],
|
|
5571
5575
|
durations: { min: 3, max: 30 },
|
|
5572
5576
|
references: { ...NO_REFERENCES, images: 10 },
|
|
@@ -5602,6 +5606,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5602
5606
|
lifecycle: "active",
|
|
5603
5607
|
exposure: ["cowork", "space_builder"],
|
|
5604
5608
|
constraints: {
|
|
5609
|
+
inputBilling: "kling-v4",
|
|
5605
5610
|
aspectRatios: ["adaptive", "16:9", "9:16", "1:1", "21:9"],
|
|
5606
5611
|
resolutions: ["720p"],
|
|
5607
5612
|
durations: { min: 3, max: 20 },
|
|
@@ -5640,6 +5645,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5640
5645
|
lifecycle: "active",
|
|
5641
5646
|
exposure: ["cowork", "space_builder"],
|
|
5642
5647
|
constraints: {
|
|
5648
|
+
inputBilling: "kling-v4",
|
|
5643
5649
|
resolutions: ["720p"],
|
|
5644
5650
|
durations: { min: 3, max: 20 },
|
|
5645
5651
|
references: {
|
|
@@ -5721,6 +5727,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5721
5727
|
lifecycle: "active",
|
|
5722
5728
|
exposure: ["cowork", "space_builder"],
|
|
5723
5729
|
constraints: {
|
|
5730
|
+
inputBilling: "h3-max-reference",
|
|
5724
5731
|
resolutions: ["480p", "768p"],
|
|
5725
5732
|
durations: { min: 5, max: 13 },
|
|
5726
5733
|
references: { images: 9, videos: 3, audios: 0 },
|
|
@@ -5958,6 +5965,7 @@ var VIDEO_FAMILY_MODELS = [
|
|
|
5958
5965
|
lifecycle: "active",
|
|
5959
5966
|
exposure: ["cowork", "space_builder"],
|
|
5960
5967
|
constraints: {
|
|
5968
|
+
inputBilling: "grok-input-image",
|
|
5961
5969
|
aspectRatios: [...GROK_15_RATIOS],
|
|
5962
5970
|
resolutions: ["480p", "720p", "1080p"],
|
|
5963
5971
|
durations: { min: 1, max: 15 },
|
|
@@ -6235,6 +6243,7 @@ var VIDEO_MODELS = [
|
|
|
6235
6243
|
replacedBy: "gemini-omni-1.1-flash",
|
|
6236
6244
|
exposure: [],
|
|
6237
6245
|
constraints: {
|
|
6246
|
+
inputBilling: "omni",
|
|
6238
6247
|
// 1.0 rejects `resolution`; it renders 720p. No defaults: the adapter
|
|
6239
6248
|
// sends ratio and duration only when the caller set them, so a
|
|
6240
6249
|
// reference clip keeps its own framing.
|
|
@@ -6266,6 +6275,7 @@ var VIDEO_MODELS = [
|
|
|
6266
6275
|
lifecycle: "active",
|
|
6267
6276
|
exposure: ["cowork", "space_builder"],
|
|
6268
6277
|
constraints: {
|
|
6278
|
+
inputBilling: "omni",
|
|
6269
6279
|
aspectRatios: [...OMNI_RATIOS],
|
|
6270
6280
|
resolutions: ["360p", "720p", "1080p", "4k"],
|
|
6271
6281
|
durations: [3, 4, 5, 6, 7, 8, 9, 10],
|
|
@@ -6310,6 +6320,7 @@ var VIDEO_MODELS = [
|
|
|
6310
6320
|
lifecycle: "active",
|
|
6311
6321
|
exposure: ["cowork", "space_builder"],
|
|
6312
6322
|
constraints: {
|
|
6323
|
+
inputBilling: "omni",
|
|
6313
6324
|
aspectRatios: [...OMNI_RATIOS],
|
|
6314
6325
|
resolutions: ["360p", "720p", "1080p", "4k"],
|
|
6315
6326
|
durations: { min: 3, max: 15 },
|
|
@@ -6486,6 +6497,7 @@ var VIDEO_MODELS = [
|
|
|
6486
6497
|
lifecycle: "active",
|
|
6487
6498
|
exposure: ["cowork", "space_builder"],
|
|
6488
6499
|
constraints: {
|
|
6500
|
+
inputBilling: "grok-input-image",
|
|
6489
6501
|
aspectRatios: [...GROK_RATIOS],
|
|
6490
6502
|
resolutions: ["480p", "720p"],
|
|
6491
6503
|
durations: { min: 1, max: 15 },
|
|
@@ -6687,6 +6699,7 @@ var VIDEO_MODELS = [
|
|
|
6687
6699
|
lifecycle: "active",
|
|
6688
6700
|
exposure: ["cowork", "space_builder"],
|
|
6689
6701
|
constraints: {
|
|
6702
|
+
inputBilling: "h3-reference",
|
|
6690
6703
|
aspectRatios: [...H3_REFERENCE_RATIOS],
|
|
6691
6704
|
resolutions: ["480p", "768p", "2k", "4k"],
|
|
6692
6705
|
durations: { min: 5, max: 15 },
|
|
@@ -6731,6 +6744,7 @@ var VIDEO_MODELS = [
|
|
|
6731
6744
|
lifecycle: "active",
|
|
6732
6745
|
exposure: ["cowork", "space_builder"],
|
|
6733
6746
|
constraints: {
|
|
6747
|
+
inputBilling: "h3-max-reference",
|
|
6734
6748
|
aspectRatios: [...H3_REFERENCE_RATIOS],
|
|
6735
6749
|
resolutions: ["480p", "768p", "1080p"],
|
|
6736
6750
|
durations: { min: 5, max: 15 },
|
|
@@ -6778,6 +6792,7 @@ var VIDEO_MODELS = [
|
|
|
6778
6792
|
lifecycle: "active",
|
|
6779
6793
|
exposure: ["cowork", "space_builder"],
|
|
6780
6794
|
constraints: {
|
|
6795
|
+
inputBilling: "input-plus-output",
|
|
6781
6796
|
aspectRatios: [...WAN_RATIOS],
|
|
6782
6797
|
resolutions: ["480p", "720p", "1080p"],
|
|
6783
6798
|
durations: { min: 2, max: 30 },
|
|
@@ -6819,6 +6834,7 @@ var VIDEO_MODELS = [
|
|
|
6819
6834
|
lifecycle: "active",
|
|
6820
6835
|
exposure: ["cowork", "space_builder"],
|
|
6821
6836
|
constraints: {
|
|
6837
|
+
inputBilling: "input-plus-output",
|
|
6822
6838
|
aspectRatios: [...WAN_RATIOS],
|
|
6823
6839
|
resolutions: ["480p", "720p", "1080p"],
|
|
6824
6840
|
durations: { min: 2, max: 30 },
|
|
@@ -7482,7 +7498,18 @@ var PromptConventionsSchema = import_zod.z.strictObject({
|
|
|
7482
7498
|
referenceSyntax: ReferenceSyntaxSchema,
|
|
7483
7499
|
maxChars: MaxCharsSchema.optional()
|
|
7484
7500
|
});
|
|
7501
|
+
var InputBillingSchema = import_zod.z.enum([
|
|
7502
|
+
"seedance",
|
|
7503
|
+
"omni",
|
|
7504
|
+
"h3-max-reference",
|
|
7505
|
+
"h3-reference",
|
|
7506
|
+
"grok-input-image",
|
|
7507
|
+
"source-video-rate",
|
|
7508
|
+
"kling-v4",
|
|
7509
|
+
"input-plus-output"
|
|
7510
|
+
]);
|
|
7485
7511
|
var AUDIO_OUTPUTS = AudioOutputSchema.options;
|
|
7512
|
+
var INPUT_BILLINGS = InputBillingSchema.options;
|
|
7486
7513
|
var REFERENCE_SYNTAXES = ReferenceSyntaxSchema.options;
|
|
7487
7514
|
var ConstraintsReadView = import_zod.z.looseObject({
|
|
7488
7515
|
audio: AudioOutputSchema.optional().catch(void 0),
|
|
@@ -8395,6 +8422,7 @@ var ModelConstraintsSchema = import_zod3.z.looseObject({
|
|
|
8395
8422
|
// Loose on purpose: the read path keeps a row whose value is invalid (the accessors in
|
|
8396
8423
|
// conventions.ts read it as "not set"); CatalogModelSchema below rejects it on write.
|
|
8397
8424
|
audio: import_zod3.z.unknown().optional(),
|
|
8425
|
+
inputBilling: import_zod3.z.unknown().optional(),
|
|
8398
8426
|
prompt: import_zod3.z.unknown().optional()
|
|
8399
8427
|
});
|
|
8400
8428
|
var MediaRefSchema = import_zod3.z.union([
|
|
@@ -8587,6 +8615,14 @@ var CatalogModelSchema = CatalogModelSchemaBase.superRefine(
|
|
|
8587
8615
|
message: 'audio must be "always", "optional" or "never"'
|
|
8588
8616
|
});
|
|
8589
8617
|
}
|
|
8618
|
+
const inputBilling = row2.constraints.inputBilling;
|
|
8619
|
+
if (inputBilling !== void 0 && !InputBillingSchema.safeParse(inputBilling).success) {
|
|
8620
|
+
ctx.addIssue({
|
|
8621
|
+
code: "custom",
|
|
8622
|
+
path: ["constraints", "inputBilling"],
|
|
8623
|
+
message: `inputBilling must be one of ${INPUT_BILLINGS.join(", ")}`
|
|
8624
|
+
});
|
|
8625
|
+
}
|
|
8590
8626
|
const refs = row2.constraints.references;
|
|
8591
8627
|
for (const kind of ["images", "videos", "audios"]) {
|
|
8592
8628
|
const least = refs?.min?.[kind];
|
|
@@ -9368,19 +9404,42 @@ async function withRetry(fn, opts = {}) {
|
|
|
9368
9404
|
const base = opts.baseDelayMs ?? 1e3;
|
|
9369
9405
|
const max = opts.maxDelayMs ?? 1e4;
|
|
9370
9406
|
const factor = opts.factor ?? 2;
|
|
9407
|
+
const rateLimited = opts.rateLimited;
|
|
9408
|
+
let limitedFailures = 0;
|
|
9409
|
+
let otherFailures = 0;
|
|
9371
9410
|
let last;
|
|
9372
|
-
|
|
9411
|
+
const ceiling = attempts + (rateLimited?.attempts ?? 0);
|
|
9412
|
+
for (let attempt = 1; attempt <= ceiling; attempt++) {
|
|
9373
9413
|
if (opts.signal?.aborted) throw throwAborted();
|
|
9374
9414
|
try {
|
|
9375
9415
|
return await fn(attempt);
|
|
9376
9416
|
} catch (cause) {
|
|
9377
|
-
last = cause
|
|
9378
|
-
|
|
9379
|
-
|
|
9417
|
+
last = cause;
|
|
9418
|
+
const err = cause instanceof Error ? cause : new Error(String(cause), { cause });
|
|
9419
|
+
if (!shouldRetry(err) || opts.signal?.aborted) throw cause;
|
|
9420
|
+
let delay;
|
|
9421
|
+
if (rateLimited !== void 0 && err instanceof ModelKitError && err.code === "rate_limited") {
|
|
9422
|
+
limitedFailures += 1;
|
|
9423
|
+
if (limitedFailures >= rateLimited.attempts) throw cause;
|
|
9424
|
+
delay = jitter(
|
|
9425
|
+
Math.min(
|
|
9426
|
+
rateLimited.maxDelayMs,
|
|
9427
|
+
rateLimited.baseDelayMs * factor ** (limitedFailures - 1)
|
|
9428
|
+
)
|
|
9429
|
+
);
|
|
9430
|
+
} else {
|
|
9431
|
+
otherFailures += 1;
|
|
9432
|
+
if (otherFailures >= attempts) throw cause;
|
|
9433
|
+
delay = Math.min(max, base * factor ** (otherFailures - 1));
|
|
9434
|
+
}
|
|
9435
|
+
await sleep(delay, opts.signal);
|
|
9380
9436
|
}
|
|
9381
9437
|
}
|
|
9382
9438
|
throw last;
|
|
9383
9439
|
}
|
|
9440
|
+
function jitter(ms) {
|
|
9441
|
+
return Math.round(ms * (0.75 + Math.random() * 0.25));
|
|
9442
|
+
}
|
|
9384
9443
|
function combineSignals(a, b) {
|
|
9385
9444
|
return a && b ? AbortSignal.any([a, b]) : a ?? b;
|
|
9386
9445
|
}
|
|
@@ -14160,6 +14219,12 @@ async function fishFetch(ctx, path, init) {
|
|
|
14160
14219
|
if (!res.ok) throw classifyHttpError(res.status, await readBody(res), "fish", ctx.model.id);
|
|
14161
14220
|
return res;
|
|
14162
14221
|
}
|
|
14222
|
+
var FISH_RATE_LIMIT = { attempts: 6, baseDelayMs: 2e3, maxDelayMs: 2e4 };
|
|
14223
|
+
function fishRetryOptions(ctx) {
|
|
14224
|
+
const options = mediaRetryOptions(ctx.call, ctx.signal);
|
|
14225
|
+
if (ctx.call.maxRetries !== void 0) return options;
|
|
14226
|
+
return { ...options, rateLimited: FISH_RATE_LIMIT };
|
|
14227
|
+
}
|
|
14163
14228
|
function usage3(ctx) {
|
|
14164
14229
|
return {
|
|
14165
14230
|
model: ctx.model.id,
|
|
@@ -14183,23 +14248,20 @@ async function generateSpeech2(req, ctx) {
|
|
|
14183
14248
|
body.reference_id = checkVoiceId2(ctx, req.customVoice ? "customVoice" : "voice", voice);
|
|
14184
14249
|
}
|
|
14185
14250
|
if (req.language !== void 0) body.language = req.language;
|
|
14186
|
-
const { bytes, mime } = await withRetry(
|
|
14187
|
-
|
|
14188
|
-
|
|
14189
|
-
|
|
14190
|
-
|
|
14191
|
-
|
|
14192
|
-
|
|
14193
|
-
|
|
14194
|
-
|
|
14195
|
-
|
|
14196
|
-
|
|
14197
|
-
|
|
14198
|
-
|
|
14199
|
-
|
|
14200
|
-
},
|
|
14201
|
-
mediaRetryOptions(ctx.call, ctx.signal)
|
|
14202
|
-
);
|
|
14251
|
+
const { bytes, mime } = await withRetry(async () => {
|
|
14252
|
+
const res = await fishFetch(ctx, "/v1/tts", {
|
|
14253
|
+
method: "POST",
|
|
14254
|
+
headers: { "Content-Type": "application/json", model: ctx.model.providerModelId },
|
|
14255
|
+
body: JSON.stringify(body)
|
|
14256
|
+
});
|
|
14257
|
+
let audio;
|
|
14258
|
+
try {
|
|
14259
|
+
audio = new Uint8Array(await res.arrayBuffer());
|
|
14260
|
+
} catch (cause) {
|
|
14261
|
+
throw classifyThrown("fish", cause, ctx.model.id);
|
|
14262
|
+
}
|
|
14263
|
+
return { bytes: audio, mime: audioMime2(res, format) };
|
|
14264
|
+
}, fishRetryOptions(ctx));
|
|
14203
14265
|
if (bytes.byteLength === 0)
|
|
14204
14266
|
throw fishError(ctx, "provider_rejected", "Fish TTS returned no audio");
|
|
14205
14267
|
return { audio: { bytes, mime }, usage: usage3(ctx) };
|
|
@@ -14275,7 +14337,7 @@ async function createVoice2(req, ctx) {
|
|
|
14275
14337
|
const form = await cloneForm2(req, ctx);
|
|
14276
14338
|
const res = await withRetry(
|
|
14277
14339
|
() => onlyRateLimitRetries2(() => fishFetch(ctx, "/model", { method: "POST", body: form })),
|
|
14278
|
-
|
|
14340
|
+
fishRetryOptions(ctx)
|
|
14279
14341
|
);
|
|
14280
14342
|
const raw = await readBody(res);
|
|
14281
14343
|
const parsed = createdModelSchema.safeParse(raw);
|
|
@@ -14312,17 +14374,14 @@ async function designVoice(req, ctx) {
|
|
|
14312
14374
|
if (req.language !== void 0) body.language = req.language;
|
|
14313
14375
|
if (req.count !== void 0) body.n = req.count;
|
|
14314
14376
|
if (req.seed !== void 0) body.seed = req.seed;
|
|
14315
|
-
const raw = await withRetry(
|
|
14316
|
-
|
|
14317
|
-
|
|
14318
|
-
|
|
14319
|
-
|
|
14320
|
-
|
|
14321
|
-
|
|
14322
|
-
|
|
14323
|
-
},
|
|
14324
|
-
mediaRetryOptions(ctx.call, ctx.signal)
|
|
14325
|
-
);
|
|
14377
|
+
const raw = await withRetry(async () => {
|
|
14378
|
+
const res = await fishFetch(ctx, "/v1/voice-design", {
|
|
14379
|
+
method: "POST",
|
|
14380
|
+
headers: { "Content-Type": "application/json", model: ctx.model.providerModelId },
|
|
14381
|
+
body: JSON.stringify(body)
|
|
14382
|
+
});
|
|
14383
|
+
return readBody(res);
|
|
14384
|
+
}, fishRetryOptions(ctx));
|
|
14326
14385
|
const parsed = designSchema.safeParse(raw);
|
|
14327
14386
|
if (!parsed.success) {
|
|
14328
14387
|
throw fishError(ctx, "provider_rejected", "Fish voice design returned no candidates");
|
|
@@ -14340,27 +14399,24 @@ async function deleteVoice2(req, ctx) {
|
|
|
14340
14399
|
checkRow2(ctx, "voice-clone");
|
|
14341
14400
|
const id = encodeURIComponent(checkVoiceId2(ctx, "voiceId", req.voiceId));
|
|
14342
14401
|
let attempts = 0;
|
|
14343
|
-
await withRetry(
|
|
14344
|
-
|
|
14345
|
-
|
|
14346
|
-
|
|
14347
|
-
|
|
14348
|
-
|
|
14349
|
-
|
|
14350
|
-
|
|
14351
|
-
|
|
14352
|
-
|
|
14353
|
-
|
|
14354
|
-
|
|
14355
|
-
|
|
14356
|
-
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
},
|
|
14362
|
-
mediaRetryOptions(ctx.call, ctx.signal)
|
|
14363
|
-
);
|
|
14402
|
+
await withRetry(async () => {
|
|
14403
|
+
attempts += 1;
|
|
14404
|
+
try {
|
|
14405
|
+
await fishFetch(ctx, `/model/${id}`, { method: "DELETE" });
|
|
14406
|
+
} catch (cause) {
|
|
14407
|
+
if (!isModelKitError(cause) || cause.status !== 404) throw cause;
|
|
14408
|
+
if (attempts > 1) return;
|
|
14409
|
+
throw new ModelKitError({
|
|
14410
|
+
code: "provider_rejected",
|
|
14411
|
+
message: `Fish has no voice ${req.voiceId} under this key set; delete with the tier that created it`,
|
|
14412
|
+
provider: "fish",
|
|
14413
|
+
model: ctx.model.id,
|
|
14414
|
+
status: 404,
|
|
14415
|
+
cause,
|
|
14416
|
+
retryable: false
|
|
14417
|
+
});
|
|
14418
|
+
}
|
|
14419
|
+
}, fishRetryOptions(ctx));
|
|
14364
14420
|
}
|
|
14365
14421
|
var fishAdapter = {
|
|
14366
14422
|
id: "fish",
|
|
@@ -18434,6 +18490,25 @@ function fileCatalogCache(path) {
|
|
|
18434
18490
|
};
|
|
18435
18491
|
}
|
|
18436
18492
|
|
|
18493
|
+
// src/catalog/input-billing.ts
|
|
18494
|
+
var import_zod36 = require("zod");
|
|
18495
|
+
var DATA_ONLY_INPUT_BILLING = /* @__PURE__ */ new Map([
|
|
18496
|
+
["flux-3", "source-video-rate"]
|
|
18497
|
+
]);
|
|
18498
|
+
var KIT_INPUT_BILLING = new Map(
|
|
18499
|
+
MODELS.flatMap(
|
|
18500
|
+
(row2) => row2.constraints.inputBilling ? [[row2.id, row2.constraints.inputBilling]] : []
|
|
18501
|
+
)
|
|
18502
|
+
);
|
|
18503
|
+
var ConstraintsReadView2 = import_zod36.z.looseObject({
|
|
18504
|
+
inputBilling: InputBillingSchema.optional().catch(void 0)
|
|
18505
|
+
});
|
|
18506
|
+
function inputBillingOf(row2) {
|
|
18507
|
+
const view = ConstraintsReadView2.safeParse(row2.constraints);
|
|
18508
|
+
const own = view.success ? view.data.inputBilling : void 0;
|
|
18509
|
+
return own ?? KIT_INPUT_BILLING.get(row2.id) ?? (row2.adapter === "ark" ? "seedance" : void 0) ?? DATA_ONLY_INPUT_BILLING.get(row2.id) ?? null;
|
|
18510
|
+
}
|
|
18511
|
+
|
|
18437
18512
|
// src/resolve-image-output.ts
|
|
18438
18513
|
var BASE_FORMATS = ["png", "jpeg", "webp"];
|
|
18439
18514
|
var ONE_K_FRAME_PIXELS = 288 * 512;
|
|
@@ -19885,7 +19960,7 @@ async function testProviderKey(provider, secret, opts = {}) {
|
|
|
19885
19960
|
|
|
19886
19961
|
// src/text.ts
|
|
19887
19962
|
var import_ai4 = require("ai");
|
|
19888
|
-
var
|
|
19963
|
+
var import_zod37 = require("zod");
|
|
19889
19964
|
function mergeTextProviderOptions(catalog, caller) {
|
|
19890
19965
|
const merged = {};
|
|
19891
19966
|
const catalogOptions = catalog.providerOptions ?? {};
|
|
@@ -19924,8 +19999,8 @@ function passthroughTextModel(model) {
|
|
|
19924
19999
|
pricingKind: "token"
|
|
19925
20000
|
};
|
|
19926
20001
|
}
|
|
19927
|
-
var perplexityCostSchema =
|
|
19928
|
-
perplexity:
|
|
20002
|
+
var perplexityCostSchema = import_zod37.z.object({
|
|
20003
|
+
perplexity: import_zod37.z.object({ cost: import_zod37.z.object({ totalCost: import_zod37.z.number().finite().nonnegative() }) })
|
|
19929
20004
|
});
|
|
19930
20005
|
function reportedCostUsd(metadata) {
|
|
19931
20006
|
const parsed = perplexityCostSchema.safeParse(metadata);
|
|
@@ -19996,7 +20071,7 @@ function createTextSteps(initial, resolve, callerProviderOptions) {
|
|
|
19996
20071
|
|
|
19997
20072
|
// src/client.ts
|
|
19998
20073
|
var import_ai5 = require("ai");
|
|
19999
|
-
var
|
|
20074
|
+
var import_zod38 = require("zod");
|
|
20000
20075
|
|
|
20001
20076
|
// src/generated-image.ts
|
|
20002
20077
|
function toGeneratedImage(image) {
|
|
@@ -20415,10 +20490,10 @@ function textAbortOptions(sdk, context) {
|
|
|
20415
20490
|
if (abortSignal) return { abortSignal };
|
|
20416
20491
|
return {};
|
|
20417
20492
|
}
|
|
20418
|
-
var catalogId =
|
|
20419
|
-
var exactSize =
|
|
20420
|
-
var sdkRatio =
|
|
20421
|
-
var sizeTier =
|
|
20493
|
+
var catalogId = import_zod38.z.string();
|
|
20494
|
+
var exactSize = import_zod38.z.templateLiteral([import_zod38.z.number(), "x", import_zod38.z.number()]);
|
|
20495
|
+
var sdkRatio = import_zod38.z.templateLiteral([import_zod38.z.number(), ":", import_zod38.z.number()]);
|
|
20496
|
+
var sizeTier = import_zod38.z.enum(["512", "1K", "2K", "4K"]);
|
|
20422
20497
|
function isCatalogId(model) {
|
|
20423
20498
|
return catalogId.safeParse(model).success;
|
|
20424
20499
|
}
|
|
@@ -21141,6 +21216,7 @@ var describe = (modelId) => createDefaultModelKit().describe(modelId);
|
|
|
21141
21216
|
DEFAULT_ADAPTERS,
|
|
21142
21217
|
ExposureSchema,
|
|
21143
21218
|
IMAGE_INPUT_SPEC_KEYS,
|
|
21219
|
+
INPUT_BILLINGS,
|
|
21144
21220
|
INPUT_SPEC_SUPPORTS_KEYS,
|
|
21145
21221
|
InputSpecSchema,
|
|
21146
21222
|
JsonObjectSchema,
|
|
@@ -21185,6 +21261,7 @@ var describe = (modelId) => createDefaultModelKit().describe(modelId);
|
|
|
21185
21261
|
hasAwsCredentials,
|
|
21186
21262
|
higgsfieldAdapter,
|
|
21187
21263
|
imageOutputFormats,
|
|
21264
|
+
inputBillingOf,
|
|
21188
21265
|
isArrayInputSpecKey,
|
|
21189
21266
|
isInputSpecKey,
|
|
21190
21267
|
isListed,
|