Skip to content

Unrestricted Open-source alternative to AI video platforms — Free AI image & video generation studio with 600+ models (Flux, Midjourney, Kling, Sora, Veo). No content filters. Self-hosted, MIT licensed.

feat(studio): support multi-image upload and list payload formatting for reference models

Jaya Prasad Kavurue68e7f7dec0e
diff --git a/packages/studio/src/components/VideoStudio.jsx b/packages/studio/src/components/VideoStudio.jsx
index 8dc90428..9109bfc0 100644
--- a/packages/studio/src/components/VideoStudio.jsx
+++ b/packages/studio/src/components/VideoStudio.jsx
@@ -15,6 +15,7 @@ import {
getEffectsForI2VModel,
getDefaultEffectForI2VModel,
getModesForModel,
+ getMaxImagesForI2VModel,
} from "../models.js";
// ── tiny helpers ──────────────────────────────────────────────────────────────
@@ -279,6 +280,7 @@ export default function VideoStudio({
// ── uploads ──
const [uploadedImageUrl, setUploadedImageUrl] = useState(null);
+ const [uploadedImageUrls, setUploadedImageUrls] = useState([]);
const [imageUploading, setImageUploading] = useState(false);
const [uploadedEndImageUrl, setUploadedEndImageUrl] = useState(null);
const [endImageUploading, setEndImageUploading] = useState(false);
@@ -455,6 +457,11 @@ export default function VideoStudio({
if (data.selectedMode) setSelectedMode(data.selectedMode);
if (data.selectedEffect) setSelectedEffect(data.selectedEffect);
if (data.uploadedImageUrl) setUploadedImageUrl(data.uploadedImageUrl);
+ if (data.uploadedImageUrls) {
+ setUploadedImageUrls(data.uploadedImageUrls);
+ } else if (data.uploadedImageUrl) {
+ setUploadedImageUrls([data.uploadedImageUrl]);
+ }
if (data.uploadedVideoUrl) setUploadedVideoUrl(data.uploadedVideoUrl);
if (data.uploadedVideoName) setUploadedVideoName(data.uploadedVideoName);
if (data.prompt) setPrompt(data.prompt);
@@ -503,6 +510,7 @@ export default function VideoStudio({
selectedMode,
selectedEffect,
uploadedImageUrl,
+ uploadedImageUrls,
uploadedVideoUrl,
uploadedVideoName,
prompt,
@@ -526,6 +534,7 @@ export default function VideoStudio({
selectedMode,
selectedEffect,
uploadedImageUrl,
+ uploadedImageUrls,
uploadedVideoUrl,
uploadedVideoName,
prompt,
@@ -549,17 +558,30 @@ export default function VideoStudio({
setUploadedVideoUrl(null);
setUploadedVideoName(null);
setV2vMode(false);
+
+ let targetModelId = selectedModel;
if (!imageMode) {
const currentT2V = t2vModels.find((m) => m.id === selectedModel);
const sibling = currentT2V?.family
? i2vModels.find((m) => m.family === currentT2V.family)
: null;
const target = sibling || i2vModels[0];
+ targetModelId = target.id;
setImageMode(true);
setSelectedModel(target.id);
setSelectedModelName(target.name);
applyControlsForModel(target.id, true, false);
}
+
+ const maxImgs = getMaxImagesForI2VModel(targetModelId);
+ if (maxImgs > 2) {
+ setUploadedImageUrls((prev) => {
+ if (prev.includes(url)) return prev;
+ return [...prev, url].slice(0, maxImgs);
+ });
+ } else {
+ setUploadedImageUrls([url]);
+ }
setPromptDisabled(false);
} catch (err) {
alert(`Image upload failed: ${err.message}`);
@@ -664,23 +686,36 @@ export default function VideoStudio({
// Motion-control v2v: image is a second input, not a mode switch
if (isMotionControlSelection(selectedModel, v2vMode)) {
setPromptDisabled(false);
+ setUploadedImageUrls([url]);
} else {
// Clear v2v if active
setUploadedVideoUrl(null);
setUploadedVideoName(null);
setV2vMode(false);
+ let targetModelId = selectedModel;
if (!imageMode) {
const currentT2V = t2vModels.find((m) => m.id === selectedModel);
const sibling = currentT2V?.family
? i2vModels.find((m) => m.family === currentT2V.family)
: null;
const target = sibling || i2vModels[0];
+ targetModelId = target.id;
setImageMode(true);
setSelectedModel(target.id);
setSelectedModelName(target.name);
applyControlsForModel(target.id, true, false);
}
+
+ const maxImgs = getMaxImagesForI2VModel(targetModelId);
+ if (maxImgs > 2) {
+ setUploadedImageUrls((prev) => {
+ if (prev.includes(url)) return prev;
+ return [...prev, url].slice(0, maxImgs);
+ });
+ } else {
+ setUploadedImageUrls([url]);
+ }
setPromptDisabled(false);
}
} catch (err) {
@@ -695,6 +730,7 @@ export default function VideoStudio({
const clearImageUpload = () => {
setUploadedImageUrl(null);
+ setUploadedImageUrls([]);
setUploadedEndImageUrl(null);
// Motion-control v2v: keep model and video; just drop the image
if (isMotionControlSelection(selectedModel, v2vMode)) return;
@@ -706,6 +742,24 @@ export default function VideoStudio({
setPromptDisabled(false);
};
+ const removeImageAtIndex = (idx) => {
+ const nextUrls = uploadedImageUrls.filter((_, i) => i !== idx);
+ setUploadedImageUrls(nextUrls);
+ if (nextUrls.length === 0) {
+ setUploadedImageUrl(null);
+ // Reset to text-to-video if empty list
+ if (isMotionControlSelection(selectedModel, v2vMode)) return;
+ setImageMode(false);
+ const first = t2vModels[0];
+ setSelectedModel(first.id);
+ setSelectedModelName(first.name);
+ applyControlsForModel(first.id, false, false);
+ setPromptDisabled(false);
+ } else {
+ setUploadedImageUrl(nextUrls[0]);
+ }
+ };
+
// ── end-frame upload (FLF i2v models) ──────────────────────────────────────
const handleEndImageFileChange = async (e) => {
const file = e.target.files[0];
@@ -797,7 +851,6 @@ export default function VideoStudio({
if (!isMC) {
// Single-input v2v (watermark remover etc.) — drop any image
setUploadedImageUrl(null);
- setUploadedImagePreview(null);
}
setSelectedModel(m.id);
setSelectedModelName(m.name);
@@ -864,9 +917,17 @@ export default function VideoStudio({
return;
}
} else if (imageMode) {
- if (!uploadedImageUrl) {
- alert("Please upload a start frame image first.");
- return;
+ const maxImgs = getMaxImagesForI2VModel(selectedModel);
+ if (maxImgs > 2) {
+ if (uploadedImageUrls.length === 0) {
+ alert("Please upload at least one reference image first.");
+ return;
+ }
+ } else {
+ if (!uploadedImageUrl) {
+ alert("Please upload a start frame image first.");
+ return;
+ }
}
} else {
if (!trimmedPrompt) {
@@ -919,7 +980,13 @@ export default function VideoStudio({
type: "video",
});
} else if (imageMode) {
- const i2vParams = { model: selectedModel, image_url: uploadedImageUrl };
+ const maxImgs = getMaxImagesForI2VModel(selectedModel);
+ const i2vParams = { model: selectedModel };
+ if (maxImgs > 2) {
+ i2vParams.images_list = uploadedImageUrls;
+ } else {
+ i2vParams.image_url = uploadedImageUrl;
+ }
if (trimmedPrompt) i2vParams.prompt = trimmedPrompt;
i2vParams.aspect_ratio = selectedAr;
const i2vModel = i2vModels.find((m) => m.id === selectedModel);
@@ -1036,6 +1103,7 @@ export default function VideoStudio({
selectedEffect,
showEffect,
uploadedImageUrl,
+ uploadedImageUrls,
uploadedVideoUrl,
lastGenerationId,
getCurrentModel,
@@ -1053,7 +1121,7 @@ export default function VideoStudio({
resetToPromptBar();
setPrompt("");
setUploadedImageUrl(null);
- setUploadedImagePreview(null);
+ setUploadedImageUrls([]);
setImageMode(false);
setUploadedVideoUrl(null);
setUploadedVideoName(null);
@@ -1071,7 +1139,7 @@ export default function VideoStudio({
resetToPromptBar();
setPrompt("");
setUploadedImageUrl(null);
- setUploadedImagePreview(null);
+ setUploadedImageUrls([]);
setImageMode(false);
setSelectedModel("seedance-v2.0-extend");
setSelectedModelName("Seedance 2.0 Extend");
@@ -1236,91 +1304,151 @@ export default function VideoStudio({
<div className="absolute bottom-4 w-full max-w-[95%] lg:max-w-4xl z-40 animate-fade-in-up" style={{ animationDelay: "0.2s" }}>
<div className="w-full bg-[#0a0a0a]/80 backdrop-blur-3xl rounded-md border border-white/10 p-4 flex flex-col gap-2 shadow-2xl">
<div className="flex items-center gap-2 px-1">
- {/* Image upload button */}
- <div className="relative">
- <input
- ref={imageFileInputRef}
- type="file"
- accept="image/*"
- className="hidden"
- onChange={handleImageFileChange}
- />
- <button
- type="button"
- title={
- uploadedImageUrl
- ? "Clear image"
- : "Upload image for Image-to-Video"
- }
- onClick={() =>
- uploadedImageUrl
- ? clearImageUpload()
- : imageFileInputRef.current?.click()
- }
- className={`w-10 h-10 shrink-0 rounded-full border transition-all flex items-center justify-center relative overflow-hidden ${uploadedImageUrl ? "border-primary/60 bg-primary/5" : "bg-white/5 border-white/[0.03] hover:bg-white/10 hover:border-primary/40"} group`}
- >
- {imageUploading ? (
- <div className="flex flex-col items-center justify-center w-full h-full absolute inset-0 bg-black/80 z-20 backdrop-blur-[2px]">
- <svg className="w-8 h-8 -rotate-90">
- <circle
- cx="16"
- cy="16"
- r="14"
- stroke="currentColor"
- strokeWidth="2"
- fill="transparent"
- className="text-white/10"
- />
- <circle
- cx="16"
- cy="16"
- r="14"
- stroke="currentColor"
- strokeWidth="2"
- fill="transparent"
- strokeDasharray={88}
- strokeDashoffset={88 - (88 * imageProgress) / 100}
- className="text-primary transition-all duration-300"
- />
- </svg>
- <span className="absolute text-[9px] font-black text-primary leading-none">
- {imageProgress}%
+ {/* Image upload button / thumbnails */}
+ {imageMode && getMaxImagesForI2VModel(selectedModel) > 2 ? (
+ <div className="flex items-center gap-2 flex-wrap">
+ {uploadedImageUrls.map((url, idx) => (
+ <div key={idx} className="relative w-10 h-10 shrink-0 rounded-full border border-primary/60 bg-primary/5 overflow-hidden group">
+ <img src={url} alt="" className="w-full h-full object-cover" />
+ <button
+ type="button"
+ onClick={() => removeImageAtIndex(idx)}
+ className="absolute inset-0 bg-black/75 opacity-0 group-hover:opacity-100 flex items-center justify-center text-white text-xs font-black transition-opacity"
+ title="Remove image"
+ >
+ ✕
+ </button>
+ <span className="absolute bottom-0.5 right-0.5 px-1 h-3.5 bg-black/60 rounded-full text-[8px] font-black text-primary leading-none flex items-center justify-center pointer-events-none">
+ {idx + 1}
</span>
</div>
- ) : null}
-
- {uploadedImageUrl ? (
- <img
- src={uploadedImageUrl}
- alt=""
- className={`w-full h-full object-cover rounded-full ${imageUploading ? "opacity-40 blur-[2px]" : "opacity-100"}`}
- />
- ) : (
- !imageUploading && (
- <svg
- width="18"
- height="18"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="2"
- className="text-white/40 group-hover:text-primary transition-colors"
+ ))}
+ {uploadedImageUrls.length < getMaxImagesForI2VModel(selectedModel) && (
+ <div className="relative">
+ <input
+ ref={imageFileInputRef}
+ type="file"
+ accept="image/*"
+ className="hidden"
+ onChange={handleImageFileChange}
+ />
+ <button
+ type="button"
+ title="Upload reference image"
+ onClick={() => imageFileInputRef.current?.click()}
+ className="w-10 h-10 shrink-0 rounded-full border transition-all flex items-center justify-center bg-white/5 border-white/[0.03] hover:bg-white/10 hover:border-primary/40 relative overflow-hidden group"
>
- <rect
- x="3"
- y="3"
+ {imageUploading ? (
+ <div className="flex flex-col items-center justify-center w-full h-full absolute inset-0 bg-black/80 z-20 backdrop-blur-[2px]">
+ <svg className="w-8 h-8 -rotate-90">
+ <circle cx="16" cy="16" r="14" stroke="currentColor" strokeWidth="2" fill="transparent" className="text-white/10" />
+ <circle
+ cx="16"
+ cy="16"
+ r="14"
+ stroke="currentColor"
+ strokeWidth="2"
+ fill="transparent"
+ strokeDasharray={88}
+ strokeDashoffset={88 - (88 * imageProgress) / 100}
+ className="text-primary transition-all duration-300"
+ />
+ </svg>
+ <span className="absolute text-[9px] font-black text-primary leading-none">{imageProgress}%</span>
+ </div>
+ ) : (
+ <span className="text-lg font-bold text-white/40 group-hover:text-primary transition-colors">+</span>
+ )}
+ </button>
+ </div>
+ )}
+ </div>
+ ) : (
+ <div className="relative">
+ <input
+ ref={imageFileInputRef}
+ type="file"
+ accept="image/*"
+ className="hidden"
+ onChange={handleImageFileChange}
+ />
+ <button
+ type="button"
+ title={
+ uploadedImageUrl
+ ? "Clear image"
+ : "Upload image for Image-to-Video"
+ }
+ onClick={() =>
+ uploadedImageUrl
+ ? clearImageUpload()
+ : imageFileInputRef.current?.click()
+ }
+ className={`w-10 h-10 shrink-0 rounded-full border transition-all flex items-center justify-center relative overflow-hidden ${uploadedImageUrl ? "border-primary/60 bg-primary/5" : "bg-white/5 border-white/[0.03] hover:bg-white/10 hover:border-primary/40"} group`}
+ >
+ {imageUploading ? (
+ <div className="flex flex-col items-center justify-center w-full h-full absolute inset-0 bg-black/80 z-20 backdrop-blur-[2px]">
+ <svg className="w-8 h-8 -rotate-90">
+ <circle
+ cx="16"
+ cy="16"
+ r="14"
+ stroke="currentColor"
+ strokeWidth="2"
+ fill="transparent"
+ className="text-white/10"
+ />
+ <circle
+ cx="16"
+ cy="16"
+ r="14"
+ stroke="currentColor"
+ strokeWidth="2"
+ fill="transparent"
+ strokeDasharray={88}
+ strokeDashoffset={88 - (88 * imageProgress) / 100}
+ className="text-primary transition-all duration-300"
+ />
+ </svg>
+ <span className="absolute text-[9px] font-black text-primary leading-none">
+ {imageProgress}%
+ </span>
+ </div>
+ ) : null}
+
+ {uploadedImageUrl ? (
+ <img
+ src={uploadedImageUrl}
+ alt=""
+ className={`w-full h-full object-cover rounded-full ${imageUploading ? "opacity-40 blur-[2px]" : "opacity-100"}`}
+ />
+ ) : (
+ !imageUploading && (
+ <svg
width="18"
height="18"
- rx="2"
- ry="2"
- />
- <circle cx="8.5" cy="8.5" r="1.5" />
- <polyline points="21 15 16 10 5 21" />
- </svg>
- )
- )}
- </button>
- </div>
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2"
+ className="text-white/40 group-hover:text-primary transition-colors"
+ >
+ <rect
+ x="3"
+ y="3"
+ width="18"
+ height="18"
+ rx="2"
+ ry="2"
+ />
+ <circle cx="8.5" cy="8.5" r="1.5" />
+ <polyline points="21 15 16 10 5 21" />
+ </svg>
+ )
+ )}
+ </button>
+ </div>
+ )}
{/* End-frame upload button (FLF i2v models only) */}
{imageMode && i2vModels.find((m) => m.id === selectedModel)?.lastImageField && (
diff --git a/packages/studio/src/models.js b/packages/studio/src/models.js
index 44e20db3..5761a1a9 100644
--- a/packages/studio/src/models.js
+++ b/packages/studio/src/models.js
@@ -5621,6 +5621,7 @@ export const i2vModels = [
"endpoint": "pixverse-v4.5-i2v",
"family": "pixverse-v4.5",
"imageField": "images_list",
+ "lastImageField": "images_list",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -5677,6 +5678,7 @@ export const i2vModels = [
"endpoint": "vidu-v2.0-i2v",
"family": "vidu-v2",
"imageField": "images_list",
+ "lastImageField": "images_list",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -5730,6 +5732,7 @@ export const i2vModels = [
"family": "vidu-q1",
"imageField": "images_list",
"hasPrompt": true,
+ "maxImages": 7,
"inputs": {
"prompt": {
"type": "string",
@@ -5999,6 +6002,7 @@ export const i2vModels = [
"endpoint": "pixverse-v5-i2v",
"family": "pixverse-v5",
"imageField": "images_list",
+ "lastImageField": "images_list",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -6056,6 +6060,7 @@ export const i2vModels = [
"family": "bytedance",
"imageField": "images_list",
"hasPrompt": true,
+ "maxImages": 4,
"inputs": {
"prompt": {
"type": "string",
@@ -6096,6 +6101,7 @@ export const i2vModels = [
"family": "wan2.1",
"imageField": "images_list",
"hasPrompt": true,
+ "maxImages": 5,
"inputs": {
"prompt": {
"type": "string",
@@ -6564,6 +6570,7 @@ export const i2vModels = [
"family": "veo3.1",
"imageField": "images_list",
"hasPrompt": true,
+ "maxImages": 3,
"inputs": {
"prompt": {
"type": "string",
@@ -6740,6 +6747,7 @@ export const i2vModels = [
"family": "vidu-q2",
"imageField": "images_list",
"hasPrompt": true,
+ "maxImages": 7,
"inputs": {
"prompt": {
"type": "string",
@@ -6808,6 +6816,7 @@ export const i2vModels = [
"endpoint": "vidu-q2-turbo-start-end-video",
"family": "vidu-q2",
"imageField": "image_url",
+ "lastImageField": "last_image",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -6868,6 +6877,7 @@ export const i2vModels = [
"endpoint": "vidu-q2-pro-start-end-video",
"family": "vidu-q2",
"imageField": "image_url",
+ "lastImageField": "last_image",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -7054,6 +7064,7 @@ export const i2vModels = [
"family": "grok",
"imageField": "images_list",
"hasPrompt": true,
+ "maxImages": 7,
"inputs": {
"prompt": {
"type": "string",
@@ -7140,6 +7151,7 @@ export const i2vModels = [
"family": "kling-o1",
"imageField": "images_list",
"hasPrompt": true,
+ "maxImages": 7,
"inputs": {
"prompt": {
"type": "string",
@@ -7224,6 +7236,7 @@ export const i2vModels = [
"endpoint": "pixverse-v5.5-i2v",
"family": "pixverse-v5.5",
"imageField": "images_list",
+ "lastImageField": "images_list",
"hasPrompt": true,
"inputs": {
"prompt": {
@@ -7449,6 +7462,7 @@ export const i2vModels = [
"family": "kling-o1",
"imageField": "images_list",
"hasPrompt": true,
+ "maxImages": 7,
"inputs": {
"prompt": {
"type": "string",
@@ -7666,6 +7680,140 @@ export const i2vModels = [
}
}
},
+ {
+ "id": "kling-v3.0-omni-standard-image-to-video",
+ "name": "Kling v3.0 Omni Standard Image To Video",
+ "endpoint": "kling-v3.0-omni-standard-image-to-video",
+ "family": "kling-v3.0-omni",
+ "imageField": "images_list",
+ "hasPrompt": true,
+ "maxImages": 4,
+ "inputs": {
+ "prompt": {
+ "type": "string",
+ "title": "Prompt",
+ "name": "prompt",
+ "description": "Text prompt describing the video.",
+ "examples": [
+ "During an intense basketball game, gravity suddenly breaks apart. Players begin running sideways across the arena walls while the court folds upward into impossible angles. The basketball floats briefly before being slammed through the hoop as the camera rotates dynamically with the shifting gravity."
+ ]
+ },
+ "aspect_ratio": {
+ "type": "string",
+ "title": "Aspect Ratio",
+ "name": "aspect_ratio",
+ "description": "Aspect ratio of the output video.",
+ "enum": [
+ "9:16",
+ "16:9",
+ "1:1"
+ ],
+ "default": "16:9"
+ },
+ "duration": {
+ "type": "int",
+ "title": "Duration",
+ "name": "duration",
+ "description": "Duration of the generated video in seconds.",
+ "enum": [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
+ "default": 5
+ },
+ "generate_audio": {
+ "type": "boolean",
+ "title": "Generate Audio",
+ "name": "generate_audio",
+ "description": "When enabled, generate native audio with the video (adds to cost).",
+ "default": false
+ }
+ }
+ },
+ {
+ "id": "kling-v3.0-omni-pro-image-to-video",
+ "name": "Kling v3.0 Omni Pro Image To Video",
+ "endpoint": "kling-v3.0-omni-pro-image-to-video",
+ "family": "kling-v3.0-omni",
+ "imageField": "images_list",
+ "hasPrompt": true,
+ "maxImages": 4,
+ "inputs": {
+ "prompt": {
+ "type": "string",
+ "title": "Prompt",
+ "name": "prompt",
+ "description": "Text prompt describing the video.",
+ "examples": [
+ "A high-speed train races forward nonstop while the environment transforms every few seconds—from snowy mountains to neon cyberpunk city to volcanic wasteland. Sparks fly from the tracks as the camera stays tightly locked alongside the speeding train during each violent world transition."
+ ]
+ },
+ "aspect_ratio": {
+ "type": "string",
+ "title": "Aspect Ratio",
+ "name": "aspect_ratio",
+ "description": "Aspect ratio of the output video.",
+ "enum": [
+ "9:16",
+ "16:9",
+ "1:1"
+ ],
+ "default": "16:9"
+ },
+ "duration": {
+ "type": "int",
+ "title": "Duration",
+ "name": "duration",
+ "description": "Duration of the generated video in seconds.",
+ "enum": [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
+ "default": 5
+ },
+ "generate_audio": {
+ "type": "boolean",
+ "title": "Generate Audio",
+ "name": "generate_audio",
+ "description": "When enabled, generate native audio with the video (adds to cost).",
+ "default": false
+ }
+ }
+ },
+ {
+ "id": "kling-v3.0-omni-4k-image-to-video",
+ "name": "Kling v3.0 Omni 4K Image To Video",
+ "endpoint": "kling-v3.0-omni-4k-image-to-video",
+ "family": "kling-v3.0-omni",
+ "imageField": "images_list",
+ "hasPrompt": true,
+ "maxImages": 4,
+ "inputs": {
+ "prompt": {
+ "type": "string",
+ "title": "Prompt",
+ "name": "prompt",
+ "description": "Text prompt describing the video.",
+ "examples": [
+ "A cat in @image1 wakes up and walks towards the camera in slow motion."
+ ]
+ },
+ "aspect_ratio": {
+ "type": "string",
+ "title": "Aspect Ratio",
+ "name": "aspect_ratio",
+ "description": "Aspect ratio of the output video.",
+ "enum": [
+ "9:16",
+ "16:9",
+ "1:1"
+ ],
+ "default": "16:9"
+ },
+ "duration": {
+ "type": "int",
+ "title": "Duration",
+ "name": "duration",
+ "description": "Duration of the generated video in seconds.",
+ "enum": [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
+ "default": 5
+ }
+ }
+ },
{
"id": "kling-v3.0-pro-image-to-video",
"name": "Kling v3.0 Pro Image To Video",
@@ -7747,6 +7895,7 @@ export const i2vModels = [
"family": "seedance-v2.0",
"imageField": "images_list",
"hasPrompt": true,
+ "maxImages": 5,
"inputs": {
"prompt": {
"type": "string",
@@ -7785,6 +7934,14 @@ export const i2vModels = [
export const getI2IModelById = (id) => i2iModels.find(m => m.id === id);
export const getI2VModelById = (id) => i2vModels.find(m => m.id === id);
+export const getMaxImagesForI2VModel = (modelId) => {
+ const model = getI2VModelById(modelId);
+ if (!model) return 1;
+ if (model.maxImages) return model.maxImages;
+ if (model.lastImageField) return 2;
+ return 1;
+};
+
export const getAspectRatiosForI2IModel = (modelId) => {
const model = getI2IModelById(modelId);
if (!model) return ['1:1'];
diff --git a/packages/studio/src/muapi.js b/packages/studio/src/muapi.js
index 437c9161..cdae6e5a 100644
--- a/packages/studio/src/muapi.js
+++ b/packages/studio/src/muapi.js
@@ -119,13 +119,23 @@ export async function generateI2V(apiKey, params) {
const payload = {};
if (params.prompt) payload.prompt = params.prompt;
const imageField = modelInfo?.imageField || 'image_url';
- if (params.image_url) {
+ if (params.images_list && params.images_list.length > 0) {
+ if (imageField === 'images_list') payload.images_list = params.images_list;
+ else payload[imageField] = params.images_list[0];
+ } else if (params.image_url) {
if (imageField === 'images_list') payload.images_list = [params.image_url];
else payload[imageField] = params.image_url;
}
const lastImageField = modelInfo?.lastImageField;
if (lastImageField && params.last_image) {
- payload[lastImageField] = params.last_image;
+ if (lastImageField === 'images_list') {
+ if (!payload.images_list) payload.images_list = [];
+ if (payload.images_list.indexOf(params.last_image) === -1) {
+ payload.images_list.push(params.last_image);
+ }
+ } else {
+ payload[lastImageField] = params.last_image;
+ }
}
if (params.aspect_ratio) payload.aspect_ratio = params.aspect_ratio;
if (params.duration) payload.duration = params.duration;
diff --git a/src/lib/muapi.js b/src/lib/muapi.js
index ebabe9c0..d57ce73d 100644
--- a/src/lib/muapi.js
+++ b/src/lib/muapi.js
@@ -3,7 +3,7 @@ import { getModelById, getVideoModelById, getI2IModelById, getI2VModelById, getV
export class MuapiClient {
constructor() {
// Ideally user provides this in settings
- this.baseUrl = import.meta.env.DEV ? '' : 'https://api.muapi.ai';
+ this.baseUrl = (typeof import.meta !== 'undefined' && import.meta.env?.DEV) ? '' : 'https://api.muapi.ai';
}
getKey() {
@@ -318,7 +318,13 @@ export class MuapiClient {
// Place image in the correct field for this model
const imageField = modelInfo?.imageField || 'image_url';
- if (params.image_url) {
+ if (params.images_list && params.images_list.length > 0) {
+ if (imageField === 'images_list') {
+ finalPayload.images_list = params.images_list;
+ } else {
+ finalPayload[imageField] = params.images_list[0];
+ }
+ } else if (params.image_url) {
if (imageField === 'images_list') {
finalPayload.images_list = [params.image_url];
} else {
@@ -330,7 +336,14 @@ export class MuapiClient {
// Server-side param name varies (last_image vs end_image_url).
const lastImageField = modelInfo?.lastImageField;
if (lastImageField && params.last_image) {
- finalPayload[lastImageField] = params.last_image;
+ if (lastImageField === 'images_list') {
+ if (!finalPayload.images_list) finalPayload.images_list = [];
+ if (finalPayload.images_list.indexOf(params.last_image) === -1) {
+ finalPayload.images_list.push(params.last_image);
+ }
+ } else {
+ finalPayload[lastImageField] = params.last_image;
+ }
}
if (params.aspect_ratio) finalPayload.aspect_ratio = params.aspect_ratio;