makefx 1.6.2 → 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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/makefx.mjs +662 -232
  3. 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
- return providerErrorCode?.toLowerCase() === "api_key_invalid" || 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");
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: `A ${providerLabel} account key is required before generation can start.`,
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.2+1c90176554ef";
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);
@@ -5780,112 +5789,16 @@ Usage:
5780
5789
  `);
5781
5790
  }
5782
5791
  //#endregion
5783
- //#region src/backend/utils/audio-metadata.ts
5784
- function readWavDurationMs(bytes) {
5785
- if (bytes.byteLength < 12) return void 0;
5786
- const text = (offset, length) => String.fromCharCode(...bytes.subarray(offset, offset + length));
5787
- if (text(0, 4) !== "RIFF" || text(8, 4) !== "WAVE") return void 0;
5788
- const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
5789
- let byteRate;
5790
- let dataSize;
5791
- for (let offset = 12; offset + 8 <= bytes.byteLength;) {
5792
- const type = text(offset, 4);
5793
- const size = view.getUint32(offset + 4, true);
5794
- const payload = offset + 8;
5795
- if (type === "fmt " && size >= 12 && payload + 12 <= bytes.byteLength) byteRate = view.getUint32(payload + 8, true);
5796
- if (type === "data") {
5797
- dataSize = size;
5798
- break;
5799
- }
5800
- if (payload + size > bytes.byteLength) break;
5801
- offset = payload + size + size % 2;
5802
- }
5803
- if (!byteRate || dataSize === void 0) return void 0;
5804
- return Math.round(dataSize * 1e3 / byteRate);
5805
- }
5806
- function id3PayloadSize(bytes) {
5807
- if (bytes.byteLength < 10 || String.fromCharCode(...bytes.subarray(0, 3)) !== "ID3") return 0;
5808
- return 10 + ((bytes[6] & 127) << 21 | (bytes[7] & 127) << 14 | (bytes[8] & 127) << 7 | bytes[9] & 127) + ((bytes[5] & 16) !== 0 ? 10 : 0);
5809
- }
5810
- var MPEG1_LAYER3_BITRATES = [
5811
- 0,
5812
- 32,
5813
- 40,
5814
- 48,
5815
- 56,
5816
- 64,
5817
- 80,
5818
- 96,
5819
- 112,
5820
- 128,
5821
- 160,
5822
- 192,
5823
- 224,
5824
- 256,
5825
- 320
5826
- ];
5827
- var MPEG2_LAYER3_BITRATES = [
5828
- 0,
5829
- 8,
5830
- 16,
5831
- 24,
5832
- 32,
5833
- 40,
5834
- 48,
5835
- 56,
5836
- 64,
5837
- 80,
5838
- 96,
5839
- 112,
5840
- 128,
5841
- 144,
5842
- 160
5843
- ];
5844
- var MPEG1_SAMPLE_RATES = [
5845
- 44100,
5846
- 48e3,
5847
- 32e3
5848
- ];
5849
- function mp3Frame(bytes, offset) {
5850
- if (offset + 4 > bytes.byteLength || bytes[offset] !== 255 || (bytes[offset + 1] & 224) !== 224) return void 0;
5851
- const versionBits = bytes[offset + 1] >> 3 & 3;
5852
- const layerBits = bytes[offset + 1] >> 1 & 3;
5853
- const bitrateIndex = bytes[offset + 2] >> 4 & 15;
5854
- const sampleRateIndex = bytes[offset + 2] >> 2 & 3;
5855
- if (versionBits === 1 || layerBits !== 1 || bitrateIndex === 0 || bitrateIndex === 15 || sampleRateIndex === 3) return void 0;
5856
- const isMpeg1 = versionBits === 3;
5857
- const bitrateKbps = (isMpeg1 ? MPEG1_LAYER3_BITRATES : MPEG2_LAYER3_BITRATES)[bitrateIndex];
5858
- const divisor = versionBits === 0 ? 4 : versionBits === 2 ? 2 : 1;
5859
- const sampleRate = MPEG1_SAMPLE_RATES[sampleRateIndex] / divisor;
5860
- const padding = bytes[offset + 2] >> 1 & 1;
5861
- const length = Math.floor((isMpeg1 ? 144e3 : 72e3) * bitrateKbps / sampleRate) + padding;
5862
- if (length < 4 || offset + length > bytes.byteLength) return void 0;
5863
- return {
5864
- length,
5865
- durationMs: (isMpeg1 ? 1152 : 576) * 1e3 / sampleRate,
5866
- bitrateKbps
5867
- };
5868
- }
5869
- function readMp3DurationMs(bytes) {
5870
- let offset = id3PayloadSize(bytes);
5871
- let durationMs = 0;
5872
- let frames = 0;
5873
- while (offset + 4 <= bytes.byteLength) {
5874
- const frame = mp3Frame(bytes, offset);
5875
- if (!frame) {
5876
- offset += 1;
5877
- continue;
5878
- }
5879
- durationMs += frame.durationMs;
5880
- frames += 1;
5881
- offset += frame.length;
5882
- }
5883
- return frames > 0 ? Math.round(durationMs) : void 0;
5884
- }
5885
- /** Read duration for the audio formats accepted by Seedance reference mode. */
5886
- function readAudioDurationMs(bytes, mimeType) {
5887
- if (mimeType === "audio/wav" || mimeType === "audio/x-wav") return readWavDurationMs(bytes);
5888
- if (mimeType === "audio/mpeg") return readMp3DurationMs(bytes);
5792
+ //#region src/shared/audioGenerationOptions.ts
5793
+ var DEFAULT_ELEVENLABS_SPEECH_MODEL_ID = "eleven_v3";
5794
+ /**
5795
+ * Keep the provider-native ElevenLabs ID canonical everywhere after an input
5796
+ * boundary. The hyphenated MakeFX slug is accepted only for migration.
5797
+ */
5798
+ function normalizeElevenLabsSpeechModelId(model) {
5799
+ const normalized = model?.trim();
5800
+ if (!normalized) return void 0;
5801
+ return normalized === "eleven-v3" ? DEFAULT_ELEVENLABS_SPEECH_MODEL_ID : normalized;
5889
5802
  }
5890
5803
  //#endregion
5891
5804
  //#region src/backend/utils/iso-bmff-metadata.ts
@@ -5966,14 +5879,60 @@ function readIsoBmffVideoMetadata(bytes) {
5966
5879
  }
5967
5880
  //#endregion
5968
5881
  //#region src/shared/avatarGenerationOptions.ts
5969
- var AVATAR_MODEL_IDS = ["kling-avatar-v2"];
5882
+ var AVATAR_MODEL_IDS = ["kling-avatar-v2", "creatify-aurora"];
5883
+ var AURORA_AVATAR_RESOLUTIONS = ["480p", "720p"];
5970
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
+ });
5971
5912
  function isAvatarModelId(value) {
5972
5913
  return typeof value === "string" && AVATAR_MODEL_IDS.includes(value);
5973
5914
  }
5915
+ function isAuroraAvatarResolution(value) {
5916
+ return typeof value === "string" && AURORA_AVATAR_RESOLUTIONS.includes(value);
5917
+ }
5974
5918
  function isAvatarMode(value) {
5975
5919
  return typeof value === "string" && AVATAR_MODES.includes(value);
5976
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
+ }
5977
5936
  //#endregion
5978
5937
  //#region src/shared/seedance2Capabilities.ts
5979
5938
  var SEEDANCE_2_ASPECT_RATIOS = [
@@ -6000,6 +5959,36 @@ var SEEDANCE_2_DURATIONS = [
6000
5959
  14,
6001
5960
  15
6002
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
+ ];
6003
5992
  var SEEDANCE_2_BITRATE_MODES = ["standard", "high"];
6004
5993
  var MB = 1024 * 1024;
6005
5994
  var IMAGE_REFERENCE_RULE = {
@@ -6061,6 +6050,8 @@ function profile(mode, tier, endpointId) {
6061
6050
  selection,
6062
6051
  generatorId: `video/${selection}`,
6063
6052
  endpointId,
6053
+ family: "seedance-2.0",
6054
+ familyLabel: "Seedance 2",
6064
6055
  label: `Seedance 2 ${fast ? "Fast " : ""}${mode === "text" ? "Text" : mode === "frame" ? "Frames" : "References"}`,
6065
6056
  mode,
6066
6057
  tier,
@@ -6097,20 +6088,137 @@ function profile(mode, tier, endpointId) {
6097
6088
  }
6098
6089
  };
6099
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
+ }
6100
6200
  var SEEDANCE_2_CAPABILITIES = {
6101
6201
  "seedance-2-text": profile("text", "standard", "bytedance/seedance-2.0/text-to-video"),
6102
6202
  "seedance-2-frame": profile("frame", "standard", "bytedance/seedance-2.0/image-to-video"),
6103
6203
  "seedance-2-reference": profile("reference", "standard", "bytedance/seedance-2.0/reference-to-video"),
6104
6204
  "seedance-2-fast-text": profile("text", "fast", "bytedance/seedance-2.0/fast/text-to-video"),
6105
6205
  "seedance-2-fast-frame": profile("frame", "fast", "bytedance/seedance-2.0/fast/image-to-video"),
6106
- "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")
6107
6210
  };
6108
6211
  var SEEDANCE_2_SELECTIONS = Object.freeze(Object.keys(SEEDANCE_2_CAPABILITIES));
6109
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
+ }
6110
6219
  function getSeedance2RegenerationCapability(model, source, referencesWereOverridden) {
6111
6220
  const sourceCapability = source.model ? getSeedance2CapabilityByEndpoint(source.model) : void 0;
6112
- const mode = !referencesWereOverridden && sourceCapability ? sourceCapability.mode : !referencesWereOverridden && source.authoritativeFrames ? "frame" : source.references.length > 0 ? "reference" : "text";
6113
- 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"}`];
6114
6222
  }
