makefx 1.6.3 → 1.6.4
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/README.md +1 -1
- package/makefx.mjs +636 -224
- package/package.json +1 -1
package/makefx.mjs
CHANGED
|
@@ -616,9 +616,10 @@ function extractProviderErrorMessage(message) {
|
|
|
616
616
|
}
|
|
617
617
|
return "Provider request failed";
|
|
618
618
|
}
|
|
619
|
-
function isProviderAuthMessage(message, providerErrorCode, provider) {
|
|
619
|
+
function isProviderAuthMessage(message, providerErrorCode, provider, status) {
|
|
620
620
|
if (provider === "r2" || provider === "space_do" || provider === "workflow" || provider === "polar") return false;
|
|
621
|
-
|
|
621
|
+
const code = providerErrorCode?.toLowerCase();
|
|
622
|
+
return status === 401 && !(code === "permission_denied" || code === "missing_permissions" || code === "authorization_error") || code === "api_key_invalid" || code === "invalid_api_key" || code === "authentication_error" || message.includes("api_key_invalid") || message.includes("api key not valid") || message.includes("invalid api key") || message.includes("api key is required") || message.includes("not configured") || message.includes("unauthenticated");
|
|
622
623
|
}
|
|
623
624
|
//#endregion
|
|
624
625
|
//#region src/shared/generation-blockers.ts
|
|
@@ -634,6 +635,7 @@ var PROVIDER_LABELS = {
|
|
|
634
635
|
lyria: "Lyria",
|
|
635
636
|
kling: "Kling",
|
|
636
637
|
fal: "fal.ai",
|
|
638
|
+
pika: "Pika",
|
|
637
639
|
replicate: "Replicate"
|
|
638
640
|
};
|
|
639
641
|
function isGenerationBlockerCode(code) {
|
|
@@ -646,11 +648,12 @@ function inferGenerationBlockerProvider(message) {
|
|
|
646
648
|
if (normalized.includes("lyria")) return "lyria";
|
|
647
649
|
if (normalized.includes("kling")) return "kling";
|
|
648
650
|
if (normalized.includes("fal.ai") || normalized.includes("fal provider")) return "fal";
|
|
651
|
+
if (normalized.includes("pika")) return "pika";
|
|
649
652
|
if (normalized.includes("replicate")) return "replicate";
|
|
650
653
|
}
|
|
651
654
|
function generationBlockerProviderFromService(provider) {
|
|
652
655
|
if (provider === "google_ai" || provider === "veo") return "google_ai";
|
|
653
|
-
if (provider === "elevenlabs" || provider === "lyria" || provider === "kling" || provider === "fal" || provider === "replicate") return provider;
|
|
656
|
+
if (provider === "elevenlabs" || provider === "lyria" || provider === "kling" || provider === "fal" || provider === "pika" || provider === "replicate") return provider;
|
|
654
657
|
}
|
|
655
658
|
function getGenerationBlockerPresentation(code, serverMessage, provider) {
|
|
656
659
|
if (!isGenerationBlockerCode(code)) return null;
|
|
@@ -670,11 +673,12 @@ function getGenerationBlockerPresentation(code, serverMessage, provider) {
|
|
|
670
673
|
};
|
|
671
674
|
const resolvedProvider = provider ?? inferGenerationBlockerProvider(serverMessage);
|
|
672
675
|
const providerLabel = resolvedProvider ? PROVIDER_LABELS[resolvedProvider] : "provider";
|
|
676
|
+
const providerArticle = /^[aeiou]/iu.test(providerLabel) ? "An" : "A";
|
|
673
677
|
const actionPath = resolvedProvider ? `/profile#provider-key-${resolvedProvider}` : "/profile#provider-keys";
|
|
674
678
|
const setupUrl = `https://makefx.app${actionPath}`;
|
|
675
679
|
if (code === "PROVIDER_KEY_REQUIRED") return {
|
|
676
680
|
code,
|
|
677
|
-
message:
|
|
681
|
+
message: `${providerArticle} ${providerLabel} account key is required before generation can start.`,
|
|
678
682
|
retryable: false,
|
|
679
683
|
actionLabel: "Configure key",
|
|
680
684
|
actionPath,
|
|
@@ -4438,7 +4442,7 @@ require_websocket_server();
|
|
|
4438
4442
|
var wrapper_default = import_websocket.default;
|
|
4439
4443
|
//#endregion
|
|
4440
4444
|
//#region src/cli/version.ts
|
|
4441
|
-
var CLI_VERSION = "1.6.
|
|
4445
|
+
var CLI_VERSION = "1.6.4+0753202e927c";
|
|
4442
4446
|
var CLI_VERSION_HEADER = "X-MakeFX-CLI-Version";
|
|
4443
4447
|
function cliVersionHeaders() {
|
|
4444
4448
|
return {
|
|
@@ -5101,6 +5105,8 @@ var WebSocketClient = class WebSocketClient {
|
|
|
5101
5105
|
model: params.model,
|
|
5102
5106
|
aspectRatio: params.aspectRatio,
|
|
5103
5107
|
imageSize: params.imageSize,
|
|
5108
|
+
imageQuality: params.imageQuality,
|
|
5109
|
+
imageSeed: params.imageSeed,
|
|
5104
5110
|
mediaKind: params.mediaKind,
|
|
5105
5111
|
voiceId: params.voiceId,
|
|
5106
5112
|
dialogueVoiceIds: params.dialogueVoiceIds,
|
|
@@ -5111,8 +5117,11 @@ var WebSocketClient = class WebSocketClient {
|
|
|
5111
5117
|
videoTier: params.videoTier,
|
|
5112
5118
|
seedanceDuration: params.seedanceDuration,
|
|
5113
5119
|
seedanceBitrateMode: params.seedanceBitrateMode,
|
|
5120
|
+
provider: params.provider,
|
|
5114
5121
|
avatarResolution: params.avatarResolution,
|
|
5115
|
-
avatarMode: params.avatarMode
|
|
5122
|
+
avatarMode: params.avatarMode,
|
|
5123
|
+
avatarGuidanceScale: params.avatarGuidanceScale,
|
|
5124
|
+
avatarAudioGuidanceScale: params.avatarAudioGuidanceScale
|
|
5116
5125
|
};
|
|
5117
5126
|
try {
|
|
5118
5127
|
this.send(message);
|
|
@@ -5792,114 +5801,6 @@ function normalizeElevenLabsSpeechModelId(model) {
|
|
|
5792
5801
|
return normalized === "eleven-v3" ? DEFAULT_ELEVENLABS_SPEECH_MODEL_ID : normalized;
|
|
5793
5802
|
}
|
|
5794
5803
|
//#endregion
|
|
5795
|
-
//#region src/backend/utils/audio-metadata.ts
|
|
5796
|
-
function readWavDurationMs(bytes) {
|
|
5797
|
-
if (bytes.byteLength < 12) return void 0;
|
|
5798
|
-
const text = (offset, length) => String.fromCharCode(...bytes.subarray(offset, offset + length));
|
|
5799
|
-
if (text(0, 4) !== "RIFF" || text(8, 4) !== "WAVE") return void 0;
|
|
5800
|
-
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
5801
|
-
let byteRate;
|
|
5802
|
-
let dataSize;
|
|
5803
|
-
for (let offset = 12; offset + 8 <= bytes.byteLength;) {
|
|
5804
|
-
const type = text(offset, 4);
|
|
5805
|
-
const size = view.getUint32(offset + 4, true);
|
|
5806
|
-
const payload = offset + 8;
|
|
5807
|
-
if (type === "fmt " && size >= 12 && payload + 12 <= bytes.byteLength) byteRate = view.getUint32(payload + 8, true);
|
|
5808
|
-
if (type === "data") {
|
|
5809
|
-
dataSize = size;
|
|
5810
|
-
break;
|
|
5811
|
-
}
|
|
5812
|
-
if (payload + size > bytes.byteLength) break;
|
|
5813
|
-
offset = payload + size + size % 2;
|
|
5814
|
-
}
|
|
5815
|
-
if (!byteRate || dataSize === void 0) return void 0;
|
|
5816
|
-
return Math.round(dataSize * 1e3 / byteRate);
|
|
5817
|
-
}
|
|
5818
|
-
function id3PayloadSize(bytes) {
|
|
5819
|
-
if (bytes.byteLength < 10 || String.fromCharCode(...bytes.subarray(0, 3)) !== "ID3") return 0;
|
|
5820
|
-
return 10 + ((bytes[6] & 127) << 21 | (bytes[7] & 127) << 14 | (bytes[8] & 127) << 7 | bytes[9] & 127) + ((bytes[5] & 16) !== 0 ? 10 : 0);
|
|
5821
|
-
}
|
|
5822
|
-
var MPEG1_LAYER3_BITRATES = [
|
|
5823
|
-
0,
|
|
5824
|
-
32,
|
|
5825
|
-
40,
|
|
5826
|
-
48,
|
|
5827
|
-
56,
|
|
5828
|
-
64,
|
|
5829
|
-
80,
|
|
5830
|
-
96,
|
|
5831
|
-
112,
|
|
5832
|
-
128,
|
|
5833
|
-
160,
|
|
5834
|
-
192,
|
|
5835
|
-
224,
|
|
5836
|
-
256,
|
|
5837
|
-
320
|
|
5838
|
-
];
|
|
5839
|
-
var MPEG2_LAYER3_BITRATES = [
|
|
5840
|
-
0,
|
|
5841
|
-
8,
|
|
5842
|
-
16,
|
|
5843
|
-
24,
|
|
5844
|
-
32,
|
|
5845
|
-
40,
|
|
5846
|
-
48,
|
|
5847
|
-
56,
|
|
5848
|
-
64,
|
|
5849
|
-
80,
|
|
5850
|
-
96,
|
|
5851
|
-
112,
|
|
5852
|
-
128,
|
|
5853
|
-
144,
|
|
5854
|
-
160
|
|
5855
|
-
];
|
|
5856
|
-
var MPEG1_SAMPLE_RATES = [
|
|
5857
|
-
44100,
|
|
5858
|
-
48e3,
|
|
5859
|
-
32e3
|
|
5860
|
-
];
|
|
5861
|
-
function mp3Frame(bytes, offset) {
|
|
5862
|
-
if (offset + 4 > bytes.byteLength || bytes[offset] !== 255 || (bytes[offset + 1] & 224) !== 224) return void 0;
|
|
5863
|
-
const versionBits = bytes[offset + 1] >> 3 & 3;
|
|
5864
|
-
const layerBits = bytes[offset + 1] >> 1 & 3;
|
|
5865
|
-
const bitrateIndex = bytes[offset + 2] >> 4 & 15;
|
|
5866
|
-
const sampleRateIndex = bytes[offset + 2] >> 2 & 3;
|
|
5867
|
-
if (versionBits === 1 || layerBits !== 1 || bitrateIndex === 0 || bitrateIndex === 15 || sampleRateIndex === 3) return void 0;
|
|
5868
|
-
const isMpeg1 = versionBits === 3;
|
|
5869
|
-
const bitrateKbps = (isMpeg1 ? MPEG1_LAYER3_BITRATES : MPEG2_LAYER3_BITRATES)[bitrateIndex];
|
|
5870
|
-
const divisor = versionBits === 0 ? 4 : versionBits === 2 ? 2 : 1;
|
|
5871
|
-
const sampleRate = MPEG1_SAMPLE_RATES[sampleRateIndex] / divisor;
|
|
5872
|
-
const padding = bytes[offset + 2] >> 1 & 1;
|
|
5873
|
-
const length = Math.floor((isMpeg1 ? 144e3 : 72e3) * bitrateKbps / sampleRate) + padding;
|
|
5874
|
-
if (length < 4 || offset + length > bytes.byteLength) return void 0;
|
|
5875
|
-
return {
|
|
5876
|
-
length,
|
|
5877
|
-
durationMs: (isMpeg1 ? 1152 : 576) * 1e3 / sampleRate,
|
|
5878
|
-
bitrateKbps
|
|
5879
|
-
};
|
|
5880
|
-
}
|
|
5881
|
-
function readMp3DurationMs(bytes) {
|
|
5882
|
-
let offset = id3PayloadSize(bytes);
|
|
5883
|
-
let durationMs = 0;
|
|
5884
|
-
let frames = 0;
|
|
5885
|
-
while (offset + 4 <= bytes.byteLength) {
|
|
5886
|
-
const frame = mp3Frame(bytes, offset);
|
|
5887
|
-
if (!frame) {
|
|
5888
|
-
offset += 1;
|
|
5889
|
-
continue;
|
|
5890
|
-
}
|
|
5891
|
-
durationMs += frame.durationMs;
|
|
5892
|
-
frames += 1;
|
|
5893
|
-
offset += frame.length;
|
|
5894
|
-
}
|
|
5895
|
-
return frames > 0 ? Math.round(durationMs) : void 0;
|
|
5896
|
-
}
|
|
5897
|
-
/** Read duration for the audio formats accepted by Seedance reference mode. */
|
|
5898
|
-
function readAudioDurationMs(bytes, mimeType) {
|
|
5899
|
-
if (mimeType === "audio/wav" || mimeType === "audio/x-wav") return readWavDurationMs(bytes);
|
|
5900
|
-
if (mimeType === "audio/mpeg") return readMp3DurationMs(bytes);
|
|
5901
|
-
}
|
|
5902
|
-
//#endregion
|
|
5903
5804
|
//#region src/backend/utils/iso-bmff-metadata.ts
|
|
5904
5805
|
function readBox(view, offset, limit) {
|
|
5905
5806
|
if (offset < 0 || offset + 8 > limit) return null;
|
|
@@ -5978,14 +5879,60 @@ function readIsoBmffVideoMetadata(bytes) {
|
|
|
5978
5879
|
}
|
|
5979
5880
|
//#endregion
|
|
5980
5881
|
//#region src/shared/avatarGenerationOptions.ts
|
|
5981
|
-
var AVATAR_MODEL_IDS = ["kling-avatar-v2"];
|
|
5882
|
+
var AVATAR_MODEL_IDS = ["kling-avatar-v2", "creatify-aurora"];
|
|
5883
|
+
var AURORA_AVATAR_RESOLUTIONS = ["480p", "720p"];
|
|
5982
5884
|
var AVATAR_MODES = ["standard", "pro"];
|
|
5885
|
+
var DEFAULT_AURORA_AVATAR_RESOLUTION = "720p";
|
|
5886
|
+
var AURORA_GUIDANCE_SCALE = Object.freeze({
|
|
5887
|
+
min: 0,
|
|
5888
|
+
max: 5,
|
|
5889
|
+
default: 1
|
|
5890
|
+
});
|
|
5891
|
+
var AURORA_AUDIO_GUIDANCE_SCALE = Object.freeze({
|
|
5892
|
+
min: 0,
|
|
5893
|
+
max: 5,
|
|
5894
|
+
default: 2
|
|
5895
|
+
});
|
|
5896
|
+
var AVATAR_MODEL_CAPABILITIES = Object.freeze({
|
|
5897
|
+
"kling-avatar-v2": {
|
|
5898
|
+
model: "kling-avatar-v2",
|
|
5899
|
+
label: "Kling Avatar V2",
|
|
5900
|
+
modes: AVATAR_MODES,
|
|
5901
|
+
defaultMode: "standard"
|
|
5902
|
+
},
|
|
5903
|
+
"creatify-aurora": {
|
|
5904
|
+
model: "creatify-aurora",
|
|
5905
|
+
label: "Creatify Aurora",
|
|
5906
|
+
resolutions: AURORA_AVATAR_RESOLUTIONS,
|
|
5907
|
+
defaultResolution: DEFAULT_AURORA_AVATAR_RESOLUTION,
|
|
5908
|
+
guidanceScale: AURORA_GUIDANCE_SCALE,
|
|
5909
|
+
audioGuidanceScale: AURORA_AUDIO_GUIDANCE_SCALE
|
|
5910
|
+
}
|
|
5911
|
+
});
|
|
5983
5912
|
function isAvatarModelId(value) {
|
|
5984
5913
|
return typeof value === "string" && AVATAR_MODEL_IDS.includes(value);
|
|
5985
5914
|
}
|
|
5915
|
+
function isAuroraAvatarResolution(value) {
|
|
5916
|
+
return typeof value === "string" && AURORA_AVATAR_RESOLUTIONS.includes(value);
|
|
5917
|
+
}
|
|
5986
5918
|
function isAvatarMode(value) {
|
|
5987
5919
|
return typeof value === "string" && AVATAR_MODES.includes(value);
|
|
5988
5920
|
}
|
|
5921
|
+
function getAvatarModelCapabilities(model) {
|
|
5922
|
+
return AVATAR_MODEL_CAPABILITIES[model];
|
|
5923
|
+
}
|
|
5924
|
+
function getAuroraProviderCompatibilityError(provider, prompt, references = []) {
|
|
5925
|
+
if (provider === "elevenlabs" && prompt?.trim()) return "ElevenLabs Creatify Aurora does not accept a prompt; clear the prompt or select fal";
|
|
5926
|
+
const audioMimeType = references.find((reference) => reference.mediaKind === "audio")?.mimeType;
|
|
5927
|
+
if (provider === "elevenlabs" && audioMimeType && ![
|
|
5928
|
+
"audio/mpeg",
|
|
5929
|
+
"audio/wav",
|
|
5930
|
+
"audio/x-wav"
|
|
5931
|
+
].includes(audioMimeType)) return `ElevenLabs Creatify Aurora does not accept ${audioMimeType} audio; use MP3 or WAV, or select fal`;
|
|
5932
|
+
const oversizedReference = references.find((reference) => reference.sizeBytes !== void 0 && reference.sizeBytes > 8 * 1024 * 1024);
|
|
5933
|
+
if (provider === "elevenlabs" && oversizedReference) return `ElevenLabs Creatify Aurora ${oversizedReference.mediaKind} input must not exceed 8 MiB`;
|
|
5934
|
+
return null;
|
|
5935
|
+
}
|
|
5989
5936
|
//#endregion
|
|
5990
5937
|
//#region src/shared/seedance2Capabilities.ts
|
|
5991
5938
|
var SEEDANCE_2_ASPECT_RATIOS = [
|
|
@@ -6012,6 +5959,36 @@ var SEEDANCE_2_DURATIONS = [
|
|
|
6012
5959
|
14,
|
|
6013
5960
|
15
|
|
6014
5961
|
];
|
|
5962
|
+
var SEEDANCE_25_DURATIONS = [
|
|
5963
|
+
"auto",
|
|
5964
|
+
4,
|
|
5965
|
+
5,
|
|
5966
|
+
6,
|
|
5967
|
+
7,
|
|
5968
|
+
8,
|
|
5969
|
+
9,
|
|
5970
|
+
10,
|
|
5971
|
+
11,
|
|
5972
|
+
12,
|
|
5973
|
+
13,
|
|
5974
|
+
14,
|
|
5975
|
+
15,
|
|
5976
|
+
16,
|
|
5977
|
+
17,
|
|
5978
|
+
18,
|
|
5979
|
+
19,
|
|
5980
|
+
20,
|
|
5981
|
+
21,
|
|
5982
|
+
22,
|
|
5983
|
+
23,
|
|
5984
|
+
24,
|
|
5985
|
+
25,
|
|
5986
|
+
26,
|
|
5987
|
+
27,
|
|
5988
|
+
28,
|
|
5989
|
+
29,
|
|
5990
|
+
30
|
|
5991
|
+
];
|
|
6015
5992
|
var SEEDANCE_2_BITRATE_MODES = ["standard", "high"];
|
|
6016
5993
|
var MB = 1024 * 1024;
|
|
6017
5994
|
var IMAGE_REFERENCE_RULE = {
|
|
@@ -6073,6 +6050,8 @@ function profile(mode, tier, endpointId) {
|
|
|
6073
6050
|
selection,
|
|
6074
6051
|
generatorId: `video/${selection}`,
|
|
6075
6052
|
endpointId,
|
|
6053
|
+
family: "seedance-2.0",
|
|
6054
|
+
familyLabel: "Seedance 2",
|
|
6076
6055
|
label: `Seedance 2 ${fast ? "Fast " : ""}${mode === "text" ? "Text" : mode === "frame" ? "Frames" : "References"}`,
|
|
6077
6056
|
mode,
|
|
6078
6057
|
tier,
|
|
@@ -6109,20 +6088,137 @@ function profile(mode, tier, endpointId) {
|
|
|
6109
6088
|
}
|
|
6110
6089
|
};
|
|
6111
6090
|
}
|
|
6091
|
+
var SEEDANCE_25_IMAGE_REFERENCE_RULE = {
|
|
6092
|
+
mediaKind: "image",
|
|
6093
|
+
minCount: 0,
|
|
6094
|
+
maxCount: 30,
|
|
6095
|
+
promptLabel: "@ImageN",
|
|
6096
|
+
acceptedMimeTypes: [
|
|
6097
|
+
"image/jpeg",
|
|
6098
|
+
"image/png",
|
|
6099
|
+
"image/webp",
|
|
6100
|
+
"image/gif"
|
|
6101
|
+
],
|
|
6102
|
+
maxBytesPerFile: 30 * MB
|
|
6103
|
+
};
|
|
6104
|
+
var SEEDANCE_25_FRAME_IMAGE_REFERENCE_RULE = {
|
|
6105
|
+
...SEEDANCE_25_IMAGE_REFERENCE_RULE,
|
|
6106
|
+
minCount: 1,
|
|
6107
|
+
maxCount: 2,
|
|
6108
|
+
acceptedMimeTypes: [
|
|
6109
|
+
"image/jpeg",
|
|
6110
|
+
"image/png",
|
|
6111
|
+
"image/webp"
|
|
6112
|
+
]
|
|
6113
|
+
};
|
|
6114
|
+
var SEEDANCE_25_VIDEO_REFERENCE_RULE = {
|
|
6115
|
+
mediaKind: "video",
|
|
6116
|
+
minCount: 0,
|
|
6117
|
+
maxCount: 10,
|
|
6118
|
+
promptLabel: "@VideoN",
|
|
6119
|
+
acceptedMimeTypes: ["video/mp4", "video/quicktime"],
|
|
6120
|
+
maxBytesPerFile: 50 * MB,
|
|
6121
|
+
combinedDurationSeconds: { max: 30.2 },
|
|
6122
|
+
perFileDurationSeconds: {
|
|
6123
|
+
min: 1.8,
|
|
6124
|
+
max: 30.2
|
|
6125
|
+
},
|
|
6126
|
+
dimensionRange: {
|
|
6127
|
+
min: 300,
|
|
6128
|
+
max: 6e3
|
|
6129
|
+
},
|
|
6130
|
+
aspectRatioRange: {
|
|
6131
|
+
min: .4,
|
|
6132
|
+
max: 2.5
|
|
6133
|
+
}
|
|
6134
|
+
};
|
|
6135
|
+
var SEEDANCE_25_AUDIO_REFERENCE_RULE = {
|
|
6136
|
+
mediaKind: "audio",
|
|
6137
|
+
minCount: 0,
|
|
6138
|
+
maxCount: 10,
|
|
6139
|
+
promptLabel: "@AudioN",
|
|
6140
|
+
acceptedMimeTypes: [
|
|
6141
|
+
"audio/mpeg",
|
|
6142
|
+
"audio/wav",
|
|
6143
|
+
"audio/x-wav"
|
|
6144
|
+
],
|
|
6145
|
+
maxBytesPerFile: 15 * MB,
|
|
6146
|
+
combinedDurationSeconds: { max: 30.2 },
|
|
6147
|
+
perFileDurationSeconds: {
|
|
6148
|
+
min: 1.8,
|
|
6149
|
+
max: 30.2
|
|
6150
|
+
}
|
|
6151
|
+
};
|
|
6152
|
+
function seedance25Profile(mode, endpointId) {
|
|
6153
|
+
const selection = `seedance-2.5-${mode}`;
|
|
6154
|
+
const references = mode === "reference" ? [
|
|
6155
|
+
SEEDANCE_25_IMAGE_REFERENCE_RULE,
|
|
6156
|
+
SEEDANCE_25_VIDEO_REFERENCE_RULE,
|
|
6157
|
+
SEEDANCE_25_AUDIO_REFERENCE_RULE
|
|
6158
|
+
] : mode === "frame" ? [SEEDANCE_25_FRAME_IMAGE_REFERENCE_RULE] : [];
|
|
6159
|
+
return {
|
|
6160
|
+
selection,
|
|
6161
|
+
generatorId: `video/${selection}`,
|
|
6162
|
+
endpointId,
|
|
6163
|
+
family: "seedance-2.5",
|
|
6164
|
+
familyLabel: "Seedance 2.5",
|
|
6165
|
+
label: `Seedance 2.5 ${mode === "text" ? "Text" : mode === "frame" ? "Frames" : "References"}`,
|
|
6166
|
+
mode,
|
|
6167
|
+
tier: "standard",
|
|
6168
|
+
operations: mode === "text" ? ["generate"] : mode === "frame" ? ["generate", "derive"] : [
|
|
6169
|
+
"generate",
|
|
6170
|
+
"derive",
|
|
6171
|
+
"refine"
|
|
6172
|
+
],
|
|
6173
|
+
resolutions: [
|
|
6174
|
+
"480p",
|
|
6175
|
+
"720p",
|
|
6176
|
+
"1080p"
|
|
6177
|
+
],
|
|
6178
|
+
aspectRatios: mode === "frame" ? ["auto"] : SEEDANCE_2_ASPECT_RATIOS,
|
|
6179
|
+
durations: SEEDANCE_25_DURATIONS,
|
|
6180
|
+
defaultResolution: "720p",
|
|
6181
|
+
defaultAspectRatio: "auto",
|
|
6182
|
+
defaultDuration: "auto",
|
|
6183
|
+
generateAudio: {
|
|
6184
|
+
supported: true,
|
|
6185
|
+
default: true
|
|
6186
|
+
},
|
|
6187
|
+
outputSeed: { returned: true },
|
|
6188
|
+
bitrateModes: SEEDANCE_2_BITRATE_MODES,
|
|
6189
|
+
defaultBitrateMode: "standard",
|
|
6190
|
+
references,
|
|
6191
|
+
maxReferenceFiles: mode === "reference" ? 50 : mode === "frame" ? 2 : 0,
|
|
6192
|
+
requiresVisualReferenceWithAudio: mode === "reference",
|
|
6193
|
+
conditioning: {
|
|
6194
|
+
authoritativeStartEndFrames: mode === "frame",
|
|
6195
|
+
extendedMultimodalReferences: mode === "reference",
|
|
6196
|
+
canCombineAuthoritativeFramesWithExtendedReferences: false
|
|
6197
|
+
}
|
|
6198
|
+
};
|
|
6199
|
+
}
|
|
6112
6200
|
var SEEDANCE_2_CAPABILITIES = {
|
|
6113
6201
|
"seedance-2-text": profile("text", "standard", "bytedance/seedance-2.0/text-to-video"),
|
|
6114
6202
|
"seedance-2-frame": profile("frame", "standard", "bytedance/seedance-2.0/image-to-video"),
|
|
6115
6203
|
"seedance-2-reference": profile("reference", "standard", "bytedance/seedance-2.0/reference-to-video"),
|
|
6116
6204
|
"seedance-2-fast-text": profile("text", "fast", "bytedance/seedance-2.0/fast/text-to-video"),
|
|
6117
6205
|
"seedance-2-fast-frame": profile("frame", "fast", "bytedance/seedance-2.0/fast/image-to-video"),
|
|
6118
|
-
"seedance-2-fast-reference": profile("reference", "fast", "bytedance/seedance-2.0/fast/reference-to-video")
|
|
6206
|
+
"seedance-2-fast-reference": profile("reference", "fast", "bytedance/seedance-2.0/fast/reference-to-video"),
|
|
6207
|
+
"seedance-2.5-text": seedance25Profile("text", "bytedance/seedance-2.5/text-to-video"),
|
|
6208
|
+
"seedance-2.5-frame": seedance25Profile("frame", "bytedance/seedance-2.5/image-to-video"),
|
|
6209
|
+
"seedance-2.5-reference": seedance25Profile("reference", "bytedance/seedance-2.5/reference-to-video")
|
|
6119
6210
|
};
|
|
6120
6211
|
var SEEDANCE_2_SELECTIONS = Object.freeze(Object.keys(SEEDANCE_2_CAPABILITIES));
|
|
6121
6212
|
Object.freeze(SEEDANCE_2_SELECTIONS.map((selection) => SEEDANCE_2_CAPABILITIES[selection].generatorId));
|
|
6213
|
+
function getSeedanceProviderCompatibilityError(capability, provider, options) {
|
|
6214
|
+
if (provider !== "elevenlabs") return null;
|
|
6215
|
+
if (options.bitrateMode === "high") return "ElevenLabs Seedance does not support high bitrate mode";
|
|
6216
|
+
if (capability.family === "seedance-2.0" && options.resolution === "4k") return "ElevenLabs Seedance 2 does not support 4k resolution";
|
|
6217
|
+
return null;
|
|
6218
|
+
}
|
|
6122
6219
|
function getSeedance2RegenerationCapability(model, source, referencesWereOverridden) {
|
|
6123
6220
|
const sourceCapability = source.model ? getSeedance2CapabilityByEndpoint(source.model) : void 0;
|
|
6124
|
-
|
|
6125
|
-
return SEEDANCE_2_CAPABILITIES[`${model === "seedance-2-fast" ? "seedance-2-fast" : "seedance-2"}-${mode}`];
|
|
6221
|
+
return SEEDANCE_2_CAPABILITIES[`${model}-${!referencesWereOverridden && sourceCapability ? sourceCapability.mode : !referencesWereOverridden && source.authoritativeFrames ? "frame" : source.references.length > 0 ? "reference" : "text"}`];
|
|
6126
6222
|
}
|
|
6127
6223
|
/**
|
|
6128
6224
|
* Reference inputs exposed by an interface are additional to the video being
|
|
@@ -6143,18 +6239,19 @@ function getSeedance2ReferenceBudget(capability, operation) {
|
|
|
6143
6239
|
}
|
|
6144
6240
|
function validateSeedance2ReferenceCounts(capability, operation, counts) {
|
|
6145
6241
|
const total = counts.image + counts.video + counts.audio;
|
|
6242
|
+
const familyLabel = capability.familyLabel;
|
|
6146
6243
|
if (capability.mode === "text") return total > 0 ? {
|
|
6147
6244
|
code: "references_not_supported",
|
|
6148
|
-
message:
|
|
6245
|
+
message: `${familyLabel} text mode does not accept references.`
|
|
6149
6246
|
} : null;
|
|
6150
6247
|
if (capability.mode === "frame") {
|
|
6151
6248
|
if (counts.image === 0) return {
|
|
6152
6249
|
code: "start_frame_required",
|
|
6153
|
-
message:
|
|
6250
|
+
message: `${familyLabel} frame mode requires a completed image start frame.`
|
|
6154
6251
|
};
|
|
6155
6252
|
if (counts.video > 0 || counts.audio > 0 || counts.image > 2) return {
|
|
6156
6253
|
code: "frame_images_only",
|
|
6157
|
-
message:
|
|
6254
|
+
message: `${familyLabel} frame mode accepts one start image and one optional end image.`
|
|
6158
6255
|
};
|
|
6159
6256
|
return null;
|
|
6160
6257
|
}
|
|
@@ -6162,23 +6259,23 @@ function validateSeedance2ReferenceCounts(capability, operation, counts) {
|
|
|
6162
6259
|
const qualifier = operation === "refine" ? " additional" : "";
|
|
6163
6260
|
if (total > budget.maxAdditionalFiles) return {
|
|
6164
6261
|
code: "too_many_files",
|
|
6165
|
-
message:
|
|
6262
|
+
message: `${familyLabel} reference mode accepts at most ${budget.maxAdditionalFiles}${qualifier} files.`
|
|
6166
6263
|
};
|
|
6167
6264
|
if (counts.image > budget.maxAdditionalByKind.image) return {
|
|
6168
6265
|
code: "too_many_images",
|
|
6169
|
-
message:
|
|
6266
|
+
message: `${familyLabel} accepts at most ${budget.maxAdditionalByKind.image}${qualifier} reference images.`
|
|
6170
6267
|
};
|
|
6171
6268
|
if (counts.video > budget.maxAdditionalByKind.video) return {
|
|
6172
6269
|
code: "too_many_videos",
|
|
6173
|
-
message:
|
|
6270
|
+
message: `${familyLabel} accepts at most ${budget.maxAdditionalByKind.video}${qualifier} reference videos.`
|
|
6174
6271
|
};
|
|
6175
6272
|
if (counts.audio > budget.maxAdditionalByKind.audio) return {
|
|
6176
6273
|
code: "too_many_audio_clips",
|
|
6177
|
-
message:
|
|
6274
|
+
message: `${familyLabel} accepts at most ${budget.maxAdditionalByKind.audio}${qualifier} reference audio clips.`
|
|
6178
6275
|
};
|
|
6179
6276
|
if (counts.audio > 0 && counts.image + counts.video === 0 && !budget.hasImplicitSourceVideo) return {
|
|
6180
6277
|
code: "visual_reference_required",
|
|
6181
|
-
message:
|
|
6278
|
+
message: `${familyLabel} audio guidance references require at least one image or video reference.`
|
|
6182
6279
|
};
|
|
6183
6280
|
return null;
|
|
6184
6281
|
}
|
|
@@ -6269,6 +6366,16 @@ var VIDEO_GENERATION_TIER_MODELS = {
|
|
|
6269
6366
|
fast: "veo-3.1-fast-generate-preview",
|
|
6270
6367
|
lite: "veo-3.1-lite-generate-preview"
|
|
6271
6368
|
};
|
|
6369
|
+
function getVeoProviderCompatibilityError(model, tier, provider, options) {
|
|
6370
|
+
if (provider !== "elevenlabs") return null;
|
|
6371
|
+
const resolved = resolveVideoGenerationModel(model, normalizeVideoGenerationTier(tier) ?? "generate");
|
|
6372
|
+
if (!resolved || !isVeoVideoGenerationModel(resolved)) return null;
|
|
6373
|
+
if (options.resolution === "4k") return "ElevenLabs Veo 3.1 does not support 4k resolution";
|
|
6374
|
+
const referenceCount = Math.max(0, Math.floor(options.referenceCount ?? 0));
|
|
6375
|
+
if (resolved === VIDEO_GENERATION_TIER_MODELS.fast && referenceCount > 2) return "ElevenLabs Veo 3.1 Fast does not support subject image references";
|
|
6376
|
+
if (referenceCount === 3 && options.durationSeconds !== void 0 && options.durationSeconds !== 8) return "ElevenLabs Veo 3.1 subject image references require an 8-second duration";
|
|
6377
|
+
return null;
|
|
6378
|
+
}
|
|
6272
6379
|
function normalizeVideoGenerationResolution(value) {
|
|
6273
6380
|
return ALL_VIDEO_GENERATION_RESOLUTIONS.includes(value) ? value : void 0;
|
|
6274
6381
|
}
|
|
@@ -6276,6 +6383,12 @@ function normalizeVideoGenerationDurationSeconds(value) {
|
|
|
6276
6383
|
const numeric = typeof value === "string" ? Number(value) : value;
|
|
6277
6384
|
return SEEDANCE_2_DURATION_SECONDS.includes(numeric) ? numeric : void 0;
|
|
6278
6385
|
}
|
|
6386
|
+
function normalizeSeedanceDuration(value, model) {
|
|
6387
|
+
const capability = getSeedance2CapabilityByEndpoint(model);
|
|
6388
|
+
if (!capability) return void 0;
|
|
6389
|
+
const normalized = value === "auto" ? value : typeof value === "string" ? Number(value) : value;
|
|
6390
|
+
return capability.durations.includes(normalized) ? normalized : void 0;
|
|
6391
|
+
}
|
|
6279
6392
|
function normalizeVideoGenerationTier(value) {
|
|
6280
6393
|
return VIDEO_GENERATION_TIERS.includes(value) ? value : void 0;
|
|
6281
6394
|
}
|
|
@@ -6291,6 +6404,12 @@ function getVideoGenerationModelForSelection(selection = DEFAULT_VIDEO_MODEL_SEL
|
|
|
6291
6404
|
if (selection === "fal-seedance") return FAL_VIDEO_MODEL;
|
|
6292
6405
|
return getVideoGenerationModelForTier(tier);
|
|
6293
6406
|
}
|
|
6407
|
+
function resolveVideoGenerationModel(model, tier = DEFAULT_VIDEO_GENERATION_TIER) {
|
|
6408
|
+
if (model === void 0 || model === null || model === "") return getVideoGenerationModelForTier(tier);
|
|
6409
|
+
const selection = normalizeVideoModelSelection(model);
|
|
6410
|
+
if (selection) return getVideoGenerationModelForSelection(selection, tier);
|
|
6411
|
+
return isVideoGenerationModel(model) ? model : void 0;
|
|
6412
|
+
}
|
|
6294
6413
|
function getVideoGenerationResolutionsForTier(tier = DEFAULT_VIDEO_GENERATION_TIER) {
|
|
6295
6414
|
return VIDEO_GENERATION_RESOLUTIONS_BY_TIER[tier];
|
|
6296
6415
|
}
|
|
@@ -6334,6 +6453,9 @@ function isFalSeedanceV1VideoGenerationModel(model) {
|
|
|
6334
6453
|
function isFalSeedance2VideoGenerationModel(model) {
|
|
6335
6454
|
return typeof model === "string" && getSeedance2CapabilityByEndpoint(model) !== void 0;
|
|
6336
6455
|
}
|
|
6456
|
+
function isVideoGenerationModel(model) {
|
|
6457
|
+
return isVeoVideoGenerationModel(model) || isGeminiOmniVideoGenerationModel(model) || isKlingVideoGenerationModel(model) || isFalVideoGenerationModel(model);
|
|
6458
|
+
}
|
|
6337
6459
|
function getVideoGenerationMaxReferenceImages(model) {
|
|
6338
6460
|
if (isFalSeedanceV1VideoGenerationModel(model)) return 0;
|
|
6339
6461
|
if (isFalSeedance2VideoGenerationModel(model)) return getSeedance2CapabilityByEndpoint(model)?.references.find((reference) => reference.mediaKind === "image")?.maxCount ?? 0;
|
|
@@ -6350,16 +6472,34 @@ function doesVideoGenerationModelSupportAudioToggle(model) {
|
|
|
6350
6472
|
return isKlingVideoGenerationModel(model) || isVeoVideoGenerationModel(model) && VIDEO_GENERATION_AUDIO_TOGGLE_MODELS.includes(model);
|
|
6351
6473
|
}
|
|
6352
6474
|
//#endregion
|
|
6475
|
+
//#region src/shared/generationRouting.ts
|
|
6476
|
+
/** Provider identifiers that may participate in user-selectable generation routes. */
|
|
6477
|
+
var GENERATION_ROUTING_PROVIDERS = [
|
|
6478
|
+
"google_ai",
|
|
6479
|
+
"fal",
|
|
6480
|
+
"pika",
|
|
6481
|
+
"kling",
|
|
6482
|
+
"replicate",
|
|
6483
|
+
"elevenlabs",
|
|
6484
|
+
"lyria"
|
|
6485
|
+
];
|
|
6486
|
+
//#endregion
|
|
6353
6487
|
//#region src/shared/imageGenerationOptions.ts
|
|
6354
6488
|
var IMAGE_MODEL_SELECTIONS = [
|
|
6355
6489
|
"pro",
|
|
6356
6490
|
"flash",
|
|
6357
|
-
"flux"
|
|
6491
|
+
"flux",
|
|
6492
|
+
"gpt-image-2",
|
|
6493
|
+
"seedream-5-pro",
|
|
6494
|
+
"seedream-5-lite"
|
|
6358
6495
|
];
|
|
6359
6496
|
var IMAGE_MODEL_IDS = {
|
|
6360
6497
|
pro: "gemini-3-pro-image",
|
|
6361
6498
|
flash: "gemini-3.1-flash-image",
|
|
6362
|
-
flux: "fal-ai/flux/dev"
|
|
6499
|
+
flux: "fal-ai/flux/dev",
|
|
6500
|
+
"gpt-image-2": "gpt-image-2",
|
|
6501
|
+
"seedream-5-pro": "bytedance-seedream-5-pro",
|
|
6502
|
+
"seedream-5-lite": "bytedance-seedream-5-lite"
|
|
6363
6503
|
};
|
|
6364
6504
|
IMAGE_MODEL_IDS["pro"];
|
|
6365
6505
|
var IMAGE_ASPECT_RATIOS = [
|
|
@@ -6377,8 +6517,14 @@ var IMAGE_ASPECT_RATIOS = [
|
|
|
6377
6517
|
var IMAGE_SIZES = [
|
|
6378
6518
|
"1K",
|
|
6379
6519
|
"2K",
|
|
6520
|
+
"3K",
|
|
6380
6521
|
"4K"
|
|
6381
6522
|
];
|
|
6523
|
+
var IMAGE_QUALITIES = [
|
|
6524
|
+
"low",
|
|
6525
|
+
"medium",
|
|
6526
|
+
"high"
|
|
6527
|
+
];
|
|
6382
6528
|
var IMAGE_MODEL_CAPABILITIES = {
|
|
6383
6529
|
pro: {
|
|
6384
6530
|
selection: "pro",
|
|
@@ -6390,13 +6536,15 @@ var IMAGE_MODEL_CAPABILITIES = {
|
|
|
6390
6536
|
"derive",
|
|
6391
6537
|
"refine"
|
|
6392
6538
|
],
|
|
6393
|
-
maxReferenceImages:
|
|
6539
|
+
maxReferenceImages: 10,
|
|
6394
6540
|
supportedImageSizes: [
|
|
6395
6541
|
"1K",
|
|
6396
6542
|
"2K",
|
|
6397
6543
|
"4K"
|
|
6398
6544
|
],
|
|
6399
|
-
supportedAspectRatios: IMAGE_ASPECT_RATIOS
|
|
6545
|
+
supportedAspectRatios: IMAGE_ASPECT_RATIOS,
|
|
6546
|
+
supportedQualities: [],
|
|
6547
|
+
supportsSeed: false
|
|
6400
6548
|
},
|
|
6401
6549
|
flash: {
|
|
6402
6550
|
selection: "flash",
|
|
@@ -6414,7 +6562,9 @@ var IMAGE_MODEL_CAPABILITIES = {
|
|
|
6414
6562
|
"2K",
|
|
6415
6563
|
"4K"
|
|
6416
6564
|
],
|
|
6417
|
-
supportedAspectRatios: IMAGE_ASPECT_RATIOS
|
|
6565
|
+
supportedAspectRatios: IMAGE_ASPECT_RATIOS,
|
|
6566
|
+
supportedQualities: [],
|
|
6567
|
+
supportsSeed: false
|
|
6418
6568
|
},
|
|
6419
6569
|
flux: {
|
|
6420
6570
|
selection: "flux",
|
|
@@ -6424,7 +6574,77 @@ var IMAGE_MODEL_CAPABILITIES = {
|
|
|
6424
6574
|
supportedOperations: ["generate"],
|
|
6425
6575
|
maxReferenceImages: 0,
|
|
6426
6576
|
supportedImageSizes: ["1K"],
|
|
6427
|
-
supportedAspectRatios: IMAGE_ASPECT_RATIOS
|
|
6577
|
+
supportedAspectRatios: IMAGE_ASPECT_RATIOS,
|
|
6578
|
+
supportedQualities: [],
|
|
6579
|
+
supportsSeed: false
|
|
6580
|
+
},
|
|
6581
|
+
"gpt-image-2": {
|
|
6582
|
+
selection: "gpt-image-2",
|
|
6583
|
+
modelId: IMAGE_MODEL_IDS["gpt-image-2"],
|
|
6584
|
+
label: "GPT Image 2",
|
|
6585
|
+
provider: "elevenlabs",
|
|
6586
|
+
supportedOperations: [
|
|
6587
|
+
"generate",
|
|
6588
|
+
"derive",
|
|
6589
|
+
"refine"
|
|
6590
|
+
],
|
|
6591
|
+
maxReferenceImages: 10,
|
|
6592
|
+
supportedImageSizes: [
|
|
6593
|
+
"1K",
|
|
6594
|
+
"2K",
|
|
6595
|
+
"4K"
|
|
6596
|
+
],
|
|
6597
|
+
supportedAspectRatios: [
|
|
6598
|
+
"1:1",
|
|
6599
|
+
"2:3",
|
|
6600
|
+
"3:2"
|
|
6601
|
+
],
|
|
6602
|
+
supportedQualities: IMAGE_QUALITIES,
|
|
6603
|
+
supportsSeed: false
|
|
6604
|
+
},
|
|
6605
|
+
"seedream-5-pro": {
|
|
6606
|
+
selection: "seedream-5-pro",
|
|
6607
|
+
modelId: IMAGE_MODEL_IDS["seedream-5-pro"],
|
|
6608
|
+
label: "Seedream 5 Pro",
|
|
6609
|
+
provider: "elevenlabs",
|
|
6610
|
+
supportedOperations: [
|
|
6611
|
+
"generate",
|
|
6612
|
+
"derive",
|
|
6613
|
+
"refine"
|
|
6614
|
+
],
|
|
6615
|
+
maxReferenceImages: 10,
|
|
6616
|
+
supportedImageSizes: ["1K", "2K"],
|
|
6617
|
+
supportedAspectRatios: [
|
|
6618
|
+
"16:9",
|
|
6619
|
+
"4:3",
|
|
6620
|
+
"1:1",
|
|
6621
|
+
"3:4",
|
|
6622
|
+
"9:16"
|
|
6623
|
+
],
|
|
6624
|
+
supportedQualities: [],
|
|
6625
|
+
supportsSeed: true
|
|
6626
|
+
},
|
|
6627
|
+
"seedream-5-lite": {
|
|
6628
|
+
selection: "seedream-5-lite",
|
|
6629
|
+
modelId: IMAGE_MODEL_IDS["seedream-5-lite"],
|
|
6630
|
+
label: "Seedream 5 Lite",
|
|
6631
|
+
provider: "elevenlabs",
|
|
6632
|
+
supportedOperations: [
|
|
6633
|
+
"generate",
|
|
6634
|
+
"derive",
|
|
6635
|
+
"refine"
|
|
6636
|
+
],
|
|
6637
|
+
maxReferenceImages: 10,
|
|
6638
|
+
supportedImageSizes: ["2K", "3K"],
|
|
6639
|
+
supportedAspectRatios: [
|
|
6640
|
+
"16:9",
|
|
6641
|
+
"4:3",
|
|
6642
|
+
"1:1",
|
|
6643
|
+
"3:4",
|
|
6644
|
+
"9:16"
|
|
6645
|
+
],
|
|
6646
|
+
supportedQualities: [],
|
|
6647
|
+
supportsSeed: true
|
|
6428
6648
|
}
|
|
6429
6649
|
};
|
|
6430
6650
|
function isImageModelSelection(value) {
|
|
@@ -6443,11 +6663,16 @@ function normalizeImageSize(value) {
|
|
|
6443
6663
|
const normalized = value.toUpperCase();
|
|
6444
6664
|
return isImageSize(normalized) ? normalized : void 0;
|
|
6445
6665
|
}
|
|
6666
|
+
function isImageQuality(value) {
|
|
6667
|
+
return IMAGE_QUALITIES.includes(value);
|
|
6668
|
+
}
|
|
6669
|
+
function normalizeImageQuality(value) {
|
|
6670
|
+
const normalized = value.trim().toLowerCase();
|
|
6671
|
+
return isImageQuality(normalized) ? normalized : void 0;
|
|
6672
|
+
}
|
|
6446
6673
|
function getImageModelSelection(value) {
|
|
6447
6674
|
if (isImageModelSelection(value)) return value;
|
|
6448
|
-
|
|
6449
|
-
if (value === IMAGE_MODEL_IDS.flux) return "flux";
|
|
6450
|
-
return "pro";
|
|
6675
|
+
return IMAGE_MODEL_SELECTIONS.find((selection) => IMAGE_MODEL_CAPABILITIES[selection].modelId === value) ?? "pro";
|
|
6451
6676
|
}
|
|
6452
6677
|
function getImageModelProvider(model) {
|
|
6453
6678
|
return getImageModelCapabilities(model).provider;
|
|
@@ -6458,6 +6683,12 @@ function getImageModelCapabilities(model) {
|
|
|
6458
6683
|
function isImageSizeSupportedByModel(model, imageSize) {
|
|
6459
6684
|
return getImageModelCapabilities(model).supportedImageSizes.includes(imageSize);
|
|
6460
6685
|
}
|
|
6686
|
+
function isImageQualitySupportedByModel(model, quality) {
|
|
6687
|
+
return getImageModelCapabilities(model).supportedQualities.includes(quality);
|
|
6688
|
+
}
|
|
6689
|
+
function isImageSeedSupportedByModel(model) {
|
|
6690
|
+
return getImageModelCapabilities(model).supportsSeed;
|
|
6691
|
+
}
|
|
6461
6692
|
function isImageAspectRatioSupportedByModel(model, aspectRatio) {
|
|
6462
6693
|
return getImageModelCapabilities(model).supportedAspectRatios.includes(aspectRatio);
|
|
6463
6694
|
}
|
|
@@ -6654,6 +6885,7 @@ var LOCAL_REFERENCE_MIME_TYPES = {
|
|
|
6654
6885
|
".jpeg": "image/jpeg",
|
|
6655
6886
|
".png": "image/png",
|
|
6656
6887
|
".webp": "image/webp",
|
|
6888
|
+
".gif": "image/gif",
|
|
6657
6889
|
".mp4": "video/mp4",
|
|
6658
6890
|
".mov": "video/quicktime",
|
|
6659
6891
|
".mp3": "audio/mpeg",
|
|
@@ -6661,20 +6893,15 @@ var LOCAL_REFERENCE_MIME_TYPES = {
|
|
|
6661
6893
|
};
|
|
6662
6894
|
async function inspectLocalReference(filePath, mediaKind) {
|
|
6663
6895
|
const fileStat = await stat(filePath);
|
|
6664
|
-
const mimeType = LOCAL_REFERENCE_MIME_TYPES[path.extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
6665
6896
|
const inspection = {
|
|
6666
|
-
mimeType,
|
|
6897
|
+
mimeType: LOCAL_REFERENCE_MIME_TYPES[path.extname(filePath).toLowerCase()] ?? "application/octet-stream",
|
|
6667
6898
|
sizeBytes: fileStat.size
|
|
6668
6899
|
};
|
|
6669
|
-
if (mediaKind
|
|
6900
|
+
if (mediaKind !== "video") return inspection;
|
|
6670
6901
|
const bytes = new Uint8Array(await readFile(filePath));
|
|
6671
|
-
if (mediaKind === "video") return {
|
|
6672
|
-
...inspection,
|
|
6673
|
-
...readIsoBmffVideoMetadata(bytes)
|
|
6674
|
-
};
|
|
6675
6902
|
return {
|
|
6676
6903
|
...inspection,
|
|
6677
|
-
|
|
6904
|
+
...readIsoBmffVideoMetadata(bytes)
|
|
6678
6905
|
};
|
|
6679
6906
|
}
|
|
6680
6907
|
async function handleGenerate(parsed) {
|
|
@@ -6702,6 +6929,7 @@ async function executeForgeCommand(command, parsed, deps = defaultDeps$12, optio
|
|
|
6702
6929
|
validateImageCommandReferenceCount(command, parsed, mediaKind, imageOptions.model);
|
|
6703
6930
|
validateVideoAudioOptions(parsed, mediaKind);
|
|
6704
6931
|
const videoOptions = parseVideoGenerationOptions(parsed, mediaKind);
|
|
6932
|
+
parseGenerationProviderOption(parsed, mediaKind, videoOptions.model);
|
|
6705
6933
|
validateVideoModelOperation(command, mediaKind, videoOptions.model);
|
|
6706
6934
|
validateVideoFrameReferenceOptions(command, parsed, mediaKind);
|
|
6707
6935
|
validateSeedanceReferenceOptions(parseSeedanceReferenceOptions(parsed), videoOptions.model ?? getVideoGenerationModelForSelection(), command);
|
|
@@ -6728,9 +6956,12 @@ var CLI_GENERATION_COMMON_OPTIONS = [
|
|
|
6728
6956
|
var CLI_GENERATION_MEDIA_OPTIONS = {
|
|
6729
6957
|
image: [
|
|
6730
6958
|
"model",
|
|
6959
|
+
"provider",
|
|
6731
6960
|
"refs",
|
|
6732
6961
|
"aspect",
|
|
6733
|
-
"size"
|
|
6962
|
+
"size",
|
|
6963
|
+
"quality",
|
|
6964
|
+
"seed"
|
|
6734
6965
|
],
|
|
6735
6966
|
audio: [
|
|
6736
6967
|
"model",
|
|
@@ -6753,7 +6984,10 @@ var CLI_GENERATION_MEDIA_OPTIONS = {
|
|
|
6753
6984
|
"image-refs",
|
|
6754
6985
|
"video-refs",
|
|
6755
6986
|
"audio-refs",
|
|
6756
|
-
"mode"
|
|
6987
|
+
"mode",
|
|
6988
|
+
"guidance-scale",
|
|
6989
|
+
"audio-guidance-scale",
|
|
6990
|
+
"provider"
|
|
6757
6991
|
]
|
|
6758
6992
|
};
|
|
6759
6993
|
function rejectUnknownGenerationOptions(options, mediaKind) {
|
|
@@ -6825,7 +7059,7 @@ async function executeGenerate(parsed, ctx, client, deps, mediaKind, followOptio
|
|
|
6825
7059
|
...deps,
|
|
6826
7060
|
waitForReferenceVariant: (variant) => waitForReferenceVariant(client, variant)
|
|
6827
7061
|
};
|
|
6828
|
-
const resolvedSeedanceRefs = state && seedanceReferenceCount > 0 ? isAvatarModelId(effectiveVideoModel) ? await resolveAvatarReferenceIds(seedanceRefs, ctx, referenceDeps, state) : await resolveSeedanceReferenceIds(seedanceRefs, ctx, referenceDeps, state) : {
|
|
7062
|
+
const resolvedSeedanceRefs = state && seedanceReferenceCount > 0 ? isAvatarModelId(effectiveVideoModel) ? await resolveAvatarReferenceIds(seedanceRefs, ctx, referenceDeps, state) : await resolveSeedanceReferenceIds(seedanceRefs, seedanceCapability, ctx, referenceDeps, state) : {
|
|
6829
7063
|
refs: [],
|
|
6830
7064
|
ids: []
|
|
6831
7065
|
};
|
|
@@ -6835,6 +7069,24 @@ async function executeGenerate(parsed, ctx, client, deps, mediaKind, followOptio
|
|
|
6835
7069
|
const imageOptions = parseImageGenerationOptions(parsed, mediaKind);
|
|
6836
7070
|
const audioModelOptions = parseAudioGenerationOptions(parsed, mediaKind);
|
|
6837
7071
|
const videoAudioOptions = parseVideoAudioOptions(parsed, mediaKind);
|
|
7072
|
+
const provider = parseGenerationProviderOption(parsed, mediaKind, effectiveVideoModel);
|
|
7073
|
+
if (effectiveVideoModel === "creatify-aurora") {
|
|
7074
|
+
const providerError = getAuroraProviderCompatibilityError(provider, prompt);
|
|
7075
|
+
if (providerError) throw new Error(providerError);
|
|
7076
|
+
}
|
|
7077
|
+
if (seedanceCapability) {
|
|
7078
|
+
const providerError = getSeedanceProviderCompatibilityError(seedanceCapability, provider, {
|
|
7079
|
+
resolution: videoOptions.videoResolution,
|
|
7080
|
+
bitrateMode: videoOptions.seedanceBitrateMode
|
|
7081
|
+
});
|
|
7082
|
+
if (providerError) throw new Error(providerError);
|
|
7083
|
+
}
|
|
7084
|
+
const veoProviderError = getVeoProviderCompatibilityError(effectiveVideoModel, videoOptions.videoTier, provider, {
|
|
7085
|
+
resolution: videoOptions.videoResolution,
|
|
7086
|
+
referenceCount: referenceVariantIds.length,
|
|
7087
|
+
durationSeconds: videoOptions.videoDurationSeconds
|
|
7088
|
+
});
|
|
7089
|
+
if (veoProviderError) throw new Error(veoProviderError);
|
|
6838
7090
|
const collectionPlacement = parseCollectionPlacementOptions(parsed);
|
|
6839
7091
|
const followCommandOptions = {
|
|
6840
7092
|
...followOptions,
|
|
@@ -6858,6 +7110,7 @@ async function executeGenerate(parsed, ctx, client, deps, mediaKind, followOptio
|
|
|
6858
7110
|
...musicProvider ? { musicProvider } : {},
|
|
6859
7111
|
...videoAudioOptions,
|
|
6860
7112
|
...videoOptions,
|
|
7113
|
+
...provider ? { provider } : {},
|
|
6861
7114
|
onStarted: (started) => {
|
|
6862
7115
|
startedVariantRef = compactStartedVariantRef(started);
|
|
6863
7116
|
}
|
|
@@ -7010,12 +7263,12 @@ async function resolveAvatarReferenceIds(options, ctx, deps, state) {
|
|
|
7010
7263
|
ids: [...imageIds, ...audioIds]
|
|
7011
7264
|
};
|
|
7012
7265
|
}
|
|
7013
|
-
async function resolveSeedanceReferenceIds(options, ctx, deps, state, implicitVideoReferenceIds = []) {
|
|
7266
|
+
async function resolveSeedanceReferenceIds(options, capability, ctx, deps, state, implicitVideoReferenceIds = []) {
|
|
7014
7267
|
await preflightLocalSeedanceReferences({
|
|
7015
7268
|
...options,
|
|
7016
7269
|
videoRefs: [...implicitVideoReferenceIds, ...options.videoRefs]
|
|
7017
|
-
}, deps, state);
|
|
7018
|
-
const resolve = (refs, kind) => resolveReferenceVariantIds(refs, ctx, deps, state.variants, "video", state.assets, kind);
|
|
7270
|
+
}, deps, state, capability);
|
|
7271
|
+
const resolve = (refs, kind) => resolveReferenceVariantIds(refs, ctx, deps, state.variants, "video", state.assets, kind, capability);
|
|
7019
7272
|
const imageIds = await resolve(options.imageRefs, "image");
|
|
7020
7273
|
const videoIds = await resolve(options.videoRefs, "video");
|
|
7021
7274
|
const audioIds = await resolve(options.audioRefs, "audio");
|
|
@@ -7032,7 +7285,7 @@ async function resolveSeedanceReferenceIds(options, ctx, deps, state, implicitVi
|
|
|
7032
7285
|
]
|
|
7033
7286
|
};
|
|
7034
7287
|
}
|
|
7035
|
-
async function preflightLocalSeedanceReferences(options, deps, state) {
|
|
7288
|
+
async function preflightLocalSeedanceReferences(options, deps, state, capability = SEEDANCE_2_CAPABILITIES["seedance-2-reference"]) {
|
|
7036
7289
|
if (!deps.inspectLocalReference) return;
|
|
7037
7290
|
const inspections = {
|
|
7038
7291
|
image: [],
|
|
@@ -7044,7 +7297,7 @@ async function preflightLocalSeedanceReferences(options, deps, state) {
|
|
|
7044
7297
|
["video", options.videoRefs],
|
|
7045
7298
|
["audio", options.audioRefs]
|
|
7046
7299
|
]) {
|
|
7047
|
-
const rule =
|
|
7300
|
+
const rule = capability.references.find((candidate) => candidate.mediaKind === mediaKind);
|
|
7048
7301
|
for (const ref of refs) {
|
|
7049
7302
|
const isLocal = await deps.fileExists(ref);
|
|
7050
7303
|
let inspection;
|
|
@@ -7054,7 +7307,7 @@ async function preflightLocalSeedanceReferences(options, deps, state) {
|
|
|
7054
7307
|
if (!state) continue;
|
|
7055
7308
|
const variants = state.variants;
|
|
7056
7309
|
const variantId = resolveVariantRef(ref, state.assets, variants);
|
|
7057
|
-
validateReferenceVariant(variantId, variants, "video", mediaKind);
|
|
7310
|
+
validateReferenceVariant(variantId, variants, "video", mediaKind, capability);
|
|
7058
7311
|
const variant = variants.find((candidate) => candidate.id === variantId);
|
|
7059
7312
|
inspection = {
|
|
7060
7313
|
mimeType: variant.media_mime_type ?? void 0,
|
|
@@ -7064,24 +7317,40 @@ async function preflightLocalSeedanceReferences(options, deps, state) {
|
|
|
7064
7317
|
durationMs: variant.media_duration_ms ?? void 0
|
|
7065
7318
|
};
|
|
7066
7319
|
}
|
|
7067
|
-
if (inspection.mimeType && !rule.acceptedMimeTypes.includes(inspection.mimeType)) throw new Error(
|
|
7068
|
-
if (inspection.sizeBytes > rule.maxBytesPerFile) throw new Error(
|
|
7320
|
+
if (inspection.mimeType && !rule.acceptedMimeTypes.includes(inspection.mimeType)) throw new Error(`${capability.familyLabel} does not accept ${inspection.mimeType} ${mediaKind} references`);
|
|
7321
|
+
if (inspection.sizeBytes > rule.maxBytesPerFile) throw new Error(`${capability.familyLabel} ${mediaKind} references must not exceed ${Math.floor(rule.maxBytesPerFile / (1024 * 1024))} MB`);
|
|
7322
|
+
if (mediaKind === "video" && rule.perFileDurationSeconds && inspection.durationMs !== void 0) {
|
|
7323
|
+
const seconds = inspection.durationMs / 1e3;
|
|
7324
|
+
if (seconds < rule.perFileDurationSeconds.min || seconds > rule.perFileDurationSeconds.max) throw new Error(`${capability.familyLabel} ${mediaKind} references must be ${rule.perFileDurationSeconds.min} to ${rule.perFileDurationSeconds.max} seconds each`);
|
|
7325
|
+
}
|
|
7069
7326
|
if (mediaKind === "video") {
|
|
7070
7327
|
if (isLocal && (!inspection.width || !inspection.height || !inspection.durationMs)) throw new Error(`Could not read Seedance video metadata before upload: ${ref}`);
|
|
7071
|
-
|
|
7072
|
-
|
|
7328
|
+
if (inspection.width !== void 0 && inspection.height !== void 0) {
|
|
7329
|
+
if (rule.dimensionRange) {
|
|
7330
|
+
const { min, max } = rule.dimensionRange;
|
|
7331
|
+
if (inspection.width < min || inspection.width > max || inspection.height < min || inspection.height > max) throw new Error(`${capability.familyLabel} reference video sides must be ${min} to ${max} pixels`);
|
|
7332
|
+
} else {
|
|
7333
|
+
const pixels = inspection.width * inspection.height;
|
|
7334
|
+
if (pixels < 640 * 640 || pixels > 834 * 1112) throw new Error(`${capability.familyLabel} video references must be approximately 480p to 720p`);
|
|
7335
|
+
}
|
|
7336
|
+
if (rule.aspectRatioRange) {
|
|
7337
|
+
const aspectRatio = inspection.width / inspection.height;
|
|
7338
|
+
if (aspectRatio < rule.aspectRatioRange.min || aspectRatio > rule.aspectRatioRange.max) throw new Error(`${capability.familyLabel} reference video aspect ratio is outside the supported range`);
|
|
7339
|
+
}
|
|
7340
|
+
}
|
|
7073
7341
|
}
|
|
7074
|
-
if (mediaKind === "audio" && isLocal && !inspection.durationMs) throw new Error(`Could not read Seedance audio duration before upload: ${ref}`);
|
|
7075
7342
|
inspections[mediaKind].push(inspection);
|
|
7076
7343
|
}
|
|
7077
7344
|
}
|
|
7345
|
+
const videoRule = capability.references.find((rule) => rule.mediaKind === "video");
|
|
7078
7346
|
const videoBytes = inspections.video.reduce((total, item) => total + item.sizeBytes, 0);
|
|
7079
7347
|
const videoDurationMs = inspections.video.reduce((total, item) => total + (item.durationMs ?? 0), 0);
|
|
7080
|
-
if (
|
|
7348
|
+
if (videoRule?.combinedMaxBytes !== void 0 && videoBytes >= videoRule.combinedMaxBytes) throw new Error(`${capability.familyLabel} reference videos exceed their combined file-size limit`);
|
|
7081
7349
|
const hasCompleteVideoDurations = inspections.video.every((item) => item.durationMs !== void 0);
|
|
7082
|
-
|
|
7350
|
+
const videoDurationRange = videoRule?.combinedDurationSeconds;
|
|
7351
|
+
if (inspections.video.length > 0 && hasCompleteVideoDurations && videoDurationRange && (videoDurationMs < (videoDurationRange.min ?? 0) * 1e3 || videoDurationMs > videoDurationRange.max * 1e3)) throw new Error(`${capability.familyLabel} reference videos exceed their combined duration limit`);
|
|
7083
7352
|
}
|
|
7084
|
-
async function resolveReferenceVariantIds(refs, ctx, deps, variants = [], mediaKind = CLI_GENERATION_MEDIA_KIND, assets = [], expectedReferenceMediaKind) {
|
|
7353
|
+
async function resolveReferenceVariantIds(refs, ctx, deps, variants = [], mediaKind = CLI_GENERATION_MEDIA_KIND, assets = [], expectedReferenceMediaKind, seedanceCapability = SEEDANCE_2_CAPABILITIES["seedance-2-reference"]) {
|
|
7085
7354
|
const variantIds = [];
|
|
7086
7355
|
const resolvedVariants = [...variants];
|
|
7087
7356
|
for (const ref of refs) {
|
|
@@ -7103,7 +7372,7 @@ async function resolveReferenceVariantIds(refs, ctx, deps, variants = [], mediaK
|
|
|
7103
7372
|
if (!deps.waitForReferenceVariant) throw new Error(`Reference upload is still processing: ${mirroredVariant.id}`);
|
|
7104
7373
|
resolvedVariants[mirroredVariantIndex] = await deps.waitForReferenceVariant(mirroredVariant);
|
|
7105
7374
|
}
|
|
7106
|
-
validateReferenceVariant(mirror.digestEntry.variantId, resolvedVariants, mediaKind, expectedReferenceMediaKind);
|
|
7375
|
+
validateReferenceVariant(mirror.digestEntry.variantId, resolvedVariants, mediaKind, expectedReferenceMediaKind, seedanceCapability);
|
|
7107
7376
|
await recordReusedReferenceMirror({
|
|
7108
7377
|
ref,
|
|
7109
7378
|
ctx,
|
|
@@ -7135,7 +7404,7 @@ async function resolveReferenceVariantIds(refs, ctx, deps, variants = [], mediaK
|
|
|
7135
7404
|
};
|
|
7136
7405
|
}
|
|
7137
7406
|
resolvedVariants.push(uploaded.variant);
|
|
7138
|
-
validateReferenceVariant(uploaded.variant.id, resolvedVariants, mediaKind, expectedReferenceMediaKind);
|
|
7407
|
+
validateReferenceVariant(uploaded.variant.id, resolvedVariants, mediaKind, expectedReferenceMediaKind, seedanceCapability);
|
|
7139
7408
|
if (deps.recordMirrorForFile) await recordUploadedReferenceMirror({
|
|
7140
7409
|
ref,
|
|
7141
7410
|
ctx,
|
|
@@ -7148,7 +7417,7 @@ async function resolveReferenceVariantIds(refs, ctx, deps, variants = [], mediaK
|
|
|
7148
7417
|
}
|
|
7149
7418
|
if (looksLikeFilePath(ref)) throw new Error(`Reference file not found: ${ref}`);
|
|
7150
7419
|
const variantId = resolveVariantRef(ref, assets, resolvedVariants);
|
|
7151
|
-
validateReferenceVariant(variantId, resolvedVariants, mediaKind, expectedReferenceMediaKind);
|
|
7420
|
+
validateReferenceVariant(variantId, resolvedVariants, mediaKind, expectedReferenceMediaKind, seedanceCapability);
|
|
7152
7421
|
variantIds.push(variantId);
|
|
7153
7422
|
}
|
|
7154
7423
|
return variantIds;
|
|
@@ -7215,7 +7484,7 @@ async function recordUploadedReferenceMirror(input) {
|
|
|
7215
7484
|
console.warn(`Warning: reference upload succeeded but mirror registry was not updated: ${error instanceof Error ? error.message : String(error)}`);
|
|
7216
7485
|
}
|
|
7217
7486
|
}
|
|
7218
|
-
function validateReferenceVariant(ref, variants, mediaKind, expectedReferenceMediaKind) {
|
|
7487
|
+
function validateReferenceVariant(ref, variants, mediaKind, expectedReferenceMediaKind, seedanceCapability = SEEDANCE_2_CAPABILITIES["seedance-2-reference"]) {
|
|
7219
7488
|
const variant = variants.find((candidate) => candidate.id === ref);
|
|
7220
7489
|
if (!variant) throw new Error(`Reference variant not found in space sync state: ${ref}`);
|
|
7221
7490
|
if (variant.status !== "completed") throw new Error(`Reference variant is not completed: ${ref}`);
|
|
@@ -7224,10 +7493,10 @@ function validateReferenceVariant(ref, variants, mediaKind, expectedReferenceMed
|
|
|
7224
7493
|
if (expectedReferenceMediaKind) {
|
|
7225
7494
|
if (expectedReferenceMediaKind === "image" && !variant.image_key) throw new Error(`Reference variant has no image: ${ref}`);
|
|
7226
7495
|
if (expectedReferenceMediaKind !== "image" && !variant.media_key) throw new Error(`Reference variant has no ${expectedReferenceMediaKind} media: ${ref}`);
|
|
7227
|
-
const rule =
|
|
7496
|
+
const rule = seedanceCapability.references.find((candidate) => candidate.mediaKind === expectedReferenceMediaKind);
|
|
7228
7497
|
const mimeType = variant.media_mime_type;
|
|
7229
|
-
if (rule && mimeType && !rule.acceptedMimeTypes.includes(mimeType)) throw new Error(
|
|
7230
|
-
if (rule && variant.media_size_bytes && variant.media_size_bytes > rule.maxBytesPerFile) throw new Error(
|
|
7498
|
+
if (rule && mimeType && !rule.acceptedMimeTypes.includes(mimeType)) throw new Error(`${seedanceCapability.familyLabel} does not accept ${mimeType} ${expectedReferenceMediaKind} references`);
|
|
7499
|
+
if (rule && variant.media_size_bytes && variant.media_size_bytes > rule.maxBytesPerFile) throw new Error(`${seedanceCapability.familyLabel} ${expectedReferenceMediaKind} references must not exceed ${Math.floor(rule.maxBytesPerFile / (1024 * 1024))} MB`);
|
|
7231
7500
|
return;
|
|
7232
7501
|
}
|
|
7233
7502
|
if (mediaKind === "image" && !variant.image_key) throw new Error(`Reference variant has no image: ${ref}`);
|
|
@@ -7359,10 +7628,12 @@ function parseVideoGenerationOptions(parsed, mediaKind) {
|
|
|
7359
7628
|
const tierValue = readOptionalOption(parsed, "tier");
|
|
7360
7629
|
const bitrateValue = readOptionalOption(parsed, "bitrate");
|
|
7361
7630
|
const modeValue = readOptionalOption(parsed, "mode");
|
|
7631
|
+
const guidanceScaleValue = readOptionalOption(parsed, "guidance-scale");
|
|
7632
|
+
const audioGuidanceScaleValue = readOptionalOption(parsed, "audio-guidance-scale");
|
|
7362
7633
|
const modelValue = mediaKind === "video" ? readOptionalOption(parsed, "model") : void 0;
|
|
7363
7634
|
const aspectValue = mediaKind === "video" ? readOptionalOption(parsed, "aspect") : void 0;
|
|
7364
|
-
if (mediaKind !== "video" && resolutionValue === void 0 && durationValue === void 0 && tierValue === void 0 && aspectValue === void 0 && bitrateValue === void 0) return {};
|
|
7365
|
-
if (mediaKind !== "video") throw new Error("
|
|
7635
|
+
if (mediaKind !== "video" && resolutionValue === void 0 && durationValue === void 0 && tierValue === void 0 && aspectValue === void 0 && bitrateValue === void 0 && modeValue === void 0 && guidanceScaleValue === void 0 && audioGuidanceScaleValue === void 0) return {};
|
|
7636
|
+
if (mediaKind !== "video") throw new Error("Video model controls are only supported for video generation");
|
|
7366
7637
|
const videoResolution = resolutionValue === void 0 ? void 0 : normalizeVideoGenerationResolution(resolutionValue);
|
|
7367
7638
|
if (resolutionValue !== void 0 && !videoResolution) throw new Error("--resolution must be 480p, 720p, 1080p, or 4k");
|
|
7368
7639
|
const videoTier = tierValue === void 0 ? void 0 : normalizeVideoGenerationTier(tierValue);
|
|
@@ -7371,18 +7642,41 @@ function parseVideoGenerationOptions(parsed, mediaKind) {
|
|
|
7371
7642
|
if (isAvatarModelId(model)) {
|
|
7372
7643
|
if (parsed.options.refs !== void 0 || parsed.options["first-frame"] !== void 0 || parsed.options["last-frame"] !== void 0) throw new Error("Avatar models accept only --image-refs and --audio-refs");
|
|
7373
7644
|
if (aspectValue !== void 0 || durationValue !== void 0 || tierValue !== void 0 || bitrateValue !== void 0 || parsed.options.audio !== void 0 || parsed.options["no-audio"] !== void 0) throw new Error("Avatar models do not accept --aspect, --duration, --tier, --bitrate, --audio, or --no-audio");
|
|
7374
|
-
if (
|
|
7375
|
-
|
|
7645
|
+
if (model === "kling-avatar-v2") {
|
|
7646
|
+
if (parsed.options.provider !== void 0) throw new Error("Kling Avatar V2 does not accept --provider");
|
|
7647
|
+
if (resolutionValue !== void 0 || guidanceScaleValue !== void 0 || audioGuidanceScaleValue !== void 0) throw new Error("Aurora controls are not supported by --model kling-avatar-v2");
|
|
7648
|
+
if (modeValue !== void 0 && !isAvatarMode(modeValue)) throw new Error(`--mode must be ${AVATAR_MODES.join(" or ")}`);
|
|
7649
|
+
return {
|
|
7650
|
+
model,
|
|
7651
|
+
...modeValue ? { avatarMode: modeValue } : {}
|
|
7652
|
+
};
|
|
7653
|
+
}
|
|
7654
|
+
if (modeValue !== void 0) throw new Error("--mode is only supported by --model kling-avatar-v2");
|
|
7655
|
+
if (resolutionValue !== void 0 && !isAuroraAvatarResolution(resolutionValue)) throw new Error("--model creatify-aurora supports --resolution 480p or 720p; 1080p is not supported");
|
|
7656
|
+
const parseGuidance = (value, option) => {
|
|
7657
|
+
if (value === void 0) return void 0;
|
|
7658
|
+
const parsedValue = Number(value);
|
|
7659
|
+
if (!Number.isFinite(parsedValue) || parsedValue < 0 || parsedValue > 5) throw new Error(`${option} must be a number between 0 and 5`);
|
|
7660
|
+
return parsedValue;
|
|
7661
|
+
};
|
|
7662
|
+
const avatarGuidanceScale = parseGuidance(guidanceScaleValue, "--guidance-scale");
|
|
7663
|
+
const avatarAudioGuidanceScale = parseGuidance(audioGuidanceScaleValue, "--audio-guidance-scale");
|
|
7376
7664
|
return {
|
|
7377
7665
|
model,
|
|
7378
|
-
...
|
|
7666
|
+
...resolutionValue ? { avatarResolution: resolutionValue } : {},
|
|
7667
|
+
...avatarGuidanceScale !== void 0 ? { avatarGuidanceScale } : {},
|
|
7668
|
+
...avatarAudioGuidanceScale !== void 0 ? { avatarAudioGuidanceScale } : {}
|
|
7379
7669
|
};
|
|
7380
7670
|
}
|
|
7381
7671
|
if (modeValue !== void 0) throw new Error("--mode is only supported by --model kling-avatar-v2");
|
|
7672
|
+
if (guidanceScaleValue !== void 0 || audioGuidanceScaleValue !== void 0) throw new Error("--guidance-scale and --audio-guidance-scale require --model creatify-aurora");
|
|
7382
7673
|
const seedanceCapability = getSeedance2CapabilityByEndpoint(model);
|
|
7383
|
-
const seedanceDuration = durationValue === void 0 ? void 0 :
|
|
7674
|
+
const seedanceDuration = durationValue === void 0 ? void 0 : seedanceCapability ? normalizeSeedanceDuration(durationValue, model) : void 0;
|
|
7384
7675
|
const videoDurationSeconds = durationValue === void 0 || durationValue === "auto" ? void 0 : normalizeVideoGenerationDurationSeconds(durationValue);
|
|
7385
|
-
if (durationValue !== void 0 && seedanceDuration === void 0)
|
|
7676
|
+
if (seedanceCapability && durationValue !== void 0 && seedanceDuration === void 0) {
|
|
7677
|
+
const numericDurations = seedanceCapability.durations.filter((value) => typeof value === "number");
|
|
7678
|
+
throw new Error(`--duration must be auto or an integer from ${numericDurations[0]} to ${numericDurations.at(-1)}`);
|
|
7679
|
+
}
|
|
7386
7680
|
if (!seedanceCapability && durationValue === "auto") throw new Error("--duration auto is only supported by Seedance 2");
|
|
7387
7681
|
if (isGeminiOmniVideoGenerationModel(model) && (resolutionValue !== void 0 || durationValue !== void 0 || tierValue !== void 0)) throw new Error("--resolution, --duration, and --tier are only supported with --model veo-3.1");
|
|
7388
7682
|
if ((isKlingVideoGenerationModel(model) || isFalVideoGenerationModel(model)) && tierValue !== void 0) throw new Error("--tier is only supported with --model veo-3.1");
|
|
@@ -7393,10 +7687,10 @@ function parseVideoGenerationOptions(parsed, mediaKind) {
|
|
|
7393
7687
|
6,
|
|
7394
7688
|
8
|
|
7395
7689
|
].includes(videoDurationSeconds)) throw new Error("--duration must be 4, 6, or 8 for this model");
|
|
7396
|
-
const aspectRatio = aspectValue === void 0 ? void 0 : seedanceCapability
|
|
7397
|
-
if (aspectValue !== void 0 && !aspectRatio) throw new Error(seedanceCapability ?
|
|
7690
|
+
const aspectRatio = aspectValue === void 0 ? void 0 : seedanceCapability ? seedanceCapability.aspectRatios.includes(aspectValue) ? aspectValue : void 0 : normalizeVideoGenerationAspectRatio(aspectValue);
|
|
7691
|
+
if (aspectValue !== void 0 && !aspectRatio) throw new Error(seedanceCapability ? `--aspect must be one of: ${seedanceCapability.aspectRatios.join(", ")}` : "--aspect must be 16:9 or 9:16");
|
|
7398
7692
|
const seedanceBitrateMode = bitrateValue;
|
|
7399
|
-
if (bitrateValue !== void 0 && (!seedanceCapability || !seedanceCapability.bitrateModes.includes(seedanceBitrateMode))) throw new Error("--bitrate standard|high is only supported by Seedance 2");
|
|
7693
|
+
if (bitrateValue !== void 0 && (!seedanceCapability || !seedanceCapability.bitrateModes.includes(seedanceBitrateMode))) throw new Error(seedanceCapability ? `${seedanceCapability.familyLabel} does not accept --bitrate` : "--bitrate standard|high is only supported by Seedance 2");
|
|
7400
7694
|
return {
|
|
7401
7695
|
model,
|
|
7402
7696
|
...aspectRatio ? { aspectRatio } : {},
|
|
@@ -7407,6 +7701,14 @@ function parseVideoGenerationOptions(parsed, mediaKind) {
|
|
|
7407
7701
|
...seedanceBitrateMode ? { seedanceBitrateMode } : {}
|
|
7408
7702
|
};
|
|
7409
7703
|
}
|
|
7704
|
+
function parseGenerationProviderOption(parsed, mediaKind, videoModel) {
|
|
7705
|
+
const value = readOptionalOption(parsed, "provider");
|
|
7706
|
+
if (value === void 0) return void 0;
|
|
7707
|
+
if (!GENERATION_ROUTING_PROVIDERS.includes(value)) throw new Error(`--provider must be one of: ${GENERATION_ROUTING_PROVIDERS.join(", ")}`);
|
|
7708
|
+
if (mediaKind === "audio") throw new Error("--provider is supported only for routable image and video models");
|
|
7709
|
+
if (videoModel === "kling-avatar-v2") throw new Error("Kling Avatar V2 does not accept --provider");
|
|
7710
|
+
return value;
|
|
7711
|
+
}
|
|
7410
7712
|
function parseVideoFrameReferenceOptions(parsed, command, mediaKind) {
|
|
7411
7713
|
validateVideoFrameReferenceOptions(command, parsed, mediaKind);
|
|
7412
7714
|
const firstFrame = readVideoFrameOption(parsed, "first-frame");
|
|
@@ -7459,6 +7761,8 @@ function parseImageGenerationOptions(parsed, mediaKind) {
|
|
|
7459
7761
|
const model = parseImageModelOption(readOptionalOption(parsed, "model"));
|
|
7460
7762
|
const imageSize = parseImageSizeOption(readOptionalOption(parsed, "size"));
|
|
7461
7763
|
const aspectRatio = parseImageAspectRatioOption(readOptionalOption(parsed, "aspect"));
|
|
7764
|
+
const imageQuality = parseImageQualityOption(readOptionalOption(parsed, "quality"));
|
|
7765
|
+
const imageSeed = parseImageSeedOption(readOptionalOption(parsed, "seed"));
|
|
7462
7766
|
if (imageSize && !isImageSizeSupportedByModel(model, imageSize)) {
|
|
7463
7767
|
const supportedSizes = getImageModelCapabilities(model).supportedImageSizes.join(", ");
|
|
7464
7768
|
throw new Error(`--model ${model ?? "pro"} supports only --size ${supportedSizes}`);
|
|
@@ -7467,9 +7771,16 @@ function parseImageGenerationOptions(parsed, mediaKind) {
|
|
|
7467
7771
|
const supportedAspectRatios = getImageModelCapabilities(model).supportedAspectRatios.join(", ");
|
|
7468
7772
|
throw new Error(`--model ${model ?? "pro"} supports only --aspect ${supportedAspectRatios}`);
|
|
7469
7773
|
}
|
|
7774
|
+
if (imageQuality && !isImageQualitySupportedByModel(model ?? "pro", imageQuality)) {
|
|
7775
|
+
const supported = getImageModelCapabilities(model).supportedQualities.join(", ");
|
|
7776
|
+
throw new Error(`--model ${model ?? "pro"} supports ${supported ? `only --quality ${supported}` : "no --quality option"}`);
|
|
7777
|
+
}
|
|
7778
|
+
if (imageSeed !== void 0 && !isImageSeedSupportedByModel(model ?? "pro")) throw new Error(`--model ${model ?? "pro"} does not support --seed`);
|
|
7470
7779
|
return {
|
|
7471
7780
|
...model ? { model } : {},
|
|
7472
7781
|
...imageSize ? { imageSize } : {},
|
|
7782
|
+
...imageQuality ? { imageQuality } : {},
|
|
7783
|
+
...imageSeed !== void 0 ? { imageSeed } : {},
|
|
7473
7784
|
...aspectRatio ? { aspectRatio } : {}
|
|
7474
7785
|
};
|
|
7475
7786
|
}
|
|
@@ -7478,26 +7789,40 @@ function parseVideoModelOption(value, tier, parsed) {
|
|
|
7478
7789
|
const effectiveTier = tier ?? "generate";
|
|
7479
7790
|
if (!normalized) return getVideoGenerationModelForSelection(DEFAULT_VIDEO_MODEL_SELECTION, effectiveTier);
|
|
7480
7791
|
if (isAvatarModelId(normalized)) return normalized;
|
|
7481
|
-
if (normalized === "seedance-2" || normalized === "seedance-2-fast") {
|
|
7792
|
+
if (normalized === "seedance-2" || normalized === "seedance-2-fast" || normalized === "seedance-2.5") {
|
|
7482
7793
|
const hasFrames = Boolean(parsed?.options["first-frame"] || parsed?.options["last-frame"]);
|
|
7483
7794
|
const hasReferences = Boolean(parsed?.options.refs || parsed?.options["image-refs"] || parsed?.options["video-refs"] || parsed?.options["audio-refs"]);
|
|
7484
|
-
return SEEDANCE_2_CAPABILITIES[`${normalized
|
|
7795
|
+
return SEEDANCE_2_CAPABILITIES[`${normalized}-${hasFrames ? "frame" : hasReferences ? "reference" : "text"}`].endpointId;
|
|
7485
7796
|
}
|
|
7486
7797
|
const selection = normalizeVideoModelSelection(normalized === "seedance-1" ? "fal-seedance" : normalized);
|
|
7487
7798
|
if (selection) return getVideoGenerationModelForSelection(selection, effectiveTier);
|
|
7488
|
-
throw new Error("--model must be veo-3.1, omni-flash, kling, seedance-1, seedance-2, seedance-2-fast,
|
|
7799
|
+
throw new Error("--model must be veo-3.1, omni-flash, kling, seedance-1, seedance-2, seedance-2-fast, seedance-2.5, kling-avatar-v2, or creatify-aurora");
|
|
7489
7800
|
}
|
|
7490
7801
|
function parseImageModelOption(value) {
|
|
7491
7802
|
if (!value) return void 0;
|
|
7492
7803
|
if (isImageModelSelection(value)) return value;
|
|
7493
|
-
throw new Error(
|
|
7804
|
+
throw new Error(`--model must be one of: ${IMAGE_MODEL_SELECTIONS.join(", ")}`);
|
|
7494
7805
|
}
|
|
7495
7806
|
function parseImageSizeOption(value) {
|
|
7496
7807
|
if (!value) return void 0;
|
|
7497
7808
|
const normalized = normalizeImageSize(value);
|
|
7498
|
-
if (!normalized) throw new Error("--size must be 1K, 2K, or 4K");
|
|
7809
|
+
if (!normalized) throw new Error("--size must be 1K, 2K, 3K, or 4K");
|
|
7499
7810
|
return normalized;
|
|
7500
7811
|
}
|
|
7812
|
+
function parseImageQualityOption(value) {
|
|
7813
|
+
const normalized = normalizeCliOption(value);
|
|
7814
|
+
if (!normalized) return void 0;
|
|
7815
|
+
const quality = normalizeImageQuality(normalized);
|
|
7816
|
+
if (!quality) throw new Error("--quality must be low, medium, or high");
|
|
7817
|
+
return quality;
|
|
7818
|
+
}
|
|
7819
|
+
function parseImageSeedOption(value) {
|
|
7820
|
+
const normalized = normalizeCliOption(value);
|
|
7821
|
+
if (!normalized) return void 0;
|
|
7822
|
+
const seed = Number(normalized);
|
|
7823
|
+
if (!Number.isSafeInteger(seed)) throw new Error("--seed must be a safe integer");
|
|
7824
|
+
return seed;
|
|
7825
|
+
}
|
|
7501
7826
|
function parseImageAspectRatioOption(value) {
|
|
7502
7827
|
if (!value) return void 0;
|
|
7503
7828
|
if (!isImageAspectRatio(value)) {
|
|
@@ -7555,7 +7880,7 @@ function cliImageModelValues(command) {
|
|
|
7555
7880
|
function printUsage$6(command) {
|
|
7556
7881
|
console.log(`
|
|
7557
7882
|
Usage:
|
|
7558
|
-
makefx image generate "prompt" --name <name> --type <type> -o <file> [--model ${cliImageModelValues(command)}] [--refs <variant-ref-or-file,...>] [--size ${cliImageSizeValues()}] [--aspect ${cliImageAspectValues()}] [--collection <id>] [--space <id>]
|
|
7883
|
+
makefx image generate "prompt" --name <name> --type <type> -o <file> [--model ${cliImageModelValues(command)}] [--refs <variant-ref-or-file,...>] [--size ${cliImageSizeValues()}] [--quality low|medium|high] [--seed <integer>] [--aspect ${cliImageAspectValues()}] [--collection <id>] [--space <id>]
|
|
7559
7884
|
`);
|
|
7560
7885
|
}
|
|
7561
7886
|
//#endregion
|
|
@@ -7657,6 +7982,9 @@ function buildRegenerationBody(mediaKind, parsed, referenceVariantIds, audioMode
|
|
|
7657
7982
|
const params = {};
|
|
7658
7983
|
let duration;
|
|
7659
7984
|
let modelProvider;
|
|
7985
|
+
const provider = parsed.options.provider;
|
|
7986
|
+
if (provider !== void 0 && !GENERATION_ROUTING_PROVIDERS.includes(provider)) throw new Error(`--provider must be one of: ${GENERATION_ROUTING_PROVIDERS.join(", ")}`);
|
|
7987
|
+
if (provider !== void 0 && mediaKind === "audio") throw new Error("--provider is supported only for routable image and video models");
|
|
7660
7988
|
if (mediaKind === "image") {
|
|
7661
7989
|
if (model) {
|
|
7662
7990
|
if (!isImageModelSelection(model)) throw new Error(`Unsupported image model: ${model}`);
|
|
@@ -7664,6 +7992,8 @@ function buildRegenerationBody(mediaKind, parsed, referenceVariantIds, audioMode
|
|
|
7664
7992
|
}
|
|
7665
7993
|
if (parsed.options.aspect) params.aspectRatio = parsed.options.aspect;
|
|
7666
7994
|
if (parsed.options.size) params.imageSize = parsed.options.size;
|
|
7995
|
+
if (parsed.options.quality) params.imageQuality = parsed.options.quality;
|
|
7996
|
+
if (parsed.options.seed) params.imageSeed = parsed.options.seed === "random" ? null : parseInteger(parsed.options.seed, "--seed");
|
|
7667
7997
|
} else if (mediaKind === "video") {
|
|
7668
7998
|
if (parsed.options.aspect) params.aspectRatio = parsed.options.aspect;
|
|
7669
7999
|
if (parsed.options.resolution) params.videoResolution = parsed.options.resolution;
|
|
@@ -7685,6 +8015,7 @@ function buildRegenerationBody(mediaKind, parsed, referenceVariantIds, audioMode
|
|
|
7685
8015
|
...model && mediaKind === "video" ? { model: resolveVideoRegenerationModel(model, parsed, sourceRecipe) } : {},
|
|
7686
8016
|
...audioModel ? { model: audioModel } : {},
|
|
7687
8017
|
...modelProvider ? { modelProvider } : {},
|
|
8018
|
+
...provider ? { provider } : {},
|
|
7688
8019
|
...referenceVariantIds !== void 0 ? { referenceVariantIds } : {},
|
|
7689
8020
|
...Object.keys(params).length > 0 ? { params } : {},
|
|
7690
8021
|
...duration !== void 0 ? { duration } : {},
|
|
@@ -7693,21 +8024,26 @@ function buildRegenerationBody(mediaKind, parsed, referenceVariantIds, audioMode
|
|
|
7693
8024
|
}
|
|
7694
8025
|
function resolveVideoRegenerationModel(model, parsed, sourceRecipe) {
|
|
7695
8026
|
const tier = parsed.options.tier ?? "generate";
|
|
7696
|
-
if (model === "seedance-2" || model === "seedance-2-fast") {
|
|
8027
|
+
if (model === "seedance-2" || model === "seedance-2-fast" || model === "seedance-2.5") {
|
|
7697
8028
|
const referencesWereOverridden = [
|
|
7698
8029
|
"image-refs",
|
|
7699
8030
|
"video-refs",
|
|
7700
8031
|
"audio-refs"
|
|
7701
8032
|
].some((name) => parsed.options[name] !== void 0);
|
|
7702
8033
|
const storedRecipe = parseStoredRecipe$2(sourceRecipe);
|
|
8034
|
+
const effectiveReferences = referencesWereOverridden ? [
|
|
8035
|
+
...splitList(parsed.options["image-refs"]).map(() => ({ mediaKind: "image" })),
|
|
8036
|
+
...splitList(parsed.options["video-refs"]).map(() => ({ mediaKind: "video" })),
|
|
8037
|
+
...splitList(parsed.options["audio-refs"]).map(() => ({ mediaKind: "audio" }))
|
|
8038
|
+
] : storedRecipe?.references ?? [];
|
|
7703
8039
|
return getSeedance2RegenerationCapability(model, {
|
|
7704
8040
|
model: storedRecipe?.model,
|
|
7705
|
-
references:
|
|
8041
|
+
references: effectiveReferences,
|
|
7706
8042
|
authoritativeFrames: storedRecipe?.veoReferenceMode === "image-to-video" || storedRecipe?.veoReferenceMode === "first-last-frame"
|
|
7707
8043
|
}, referencesWereOverridden).endpointId;
|
|
7708
8044
|
}
|
|
7709
8045
|
const selection = normalizeVideoModelSelection(model === "seedance-1" ? "fal-seedance" : model);
|
|
7710
|
-
if (!selection) throw new Error("Unsupported video model. Expected veo-3.1, omni-flash, kling, seedance-1, seedance-2, or seedance-2
|
|
8046
|
+
if (!selection) throw new Error("Unsupported video model. Expected veo-3.1, omni-flash, kling, seedance-1, seedance-2, seedance-2-fast, or seedance-2.5");
|
|
7711
8047
|
return getVideoGenerationModelForSelection(selection, tier);
|
|
7712
8048
|
}
|
|
7713
8049
|
function parseStoredRecipe$2(recipe) {
|
|
@@ -8639,8 +8975,7 @@ async function executeSpaceLens(parsed, deps = defaultDeps$8) {
|
|
|
8639
8975
|
deps.print(parsed.options.json === "true" ? JSON.stringify(result, null, 2) : `Set the Space canvas lens to ${lens}`);
|
|
8640
8976
|
return result;
|
|
8641
8977
|
}
|
|
8642
|
-
|
|
8643
|
-
//#region src/shared/generatorCapabilities.ts
|
|
8978
|
+
IMAGE_MODEL_SELECTIONS.map((selection) => `image/${selection}`);
|
|
8644
8979
|
function input(name, type, required, description, options = {}) {
|
|
8645
8980
|
return {
|
|
8646
8981
|
name,
|
|
@@ -8673,8 +9008,13 @@ function imageGenerator(capability) {
|
|
|
8673
9008
|
}),
|
|
8674
9009
|
input("image_size", "string", false, "Output image size.", {
|
|
8675
9010
|
allowedValues: capability.supportedImageSizes,
|
|
8676
|
-
defaultValue:
|
|
8677
|
-
})
|
|
9011
|
+
defaultValue: capability.supportedImageSizes[0]
|
|
9012
|
+
}),
|
|
9013
|
+
...capability.supportedQualities.length ? [input("quality", "string", false, "Output rendering quality.", {
|
|
9014
|
+
allowedValues: capability.supportedQualities,
|
|
9015
|
+
defaultValue: "medium"
|
|
9016
|
+
})] : [],
|
|
9017
|
+
...capability.supportsSeed ? [input("seed", "integer", false, "Optional reproducible generation seed.")] : []
|
|
8678
9018
|
];
|
|
8679
9019
|
const operations = [{
|
|
8680
9020
|
operation: "generate",
|
|
@@ -8711,8 +9051,13 @@ function imageGenerator(capability) {
|
|
|
8711
9051
|
}),
|
|
8712
9052
|
input("image_size", "string", false, "Output image size.", {
|
|
8713
9053
|
allowedValues: capability.supportedImageSizes,
|
|
8714
|
-
defaultValue:
|
|
8715
|
-
})
|
|
9054
|
+
defaultValue: capability.supportedImageSizes[0]
|
|
9055
|
+
}),
|
|
9056
|
+
...capability.supportedQualities.length ? [input("quality", "string", false, "Output rendering quality.", {
|
|
9057
|
+
allowedValues: capability.supportedQualities,
|
|
9058
|
+
defaultValue: "medium"
|
|
9059
|
+
})] : [],
|
|
9060
|
+
...capability.supportsSeed ? [input("seed", "integer", false, "Optional reproducible generation seed.")] : []
|
|
8716
9061
|
]
|
|
8717
9062
|
});
|
|
8718
9063
|
return {
|
|
@@ -8810,7 +9155,8 @@ function videoGenerator(selection) {
|
|
|
8810
9155
|
};
|
|
8811
9156
|
}
|
|
8812
9157
|
function seedanceVideoGenerator(capability) {
|
|
8813
|
-
const fixedGenerator = fixedInput("generator_id", capability.generatorId,
|
|
9158
|
+
const fixedGenerator = fixedInput("generator_id", capability.generatorId, `Selects this exact ${capability.familyLabel} mode and tier.`);
|
|
9159
|
+
const numericDurations = capability.durations.filter((value) => typeof value === "number");
|
|
8814
9160
|
const parameters = [
|
|
8815
9161
|
input("aspect_ratio", "string", false, "Output aspect ratio; auto lets Seedance infer it.", {
|
|
8816
9162
|
allowedValues: capability.aspectRatios,
|
|
@@ -8820,19 +9166,19 @@ function seedanceVideoGenerator(capability) {
|
|
|
8820
9166
|
allowedValues: capability.resolutions,
|
|
8821
9167
|
defaultValue: capability.defaultResolution
|
|
8822
9168
|
}),
|
|
8823
|
-
input("duration", "string_or_integer", false,
|
|
9169
|
+
input("duration", "string_or_integer", false, `Output seconds from ${numericDurations[0]} to ${numericDurations.at(-1)}, or auto.`, {
|
|
8824
9170
|
allowedValues: capability.durations,
|
|
8825
9171
|
defaultValue: capability.defaultDuration
|
|
8826
9172
|
}),
|
|
8827
9173
|
input("generate_audio", "boolean", false, "Generate synchronized native audio.", {
|
|
8828
9174
|
allowedValues: [true, false],
|
|
8829
9175
|
defaultValue: capability.generateAudio.default
|
|
8830
|
-
}),
|
|
8831
|
-
input("bitrate_mode", "string", false, "Output bitrate quality.", {
|
|
8832
|
-
allowedValues: capability.bitrateModes,
|
|
8833
|
-
defaultValue: capability.defaultBitrateMode
|
|
8834
9176
|
})
|
|
8835
9177
|
];
|
|
9178
|
+
if (capability.bitrateModes.length > 0) parameters.push(input("bitrate_mode", "string", false, "Output bitrate quality.", {
|
|
9179
|
+
allowedValues: capability.bitrateModes,
|
|
9180
|
+
defaultValue: capability.defaultBitrateMode
|
|
9181
|
+
}));
|
|
8836
9182
|
const common = [
|
|
8837
9183
|
SPACE_INPUT,
|
|
8838
9184
|
fixedGenerator,
|
|
@@ -8842,18 +9188,21 @@ function seedanceVideoGenerator(capability) {
|
|
|
8842
9188
|
...parameters
|
|
8843
9189
|
];
|
|
8844
9190
|
const frameInputs = [input("start_frame_variant_ref", "string", true, "Completed image variant used as the authoritative first frame; cannot be combined with extended references."), input("end_frame_variant_ref", "string", false, "Completed image variant used as the authoritative final frame; cannot be combined with extended references.")];
|
|
9191
|
+
const referenceMax = (mediaKind) => capability.references.find((reference) => reference.mediaKind === mediaKind)?.maxCount ?? 0;
|
|
9192
|
+
const audioRule = capability.references.find((reference) => reference.mediaKind === "audio");
|
|
9193
|
+
const audioDurationContract = audioRule?.perFileDurationSeconds && audioRule.combinedDurationSeconds ? ` Provider contract: each clip ${audioRule.perFileDurationSeconds.min}-${audioRule.perFileDurationSeconds.max}s, ${audioRule.combinedDurationSeconds.max}s combined; MakeFX does not inspect audio duration.` : "";
|
|
8845
9194
|
const referenceInputs = [
|
|
8846
|
-
input("image_reference_variant_refs", "string_array", false,
|
|
9195
|
+
input("image_reference_variant_refs", "string_array", false, `Ordered completed images addressed as @Image1 through @Image${referenceMax("image")} for soft subject, style, or geography guidance; not authoritative boundary frames.`, {
|
|
8847
9196
|
minItems: 1,
|
|
8848
|
-
maxItems:
|
|
9197
|
+
maxItems: referenceMax("image")
|
|
8849
9198
|
}),
|
|
8850
|
-
input("video_reference_variant_refs", "string_array", false,
|
|
9199
|
+
input("video_reference_variant_refs", "string_array", false, `Ordered completed videos addressed as @Video1 through @Video${referenceMax("video")}.`, {
|
|
8851
9200
|
minItems: 1,
|
|
8852
|
-
maxItems:
|
|
9201
|
+
maxItems: referenceMax("video")
|
|
8853
9202
|
}),
|
|
8854
|
-
input("audio_reference_variant_refs", "string_array", false,
|
|
9203
|
+
input("audio_reference_variant_refs", "string_array", false, `Ordered completed audio clips addressed as @Audio1 through @Audio${referenceMax("audio")}.${audioDurationContract}`, {
|
|
8855
9204
|
minItems: 1,
|
|
8856
|
-
maxItems:
|
|
9205
|
+
maxItems: referenceMax("audio")
|
|
8857
9206
|
})
|
|
8858
9207
|
];
|
|
8859
9208
|
const modeInputs = capability.mode === "frame" ? frameInputs : capability.mode === "reference" ? referenceInputs : [];
|
|
@@ -8867,8 +9216,8 @@ function seedanceVideoGenerator(capability) {
|
|
|
8867
9216
|
const budget = getSeedance2ReferenceBudget(capability, "refine");
|
|
8868
9217
|
const editReferenceInputs = referenceInputs.map((referenceInput) => referenceInput.name === "video_reference_variant_refs" ? {
|
|
8869
9218
|
...referenceInput,
|
|
8870
|
-
maxItems:
|
|
8871
|
-
description:
|
|
9219
|
+
maxItems: budget.maxAdditionalByKind.video,
|
|
9220
|
+
description: `Up to ${budget.maxAdditionalByKind.video} additional completed videos addressed from @Video2; the source video is @Video1.`
|
|
8872
9221
|
} : referenceInput);
|
|
8873
9222
|
operations.push({
|
|
8874
9223
|
operation: "refine",
|
|
@@ -8917,19 +9266,35 @@ function seedanceVideoGenerator(capability) {
|
|
|
8917
9266
|
notes: [
|
|
8918
9267
|
"Use compact variant references; binary media input is not accepted.",
|
|
8919
9268
|
capability.mode === "reference" ? "Prompt labels are modality-specific and one-based: @ImageN, @VideoN, and @AudioN. @ImageN guides content, style, or geography but is not an authoritative start/end frame." : capability.mode === "frame" ? "The start and end images are authoritative boundary frames. The provider does not allow extended image, video, or audio references in this mode." : "This mode rejects all reference inputs.",
|
|
8920
|
-
|
|
8921
|
-
capability.resolutions.includes("4k") ? "Standard supports 480p, 720p, 1080p, and 4K output." : "Fast supports 480p and 720p output."
|
|
9269
|
+
`${capability.familyLabel} cannot combine authoritative start/end frames with extended multimodal references in one request.`,
|
|
9270
|
+
capability.family === "seedance-2.5" ? "Seedance 2.5 supports 480p, 720p, and 1080p output; 4K is not exposed by the provider." : capability.resolutions.includes("4k") ? "Standard supports 480p, 720p, 1080p, and 4K output." : "Fast supports 480p and 720p output."
|
|
8922
9271
|
]
|
|
8923
9272
|
};
|
|
8924
9273
|
}
|
|
8925
9274
|
function avatarVideoGenerator(model) {
|
|
8926
|
-
const
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
9275
|
+
const capability = getAvatarModelCapabilities(model);
|
|
9276
|
+
const parameters = capability.model === "kling-avatar-v2" ? [input("mode", "string", false, "Generation quality.", {
|
|
9277
|
+
allowedValues: capability.modes,
|
|
9278
|
+
defaultValue: capability.defaultMode
|
|
9279
|
+
})] : [
|
|
9280
|
+
input("resolution", "string", false, "Output resolution.", {
|
|
9281
|
+
allowedValues: capability.resolutions,
|
|
9282
|
+
defaultValue: capability.defaultResolution
|
|
9283
|
+
}),
|
|
9284
|
+
input("guidance_scale", "number", false, "Strength of visual prompt guidance.", {
|
|
9285
|
+
defaultValue: capability.guidanceScale.default,
|
|
9286
|
+
minimum: capability.guidanceScale.min,
|
|
9287
|
+
maximum: capability.guidanceScale.max
|
|
9288
|
+
}),
|
|
9289
|
+
input("audio_guidance_scale", "number", false, "Strength of audio-driven motion guidance.", {
|
|
9290
|
+
defaultValue: capability.audioGuidanceScale.default,
|
|
9291
|
+
minimum: capability.audioGuidanceScale.min,
|
|
9292
|
+
maximum: capability.audioGuidanceScale.max
|
|
9293
|
+
})
|
|
9294
|
+
];
|
|
8930
9295
|
return {
|
|
8931
9296
|
id: `video/${model}`,
|
|
8932
|
-
label:
|
|
9297
|
+
label: capability.label,
|
|
8933
9298
|
mediaKind: "video",
|
|
8934
9299
|
modelIds: [model],
|
|
8935
9300
|
defaultModelId: model,
|
|
@@ -8985,7 +9350,7 @@ function avatarVideoGenerator(model) {
|
|
|
8985
9350
|
maxBytesPerFile: 5 * 1024 * 1024
|
|
8986
9351
|
}]
|
|
8987
9352
|
},
|
|
8988
|
-
notes: ["Outputs an ordinary video Variant. Provider routing remains internal."]
|
|
9353
|
+
notes: ["Outputs an ordinary video Variant. Provider routing remains internal.", ...capability.model === "creatify-aurora" ? ["Aurora supports 480p and 720p output; 1080p is not supported by the provider."] : []]
|
|
8989
9354
|
};
|
|
8990
9355
|
}
|
|
8991
9356
|
function audioGenerator(input_) {
|
|
@@ -9097,6 +9462,8 @@ var DRAFT_RECIPE_INPUT_KEYS = {
|
|
|
9097
9462
|
prompt: "prompt",
|
|
9098
9463
|
aspect_ratio: "aspectRatio",
|
|
9099
9464
|
image_size: "imageSize",
|
|
9465
|
+
quality: "imageQuality",
|
|
9466
|
+
seed: "imageSeed",
|
|
9100
9467
|
model: "model",
|
|
9101
9468
|
voice_id: "voiceId",
|
|
9102
9469
|
dialogue_voice_ids: "dialogueVoiceIds",
|
|
@@ -9106,11 +9473,14 @@ var DRAFT_RECIPE_INPUT_KEYS = {
|
|
|
9106
9473
|
video_duration_seconds: "videoDurationSeconds",
|
|
9107
9474
|
video_tier: "videoTier",
|
|
9108
9475
|
duration: "seedanceDuration",
|
|
9109
|
-
bitrate_mode: "seedanceBitrateMode"
|
|
9476
|
+
bitrate_mode: "seedanceBitrateMode",
|
|
9477
|
+
provider: "provider"
|
|
9110
9478
|
};
|
|
9111
9479
|
function draftRecipeInputKey(inputName, generatorId) {
|
|
9112
|
-
if (generatorId === "video/p-video-avatar" && inputName === "resolution") return "avatarResolution";
|
|
9480
|
+
if ((generatorId === "video/p-video-avatar" || generatorId === "video/creatify-aurora") && inputName === "resolution") return "avatarResolution";
|
|
9113
9481
|
if (generatorId === "video/kling-avatar-v2" && inputName === "mode") return "avatarMode";
|
|
9482
|
+
if (generatorId === "video/creatify-aurora" && inputName === "guidance_scale") return "avatarGuidanceScale";
|
|
9483
|
+
if (generatorId === "video/creatify-aurora" && inputName === "audio_guidance_scale") return "avatarAudioGuidanceScale";
|
|
9114
9484
|
return DRAFT_RECIPE_INPUT_KEYS[inputName];
|
|
9115
9485
|
}
|
|
9116
9486
|
var DRAFT_REFERENCE_FIELD = /(?:_variant_refs?|VariantRefs?)$/;
|
|
@@ -9161,6 +9531,7 @@ function buildDraftMapping(args) {
|
|
|
9161
9531
|
const value = recipe[key];
|
|
9162
9532
|
if (value !== void 0) recipeTemplate[key] = value;
|
|
9163
9533
|
}
|
|
9534
|
+
if (recipe.provider !== void 0) recipeTemplate.provider = recipe.provider;
|
|
9164
9535
|
const availableSlots = operationDefinition.inputs.filter((input) => DRAFT_REFERENCE_FIELD.test(input.name)).map((input) => input.name);
|
|
9165
9536
|
const bindings = [];
|
|
9166
9537
|
if (destinationKind === "sibling" && sourceVariantId && availableSlots.includes("source_variant_ref")) bindings.push({
|
|
@@ -10359,7 +10730,29 @@ async function executeModels(parsed, deps = defaultDeps$5) {
|
|
|
10359
10730
|
deps.print(parsed.options.json === "true" ? JSON.stringify(model, null, 2) : formatModelDetail(model));
|
|
10360
10731
|
return model;
|
|
10361
10732
|
}
|
|
10362
|
-
|
|
10733
|
+
if (command === "configure") {
|
|
10734
|
+
const id = parsed.positionals[1];
|
|
10735
|
+
if (!id) throw new Error("Model is required: makefx models configure <model>");
|
|
10736
|
+
const provider = parsed.options.provider;
|
|
10737
|
+
const reset = parsed.options["reset-provider"] === "true";
|
|
10738
|
+
if ((!provider || provider === "true") === !reset) throw new Error("Use exactly one of --provider <provider> or --reset-provider");
|
|
10739
|
+
const response = reset ? await deps.fetch(`${baseUrl}/api/user/model-provider-preferences/${encodeURIComponent(id)}`, {
|
|
10740
|
+
method: "DELETE",
|
|
10741
|
+
headers
|
|
10742
|
+
}) : await deps.fetch(`${baseUrl}/api/user/model-provider-preferences/${encodeURIComponent(id)}`, {
|
|
10743
|
+
method: "PUT",
|
|
10744
|
+
headers: {
|
|
10745
|
+
...headers,
|
|
10746
|
+
"Content-Type": "application/json"
|
|
10747
|
+
},
|
|
10748
|
+
body: JSON.stringify({ provider })
|
|
10749
|
+
});
|
|
10750
|
+
if (!response.ok) throw new Error(`Model provider configuration failed (${response.status}): ${await response.text()}`);
|
|
10751
|
+
const { preference } = await response.json();
|
|
10752
|
+
deps.print(parsed.options.json === "true" ? JSON.stringify(preference, null, 2) : formatModelRouting(preference));
|
|
10753
|
+
return preference;
|
|
10754
|
+
}
|
|
10755
|
+
throw new Error("Models command is required: list, show, or configure");
|
|
10363
10756
|
}
|
|
10364
10757
|
function formatModelDetail(model) {
|
|
10365
10758
|
const lines = [
|
|
@@ -10369,6 +10762,7 @@ function formatModelDetail(model) {
|
|
|
10369
10762
|
"Operations:"
|
|
10370
10763
|
];
|
|
10371
10764
|
if (!model.availability.available && model.availability.guidance) lines.splice(3, 0, `Next step: ${model.availability.guidance}`);
|
|
10765
|
+
if (model.routing) lines.splice(3, 0, ...formatModelRoutingLines(model));
|
|
10372
10766
|
for (const operation of model.operations) {
|
|
10373
10767
|
if (typeof operation === "string") {
|
|
10374
10768
|
lines.push(` - ${operation}`);
|
|
@@ -10390,6 +10784,20 @@ function formatModelDetail(model) {
|
|
|
10390
10784
|
}
|
|
10391
10785
|
return lines.join("\n");
|
|
10392
10786
|
}
|
|
10787
|
+
function formatModelRouting(model) {
|
|
10788
|
+
return [`${model.label} (${model.model})`, ...formatModelRoutingLines(model)].join("\n");
|
|
10789
|
+
}
|
|
10790
|
+
function formatModelRoutingLines(model) {
|
|
10791
|
+
if (!model.routing) return [];
|
|
10792
|
+
const lines = [`Default provider: ${model.routing.effective_provider} (${model.routing.source})`, "Provider routes:"];
|
|
10793
|
+
for (const provider of model.routing.providers) {
|
|
10794
|
+
const credential = provider.requires_byok ? "BYOK" : "managed or BYOK";
|
|
10795
|
+
lines.push(` - ${provider.id} (${credential}): ${provider.available ? "ready" : provider.reason ?? "unavailable"}`);
|
|
10796
|
+
if (!provider.available && provider.guidance) lines.push(` Next step: ${provider.guidance}`);
|
|
10797
|
+
if (provider.requires_byok) lines.push(" Provider billing and model access are controlled by that provider account.");
|
|
10798
|
+
}
|
|
10799
|
+
return lines;
|
|
10800
|
+
}
|
|
10393
10801
|
function formatInputs(inputs, indent) {
|
|
10394
10802
|
if (inputs.length === 0) return [];
|
|
10395
10803
|
return inputs.map((input) => {
|
|
@@ -10409,7 +10817,8 @@ function rejectUnknownModelOptions(command, options) {
|
|
|
10409
10817
|
];
|
|
10410
10818
|
const commandOptions = command ? {
|
|
10411
10819
|
list: ["media", "available"],
|
|
10412
|
-
show: []
|
|
10820
|
+
show: [],
|
|
10821
|
+
configure: ["provider", "reset-provider"]
|
|
10413
10822
|
}[command] : void 0;
|
|
10414
10823
|
if (!commandOptions) return;
|
|
10415
10824
|
const allowed = new Set([...common, ...commandOptions]);
|
|
@@ -11471,7 +11880,7 @@ async function handleVideo(parsed) {
|
|
|
11471
11880
|
var TOP_LEVEL_HELP = `Make Effects CLI
|
|
11472
11881
|
|
|
11473
11882
|
Creative:
|
|
11474
|
-
models list | show
|
|
11883
|
+
models list | show | configure
|
|
11475
11884
|
image generate | regenerate
|
|
11476
11885
|
video generate | regenerate
|
|
11477
11886
|
audio speech|dialogue|music|sfx generate|regenerate
|
|
@@ -11498,16 +11907,18 @@ Assets and variants use compact refs:
|
|
|
11498
11907
|
Run makefx help <noun> for details.`;
|
|
11499
11908
|
var HELP = {
|
|
11500
11909
|
image: `Usage:
|
|
11501
|
-
makefx image generate "prompt" --name <name> --type <type> -o <file> [--model pro|flash|flux] [--refs <variant-ref-or-file,...>] [--aspect <ratio>] [--size 1K|2K|4K] [--collection <id>] [--space <id>]
|
|
11502
|
-
makefx image regenerate <variant-ref> ["prompt"] [--model pro|flash|flux] [--aspect <ratio>] [--size <size>] [--refs <refs>] [--no-activate] [--wait]`,
|
|
11910
|
+
makefx image generate "prompt" --name <name> --type <type> -o <file> [--model pro|flash|flux|gpt-image-2|seedream-5-pro|seedream-5-lite] [--provider <provider>] [--refs <variant-ref-or-file,...>] [--aspect <ratio>] [--size 1K|2K|3K|4K] [--quality low|medium|high] [--seed <integer>] [--collection <id>] [--space <id>]
|
|
11911
|
+
makefx image regenerate <variant-ref> ["prompt"] [--model pro|flash|flux|gpt-image-2|seedream-5-pro|seedream-5-lite] [--provider <provider>] [--aspect <ratio>] [--size <size>] [--quality low|medium|high] [--seed <integer|random>] [--refs <refs>] [--no-activate] [--wait]`,
|
|
11503
11912
|
video: `Usage:
|
|
11504
|
-
makefx video generate "prompt" --name <name> --type <type> -o <file> [--model veo-3.1|omni-flash|kling|seedance-1|seedance-2|seedance-2-fast]
|
|
11913
|
+
makefx video generate "prompt" --name <name> --type <type> -o <file> [--model veo-3.1|omni-flash|kling|seedance-1|seedance-2|seedance-2-fast|seedance-2.5|kling-avatar-v2|creatify-aurora] [--provider fal|elevenlabs|pika]
|
|
11505
11914
|
[--refs <variant-ref-or-file,...>] [--first-frame <ref>] [--last-frame <ref>] [--image-refs <refs>] [--video-refs <refs>] [--audio-refs <refs>]
|
|
11506
11915
|
[--aspect <ratio>] [--resolution 480p|720p|1080p|4k] [--duration <seconds|auto>] [--tier generate|fast|lite] [--bitrate standard|high]
|
|
11507
11916
|
[--audio | --no-audio] [--collection <id>] [--space <id>]
|
|
11508
11917
|
makefx video generate ["prompt"] --model kling-avatar-v2 --image-refs <portrait-ref> --audio-refs <audio-ref>
|
|
11509
11918
|
--name <name> --type <type> -o <file> [--mode standard|pro] [--collection <id>] [--space <id>]
|
|
11510
|
-
makefx video
|
|
11919
|
+
makefx video generate ["prompt"] --model creatify-aurora --image-refs <portrait-ref> --audio-refs <audio-ref>
|
|
11920
|
+
--name <name> --type <type> -o <file> [--resolution 480p|720p] [--guidance-scale 0..5] [--audio-guidance-scale 0..5] [--collection <id>] [--space <id>]
|
|
11921
|
+
makefx video regenerate <variant-ref> ["prompt"] [--model <model>] [--provider fal|elevenlabs|pika] [--aspect <ratio>] [--resolution <value>] [--duration <seconds>] [--tier <tier>] [--bitrate standard|high] [--audio | --no-audio] [--image-refs <refs>] [--video-refs <refs>] [--audio-refs <refs>] [--no-activate] [--wait]
|
|
11511
11922
|
|
|
11512
11923
|
Seedance mode is inferred: first/last frame selects frame mode, image/video/audio refs select reference mode, and no references selects text mode.`,
|
|
11513
11924
|
audio: `Usage:
|
|
@@ -11526,7 +11937,8 @@ Seedance mode is inferred: first/last frame selects frame mode, image/video/audi
|
|
|
11526
11937
|
Generate commands also accept [--collection <id>] [--space <id>].`,
|
|
11527
11938
|
models: `Usage:
|
|
11528
11939
|
makefx models list [--media image|video|audio] [--available] [--json]
|
|
11529
|
-
makefx models show <model> [--json]
|
|
11940
|
+
makefx models show <model> [--json]
|
|
11941
|
+
makefx models configure <model> (--provider <provider> | --reset-provider) [--json]`,
|
|
11530
11942
|
assets: `Usage:
|
|
11531
11943
|
makefx assets list [--query <text>] [--media image|audio|video] [--type <type>] [--json]
|
|
11532
11944
|
makefx assets show <asset-ref> [--json]
|