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): simplify xAI model selection

antilya1aefc6b6e87f
diff --git a/packages/studio/src/components/VideoStudio.jsx b/packages/studio/src/components/VideoStudio.jsx
index c17ad78c..0a4649d3 100644
--- a/packages/studio/src/components/VideoStudio.jsx
+++ b/packages/studio/src/components/VideoStudio.jsx
@@ -42,7 +42,7 @@ import {
getGroupedVideoSelectionAdjustments,
} from "../groupedVideoParameters.js";
import { migrateSeedanceResolutionSelection } from "../seedanceParameters.js";
-import { getVideoDurationLabel, getVideoModeDescription } from "../videoModelCopy.js";
+import { getVideoAspectRatioLabel, getVideoDurationLabel, getVideoModeDescription } from "../videoModelCopy.js";
import {
buildReferenceParams,
getModelMediaCapabilities,
@@ -1109,6 +1109,7 @@ export default function VideoStudio({
const describeSelectionAdjustments = useCallback((adjustments) => {
const valueLabel = (key, value) => {
if (key === "duration") return getVideoDurationLabel(value, groupCopy);
+ if (key === "aspectRatio") return getVideoAspectRatioLabel(value, groupCopy);
if (key === "profile") return groupCopy.profiles[value]?.label || value;
if (key === "speed") return groupCopy.speeds[value] || value;
if (key === "resolution" && value === "default") return groupCopy.defaultResolution;
@@ -1162,6 +1163,7 @@ export default function VideoStudio({
resolution: selectedResolution, quality: selectedQuality,
}), [selectedVariant, modelParameterValues, selectedAr, selectedDuration, selectedResolution, selectedQuality],
);
+ const aspectRatioHelp = groupCopy[selectedVariant?.model.inputs?.aspect_ratio?.descriptionKey];
const groupedModes = useMemo(() => groupedConfiguration && workflowFamily
? [...(workflowFamily.hasBase ? [{ id: null }] : []), ...workflowFamily.workflows].map((workflow) => {
const plan = getSelectionPlan({ workflowId: workflow.id });
@@ -1661,21 +1663,13 @@ export default function VideoStudio({
urls.length > 0 &&
draftSession === workflowDraftSessionRef.current
) {
- const latestDraft = workflowMediaDraftsRef.current[draftKey] || {};
- const latestActiveDraft = projectVideoWorkflowMedia(
- targetModel,
- workflowIdAtStart,
- latestDraft,
+ const appendUploads = (drafts) => appendVideoWorkflowMedia(
+ drafts, draftKey, slot, urls,
+ projectVideoWorkflowMedia(targetModel, workflowIdAtStart, drafts[draftKey] || {}),
);
- const nextDrafts = appendVideoWorkflowMedia(
- workflowMediaDraftsRef.current,
- draftKey,
- slot,
- urls,
- latestActiveDraft,
- );
- workflowMediaDraftsRef.current = nextDrafts;
- setWorkflowMediaDrafts(nextDrafts);
+ // Keep upload capacity current without overwriting queued draft edits.
+ workflowMediaDraftsRef.current = appendUploads(workflowMediaDraftsRef.current);
+ setWorkflowMediaDrafts(appendUploads);
}
} finally {
workflowUploadSlotRef.current = null;
@@ -3180,7 +3174,7 @@ export default function VideoStudio({
>
<PromptAspectRatioIcon />
<span className={PROMPT_CONTROL_LABEL_CLASS}>
- {selectedAr}
+ {getVideoAspectRatioLabel(selectedAr, groupCopy)}
</span>
</button>
{openDropdown === "ar" && (
@@ -3190,6 +3184,9 @@ export default function VideoStudio({
<PromptPopoverHeader>
{copy.dropdowns.aspectRatio}
</PromptPopoverHeader>
+ {aspectRatioHelp && (
+ <p className="px-3 pb-2 text-[11px] text-white/45">{aspectRatioHelp}</p>
+ )}
<PromptMenuList>
{(groupedConfiguration ? commonOptions.aspectRatios : getCurrentAspectRatios(selectedModel)).map((r) => (
<PromptMenuItem
@@ -3201,7 +3198,7 @@ export default function VideoStudio({
setOpenDropdown(null);
}}
>
- {r}
+ {getVideoAspectRatioLabel(r, groupCopy)}
</PromptMenuItem>
))}
</PromptMenuList>
diff --git a/packages/studio/src/groupedVideoModels.js b/packages/studio/src/groupedVideoModels.js
index 24a4fc3e..0facf2c6 100644
--- a/packages/studio/src/groupedVideoModels.js
+++ b/packages/studio/src/groupedVideoModels.js
@@ -8,8 +8,9 @@ import { VIDU_MODEL_GROUP } from "./viduModels.js";
import { PIXVERSE_MODEL_GROUP } from "./pixverseModels.js";
import { LTX_MODEL_GROUP } from "./ltxModels.js";
import { SORA_MODEL_GROUP } from "./soraModels.js";
+import { XAI_MODEL_GROUP } from "./xaiModels.js";
-const groups = [SEEDANCE_MODEL_GROUP, VEO_MODEL_GROUP, MINIMAX_MODEL_GROUP, ALIBABA_MODEL_GROUP, HAPPY_HORSE_MODEL_GROUP, KLING_MODEL_GROUP, VIDU_MODEL_GROUP, PIXVERSE_MODEL_GROUP, LTX_MODEL_GROUP, SORA_MODEL_GROUP];
+const groups = [SEEDANCE_MODEL_GROUP, VEO_MODEL_GROUP, MINIMAX_MODEL_GROUP, ALIBABA_MODEL_GROUP, HAPPY_HORSE_MODEL_GROUP, KLING_MODEL_GROUP, VIDU_MODEL_GROUP, PIXVERSE_MODEL_GROUP, LTX_MODEL_GROUP, SORA_MODEL_GROUP, XAI_MODEL_GROUP];
const groupByFamilyId = new Map();
const configurationByModelId = new Map();
const familyNames = {};
diff --git a/packages/studio/src/groupedVideoParameters.js b/packages/studio/src/groupedVideoParameters.js
index c57a4c86..c5a8864b 100644
--- a/packages/studio/src/groupedVideoParameters.js
+++ b/packages/studio/src/groupedVideoParameters.js
@@ -20,6 +20,8 @@ import { LTX_MODEL_GROUP } from "./ltxModels.js";
import { ltxParameters } from "./ltxParameters.js";
import { SORA_MODEL_GROUP } from "./soraModels.js";
import { soraParameters } from "./soraParameters.js";
+import { XAI_MODEL_GROUP } from "./xaiModels.js";
+import { xaiParameters } from "./xaiParameters.js";
import {
getMiniMaxResolutionOptions,
getMiniMaxSelectionAdjustments,
@@ -35,6 +37,7 @@ import {
} from "./veoParameters.js";
const groups = [
+ { familyNames: XAI_MODEL_GROUP.familyNames, ...xaiParameters },
{ familyNames: SORA_MODEL_GROUP.familyNames, ...soraParameters },
{ familyNames: LTX_MODEL_GROUP.familyNames, ...ltxParameters },
{ familyNames: PIXVERSE_MODEL_GROUP.familyNames, ...pixverseParameters },
diff --git a/packages/studio/src/messages/en/videoStudio.json b/packages/studio/src/messages/en/videoStudio.json
index 28a3676f..94eec9b3 100644
--- a/packages/studio/src/messages/en/videoStudio.json
+++ b/packages/studio/src/messages/en/videoStudio.json
@@ -458,6 +458,23 @@
},
"musicDuration": "Sets duration to 4 seconds."
},
+ "xai": {
+ "aspectRatioLabels": {
+ "auto": "Match image"
+ },
+ "singleImageFormat": "With one image, the format follows that image.",
+ "fields": {
+ "mode": {
+ "title": "Style",
+ "description": "",
+ "optionLabels": {
+ "normal": "Standard",
+ "fun": "Creative",
+ "spicy": "Spicy"
+ }
+ }
+ }
+ },
"sora": {
"provider": "Generation",
"providerHelp": "",
diff --git a/packages/studio/src/messages/zh/videoStudio.json b/packages/studio/src/messages/zh/videoStudio.json
index 5caeda09..bd338ce6 100644
--- a/packages/studio/src/messages/zh/videoStudio.json
+++ b/packages/studio/src/messages/zh/videoStudio.json
@@ -458,6 +458,23 @@
},
"musicDuration": "时长设为 4 秒。"
},
+ "xai": {
+ "aspectRatioLabels": {
+ "auto": "匹配图片"
+ },
+ "singleImageFormat": "只有一张图片时,画面比例随图片。",
+ "fields": {
+ "mode": {
+ "title": "风格",
+ "description": "",
+ "optionLabels": {
+ "normal": "标准",
+ "fun": "创意",
+ "spicy": "Spicy"
+ }
+ }
+ }
+ },
"sora": {
"provider": "生成方式",
"providerHelp": "",
diff --git a/packages/studio/src/models.js b/packages/studio/src/models.js
index ba3ce384..58a3b1cb 100644
--- a/packages/studio/src/models.js
+++ b/packages/studio/src/models.js
@@ -49,6 +49,27 @@ const SEEDANCE_25_SEED_INPUT = Object.freeze({
minValue: -1,
maxValue: 4294967295,
});
+const GROK_ASPECT_RATIO_INPUT = Object.freeze({
+ type: "string", title: "Aspect Ratio", name: "aspect_ratio",
+ enum: Object.freeze(["9:16", "16:9", "2:3", "3:2", "1:1"]),
+ default: "2:3",
+});
+const GROK_RESOLUTION_INPUT = Object.freeze({
+ type: "string", title: "Resolution", name: "resolution",
+ enum: Object.freeze(["480p", "720p"]), default: "480p",
+});
+const GROK_DURATION_INPUT = Object.freeze({
+ type: "int", title: "Duration", name: "duration",
+ default: 6, minValue: 6, maxValue: 30, step: 1,
+});
+const GROK_IMAGE_INPUT = Object.freeze({
+ type: "array", title: "Image URLs", name: "images_list",
+ items: Object.freeze({ type: "string" }), minItems: 1, maxItems: 7,
+});
+const GROK_STYLE_INPUT = Object.freeze({
+ type: "string", title: "Style", name: "mode", configurable: true,
+ enum: Object.freeze(["normal", "fun", "spicy"]), default: "normal",
+});
const MINIMAX_H3_OPEN_SEED_INPUT = Object.freeze({
type: "integer",
title: "Seed",
@@ -5701,44 +5722,10 @@ export const t2vModels = [
"name": "prompt",
"description": "Text prompt describing the video."
},
- "aspect_ratio": {
- "enum": [
- "9:16",
- "16:9",
- "2:3",
- "3:2",
- "1:1"
- ],
- "title": "Aspect Ratio",
- "name": "aspect_ratio",
- "type": "string",
- "description": "Aspect ratio of the output video.",
- "default": "1:1"
- },
- "mode": {
- "enum": [
- "fun",
- "normal",
- "spicy"
- ],
- "title": "Mode",
- "name": "mode",
- "type": "string",
- "description": "Generation style: normal = standard output; fun = more creative/expressive; spicy = edgier content (text-to-video only).",
- "default": "normal"
- },
- "duration": {
- "enum": [
- 6,
- 10,
- 15
- ],
- "title": "Duration",
- "name": "duration",
- "type": "int",
- "description": "The duration of the generated video in seconds.",
- "default": 6
- }
+ "aspect_ratio": { ...GROK_ASPECT_RATIO_INPUT, default: "1:1" },
+ "mode": GROK_STYLE_INPUT,
+ "resolution": GROK_RESOLUTION_INPUT,
+ "duration": GROK_DURATION_INPUT
},
"provider": "grok",
"provider_name": "xAI"
@@ -6166,6 +6153,7 @@ export const t2vModels = [
"id": "grok-imagine-extend",
"name": "Grok Imagine Extend",
"requiresRequestId": true,
+ "promptRequired": true,
"endpoint": "grok-imagine-extend",
"inputs": {
"request_id": {
@@ -6199,17 +6187,7 @@ export const t2vModels = [
"description": "Duration in seconds to extend the video.",
"default": 6
},
- "resolution": {
- "enum": [
- "480p",
- "720p"
- ],
- "title": "Resolution",
- "name": "resolution",
- "type": "string",
- "description": "Output video resolution.",
- "default": "480p"
- }
+ "resolution": GROK_RESOLUTION_INPUT
},
"provider": "grok",
"provider_name": "xAI"
@@ -15246,8 +15224,8 @@ export const i2vModels = [
"imageField": "images_list",
"hasPrompt": true,
"promptRequired": true,
- "maxImages": 7,
"inputs": {
+ "images_list": GROK_IMAGE_INPUT,
"prompt": {
"type": "string",
"title": "Prompt",
@@ -15257,30 +15235,10 @@ export const i2vModels = [
"Camera glides through vines toward temple entrance, mist disperses as sunlight pierces canopy, birds fly off, subtle dust motes in the air, adventure-style cinematic score."
]
},
- "mode": {
- "type": "string",
- "title": "Mode",
- "name": "mode",
- "description": "Note: When generating videos using external image inputs, Spicy mode is not supported and will automatically switch to Normal.",
- "enum": [
- "fun",
- "normal",
- "spicy"
- ],
- "default": "normal"
- },
- "duration": {
- "type": "int",
- "title": "Duration",
- "name": "duration",
- "description": "The duration of the generated video in seconds.",
- "enum": [
- 6,
- 10,
- 15
- ],
- "default": 6
- }
+ "aspect_ratio": { ...GROK_ASPECT_RATIO_INPUT, descriptionKey: "singleImageFormat" },
+ "mode": { ...GROK_STYLE_INPUT, enum: ["normal", "fun"] },
+ "resolution": GROK_RESOLUTION_INPUT,
+ "duration": GROK_DURATION_INPUT
},
"provider": "grok",
"provider_name": "xAI"
@@ -19178,8 +19136,6 @@ export const i2vModels = [
"family": "video-generation",
"imageField": "images_list",
"hasPrompt": true,
- "aspectRatioMode": "inherited",
- "parameterNotice": "Aspect ratio is inherited from the input image.",
"inputs": {
"prompt": {
"type": "string",
@@ -19190,20 +19146,7 @@ export const i2vModels = [
"The whale suddenly begins swimming through the apartment as if the room is underwater. Furniture crashes into walls, water bursts outward, and the whale breaks through multiple rooms while the camera follows beside it."
]
},
- "images_list": {
- "examples": [
- "https://cdn.muapi.ai/assets/grok-imagine-video-1-5-preview.jpg"
- ],
- "description": "Upload or provide image URLs to use as input for video generation.",
- "field": "images_list",
- "type": "array",
- "items": {
- "type": "string"
- },
- "title": "Image URLs",
- "name": "images_list",
- "maxItems": 7
- },
+ "images_list": GROK_IMAGE_INPUT,
"aspect_ratio": {
"enum": [
"auto",
@@ -19221,17 +19164,7 @@ export const i2vModels = [
"description": "Aspect ratio for the generated video. Use 'auto' to match the input image.",
"default": "auto"
},
- "resolution": {
- "enum": [
- "480p",
- "720p"
- ],
- "type": "string",
- "title": "Resolution",
- "name": "resolution",
- "description": "Output video resolution.",
- "default": "480p"
- },
+ "resolution": GROK_RESOLUTION_INPUT,
"duration": {
"type": "int",
"title": "Duration (seconds)",
diff --git a/packages/studio/src/videoModelCopy.js b/packages/studio/src/videoModelCopy.js
index a9138150..e5670724 100644
--- a/packages/studio/src/videoModelCopy.js
+++ b/packages/studio/src/videoModelCopy.js
@@ -4,6 +4,10 @@ export function getVideoDurationLabel(value, copy) {
return copy.durationLabels?.[value] || `${value}s`;
}
+export function getVideoAspectRatioLabel(value, copy) {
+ return copy.aspectRatioLabels?.[value] || value;
+}
+
export function getVideoModeDescription(model, workflowId, copy) {
const description = copy.modeDescriptions[workflowId || "text"];
if (workflowId !== "references" || !model) return description;
diff --git a/packages/studio/src/videoWorkflows.js b/packages/studio/src/videoWorkflows.js
index 5cff50cf..3a18c2a6 100644
--- a/packages/studio/src/videoWorkflows.js
+++ b/packages/studio/src/videoWorkflows.js
@@ -58,10 +58,6 @@ export const VIDEO_WORKFLOW_VARIANTS = Object.freeze({
references: ["gemini-omni-image-to-video"],
edit_video: ["gemini-omni-video-edit"],
},
- "grok-imagine-video": {
- animate_image: ["grok-imagine-video-1-5-preview"],
- references: ["grok-imagine-image-to-video"],
- },
...GROUPED_VIDEO_WORKFLOW_VARIANTS,
});
@@ -761,10 +757,15 @@ export function getVideoWorkflowDraftKey(familyId, workflowId) {
}
export function migrateVideoWorkflowMediaDrafts(drafts) {
- // Omni references used to share Kling 3.0's draft before becoming a separate model.
- const { "kling-v3:references": omniReferences, ...migrated } = drafts;
- const key = getVideoWorkflowDraftKey("kling-v3-omni", "references");
- if (omniReferences && !Object.hasOwn(migrated, key)) migrated[key] = omniReferences;
+ // Preserve uploads when a model becomes a separate family.
+ const migrated = { ...drafts };
+ for (const [from, to] of [
+ ["kling-v3:references", "kling-v3-omni:references"],
+ ["grok-imagine-video:animate_image", "grok-imagine-video-1.5:animate_image"],
+ ]) {
+ if (drafts[from] && !Object.hasOwn(migrated, to)) migrated[to] = drafts[from];
+ delete migrated[from];
+ }
return migrated;
}
diff --git a/packages/studio/src/xaiModels.js b/packages/studio/src/xaiModels.js
new file mode 100644
index 00000000..60a54c5f
--- /dev/null
+++ b/packages/studio/src/xaiModels.js
@@ -0,0 +1,30 @@
+import { createGroupedVideoRegistry } from "./groupedVideoRegistry.js";
+
+export const XAI_FAMILY_NAMES = Object.freeze({
+ "grok-imagine-video-1.5": "Grok Imagine 1.5 Preview",
+ "grok-imagine-video": "Grok Imagine",
+});
+
+const registry = createGroupedVideoRegistry({
+ facetOptions: {},
+ facetLabels: {},
+ registerVariants(register) {
+ register("grok-imagine-text-to-video", "grok-imagine-video", [null]);
+ register("grok-imagine-image-to-video", "grok-imagine-video", ["references"]);
+ register("grok-imagine-video-1-5-preview", "grok-imagine-video-1.5", ["animate_image", "references"]);
+ },
+});
+
+export const {
+ getConfiguration: getXaiConfiguration,
+ resolveVariant: resolveXaiVariant,
+} = registry;
+
+export const XAI_MODEL_GROUP = Object.freeze({
+ copyKey: "xai",
+ familyNames: XAI_FAMILY_NAMES,
+ configurations: registry.configurations,
+ workflowVariants: registry.workflowVariants,
+ resolveVariant: resolveXaiVariant,
+ getVariantOptions: registry.getVariantOptions,
+});
diff --git a/packages/studio/src/xaiParameters.js b/packages/studio/src/xaiParameters.js
new file mode 100644
index 00000000..0d01716e
--- /dev/null
+++ b/packages/studio/src/xaiParameters.js
@@ -0,0 +1,7 @@
+import { createNativeVideoParameters } from "./nativeVideoParameters.js";
+import { getXaiConfiguration, resolveXaiVariant } from "./xaiModels.js";
+
+export const xaiParameters = createNativeVideoParameters({
+ getConfiguration: getXaiConfiguration,
+ resolveVariant: resolveXaiVariant,
+});