@shop-os/modelkit 0.23.1 → 0.24.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/dist/catalog.cjs +123 -1
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +35 -0
- package/dist/catalog.d.ts +35 -0
- package/dist/catalog.js +123 -1
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +202 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +202 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/catalog.d.cts
CHANGED
|
@@ -254,6 +254,12 @@ interface VideoRequest {
|
|
|
254
254
|
startSeconds: number;
|
|
255
255
|
resumeSeconds: number;
|
|
256
256
|
};
|
|
257
|
+
/** Rows with `constraints.draft`: render the final from this draft task (a draft call's
|
|
258
|
+
* `jobId`). The provider reuses
|
|
259
|
+
* the draft's prompt, inputs, duration, ratio, seed and audio, so the adapter sends none of
|
|
260
|
+
* them; `resolution` must be one of `finalResolutions` (default: the first), and
|
|
261
|
+
* `durationSeconds` is only the usage fallback until the task reports its length. */
|
|
262
|
+
draftTaskId?: string;
|
|
257
263
|
}
|
|
258
264
|
/**
|
|
259
265
|
* What a caller passes to generateVideo. `duration` is the AI SDK spelling of
|
|
@@ -845,6 +851,14 @@ interface ModelConstraints {
|
|
|
845
851
|
* `new`: it returns only the added footage and the caller joins it (Seedance). */
|
|
846
852
|
returns?: "new" | "joined";
|
|
847
853
|
};
|
|
854
|
+
/** A draft row (Seedance 2.5 Draft): every call renders a preview at `resolution`, and a call
|
|
855
|
+
* with `VideoRequest.draftTaskId` renders the final from one at one of `finalResolutions`, for
|
|
856
|
+
* `ttlDays` after the draft task was created. Both steps run and bill as this row. */
|
|
857
|
+
draft?: {
|
|
858
|
+
resolution: VideoResolution;
|
|
859
|
+
finalResolutions: VideoResolution[];
|
|
860
|
+
ttlDays: number;
|
|
861
|
+
};
|
|
848
862
|
/** What a `video-tool` row accepts. Read it through `videoToolConstraints(row)`. */
|
|
849
863
|
tool?: VideoToolConstraints;
|
|
850
864
|
/** Required on `model3d` rows. */
|
|
@@ -1500,6 +1514,27 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
1500
1514
|
joined: "joined";
|
|
1501
1515
|
}>>;
|
|
1502
1516
|
}, z.core.$loose>>;
|
|
1517
|
+
draft: z.ZodOptional<z.ZodObject<{
|
|
1518
|
+
resolution: z.ZodEnum<{
|
|
1519
|
+
"360p": "360p";
|
|
1520
|
+
"480p": "480p";
|
|
1521
|
+
"720p": "720p";
|
|
1522
|
+
"768p": "768p";
|
|
1523
|
+
"1080p": "1080p";
|
|
1524
|
+
"2k": "2k";
|
|
1525
|
+
"4k": "4k";
|
|
1526
|
+
}>;
|
|
1527
|
+
finalResolutions: z.ZodArray<z.ZodEnum<{
|
|
1528
|
+
"360p": "360p";
|
|
1529
|
+
"480p": "480p";
|
|
1530
|
+
"720p": "720p";
|
|
1531
|
+
"768p": "768p";
|
|
1532
|
+
"1080p": "1080p";
|
|
1533
|
+
"2k": "2k";
|
|
1534
|
+
"4k": "4k";
|
|
1535
|
+
}>>;
|
|
1536
|
+
ttlDays: z.ZodNumber;
|
|
1537
|
+
}, z.core.$loose>>;
|
|
1503
1538
|
tool: z.ZodOptional<z.ZodObject<{
|
|
1504
1539
|
kind: z.ZodEnum<{
|
|
1505
1540
|
upscale: "upscale";
|
package/dist/catalog.d.ts
CHANGED
|
@@ -254,6 +254,12 @@ interface VideoRequest {
|
|
|
254
254
|
startSeconds: number;
|
|
255
255
|
resumeSeconds: number;
|
|
256
256
|
};
|
|
257
|
+
/** Rows with `constraints.draft`: render the final from this draft task (a draft call's
|
|
258
|
+
* `jobId`). The provider reuses
|
|
259
|
+
* the draft's prompt, inputs, duration, ratio, seed and audio, so the adapter sends none of
|
|
260
|
+
* them; `resolution` must be one of `finalResolutions` (default: the first), and
|
|
261
|
+
* `durationSeconds` is only the usage fallback until the task reports its length. */
|
|
262
|
+
draftTaskId?: string;
|
|
257
263
|
}
|
|
258
264
|
/**
|
|
259
265
|
* What a caller passes to generateVideo. `duration` is the AI SDK spelling of
|
|
@@ -845,6 +851,14 @@ interface ModelConstraints {
|
|
|
845
851
|
* `new`: it returns only the added footage and the caller joins it (Seedance). */
|
|
846
852
|
returns?: "new" | "joined";
|
|
847
853
|
};
|
|
854
|
+
/** A draft row (Seedance 2.5 Draft): every call renders a preview at `resolution`, and a call
|
|
855
|
+
* with `VideoRequest.draftTaskId` renders the final from one at one of `finalResolutions`, for
|
|
856
|
+
* `ttlDays` after the draft task was created. Both steps run and bill as this row. */
|
|
857
|
+
draft?: {
|
|
858
|
+
resolution: VideoResolution;
|
|
859
|
+
finalResolutions: VideoResolution[];
|
|
860
|
+
ttlDays: number;
|
|
861
|
+
};
|
|
848
862
|
/** What a `video-tool` row accepts. Read it through `videoToolConstraints(row)`. */
|
|
849
863
|
tool?: VideoToolConstraints;
|
|
850
864
|
/** Required on `model3d` rows. */
|
|
@@ -1500,6 +1514,27 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
1500
1514
|
joined: "joined";
|
|
1501
1515
|
}>>;
|
|
1502
1516
|
}, z.core.$loose>>;
|
|
1517
|
+
draft: z.ZodOptional<z.ZodObject<{
|
|
1518
|
+
resolution: z.ZodEnum<{
|
|
1519
|
+
"360p": "360p";
|
|
1520
|
+
"480p": "480p";
|
|
1521
|
+
"720p": "720p";
|
|
1522
|
+
"768p": "768p";
|
|
1523
|
+
"1080p": "1080p";
|
|
1524
|
+
"2k": "2k";
|
|
1525
|
+
"4k": "4k";
|
|
1526
|
+
}>;
|
|
1527
|
+
finalResolutions: z.ZodArray<z.ZodEnum<{
|
|
1528
|
+
"360p": "360p";
|
|
1529
|
+
"480p": "480p";
|
|
1530
|
+
"720p": "720p";
|
|
1531
|
+
"768p": "768p";
|
|
1532
|
+
"1080p": "1080p";
|
|
1533
|
+
"2k": "2k";
|
|
1534
|
+
"4k": "4k";
|
|
1535
|
+
}>>;
|
|
1536
|
+
ttlDays: z.ZodNumber;
|
|
1537
|
+
}, z.core.$loose>>;
|
|
1503
1538
|
tool: z.ZodOptional<z.ZodObject<{
|
|
1504
1539
|
kind: z.ZodEnum<{
|
|
1505
1540
|
upscale: "upscale";
|
package/dist/catalog.js
CHANGED
|
@@ -352,6 +352,34 @@ var FAL_IMAGE_MODELS = [
|
|
|
352
352
|
logo: `${LOBE}/kling-color.png`
|
|
353
353
|
}
|
|
354
354
|
},
|
|
355
|
+
{
|
|
356
|
+
// kling/v4/text-to-image; references switch to kling/v4/image-to-image (up to 10,
|
|
357
|
+
// "@Image1".."@Image10"). Per output image: $0.063 at 2K, $0.094 at 4K (Kling price page,
|
|
358
|
+
// 2026-11-17); each reference adds $0.003, which we absorb. Native 8K is ENG-4137.
|
|
359
|
+
id: "kling-image-4.0",
|
|
360
|
+
aliases: [],
|
|
361
|
+
label: "Kling Image 4.0",
|
|
362
|
+
type: "image",
|
|
363
|
+
adapter: "fal",
|
|
364
|
+
providerModelId: "kling/v4/text-to-image",
|
|
365
|
+
lifecycle: "active",
|
|
366
|
+
exposure: EXPOSURE,
|
|
367
|
+
constraints: {
|
|
368
|
+
aspectRatios: [...KLING_RATIOS, "adaptive"],
|
|
369
|
+
sizes: ["2K", "4K"],
|
|
370
|
+
references: { images: 10 },
|
|
371
|
+
supports: ["count"],
|
|
372
|
+
prompt: { referenceSyntax: "numbered", maxChars: 21e3 }
|
|
373
|
+
},
|
|
374
|
+
defaults: { size: "2K", aspectRatio: "adaptive", count: 1 },
|
|
375
|
+
usage: { ...IMAGE_USAGE },
|
|
376
|
+
pricingKind: "image_size",
|
|
377
|
+
display: {
|
|
378
|
+
provider: "kuaishou",
|
|
379
|
+
description: "Kling Image 4.0 for photoreal text-to-image, long in-image text and multi-reference editing; takes a prompt and up to 10 reference images and outputs 2K or 4K.",
|
|
380
|
+
logo: `${LOBE}/kling-color.png`
|
|
381
|
+
}
|
|
382
|
+
},
|
|
355
383
|
{
|
|
356
384
|
// fal-ai/kling-image/v3/text-to-image; a reference switches to .../v3/image-to-image, which
|
|
357
385
|
// takes exactly one image_url and no "auto" ratio. $0.028 per image.
|
|
@@ -6342,6 +6370,54 @@ var VIDEO_MODELS = [
|
|
|
6342
6370
|
},
|
|
6343
6371
|
capabilities: { acceptsSourceVideo: true, videoEdit: true, ...FRAMES_EXCLUDE_REFERENCES }
|
|
6344
6372
|
},
|
|
6373
|
+
{
|
|
6374
|
+
// The same BytePlus model in draft mode. Probed 2026-11-17: a draft must be 480p; its
|
|
6375
|
+
// final is a second task on this row (draftTaskId), and 720p or no resolution is refused
|
|
6376
|
+
// there. A 4k final also rendered, but the docs list 1080p only. No alias for the provider
|
|
6377
|
+
// id: that alias resolves usage to seedance-2.5. Edit and extend stay on seedance-2.5.
|
|
6378
|
+
id: "seedance-2.5-draft",
|
|
6379
|
+
aliases: ["seedance-2-5-draft"],
|
|
6380
|
+
label: "Seedance 2.5 Draft",
|
|
6381
|
+
type: "video",
|
|
6382
|
+
adapter: "ark",
|
|
6383
|
+
providerModelId: "dreamina-seedance-2-5-260628",
|
|
6384
|
+
lifecycle: "active",
|
|
6385
|
+
exposure: [],
|
|
6386
|
+
constraints: {
|
|
6387
|
+
aspectRatios: [...SEEDANCE_RATIOS],
|
|
6388
|
+
resolutions: ["480p"],
|
|
6389
|
+
durations: { min: 4, max: 30 },
|
|
6390
|
+
references: {
|
|
6391
|
+
images: 30,
|
|
6392
|
+
videos: 10,
|
|
6393
|
+
audios: 10,
|
|
6394
|
+
videoSeconds: { min: 2, max: 30, total: 30 },
|
|
6395
|
+
...SEEDANCE_REFERENCE_MEDIA,
|
|
6396
|
+
audioSeconds: { min: 2, max: 30, total: 30 },
|
|
6397
|
+
audioFormats: ["wav", "mp3"],
|
|
6398
|
+
audioMaxBytes: 15 * 1024 * 1024
|
|
6399
|
+
},
|
|
6400
|
+
ratioIgnoredWith: ["firstFrame"],
|
|
6401
|
+
supports: ["generateAudio", "lastFrame", "watermark"],
|
|
6402
|
+
draft: { resolution: "480p", finalResolutions: ["1080p"], ttlDays: 14 },
|
|
6403
|
+
prompt: SEEDANCE_PROMPT,
|
|
6404
|
+
audio: "optional"
|
|
6405
|
+
},
|
|
6406
|
+
defaults: {
|
|
6407
|
+
durationSeconds: 5,
|
|
6408
|
+
resolution: "480p",
|
|
6409
|
+
aspectRatio: "16:9",
|
|
6410
|
+
generateAudio: true
|
|
6411
|
+
},
|
|
6412
|
+
usage: { ...VIDEO_USAGE3 },
|
|
6413
|
+
pricingKind: "video_per_second",
|
|
6414
|
+
display: {
|
|
6415
|
+
provider: "bytedance",
|
|
6416
|
+
logo: BYTEDANCE_LOGO2,
|
|
6417
|
+
description: "A quick 480p Seedance 2.5 preview. Render the 1080p final from it within 14 days; the final keeps the draft's scene and motion."
|
|
6418
|
+
},
|
|
6419
|
+
capabilities: { acceptsSourceVideo: false, videoEdit: false, ...FRAMES_EXCLUDE_REFERENCES }
|
|
6420
|
+
},
|
|
6345
6421
|
{
|
|
6346
6422
|
// Limits probed on the live API 2026-11-16 (1080p is refused). Extend probe: a 4 s
|
|
6347
6423
|
// extend returned 4 s of new footage only and billed input + output tokens, as on 2.5.
|
|
@@ -8325,6 +8401,13 @@ var ModelConstraintsSchema = z3.looseObject({
|
|
|
8325
8401
|
maxTotalSeconds: z3.number(),
|
|
8326
8402
|
returns: z3.enum(["new", "joined"]).optional()
|
|
8327
8403
|
}).optional(),
|
|
8404
|
+
// Loose so a kit before 0.24.0 keeps a row that carries it (an unknown `supports` value
|
|
8405
|
+
// would drop the row there).
|
|
8406
|
+
draft: z3.looseObject({
|
|
8407
|
+
resolution: VideoResolutionSchema,
|
|
8408
|
+
finalResolutions: z3.array(VideoResolutionSchema).min(1),
|
|
8409
|
+
ttlDays: z3.number().positive()
|
|
8410
|
+
}).optional(),
|
|
8328
8411
|
tool: VideoToolConstraintsSchema.optional(),
|
|
8329
8412
|
model3d: Model3dConstraintsSchema.optional(),
|
|
8330
8413
|
// Loose on purpose: the read path keeps a row whose value is invalid (the accessors in
|
|
@@ -9438,6 +9521,20 @@ var FAL_IMAGE_SPECS = /* @__PURE__ */ new Map([
|
|
|
9438
9521
|
aspectRatios: KLING_RATIOS3
|
|
9439
9522
|
}
|
|
9440
9523
|
],
|
|
9524
|
+
[
|
|
9525
|
+
// No output_format or seed field. Kling caps non-English prompts at 21,000 characters
|
|
9526
|
+
// (API update 2026-11-17), under the schema's 50,000.
|
|
9527
|
+
"kling/v4/text-to-image",
|
|
9528
|
+
{
|
|
9529
|
+
label: "Kling Image 4.0",
|
|
9530
|
+
maxReferences: 10,
|
|
9531
|
+
maxCount: 9,
|
|
9532
|
+
outputFormats: [],
|
|
9533
|
+
promptMax: 21e3,
|
|
9534
|
+
promptRequired: true,
|
|
9535
|
+
aspectRatios: [...KLING_RATIOS3, "adaptive"]
|
|
9536
|
+
}
|
|
9537
|
+
],
|
|
9441
9538
|
[
|
|
9442
9539
|
"recraft/v4.1/flash/text-to-image",
|
|
9443
9540
|
{
|
|
@@ -9933,6 +10030,25 @@ function resolveVideoResolution(requested, model, onUnsupported, warnings) {
|
|
|
9933
10030
|
warnings
|
|
9934
10031
|
);
|
|
9935
10032
|
}
|
|
10033
|
+
function resolveDraftFinalResolution(requested, draft, model, onUnsupported, warnings) {
|
|
10034
|
+
const [first] = draft.finalResolutions;
|
|
10035
|
+
if (requested === void 0 || draft.finalResolutions.includes(requested))
|
|
10036
|
+
return requested ?? first;
|
|
10037
|
+
if (onUnsupported === "error") {
|
|
10038
|
+
throw new ModelKitError({
|
|
10039
|
+
code: "unsupported_option",
|
|
10040
|
+
message: `${model.id} renders a final from a draft at ${draft.finalResolutions.join(", ")} only`,
|
|
10041
|
+
model: model.id,
|
|
10042
|
+
retryable: false
|
|
10043
|
+
});
|
|
10044
|
+
}
|
|
10045
|
+
warnings.push({
|
|
10046
|
+
code: "resolution_coerced",
|
|
10047
|
+
field: "resolution",
|
|
10048
|
+
message: `${model.id} renders a final at ${String(first)}, not ${requested}`
|
|
10049
|
+
});
|
|
10050
|
+
return first;
|
|
10051
|
+
}
|
|
9936
10052
|
function resolveDuration(requested, durations, model, onUnsupported, warnings) {
|
|
9937
10053
|
if (requested === void 0 || !durations) return requested;
|
|
9938
10054
|
const inSet = Array.isArray(durations) ? durations.includes(requested) : requested >= durations.min && requested <= durations.max;
|
|
@@ -10260,7 +10376,13 @@ function resolveVideoOptions(model, request, onUnsupported = "error") {
|
|
|
10260
10376
|
);
|
|
10261
10377
|
if (aspectRatio !== void 0) merged.aspectRatio = aspectRatio;
|
|
10262
10378
|
fillKlingModeResolution(model, merged);
|
|
10263
|
-
const resolution =
|
|
10379
|
+
const resolution = merged.draftTaskId !== void 0 && c.draft ? resolveDraftFinalResolution(
|
|
10380
|
+
request.resolution,
|
|
10381
|
+
c.draft,
|
|
10382
|
+
model,
|
|
10383
|
+
onUnsupported,
|
|
10384
|
+
warnings
|
|
10385
|
+
) : resolveVideoResolution(merged.resolution, model, onUnsupported, warnings);
|
|
10264
10386
|
if (resolution !== void 0) merged.resolution = resolution;
|
|
10265
10387
|
if (takesKlingMode(model)) delete merged.mode;
|
|
10266
10388
|
const duration = resolveDuration(
|