@nodaro/shared 3.39.0 → 3.40.0
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/dist/{chunk-XUISP5BT.cjs → chunk-25PAKSMK.cjs} +41 -38
- package/dist/chunk-25PAKSMK.cjs.map +1 -0
- package/dist/{chunk-5OED47LE.js → chunk-2BJADMEX.js} +3 -3
- package/dist/{chunk-5OED47LE.js.map → chunk-2BJADMEX.js.map} +1 -1
- package/dist/{chunk-YNJ44IAL.cjs → chunk-4IWVZR44.cjs} +5 -5
- package/dist/{chunk-YNJ44IAL.cjs.map → chunk-4IWVZR44.cjs.map} +1 -1
- package/dist/{chunk-33QG2DOW.cjs → chunk-4LKEOIOT.cjs} +6 -6
- package/dist/{chunk-33QG2DOW.cjs.map → chunk-4LKEOIOT.cjs.map} +1 -1
- package/dist/{chunk-ZG4XSEZV.js → chunk-5CKTBGB6.js} +71 -2
- package/dist/chunk-5CKTBGB6.js.map +1 -0
- package/dist/{chunk-BDSFMY4X.js → chunk-5J5L26IZ.js} +5 -5
- package/dist/{chunk-BDSFMY4X.js.map → chunk-5J5L26IZ.js.map} +1 -1
- package/dist/{chunk-VRLRPGO7.js → chunk-A4NDZBSJ.js} +93 -11
- package/dist/chunk-A4NDZBSJ.js.map +1 -0
- package/dist/{chunk-KOP7UTQR.cjs → chunk-ADYPAGQF.cjs} +71 -2
- package/dist/chunk-ADYPAGQF.cjs.map +1 -0
- package/dist/{chunk-HABDAHZR.cjs → chunk-BOUEGYGI.cjs} +118 -28
- package/dist/chunk-BOUEGYGI.cjs.map +1 -0
- package/dist/{chunk-JLKZEKQ3.cjs → chunk-BWQRAQUD.cjs} +43 -43
- package/dist/{chunk-JLKZEKQ3.cjs.map → chunk-BWQRAQUD.cjs.map} +1 -1
- package/dist/{chunk-MSIIC6MY.cjs → chunk-DJIRIBKX.cjs} +4 -4
- package/dist/{chunk-MSIIC6MY.cjs.map → chunk-DJIRIBKX.cjs.map} +1 -1
- package/dist/{chunk-XA53RUSD.js → chunk-E4MLBJKG.js} +8 -8
- package/dist/{chunk-XA53RUSD.js.map → chunk-E4MLBJKG.js.map} +1 -1
- package/dist/chunk-FVZMFDRO.js +23 -0
- package/dist/chunk-FVZMFDRO.js.map +1 -0
- package/dist/{chunk-DKTRVOU5.js → chunk-GNY2S63W.js} +4 -4
- package/dist/{chunk-DKTRVOU5.js.map → chunk-GNY2S63W.js.map} +1 -1
- package/dist/{chunk-YHCG3HOR.js → chunk-GXTWKAJF.js} +3 -3
- package/dist/{chunk-YHCG3HOR.js.map → chunk-GXTWKAJF.js.map} +1 -1
- package/dist/{chunk-DE3PEIIP.cjs → chunk-IKCFSNNH.cjs} +21 -21
- package/dist/{chunk-DE3PEIIP.cjs.map → chunk-IKCFSNNH.cjs.map} +1 -1
- package/dist/{chunk-BYP62B7F.cjs → chunk-JN3V33AN.cjs} +6 -6
- package/dist/{chunk-BYP62B7F.cjs.map → chunk-JN3V33AN.cjs.map} +1 -1
- package/dist/{chunk-QXTCIJP5.js → chunk-LOTL72UI.js} +3 -3
- package/dist/{chunk-QXTCIJP5.js.map → chunk-LOTL72UI.js.map} +1 -1
- package/dist/{chunk-7QITUDRT.js → chunk-MLB6YNLS.js} +4 -4
- package/dist/{chunk-7QITUDRT.js.map → chunk-MLB6YNLS.js.map} +1 -1
- package/dist/{chunk-JABZNRXL.cjs → chunk-N2KG5AMQ.cjs} +4 -4
- package/dist/{chunk-JABZNRXL.cjs.map → chunk-N2KG5AMQ.cjs.map} +1 -1
- package/dist/{chunk-KMNSK7T5.js → chunk-NRSYWQKM.js} +7 -4
- package/dist/chunk-NRSYWQKM.js.map +1 -0
- package/dist/{chunk-IIGKJYWL.js → chunk-PYDZ7ZGH.js} +3 -3
- package/dist/{chunk-IIGKJYWL.js.map → chunk-PYDZ7ZGH.js.map} +1 -1
- package/dist/{chunk-ENFBA33M.cjs → chunk-RLVZ3RLE.cjs} +8 -8
- package/dist/{chunk-ENFBA33M.cjs.map → chunk-RLVZ3RLE.cjs.map} +1 -1
- package/dist/{chunk-JMUHMLJP.js → chunk-SYUY7GNT.js} +7 -5
- package/dist/chunk-SYUY7GNT.js.map +1 -0
- package/dist/{chunk-VRUN5TG2.cjs → chunk-TUUEQ2WR.cjs} +8 -8
- package/dist/{chunk-VRUN5TG2.cjs.map → chunk-TUUEQ2WR.cjs.map} +1 -1
- package/dist/{chunk-HZ46RDLD.cjs → chunk-VNC5DNIQ.cjs} +11 -11
- package/dist/{chunk-HZ46RDLD.cjs.map → chunk-VNC5DNIQ.cjs.map} +1 -1
- package/dist/{chunk-MSDECC3A.cjs → chunk-VSDJCJKP.cjs} +44 -42
- package/dist/chunk-VSDJCJKP.cjs.map +1 -0
- package/dist/{chunk-GW54ANCH.js → chunk-X7IRSO4L.js} +3 -3
- package/dist/{chunk-GW54ANCH.js.map → chunk-X7IRSO4L.js.map} +1 -1
- package/dist/chunk-XOZIHGR5.cjs +27 -0
- package/dist/chunk-XOZIHGR5.cjs.map +1 -0
- package/dist/{chunk-YSEM7JDE.cjs → chunk-YEET2QGF.cjs} +4 -4
- package/dist/{chunk-YSEM7JDE.cjs.map → chunk-YEET2QGF.cjs.map} +1 -1
- package/dist/{chunk-CMH2ACOX.js → chunk-YEZ2YUKK.js} +3 -3
- package/dist/{chunk-CMH2ACOX.js.map → chunk-YEZ2YUKK.js.map} +1 -1
- package/dist/{chunk-SPP6HQMM.js → chunk-YX5FW7ON.js} +39 -5
- package/dist/chunk-YX5FW7ON.js.map +1 -0
- package/dist/{chunk-75ZMA34U.cjs → chunk-ZAOBNW6Y.cjs} +47 -11
- package/dist/chunk-ZAOBNW6Y.cjs.map +1 -0
- package/dist/{chunk-AZBIXGM5.js → chunk-ZXIP5T5V.js} +3 -3
- package/dist/{chunk-AZBIXGM5.js.map → chunk-ZXIP5T5V.js.map} +1 -1
- package/dist/entries/apps.cjs +42 -42
- package/dist/entries/apps.js +7 -7
- package/dist/entries/credits.cjs +150 -150
- package/dist/entries/credits.d.cts +1 -1
- package/dist/entries/credits.d.ts +1 -1
- package/dist/entries/credits.js +7 -7
- package/dist/entries/llm-models.d.cts +1 -1
- package/dist/entries/llm-models.d.ts +1 -1
- package/dist/entries/model-catalog.cjs +66 -66
- package/dist/entries/model-catalog.d.cts +2 -2
- package/dist/entries/model-catalog.d.ts +2 -2
- package/dist/entries/model-catalog.js +4 -4
- package/dist/entries/models.cjs +261 -229
- package/dist/entries/models.d.cts +3 -3
- package/dist/entries/models.d.ts +3 -3
- package/dist/entries/models.js +4 -4
- package/dist/entries/nodes.cjs +206 -206
- package/dist/entries/nodes.d.cts +1 -1
- package/dist/entries/nodes.d.ts +1 -1
- package/dist/entries/nodes.js +8 -8
- package/dist/entries/pipeline.cjs +149 -149
- package/dist/entries/pipeline.d.cts +1 -1
- package/dist/entries/pipeline.d.ts +1 -1
- package/dist/entries/pipeline.js +3 -3
- package/dist/entries/ugc.cjs +71 -71
- package/dist/entries/ugc.js +4 -4
- package/dist/entries/video.cjs +123 -115
- package/dist/entries/video.d.cts +26 -1
- package/dist/entries/video.d.ts +26 -1
- package/dist/entries/video.js +4 -4
- package/dist/index.cjs +1044 -1004
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +17 -17
- package/dist/{model-catalog-I48SvalA.d.ts → model-catalog-dQPdLltX.d.cts} +11 -0
- package/dist/{model-catalog-I48SvalA.d.cts → model-catalog-dQPdLltX.d.ts} +11 -0
- package/dist/{model-constants-C43YS07I.d.ts → model-constants-B5ka4TQr.d.cts} +61 -6
- package/dist/{model-constants-C43YS07I.d.cts → model-constants-B5ka4TQr.d.ts} +61 -6
- package/package.json +1 -1
- package/src/__tests__/gvp-supported-providers.test.ts +8 -1
- package/src/__tests__/kling4-catalog.test.ts +129 -0
- package/src/__tests__/video-character-refs.test.ts +3 -2
- package/src/credit-identifiers.ts +6 -0
- package/src/entries/models.ts +8 -0
- package/src/entries/video.ts +2 -0
- package/src/model-catalog.ts +82 -0
- package/src/model-constants.ts +151 -3
- package/src/node-default-mappings.ts +3 -0
- package/src/video-character-refs.ts +67 -0
- package/src/video-ui-defaults.ts +8 -5
- package/dist/chunk-75ZMA34U.cjs.map +0 -1
- package/dist/chunk-HABDAHZR.cjs.map +0 -1
- package/dist/chunk-JMUHMLJP.js.map +0 -1
- package/dist/chunk-KMNSK7T5.js.map +0 -1
- package/dist/chunk-KOP7UTQR.cjs.map +0 -1
- package/dist/chunk-MSDECC3A.cjs.map +0 -1
- package/dist/chunk-SPP6HQMM.js.map +0 -1
- package/dist/chunk-VRLRPGO7.js.map +0 -1
- package/dist/chunk-W4GABGRD.js +0 -21
- package/dist/chunk-W4GABGRD.js.map +0 -1
- package/dist/chunk-XJ3HJSO5.cjs +0 -25
- package/dist/chunk-XJ3HJSO5.cjs.map +0 -1
- package/dist/chunk-XUISP5BT.cjs.map +0 -1
- package/dist/chunk-ZG4XSEZV.js.map +0 -1
package/src/model-catalog.ts
CHANGED
|
@@ -275,6 +275,17 @@ export interface ModelCatalogEntry {
|
|
|
275
275
|
* lane for a model with no text-to-video mode, instead of the text-to-video
|
|
276
276
|
* lane, whose "image required" gate would refuse it. Requires
|
|
277
277
|
* `"reference-image"` (guarded by `video-reference-only.test.ts`).
|
|
278
|
+
*
|
|
279
|
+
* `"keyframes"` (video models only) means the model's Image References are
|
|
280
|
+
* IN-BETWEEN FRAMES, in order, between the start and end frame — not loose
|
|
281
|
+
* references (Kling 4.0 Keyframes: KIE `keyframe_urls`). The editor names the
|
|
282
|
+
* tray and the mode after it, and generate-video-pro leaves such a model out
|
|
283
|
+
* (its segments would send cast references as frames).
|
|
284
|
+
*
|
|
285
|
+
* `"character-subjects"` (video models only) means a wired Character node
|
|
286
|
+
* reaches the model as a NAMED SUBJECT built from several of its images
|
|
287
|
+
* (`characterReferencesFromWired` → `characterReferences`), not only as a
|
|
288
|
+
* reference image (Kling 4.0: KIE `elements`, `@Name` in the prompt).
|
|
278
289
|
*/
|
|
279
290
|
features?: readonly string[]
|
|
280
291
|
/**
|
|
@@ -460,6 +471,10 @@ const VIDEO_RATIOS_WAN_3 = ["adaptive", "16:9", "4:3", "1:1", "3:4", "9:16"] as
|
|
|
460
471
|
// default 16:9). The image-to-video endpoint takes NO aspect ratio: its output
|
|
461
472
|
// inherits the start frame's shape, so these apply to reference runs only.
|
|
462
473
|
const VIDEO_RATIOS_VIDU_Q4 = ["16:9", "9:16", "1:1", "4:3", "3:4"] as const
|
|
474
|
+
// Kling 4.0 — both endpoints share the enum (docs.kie.ai/market/kling/v4-reference-to-video,
|
|
475
|
+
// /v4-keyframe-to-video). `auto` follows the materials; with none it renders 16:9.
|
|
476
|
+
// The keyframe endpoint ignores the ratio once any frame is attached.
|
|
477
|
+
const VIDEO_RATIOS_KLING_4 = ["auto", "16:9", "9:16", "1:1", "21:9"] as const
|
|
463
478
|
|
|
464
479
|
// =============================================================================
|
|
465
480
|
// IMAGE MODELS
|
|
@@ -1774,6 +1789,73 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
1774
1789
|
{ identifier: "kling-3-omni:15s", credits: 750 },
|
|
1775
1790
|
],
|
|
1776
1791
|
},
|
|
1792
|
+
// Kling 4.0 — two KIE endpoints, two ids (one per entry in the model list).
|
|
1793
|
+
// Reference: docs.kie.ai/market/kling/v4-reference-to-video — text plus up to
|
|
1794
|
+
// 10 reference images, 5 reference videos (2-30s each), 7 subjects and 3
|
|
1795
|
+
// voices (15 materials in all); with none it is plain text-to-video. A wired
|
|
1796
|
+
// start frame joins the reference images. Keyframes:
|
|
1797
|
+
// docs.kie.ai/market/kling/v4-keyframe-to-video — start frame, up to 8
|
|
1798
|
+
// in-between frames (the node's Image References, in order) and an end
|
|
1799
|
+
// frame; with no frame it is text-to-video. Both: 3-30s, 720p/1080p, native
|
|
1800
|
+
// audio always on, no seed. Per-second billing; a reference-video run bills
|
|
1801
|
+
// its input seconds too (ee/billing/ref-video-billing.ts).
|
|
1802
|
+
"kling-4": {
|
|
1803
|
+
id: "kling-4",
|
|
1804
|
+
kind: "video",
|
|
1805
|
+
modes: ["i2v", "t2v"] as const,
|
|
1806
|
+
family: "Kuaishou",
|
|
1807
|
+
maker: "kuaishou",
|
|
1808
|
+
label: "Kling 4.0",
|
|
1809
|
+
series: "Kling",
|
|
1810
|
+
description: "Kling 4.0 — up to 30s with native audio and lip-sync; reference images, videos, characters and voices, or plain text.",
|
|
1811
|
+
useCases: ["premium", "narrative", "cinematic", "reference"],
|
|
1812
|
+
// Reference VIDEOS are taken (VIDEO_REF_LIMITS_BY_PROVIDER `videos: 5`) but
|
|
1813
|
+
// `video-reference` is NOT declared: like wan-3, the generate-video-pro
|
|
1814
|
+
// extend chain (a continuation tail sent as a reference video) is unwired
|
|
1815
|
+
// for it, so the pro node offers it in keyframes mode only.
|
|
1816
|
+
features: ["audio", "reference-image", "reference-to-video", "character-subjects"],
|
|
1817
|
+
aspectRatios: VIDEO_RATIOS_KLING_4,
|
|
1818
|
+
durations: [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
|
|
1819
|
+
defaultDuration: 5,
|
|
1820
|
+
resolutions: ["720p", "1080p"],
|
|
1821
|
+
unlistedResolutionRendersAs: "720p",
|
|
1822
|
+
noSeed: true, // neither Kling 4.0 schema has a `seed` (additionalProperties: false)
|
|
1823
|
+
pricing: [
|
|
1824
|
+
{ identifier: "kling-4", credits: 360, note: "default 5s 720p — see :Ns:res variants for exact" },
|
|
1825
|
+
{ identifier: "kling-4:5s:720p", credits: 360, note: "5s 720p (the default tier)" },
|
|
1826
|
+
{ identifier: "kling-4:5s:1080p", credits: 540, note: "5s 1080p" },
|
|
1827
|
+
{ identifier: "kling-4:3s:720p", credits: 220, note: "3s 720p (min)" },
|
|
1828
|
+
{ identifier: "kling-4:30s:1080p", credits: 3190, note: "30s 1080p (max)" },
|
|
1829
|
+
{ identifier: "kling-4:8s:720p-ref", credits: 340, note: "per-second anchor with a reference video: billed × (output + max(output, input seconds)) ÷ 8" },
|
|
1830
|
+
],
|
|
1831
|
+
},
|
|
1832
|
+
"kling-4-keyframes": {
|
|
1833
|
+
id: "kling-4-keyframes",
|
|
1834
|
+
kind: "video",
|
|
1835
|
+
modes: ["i2v", "t2v"] as const,
|
|
1836
|
+
family: "Kuaishou",
|
|
1837
|
+
maker: "kuaishou",
|
|
1838
|
+
label: "Kling 4.0 Keyframes",
|
|
1839
|
+
series: "Kling",
|
|
1840
|
+
description: "Kling 4.0 Keyframes — start frame, up to 8 in-between frames and an end frame; up to 30s with native audio.",
|
|
1841
|
+
useCases: ["premium", "narrative", "keyframes"],
|
|
1842
|
+
// `reference-to-video`: in-between frames alone (no start frame) run —
|
|
1843
|
+
// KIE takes `keyframe_urls` without `first_frame_url`.
|
|
1844
|
+
features: ["end-frame", "audio", "reference-image", "reference-to-video", "keyframes"],
|
|
1845
|
+
aspectRatios: VIDEO_RATIOS_KLING_4,
|
|
1846
|
+
durations: [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
|
|
1847
|
+
defaultDuration: 5,
|
|
1848
|
+
resolutions: ["720p", "1080p"],
|
|
1849
|
+
unlistedResolutionRendersAs: "720p",
|
|
1850
|
+
noSeed: true,
|
|
1851
|
+
pricing: [
|
|
1852
|
+
{ identifier: "kling-4-keyframes", credits: 360, note: "default 5s 720p — see :Ns:res variants for exact" },
|
|
1853
|
+
{ identifier: "kling-4-keyframes:5s:720p", credits: 360, note: "5s 720p (the default tier)" },
|
|
1854
|
+
{ identifier: "kling-4-keyframes:5s:1080p", credits: 540, note: "5s 1080p" },
|
|
1855
|
+
{ identifier: "kling-4-keyframes:3s:720p", credits: 220, note: "3s 720p (min)" },
|
|
1856
|
+
{ identifier: "kling-4-keyframes:30s:1080p", credits: 3190, note: "30s 1080p (max)" },
|
|
1857
|
+
],
|
|
1858
|
+
},
|
|
1777
1859
|
|
|
1778
1860
|
// ── xAI Grok video ──
|
|
1779
1861
|
"grok-i2v": {
|
package/src/model-constants.ts
CHANGED
|
@@ -247,6 +247,10 @@ export const MAX_VIDEO_PROMPT_CHARS_BY_PROVIDER: Record<string, number> = {
|
|
|
247
247
|
// Vidu Q4 — 20000 chars on both endpoints
|
|
248
248
|
// (docs.kie.ai/market/vidu-q4/image-to-video and /reference-to-video).
|
|
249
249
|
"vidu-q4": 20000,
|
|
250
|
+
// Kling 4.0 — 8000 chars on both endpoints
|
|
251
|
+
// (docs.kie.ai/market/kling/v4-reference-to-video and /v4-keyframe-to-video).
|
|
252
|
+
"kling-4": 8000,
|
|
253
|
+
"kling-4-keyframes": 8000,
|
|
250
254
|
"bytedance-lite": 10000,
|
|
251
255
|
"bytedance-pro": 10000,
|
|
252
256
|
"bytedance-pro-fast": 10000,
|
|
@@ -912,6 +916,11 @@ export const IMAGE_TO_VIDEO_PROVIDERS = [
|
|
|
912
916
|
// endpoints. No text-to-video mode: also listed in TEXT_TO_VIDEO_PROVIDERS's
|
|
913
917
|
// image-required section so the t2v route answers with the friendly 400.
|
|
914
918
|
"vidu-q4",
|
|
919
|
+
// Kling 4.0 — two ids, one per KIE endpoint (reference-to-video and
|
|
920
|
+
// keyframe-to-video). Each endpoint also runs with no image, so each id is
|
|
921
|
+
// listed here AND in TEXT_TO_VIDEO_PROVIDERS's main section (like wan-3).
|
|
922
|
+
"kling-4",
|
|
923
|
+
"kling-4-keyframes",
|
|
915
924
|
"ltx-2.3-pro",
|
|
916
925
|
"ltx-2.3-fast",
|
|
917
926
|
// xAI Grok Imagine Video 1.5 — KIE i2v (image_urls required). Also listed in
|
|
@@ -956,6 +965,10 @@ export const TEXT_TO_VIDEO_PROVIDERS = [
|
|
|
956
965
|
// VIDEO_PROVIDERS_REQUIRING_IMAGE.
|
|
957
966
|
"wan-3",
|
|
958
967
|
"wan-3-prime",
|
|
968
|
+
// Kling 4.0 — both endpoints take a prompt-only run (reference-to-video with
|
|
969
|
+
// no materials, keyframe-to-video with no frame).
|
|
970
|
+
"kling-4",
|
|
971
|
+
"kling-4-keyframes",
|
|
959
972
|
"ltx-2.3-pro",
|
|
960
973
|
"ltx-2.3-fast",
|
|
961
974
|
// ── i2v-only providers (image required) ──────────────────────────────────
|
|
@@ -1103,11 +1116,13 @@ export function videoProviderReferenceSyntax(provider: string | undefined): Vide
|
|
|
1103
1116
|
/**
|
|
1104
1117
|
* Reference-capable video models whose start/end frames ride a channel of
|
|
1105
1118
|
* their OWN (separate frame parameters next to the reference list), so a frame
|
|
1106
|
-
* never occupies a reference seat
|
|
1107
|
-
* `end_image
|
|
1119
|
+
* never occupies a reference seat: `kling-3-omni` (Replicate `start_image` /
|
|
1120
|
+
* `end_image`, no dispatch path today) and Kling 4.0 Keyframes (KIE
|
|
1121
|
+
* `first_frame_url` / `last_frame_url` beside its in-between `keyframe_urls`).
|
|
1108
1122
|
*/
|
|
1109
1123
|
export const VIDEO_PROVIDERS_WITH_SEPARATE_FRAME_CHANNEL: ReadonlySet<string> = new Set([
|
|
1110
1124
|
"kling-3-omni",
|
|
1125
|
+
"kling-4-keyframes",
|
|
1111
1126
|
])
|
|
1112
1127
|
|
|
1113
1128
|
/**
|
|
@@ -1751,6 +1766,10 @@ export const DURATION_PRICED_PROVIDERS = new Set([
|
|
|
1751
1766
|
// Vidu Q4 — per-second billing at five resolution rates, identical on both
|
|
1752
1767
|
// endpoints and with audio on or off.
|
|
1753
1768
|
"vidu-q4",
|
|
1769
|
+
// Kling 4.0 — per-second billing at two resolution rates (plus a reference-
|
|
1770
|
+
// video rate on `kling-4`, see VIDEO_REF_RATE_PROVIDERS).
|
|
1771
|
+
"kling-4",
|
|
1772
|
+
"kling-4-keyframes",
|
|
1754
1773
|
])
|
|
1755
1774
|
|
|
1756
1775
|
/**
|
|
@@ -1895,6 +1914,52 @@ export function normalizeViduQ4Resolution(resolution: string | undefined): "540p
|
|
|
1895
1914
|
}
|
|
1896
1915
|
}
|
|
1897
1916
|
|
|
1917
|
+
/**
|
|
1918
|
+
* Kling 4.0 family — two Nodaro ids over KIE's two Kling 4.0 endpoints:
|
|
1919
|
+
* `kling-4` → `kling-4.0/reference-to-video`, `kling-4-keyframes` →
|
|
1920
|
+
* `kling-4.0/keyframe-to-video`. Exact-membership set.
|
|
1921
|
+
*/
|
|
1922
|
+
export const KLING_4_PROVIDERS = new Set<string>([
|
|
1923
|
+
"kling-4",
|
|
1924
|
+
"kling-4-keyframes",
|
|
1925
|
+
])
|
|
1926
|
+
|
|
1927
|
+
export function isKling4Provider(provider: string | undefined): provider is "kling-4" | "kling-4-keyframes" {
|
|
1928
|
+
return !!provider && KLING_4_PROVIDERS.has(provider)
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
/** Kling 4.0 resolution rendered when the param is omitted or unknown — KIE's
|
|
1932
|
+
* own default and the tier the bare credit identifier prices. */
|
|
1933
|
+
export const KLING_4_DEFAULT_RESOLUTION = "720p"
|
|
1934
|
+
|
|
1935
|
+
/**
|
|
1936
|
+
* SINGLE normalization for the Kling 4.0 resolution lever. The KIE wire enum is
|
|
1937
|
+
* lowercase ("720p" | "1080p"), the same spelling as the catalog and the credit
|
|
1938
|
+
* identifiers; this folds case and collapses anything else to
|
|
1939
|
+
* {@link KLING_4_DEFAULT_RESOLUTION}. The runner sends what this returns and
|
|
1940
|
+
* the credit identifier bills what this returns.
|
|
1941
|
+
*/
|
|
1942
|
+
export function normalizeKling4Resolution(resolution: string | undefined): "720p" | "1080p" {
|
|
1943
|
+
return resolution?.trim().toLowerCase() === "1080p" ? "1080p" : KLING_4_DEFAULT_RESOLUTION
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
/** Most in-between frames Kling 4.0 Keyframes takes (`keyframe_urls`). */
|
|
1947
|
+
export const KLING_4_MAX_MIDDLE_FRAMES = 8
|
|
1948
|
+
|
|
1949
|
+
/**
|
|
1950
|
+
* How many frames IN ALL (start + in-between + end) Kling 4.0 Keyframes
|
|
1951
|
+
* accepts for a clip of `durationSec` seconds — KIE's own table
|
|
1952
|
+
* (docs.kie.ai/market/kling/v4-keyframe-to-video): 3s → 4, 4s → 5 … 8s → 9,
|
|
1953
|
+
* 9s or longer → 10. Live-verified 2026-10-23: 5 frames at 3s is a 422
|
|
1954
|
+
* "duration 3s allows at most 4 frames (first + keyframes + last), got 5".
|
|
1955
|
+
*/
|
|
1956
|
+
export function kling4KeyframeFrameCap(durationSec: number | string | undefined): number {
|
|
1957
|
+
// The length the run renders: the catalog's default when unset, else the
|
|
1958
|
+
// nearest legal second — the same funnel the price reads.
|
|
1959
|
+
const d = pricedOutputDurationSec("kling-4-keyframes", Number.isFinite(Number(durationSec)) ? durationSec : undefined)
|
|
1960
|
+
return Math.min(10, d + 1)
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1898
1963
|
/**
|
|
1899
1964
|
* Google Gemini Omni family — the KIE "gemini-omni-video" market model and its
|
|
1900
1965
|
* faster/cheaper "google/gemini-omni-flash-1-1" sibling. Both take the SAME
|
|
@@ -1987,6 +2052,9 @@ function deriveGvpSupportedProviders(): VideoGenProvider[] {
|
|
|
1987
2052
|
// Must also be dispatchable by the unified video node — the pro route
|
|
1988
2053
|
// hands the provider id straight to the app's imageToVideo.
|
|
1989
2054
|
dispatchable.has(m.id) &&
|
|
2055
|
+
// A keyframes model's Image References are in-between FRAMES, so the
|
|
2056
|
+
// cast references a pro segment sends would land as frames.
|
|
2057
|
+
m.features?.includes("keyframes") !== true &&
|
|
1990
2058
|
// ...and must actually REACH a provider. Capability alone is not
|
|
1991
2059
|
// enough: kling-3-omni passes every check above and still fails at the
|
|
1992
2060
|
// router (see VIDEO_PROVIDERS_WITHOUT_DISPATCH).
|
|
@@ -2386,7 +2454,21 @@ export function checkRefAudioRules(provider: string | undefined, probes: readonl
|
|
|
2386
2454
|
*/
|
|
2387
2455
|
export const VIDEO_REF_LIMITS_BY_PROVIDER: Record<
|
|
2388
2456
|
string,
|
|
2389
|
-
{
|
|
2457
|
+
{
|
|
2458
|
+
images?: number
|
|
2459
|
+
videos?: number
|
|
2460
|
+
audio?: number
|
|
2461
|
+
characters?: number
|
|
2462
|
+
voices?: number
|
|
2463
|
+
/**
|
|
2464
|
+
* Cap on ALL materials together (images + videos + characters + audio),
|
|
2465
|
+
* when the provider counts them as one budget (Kling 4.0: 15). Absent ⇒
|
|
2466
|
+
* no combined cap beyond the per-kind ones — and, for a model declaring
|
|
2467
|
+
* `characters`, the Gemini Omni input-unit budget applies instead
|
|
2468
|
+
* (`videoCharacterRefProblem`).
|
|
2469
|
+
*/
|
|
2470
|
+
materials?: number
|
|
2471
|
+
} | undefined
|
|
2390
2472
|
> = {
|
|
2391
2473
|
// Seedance 2 — full multimodal caps.
|
|
2392
2474
|
"seedance-2": { ...SEEDANCE_2_REF_LIMITS },
|
|
@@ -2421,6 +2503,16 @@ export const VIDEO_REF_LIMITS_BY_PROVIDER: Record<
|
|
|
2421
2503
|
// (images + 2×videos + character_ids ≤ 7).
|
|
2422
2504
|
"gemini-omni-flash": { images: 7, videos: 1, characters: 3, voices: 3 },
|
|
2423
2505
|
"kling-3-omni": { images: 7 }, // catalog/docs: "end frame + up to 7 reference images"
|
|
2506
|
+
// Kling 4.0 Reference — 10 images, 5 videos, 7 subjects (`characters`,
|
|
2507
|
+
// KIE `elements`) and 3 voices (reference audio, KIE `voices`), 15 in all
|
|
2508
|
+
// (docs.kie.ai/market/kling/v4-reference-to-video). A wired start frame takes
|
|
2509
|
+
// one of the 10 image slots. No `voices` key: that names Gemini Omni's
|
|
2510
|
+
// preset personas, which Kling does not take.
|
|
2511
|
+
"kling-4": { images: 10, videos: 5, audio: 3, characters: 7, materials: 15 },
|
|
2512
|
+
// Kling 4.0 Keyframes — the Image References are the in-between frames
|
|
2513
|
+
// (`keyframe_urls`, max 8; the clip's duration lowers the cap, see
|
|
2514
|
+
// kling4KeyframeFrameCap). No reference videos or audio.
|
|
2515
|
+
"kling-4-keyframes": { images: KLING_4_MAX_MIDDLE_FRAMES },
|
|
2424
2516
|
"grok-i2v": { images: 7 }, // backend kie/models.ts maxRefImages: 7
|
|
2425
2517
|
"happyhorse-ref2v": { images: 9 }, // backend kie/models.ts maxRefImages: 9
|
|
2426
2518
|
// VEO 3.x — REFERENCE_2_VIDEO path caps refs at 3 (kie/video.ts slices to
|
|
@@ -2479,6 +2571,10 @@ export const VIDEO_REF_VIDEO_DURATION_LIMITS: Record<string, RefVideoDurationLim
|
|
|
2479
2571
|
// audio side already declares in SEEDANCE_2_R2V_MAX_AUDIO_SEC_BY_PROVIDER
|
|
2480
2572
|
// above, whose h3 row cites the same page.
|
|
2481
2573
|
"minimax-h3": { minSec: 2, maxSec: 15, maxTotalSec: 15 },
|
|
2574
|
+
// Kling 4.0 Reference — "up to 5 clips, each 2–30 seconds", no combined cap
|
|
2575
|
+
// (docs.kie.ai/market/kling/v4-reference-to-video); KIE's own reject reads
|
|
2576
|
+
// "video_1 duration must be between 2 and 30 seconds, got 45".
|
|
2577
|
+
"kling-4": { minSec: 2, maxSec: 30 },
|
|
2482
2578
|
}
|
|
2483
2579
|
|
|
2484
2580
|
/**
|
|
@@ -2568,6 +2664,35 @@ export const RESOLUTION_DURATION_PRICING: Record<string, readonly string[]> = {
|
|
|
2568
2664
|
// PRICING_DEFAULT_RESOLUTION, and normalizeViduQ4Resolution pins the same
|
|
2569
2665
|
// 720p at the wire.
|
|
2570
2666
|
"vidu-q4": ["540p", "720p", "1080p", "2k", "4k"],
|
|
2667
|
+
// Kling 4.0 — per-second billing at two resolution rates on both endpoints.
|
|
2668
|
+
// `kling-4` adds a `-ref` rate for a run with a reference video
|
|
2669
|
+
// (VIDEO_REF_RATE_PROVIDERS).
|
|
2670
|
+
"kling-4": ["720p", "1080p"],
|
|
2671
|
+
"kling-4-keyframes": ["720p", "1080p"],
|
|
2672
|
+
}
|
|
2673
|
+
|
|
2674
|
+
/**
|
|
2675
|
+
* Members of RESOLUTION_DURATION_PRICING that bill a run carrying a reference
|
|
2676
|
+
* VIDEO at a different per-second rate: their identifier gains a `-ref` suffix
|
|
2677
|
+
* after the resolution (`kling-4:8s:720p-ref`). The rate is per second of the
|
|
2678
|
+
* BILLED duration, which the reference-video billing rule
|
|
2679
|
+
* (backend ee/billing/ref-video-billing.ts) computes from the probed clips.
|
|
2680
|
+
*/
|
|
2681
|
+
export const VIDEO_REF_RATE_PROVIDERS = new Set<string>([
|
|
2682
|
+
"kling-4",
|
|
2683
|
+
])
|
|
2684
|
+
|
|
2685
|
+
/**
|
|
2686
|
+
* Video models whose reference-VIDEO runs also bill the clips' own seconds:
|
|
2687
|
+
* the Seedance 2 family (`unit × (input + output)`) and the
|
|
2688
|
+
* VIDEO_REF_RATE_PROVIDERS (Kling 4.0: `unit × (output + max(output, input))`).
|
|
2689
|
+
* The reservation holds the worst case from the probed clips and the
|
|
2690
|
+
* settlement meters down to what was delivered (backend
|
|
2691
|
+
* ee/billing/seedance2-ref-video-credits.ts) — this is the one gate every lane
|
|
2692
|
+
* (routes, orchestrator, worker settlement, reconcile) asks.
|
|
2693
|
+
*/
|
|
2694
|
+
export function billsReferenceVideoSeconds(provider: string | undefined): boolean {
|
|
2695
|
+
return isSeedance2Provider(provider) || (!!provider && VIDEO_REF_RATE_PROVIDERS.has(provider))
|
|
2571
2696
|
}
|
|
2572
2697
|
|
|
2573
2698
|
/**
|
|
@@ -2796,6 +2921,13 @@ export const VIDEO_AUDIO_CAPABILITY: Record<string, VideoAudioCapability> = {
|
|
|
2796
2921
|
// `audio_driven` would reroute the Story→Video dialogue pipeline. Audio is
|
|
2797
2922
|
// priced into the uniform per-second rate (no `:audio` composite).
|
|
2798
2923
|
"vidu-q4": { mode: "ambient", field: "audio", defaultOn: true },
|
|
2924
|
+
// Kling 4.0 — native audio on both endpoints, no lever: neither schema has
|
|
2925
|
+
// an audio switch (the reference endpoint's `keep_original_sound` only picks
|
|
2926
|
+
// between a reference video's own sound and generated sound). Classified
|
|
2927
|
+
// "ambient" on the Wan 3.0 rule until a live probe verifies scripted
|
|
2928
|
+
// dialogue; priced into the per-second rate.
|
|
2929
|
+
"kling-4": { mode: "ambient", alwaysOn: true, defaultOn: true },
|
|
2930
|
+
"kling-4-keyframes": { mode: "ambient", alwaysOn: true, defaultOn: true },
|
|
2799
2931
|
// Gemini Omni (both SKUs — the pro `gemini-omni-video` and the faster
|
|
2800
2932
|
// `gemini-omni-flash`; one model at two speeds, so their rows are identical
|
|
2801
2933
|
// and a test pins that). Settled 2026-09-03 from Google's own documentation
|
|
@@ -2964,6 +3096,10 @@ export const VIDEO_VARIABLE_PRICING: Record<string, "duration" | "duration+audio
|
|
|
2964
3096
|
// Vidu Q4 — per-second billing at five resolution rates; no reference or
|
|
2965
3097
|
// audio dimension.
|
|
2966
3098
|
"vidu-q4": "duration+resolution",
|
|
3099
|
+
// Kling 4.0 — per-second at two resolution rates; `kling-4` adds the
|
|
3100
|
+
// reference-video rate.
|
|
3101
|
+
"kling-4": "duration+resolution+ref",
|
|
3102
|
+
"kling-4-keyframes": "duration+resolution",
|
|
2967
3103
|
}
|
|
2968
3104
|
|
|
2969
3105
|
/**
|
|
@@ -3079,6 +3215,10 @@ export const PRICING_DEFAULT_RESOLUTION: Record<string, string> = {
|
|
|
3079
3215
|
// Vidu Q4 — KIE renders 720p when `resolution` is omitted, and
|
|
3080
3216
|
// normalizeViduQ4Resolution pins the same tier for anything unknown.
|
|
3081
3217
|
"vidu-q4": "720p",
|
|
3218
|
+
// Kling 4.0 — KIE renders 720p when `resolution` is omitted, and
|
|
3219
|
+
// normalizeKling4Resolution pins the same tier for anything unknown.
|
|
3220
|
+
"kling-4": "720p",
|
|
3221
|
+
"kling-4-keyframes": "720p",
|
|
3082
3222
|
}
|
|
3083
3223
|
|
|
3084
3224
|
/** HappyHorse 1.1 per-second tiers — one per allowed duration (3–15s), shared
|
|
@@ -3128,6 +3268,12 @@ const VIDU_Q4_DURATION_TIERS: Array<{ maxSeconds: number; suffix: string }> = Ar
|
|
|
3128
3268
|
(_, i) => ({ maxSeconds: i + 3, suffix: `${i + 3}s` }),
|
|
3129
3269
|
)
|
|
3130
3270
|
|
|
3271
|
+
/** Kling 4.0 per-second tiers — one per allowed duration (3-30s), both ids. */
|
|
3272
|
+
const KLING_4_DURATION_TIERS: Array<{ maxSeconds: number; suffix: string }> = Array.from(
|
|
3273
|
+
{ length: 28 },
|
|
3274
|
+
(_, i) => ({ maxSeconds: i + 3, suffix: `${i + 3}s` }),
|
|
3275
|
+
)
|
|
3276
|
+
|
|
3131
3277
|
/**
|
|
3132
3278
|
* Duration tier breakpoints for variable-priced video models.
|
|
3133
3279
|
* Maps provider → array of { maxSeconds, suffix } in ascending order.
|
|
@@ -3211,6 +3357,8 @@ export const VIDEO_DURATION_TIERS: Record<string, Array<{ maxSeconds: number; su
|
|
|
3211
3357
|
"wan-3": WAN_3_DURATION_TIERS,
|
|
3212
3358
|
"wan-3-prime": WAN_3_DURATION_TIERS,
|
|
3213
3359
|
"vidu-q4": VIDU_Q4_DURATION_TIERS,
|
|
3360
|
+
"kling-4": KLING_4_DURATION_TIERS,
|
|
3361
|
+
"kling-4-keyframes": KLING_4_DURATION_TIERS,
|
|
3214
3362
|
// MiniMax Hailuo 3 — true per-second billing (KIE 36.5 cr/s @2K, 22.5 cr/s
|
|
3215
3363
|
// @768P). One tier per allowed second (4-15s) so the composite identifier
|
|
3216
3364
|
// maps 1:1 to the seeded price — no rounding/overcharge for any on-menu
|
|
@@ -202,6 +202,9 @@ const QUALITY_MAP: Record<string, QualityMapping> = {
|
|
|
202
202
|
// Vidu Q4 — five tiers; the quality rungs stop at 1080p so "high" never
|
|
203
203
|
// lands on the 2k/4k ladder (4k is closed to the free tier).
|
|
204
204
|
"vidu-q4": { field: "resolution", values: { low: "540p", mid: "720p", high: "1080p" } },
|
|
205
|
+
// Kling 4.0 — two tiers on both endpoints.
|
|
206
|
+
"kling-4": { field: "resolution", values: { low: "720p", mid: "720p", high: "1080p" } },
|
|
207
|
+
"kling-4-keyframes": { field: "resolution", values: { low: "720p", mid: "720p", high: "1080p" } },
|
|
205
208
|
"wan-2.7-i2v": { field: "resolution", values: { low: "720p", mid: "1080p", high: "1080p" } },
|
|
206
209
|
"wan-2.7-t2v": { field: "resolution", values: { low: "720p", mid: "1080p", high: "1080p" } },
|
|
207
210
|
"happyhorse": { field: "resolution", values: { low: "720p", mid: "1080p", high: "1080p" } },
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { VIDEO_REF_LIMITS_BY_PROVIDER } from "./model-constants.js"
|
|
2
|
+
import type { ConnectedReference } from "./types.js"
|
|
2
3
|
import type { GeminiOmniVoicePresetId } from "./gemini-omni-voices.js"
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -30,6 +31,13 @@ export interface VideoCharacterReference {
|
|
|
30
31
|
imageUrl: string
|
|
31
32
|
/** Optional full-body image; costs a second input unit. */
|
|
32
33
|
bodyImageUrl?: string
|
|
34
|
+
/**
|
|
35
|
+
* More views of the same person, after the portrait and body image. Read by
|
|
36
|
+
* models whose subject takes several images (Kling 4.0: 2-4 per subject, the
|
|
37
|
+
* portrait first); ignored elsewhere. At most
|
|
38
|
+
* {@link VIDEO_CHARACTER_EXTRA_IMAGES_MAX}.
|
|
39
|
+
*/
|
|
40
|
+
extraImageUrls?: string[]
|
|
33
41
|
/** Who this is: appearance, identity, style, clothing. Required by the upstream. */
|
|
34
42
|
description: string
|
|
35
43
|
/** Optional display name. */
|
|
@@ -48,6 +56,9 @@ export const VIDEO_CHARACTER_REFS_WIRE_MAX = Math.max(
|
|
|
48
56
|
...Object.values(VIDEO_REF_LIMITS_BY_PROVIDER).map((l) => l?.characters ?? 0),
|
|
49
57
|
)
|
|
50
58
|
|
|
59
|
+
/** Most `extraImageUrls` a character reference may carry (Kling 4.0's subject takes 4 images: the portrait + 3). */
|
|
60
|
+
export const VIDEO_CHARACTER_EXTRA_IMAGES_MAX = 3
|
|
61
|
+
|
|
51
62
|
/** Longest `description` / `name` a client may send (route Zod reads these). */
|
|
52
63
|
export const VIDEO_CHARACTER_DESCRIPTION_MAX = 2000
|
|
53
64
|
export const VIDEO_CHARACTER_NAME_MAX = 100
|
|
@@ -175,6 +186,8 @@ export function videoCharacterRefProblem(args: {
|
|
|
175
186
|
hasStartFrame: boolean
|
|
176
187
|
/** True when the request carries an end frame (`endFrameUrl`). */
|
|
177
188
|
hasEndFrame?: boolean
|
|
189
|
+
/** Reference audio clips that will ship (counted by a `materials` budget). */
|
|
190
|
+
audioCount?: number
|
|
178
191
|
}): VideoCharacterRefProblem | null {
|
|
179
192
|
const { provider, characterReferences } = args
|
|
180
193
|
if (!characterReferences || characterReferences.length === 0) return null
|
|
@@ -195,6 +208,24 @@ export function videoCharacterRefProblem(args: {
|
|
|
195
208
|
message: `${provider} accepts at most ${cap} character references; got ${characterReferences.length}.`,
|
|
196
209
|
}
|
|
197
210
|
}
|
|
211
|
+
// A provider that counts every material against ONE budget (Kling 4.0: 15
|
|
212
|
+
// images + videos + subjects + voices) takes characters beside a start frame
|
|
213
|
+
// (the frame joins the reference images) — the Gemini Omni unit rules below
|
|
214
|
+
// do not apply to it.
|
|
215
|
+
const materials = VIDEO_REF_LIMITS_BY_PROVIDER[provider as string]?.materials
|
|
216
|
+
if (materials !== undefined) {
|
|
217
|
+
const used =
|
|
218
|
+
args.imageCount + (args.hasStartFrame ? 1 : 0) + args.videoCount + characterReferences.length + (args.audioCount ?? 0)
|
|
219
|
+
if (used > materials) {
|
|
220
|
+
return {
|
|
221
|
+
code: "character_references_quota",
|
|
222
|
+
message:
|
|
223
|
+
`${provider} takes at most ${materials} materials in all — reference images (a start frame counts as one), ` +
|
|
224
|
+
`reference videos, characters and voices. This request uses ${used}. Remove some.`,
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return videoCharacterVoiceProblem({ provider, characterReferences })
|
|
228
|
+
}
|
|
198
229
|
// A NODARO limit, not an upstream exclusivity: Gemini Omni's start frame is
|
|
199
230
|
// sent as the first entry of `image_urls` (never as `first_frame_url`), so
|
|
200
231
|
// the upstream would take it beside `character_ids`. We reject the pair
|
|
@@ -231,3 +262,39 @@ export function videoCharacterRefProblem(args: {
|
|
|
231
262
|
}
|
|
232
263
|
return videoCharacterVoiceProblem({ provider, characterReferences })
|
|
233
264
|
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* One provider-neutral character reference per wired Character node, for a
|
|
268
|
+
* model that takes wired characters as NAMED SUBJECTS (catalog feature
|
|
269
|
+
* `character-subjects`, Kling 4.0). Input: the wired-character entries both
|
|
270
|
+
* engines already expand (`expandWiredCharacterRefs` server-side, the editor's
|
|
271
|
+
* twin) — the canonical portrait and every variant, grouped here by character.
|
|
272
|
+
* The portrait leads; up to {@link VIDEO_CHARACTER_EXTRA_IMAGES_MAX} more views
|
|
273
|
+
* follow in expansion order. The name is the character's own; the description
|
|
274
|
+
* its canonical description, else its description. A character with a single
|
|
275
|
+
* image still yields a reference — the provider decides (Kling keeps it a
|
|
276
|
+
* reference image).
|
|
277
|
+
*/
|
|
278
|
+
export function characterReferencesFromWired(refs: readonly ConnectedReference[]): VideoCharacterReference[] {
|
|
279
|
+
const bySlug = new Map<string, { name: string; description?: string; urls: string[] }>()
|
|
280
|
+
for (const r of refs) {
|
|
281
|
+
if (r.source !== "wired-character" || !r.characterSlug || !r.url) continue
|
|
282
|
+
let entry = bySlug.get(r.characterSlug)
|
|
283
|
+
if (!entry) {
|
|
284
|
+
entry = { name: r.defaultName.split(" / ")[0]!.trim() || r.characterSlug, urls: [] }
|
|
285
|
+
bySlug.set(r.characterSlug, entry)
|
|
286
|
+
}
|
|
287
|
+
const description = (r.characterCanonicalDescription ?? r.description)?.trim()
|
|
288
|
+
if (!entry.description && description) entry.description = description
|
|
289
|
+
if (entry.urls.includes(r.url)) continue
|
|
290
|
+
// The canonical portrait leads whatever order the variants arrived in.
|
|
291
|
+
if (!r.variantSlug) entry.urls.unshift(r.url)
|
|
292
|
+
else entry.urls.push(r.url)
|
|
293
|
+
}
|
|
294
|
+
return [...bySlug.values()].map((c) => ({
|
|
295
|
+
imageUrl: c.urls[0]!,
|
|
296
|
+
...(c.urls.length > 1 ? { extraImageUrls: c.urls.slice(1, 1 + VIDEO_CHARACTER_EXTRA_IMAGES_MAX) } : {}),
|
|
297
|
+
description: (c.description ?? c.name).slice(0, VIDEO_CHARACTER_DESCRIPTION_MAX),
|
|
298
|
+
name: c.name.slice(0, VIDEO_CHARACTER_NAME_MAX),
|
|
299
|
+
}))
|
|
300
|
+
}
|
package/src/video-ui-defaults.ts
CHANGED
|
@@ -34,21 +34,24 @@ import {
|
|
|
34
34
|
isMinimaxH3Provider,
|
|
35
35
|
isWan3Provider,
|
|
36
36
|
isViduQ4Provider,
|
|
37
|
+
isKling4Provider,
|
|
37
38
|
isGeminiOmniProvider,
|
|
38
39
|
} from "./model-constants.js"
|
|
39
40
|
import { MODEL_CATALOG } from "./model-catalog.js"
|
|
40
41
|
|
|
41
42
|
/** `adaptive` is the aspect default for Seedance 2, MiniMax H3 and Wan 3.0. */
|
|
42
43
|
export function uiAspectRatioFill(provider: string): string | undefined {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
if (isSeedance2Provider(provider) || isMinimaxH3Provider(provider) || isWan3Provider(provider)) return "adaptive"
|
|
45
|
+
// Kling 4.0: `auto` follows the materials (frames / references) and renders
|
|
46
|
+
// 16:9 with none — KIE's own default when the field is omitted.
|
|
47
|
+
if (isKling4Provider(provider)) return "auto"
|
|
48
|
+
return undefined
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
/** See the file docstring — per-family on purpose; never a generic
|
|
49
52
|
* PRICING_DEFAULT_RESOLUTION read (that would reprice seedance-2-5). */
|
|
50
53
|
export function uiResolutionFill(provider: string): string | undefined {
|
|
51
|
-
if (isWan3Provider(provider) || isViduQ4Provider(provider)) return PRICING_DEFAULT_RESOLUTION[provider]
|
|
54
|
+
if (isWan3Provider(provider) || isViduQ4Provider(provider) || isKling4Provider(provider)) return PRICING_DEFAULT_RESOLUTION[provider]
|
|
52
55
|
if (isSeedance2Provider(provider)) return MODEL_CATALOG[provider]?.resolutions?.[0]
|
|
53
56
|
return undefined
|
|
54
57
|
}
|
|
@@ -62,7 +65,7 @@ export function uiResolutionFill(provider: string): string | undefined {
|
|
|
62
65
|
* undefined and the caller keeps `durations[0]`.
|
|
63
66
|
*/
|
|
64
67
|
export function uiDurationFill(provider: string): number | undefined {
|
|
65
|
-
if (isWan3Provider(provider) || isViduQ4Provider(provider)) return 5
|
|
68
|
+
if (isWan3Provider(provider) || isViduQ4Provider(provider) || isKling4Provider(provider)) return 5
|
|
66
69
|
if (isGeminiOmniProvider(provider)) return 8
|
|
67
70
|
return undefined
|
|
68
71
|
}
|