@shop-os/modelkit 0.2.19 → 0.2.21
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 +61 -0
- package/dist/catalog.cjs +343 -184
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +28 -1
- package/dist/catalog.d.ts +28 -1
- package/dist/catalog.js +343 -184
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +514 -328
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +514 -328
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -283,7 +283,9 @@ function geminiImage(id, label, aliases, sizes, display, exposure, references) {
|
|
|
283
283
|
const constraints = {
|
|
284
284
|
aspectRatios: [...GEMINI_RATIOS],
|
|
285
285
|
sizes,
|
|
286
|
-
supports: ["safetySettings", "temperature"]
|
|
286
|
+
supports: ["safetySettings", "temperature"],
|
|
287
|
+
// google-image sends MediaRef.label as a text part beside each reference.
|
|
288
|
+
prompt: { referenceSyntax: "caption" }
|
|
287
289
|
};
|
|
288
290
|
if (references !== void 0) constraints.references = references;
|
|
289
291
|
const model = {
|
|
@@ -570,6 +572,7 @@ var IMAGE_MODELS = [
|
|
|
570
572
|
constraints: {
|
|
571
573
|
aspectRatios: ["1:1", "2:3", "3:2", "16:9", "9:16", "4:3", "3:4", "4:5", "5:4", "21:9"],
|
|
572
574
|
sizes: ["1K"],
|
|
575
|
+
references: { images: 8 },
|
|
573
576
|
// flux-2-pro's job type always returns image/png; only the seed is forwarded.
|
|
574
577
|
supports: ["seed"]
|
|
575
578
|
},
|
|
@@ -1365,12 +1368,14 @@ var TEXT_MODELS = [
|
|
|
1365
1368
|
var VIDEO_USAGE = { unit: "seconds" };
|
|
1366
1369
|
var SEEDANCE_RATIOS = ["21:9", "16:9", "4:3", "1:1", "3:4", "9:16", "adaptive"];
|
|
1367
1370
|
var KLING_RATIOS = ["16:9", "9:16", "1:1", "adaptive"];
|
|
1371
|
+
var KLING_OMNI_RATIOS = ["16:9", "9:16", "1:1"];
|
|
1368
1372
|
var OMNI_RATIOS = ["16:9", "9:16"];
|
|
1369
1373
|
var GROK_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3"];
|
|
1370
1374
|
var H3_RATIOS = ["21:9", "16:9", "4:3", "1:1", "3:4", "9:16"];
|
|
1371
1375
|
var H3_REFERENCE_RATIOS = ["adaptive", ...H3_RATIOS];
|
|
1372
1376
|
var NEGATIVE_PROMPT = "blur, distort, and low quality";
|
|
1373
1377
|
var FRAMES_EXCLUDE_REFERENCES = { framesExcludeReferences: true };
|
|
1378
|
+
var KLING_PROMPT = { referenceSyntax: "numbered", maxChars: 2500 };
|
|
1374
1379
|
var BYTEDANCE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png";
|
|
1375
1380
|
var GOOGLE_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
|
|
1376
1381
|
var VIDEO_MODELS = [
|
|
@@ -1391,9 +1396,14 @@ var VIDEO_MODELS = [
|
|
|
1391
1396
|
constraints: {
|
|
1392
1397
|
aspectRatios: [...OMNI_RATIOS],
|
|
1393
1398
|
resolutions: ["720p", "1080p", "4k"],
|
|
1399
|
+
// Veo also takes 4 and 6, but must be 8 at 1080p/4k or with reference images;
|
|
1400
|
+
// [8] until the kit has a rule that forces it there (CHANGELOG 0.2.21).
|
|
1394
1401
|
durations: [8],
|
|
1395
1402
|
references: { images: 3 },
|
|
1396
|
-
supports: ["lastFrame", "seed"]
|
|
1403
|
+
supports: ["lastFrame", "seed"],
|
|
1404
|
+
// 1,024 text tokens; 3,000 characters assumes ~2.9 characters per token.
|
|
1405
|
+
prompt: { referenceSyntax: "numbered", maxChars: 3e3 },
|
|
1406
|
+
audio: "always"
|
|
1397
1407
|
},
|
|
1398
1408
|
defaults: { durationSeconds: 8, resolution: "720p", aspectRatio: "16:9" },
|
|
1399
1409
|
usage: { ...VIDEO_USAGE, slug: "veo" },
|
|
@@ -1403,7 +1413,8 @@ var VIDEO_MODELS = [
|
|
|
1403
1413
|
description: "Google's highest-quality video generation model. Supports up to 4K resolution and 8-second clips with reference image conditioning.",
|
|
1404
1414
|
logo: GOOGLE_LOGO2
|
|
1405
1415
|
},
|
|
1406
|
-
|
|
1416
|
+
// Veo's lastFrame "must be used in combination with the image parameter".
|
|
1417
|
+
capabilities: { ...FRAMES_EXCLUDE_REFERENCES, lastFrameRequiresFirstFrame: true }
|
|
1407
1418
|
},
|
|
1408
1419
|
{
|
|
1409
1420
|
id: "veo-3.1-fast",
|
|
@@ -1423,7 +1434,8 @@ var VIDEO_MODELS = [
|
|
|
1423
1434
|
resolutions: ["720p", "1080p", "4k"],
|
|
1424
1435
|
durations: [4, 6, 8],
|
|
1425
1436
|
references: { images: 3 },
|
|
1426
|
-
supports: ["lastFrame", "seed"]
|
|
1437
|
+
supports: ["lastFrame", "seed"],
|
|
1438
|
+
audio: "always"
|
|
1427
1439
|
},
|
|
1428
1440
|
defaults: { durationSeconds: 8, resolution: "720p", aspectRatio: "16:9" },
|
|
1429
1441
|
usage: { ...VIDEO_USAGE },
|
|
@@ -1451,7 +1463,8 @@ var VIDEO_MODELS = [
|
|
|
1451
1463
|
aspectRatios: [...OMNI_RATIOS],
|
|
1452
1464
|
resolutions: ["720p", "1080p"],
|
|
1453
1465
|
durations: [4, 6, 8],
|
|
1454
|
-
supports: ["lastFrame", "seed"]
|
|
1466
|
+
supports: ["lastFrame", "seed"],
|
|
1467
|
+
audio: "always"
|
|
1455
1468
|
},
|
|
1456
1469
|
defaults: { durationSeconds: 8, resolution: "720p", aspectRatio: "16:9" },
|
|
1457
1470
|
usage: { ...VIDEO_USAGE },
|
|
@@ -1485,7 +1498,10 @@ var VIDEO_MODELS = [
|
|
|
1485
1498
|
durations: [3, 4, 5, 6, 7, 8, 9, 10],
|
|
1486
1499
|
references: { images: 6, videos: 1, videoSeconds: { max: 10 } },
|
|
1487
1500
|
sourceVideoSeconds: { max: 10 },
|
|
1488
|
-
supports: []
|
|
1501
|
+
supports: [],
|
|
1502
|
+
// generateOmniVideo sends MediaRef.label as a text part beside each image.
|
|
1503
|
+
prompt: { referenceSyntax: "caption" },
|
|
1504
|
+
audio: "always"
|
|
1489
1505
|
},
|
|
1490
1506
|
defaults: {},
|
|
1491
1507
|
usage: { ...VIDEO_USAGE, slug: "gemini_omni" },
|
|
@@ -1518,8 +1534,12 @@ var VIDEO_MODELS = [
|
|
|
1518
1534
|
// extension can upload a <= 10 s source with task "extend"; later ones
|
|
1519
1535
|
// chain by `previousInteractionId` (the API rejects the id together
|
|
1520
1536
|
// with a video task, so those calls carry the prompt alone).
|
|
1521
|
-
|
|
1522
|
-
|
|
1537
|
+
// First-to-last-frame interpolation: `<LAST_FRAME>` goes with `<FIRST_FRAME>`.
|
|
1538
|
+
supports: ["videoExtension", "lastFrame"],
|
|
1539
|
+
extension: { segmentSeconds: 10, maxTotalSeconds: 40 },
|
|
1540
|
+
// generateOmniVideo sends MediaRef.label as a text part beside each image.
|
|
1541
|
+
prompt: { referenceSyntax: "caption" },
|
|
1542
|
+
audio: "always"
|
|
1523
1543
|
},
|
|
1524
1544
|
defaults: {},
|
|
1525
1545
|
usage: { ...VIDEO_USAGE },
|
|
@@ -1529,7 +1549,7 @@ var VIDEO_MODELS = [
|
|
|
1529
1549
|
logo: GOOGLE_LOGO2,
|
|
1530
1550
|
description: "Google Gemini Omni Flash 1.1 conversational video generation, editing and extension; text, image, and up to 10-second video input, 3-10 second output at up to 4K and 24 FPS, extendable to 40 seconds."
|
|
1531
1551
|
},
|
|
1532
|
-
capabilities: { acceptsSourceVideo: true }
|
|
1552
|
+
capabilities: { acceptsSourceVideo: true, lastFrameRequiresFirstFrame: true }
|
|
1533
1553
|
},
|
|
1534
1554
|
{
|
|
1535
1555
|
// vibe-triggers and Space Builder drop the ratio when a frame is wired; Cowork always sends it.
|
|
@@ -1555,7 +1575,9 @@ var VIDEO_MODELS = [
|
|
|
1555
1575
|
},
|
|
1556
1576
|
sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
|
|
1557
1577
|
ratioIgnoredWith: ["firstFrame", "sourceVideo"],
|
|
1558
|
-
|
|
1578
|
+
// No seed: 2.x echoes it but does not honour it (two seeded runs differed, 2026-10-01).
|
|
1579
|
+
supports: ["generateAudio", "lastFrame", "watermark"],
|
|
1580
|
+
audio: "optional"
|
|
1559
1581
|
},
|
|
1560
1582
|
defaults: {
|
|
1561
1583
|
durationSeconds: 5,
|
|
@@ -1594,7 +1616,9 @@ var VIDEO_MODELS = [
|
|
|
1594
1616
|
},
|
|
1595
1617
|
sourceVideoSeconds: { min: 2, max: 15, inReferenceTotal: true },
|
|
1596
1618
|
ratioIgnoredWith: ["firstFrame", "sourceVideo"],
|
|
1597
|
-
|
|
1619
|
+
// No seed: 2.x echoes it but does not honour it (two seeded runs differed, 2026-10-01).
|
|
1620
|
+
supports: ["generateAudio", "lastFrame", "watermark"],
|
|
1621
|
+
audio: "optional"
|
|
1598
1622
|
},
|
|
1599
1623
|
defaults: {
|
|
1600
1624
|
durationSeconds: 5,
|
|
@@ -1612,7 +1636,6 @@ var VIDEO_MODELS = [
|
|
|
1612
1636
|
capabilities: { acceptsSourceVideo: true, ...FRAMES_EXCLUDE_REFERENCES }
|
|
1613
1637
|
},
|
|
1614
1638
|
{
|
|
1615
|
-
// generateAudio defaults to false here (trigger-workflows); Space Builder defaults it to true.
|
|
1616
1639
|
// omni_reference_task_type edit/extend: adaptive ratio, edit sends duration -1.
|
|
1617
1640
|
id: "seedance-2.5",
|
|
1618
1641
|
aliases: ["seedance-2-5", "dreamina-seedance-2-5-260628"],
|
|
@@ -1634,13 +1657,15 @@ var VIDEO_MODELS = [
|
|
|
1634
1657
|
},
|
|
1635
1658
|
sourceVideoSeconds: { min: 2, max: 30, editMin: 4, inReferenceTotal: true },
|
|
1636
1659
|
ratioIgnoredWith: ["firstFrame", "sourceVideo"],
|
|
1637
|
-
|
|
1660
|
+
// No seed: 2.x echoes it but does not honour it (two seeded runs differed, 2026-10-01).
|
|
1661
|
+
supports: ["generateAudio", "lastFrame", "watermark", "taskType"],
|
|
1662
|
+
audio: "optional"
|
|
1638
1663
|
},
|
|
1639
1664
|
defaults: {
|
|
1640
1665
|
durationSeconds: 5,
|
|
1641
1666
|
resolution: "720p",
|
|
1642
1667
|
aspectRatio: "16:9",
|
|
1643
|
-
generateAudio:
|
|
1668
|
+
generateAudio: true
|
|
1644
1669
|
},
|
|
1645
1670
|
usage: { ...VIDEO_USAGE },
|
|
1646
1671
|
pricingKind: "video_per_second",
|
|
@@ -1652,7 +1677,6 @@ var VIDEO_MODELS = [
|
|
|
1652
1677
|
capabilities: { acceptsSourceVideo: true, ...FRAMES_EXCLUDE_REFERENCES }
|
|
1653
1678
|
},
|
|
1654
1679
|
{
|
|
1655
|
-
// Cowork allows 7 reference images and durations 4/6/8/10; Space Builder allows 5 and 1-15s.
|
|
1656
1680
|
id: "grok-imagine",
|
|
1657
1681
|
aliases: ["grok-imagine-video", "grokImagine"],
|
|
1658
1682
|
label: "Grok Imagine",
|
|
@@ -1666,8 +1690,11 @@ var VIDEO_MODELS = [
|
|
|
1666
1690
|
resolutions: ["480p", "720p"],
|
|
1667
1691
|
durations: { min: 1, max: 15 },
|
|
1668
1692
|
durationPresets: [4, 6, 8, 10],
|
|
1669
|
-
|
|
1670
|
-
|
|
1693
|
+
// xAI: "A maximum of 7 reference images can be provided per request."
|
|
1694
|
+
references: { images: 7 },
|
|
1695
|
+
supports: [],
|
|
1696
|
+
// xAI can switch sound off (generate_audio); xai-video.ts never sends it.
|
|
1697
|
+
audio: "always"
|
|
1671
1698
|
},
|
|
1672
1699
|
// No resolution default: xAI picks its own unless the caller asks.
|
|
1673
1700
|
defaults: { durationSeconds: 8, aspectRatio: "16:9" },
|
|
@@ -1689,15 +1716,16 @@ var VIDEO_MODELS = [
|
|
|
1689
1716
|
providerModelId: "kling-video/v2.5-turbo/pro/image-to-video",
|
|
1690
1717
|
lifecycle: "active",
|
|
1691
1718
|
exposure: ["cowork", "space_builder"],
|
|
1719
|
+
// The endpoint has no aspect_ratio or last_image_url: the start image sets the framing.
|
|
1692
1720
|
constraints: {
|
|
1693
|
-
aspectRatios: [...KLING_RATIOS],
|
|
1694
1721
|
durations: [5, 10],
|
|
1695
1722
|
requires: ["firstFrame"],
|
|
1696
|
-
supports: ["cfgScale", "negativePrompt",
|
|
1723
|
+
supports: ["cfgScale", "negativePrompt"],
|
|
1724
|
+
prompt: KLING_PROMPT,
|
|
1725
|
+
audio: "never"
|
|
1697
1726
|
},
|
|
1698
1727
|
defaults: {
|
|
1699
1728
|
durationSeconds: 5,
|
|
1700
|
-
aspectRatio: "16:9",
|
|
1701
1729
|
cfgScale: 0.5,
|
|
1702
1730
|
negativePrompt: NEGATIVE_PROMPT
|
|
1703
1731
|
},
|
|
@@ -1706,7 +1734,7 @@ var VIDEO_MODELS = [
|
|
|
1706
1734
|
display: {
|
|
1707
1735
|
provider: "kuaishou",
|
|
1708
1736
|
logo: "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/kling-color.png",
|
|
1709
|
-
description: "Kuaishou Kling 2.5 Turbo Pro image-to-video; animates a single input image from a text prompt
|
|
1737
|
+
description: "Kuaishou Kling 2.5 Turbo Pro image-to-video; animates a single input image from a text prompt, 5- or 10-second clips."
|
|
1710
1738
|
},
|
|
1711
1739
|
capabilities: { ...FRAMES_EXCLUDE_REFERENCES }
|
|
1712
1740
|
},
|
|
@@ -1720,17 +1748,18 @@ var VIDEO_MODELS = [
|
|
|
1720
1748
|
providerModelId: "kling-video/v3.0/pro/image-to-video",
|
|
1721
1749
|
lifecycle: "active",
|
|
1722
1750
|
exposure: ["cowork", "space_builder"],
|
|
1751
|
+
// The endpoint has no aspect_ratio or negative_prompt; sound is "on"/"off" (default on).
|
|
1723
1752
|
constraints: {
|
|
1724
|
-
aspectRatios: [...KLING_RATIOS],
|
|
1725
1753
|
durations: { min: 3, max: 15 },
|
|
1726
1754
|
requires: ["firstFrame"],
|
|
1727
|
-
supports: ["cfgScale", "
|
|
1755
|
+
supports: ["cfgScale", "lastFrame", "generateAudio"],
|
|
1756
|
+
prompt: KLING_PROMPT,
|
|
1757
|
+
audio: "optional"
|
|
1728
1758
|
},
|
|
1729
1759
|
defaults: {
|
|
1730
1760
|
durationSeconds: 5,
|
|
1731
|
-
aspectRatio: "16:9",
|
|
1732
1761
|
cfgScale: 0.5,
|
|
1733
|
-
|
|
1762
|
+
generateAudio: true
|
|
1734
1763
|
},
|
|
1735
1764
|
usage: { ...VIDEO_USAGE },
|
|
1736
1765
|
pricingKind: "video_per_second",
|
|
@@ -1742,7 +1771,7 @@ var VIDEO_MODELS = [
|
|
|
1742
1771
|
capabilities: { ...FRAMES_EXCLUDE_REFERENCES }
|
|
1743
1772
|
},
|
|
1744
1773
|
{
|
|
1745
|
-
// mode standard/pro selects 720p/1080p; the endpoint takes no separate resolution.
|
|
1774
|
+
// mode standard/pro/4k selects 720p/1080p/4K; the endpoint takes no separate resolution.
|
|
1746
1775
|
// Replicate: "Max 7 [images] without video, 4 with video"; 4K does not support
|
|
1747
1776
|
// reference_video. No `videos` limit yet: the adapter sends no reference video,
|
|
1748
1777
|
// so `imagesWithVideo` stays dormant until one is wired through.
|
|
@@ -1755,21 +1784,25 @@ var VIDEO_MODELS = [
|
|
|
1755
1784
|
lifecycle: "active",
|
|
1756
1785
|
exposure: ["cowork", "space_builder"],
|
|
1757
1786
|
constraints: {
|
|
1758
|
-
aspectRatios: [...
|
|
1759
|
-
resolutions: ["720p", "1080p"],
|
|
1787
|
+
aspectRatios: [...KLING_OMNI_RATIOS],
|
|
1788
|
+
resolutions: ["720p", "1080p", "4k"],
|
|
1760
1789
|
durations: { min: 3, max: 15 },
|
|
1761
1790
|
references: { images: 7, imagesWithVideo: 4 },
|
|
1762
|
-
supports: ["generateAudio", "lastFrame"]
|
|
1791
|
+
supports: ["generateAudio", "lastFrame"],
|
|
1792
|
+
prompt: KLING_PROMPT,
|
|
1793
|
+
audio: "optional"
|
|
1763
1794
|
},
|
|
1764
|
-
defaults: { durationSeconds: 5, aspectRatio: "16:9", generateAudio:
|
|
1795
|
+
defaults: { durationSeconds: 5, aspectRatio: "16:9", generateAudio: true, mode: "pro" },
|
|
1765
1796
|
usage: { unit: "compute_seconds" },
|
|
1766
1797
|
pricingKind: "video_per_second",
|
|
1767
1798
|
display: {
|
|
1768
1799
|
provider: "kuaishou",
|
|
1769
1800
|
logo: "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/kling-color.png",
|
|
1770
|
-
description: "Kuaishou Kling Video 3.0 Omni unified generation and editing from text, start/end images, up to 7 reference images, and reference video; up to 15 seconds at up to
|
|
1771
|
-
}
|
|
1772
|
-
|
|
1801
|
+
description: "Kuaishou Kling Video 3.0 Omni unified generation and editing from text, start/end images, up to 7 reference images, and reference video; up to 15 seconds at up to 4K."
|
|
1802
|
+
}
|
|
1803
|
+
// end_image "Requires start_image", but no lastFrameRequiresFirstFrame: SpaceLab resolves
|
|
1804
|
+
// replicate rows in error mode, so the flag would refuse its end-frame-only nodes, which
|
|
1805
|
+
// the adapter sends as start_image.
|
|
1773
1806
|
},
|
|
1774
1807
|
{
|
|
1775
1808
|
id: "minimax-h3",
|
|
@@ -1784,7 +1817,10 @@ var VIDEO_MODELS = [
|
|
|
1784
1817
|
aspectRatios: [...H3_RATIOS],
|
|
1785
1818
|
resolutions: ["480p", "768p", "2k", "4k"],
|
|
1786
1819
|
durations: { min: 5, max: 15 },
|
|
1787
|
-
|
|
1820
|
+
// fal's image-to-video endpoint has no aspect_ratio; the frame sets it.
|
|
1821
|
+
ratioIgnoredWith: ["firstFrame"],
|
|
1822
|
+
supports: ["seed", "promptExpansion", "lastFrame", "safetyChecker"],
|
|
1823
|
+
audio: "always"
|
|
1788
1824
|
},
|
|
1789
1825
|
defaults: {
|
|
1790
1826
|
durationSeconds: 5,
|
|
@@ -1812,9 +1848,12 @@ var VIDEO_MODELS = [
|
|
|
1812
1848
|
exposure: ["cowork", "space_builder"],
|
|
1813
1849
|
constraints: {
|
|
1814
1850
|
aspectRatios: [...H3_RATIOS],
|
|
1815
|
-
resolutions: ["480p", "768p"],
|
|
1851
|
+
resolutions: ["480p", "768p", "1080p"],
|
|
1816
1852
|
durations: { min: 5, max: 15 },
|
|
1817
|
-
|
|
1853
|
+
// fal's image-to-video endpoint has no aspect_ratio; the frame sets it.
|
|
1854
|
+
ratioIgnoredWith: ["firstFrame"],
|
|
1855
|
+
supports: ["seed", "promptExpansion", "lastFrame", "safetyChecker"],
|
|
1856
|
+
audio: "always"
|
|
1818
1857
|
},
|
|
1819
1858
|
defaults: {
|
|
1820
1859
|
durationSeconds: 5,
|
|
@@ -1827,7 +1866,7 @@ var VIDEO_MODELS = [
|
|
|
1827
1866
|
display: {
|
|
1828
1867
|
provider: "minimax",
|
|
1829
1868
|
logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png",
|
|
1830
|
-
description: "High-speed MiniMax H3 Max variant for text-to-video and image-to-video (first/last frame) only, up to
|
|
1869
|
+
description: "High-speed MiniMax H3 Max variant for text-to-video and image-to-video (first/last frame) only, up to 1080p."
|
|
1831
1870
|
},
|
|
1832
1871
|
capabilities: { ...FRAMES_EXCLUDE_REFERENCES }
|
|
1833
1872
|
},
|
|
@@ -1844,6 +1883,8 @@ var VIDEO_MODELS = [
|
|
|
1844
1883
|
aspectRatios: [...H3_REFERENCE_RATIOS],
|
|
1845
1884
|
resolutions: ["480p", "768p", "2k", "4k"],
|
|
1846
1885
|
durations: { min: 5, max: 15 },
|
|
1886
|
+
// A start frame routes to image-to-video, which has no aspect_ratio.
|
|
1887
|
+
ratioIgnoredWith: ["firstFrame"],
|
|
1847
1888
|
references: {
|
|
1848
1889
|
images: 9,
|
|
1849
1890
|
videos: 3,
|
|
@@ -1852,7 +1893,8 @@ var VIDEO_MODELS = [
|
|
|
1852
1893
|
audioOnly: false,
|
|
1853
1894
|
videoSeconds: { min: 2, max: 15, total: 15 }
|
|
1854
1895
|
},
|
|
1855
|
-
supports: ["seed", "promptExpansion", "safetyChecker"]
|
|
1896
|
+
supports: ["seed", "promptExpansion", "safetyChecker"],
|
|
1897
|
+
audio: "always"
|
|
1856
1898
|
},
|
|
1857
1899
|
defaults: {
|
|
1858
1900
|
durationSeconds: 5,
|
|
@@ -1867,7 +1909,9 @@ var VIDEO_MODELS = [
|
|
|
1867
1909
|
logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png",
|
|
1868
1910
|
description: "MiniMax H3 reference-to-video mode guided by up to 9 reference images, 3 reference videos, and 3 audio clips; reference and image-to-video inputs cannot be mixed."
|
|
1869
1911
|
},
|
|
1870
|
-
|
|
1912
|
+
// fal's reference-to-video endpoint never reads a frame; the resolver must drop the
|
|
1913
|
+
// references instead of the adapter silently dropping the frame.
|
|
1914
|
+
capabilities: { ...FRAMES_EXCLUDE_REFERENCES }
|
|
1871
1915
|
},
|
|
1872
1916
|
{
|
|
1873
1917
|
id: "minimax-h3-max-reference",
|
|
@@ -1880,8 +1924,10 @@ var VIDEO_MODELS = [
|
|
|
1880
1924
|
exposure: ["cowork", "space_builder"],
|
|
1881
1925
|
constraints: {
|
|
1882
1926
|
aspectRatios: [...H3_REFERENCE_RATIOS],
|
|
1883
|
-
resolutions: ["480p", "768p"],
|
|
1927
|
+
resolutions: ["480p", "768p", "1080p"],
|
|
1884
1928
|
durations: { min: 5, max: 15 },
|
|
1929
|
+
// A start frame routes to image-to-video, which has no aspect_ratio.
|
|
1930
|
+
ratioIgnoredWith: ["firstFrame"],
|
|
1885
1931
|
references: {
|
|
1886
1932
|
images: 9,
|
|
1887
1933
|
videos: 3,
|
|
@@ -1890,7 +1936,8 @@ var VIDEO_MODELS = [
|
|
|
1890
1936
|
audioOnly: false,
|
|
1891
1937
|
videoSeconds: { min: 2, max: 15, total: 15 }
|
|
1892
1938
|
},
|
|
1893
|
-
supports: ["seed", "promptExpansion", "safetyChecker"]
|
|
1939
|
+
supports: ["seed", "promptExpansion", "safetyChecker"],
|
|
1940
|
+
audio: "always"
|
|
1894
1941
|
},
|
|
1895
1942
|
defaults: {
|
|
1896
1943
|
durationSeconds: 5,
|
|
@@ -1905,7 +1952,9 @@ var VIDEO_MODELS = [
|
|
|
1905
1952
|
logo: "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png",
|
|
1906
1953
|
description: "MiniMax H3 Max reference-to-video on fal; conditions on reference images, videos, and audio. MiniMax's own docs do not list a reference mode for H3 Max."
|
|
1907
1954
|
},
|
|
1908
|
-
|
|
1955
|
+
// fal's reference-to-video endpoint never reads a frame; the resolver must drop the
|
|
1956
|
+
// references instead of the adapter silently dropping the frame.
|
|
1957
|
+
capabilities: { ...FRAMES_EXCLUDE_REFERENCES }
|
|
1909
1958
|
},
|
|
1910
1959
|
{
|
|
1911
1960
|
// Duration 3-10s per trigger-workflows mapDuration; the endpoint takes no resolution.
|
|
@@ -1922,7 +1971,8 @@ var VIDEO_MODELS = [
|
|
|
1922
1971
|
durations: { min: 3, max: 10 },
|
|
1923
1972
|
requires: ["sourceVideo"],
|
|
1924
1973
|
sourceVideoSeconds: { min: 3, max: 10.05 },
|
|
1925
|
-
supports: []
|
|
1974
|
+
supports: [],
|
|
1975
|
+
audio: "never"
|
|
1926
1976
|
},
|
|
1927
1977
|
defaults: { durationSeconds: 5, aspectRatio: "16:9" },
|
|
1928
1978
|
usage: { ...VIDEO_USAGE },
|
|
@@ -1946,7 +1996,8 @@ var VIDEO_MODELS = [
|
|
|
1946
1996
|
constraints: {
|
|
1947
1997
|
resolutions: ["768p"],
|
|
1948
1998
|
durations: [6, 10],
|
|
1949
|
-
supports: ["lastFrame"]
|
|
1999
|
+
supports: ["lastFrame"],
|
|
2000
|
+
audio: "never"
|
|
1950
2001
|
},
|
|
1951
2002
|
defaults: { durationSeconds: 6, resolution: "768p" },
|
|
1952
2003
|
usage: { unit: "compute_seconds" },
|
|
@@ -1969,7 +2020,8 @@ var VIDEO_MODELS = [
|
|
|
1969
2020
|
exposure: [],
|
|
1970
2021
|
constraints: {
|
|
1971
2022
|
requires: ["firstFrame"],
|
|
1972
|
-
supports: ["seed", "lastFrame"]
|
|
2023
|
+
supports: ["seed", "lastFrame"],
|
|
2024
|
+
audio: "never"
|
|
1973
2025
|
},
|
|
1974
2026
|
defaults: {},
|
|
1975
2027
|
usage: { ...VIDEO_USAGE },
|
|
@@ -1991,7 +2043,7 @@ var MODELS = [
|
|
|
1991
2043
|
];
|
|
1992
2044
|
|
|
1993
2045
|
// src/catalog/schema.ts
|
|
1994
|
-
var
|
|
2046
|
+
var import_zod3 = require("zod");
|
|
1995
2047
|
|
|
1996
2048
|
// src/catalog/collisions.ts
|
|
1997
2049
|
function collisionIssues(rows) {
|
|
@@ -2038,8 +2090,57 @@ function collisionIssues(rows) {
|
|
|
2038
2090
|
return issues;
|
|
2039
2091
|
}
|
|
2040
2092
|
|
|
2041
|
-
// src/catalog/
|
|
2093
|
+
// src/catalog/conventions.ts
|
|
2042
2094
|
var import_zod = require("zod");
|
|
2095
|
+
var AudioOutputSchema = import_zod.z.enum(["always", "optional", "never"]);
|
|
2096
|
+
var ReferenceSyntaxSchema = import_zod.z.enum(["numbered", "caption", "descriptive"]);
|
|
2097
|
+
var MaxCharsSchema = import_zod.z.number().int().positive();
|
|
2098
|
+
var PromptConventionsSchema = import_zod.z.strictObject({
|
|
2099
|
+
referenceSyntax: ReferenceSyntaxSchema,
|
|
2100
|
+
maxChars: MaxCharsSchema.optional()
|
|
2101
|
+
});
|
|
2102
|
+
var AUDIO_OUTPUTS = AudioOutputSchema.options;
|
|
2103
|
+
var REFERENCE_SYNTAXES = ReferenceSyntaxSchema.options;
|
|
2104
|
+
var ConstraintsReadView = import_zod.z.looseObject({
|
|
2105
|
+
audio: AudioOutputSchema.optional().catch(void 0),
|
|
2106
|
+
prompt: import_zod.z.looseObject({
|
|
2107
|
+
referenceSyntax: ReferenceSyntaxSchema.catch("numbered"),
|
|
2108
|
+
maxChars: MaxCharsSchema.optional().catch(void 0)
|
|
2109
|
+
}).optional().catch(void 0)
|
|
2110
|
+
});
|
|
2111
|
+
var DEFAULT_CONVENTIONS = { referenceSyntax: "numbered" };
|
|
2112
|
+
function promptConventions(row) {
|
|
2113
|
+
const view = ConstraintsReadView.safeParse(row.constraints);
|
|
2114
|
+
const prompt = view.success ? view.data.prompt : void 0;
|
|
2115
|
+
if (prompt === void 0) return { ...DEFAULT_CONVENTIONS };
|
|
2116
|
+
const result = { referenceSyntax: prompt.referenceSyntax };
|
|
2117
|
+
if (prompt.maxChars !== void 0) result.maxChars = prompt.maxChars;
|
|
2118
|
+
return result;
|
|
2119
|
+
}
|
|
2120
|
+
var RawConventionsView = import_zod.z.looseObject({
|
|
2121
|
+
audio: import_zod.z.unknown().optional(),
|
|
2122
|
+
prompt: import_zod.z.unknown().optional()
|
|
2123
|
+
});
|
|
2124
|
+
function normaliseConventions(row) {
|
|
2125
|
+
const view = RawConventionsView.safeParse(row.constraints);
|
|
2126
|
+
if (!view.success) return { row, invalidKeys: [] };
|
|
2127
|
+
const { audio, prompt } = view.data;
|
|
2128
|
+
const badAudio = audio !== void 0 && !AudioOutputSchema.safeParse(audio).success;
|
|
2129
|
+
const badPrompt = prompt !== void 0 && !PromptConventionsSchema.safeParse(prompt).success;
|
|
2130
|
+
if (!badAudio && !badPrompt) return { row, invalidKeys: [] };
|
|
2131
|
+
const invalidKeys = [];
|
|
2132
|
+
if (badAudio) invalidKeys.push("constraints.audio");
|
|
2133
|
+
if (badPrompt) invalidKeys.push("constraints.prompt");
|
|
2134
|
+
const entries = Object.entries(row.constraints).flatMap(([key, value]) => {
|
|
2135
|
+
if (key === "audio" && badAudio) return [];
|
|
2136
|
+
if (key === "prompt" && badPrompt) return [[key, promptConventions(row)]];
|
|
2137
|
+
return [[key, value]];
|
|
2138
|
+
});
|
|
2139
|
+
return { row: { ...row, constraints: Object.fromEntries(entries) }, invalidKeys };
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
// src/catalog/input-spec.ts
|
|
2143
|
+
var import_zod2 = require("zod");
|
|
2043
2144
|
var VIDEO_INPUT_SPEC_KEYS = [
|
|
2044
2145
|
"prompt",
|
|
2045
2146
|
"durationSeconds",
|
|
@@ -2078,8 +2179,8 @@ var ALL_KEY_SET = /* @__PURE__ */ new Set([
|
|
|
2078
2179
|
...VIDEO_INPUT_SPEC_KEYS,
|
|
2079
2180
|
...AUDIO_INPUT_SPEC_KEYS
|
|
2080
2181
|
]);
|
|
2081
|
-
var ProviderScalarSchema =
|
|
2082
|
-
var FieldsSchema =
|
|
2182
|
+
var ProviderScalarSchema = import_zod2.z.union([import_zod2.z.string(), import_zod2.z.number(), import_zod2.z.boolean()]);
|
|
2183
|
+
var FieldsSchema = import_zod2.z.record(import_zod2.z.string(), import_zod2.z.string().min(1)).superRefine((fields, ctx) => {
|
|
2083
2184
|
const keys = Object.keys(fields);
|
|
2084
2185
|
if (keys.length === 0) {
|
|
2085
2186
|
ctx.addIssue({
|
|
@@ -2097,7 +2198,7 @@ var FieldsSchema = import_zod.z.record(import_zod.z.string(), import_zod.z.strin
|
|
|
2097
2198
|
}
|
|
2098
2199
|
}
|
|
2099
2200
|
});
|
|
2100
|
-
var ValuesSchema =
|
|
2201
|
+
var ValuesSchema = import_zod2.z.record(import_zod2.z.string(), import_zod2.z.record(import_zod2.z.string(), ProviderScalarSchema)).superRefine((values, ctx) => {
|
|
2101
2202
|
for (const key of Object.keys(values)) {
|
|
2102
2203
|
if (!ALL_KEY_SET.has(key)) {
|
|
2103
2204
|
ctx.addIssue({
|
|
@@ -2107,8 +2208,8 @@ var ValuesSchema = import_zod.z.record(import_zod.z.string(), import_zod.z.recor
|
|
|
2107
2208
|
}
|
|
2108
2209
|
}
|
|
2109
2210
|
});
|
|
2110
|
-
var StaticSchema =
|
|
2111
|
-
var InputSpecSchema =
|
|
2211
|
+
var StaticSchema = import_zod2.z.record(import_zod2.z.string(), ProviderScalarSchema);
|
|
2212
|
+
var InputSpecSchema = import_zod2.z.strictObject({
|
|
2112
2213
|
fields: FieldsSchema,
|
|
2113
2214
|
values: ValuesSchema.optional(),
|
|
2114
2215
|
static: StaticSchema.optional()
|
|
@@ -2215,16 +2316,16 @@ var ADAPTER_IDS = [
|
|
|
2215
2316
|
"higgsfield",
|
|
2216
2317
|
"xai-video"
|
|
2217
2318
|
];
|
|
2218
|
-
var ModelTypeSchema =
|
|
2219
|
-
var LifecycleSchema =
|
|
2220
|
-
var SurfaceSchema =
|
|
2319
|
+
var ModelTypeSchema = import_zod3.z.enum(["text", "image", "video", "audio", "upscale", "bg-remove"]);
|
|
2320
|
+
var LifecycleSchema = import_zod3.z.enum(["active", "deprecated", "retired"]);
|
|
2321
|
+
var SurfaceSchema = import_zod3.z.enum(["cowork", "space_builder"]);
|
|
2221
2322
|
var SURFACES2 = SurfaceSchema.options;
|
|
2222
|
-
var ExposureSchema =
|
|
2323
|
+
var ExposureSchema = import_zod3.z.preprocess(
|
|
2223
2324
|
normalizeExposure,
|
|
2224
|
-
|
|
2325
|
+
import_zod3.z.array(SurfaceSchema)
|
|
2225
2326
|
);
|
|
2226
|
-
var AdapterSchema =
|
|
2227
|
-
var AspectRatioSchema =
|
|
2327
|
+
var AdapterSchema = import_zod3.z.enum(ADAPTER_IDS);
|
|
2328
|
+
var AspectRatioSchema = import_zod3.z.enum([
|
|
2228
2329
|
"1:1",
|
|
2229
2330
|
"16:9",
|
|
2230
2331
|
"9:16",
|
|
@@ -2239,12 +2340,12 @@ var AspectRatioSchema = import_zod2.z.enum([
|
|
|
2239
2340
|
"97:30",
|
|
2240
2341
|
"adaptive"
|
|
2241
2342
|
]);
|
|
2242
|
-
var ImageSizeSchema =
|
|
2243
|
-
var VideoResolutionSchema =
|
|
2244
|
-
var ImageQualitySchema =
|
|
2245
|
-
var OutputFormatSchema =
|
|
2246
|
-
var RequiredInputSchema =
|
|
2247
|
-
var SupportedOptionSchema =
|
|
2343
|
+
var ImageSizeSchema = import_zod3.z.enum(["512", "1K", "2K", "4K"]);
|
|
2344
|
+
var VideoResolutionSchema = import_zod3.z.enum(["360p", "480p", "720p", "768p", "1080p", "2k", "4k"]);
|
|
2345
|
+
var ImageQualitySchema = import_zod3.z.enum(["auto", "low", "medium", "high", "xhigh", "max"]);
|
|
2346
|
+
var OutputFormatSchema = import_zod3.z.enum(["png", "jpeg", "webp"]);
|
|
2347
|
+
var RequiredInputSchema = import_zod3.z.enum(["firstFrame", "sourceVideo", "references"]);
|
|
2348
|
+
var SupportedOptionSchema = import_zod3.z.enum([
|
|
2248
2349
|
"seed",
|
|
2249
2350
|
"quality",
|
|
2250
2351
|
"negativePrompt",
|
|
@@ -2264,142 +2365,147 @@ var SupportedOptionSchema = import_zod2.z.enum([
|
|
|
2264
2365
|
"videoExtension",
|
|
2265
2366
|
"instrumental"
|
|
2266
2367
|
]);
|
|
2267
|
-
var UsageUnitSchema =
|
|
2368
|
+
var UsageUnitSchema = import_zod3.z.enum([
|
|
2268
2369
|
"tokens",
|
|
2269
2370
|
"images",
|
|
2270
2371
|
"seconds",
|
|
2271
2372
|
"reported_cost_usd",
|
|
2272
2373
|
"compute_seconds"
|
|
2273
2374
|
]);
|
|
2274
|
-
var PricingKindSchema =
|
|
2275
|
-
var ProviderOptionValueSchema =
|
|
2276
|
-
() =>
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2375
|
+
var PricingKindSchema = import_zod3.z.enum(["token", "image_size", "video_per_second", "flat"]);
|
|
2376
|
+
var ProviderOptionValueSchema = import_zod3.z.lazy(
|
|
2377
|
+
() => import_zod3.z.union([
|
|
2378
|
+
import_zod3.z.string(),
|
|
2379
|
+
import_zod3.z.number(),
|
|
2380
|
+
import_zod3.z.boolean(),
|
|
2381
|
+
import_zod3.z.array(ProviderOptionValueSchema),
|
|
2382
|
+
import_zod3.z.record(import_zod3.z.string(), ProviderOptionValueSchema)
|
|
2282
2383
|
])
|
|
2283
2384
|
);
|
|
2284
|
-
var ProviderOptionsSchema =
|
|
2285
|
-
var VideoSecondsLimitsSchema =
|
|
2286
|
-
min:
|
|
2287
|
-
max:
|
|
2288
|
-
total:
|
|
2289
|
-
editMin:
|
|
2385
|
+
var ProviderOptionsSchema = import_zod3.z.record(import_zod3.z.string(), import_zod3.z.record(import_zod3.z.string(), ProviderOptionValueSchema));
|
|
2386
|
+
var VideoSecondsLimitsSchema = import_zod3.z.looseObject({
|
|
2387
|
+
min: import_zod3.z.number().optional(),
|
|
2388
|
+
max: import_zod3.z.number().optional(),
|
|
2389
|
+
total: import_zod3.z.number().optional(),
|
|
2390
|
+
editMin: import_zod3.z.number().optional()
|
|
2290
2391
|
});
|
|
2291
|
-
var ReferenceLimitsSchema =
|
|
2292
|
-
images:
|
|
2293
|
-
imagesWithVideo:
|
|
2294
|
-
videos:
|
|
2295
|
-
audios:
|
|
2296
|
-
total:
|
|
2297
|
-
audioOnly:
|
|
2392
|
+
var ReferenceLimitsSchema = import_zod3.z.looseObject({
|
|
2393
|
+
images: import_zod3.z.number().optional(),
|
|
2394
|
+
imagesWithVideo: import_zod3.z.number().optional(),
|
|
2395
|
+
videos: import_zod3.z.number().optional(),
|
|
2396
|
+
audios: import_zod3.z.number().optional(),
|
|
2397
|
+
total: import_zod3.z.number().optional(),
|
|
2398
|
+
audioOnly: import_zod3.z.boolean().optional(),
|
|
2298
2399
|
videoSeconds: VideoSecondsLimitsSchema.optional()
|
|
2299
2400
|
});
|
|
2300
|
-
var ModelConstraintsSchema =
|
|
2301
|
-
aspectRatios:
|
|
2302
|
-
sizes:
|
|
2303
|
-
resolutions:
|
|
2304
|
-
durations:
|
|
2305
|
-
durationPresets:
|
|
2306
|
-
qualityOptions:
|
|
2307
|
-
exactSizes:
|
|
2401
|
+
var ModelConstraintsSchema = import_zod3.z.looseObject({
|
|
2402
|
+
aspectRatios: import_zod3.z.array(AspectRatioSchema).optional(),
|
|
2403
|
+
sizes: import_zod3.z.array(ImageSizeSchema).optional(),
|
|
2404
|
+
resolutions: import_zod3.z.array(VideoResolutionSchema).optional(),
|
|
2405
|
+
durations: import_zod3.z.union([import_zod3.z.looseObject({ min: import_zod3.z.number(), max: import_zod3.z.number() }), import_zod3.z.array(import_zod3.z.number())]).optional(),
|
|
2406
|
+
durationPresets: import_zod3.z.array(import_zod3.z.number()).optional(),
|
|
2407
|
+
qualityOptions: import_zod3.z.array(import_zod3.z.string()).optional(),
|
|
2408
|
+
exactSizes: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.string()).optional(),
|
|
2308
2409
|
references: ReferenceLimitsSchema.optional(),
|
|
2309
|
-
requires:
|
|
2310
|
-
supports:
|
|
2311
|
-
ratioIgnoredWith:
|
|
2312
|
-
sourceVideoSeconds: VideoSecondsLimitsSchema.omit({ total: true }).extend({ inReferenceTotal:
|
|
2313
|
-
extension:
|
|
2410
|
+
requires: import_zod3.z.array(RequiredInputSchema).optional(),
|
|
2411
|
+
supports: import_zod3.z.array(SupportedOptionSchema).optional(),
|
|
2412
|
+
ratioIgnoredWith: import_zod3.z.array(import_zod3.z.enum(["firstFrame", "sourceVideo"])).optional(),
|
|
2413
|
+
sourceVideoSeconds: VideoSecondsLimitsSchema.omit({ total: true }).extend({ inReferenceTotal: import_zod3.z.boolean().optional() }).optional(),
|
|
2414
|
+
extension: import_zod3.z.looseObject({ segmentSeconds: import_zod3.z.number(), maxTotalSeconds: import_zod3.z.number() }).optional(),
|
|
2415
|
+
// Loose on purpose: the read path keeps a row whose value is invalid (the accessors in
|
|
2416
|
+
// conventions.ts read it as "not set"); CatalogModelSchema below rejects it on write.
|
|
2417
|
+
audio: import_zod3.z.unknown().optional(),
|
|
2418
|
+
prompt: import_zod3.z.unknown().optional()
|
|
2314
2419
|
});
|
|
2315
|
-
var MediaRefSchema =
|
|
2316
|
-
|
|
2317
|
-
url:
|
|
2318
|
-
label:
|
|
2319
|
-
durationSeconds:
|
|
2420
|
+
var MediaRefSchema = import_zod3.z.union([
|
|
2421
|
+
import_zod3.z.looseObject({
|
|
2422
|
+
url: import_zod3.z.string(),
|
|
2423
|
+
label: import_zod3.z.string().optional(),
|
|
2424
|
+
durationSeconds: import_zod3.z.number().optional()
|
|
2320
2425
|
}),
|
|
2321
|
-
|
|
2322
|
-
bytes:
|
|
2323
|
-
mime:
|
|
2324
|
-
label:
|
|
2325
|
-
durationSeconds:
|
|
2426
|
+
import_zod3.z.looseObject({
|
|
2427
|
+
bytes: import_zod3.z.instanceof(Uint8Array),
|
|
2428
|
+
mime: import_zod3.z.string(),
|
|
2429
|
+
label: import_zod3.z.string().optional(),
|
|
2430
|
+
durationSeconds: import_zod3.z.number().optional()
|
|
2326
2431
|
})
|
|
2327
2432
|
]);
|
|
2328
|
-
var ImageSafetySettingSchema =
|
|
2329
|
-
var UpscaleOptionsSchema =
|
|
2330
|
-
enhanceModel:
|
|
2331
|
-
subjectDetection:
|
|
2332
|
-
faceEnhancement:
|
|
2333
|
-
faceEnhancementCreativity:
|
|
2334
|
-
faceEnhancementStrength:
|
|
2433
|
+
var ImageSafetySettingSchema = import_zod3.z.looseObject({ category: import_zod3.z.string(), threshold: import_zod3.z.string() });
|
|
2434
|
+
var UpscaleOptionsSchema = import_zod3.z.looseObject({
|
|
2435
|
+
enhanceModel: import_zod3.z.string().optional(),
|
|
2436
|
+
subjectDetection: import_zod3.z.string().optional(),
|
|
2437
|
+
faceEnhancement: import_zod3.z.boolean().optional(),
|
|
2438
|
+
faceEnhancementCreativity: import_zod3.z.number().optional(),
|
|
2439
|
+
faceEnhancementStrength: import_zod3.z.number().optional()
|
|
2335
2440
|
});
|
|
2336
|
-
var DefaultsSchema =
|
|
2337
|
-
references:
|
|
2441
|
+
var DefaultsSchema = import_zod3.z.looseObject({
|
|
2442
|
+
references: import_zod3.z.array(MediaRefSchema).optional(),
|
|
2338
2443
|
aspectRatio: AspectRatioSchema.optional(),
|
|
2339
2444
|
size: ImageSizeSchema.optional(),
|
|
2340
|
-
exactSize:
|
|
2445
|
+
exactSize: import_zod3.z.string().optional(),
|
|
2341
2446
|
quality: ImageQualitySchema.optional(),
|
|
2342
|
-
seed:
|
|
2343
|
-
count:
|
|
2447
|
+
seed: import_zod3.z.number().optional(),
|
|
2448
|
+
count: import_zod3.z.number().optional(),
|
|
2344
2449
|
outputFormat: OutputFormatSchema.optional(),
|
|
2345
|
-
scaleFactor:
|
|
2346
|
-
safetySettings:
|
|
2347
|
-
temperature:
|
|
2450
|
+
scaleFactor: import_zod3.z.number().optional(),
|
|
2451
|
+
safetySettings: import_zod3.z.array(ImageSafetySettingSchema).optional(),
|
|
2452
|
+
temperature: import_zod3.z.number().optional(),
|
|
2348
2453
|
upscale: UpscaleOptionsSchema.optional(),
|
|
2349
2454
|
firstFrame: MediaRefSchema.optional(),
|
|
2350
2455
|
lastFrame: MediaRefSchema.optional(),
|
|
2351
2456
|
sourceVideo: MediaRefSchema.optional(),
|
|
2352
|
-
referenceImages:
|
|
2353
|
-
referenceVideos:
|
|
2354
|
-
referenceAudios:
|
|
2457
|
+
referenceImages: import_zod3.z.array(MediaRefSchema).optional(),
|
|
2458
|
+
referenceVideos: import_zod3.z.array(MediaRefSchema).optional(),
|
|
2459
|
+
referenceAudios: import_zod3.z.array(MediaRefSchema).optional(),
|
|
2355
2460
|
resolution: VideoResolutionSchema.optional(),
|
|
2356
|
-
durationSeconds:
|
|
2357
|
-
generateAudio:
|
|
2358
|
-
negativePrompt:
|
|
2359
|
-
cfgScale:
|
|
2360
|
-
promptExpansion:
|
|
2361
|
-
watermark:
|
|
2362
|
-
safetyChecker:
|
|
2363
|
-
taskType:
|
|
2364
|
-
mode:
|
|
2365
|
-
instrumental:
|
|
2461
|
+
durationSeconds: import_zod3.z.number().optional(),
|
|
2462
|
+
generateAudio: import_zod3.z.boolean().optional(),
|
|
2463
|
+
negativePrompt: import_zod3.z.string().optional(),
|
|
2464
|
+
cfgScale: import_zod3.z.number().optional(),
|
|
2465
|
+
promptExpansion: import_zod3.z.enum(["fast", "balanced", "quality"]).optional(),
|
|
2466
|
+
watermark: import_zod3.z.boolean().optional(),
|
|
2467
|
+
safetyChecker: import_zod3.z.boolean().optional(),
|
|
2468
|
+
taskType: import_zod3.z.enum(["reference", "edit", "extend"]).optional(),
|
|
2469
|
+
mode: import_zod3.z.enum(["standard", "pro"]).optional(),
|
|
2470
|
+
instrumental: import_zod3.z.boolean().optional()
|
|
2366
2471
|
});
|
|
2367
|
-
var CatalogDisplaySchema =
|
|
2368
|
-
provider:
|
|
2369
|
-
description:
|
|
2370
|
-
logo:
|
|
2371
|
-
costTier:
|
|
2372
|
-
recommended:
|
|
2373
|
-
sortOrder:
|
|
2374
|
-
chat:
|
|
2472
|
+
var CatalogDisplaySchema = import_zod3.z.looseObject({
|
|
2473
|
+
provider: import_zod3.z.string(),
|
|
2474
|
+
description: import_zod3.z.string(),
|
|
2475
|
+
logo: import_zod3.z.string().optional(),
|
|
2476
|
+
costTier: import_zod3.z.union([import_zod3.z.literal(1), import_zod3.z.literal(2), import_zod3.z.literal(3)]).optional(),
|
|
2477
|
+
recommended: import_zod3.z.boolean().optional(),
|
|
2478
|
+
sortOrder: import_zod3.z.number().optional(),
|
|
2479
|
+
chat: import_zod3.z.looseObject({
|
|
2375
2480
|
providerOptions: ProviderOptionsSchema.optional(),
|
|
2376
|
-
temperature:
|
|
2481
|
+
temperature: import_zod3.z.number().optional()
|
|
2377
2482
|
}).optional()
|
|
2378
2483
|
});
|
|
2379
|
-
var CatalogCapabilitiesSchema =
|
|
2380
|
-
acceptsSourceVideo:
|
|
2381
|
-
framesExcludeReferences:
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2484
|
+
var CatalogCapabilitiesSchema = import_zod3.z.looseObject({
|
|
2485
|
+
acceptsSourceVideo: import_zod3.z.boolean().optional(),
|
|
2486
|
+
framesExcludeReferences: import_zod3.z.boolean().optional(),
|
|
2487
|
+
lastFrameRequiresFirstFrame: import_zod3.z.boolean().optional(),
|
|
2488
|
+
reasoning: import_zod3.z.boolean().optional(),
|
|
2489
|
+
vision: import_zod3.z.boolean().optional(),
|
|
2490
|
+
contextWindow: import_zod3.z.number().optional()
|
|
2385
2491
|
});
|
|
2386
|
-
var CatalogModelSchemaBase =
|
|
2387
|
-
id:
|
|
2388
|
-
aliases:
|
|
2389
|
-
label:
|
|
2492
|
+
var CatalogModelSchemaBase = import_zod3.z.looseObject({
|
|
2493
|
+
id: import_zod3.z.string().min(1),
|
|
2494
|
+
aliases: import_zod3.z.array(import_zod3.z.string()).default([]),
|
|
2495
|
+
label: import_zod3.z.string().min(1),
|
|
2390
2496
|
type: ModelTypeSchema,
|
|
2391
2497
|
adapter: AdapterSchema,
|
|
2392
|
-
providerModelId:
|
|
2498
|
+
providerModelId: import_zod3.z.string().min(1),
|
|
2393
2499
|
lifecycle: LifecycleSchema,
|
|
2394
|
-
replacedBy:
|
|
2500
|
+
replacedBy: import_zod3.z.string().optional(),
|
|
2395
2501
|
exposure: ExposureSchema,
|
|
2396
2502
|
constraints: ModelConstraintsSchema,
|
|
2397
2503
|
defaults: DefaultsSchema,
|
|
2398
2504
|
providerOptions: ProviderOptionsSchema.optional(),
|
|
2399
|
-
usage:
|
|
2505
|
+
usage: import_zod3.z.looseObject({
|
|
2400
2506
|
unit: UsageUnitSchema,
|
|
2401
|
-
slug:
|
|
2402
|
-
providerLabel:
|
|
2507
|
+
slug: import_zod3.z.string().optional(),
|
|
2508
|
+
providerLabel: import_zod3.z.string().optional()
|
|
2403
2509
|
}),
|
|
2404
2510
|
pricingKind: PricingKindSchema,
|
|
2405
2511
|
display: CatalogDisplaySchema.optional(),
|
|
@@ -2450,9 +2556,30 @@ var CatalogModelSchema = CatalogModelSchemaBase.superRefine(
|
|
|
2450
2556
|
}
|
|
2451
2557
|
}
|
|
2452
2558
|
}
|
|
2559
|
+
const audio = row.constraints.audio;
|
|
2560
|
+
if (audio !== void 0 && !AudioOutputSchema.safeParse(audio).success) {
|
|
2561
|
+
ctx.addIssue({
|
|
2562
|
+
code: "custom",
|
|
2563
|
+
path: ["constraints", "audio"],
|
|
2564
|
+
message: 'audio must be "always", "optional" or "never"'
|
|
2565
|
+
});
|
|
2566
|
+
}
|
|
2567
|
+
const prompt = row.constraints.prompt;
|
|
2568
|
+
if (prompt !== void 0) {
|
|
2569
|
+
const parsed = PromptConventionsSchema.safeParse(prompt);
|
|
2570
|
+
if (!parsed.success) {
|
|
2571
|
+
for (const issue of parsed.error.issues) {
|
|
2572
|
+
ctx.addIssue({
|
|
2573
|
+
code: "custom",
|
|
2574
|
+
path: ["constraints", "prompt", ...issue.path.map(String)],
|
|
2575
|
+
message: issue.message
|
|
2576
|
+
});
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2453
2580
|
}
|
|
2454
2581
|
);
|
|
2455
|
-
var CatalogSchema =
|
|
2582
|
+
var CatalogSchema = import_zod3.z.array(CatalogModelSchemaBase.transform((row) => normaliseConventions(row).row)).superRefine((rows, ctx) => {
|
|
2456
2583
|
for (const issue of collisionIssues(rows)) {
|
|
2457
2584
|
ctx.addIssue({
|
|
2458
2585
|
code: "custom",
|
|
@@ -2473,7 +2600,7 @@ var import_xai = require("@ai-sdk/xai");
|
|
|
2473
2600
|
var import_deepseek = require("@ai-sdk/deepseek");
|
|
2474
2601
|
var import_moonshotai = require("@ai-sdk/moonshotai");
|
|
2475
2602
|
var import_ai = require("ai");
|
|
2476
|
-
var
|
|
2603
|
+
var import_zod4 = require("zod");
|
|
2477
2604
|
var TEXT_PROVIDERS = [
|
|
2478
2605
|
"openai",
|
|
2479
2606
|
"anthropic",
|
|
@@ -2484,7 +2611,7 @@ var TEXT_PROVIDERS = [
|
|
|
2484
2611
|
"moonshot",
|
|
2485
2612
|
"minimax"
|
|
2486
2613
|
];
|
|
2487
|
-
var textProviderSchema =
|
|
2614
|
+
var textProviderSchema = import_zod4.z.enum(TEXT_PROVIDERS);
|
|
2488
2615
|
function isTextProvider(value) {
|
|
2489
2616
|
return textProviderSchema.safeParse(value).success;
|
|
2490
2617
|
}
|
|
@@ -2777,24 +2904,24 @@ var aiSdkTextAdapter = {
|
|
|
2777
2904
|
};
|
|
2778
2905
|
|
|
2779
2906
|
// src/adapters/ark.ts
|
|
2780
|
-
var
|
|
2907
|
+
var import_zod7 = require("zod");
|
|
2781
2908
|
|
|
2782
2909
|
// src/retry.ts
|
|
2783
|
-
var
|
|
2910
|
+
var import_zod6 = require("zod");
|
|
2784
2911
|
|
|
2785
2912
|
// src/json.ts
|
|
2786
|
-
var
|
|
2787
|
-
var JsonValueSchema =
|
|
2788
|
-
() =>
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2913
|
+
var import_zod5 = require("zod");
|
|
2914
|
+
var JsonValueSchema = import_zod5.z.lazy(
|
|
2915
|
+
() => import_zod5.z.union([
|
|
2916
|
+
import_zod5.z.string(),
|
|
2917
|
+
import_zod5.z.number(),
|
|
2918
|
+
import_zod5.z.boolean(),
|
|
2919
|
+
import_zod5.z.null(),
|
|
2920
|
+
import_zod5.z.array(JsonValueSchema),
|
|
2921
|
+
import_zod5.z.record(import_zod5.z.string(), JsonValueSchema)
|
|
2795
2922
|
])
|
|
2796
2923
|
);
|
|
2797
|
-
var JsonObjectSchema =
|
|
2924
|
+
var JsonObjectSchema = import_zod5.z.record(import_zod5.z.string(), JsonValueSchema);
|
|
2798
2925
|
async function readErrorBody(res) {
|
|
2799
2926
|
const text2 = await res.text().catch(() => "");
|
|
2800
2927
|
try {
|
|
@@ -2803,11 +2930,11 @@ async function readErrorBody(res) {
|
|
|
2803
2930
|
return text2;
|
|
2804
2931
|
}
|
|
2805
2932
|
}
|
|
2806
|
-
var thrownErrorSchema =
|
|
2807
|
-
message:
|
|
2808
|
-
status:
|
|
2809
|
-
statusCode:
|
|
2810
|
-
responseBody:
|
|
2933
|
+
var thrownErrorSchema = import_zod5.z.object({
|
|
2934
|
+
message: import_zod5.z.string().optional(),
|
|
2935
|
+
status: import_zod5.z.number().optional(),
|
|
2936
|
+
statusCode: import_zod5.z.number().optional(),
|
|
2937
|
+
responseBody: import_zod5.z.string().optional()
|
|
2811
2938
|
});
|
|
2812
2939
|
function describeThrown(cause) {
|
|
2813
2940
|
const parsed = thrownErrorSchema.safeParse(cause);
|
|
@@ -2818,7 +2945,7 @@ function describeThrown(cause) {
|
|
|
2818
2945
|
}
|
|
2819
2946
|
|
|
2820
2947
|
// src/retry.ts
|
|
2821
|
-
var textBody =
|
|
2948
|
+
var textBody = import_zod6.z.string();
|
|
2822
2949
|
function classifyHttpError(status, body, provider, model) {
|
|
2823
2950
|
const asText = textBody.safeParse(body);
|
|
2824
2951
|
const text2 = asText.success ? asText.data : JSON.stringify(body);
|
|
@@ -3077,7 +3204,7 @@ function arkKey(ctx) {
|
|
|
3077
3204
|
return key;
|
|
3078
3205
|
}
|
|
3079
3206
|
function throwArkError(status, body, model) {
|
|
3080
|
-
const parsed =
|
|
3207
|
+
const parsed = import_zod7.z.string().safeParse(body);
|
|
3081
3208
|
const text2 = parsed.success ? parsed.data : JSON.stringify(body ?? "");
|
|
3082
3209
|
if (/sensitive.?content|human.?face/i.test(text2)) {
|
|
3083
3210
|
const init = {
|
|
@@ -3115,13 +3242,13 @@ function sniffedImageMime(bytes) {
|
|
|
3115
3242
|
return "image/webp";
|
|
3116
3243
|
return "image/jpeg";
|
|
3117
3244
|
}
|
|
3118
|
-
var SeedreamImageSchema =
|
|
3119
|
-
url:
|
|
3120
|
-
b64_json:
|
|
3245
|
+
var SeedreamImageSchema = import_zod7.z.object({
|
|
3246
|
+
url: import_zod7.z.string().optional(),
|
|
3247
|
+
b64_json: import_zod7.z.string().optional()
|
|
3121
3248
|
});
|
|
3122
|
-
var SeedreamResponseSchema =
|
|
3123
|
-
data:
|
|
3124
|
-
error:
|
|
3249
|
+
var SeedreamResponseSchema = import_zod7.z.object({
|
|
3250
|
+
data: import_zod7.z.array(SeedreamImageSchema).optional(),
|
|
3251
|
+
error: import_zod7.z.object({ message: import_zod7.z.string().optional(), code: import_zod7.z.string().optional() }).optional()
|
|
3125
3252
|
});
|
|
3126
3253
|
function fetchInitFor(ctx, init) {
|
|
3127
3254
|
if (ctx.signal !== void 0) init.signal = ctx.signal;
|
|
@@ -3203,21 +3330,21 @@ async function generateSeedreamImage(req, ctx) {
|
|
|
3203
3330
|
if (req.quality !== void 0) usage2.imageQuality = req.quality;
|
|
3204
3331
|
return { images: [{ bytes, mime: sniffedImageMime(bytes) }], usage: usage2, raw: data };
|
|
3205
3332
|
}
|
|
3206
|
-
var SeedanceUsageSchema =
|
|
3207
|
-
total_tokens:
|
|
3208
|
-
completion_tokens:
|
|
3333
|
+
var SeedanceUsageSchema = import_zod7.z.object({
|
|
3334
|
+
total_tokens: import_zod7.z.number().optional(),
|
|
3335
|
+
completion_tokens: import_zod7.z.number().optional()
|
|
3209
3336
|
});
|
|
3210
|
-
var SeedanceResponseSchema =
|
|
3211
|
-
id:
|
|
3212
|
-
status:
|
|
3213
|
-
content:
|
|
3337
|
+
var SeedanceResponseSchema = import_zod7.z.object({
|
|
3338
|
+
id: import_zod7.z.string().optional(),
|
|
3339
|
+
status: import_zod7.z.string().optional(),
|
|
3340
|
+
content: import_zod7.z.object({ video_url: import_zod7.z.string().optional() }).optional(),
|
|
3214
3341
|
usage: SeedanceUsageSchema.optional(),
|
|
3215
|
-
duration:
|
|
3216
|
-
framespersecond:
|
|
3217
|
-
resolution:
|
|
3218
|
-
error:
|
|
3342
|
+
duration: import_zod7.z.number().optional(),
|
|
3343
|
+
framespersecond: import_zod7.z.number().optional(),
|
|
3344
|
+
resolution: import_zod7.z.string().optional(),
|
|
3345
|
+
error: import_zod7.z.union([import_zod7.z.string(), import_zod7.z.object({ message: import_zod7.z.string().optional() })]).optional()
|
|
3219
3346
|
});
|
|
3220
|
-
var SeedanceErrorMessageSchema =
|
|
3347
|
+
var SeedanceErrorMessageSchema = import_zod7.z.object({ message: import_zod7.z.string().optional() });
|
|
3221
3348
|
function seedanceUsage(ctx, req, duration) {
|
|
3222
3349
|
const usage2 = {
|
|
3223
3350
|
model: ctx.model.id,
|
|
@@ -3231,7 +3358,7 @@ function seedanceUsage(ctx, req, duration) {
|
|
|
3231
3358
|
return usage2;
|
|
3232
3359
|
}
|
|
3233
3360
|
function seedanceErrorMessage(error, status) {
|
|
3234
|
-
const asString =
|
|
3361
|
+
const asString = import_zod7.z.string().safeParse(error);
|
|
3235
3362
|
if (asString.success) return asString.data;
|
|
3236
3363
|
const asObject = SeedanceErrorMessageSchema.safeParse(error);
|
|
3237
3364
|
if (asObject.success && asObject.data.message !== void 0) return asObject.data.message;
|
|
@@ -3404,18 +3531,18 @@ async function generateSeedanceVideo(req, ctx) {
|
|
|
3404
3531
|
}
|
|
3405
3532
|
|
|
3406
3533
|
// src/adapters/fal.ts
|
|
3407
|
-
var
|
|
3534
|
+
var import_zod9 = require("zod");
|
|
3408
3535
|
var import_client = require("@fal-ai/client");
|
|
3409
3536
|
|
|
3410
3537
|
// src/adapters/fal-http.ts
|
|
3411
|
-
var
|
|
3412
|
-
var queueUrl =
|
|
3413
|
-
var submissionSchema =
|
|
3414
|
-
request_id:
|
|
3538
|
+
var import_zod8 = require("zod");
|
|
3539
|
+
var queueUrl = import_zod8.z.url().refine((value) => new URL(value).origin === "https://queue.fal.run");
|
|
3540
|
+
var submissionSchema = import_zod8.z.object({
|
|
3541
|
+
request_id: import_zod8.z.string(),
|
|
3415
3542
|
status_url: queueUrl,
|
|
3416
3543
|
response_url: queueUrl
|
|
3417
3544
|
});
|
|
3418
|
-
var statusSchema =
|
|
3545
|
+
var statusSchema = import_zod8.z.object({ status: import_zod8.z.string() });
|
|
3419
3546
|
function createFalHttpClient(opts) {
|
|
3420
3547
|
const jobs = /* @__PURE__ */ new Map();
|
|
3421
3548
|
async function request(url, input, signal) {
|
|
@@ -3499,7 +3626,7 @@ var KLING_O1_ENDPOINT = "fal-ai/kling-video/o1/video-to-video/reference";
|
|
|
3499
3626
|
var FAL_QUEUE_HOST = "https://queue.fal.run";
|
|
3500
3627
|
var PASSTHROUGH_POLL_MS = 2e3;
|
|
3501
3628
|
var PASSTHROUGH_MAX_WAIT_MS = 18e4;
|
|
3502
|
-
var falSubscribePayloadSchema =
|
|
3629
|
+
var falSubscribePayloadSchema = import_zod9.z.object({ data: JsonValueSchema });
|
|
3503
3630
|
function defaultCreateFalClient(opts) {
|
|
3504
3631
|
if (opts.maxRetries !== void 0)
|
|
3505
3632
|
return createFalHttpClient({
|
|
@@ -3555,7 +3682,7 @@ function createFalAdapter(deps = defaultDeps) {
|
|
|
3555
3682
|
};
|
|
3556
3683
|
}
|
|
3557
3684
|
var falAdapter = createFalAdapter();
|
|
3558
|
-
var falDetailSchema =
|
|
3685
|
+
var falDetailSchema = import_zod9.z.object({ detail: JsonValueSchema });
|
|
3559
3686
|
function liftDetail(body) {
|
|
3560
3687
|
const parsed = falDetailSchema.safeParse(body);
|
|
3561
3688
|
const detail = parsed.success ? parsed.data.detail : void 0;
|
|
@@ -3564,11 +3691,11 @@ function liftDetail(body) {
|
|
|
3564
3691
|
function falError(status, body, model) {
|
|
3565
3692
|
return classifyHttpError(status, liftDetail(body), "fal", model);
|
|
3566
3693
|
}
|
|
3567
|
-
var falSdkThrownSchema =
|
|
3568
|
-
status:
|
|
3569
|
-
statusCode:
|
|
3694
|
+
var falSdkThrownSchema = import_zod9.z.object({
|
|
3695
|
+
status: import_zod9.z.number().optional(),
|
|
3696
|
+
statusCode: import_zod9.z.number().optional(),
|
|
3570
3697
|
body: JsonValueSchema.optional(),
|
|
3571
|
-
message:
|
|
3698
|
+
message: import_zod9.z.string().optional()
|
|
3572
3699
|
});
|
|
3573
3700
|
function falSdkError(cause, model) {
|
|
3574
3701
|
const parsed = falSdkThrownSchema.safeParse(cause);
|
|
@@ -3616,12 +3743,12 @@ async function gatewayFetch(cfg, fetchImpl, targetUrl, init) {
|
|
|
3616
3743
|
if (init.body !== void 0) request.body = init.body;
|
|
3617
3744
|
return fetchImpl(cfg.baseUrl, request);
|
|
3618
3745
|
}
|
|
3619
|
-
var falQueueSubmitSchema =
|
|
3620
|
-
request_id:
|
|
3621
|
-
status_url:
|
|
3622
|
-
response_url:
|
|
3746
|
+
var falQueueSubmitSchema = import_zod9.z.object({
|
|
3747
|
+
request_id: import_zod9.z.string(),
|
|
3748
|
+
status_url: import_zod9.z.string(),
|
|
3749
|
+
response_url: import_zod9.z.string()
|
|
3623
3750
|
});
|
|
3624
|
-
var falQueueStatusSchema =
|
|
3751
|
+
var falQueueStatusSchema = import_zod9.z.object({ status: import_zod9.z.string() });
|
|
3625
3752
|
async function passthroughRequest(ctx, endpoint, input) {
|
|
3626
3753
|
const cfg = gatewayConfig(ctx);
|
|
3627
3754
|
const submitRes = await gatewayFetch(cfg, ctx.fetch, `${FAL_QUEUE_HOST}/${endpoint}`, {
|
|
@@ -3754,11 +3881,11 @@ async function decodeImage(ctx, url, contentType) {
|
|
|
3754
3881
|
const mime = res.headers.get("content-type") ?? contentType ?? "image/png";
|
|
3755
3882
|
return { bytes: new Uint8Array(await res.arrayBuffer()), mime };
|
|
3756
3883
|
}
|
|
3757
|
-
var museImageResultSchema =
|
|
3758
|
-
images:
|
|
3759
|
-
|
|
3760
|
-
url:
|
|
3761
|
-
content_type:
|
|
3884
|
+
var museImageResultSchema = import_zod9.z.object({
|
|
3885
|
+
images: import_zod9.z.array(
|
|
3886
|
+
import_zod9.z.object({
|
|
3887
|
+
url: import_zod9.z.string().optional(),
|
|
3888
|
+
content_type: import_zod9.z.string().nullable().optional()
|
|
3762
3889
|
})
|
|
3763
3890
|
).optional()
|
|
3764
3891
|
});
|
|
@@ -3862,8 +3989,8 @@ function klingO1Input(req) {
|
|
|
3862
3989
|
if (refs.length > 0) input.image_urls = refs;
|
|
3863
3990
|
return input;
|
|
3864
3991
|
}
|
|
3865
|
-
var falVideoResultSchema =
|
|
3866
|
-
video:
|
|
3992
|
+
var falVideoResultSchema = import_zod9.z.object({
|
|
3993
|
+
video: import_zod9.z.object({ url: import_zod9.z.string().optional() }).optional()
|
|
3867
3994
|
});
|
|
3868
3995
|
function extractVideoUrl(result, endpoint, model) {
|
|
3869
3996
|
const parsed = falVideoResultSchema.safeParse(result);
|
|
@@ -4064,11 +4191,11 @@ async function passthroughVideoJob(ctx, req, endpoint, input) {
|
|
|
4064
4191
|
}
|
|
4065
4192
|
|
|
4066
4193
|
// src/adapters/google-genai.ts
|
|
4067
|
-
var
|
|
4194
|
+
var import_zod11 = require("zod");
|
|
4068
4195
|
var import_genai = require("@google/genai");
|
|
4069
4196
|
|
|
4070
4197
|
// src/adapters/google-files.ts
|
|
4071
|
-
var
|
|
4198
|
+
var import_zod10 = require("zod");
|
|
4072
4199
|
var GOOGLE_FILES_BASE = "https://generativelanguage.googleapis.com";
|
|
4073
4200
|
var GOOGLE_FILES_POLL_INTERVAL_MS = 2e3;
|
|
4074
4201
|
var GOOGLE_FILES_POLL_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
@@ -4078,17 +4205,17 @@ var GENERIC_MEDIA_TYPES = /* @__PURE__ */ new Set([
|
|
|
4078
4205
|
"binary/octet-stream",
|
|
4079
4206
|
"application/binary"
|
|
4080
4207
|
]);
|
|
4081
|
-
var uploadedFileSchema =
|
|
4082
|
-
file:
|
|
4083
|
-
uri:
|
|
4084
|
-
name:
|
|
4085
|
-
state:
|
|
4086
|
-
mimeType:
|
|
4208
|
+
var uploadedFileSchema = import_zod10.z.object({
|
|
4209
|
+
file: import_zod10.z.object({
|
|
4210
|
+
uri: import_zod10.z.string().optional(),
|
|
4211
|
+
name: import_zod10.z.string().optional(),
|
|
4212
|
+
state: import_zod10.z.string().optional(),
|
|
4213
|
+
mimeType: import_zod10.z.string().optional()
|
|
4087
4214
|
}).optional()
|
|
4088
4215
|
});
|
|
4089
|
-
var fileStateSchema =
|
|
4090
|
-
state:
|
|
4091
|
-
error:
|
|
4216
|
+
var fileStateSchema = import_zod10.z.object({
|
|
4217
|
+
state: import_zod10.z.string().optional(),
|
|
4218
|
+
error: import_zod10.z.object({ message: import_zod10.z.string().optional() }).optional()
|
|
4092
4219
|
});
|
|
4093
4220
|
function resolveMime(declared, fallback) {
|
|
4094
4221
|
const clean = declared?.split(";")[0]?.trim().toLowerCase();
|
|
@@ -4305,7 +4432,7 @@ var OMNI_POLL_INTERVAL_MS = 1e4;
|
|
|
4305
4432
|
var RESULT_TIMEOUT_MS2 = 15 * 60 * 1e3;
|
|
4306
4433
|
var OMNI_INLINE_LIMIT_BYTES = 4 * 1024 * 1024;
|
|
4307
4434
|
var MEDIA_PART_INLINE_LIMIT_BYTES = 20 * 1024 * 1024;
|
|
4308
|
-
var errorTextSchema =
|
|
4435
|
+
var errorTextSchema = import_zod11.z.string();
|
|
4309
4436
|
function isGoogleGenaiVideoKnown(providerModelId) {
|
|
4310
4437
|
return providerModelId.startsWith("veo-") || providerModelId.startsWith("gemini-omni");
|
|
4311
4438
|
}
|
|
@@ -4580,7 +4707,12 @@ async function generateOmniVideo(req, ctx, createGenAIClient) {
|
|
|
4580
4707
|
const extend = req.taskType === "extend";
|
|
4581
4708
|
const previousId = extend ? req.previousInteractionId : void 0;
|
|
4582
4709
|
const chained = previousId !== void 0;
|
|
4583
|
-
for (const field of [
|
|
4710
|
+
for (const field of [
|
|
4711
|
+
"referenceImages",
|
|
4712
|
+
"referenceVideos",
|
|
4713
|
+
"firstFrame",
|
|
4714
|
+
"lastFrame"
|
|
4715
|
+
]) {
|
|
4584
4716
|
const value = req[field];
|
|
4585
4717
|
if (!chained || value === void 0 || Array.isArray(value) && value.length === 0)
|
|
4586
4718
|
continue;
|
|
@@ -4594,6 +4726,14 @@ async function generateOmniVideo(req, ctx, createGenAIClient) {
|
|
|
4594
4726
|
const images = chained ? [] : req.referenceImages ?? [];
|
|
4595
4727
|
const videos = chained ? [] : req.referenceVideos ?? [];
|
|
4596
4728
|
const firstFrame = chained ? void 0 : req.firstFrame;
|
|
4729
|
+
const lastFrame = firstFrame ? req.lastFrame : void 0;
|
|
4730
|
+
if (!chained && req.lastFrame !== void 0 && lastFrame === void 0) {
|
|
4731
|
+
ctx.warnings.push({
|
|
4732
|
+
code: "option_ignored",
|
|
4733
|
+
field: "lastFrame",
|
|
4734
|
+
message: `${modelId} takes an end frame only with a start frame; lastFrame ignored`
|
|
4735
|
+
});
|
|
4736
|
+
}
|
|
4597
4737
|
if (extend && !chained && req.sourceVideo === void 0) {
|
|
4598
4738
|
throw new ModelKitError({
|
|
4599
4739
|
code: "missing_input",
|
|
@@ -4678,27 +4818,7 @@ async function generateOmniVideo(req, ctx, createGenAIClient) {
|
|
|
4678
4818
|
mime_type: media.mime
|
|
4679
4819
|
});
|
|
4680
4820
|
}
|
|
4681
|
-
|
|
4682
|
-
if (firstFrame.label !== void 0)
|
|
4683
|
-
parts.push({ type: "text", text: firstFrame.label });
|
|
4684
|
-
const media = await resolveMedia(
|
|
4685
|
-
firstFrame,
|
|
4686
|
-
ctx.fetch,
|
|
4687
|
-
ctx.signal,
|
|
4688
|
-
"image/png",
|
|
4689
|
-
modelId
|
|
4690
|
-
);
|
|
4691
|
-
if (media.bytes.length > OMNI_INLINE_LIMIT_BYTES) {
|
|
4692
|
-
parts.push({
|
|
4693
|
-
type: "image",
|
|
4694
|
-
uri: await uploadOne("image", media.bytes, media.mime),
|
|
4695
|
-
mime_type: media.mime
|
|
4696
|
-
});
|
|
4697
|
-
} else {
|
|
4698
|
-
parts.push({ type: "image", data: toBase64(media.bytes), mime_type: media.mime });
|
|
4699
|
-
}
|
|
4700
|
-
}
|
|
4701
|
-
for (const ref of images) {
|
|
4821
|
+
const pushImage = async (ref) => {
|
|
4702
4822
|
if (ref.label !== void 0) parts.push({ type: "text", text: ref.label });
|
|
4703
4823
|
const media = await resolveMedia(ref, ctx.fetch, ctx.signal, "image/png", modelId);
|
|
4704
4824
|
if (media.bytes.length > OMNI_INLINE_LIMIT_BYTES) {
|
|
@@ -4710,8 +4830,12 @@ async function generateOmniVideo(req, ctx, createGenAIClient) {
|
|
|
4710
4830
|
} else {
|
|
4711
4831
|
parts.push({ type: "image", data: toBase64(media.bytes), mime_type: media.mime });
|
|
4712
4832
|
}
|
|
4713
|
-
}
|
|
4714
|
-
|
|
4833
|
+
};
|
|
4834
|
+
if (firstFrame) await pushImage(firstFrame);
|
|
4835
|
+
if (lastFrame) await pushImage(lastFrame);
|
|
4836
|
+
for (const ref of images) await pushImage(ref);
|
|
4837
|
+
const prompt = lastFrame ? `<FIRST_FRAME> <LAST_FRAME> ${req.prompt}` : req.prompt;
|
|
4838
|
+
parts.push({ type: "text", text: prompt });
|
|
4715
4839
|
try {
|
|
4716
4840
|
interaction = await withRetry(async () => {
|
|
4717
4841
|
try {
|
|
@@ -4914,15 +5038,15 @@ async function prepareGoogleMediaPart(ref, mediaType, ctx) {
|
|
|
4914
5038
|
// src/adapters/google-image.ts
|
|
4915
5039
|
var import_google2 = require("@ai-sdk/google");
|
|
4916
5040
|
var import_ai2 = require("ai");
|
|
4917
|
-
var
|
|
5041
|
+
var import_zod12 = require("zod");
|
|
4918
5042
|
var GEMINI_IMAGE_TIMEOUT_MS = 6e5;
|
|
4919
5043
|
var defaultGoogleImageDeps = {
|
|
4920
5044
|
createGoogleClient: (opts) => (0, import_google2.createGoogleGenerativeAI)(opts),
|
|
4921
5045
|
runTextGeneration: (opts) => (0, import_ai2.generateText)(opts)
|
|
4922
5046
|
};
|
|
4923
|
-
var causeChainNodeSchema =
|
|
4924
|
-
message:
|
|
4925
|
-
cause:
|
|
5047
|
+
var causeChainNodeSchema = import_zod12.z.object({
|
|
5048
|
+
message: import_zod12.z.string().optional(),
|
|
5049
|
+
cause: import_zod12.z.unknown().optional()
|
|
4926
5050
|
});
|
|
4927
5051
|
function extractBlockReason(cause) {
|
|
4928
5052
|
let current = cause;
|
|
@@ -5042,7 +5166,7 @@ function createGoogleImageAdapter(deps = defaultGoogleImageDeps) {
|
|
|
5042
5166
|
var googleImageAdapter = createGoogleImageAdapter();
|
|
5043
5167
|
|
|
5044
5168
|
// src/adapters/higgsfield.ts
|
|
5045
|
-
var
|
|
5169
|
+
var import_zod13 = require("zod");
|
|
5046
5170
|
|
|
5047
5171
|
// src/adapters/higgsfield-motions.ts
|
|
5048
5172
|
var MOTION_MAP = {
|
|
@@ -5241,14 +5365,34 @@ function videoUsage3(ctx, req, duration) {
|
|
|
5241
5365
|
if (req.durationSeconds !== void 0) event.durationSeconds = req.durationSeconds;
|
|
5242
5366
|
return event;
|
|
5243
5367
|
}
|
|
5244
|
-
var
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5368
|
+
var KLING_ENDPOINT_FIELDS = /* @__PURE__ */ new Map([
|
|
5369
|
+
[
|
|
5370
|
+
"kling-video/v2.5-turbo/pro/image-to-video",
|
|
5371
|
+
{ aspectRatio: false, negativePrompt: true, lastFrame: false, sound: false }
|
|
5372
|
+
],
|
|
5373
|
+
[
|
|
5374
|
+
"kling-video/v3.0/pro/image-to-video",
|
|
5375
|
+
{ aspectRatio: false, negativePrompt: false, lastFrame: true, sound: true }
|
|
5376
|
+
]
|
|
5377
|
+
]);
|
|
5378
|
+
var UNLISTED_KLING_FIELDS = {
|
|
5379
|
+
aspectRatio: true,
|
|
5380
|
+
negativePrompt: true,
|
|
5381
|
+
lastFrame: true,
|
|
5382
|
+
sound: false
|
|
5383
|
+
};
|
|
5384
|
+
function klingEndpointFields(providerModelId) {
|
|
5385
|
+
const path = (providerModelId.startsWith("/") ? providerModelId.slice(1) : providerModelId).toLowerCase();
|
|
5386
|
+
return KLING_ENDPOINT_FIELDS.get(path) ?? UNLISTED_KLING_FIELDS;
|
|
5387
|
+
}
|
|
5388
|
+
var klingCreateSchema = import_zod13.z.object({ status_url: import_zod13.z.string() });
|
|
5389
|
+
var klingStatusSchema = import_zod13.z.object({
|
|
5390
|
+
status: import_zod13.z.string().optional(),
|
|
5391
|
+
video: import_zod13.z.object({ url: import_zod13.z.string().optional() }).optional(),
|
|
5248
5392
|
error: JsonValueSchema.optional()
|
|
5249
5393
|
});
|
|
5250
|
-
var errorMessageSchema =
|
|
5251
|
-
var textValueSchema =
|
|
5394
|
+
var errorMessageSchema = import_zod13.z.object({ message: import_zod13.z.string().optional() });
|
|
5395
|
+
var textValueSchema = import_zod13.z.string();
|
|
5252
5396
|
function klingErrorDetail(error) {
|
|
5253
5397
|
if (error === void 0) return "unknown_error";
|
|
5254
5398
|
const asText = textValueSchema.safeParse(error);
|
|
@@ -5275,6 +5419,13 @@ async function createRequest(ctx, url, init) {
|
|
|
5275
5419
|
}
|
|
5276
5420
|
return res;
|
|
5277
5421
|
}
|
|
5422
|
+
function ignoreKlingField(ctx, field) {
|
|
5423
|
+
ctx.warnings.push({
|
|
5424
|
+
code: "option_ignored",
|
|
5425
|
+
field,
|
|
5426
|
+
message: `${ctx.model.id}: the Higgsfield endpoint has no ${field} input; ignored`
|
|
5427
|
+
});
|
|
5428
|
+
}
|
|
5278
5429
|
async function generateKlingVideo(req, ctx) {
|
|
5279
5430
|
const firstFrame = req.firstFrame ? refToUrl(req.firstFrame) : void 0;
|
|
5280
5431
|
if (!firstFrame) {
|
|
@@ -5286,16 +5437,29 @@ async function generateKlingVideo(req, ctx) {
|
|
|
5286
5437
|
retryable: false
|
|
5287
5438
|
});
|
|
5288
5439
|
}
|
|
5440
|
+
const fields = klingEndpointFields(ctx.model.providerModelId);
|
|
5289
5441
|
const body = {
|
|
5290
5442
|
prompt: req.prompt.trim(),
|
|
5291
5443
|
image_url: firstFrame,
|
|
5292
|
-
cfg_scale: req.cfgScale ?? 0.5
|
|
5293
|
-
negative_prompt: req.negativePrompt ?? DEFAULT_NEGATIVE_PROMPT
|
|
5444
|
+
cfg_scale: req.cfgScale ?? 0.5
|
|
5294
5445
|
};
|
|
5446
|
+
if (fields.negativePrompt) {
|
|
5447
|
+
body.negative_prompt = req.negativePrompt ?? DEFAULT_NEGATIVE_PROMPT;
|
|
5448
|
+
} else if (req.negativePrompt !== void 0) {
|
|
5449
|
+
ignoreKlingField(ctx, "negativePrompt");
|
|
5450
|
+
}
|
|
5295
5451
|
if (req.durationSeconds !== void 0) body.duration = req.durationSeconds;
|
|
5296
|
-
if (req.aspectRatio !== void 0 && req.aspectRatio !== "adaptive")
|
|
5297
|
-
body.aspect_ratio = req.aspectRatio;
|
|
5298
|
-
|
|
5452
|
+
if (req.aspectRatio !== void 0 && req.aspectRatio !== "adaptive") {
|
|
5453
|
+
if (fields.aspectRatio) body.aspect_ratio = req.aspectRatio;
|
|
5454
|
+
else ignoreKlingField(ctx, "aspectRatio");
|
|
5455
|
+
}
|
|
5456
|
+
if (req.lastFrame) {
|
|
5457
|
+
if (fields.lastFrame) body.last_image_url = refToUrl(req.lastFrame);
|
|
5458
|
+
else ignoreKlingField(ctx, "lastFrame");
|
|
5459
|
+
}
|
|
5460
|
+
if (fields.sound && req.generateAudio !== void 0) {
|
|
5461
|
+
body.sound = req.generateAudio ? "on" : "off";
|
|
5462
|
+
}
|
|
5299
5463
|
const endpoint = klingEndpoint(ctx.model.providerModelId, ctx.model.id);
|
|
5300
5464
|
const retryOptions = mediaRetryOptions(ctx.call, ctx.signal);
|
|
5301
5465
|
const createRes = await withRetry(
|
|
@@ -5384,8 +5548,8 @@ async function generateKlingVideo(req, ctx) {
|
|
|
5384
5548
|
}
|
|
5385
5549
|
};
|
|
5386
5550
|
}
|
|
5387
|
-
var dopMotionOptionsSchema =
|
|
5388
|
-
modelkit:
|
|
5551
|
+
var dopMotionOptionsSchema = import_zod13.z.object({
|
|
5552
|
+
modelkit: import_zod13.z.object({ motion: import_zod13.z.string().optional() }).optional()
|
|
5389
5553
|
});
|
|
5390
5554
|
function dopMotionId(ctx) {
|
|
5391
5555
|
const parsed = dopMotionOptionsSchema.safeParse(ctx.model.providerOptions);
|
|
@@ -5401,7 +5565,7 @@ function dopMotionId(ctx) {
|
|
|
5401
5565
|
});
|
|
5402
5566
|
return id;
|
|
5403
5567
|
}
|
|
5404
|
-
var jsonRecordSchema =
|
|
5568
|
+
var jsonRecordSchema = import_zod13.z.record(import_zod13.z.string(), JsonValueSchema);
|
|
5405
5569
|
var DOP_URL_KEYS = ["url", "video_url", "output_url", "result_url", "download_url"];
|
|
5406
5570
|
var DOP_NESTED_KEYS = ["video", "result", "results"];
|
|
5407
5571
|
function dopUrl(body) {
|
|
@@ -5429,8 +5593,8 @@ function dopUrl(body) {
|
|
|
5429
5593
|
}
|
|
5430
5594
|
return void 0;
|
|
5431
5595
|
}
|
|
5432
|
-
var dopCreateSchema =
|
|
5433
|
-
var dopStatusSchema =
|
|
5596
|
+
var dopCreateSchema = import_zod13.z.object({ id: import_zod13.z.string() });
|
|
5597
|
+
var dopStatusSchema = import_zod13.z.object({ status: import_zod13.z.string().optional() });
|
|
5434
5598
|
async function generateDopVideo(req, ctx) {
|
|
5435
5599
|
const firstFrame = req.firstFrame ? refToUrl(req.firstFrame) : void 0;
|
|
5436
5600
|
if (!firstFrame) {
|
|
@@ -5558,7 +5722,7 @@ var higgsfieldAdapter = {
|
|
|
5558
5722
|
|
|
5559
5723
|
// src/adapters/openai-image.ts
|
|
5560
5724
|
var import_openai2 = __toESM(require("openai"), 1);
|
|
5561
|
-
var
|
|
5725
|
+
var import_zod14 = require("zod");
|
|
5562
5726
|
var MAX_EDIT_REFERENCES = 16;
|
|
5563
5727
|
function aspectRatioToSize(ratio, tier) {
|
|
5564
5728
|
const TIER_LONG_EDGE = {
|
|
@@ -5641,9 +5805,9 @@ function toProviderError2(cause, ctx) {
|
|
|
5641
5805
|
ctx.model.id
|
|
5642
5806
|
);
|
|
5643
5807
|
}
|
|
5644
|
-
var openaiUsageSchema =
|
|
5645
|
-
input_tokens:
|
|
5646
|
-
output_tokens:
|
|
5808
|
+
var openaiUsageSchema = import_zod14.z.object({
|
|
5809
|
+
input_tokens: import_zod14.z.number().optional(),
|
|
5810
|
+
output_tokens: import_zod14.z.number().optional()
|
|
5647
5811
|
});
|
|
5648
5812
|
var openaiImageAdapter = {
|
|
5649
5813
|
id: "openai-image",
|
|
@@ -6054,13 +6218,13 @@ var prodiaAdapter = {
|
|
|
6054
6218
|
var import_replicate = __toESM(require("replicate"), 1);
|
|
6055
6219
|
|
|
6056
6220
|
// src/adapters/replicate-http.ts
|
|
6057
|
-
var
|
|
6058
|
-
var predictionSchema =
|
|
6059
|
-
id:
|
|
6060
|
-
status:
|
|
6221
|
+
var import_zod15 = require("zod");
|
|
6222
|
+
var predictionSchema = import_zod15.z.object({
|
|
6223
|
+
id: import_zod15.z.string(),
|
|
6224
|
+
status: import_zod15.z.string(),
|
|
6061
6225
|
output: JsonValueSchema.optional(),
|
|
6062
6226
|
error: JsonValueSchema.optional(),
|
|
6063
|
-
metrics:
|
|
6227
|
+
metrics: import_zod15.z.object({ predict_time: import_zod15.z.number().optional() }).optional()
|
|
6064
6228
|
});
|
|
6065
6229
|
function createReplicateHttpClient(opts) {
|
|
6066
6230
|
async function request(path, body, signal) {
|
|
@@ -6111,7 +6275,7 @@ function createReplicateHttpClient(opts) {
|
|
|
6111
6275
|
}
|
|
6112
6276
|
|
|
6113
6277
|
// src/adapters/replicate.ts
|
|
6114
|
-
var
|
|
6278
|
+
var import_zod16 = require("zod");
|
|
6115
6279
|
|
|
6116
6280
|
// src/adapters/input-spec-mapper.ts
|
|
6117
6281
|
function canonicalValue(req, key) {
|
|
@@ -6186,8 +6350,8 @@ function route(providerModelId) {
|
|
|
6186
6350
|
if (!providerModelId.includes("/")) return { version: providerModelId };
|
|
6187
6351
|
return { model: providerModelId };
|
|
6188
6352
|
}
|
|
6189
|
-
var replicateResponseStatusSchema =
|
|
6190
|
-
response:
|
|
6353
|
+
var replicateResponseStatusSchema = import_zod16.z.object({
|
|
6354
|
+
response: import_zod16.z.object({ status: import_zod16.z.number() }).partial()
|
|
6191
6355
|
});
|
|
6192
6356
|
function replicateError(cause, ctx) {
|
|
6193
6357
|
if (isModelKitError(cause)) return cause;
|
|
@@ -6214,7 +6378,7 @@ function isUrlFn(value) {
|
|
|
6214
6378
|
function extractOutputUrl(output) {
|
|
6215
6379
|
const root = Array.isArray(output) ? output[0] : output;
|
|
6216
6380
|
if (root === void 0) throw noOutput();
|
|
6217
|
-
const asString =
|
|
6381
|
+
const asString = import_zod16.z.string().safeParse(root);
|
|
6218
6382
|
if (asString.success && asString.data) return asString.data;
|
|
6219
6383
|
if (root instanceof URL) return root.href;
|
|
6220
6384
|
if (isObjectOutput(root)) {
|
|
@@ -6223,15 +6387,15 @@ function extractOutputUrl(output) {
|
|
|
6223
6387
|
if (urlValue !== void 0 && isUrlFn(urlValue)) {
|
|
6224
6388
|
const called = urlValue();
|
|
6225
6389
|
if (called instanceof URL) return called.href;
|
|
6226
|
-
const calledString =
|
|
6390
|
+
const calledString = import_zod16.z.string().safeParse(called);
|
|
6227
6391
|
if (calledString.success && calledString.data) return calledString.data;
|
|
6228
6392
|
} else {
|
|
6229
|
-
const direct =
|
|
6393
|
+
const direct = import_zod16.z.string().safeParse(urlValue);
|
|
6230
6394
|
if (direct.success && direct.data) return direct.data;
|
|
6231
6395
|
}
|
|
6232
6396
|
}
|
|
6233
6397
|
if ("default" in root) {
|
|
6234
|
-
const fallback =
|
|
6398
|
+
const fallback = import_zod16.z.string().safeParse(root.default);
|
|
6235
6399
|
if (fallback.success && fallback.data) return fallback.data;
|
|
6236
6400
|
}
|
|
6237
6401
|
}
|
|
@@ -6292,7 +6456,7 @@ async function runPrediction(ctx, input, deps) {
|
|
|
6292
6456
|
}
|
|
6293
6457
|
return void 0;
|
|
6294
6458
|
}, pollOpts);
|
|
6295
|
-
const predictTime =
|
|
6459
|
+
const predictTime = import_zod16.z.number().safeParse(done.metrics?.predict_time);
|
|
6296
6460
|
if (done.output === void 0) throw noOutput();
|
|
6297
6461
|
return {
|
|
6298
6462
|
url: extractOutputUrl(done.output),
|
|
@@ -6597,24 +6761,22 @@ function klingInput(req) {
|
|
|
6597
6761
|
return input;
|
|
6598
6762
|
}
|
|
6599
6763
|
function klingOmniMode(req) {
|
|
6764
|
+
if (req.resolution === "4k") return "4k";
|
|
6600
6765
|
if (req.resolution === "1080p") return "pro";
|
|
6601
6766
|
if (req.resolution === "720p") return "standard";
|
|
6602
6767
|
return req.mode ?? "standard";
|
|
6603
6768
|
}
|
|
6604
6769
|
function klingOmniInput(req) {
|
|
6605
|
-
const images = (req.firstFrame ? [req.firstFrame] : []).map(refToUrl);
|
|
6606
|
-
if (req.lastFrame) images.push(refToUrl(req.lastFrame));
|
|
6607
6770
|
const input = {
|
|
6608
6771
|
prompt: req.prompt,
|
|
6609
6772
|
duration: req.durationSeconds ?? 10,
|
|
6610
6773
|
mode: klingOmniMode(req),
|
|
6611
6774
|
generate_audio: req.generateAudio ?? false
|
|
6612
6775
|
};
|
|
6613
|
-
const
|
|
6614
|
-
if (
|
|
6615
|
-
input.start_image =
|
|
6616
|
-
|
|
6617
|
-
if (endImage !== void 0) input.end_image = endImage;
|
|
6776
|
+
const start = req.firstFrame ?? req.lastFrame;
|
|
6777
|
+
if (start) {
|
|
6778
|
+
input.start_image = refToUrl(start);
|
|
6779
|
+
if (req.firstFrame && req.lastFrame) input.end_image = refToUrl(req.lastFrame);
|
|
6618
6780
|
} else if (req.aspectRatio !== "adaptive") {
|
|
6619
6781
|
input.aspect_ratio = req.aspectRatio ?? "16:9";
|
|
6620
6782
|
}
|
|
@@ -6677,7 +6839,7 @@ async function generateReplicateVideo(req, ctx, deps) {
|
|
|
6677
6839
|
throw replicateError(cause, ctx);
|
|
6678
6840
|
}
|
|
6679
6841
|
if (current.status === "succeeded") {
|
|
6680
|
-
const predictTime =
|
|
6842
|
+
const predictTime = import_zod16.z.number().safeParse(current.metrics?.predict_time);
|
|
6681
6843
|
if (current.output === void 0) throw noOutput();
|
|
6682
6844
|
return {
|
|
6683
6845
|
url: extractOutputUrl(current.output),
|
|
@@ -6818,7 +6980,7 @@ async function generateReplicateAudio(req, ctx, deps) {
|
|
|
6818
6980
|
// src/adapters/xai-video.ts
|
|
6819
6981
|
var import_ai3 = require("ai");
|
|
6820
6982
|
var import_xai2 = require("@ai-sdk/xai");
|
|
6821
|
-
var
|
|
6983
|
+
var import_zod17 = require("zod");
|
|
6822
6984
|
var POLL_INTERVAL_MS2 = 1e4;
|
|
6823
6985
|
var POLL_TIMEOUT_MS2 = 15 * 6e4;
|
|
6824
6986
|
var defaultXaiDeps = {
|
|
@@ -6831,8 +6993,8 @@ function createXaiVideoAdapter(deps = defaultXaiDeps) {
|
|
|
6831
6993
|
};
|
|
6832
6994
|
}
|
|
6833
6995
|
var xaiVideoAdapter = createXaiVideoAdapter();
|
|
6834
|
-
var xaiResponseStatusSchema =
|
|
6835
|
-
response:
|
|
6996
|
+
var xaiResponseStatusSchema = import_zod17.z.object({
|
|
6997
|
+
response: import_zod17.z.object({ status: import_zod17.z.number() }).partial()
|
|
6836
6998
|
});
|
|
6837
6999
|
function xaiError(cause, ctx) {
|
|
6838
7000
|
const info = describeThrown(cause);
|
|
@@ -6840,12 +7002,12 @@ function xaiError(cause, ctx) {
|
|
|
6840
7002
|
const status = info.status ?? (nested.success ? nested.data.response?.status : void 0);
|
|
6841
7003
|
return classifyThrown("xai-video", cause, ctx.model.id, { status, body: info.body });
|
|
6842
7004
|
}
|
|
6843
|
-
var xaiMetaSchema =
|
|
7005
|
+
var xaiMetaSchema = import_zod17.z.object({
|
|
6844
7006
|
videoUrl: JsonValueSchema.optional(),
|
|
6845
7007
|
costInUsdTicks: JsonValueSchema.optional(),
|
|
6846
7008
|
duration: JsonValueSchema.optional()
|
|
6847
7009
|
});
|
|
6848
|
-
var xaiProviderMetadataSchema =
|
|
7010
|
+
var xaiProviderMetadataSchema = import_zod17.z.object({ xai: xaiMetaSchema });
|
|
6849
7011
|
function metaOf(result) {
|
|
6850
7012
|
const parsed = xaiProviderMetadataSchema.partial().safeParse(result.providerMetadata);
|
|
6851
7013
|
if (!parsed.success) return {};
|
|
@@ -6862,7 +7024,7 @@ async function generateXaiVideo(req, ctx, deps) {
|
|
|
6862
7024
|
retryable: false
|
|
6863
7025
|
});
|
|
6864
7026
|
}
|
|
6865
|
-
const refUrls = (req.referenceImages ?? []).map(refToUrl).slice(0,
|
|
7027
|
+
const refUrls = (req.referenceImages ?? []).map(refToUrl).slice(0, 7);
|
|
6866
7028
|
const xaiOptions = {
|
|
6867
7029
|
pollIntervalMs: POLL_INTERVAL_MS2,
|
|
6868
7030
|
pollTimeoutMs: POLL_TIMEOUT_MS2
|
|
@@ -6953,7 +7115,7 @@ async function mapResult(ctx, req, result) {
|
|
|
6953
7115
|
};
|
|
6954
7116
|
}
|
|
6955
7117
|
const meta = metaOf(result);
|
|
6956
|
-
const videoUrl =
|
|
7118
|
+
const videoUrl = import_zod17.z.string().safeParse(meta.videoUrl);
|
|
6957
7119
|
if (videoUrl.success && videoUrl.data) {
|
|
6958
7120
|
const res = await ctx.fetch(videoUrl.data);
|
|
6959
7121
|
if (!res.ok) {
|
|
@@ -6976,7 +7138,7 @@ async function mapResult(ctx, req, result) {
|
|
|
6976
7138
|
});
|
|
6977
7139
|
}
|
|
6978
7140
|
function usage(ctx, req, meta) {
|
|
6979
|
-
const costTicks =
|
|
7141
|
+
const costTicks = import_zod17.z.number().safeParse(meta.costInUsdTicks);
|
|
6980
7142
|
const cost = costTicks.success ? costTicks.data / 1e10 : void 0;
|
|
6981
7143
|
const event = {
|
|
6982
7144
|
model: ctx.model.id,
|
|
@@ -7109,22 +7271,22 @@ var liveState = store[KEY] ??= {
|
|
|
7109
7271
|
var liveCatalog = liveState.catalog;
|
|
7110
7272
|
|
|
7111
7273
|
// src/catalog/load.ts
|
|
7112
|
-
var
|
|
7274
|
+
var import_zod18 = require("zod");
|
|
7113
7275
|
function rowCount() {
|
|
7114
7276
|
return liveCatalog.list({ lifecycle: ["active", "deprecated", "retired"] }).length;
|
|
7115
7277
|
}
|
|
7116
7278
|
function authHeaders(auth) {
|
|
7117
7279
|
return "bearer" in auth ? { Authorization: `Bearer ${auth.bearer}` } : { "x-api-key": auth.apiKey };
|
|
7118
7280
|
}
|
|
7119
|
-
var EnvelopeSchema =
|
|
7120
|
-
rows:
|
|
7121
|
-
revision:
|
|
7281
|
+
var EnvelopeSchema = import_zod18.z.object({
|
|
7282
|
+
rows: import_zod18.z.array(JsonValueSchema),
|
|
7283
|
+
revision: import_zod18.z.string().optional()
|
|
7122
7284
|
});
|
|
7123
7285
|
function dropReason(path, message) {
|
|
7124
7286
|
return path.length === 0 ? message : `${path.map((part) => String(part)).join(".")} ${message}`;
|
|
7125
7287
|
}
|
|
7126
7288
|
function rowId(raw) {
|
|
7127
|
-
const parsed =
|
|
7289
|
+
const parsed = import_zod18.z.object({ id: import_zod18.z.string().min(1) }).loose().safeParse(raw);
|
|
7128
7290
|
if (!parsed.success) return "?";
|
|
7129
7291
|
return parsed.data.id;
|
|
7130
7292
|
}
|
|
@@ -7152,7 +7314,13 @@ function quarantine(rawRows, logger) {
|
|
|
7152
7314
|
);
|
|
7153
7315
|
}
|
|
7154
7316
|
}
|
|
7155
|
-
|
|
7317
|
+
const normalised = normaliseConventions(row);
|
|
7318
|
+
if (normalised.invalidKeys.length > 0) {
|
|
7319
|
+
logger.warn(
|
|
7320
|
+
`[modelkit] catalog row ${row.id} has an invalid ${normalised.invalidKeys.join(", ")}; read as not set`
|
|
7321
|
+
);
|
|
7322
|
+
}
|
|
7323
|
+
valid.push(normalised.row);
|
|
7156
7324
|
}
|
|
7157
7325
|
let kept = valid;
|
|
7158
7326
|
for (; ; ) {
|
|
@@ -7570,6 +7738,24 @@ function resolveVideoOptions(model, request, onUnsupported = "error") {
|
|
|
7570
7738
|
});
|
|
7571
7739
|
delete merged.sourceVideo;
|
|
7572
7740
|
}
|
|
7741
|
+
if (merged.lastFrame !== void 0 && merged.firstFrame === void 0 && model.capabilities?.lastFrameRequiresFirstFrame) {
|
|
7742
|
+
if (onUnsupported === "error") {
|
|
7743
|
+
throw new ModelKitError({
|
|
7744
|
+
code: "missing_input",
|
|
7745
|
+
message: `${model.id} takes an end frame only together with a start frame`,
|
|
7746
|
+
model: model.id,
|
|
7747
|
+
retryable: false
|
|
7748
|
+
});
|
|
7749
|
+
}
|
|
7750
|
+
warnings.push({
|
|
7751
|
+
code: "option_ignored",
|
|
7752
|
+
field: "lastFrame",
|
|
7753
|
+
to: "firstFrame",
|
|
7754
|
+
message: `end frame used as start frame: ${model.id} needs a start frame with an end frame`
|
|
7755
|
+
});
|
|
7756
|
+
merged.firstFrame = merged.lastFrame;
|
|
7757
|
+
delete merged.lastFrame;
|
|
7758
|
+
}
|
|
7573
7759
|
const hasFrames = merged.firstFrame !== void 0 || merged.lastFrame !== void 0;
|
|
7574
7760
|
const hasRefs = compact(merged.referenceImages).length + compact(merged.referenceVideos).length + compact(merged.referenceAudios).length > 0;
|
|
7575
7761
|
if (hasFrames && hasRefs && model.capabilities?.framesExcludeReferences) {
|
|
@@ -7945,7 +8131,7 @@ function createTextSteps(initial, resolve, callerProviderOptions) {
|
|
|
7945
8131
|
|
|
7946
8132
|
// src/client.ts
|
|
7947
8133
|
var import_ai5 = require("ai");
|
|
7948
|
-
var
|
|
8134
|
+
var import_zod19 = require("zod");
|
|
7949
8135
|
|
|
7950
8136
|
// src/generated-image.ts
|
|
7951
8137
|
function toGeneratedImage(image) {
|
|
@@ -8020,10 +8206,10 @@ function textAbortOptions(sdk, context) {
|
|
|
8020
8206
|
if (abortSignal) return { abortSignal };
|
|
8021
8207
|
return {};
|
|
8022
8208
|
}
|
|
8023
|
-
var catalogId =
|
|
8024
|
-
var exactSize =
|
|
8025
|
-
var sdkRatio =
|
|
8026
|
-
var sizeTier =
|
|
8209
|
+
var catalogId = import_zod19.z.string();
|
|
8210
|
+
var exactSize = import_zod19.z.templateLiteral([import_zod19.z.number(), "x", import_zod19.z.number()]);
|
|
8211
|
+
var sdkRatio = import_zod19.z.templateLiteral([import_zod19.z.number(), ":", import_zod19.z.number()]);
|
|
8212
|
+
var sizeTier = import_zod19.z.enum(["512", "1K", "2K", "4K"]);
|
|
8027
8213
|
function isCatalogId(model) {
|
|
8028
8214
|
return catalogId.safeParse(model).success;
|
|
8029
8215
|
}
|