6115
6223
  /**
6116
6224
  * Reference inputs exposed by an interface are additional to the video being
@@ -6131,18 +6239,19 @@ function getSeedance2ReferenceBudget(capability, operation) {
6131
6239
  }
6132
6240
  function validateSeedance2ReferenceCounts(capability, operation, counts) {
6133
6241
  const total = counts.image + counts.video + counts.audio;
6242
+ const familyLabel = capability.familyLabel;
6134
6243
  if (capability.mode === "text") return total > 0 ? {
6135
6244
  code: "references_not_supported",
6136
- message: "Seedance 2 text mode does not accept references."
6245
+ message: `${familyLabel} text mode does not accept references.`
6137
6246
  } : null;
6138
6247
  if (capability.mode === "frame") {
6139
6248
  if (counts.image === 0) return {
6140
6249
  code: "start_frame_required",
6141
- message: "Seedance 2 frame mode requires a completed image start frame."
6250
+ message: `${familyLabel} frame mode requires a completed image start frame.`
6142
6251
  };
6143
6252
  if (counts.video > 0 || counts.audio > 0 || counts.image > 2) return {
6144
6253
  code: "frame_images_only",
6145
- message: "Seedance 2 frame mode accepts one start image and one optional end image."
6254
+ message: `${familyLabel} frame mode accepts one start image and one optional end image.`
6146
6255
  };
6147
6256
  return null;
6148
6257
  }
@@ -6150,23 +6259,23 @@ function validateSeedance2ReferenceCounts(capability, operation, counts) {
6150
6259
  const qualifier = operation === "refine" ? " additional" : "";
6151
6260
  if (total > budget.maxAdditionalFiles) return {
6152
6261
  code: "too_many_files",
6153
- message: `Seedance 2 reference mode accepts at most ${budget.maxAdditionalFiles}${qualifier} files.`
6262
+ message: `${familyLabel} reference mode accepts at most ${budget.maxAdditionalFiles}${qualifier} files.`
6154
6263
  };
6155
6264
  if (counts.image > budget.maxAdditionalByKind.image) return {
6156
6265
  code: "too_many_images",
6157
- message: `Seedance 2 accepts at most ${budget.maxAdditionalByKind.image}${qualifier} reference images.`
6266
+ message: `${familyLabel} accepts at most ${budget.maxAdditionalByKind.image}${qualifier} reference images.`
6158
6267
  };
6159
6268
  if (counts.video > budget.maxAdditionalByKind.video) return {
6160
6269
  code: "too_many_videos",
6161
- message: `Seedance 2 accepts at most ${budget.maxAdditionalByKind.video}${qualifier} reference videos.`
6270
+ message: `${familyLabel} accepts at most ${budget.maxAdditionalByKind.video}${qualifier} reference videos.`
6162
6271
  };
6163
6272
  if (counts.audio > budget.maxAdditionalByKind.audio) return {
6164
6273
  code: "too_many_audio_clips",
6165
- message: `Seedance 2 accepts at most ${budget.maxAdditionalByKind.audio}${qualifier} reference audio clips.`
6274
+ message: `${familyLabel} accepts at most ${budget.maxAdditionalByKind.audio}${qualifier} reference audio clips.`
6166
6275
  };
6167
6276
  if (counts.audio > 0 && counts.image + counts.video === 0 && !budget.hasImplicitSourceVideo) return {
6168
6277
  code: "visual_reference_required",
6169
- message: "Seedance 2 audio guidance references require at least one image or video reference."
6278
+ message: `${familyLabel} audio guidance references require at least one image or video reference.`
6170
6279
  };
6171
6280
  return null;
6172
6281
  }
@@ -6257,6 +6366,16 @@ var VIDEO_GENERATION_TIER_MODELS = {
6257
6366
  fast: "veo-3.1-fast-generate-preview",
6258
6367
  lite: "veo-3.1-lite-generate-preview"
6259
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
+ }
6260
6379
  function normalizeVideoGenerationResolution(value) {
6261
6380
  return ALL_VIDEO_GENERATION_RESOLUTIONS.includes(value) ? value : void 0;
6262
6381
  }
@@ -6264,6 +6383,12 @@ function normalizeVideoGenerationDurationSeconds(value) {
6264
6383
  const numeric = typeof value === "string" ? Number(value) : value;
6265
6384
  return SEEDANCE_2_DURATION_SECONDS.includes(numeric) ? numeric : void 0;
6266
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
+ }
6267
6392
  function normalizeVideoGenerationTier(value) {
6268
6393
  return VIDEO_GENERATION_TIERS.includes(value) ? value : void 0;
6269
6394
  }
@@ -6279,6 +6404,12 @@ function getVideoGenerationModelForSelection(selection = DEFAULT_VIDEO_MODEL_SEL
6279
6404
  if (selection === "fal-seedance") return FAL_VIDEO_MODEL;
6280
6405
  return getVideoGenerationModelForTier(tier);
6281
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
+ }
6282
6413
  function getVideoGenerationResolutionsForTier(tier = DEFAULT_VIDEO_GENERATION_TIER) {
6283
6414
  return VIDEO_GENERATION_RESOLUTIONS_BY_TIER[tier];
6284
6415
  }
@@ -6322,6 +6453,9 @@ function isFalSeedanceV1VideoGenerationModel(model) {
6322
6453
  function isFalSeedance2VideoGenerationModel(model) {
6323
6454
  return typeof model === "string" && getSeedance2CapabilityByEndpoint(model) !== void 0;
6324
6455
  }
6456
+ function isVideoGenerationModel(model) {
6457
+ return isVeoVideoGenerationModel(model) || isGeminiOmniVideoGenerationModel(model) || isKlingVideoGenerationModel(model) || isFalVideoGenerationModel(model);
6458
+ }
6325
6459
  function getVideoGenerationMaxReferenceImages(model) {
6326
6460
  if (isFalSeedanceV1VideoGenerationModel(model)) return 0;
6327
6461
  if (isFalSeedance2VideoGenerationModel(model)) return getSeedance2CapabilityByEndpoint(model)?.references.find((reference) => reference.mediaKind === "image")?.maxCount ?? 0;
@@ -6338,16 +6472,34 @@ function doesVideoGenerationModelSupportAudioToggle(model) {
6338
6472
  return isKlingVideoGenerationModel(model) || isVeoVideoGenerationModel(model) && VIDEO_GENERATION_AUDIO_TOGGLE_MODELS.includes(model);
6339
6473
  }
6340
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
6341
6487
  //#region src/shared/imageGenerationOptions.ts
6342
6488
  var IMAGE_MODEL_SELECTIONS = [
6343
6489
  "pro",
6344
6490
  "flash",
6345
- "flux"
6491
+ "flux",
6492
+ "gpt-image-2",
6493
+ "seedream-5-pro",
6494
+ "seedream-5-lite"
6346
6495
  ];
6347
6496
  var IMAGE_MODEL_IDS = {
6348
6497
  pro: "gemini-3-pro-image",
6349
6498
  flash: "gemini-3.1-flash-image",
6350
- 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"
6351
6503
  };
6352
6504
  IMAGE_MODEL_IDS["pro"];
6353
6505
  var IMAGE_ASPECT_RATIOS = [
@@ -6365,8 +6517,14 @@ var IMAGE_ASPECT_RATIOS = [
6365
6517
  var IMAGE_SIZES = [
6366
6518
  "1K",
6367
6519
  "2K",
6520
+ "3K",
6368
6521
  "4K"
6369
6522
  ];
6523
+ var IMAGE_QUALITIES = [
6524
+ "low",
6525
+ "medium",
6526
+ "high"
6527
+ ];
6370
6528
  var IMAGE_MODEL_CAPABILITIES = {
6371
6529
  pro: {
6372
6530
  selection: "pro",
@@ -6378,13 +6536,15 @@ var IMAGE_MODEL_CAPABILITIES = {
6378
6536
  "derive",
6379
6537
  "refine"
6380
6538
  ],
6381
- maxReferenceImages: 14,
6539
+ maxReferenceImages: 10,
6382
6540
  supportedImageSizes: [
6383
6541
  "1K",
6384
6542
  "2K",
6385
6543
  "4K"
6386
6544
  ],
6387
- supportedAspectRatios: IMAGE_ASPECT_RATIOS
6545
+ supportedAspectRatios: IMAGE_ASPECT_RATIOS,
6546
+ supportedQualities: [],
6547
+ supportsSeed: false
6388
6548
  },
6389
6549
  flash: {
6390
6550
  selection: "flash",
@@ -6402,7 +6562,9 @@ var IMAGE_MODEL_CAPABILITIES = {
6402
6562
  "2K",
6403
6563
  "4K"
6404
6564
  ],
6405
- supportedAspectRatios: IMAGE_ASPECT_RATIOS
6565
+ supportedAspectRatios: IMAGE_ASPECT_RATIOS,
6566
+ supportedQualities: [],
6567
+ supportsSeed: false
6406
6568
  },
6407
6569
  flux: {
6408
6570
  selection: "flux",
@@ -6412,7 +6574,77 @@ var IMAGE_MODEL_CAPABILITIES = {
6412
6574
  supportedOperations: ["generate"],
6413
6575
  maxReferenceImages: 0,
6414
6576
  supportedImageSizes: ["1K"],
6415
- 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
6416
6648
  }
6417
6649
  };
6418
6650
  function isImageModelSelection(value) {
@@ -6431,11 +6663,16 @@ function normalizeImageSize(value) {
6431
6663
  const normalized = value.toUpperCase();
6432
6664
  return isImageSize(normalized) ? normalized : void 0;
6433
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
+ }
6434
6673
  function getImageModelSelection(value) {
6435
6674
  if (isImageModelSelection(value)) return value;
6436
- if (value === IMAGE_MODEL_IDS.flash) return "flash";
6437
- if (value === IMAGE_MODEL_IDS.flux) return "flux";
6438
- return "pro";
6675
+ return IMAGE_MODEL_SELECTIONS.find((selection) => IMAGE_MODEL_CAPABILITIES[selection].modelId === value) ?? "pro";
6439
6676
  }
6440
6677
  function getImageModelProvider(model) {
6441
6678
  return getImageModelCapabilities(model).provider;
@@ -6446,6 +6683,12 @@ function getImageModelCapabilities(model) {
6446
6683
  function isImageSizeSupportedByModel(model, imageSize) {
6447
6684
  return getImageModelCapabilities(model).supportedImageSizes.includes(imageSize);
6448
6685
  }
6686
+ function isImageQualitySupportedByModel(model, quality) {
6687
+ return getImageModelCapabilities(model).supportedQualities.includes(quality);
6688
+ }
6689
+ function isImageSeedSupportedByModel(model) {
6690
+ return getImageModelCapabilities(model).supportsSeed;
6691
+ }
6449
6692
  function isImageAspectRatioSupportedByModel(model, aspectRatio) {
6450
6693
  return getImageModelCapabilities(model).supportedAspectRatios.includes(aspectRatio);
6451
6694
  }
@@ -6642,6 +6885,7 @@ var LOCAL_REFERENCE_MIME_TYPES = {
6642
6885
  ".jpeg": "image/jpeg",
6643
6886
  ".png": "image/png",
6644
6887
  ".webp": "image/webp",
6888
+ ".gif": "image/gif",
6645
6889
  ".mp4": "video/mp4",
6646
6890
  ".mov": "video/quicktime",
6647
6891
  ".mp3": "audio/mpeg",
@@ -6649,20 +6893,15 @@ var LOCAL_REFERENCE_MIME_TYPES = {
6649
6893
  };
6650
6894
  async function inspectLocalReference(filePath, mediaKind) {
6651
6895
  const fileStat = await stat(filePath);
6652
- const mimeType = LOCAL_REFERENCE_MIME_TYPES[path.extname(filePath).toLowerCase()] ?? "application/octet-stream";
6653
6896
  const inspection = {
6654
- mimeType,
6897
+ mimeType: LOCAL_REFERENCE_MIME_TYPES[path.extname(filePath).toLowerCase()] ?? "application/octet-stream",
6655
6898
  sizeBytes: fileStat.size
6656
6899
  };
6657
- if (mediaKind === "image") return inspection;
6900
+ if (mediaKind !== "video") return inspection;
6658
6901
  const bytes = new Uint8Array(await readFile(filePath));
6659
- if (mediaKind === "video") return {
6660
- ...inspection,
6661
- ...readIsoBmffVideoMetadata(bytes)
6662
- };
6663
6902
  return {
6664
6903
  ...inspection,
6665
- durationMs: readAudioDurationMs(bytes, mimeType)
6904
+ ...readIsoBmffVideoMetadata(bytes)
6666
6905
  };
6667
6906
  }
6668
6907
  async function handleGenerate(parsed) {
@@ -6690,6 +6929,7 @@ async function executeForgeCommand(command, parsed, deps = defaultDeps$12, optio
6690
6929
  validateImageCommandReferenceCount(command, parsed, mediaKind, imageOptions.model);
6691
6930
  validateVideoAudioOptions(parsed, mediaKind);
6692
6931
  const videoOptions = parseVideoGenerationOptions(parsed, mediaKind);
6932
+ parseGenerationProviderOption(parsed, mediaKind, videoOptions.model);
6693
6933
  validateVideoModelOperation(command, mediaKind, videoOptions.model);
6694
6934
  validateVideoFrameReferenceOptions(command, parsed, mediaKind);
6695
6935
  validateSeedanceReferenceOptions(parseSeedanceReferenceOptions(parsed), videoOptions.model ?? getVideoGenerationModelForSelection(), command);
@@ -6716,9 +6956,12 @@ var CLI_GENERATION_COMMON_OPTIONS = [
6716
6956
  var CLI_GENERATION_MEDIA_OPTIONS = {
6717
6957
  image: [
6718
6958
  "model",
6959
+ "provider",
6719
6960
  "refs",
6720
6961
  "aspect",
6721
- "size"
6962
+ "size",
6963
+ "quality",
6964
+ "seed"
6722
6965
  ],
6723
6966
  audio: [
6724
6967
  "model",
@@ -6741,7 +6984,10 @@ var CLI_GENERATION_MEDIA_OPTIONS = {
6741
6984
  "image-refs",
6742
6985
  "video-refs",
6743
6986
  "audio-refs",
6744
- "mode"
6987
+ "mode",
6988
+ "guidance-scale",
6989
+ "audio-guidance-scale",
6990
+ "provider"
6745
6991
  ]
6746
6992
  };
6747
6993
  function rejectUnknownGenerationOptions(options, mediaKind) {
@@ -6813,7 +7059,7 @@ async function executeGenerate(parsed, ctx, client, deps, mediaKind, followOptio
6813
7059
  ...deps,
6814
7060
  waitForReferenceVariant: (variant) => waitForReferenceVariant(client, variant)
6815
7061
  };
6816
- 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) : {
6817
7063
  refs: [],
6818
7064
  ids: []
6819
7065
  };
@@ -6823,6 +7069,24 @@ async function executeGenerate(parsed, ctx, client, deps, mediaKind, followOptio
6823
7069
  const imageOptions = parseImageGenerationOptions(parsed, mediaKind);
6824
7070
  const audioModelOptions = parseAudioGenerationOptions(parsed, mediaKind);
6825
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);
6826
7090
  const collectionPlacement = parseCollectionPlacementOptions(parsed);
6827
7091
  const followCommandOptions = {
6828
7092
  ...followOptions,
@@ -6846,6 +7110,7 @@ async function executeGenerate(parsed, ctx, client, deps, mediaKind, followOptio
6846
7110
  ...musicProvider ? { musicProvider } : {},
6847
7111
  ...videoAudioOptions,
6848
7112
  ...videoOptions,
7113
+ ...provider ? { provider } : {},
6849
7114
  onStarted: (started) => {
6850
7115
  startedVariantRef = compactStartedVariantRef(started);
6851
7116
  }
@@ -6870,8 +7135,9 @@ function getAudioModeFromType(type) {
6870
7135
  }
6871
7136
  function validateAudioModelOption(value, mode) {
6872
7137
  if (!value) return;
6873
- const supported = mode === "music" ? ["eleven-music", "lyria-3"] : mode === "sfx" ? ["eleven-sfx"] : mode === "speech" || mode === "dialogue" ? ["eleven-v3"] : [];
6874
- if (!supported.includes(value)) throw new Error(`Unsupported ${mode ?? "audio"} model: ${value}. Expected ${supported.join(" or ")}`);
7138
+ const normalized = mode === "speech" || mode === "dialogue" ? normalizeElevenLabsSpeechModelId(value) : value;
7139
+ const supported = mode === "music" ? ["eleven-music", "lyria-3"] : mode === "sfx" ? ["eleven-sfx"] : mode === "speech" || mode === "dialogue" ? [DEFAULT_ELEVENLABS_SPEECH_MODEL_ID] : [];
7140
+ if (!normalized || !supported.includes(normalized)) throw new Error(`Unsupported ${mode ?? "audio"} model: ${value}. Expected ${supported.join(" or ")}`);
6875
7141
  }
6876
7142
  function parseMusicProviderOption(parsed, mediaKind, assetType) {
6877
7143
  const value = parsed.options.model;
@@ -6997,12 +7263,12 @@ async function resolveAvatarReferenceIds(options, ctx, deps, state) {
6997
7263
  ids: [...imageIds, ...audioIds]
6998
7264
  };
6999
7265
  }
7000
- async function resolveSeedanceReferenceIds(options, ctx, deps, state, implicitVideoReferenceIds = []) {
7266
+ async function resolveSeedanceReferenceIds(options, capability, ctx, deps, state, implicitVideoReferenceIds = []) {
7001
7267
  await preflightLocalSeedanceReferences({
7002
7268
  ...options,
7003
7269
  videoRefs: [...implicitVideoReferenceIds, ...options.videoRefs]
7004
- }, deps, state);
7005
- 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);
7006
7272
  const imageIds = await resolve(options.imageRefs, "image");
7007
7273
  const videoIds = await resolve(options.videoRefs, "video");
7008
7274
  const audioIds = await resolve(options.audioRefs, "audio");
@@ -7019,7 +7285,7 @@ async function resolveSeedanceReferenceIds(options, ctx, deps, state, implicitVi
7019
7285
  ]
7020
7286
  };
7021
7287
  }
7022
- async function preflightLocalSeedanceReferences(options, deps, state) {
7288
+ async function preflightLocalSeedanceReferences(options, deps, state, capability = SEEDANCE_2_CAPABILITIES["seedance-2-reference"]) {
7023
7289
  if (!deps.inspectLocalReference) return;
7024
7290
  const inspections = {
7025
7291
  image: [],
@@ -7031,7 +7297,7 @@ async function preflightLocalSeedanceReferences(options, deps, state) {
7031
7297
  ["video", options.videoRefs],
7032
7298
  ["audio", options.audioRefs]
7033
7299
  ]) {
7034
- const rule = SEEDANCE_2_CAPABILITIES["seedance-2-reference"].references.find((candidate) => candidate.mediaKind === mediaKind);
7300
+ const rule = capability.references.find((candidate) => candidate.mediaKind === mediaKind);
7035
7301
  for (const ref of refs) {
7036
7302
  const isLocal = await deps.fileExists(ref);
7037
7303
  let inspection;
@@ -7041,7 +7307,7 @@ async function preflightLocalSeedanceReferences(options, deps, state) {
7041
7307
  if (!state) continue;
7042
7308
  const variants = state.variants;
7043
7309
  const variantId = resolveVariantRef(ref, state.assets, variants);
7044
- validateReferenceVariant(variantId, variants, "video", mediaKind);
7310
+ validateReferenceVariant(variantId, variants, "video", mediaKind, capability);
7045
7311
  const variant = variants.find((candidate) => candidate.id === variantId);
7046
7312
  inspection = {
7047
7313
  mimeType: variant.media_mime_type ?? void 0,
@@ -7051,24 +7317,40 @@ async function preflightLocalSeedanceReferences(options, deps, state) {
7051
7317
  durationMs: variant.media_duration_ms ?? void 0
7052
7318
  };
7053
7319
  }
7054
- if (inspection.mimeType && !rule.acceptedMimeTypes.includes(inspection.mimeType)) throw new Error(`Seedance 2 does not accept ${inspection.mimeType} ${mediaKind} references`);
7055
- if (inspection.sizeBytes > rule.maxBytesPerFile) throw new Error(`Seedance 2 ${mediaKind} references must not exceed ${Math.floor(rule.maxBytesPerFile / (1024 * 1024))} MB`);
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
+ }
7056
7326
  if (mediaKind === "video") {
7057
7327
  if (isLocal && (!inspection.width || !inspection.height || !inspection.durationMs)) throw new Error(`Could not read Seedance video metadata before upload: ${ref}`);
7058
- const pixels = inspection.width && inspection.height ? inspection.width * inspection.height : void 0;
7059
- if (pixels !== void 0 && (pixels < 640 * 640 || pixels > 834 * 1112)) throw new Error("Seedance video references must be approximately 480p to 720p");
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
+ }
7060
7341
  }
7061
- if (mediaKind === "audio" && isLocal && !inspection.durationMs) throw new Error(`Could not read Seedance audio duration before upload: ${ref}`);
7062
7342
  inspections[mediaKind].push(inspection);
7063
7343
  }
7064
7344
  }
7345
+ const videoRule = capability.references.find((rule) => rule.mediaKind === "video");
7065
7346
  const videoBytes = inspections.video.reduce((total, item) => total + item.sizeBytes, 0);
7066
7347
  const videoDurationMs = inspections.video.reduce((total, item) => total + (item.durationMs ?? 0), 0);
7067
- if (videoBytes >= 50 * 1024 * 1024) throw new Error("Seedance reference videos must total under 50 MB");
7348
+ if (videoRule?.combinedMaxBytes !== void 0 && videoBytes >= videoRule.combinedMaxBytes) throw new Error(`${capability.familyLabel} reference videos exceed their combined file-size limit`);
7068
7349
  const hasCompleteVideoDurations = inspections.video.every((item) => item.durationMs !== void 0);
7069
- if (inspections.video.length > 0 && hasCompleteVideoDurations && (videoDurationMs < 2e3 || videoDurationMs > 15e3)) throw new Error("Seedance reference videos must total 2 to 15 seconds");
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`);
7070
7352
  }
7071
- 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"]) {
7072
7354
  const variantIds = [];
7073
7355
  const resolvedVariants = [...variants];
7074
7356
  for (const ref of refs) {
@@ -7090,7 +7372,7 @@ async function resolveReferenceVariantIds(refs, ctx, deps, variants = [], mediaK
7090
7372
  if (!deps.waitForReferenceVariant) throw new Error(`Reference upload is still processing: ${mirroredVariant.id}`);
7091
7373
  resolvedVariants[mirroredVariantIndex] = await deps.waitForReferenceVariant(mirroredVariant);
7092
7374
  }
7093
- validateReferenceVariant(mirror.digestEntry.variantId, resolvedVariants, mediaKind, expectedReferenceMediaKind);
7375
+ validateReferenceVariant(mirror.digestEntry.variantId, resolvedVariants, mediaKind, expectedReferenceMediaKind, seedanceCapability);
7094
7376
  await recordReusedReferenceMirror({
7095
7377
  ref,
7096
7378
  ctx,
@@ -7122,7 +7404,7 @@ async function resolveReferenceVariantIds(refs, ctx, deps, variants = [], mediaK
7122
7404
  };
7123
7405
  }
7124
7406
  resolvedVariants.push(uploaded.variant);
7125
- validateReferenceVariant(uploaded.variant.id, resolvedVariants, mediaKind, expectedReferenceMediaKind);
7407
+ validateReferenceVariant(uploaded.variant.id, resolvedVariants, mediaKind, expectedReferenceMediaKind, seedanceCapability);
7126
7408
  if (deps.recordMirrorForFile) await recordUploadedReferenceMirror({
7127
7409
  ref,
7128
7410
  ctx,
@@ -7135,7 +7417,7 @@ async function resolveReferenceVariantIds(refs, ctx, deps, variants = [], mediaK
7135
7417
  }
7136
7418
  if (looksLikeFilePath(ref)) throw new Error(`Reference file not found: ${ref}`);
7137
7419
  const variantId = resolveVariantRef(ref, assets, resolvedVariants);
7138
- validateReferenceVariant(variantId, resolvedVariants, mediaKind, expectedReferenceMediaKind);
7420
+ validateReferenceVariant(variantId, resolvedVariants, mediaKind, expectedReferenceMediaKind, seedanceCapability);
7139
7421
  variantIds.push(variantId);
7140
7422
  }
7141
7423
  return variantIds;
@@ -7202,7 +7484,7 @@ async function recordUploadedReferenceMirror(input) {
7202
7484
  console.warn(`Warning: reference upload succeeded but mirror registry was not updated: ${error instanceof Error ? error.message : String(error)}`);
7203
7485
  }
7204
7486
  }
7205
- function validateReferenceVariant(ref, variants, mediaKind, expectedReferenceMediaKind) {
7487
+ function validateReferenceVariant(ref, variants, mediaKind, expectedReferenceMediaKind, seedanceCapability = SEEDANCE_2_CAPABILITIES["seedance-2-reference"]) {
7206
7488
  const variant = variants.find((candidate) => candidate.id === ref);
7207
7489
  if (!variant) throw new Error(`Reference variant not found in space sync state: ${ref}`);
7208
7490
  if (variant.status !== "completed") throw new Error(`Reference variant is not completed: ${ref}`);
@@ -7211,10 +7493,10 @@ function validateReferenceVariant(ref, variants, mediaKind, expectedReferenceMed
7211
7493
  if (expectedReferenceMediaKind) {
7212
7494
  if (expectedReferenceMediaKind === "image" && !variant.image_key) throw new Error(`Reference variant has no image: ${ref}`);
7213
7495
  if (expectedReferenceMediaKind !== "image" && !variant.media_key) throw new Error(`Reference variant has no ${expectedReferenceMediaKind} media: ${ref}`);
7214
- const rule = SEEDANCE_2_CAPABILITIES["seedance-2-reference"].references.find((candidate) => candidate.mediaKind === expectedReferenceMediaKind);
7496
+ const rule = seedanceCapability.references.find((candidate) => candidate.mediaKind === expectedReferenceMediaKind);
7215
7497
  const mimeType = variant.media_mime_type;
7216
- if (rule && mimeType && !rule.acceptedMimeTypes.includes(mimeType)) throw new Error(`Seedance 2 does not accept ${mimeType} ${expectedReferenceMediaKind} references`);
7217
- if (rule && variant.media_size_bytes && variant.media_size_bytes > rule.maxBytesPerFile) throw new Error(`Seedance 2 ${expectedReferenceMediaKind} references must not exceed ${Math.floor(rule.maxBytesPerFile / (1024 * 1024))} MB`);
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`);
7218
7500
  return;
7219
7501
  }
7220
7502
  if (mediaKind === "image" && !variant.image_key) throw new Error(`Reference variant has no image: ${ref}`);
@@ -7346,10 +7628,12 @@ function parseVideoGenerationOptions(parsed, mediaKind) {
7346
7628
  const tierValue = readOptionalOption(parsed, "tier");
7347
7629
  const bitrateValue = readOptionalOption(parsed, "bitrate");
7348
7630
  const modeValue = readOptionalOption(parsed, "mode");
7631
+ const guidanceScaleValue = readOptionalOption(parsed, "guidance-scale");
7632
+ const audioGuidanceScaleValue = readOptionalOption(parsed, "audio-guidance-scale");
7349
7633
  const modelValue = mediaKind === "video" ? readOptionalOption(parsed, "model") : void 0;
7350
7634
  const aspectValue = mediaKind === "video" ? readOptionalOption(parsed, "aspect") : void 0;
7351
- if (mediaKind !== "video" && resolutionValue === void 0 && durationValue === void 0 && tierValue === void 0 && aspectValue === void 0 && bitrateValue === void 0) return {};
7352
- if (mediaKind !== "video") throw new Error("--resolution, --duration, --tier, and --bitrate are only supported for video generation");
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");
7353
7637
  const videoResolution = resolutionValue === void 0 ? void 0 : normalizeVideoGenerationResolution(resolutionValue);
7354
7638
  if (resolutionValue !== void 0 && !videoResolution) throw new Error("--resolution must be 480p, 720p, 1080p, or 4k");
7355
7639
  const videoTier = tierValue === void 0 ? void 0 : normalizeVideoGenerationTier(tierValue);
@@ -7358,18 +7642,41 @@ function parseVideoGenerationOptions(parsed, mediaKind) {
7358
7642
  if (isAvatarModelId(model)) {
7359
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");
7360
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");
7361
- if (resolutionValue !== void 0) throw new Error("--resolution is not supported by Avatar models");
7362
- if (modeValue !== void 0 && !isAvatarMode(modeValue)) throw new Error(`--mode must be ${AVATAR_MODES.join(" or ")}`);
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");
7363
7664
  return {
7364
7665
  model,
7365
- ...modeValue ? { avatarMode: modeValue } : {}
7666
+ ...resolutionValue ? { avatarResolution: resolutionValue } : {},
7667
+ ...avatarGuidanceScale !== void 0 ? { avatarGuidanceScale } : {},
7668
+ ...avatarAudioGuidanceScale !== void 0 ? { avatarAudioGuidanceScale } : {}
7366
7669
  };
7367
7670
  }
7368
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");
7369
7673
  const seedanceCapability = getSeedance2CapabilityByEndpoint(model);
7370
- const seedanceDuration = durationValue === void 0 ? void 0 : durationValue === "auto" ? "auto" : normalizeVideoGenerationDurationSeconds(durationValue);
7674
+ const seedanceDuration = durationValue === void 0 ? void 0 : seedanceCapability ? normalizeSeedanceDuration(durationValue, model) : void 0;
7371
7675
  const videoDurationSeconds = durationValue === void 0 || durationValue === "auto" ? void 0 : normalizeVideoGenerationDurationSeconds(durationValue);
7372
- if (durationValue !== void 0 && seedanceDuration === void 0) throw new Error("--duration must be auto or an integer from 4 to 15");
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
+ }
7373
7680
  if (!seedanceCapability && durationValue === "auto") throw new Error("--duration auto is only supported by Seedance 2");
7374
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");
7375
7682
  if ((isKlingVideoGenerationModel(model) || isFalVideoGenerationModel(model)) && tierValue !== void 0) throw new Error("--tier is only supported with --model veo-3.1");
@@ -7380,10 +7687,10 @@ function parseVideoGenerationOptions(parsed, mediaKind) {
7380
7687
  6,
7381
7688
  8
7382
7689
  ].includes(videoDurationSeconds)) throw new Error("--duration must be 4, 6, or 8 for this model");
7383
- const aspectRatio = aspectValue === void 0 ? void 0 : seedanceCapability?.aspectRatios.includes(aspectValue) ? aspectValue : normalizeVideoGenerationAspectRatio(aspectValue);
7384
- if (aspectValue !== void 0 && !aspectRatio) throw new Error(seedanceCapability ? "--aspect must be auto, 21:9, 16:9, 4:3, 1:1, 3:4, or 9:16" : "--aspect must be 16:9 or 9:16");
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");
7385
7692
  const seedanceBitrateMode = bitrateValue;
7386
- 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");
7387
7694
  return {
7388
7695
  model,
7389
7696
  ...aspectRatio ? { aspectRatio } : {},
@@ -7394,6 +7701,14 @@ function parseVideoGenerationOptions(parsed, mediaKind) {
7394
7701
  ...seedanceBitrateMode ? { seedanceBitrateMode } : {}
7395
7702
  };
7396
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
+ }
7397
7712
  function parseVideoFrameReferenceOptions(parsed, command, mediaKind) {
7398
7713
  validateVideoFrameReferenceOptions(command, parsed, mediaKind);
7399
7714
  const firstFrame = readVideoFrameOption(parsed, "first-frame");
@@ -7434,15 +7749,20 @@ function normalizeCliOption(value) {
7434
7749
  if (value === void 0 || value === "true") return void 0;
7435
7750
  return value.trim() || void 0;
7436
7751
  }
7437
- function parseAudioGenerationOptions(_parsed, mediaKind) {
7752
+ function parseAudioGenerationOptions(parsed, mediaKind) {
7438
7753
  if (mediaKind !== "audio") return {};
7439
- return {};
7754
+ const mode = getAudioModeFromType(parsed.options.type);
7755
+ if (mode !== "speech" && mode !== "dialogue") return {};
7756
+ const model = normalizeElevenLabsSpeechModelId(parsed.options.model);
7757
+ return model ? { model } : {};
7440
7758
  }
7441
7759
  function parseImageGenerationOptions(parsed, mediaKind) {
7442
7760
  if (mediaKind !== "image") return {};
7443
7761
  const model = parseImageModelOption(readOptionalOption(parsed, "model"));
7444
7762
  const imageSize = parseImageSizeOption(readOptionalOption(parsed, "size"));
7445
7763
  const aspectRatio = parseImageAspectRatioOption(readOptionalOption(parsed, "aspect"));
7764
+ const imageQuality = parseImageQualityOption(readOptionalOption(parsed, "quality"));
7765
+ const imageSeed = parseImageSeedOption(readOptionalOption(parsed, "seed"));
7446
7766
  if (imageSize && !isImageSizeSupportedByModel(model, imageSize)) {
7447
7767
  const supportedSizes = getImageModelCapabilities(model).supportedImageSizes.join(", ");
7448
7768
  throw new Error(`--model ${model ?? "pro"} supports only --size ${supportedSizes}`);
@@ -7451,9 +7771,16 @@ function parseImageGenerationOptions(parsed, mediaKind) {
7451
7771
  const supportedAspectRatios = getImageModelCapabilities(model).supportedAspectRatios.join(", ");
7452
7772
  throw new Error(`--model ${model ?? "pro"} supports only --aspect ${supportedAspectRatios}`);
7453
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`);
7454
7779
  return {
7455
7780
  ...model ? { model } : {},
7456
7781
  ...imageSize ? { imageSize } : {},
7782
+ ...imageQuality ? { imageQuality } : {},
7783
+ ...imageSeed !== void 0 ? { imageSeed } : {},
7457
7784
  ...aspectRatio ? { aspectRatio } : {}
7458
7785
  };
7459
7786
  }
@@ -7462,26 +7789,40 @@ function parseVideoModelOption(value, tier, parsed) {
7462
7789
  const effectiveTier = tier ?? "generate";
7463
7790
  if (!normalized) return getVideoGenerationModelForSelection(DEFAULT_VIDEO_MODEL_SELECTION, effectiveTier);
7464
7791
  if (isAvatarModelId(normalized)) return normalized;
7465
- if (normalized === "seedance-2" || normalized === "seedance-2-fast") {
7792
+ if (normalized === "seedance-2" || normalized === "seedance-2-fast" || normalized === "seedance-2.5") {
7466
7793
  const hasFrames = Boolean(parsed?.options["first-frame"] || parsed?.options["last-frame"]);
7467
7794
  const hasReferences = Boolean(parsed?.options.refs || parsed?.options["image-refs"] || parsed?.options["video-refs"] || parsed?.options["audio-refs"]);
7468
- return SEEDANCE_2_CAPABILITIES[`${normalized === "seedance-2-fast" ? "seedance-2-fast" : "seedance-2"}-${hasFrames ? "frame" : hasReferences ? "reference" : "text"}`].endpointId;
7795
+ return SEEDANCE_2_CAPABILITIES[`${normalized}-${hasFrames ? "frame" : hasReferences ? "reference" : "text"}`].endpointId;
7469
7796
  }
7470
7797
  const selection = normalizeVideoModelSelection(normalized === "seedance-1" ? "fal-seedance" : normalized);
7471
7798
  if (selection) return getVideoGenerationModelForSelection(selection, effectiveTier);
7472
- throw new Error("--model must be veo-3.1, omni-flash, kling, seedance-1, seedance-2, seedance-2-fast, or kling-avatar-v2");
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");
7473
7800
  }
7474
7801
  function parseImageModelOption(value) {
7475
7802
  if (!value) return void 0;
7476
7803
  if (isImageModelSelection(value)) return value;
7477
- throw new Error("--model must be pro, flash, or flux");
7804
+ throw new Error(`--model must be one of: ${IMAGE_MODEL_SELECTIONS.join(", ")}`);
7478
7805
  }
7479
7806
  function parseImageSizeOption(value) {
7480
7807
  if (!value) return void 0;
7481
7808
  const normalized = normalizeImageSize(value);
7482
- 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");
7483
7810
  return normalized;
7484
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
+ }
7485
7826
  function parseImageAspectRatioOption(value) {
7486
7827
  if (!value) return void 0;
7487
7828
  if (!isImageAspectRatio(value)) {
@@ -7539,7 +7880,7 @@ function cliImageModelValues(command) {
7539
7880
  function printUsage$6(command) {
7540
7881
  console.log(`
7541
7882
  Usage:
7542
- 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>]
7543
7884
  `);
7544
7885
  }
7545
7886
  //#endregion
@@ -7637,9 +7978,13 @@ function parseWaitSeconds$1(value) {
7637
7978
  function buildRegenerationBody(mediaKind, parsed, referenceVariantIds, audioMode, sourceRecipe) {
7638
7979
  const prompt = parsed.positionals[1] ?? parsed.options.prompt;
7639
7980
  const model = parsed.options.model;
7981
+ const audioModel = mediaKind === "audio" && (audioMode === "speech" || audioMode === "dialogue") ? normalizeElevenLabsSpeechModelId(model) : void 0;
7640
7982
  const params = {};
7641
7983
  let duration;
7642
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");
7643
7988
  if (mediaKind === "image") {
7644
7989
  if (model) {
7645
7990
  if (!isImageModelSelection(model)) throw new Error(`Unsupported image model: ${model}`);
@@ -7647,6 +7992,8 @@ function buildRegenerationBody(mediaKind, parsed, referenceVariantIds, audioMode
7647
7992
  }
7648
7993
  if (parsed.options.aspect) params.aspectRatio = parsed.options.aspect;
7649
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");
7650
7997
  } else if (mediaKind === "video") {
7651
7998
  if (parsed.options.aspect) params.aspectRatio = parsed.options.aspect;
7652
7999
  if (parsed.options.resolution) params.videoResolution = parsed.options.resolution;
@@ -7657,7 +8004,7 @@ function buildRegenerationBody(mediaKind, parsed, referenceVariantIds, audioMode
7657
8004
  if (parsed.options["no-audio"] === "true") params.generateAudio = false;
7658
8005
  } else {
7659
8006
  if (!audioMode) throw new Error("Audio regeneration mode is required");
7660
- validateAudioModel(audioMode, model);
8007
+ validateAudioModel(audioMode, audioModel ?? model);
7661
8008
  if (parsed.options.voice) params.voiceId = parsed.options.voice;
7662
8009
  if (parsed.options["dialogue-voices"]) params.dialogueVoiceIds = splitList(parsed.options["dialogue-voices"]);
7663
8010
  if (audioMode === "music" && model) params.musicProvider = model === "lyria-3" ? "lyria" : "elevenlabs";
@@ -7666,7 +8013,9 @@ function buildRegenerationBody(mediaKind, parsed, referenceVariantIds, audioMode
7666
8013
  ...prompt ? { prompt } : {},
7667
8014
  ...model && mediaKind === "image" ? { model } : {},
7668
8015
  ...model && mediaKind === "video" ? { model: resolveVideoRegenerationModel(model, parsed, sourceRecipe) } : {},
8016
+ ...audioModel ? { model: audioModel } : {},
7669
8017
  ...modelProvider ? { modelProvider } : {},
8018
+ ...provider ? { provider } : {},
7670
8019
  ...referenceVariantIds !== void 0 ? { referenceVariantIds } : {},
7671
8020
  ...Object.keys(params).length > 0 ? { params } : {},
7672
8021
  ...duration !== void 0 ? { duration } : {},
@@ -7675,21 +8024,26 @@ function buildRegenerationBody(mediaKind, parsed, referenceVariantIds, audioMode
7675
8024
  }
7676
8025
  function resolveVideoRegenerationModel(model, parsed, sourceRecipe) {
7677
8026
  const tier = parsed.options.tier ?? "generate";
7678
- if (model === "seedance-2" || model === "seedance-2-fast") {
8027
+ if (model === "seedance-2" || model === "seedance-2-fast" || model === "seedance-2.5") {
7679
8028
  const referencesWereOverridden = [
7680
8029
  "image-refs",
7681
8030
  "video-refs",
7682
8031
  "audio-refs"
7683
8032
  ].some((name) => parsed.options[name] !== void 0);
7684
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 ?? [];
7685
8039
  return getSeedance2RegenerationCapability(model, {
7686
8040
  model: storedRecipe?.model,
7687
- references: storedRecipe?.references ?? [],
8041
+ references: effectiveReferences,
7688
8042
  authoritativeFrames: storedRecipe?.veoReferenceMode === "image-to-video" || storedRecipe?.veoReferenceMode === "first-last-frame"
7689
8043
  }, referencesWereOverridden).endpointId;
7690
8044
  }
7691
8045
  const selection = normalizeVideoModelSelection(model === "seedance-1" ? "fal-seedance" : model);
7692
- if (!selection) throw new Error("Unsupported video model. Expected veo-3.1, omni-flash, kling, seedance-1, seedance-2, or seedance-2-fast");
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");
7693
8047
  return getVideoGenerationModelForSelection(selection, tier);
7694
8048
  }
7695
8049
  function parseStoredRecipe$2(recipe) {
@@ -7707,7 +8061,7 @@ function parseStoredRecipe$2(recipe) {
7707
8061
  }
7708
8062
  function validateAudioModel(mode, model) {
7709
8063
  if (!model) return;
7710
- const supported = mode === "music" ? ["eleven-music", "lyria-3"] : mode === "sfx" ? ["eleven-sfx"] : ["eleven-v3"];
8064
+ const supported = mode === "music" ? ["eleven-music", "lyria-3"] : mode === "sfx" ? ["eleven-sfx"] : [DEFAULT_ELEVENLABS_SPEECH_MODEL_ID];
7711
8065
  if (!supported.includes(model)) throw new Error(`Unsupported ${mode} model: ${model}. Expected ${supported.join(" or ")}`);
7712
8066
  }
7713
8067
  function parseReferences(mediaKind, options) {
@@ -8621,8 +8975,7 @@ async function executeSpaceLens(parsed, deps = defaultDeps$8) {
8621
8975
  deps.print(parsed.options.json === "true" ? JSON.stringify(result, null, 2) : `Set the Space canvas lens to ${lens}`);
8622
8976
  return result;
8623
8977
  }
8624
- //#endregion
8625
- //#region src/shared/generatorCapabilities.ts
8978
+ IMAGE_MODEL_SELECTIONS.map((selection) => `image/${selection}`);
8626
8979
  function input(name, type, required, description, options = {}) {
8627
8980
  return {
8628
8981
  name,
@@ -8655,8 +9008,13 @@ function imageGenerator(capability) {
8655
9008
  }),
8656
9009
  input("image_size", "string", false, "Output image size.", {
8657
9010
  allowedValues: capability.supportedImageSizes,
8658
- defaultValue: "1K"
8659
- })
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.")] : []
8660
9018
  ];
8661
9019
  const operations = [{
8662
9020
  operation: "generate",
@@ -8693,8 +9051,13 @@ function imageGenerator(capability) {
8693
9051
  }),
8694
9052
  input("image_size", "string", false, "Output image size.", {
8695
9053
  allowedValues: capability.supportedImageSizes,
8696
- defaultValue: "1K"
8697
- })
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.")] : []
8698
9061
  ]
8699
9062
  });
8700
9063
  return {
@@ -8792,7 +9155,8 @@ function videoGenerator(selection) {
8792
9155
  };
8793
9156
  }
8794
9157
  function seedanceVideoGenerator(capability) {
8795
- const fixedGenerator = fixedInput("generator_id", capability.generatorId, "Selects this exact Seedance 2 mode and tier.");
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");
8796
9160
  const parameters = [
8797
9161
  input("aspect_ratio", "string", false, "Output aspect ratio; auto lets Seedance infer it.", {
8798
9162
  allowedValues: capability.aspectRatios,
@@ -8802,19 +9166,19 @@ function seedanceVideoGenerator(capability) {
8802
9166
  allowedValues: capability.resolutions,
8803
9167
  defaultValue: capability.defaultResolution
8804
9168
  }),
8805
- input("duration", "string_or_integer", false, "Output seconds from 4 to 15, or auto.", {
9169
+ input("duration", "string_or_integer", false, `Output seconds from ${numericDurations[0]} to ${numericDurations.at(-1)}, or auto.`, {
8806
9170
  allowedValues: capability.durations,
8807
9171
  defaultValue: capability.defaultDuration
8808
9172
  }),
8809
9173
  input("generate_audio", "boolean", false, "Generate synchronized native audio.", {
8810
9174
  allowedValues: [true, false],
8811
9175
  defaultValue: capability.generateAudio.default
8812
- }),
8813
- input("bitrate_mode", "string", false, "Output bitrate quality.", {
8814
- allowedValues: capability.bitrateModes,
8815
- defaultValue: capability.defaultBitrateMode
8816
9176
  })
8817
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
+ }));
8818
9182
  const common = [
8819
9183
  SPACE_INPUT,
8820
9184
  fixedGenerator,
@@ -8824,18 +9188,21 @@ function seedanceVideoGenerator(capability) {
8824
9188
  ...parameters
8825
9189
  ];
8826
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.` : "";
8827
9194
  const referenceInputs = [
8828
- input("image_reference_variant_refs", "string_array", false, "Ordered completed images addressed as @Image1 through @Image9 for soft subject, style, or geography guidance; not authoritative boundary frames.", {
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.`, {
8829
9196
  minItems: 1,
8830
- maxItems: 9
9197
+ maxItems: referenceMax("image")
8831
9198
  }),
8832
- input("video_reference_variant_refs", "string_array", false, "Ordered completed videos addressed as @Video1 through @Video3.", {
9199
+ input("video_reference_variant_refs", "string_array", false, `Ordered completed videos addressed as @Video1 through @Video${referenceMax("video")}.`, {
8833
9200
  minItems: 1,
8834
- maxItems: 3
9201
+ maxItems: referenceMax("video")
8835
9202
  }),
8836
- input("audio_reference_variant_refs", "string_array", false, "Ordered completed audio clips addressed as @Audio1 through @Audio3.", {
9203
+ input("audio_reference_variant_refs", "string_array", false, `Ordered completed audio clips addressed as @Audio1 through @Audio${referenceMax("audio")}.${audioDurationContract}`, {
8837
9204
  minItems: 1,
8838
- maxItems: 3
9205
+ maxItems: referenceMax("audio")
8839
9206
  })
8840
9207
  ];
8841
9208
  const modeInputs = capability.mode === "frame" ? frameInputs : capability.mode === "reference" ? referenceInputs : [];
@@ -8849,8 +9216,8 @@ function seedanceVideoGenerator(capability) {
8849
9216
  const budget = getSeedance2ReferenceBudget(capability, "refine");
8850
9217
  const editReferenceInputs = referenceInputs.map((referenceInput) => referenceInput.name === "video_reference_variant_refs" ? {
8851
9218
  ...referenceInput,
8852
- maxItems: 2,
8853
- description: "Up to two additional completed videos addressed as @Video2 and @Video3; the source video is @Video1."
9219
+ maxItems: budget.maxAdditionalByKind.video,
9220
+ description: `Up to ${budget.maxAdditionalByKind.video} additional completed videos addressed from @Video2; the source video is @Video1.`
8854
9221
  } : referenceInput);
8855
9222
  operations.push({
8856
9223
  operation: "refine",
@@ -8899,19 +9266,35 @@ function seedanceVideoGenerator(capability) {
8899
9266
  notes: [
8900
9267
  "Use compact variant references; binary media input is not accepted.",
8901
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.",
8902
- "Seedance 2 cannot combine authoritative start/end frames with extended multimodal references in one request.",
8903
- 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."
8904
9271
  ]
8905
9272
  };
8906
9273
  }
8907
9274
  function avatarVideoGenerator(model) {
8908
- const parameters = [input("mode", "string", false, "Generation quality.", {
8909
- allowedValues: AVATAR_MODES,
8910
- defaultValue: "standard"
8911
- })];
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
+ ];
8912
9295
  return {
8913
9296
  id: `video/${model}`,
8914
- label: "Kling Avatar V2",
9297
+ label: capability.label,
8915
9298
  mediaKind: "video",
8916
9299
  modelIds: [model],
8917
9300
  defaultModelId: model,
@@ -8967,7 +9350,7 @@ function avatarVideoGenerator(model) {
8967
9350
  maxBytesPerFile: 5 * 1024 * 1024
8968
9351
  }]
8969
9352
  },
8970
- 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."] : []]
8971
9354
  };
8972
9355
  }
8973
9356
  function audioGenerator(input_) {
@@ -9079,6 +9462,8 @@ var DRAFT_RECIPE_INPUT_KEYS = {
9079
9462
  prompt: "prompt",
9080
9463
  aspect_ratio: "aspectRatio",
9081
9464
  image_size: "imageSize",
9465
+ quality: "imageQuality",
9466
+ seed: "imageSeed",
9082
9467
  model: "model",
9083
9468
  voice_id: "voiceId",
9084
9469
  dialogue_voice_ids: "dialogueVoiceIds",
@@ -9088,11 +9473,14 @@ var DRAFT_RECIPE_INPUT_KEYS = {
9088
9473
  video_duration_seconds: "videoDurationSeconds",
9089
9474
  video_tier: "videoTier",
9090
9475
  duration: "seedanceDuration",
9091
- bitrate_mode: "seedanceBitrateMode"
9476
+ bitrate_mode: "seedanceBitrateMode",
9477
+ provider: "provider"
9092
9478
  };
9093
9479
  function draftRecipeInputKey(inputName, generatorId) {
9094
- 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";
9095
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";
9096
9484
  return DRAFT_RECIPE_INPUT_KEYS[inputName];
9097
9485
  }
9098
9486
  var DRAFT_REFERENCE_FIELD = /(?:_variant_refs?|VariantRefs?)$/;
@@ -9143,6 +9531,7 @@ function buildDraftMapping(args) {
9143
9531
  const value = recipe[key];
9144
9532
  if (value !== void 0) recipeTemplate[key] = value;
9145
9533
  }
9534
+ if (recipe.provider !== void 0) recipeTemplate.provider = recipe.provider;
9146
9535
  const availableSlots = operationDefinition.inputs.filter((input) => DRAFT_REFERENCE_FIELD.test(input.name)).map((input) => input.name);
9147
9536
  const bindings = [];
9148
9537
  if (destinationKind === "sibling" && sourceVariantId && availableSlots.includes("source_variant_ref")) bindings.push({
@@ -10341,7 +10730,29 @@ async function executeModels(parsed, deps = defaultDeps$5) {
10341
10730
  deps.print(parsed.options.json === "true" ? JSON.stringify(model, null, 2) : formatModelDetail(model));
10342
10731
  return model;
10343
10732
  }
10344
- throw new Error("Models command is required: list or show");
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");
10345
10756
  }
10346
10757
  function formatModelDetail(model) {
10347
10758
  const lines = [
@@ -10351,6 +10762,7 @@ function formatModelDetail(model) {
10351
10762
  "Operations:"
10352
10763
  ];
10353
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));
10354
10766
  for (const operation of model.operations) {
10355
10767
  if (typeof operation === "string") {
10356
10768
  lines.push(` - ${operation}`);
@@ -10372,6 +10784,20 @@ function formatModelDetail(model) {
10372
10784
  }
10373
10785
  return lines.join("\n");
10374
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
+ }
10375
10801
  function formatInputs(inputs, indent) {
10376
10802
  if (inputs.length === 0) return [];
10377
10803
  return inputs.map((input) => {
@@ -10391,7 +10817,8 @@ function rejectUnknownModelOptions(command, options) {
10391
10817
  ];
10392
10818
  const commandOptions = command ? {
10393
10819
  list: ["media", "available"],
10394
- show: []
10820
+ show: [],
10821
+ configure: ["provider", "reset-provider"]
10395
10822
  }[command] : void 0;
10396
10823
  if (!commandOptions) return;
10397
10824
  const allowed = new Set([...common, ...commandOptions]);
@@ -11453,7 +11880,7 @@ async function handleVideo(parsed) {
11453
11880
  var TOP_LEVEL_HELP = `Make Effects CLI
11454
11881
 
11455
11882
  Creative:
11456
- models list | show
11883
+ models list | show | configure
11457
11884
  image generate | regenerate
11458
11885
  video generate | regenerate
11459
11886
  audio speech|dialogue|music|sfx generate|regenerate
@@ -11480,26 +11907,28 @@ Assets and variants use compact refs:
11480
11907
  Run makefx help <noun> for details.`;
11481
11908
  var HELP = {
11482
11909
  image: `Usage:
11483
- 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>]
11484
- 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]`,
11485
11912
  video: `Usage:
11486
- 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]
11487
11914
  [--refs <variant-ref-or-file,...>] [--first-frame <ref>] [--last-frame <ref>] [--image-refs <refs>] [--video-refs <refs>] [--audio-refs <refs>]
11488
11915
  [--aspect <ratio>] [--resolution 480p|720p|1080p|4k] [--duration <seconds|auto>] [--tier generate|fast|lite] [--bitrate standard|high]
11489
11916
  [--audio | --no-audio] [--collection <id>] [--space <id>]
11490
11917
  makefx video generate ["prompt"] --model kling-avatar-v2 --image-refs <portrait-ref> --audio-refs <audio-ref>
11491
11918
  --name <name> --type <type> -o <file> [--mode standard|pro] [--collection <id>] [--space <id>]
11492
- makefx video regenerate <variant-ref> ["prompt"] [--model <model>] [--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]
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]
11493
11922
 
11494
11923
  Seedance mode is inferred: first/last frame selects frame mode, image/video/audio refs select reference mode, and no references selects text mode.`,
11495
11924
  audio: `Usage:
11496
11925
  makefx audio voices [--json]
11497
11926
  makefx audio align <variant-ref> "transcript" [--space <id>] [--json]
11498
11927
  makefx audio align <variant-ref> --input transcript.txt [--space <id>] [--json]
11499
- makefx audio speech generate "text" --voice <voice-id> --name <name> -o <file>
11500
- makefx audio speech regenerate <variant-ref> ["text"] [--voice <voice-id>] [--no-activate] [--wait]
11501
- makefx audio dialogue generate --input <file> --dialogue-voices <id,id> --name <name> -o <file>
11502
- makefx audio dialogue regenerate <variant-ref> ["script"] [--dialogue-voices <id,id>] [--no-activate] [--wait]
11928
+ makefx audio speech generate "text" [--model eleven_v3] --voice <voice-id> --name <name> -o <file>
11929
+ makefx audio speech regenerate <variant-ref> ["text"] [--model eleven_v3] [--voice <voice-id>] [--no-activate] [--wait]
11930
+ makefx audio dialogue generate --input <file> [--model eleven_v3] --dialogue-voices <id,id> --name <name> -o <file>
11931
+ makefx audio dialogue regenerate <variant-ref> ["script"] [--model eleven_v3] [--dialogue-voices <id,id>] [--no-activate] [--wait]
11503
11932
  makefx audio music generate "prompt" --model eleven-music|lyria-3 --name <name> -o <file>
11504
11933
  makefx audio music regenerate <variant-ref> ["prompt"] [--model eleven-music|lyria-3] [--no-activate] [--wait]
11505
11934
  makefx audio sfx generate "prompt" --name <name> -o <file>
@@ -11508,7 +11937,8 @@ Seedance mode is inferred: first/last frame selects frame mode, image/video/audi
11508
11937
  Generate commands also accept [--collection <id>] [--space <id>].`,
11509
11938
  models: `Usage:
11510
11939
  makefx models list [--media image|video|audio] [--available] [--json]
11511
- makefx models show <model> [--json]`,
11940
+ makefx models show <model> [--json]
11941
+ makefx models configure <model> (--provider <provider> | --reset-provider) [--json]`,
11512
11942
  assets: `Usage:
11513
11943
  makefx assets list [--query <text>] [--media image|audio|video] [--type <type>] [--json]
11514
11944
  makefx assets show <asset-ref> [--json]