Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Hosted routes: fields and values as each provider's schema takes them

Adarsh8cf0b27975f8
diff --git a/docs/research/new-models-10.json b/docs/research/new-models-10.json
index 7299f9c5..b1fbd3e5 100644
--- a/docs/research/new-models-10.json
+++ b/docs/research/new-models-10.json
@@ -5666,8 +5666,8 @@
"nullable": true,
"type": "string",
"required": false,
- "maxLength": 600,
- "desc": "Describe your desired texture style using text. Maximum 600 characters. Required if image_style_url is not provided.",
+ "maxLength": 800,
+ "desc": "Describe your desired texture style using text. Maximum 800 characters. Required if image_style_url is not provided.",
"examples": [
"red and black chest"
]
@@ -5676,7 +5676,7 @@
"nullable": true,
"type": "string",
"required": false,
- "desc": "2D image to guide the texturing process. Supports .jpg, .jpeg, and .png formats. Required if text_style_prompt is not provided. If both are provided, image_style_url takes precedence."
+ "desc": "2D image to guide the texturing process. Supports .jpg, .jpeg, .png, and .webp formats. Required if text_style_prompt is not provided. If both are provided, image_style_url takes precedence."
},
"texture_resolution": {
"type": "enum",
@@ -5744,8 +5744,8 @@
"nullable": true,
"type": "string",
"required": false,
- "maxLength": 600,
- "desc": "Describe your desired texture style using text. Maximum 600 characters. Required if image_style_url is not provided.",
+ "maxLength": 800,
+ "desc": "Describe your desired texture style using text. Maximum 800 characters. Required if image_style_url is not provided.",
"examples": [
"red and black chest"
]
@@ -5754,7 +5754,7 @@
"nullable": true,
"type": "string",
"required": false,
- "desc": "2D image to guide the texturing process. Supports .jpg, .jpeg, and .png formats. Required if text_style_prompt is not provided. If both are provided, image_style_url takes precedence."
+ "desc": "2D image to guide the texturing process. Supports .jpg, .jpeg, .png, and .webp formats. Required if text_style_prompt is not provided. If both are provided, image_style_url takes precedence."
},
"texture_resolution": {
"type": "enum",
diff --git a/scripts/gen-cloud-models.py b/scripts/gen-cloud-models.py
index 21224fb8..0046e109 100644
--- a/scripts/gen-cloud-models.py
+++ b/scripts/gen-cloud-models.py
@@ -102,7 +102,7 @@ M = []
def model(id, name, vendor, family, kind, tagline, routes, badges=None, pricing=None, defaults=None, options=None, fixed=None, hidden=False,
sliders=None, controls=None, api_defaults=None, formats=None, ranged_durations=False, fit_values=False, fps_targets=None, upscale_tiers=None,
frame_step=None, original=False, sizes=None, keep_shape=False, licence=None, frame_fps=None, frame_multiple=None,
- exact_size=False, tier_size=None, prompt_max=False):
+ exact_size=False, tier_size=None, prompt_max=False, length_range=False):
"""sliders / controls: [(field, label)] read from each route's research inputs (dotted = nested field; a slider's
third item is its step, when the generic one is too coarse):
numeric fields with minimum/maximum become sliders, enums become composer controls; both travel as params.extra.
@@ -134,6 +134,11 @@ def model(id, name, vendor, family, kind, tagline, routes, badges=None, pricing=
the limits the field's description states ("256 to 4096 pixels"); the tiers become the resolutions.
prompt_max: kept for the entries that set it; every route now gets FieldMap.promptMax from its prompt field's maxLength (or the
limit its description states), so a longer prompt is refused before a paid call (Vidu Q4's 5,000 characters, Meshy retexture's 600).
+ On a song model, a smaller limit its prompt's description states for a prompt that comes with lyrics ("With lyrics, it ...
+ supports up to 1,024 characters": Mureka's songs) goes to ModelOptions.lyrics.promptMax.
+ length_range: the length field's own limits go to FieldMap.ranges (Mureka 9.5's whole seconds from 120 to 300, MiniMax Music 3's
+ up to 300, ElevenLabs Music v2.5's 3,000 to 600,000 ms; a list of every whole second in a run, as Replicate's H3 Lite has), so
+ an API caller's length is kept inside them.
A route's options dict may also set max_images (FieldMap.maxImages), note, loraEndpoint (the same model with LoRAs:
FieldMap.loras comes from its research record) and pin (a Replicate model run by version: the research's version)."""
M.append(dict(id=id, name=name, vendor=vendor, family=family, kind=kind, tagline=tagline, routes=routes,
@@ -141,7 +146,8 @@ def model(id, name, vendor, family, kind, tagline, routes, badges=None, pricing=
sliders=sliders or [], controls=controls or [], api_defaults=api_defaults or {}, formats=formats or {},
ranged_durations=ranged_durations, fit_values=fit_values, fps_targets=fps_targets or [], upscale_tiers=upscale_tiers or [],
frame_step=frame_step, original=original, sizes=sizes, keep_shape=keep_shape, licence=licence, frame_fps=frame_fps,
- frame_multiple=frame_multiple, exact_size=exact_size, tier_size=tier_size, prompt_max=prompt_max))
+ frame_multiple=frame_multiple, exact_size=exact_size, tier_size=tier_size, prompt_max=prompt_max,
+ length_range=length_range))
# ----- Image
@@ -654,20 +660,20 @@ H3_RES = {"480P": 0.05, "768P": 0.08, "1080P": 0.16, "2K": 0.32}
# resolution and 1.2 times over for a video over 15 s (fal's page: 30 s at 768P costs $2.88).
model("minimax-h3-max-lipsync", "MiniMax H3 Max Lip Sync · up to 15 min", "MiniMax", "hailuo", "video",
"A portrait speaks your audio: 5 seconds to 15 minutes, as long as the voice, 480P to 2K",
- [("avatar", "minimax/h3-max/lip-sync/image-to-video")], badges=["new"], defaults={"resolution": "768P"},
+ [("avatar", "minimax/h3-max/lip-sync/image-to-video")], badges=["new"], defaults={"resolution": "768P"}, fit_values=True,
pricing=("second", 0.08, "768P; 480P $0.05, 1080P $0.16, 2K $0.32; 1.2× for audio over 15 s", {"byResolution": H3_RES, "longFactor": {"over": 15, "factor": 1.2}}))
# H3 Max relight: the clip (up to 15 s, resampled to 24 fps) relit to match a lit sphere, which Fuobe draws in the browser from a
# light preset (ModelOptions.lightSphere). The result keeps the clip's shape ("adaptive") and is billed on its length.
model("minimax-h3-max-relight", "MiniMax H3 Max Relight", "MiniMax", "hailuo", "video",
"Real footage relit to a light you pick — direction, colour and softness — up to 15 s",
- [("relight-video", "minimax/h3-max/relight", "fal", {"drop": ["aspectRatio"]})], badges=["new"], defaults={"resolution": "768P"},
+ [("relight-video", "minimax/h3-max/relight", "fal", {"drop": ["aspectRatio"], "closed": True})], badges=["new"], defaults={"resolution": "768P"}, fit_values=True,
fixed={"aspect_ratio": "adaptive"}, options={"lightSphere": True, "promptOptional": True},
pricing=("second", 0.08, "768P; 480P $0.05, 1080P $0.16, 2K $0.32; billed on the clip's length", {"byResolution": H3_RES}))
# H3 Max insert: a new scene of `duration` seconds generated between params.startTime and params.endTime (resume_time) of the clip;
# only the new scene is billed (references past fal's first 4,096 tokens add $0.02 per 1,000, not counted here).
model("minimax-h3-max-insert", "MiniMax H3 Max Insert a moment", "MiniMax", "hailuo", "video",
"A new 5–13 s moment generated inside your clip, between two points you mark",
- [("insert-moment", "minimax/h3-max/insert-video")], badges=["new"], defaults={"resolution": "768p", "duration": 5}, ranged_durations=True,
+ [("insert-moment", "minimax/h3-max/insert-video", "fal", {"closed": True})], badges=["new"], defaults={"resolution": "768p", "duration": 5}, ranged_durations=True, fit_values=True,
options={"promptOptional": True}, prompt_max=True,
pricing=("second", 0.06, "768p; 480p $0.05; only the new moment is billed; references past the first 4,096 tokens add $0.02 per 1,000",
{"byResolution": {"480p": 0.05, "768p": 0.06}}))
@@ -680,7 +686,7 @@ for _slug, _id, _name, _tag in (("16bit-pixel", "pixel", "16-bit Pixel", "16-bit
_ep = f"minimax/h3-max/styles/{_slug}"
model(f"minimax-h3-max-look-{_id}", f"MiniMax H3 Max · {_name} look", "MiniMax", "hailuo", "video",
f"A new 5–15 s clip with sound, made as {_tag}, from words or a first frame (it doesn't restyle a clip)",
- [("t2v", _ep), ("i2v", _ep)], badges=["new", "audio"], defaults={"aspectRatio": "16:9", "duration": 5}, ranged_durations=True,
+ [("t2v", _ep, "fal", {"closed": True}), ("i2v", _ep, "fal", {"closed": True})], badges=["new", "audio"], defaults={"aspectRatio": "16:9", "duration": 5}, ranged_durations=True,
controls=[("damage_level", "Tape wear")] if _slug == "vhs" else None,
pricing=("second", 0.08, "768p, sound included"))
# H3 Max Turbo: words, a start frame or start and end frames, 1-15 s with sound. fal's November rate runs to 2026-11-15 (30% off),
@@ -688,7 +694,7 @@ for _slug, _id, _name, _tag in (("16bit-pixel", "pixel", "16-bit Pixel", "16-bit
model("minimax-h3-max-turbo", "MiniMax H3 Max Turbo", "MiniMax", "hailuo", "video",
"Fast, cheap H3 Max with sound — drafts and quick takes from words or frames, 1–15 s",
[("t2v", "minimax/h3-max-turbo/text-to-video"), ("i2v", "minimax/h3-max-turbo/image-to-video", "fal", "+flf2v")],
- badges=["new", "fast", "audio"], defaults={"aspectRatio": "16:9", "duration": 5, "resolution": "768P"}, ranged_durations=True,
+ badges=["new", "fast", "audio"], defaults={"aspectRatio": "16:9", "duration": 5, "resolution": "768P"}, ranged_durations=True, fit_values=True,
pricing=("second", 0.04, "768P; 480P $0.025, 1080P $0.08 — $0.028 (480P $0.0175, 1080P $0.056) until 2026-11-15",
{"byResolution": {"480P": 0.025, "768P": 0.04, "1080P": 0.08},
"promo": {"until": "2026-11-15", "usd": 0.028, "byResolution": {"480P": 0.0175, "768P": 0.028, "1080P": 0.056}}}))
@@ -706,11 +712,14 @@ model("minimax-h3-max-turbo-extend", "MiniMax H3 Max Turbo · extend", "MiniMax"
pricing=("second", 0.04, "768P; 480P $0.025, 1080P $0.08, 2K $0.16; only the new seconds", {"byResolution": {"480P": 0.025, "768P": 0.04, "1080P": 0.08, "2K": 0.16}}))
# One Replicate model takes every input; each route sends only its own (a start frame is never also a reference picture).
# HighSpeed's ratio is "adaptive" from a frame (its schema: "adaptive for image-to-video"); Lite ignores the ratio then.
+# The reference lists are plain strings ("Public URLs for up to 9 reference images"), not file fields (format: uri):
+# Replicate hands them to the model as text, so each file must go as a public link (FieldMap.publicLinks).
def H3_REPLICATE_ROUTES(ep, adaptive=False):
refs = ["images", "video", "audio"]
frame = {"drop": ["aspectRatio"], "fixed": {"ratio": "adaptive"}} if adaptive else {}
return [("t2v", ep, "replicate", {"drop": ["image", "endImage", *refs]}), ("i2v", ep, "replicate", {**frame, "drop": ["endImage", *refs, *frame.get("drop", [])]}),
- ("flf2v", ep, "replicate", {**frame, "drop": [*refs, *frame.get("drop", [])]}), ("ref2v", ep, "replicate", {"drop": ["image", "endImage"]})]
+ ("flf2v", ep, "replicate", {**frame, "drop": [*refs, *frame.get("drop", [])]}),
+ ("ref2v", ep, "replicate", {"drop": ["image", "endImage"], "publicLinks": True})]
# Replicate's H3 Lite (480P / 768P) and HighSpeed (one rate): words, a first frame, first and last frames, or references, 4-15 s.
@@ -719,12 +728,13 @@ def H3_REPLICATE_ROUTES(ep, adaptive=False):
model("minimax-h3-lite", "MiniMax H3 Lite", "MiniMax", "hailuo", "video",
"The lightest H3 with sound: words, frames or references, 4–15 s at 480P or 768P",
H3_REPLICATE_ROUTES("minimax/h3-lite"),
- badges=["new", "audio"], defaults={"aspectRatio": "16:9", "duration": 5, "resolution": "768P"}, fit_values=True, options={"maxImages": 9},
+ badges=["new", "audio"], defaults={"aspectRatio": "16:9", "duration": 5, "resolution": "768P"}, fit_values=True, options={"maxImages": 9}, length_range=True,
pricing=("second", 0.02, "768P; 480P $0.0125", {"byResolution": {"480P": 0.0125, "768P": 0.02}}))
model("minimax-h3-highspeed", "MiniMax H3 HighSpeed", "MiniMax", "hailuo", "video",
"H3 tuned for speed, with sound: words, frames or references, 4–15 s",
H3_REPLICATE_ROUTES("minimax/h3-highspeed", adaptive=True),
- badges=["new", "audio", "fast"], defaults={"aspectRatio": "16:9", "duration": 5}, fit_values=True, options={"maxImages": 9}, pricing=("second", 0.03))
+ badges=["new", "audio", "fast"], defaults={"aspectRatio": "16:9", "duration": 5}, fit_values=True, options={"maxImages": 9}, length_range=True,
+ pricing=("second", 0.03))
model("hailuo-2-3", "MiniMax Hailuo 2.3", "MiniMax", "hailuo", "video", "Expressive characters and dynamic action",
[("t2v", "fal-ai/minimax/hailuo-2.3/pro/text-to-video"), ("i2v", "fal-ai/minimax/hailuo-2.3/pro/image-to-video")],
pricing=("video", 0.49), defaults={"duration": 6}, fixed={"prompt_optimizer": True})
@@ -990,6 +1000,7 @@ model("vidu-q3", "Vidu Q3", "Shengshu", "vidu", "video", "Anime-friendly video w
model("vidu-q4", "Vidu Q4", "Shengshu", "vidu", "video", "Vidu's newest: a start frame or up to 12 references and 3 voices, 3–16 s, up to 4K",
[("i2v", "fal-ai/vidu/q4/image-to-video"), ("ref2v", "fal-ai/vidu/q4/reference-to-video")], badges=["new", "4k", "audio"], ranged_durations=True,
defaults={"aspectRatio": "16:9", "duration": 5, "resolution": "720p"}, options={"maxImages": 12, "referenceAudio": "mp3"}, prompt_max=True, fit_values=True,
+ length_range=True,
pricing=("second", 0.0665, "720p; 540p $0.0315, 1080p $0.084, 2K $0.133, 4K $0.273; sound costs nothing extra",
{"byResolution": {"540p": 0.0315, "720p": 0.0665, "1080p": 0.084, "2K": 0.133, "4K": 0.273}}))
model("luma-ray-3-2", "Luma Ray 3.2", "Luma", "luma", "video", "HDR, physically convincing motion",
@@ -1173,14 +1184,15 @@ model("stable-audio-3-music", "Stable Audio 3 Music", "Stability AI", "stable-au
model("mureka-song", "Mureka 9.5", "Mureka", "mureka", "audio", "Full songs with vocals in many genres, 2 to 5 minutes",
[("music", "mureka/v9.5/generate/song", "fal", {"ignore": ["model"]})],
pricing=("request", 0.50, "a song from a prompt; with your lyrics $0.15", {"withLyrics": 0.15}),
- defaults={"duration": 180}, options={"durations": [120, 180, 240, 300], "lyrics": {"instrumentalModel": "mureka-9-5-instrumental"}})
+ defaults={"duration": 180}, options={"durations": [120, 180, 240, 300], "lyrics": {"instrumentalModel": "mureka-9-5-instrumental"}},
+ prompt_max=True, length_range=True)
model("mureka-9", "Mureka 9", "Mureka", "mureka", "audio", "Songs with vocals at a lower price, sung from your lyrics or written for you",
[("music", "mureka/v9/generate/song")], badges=["new"], pricing=("request", 0.30, "a song from a prompt; with your lyrics $0.045", {"withLyrics": 0.045}),
- options={"lyrics": {"instrumentalModel": "mureka-9-instrumental"}})
+ options={"lyrics": {"instrumentalModel": "mureka-9-instrumental"}}, prompt_max=True)
model("mureka-9-5-instrumental", "Mureka 9.5 Instrumental", "Mureka", "mureka", "audio", "Mureka's newest instrumental tracks and beds, no vocals",
- [("music", "mureka/v9.5/generate/instrumental")], badges=["new"], pricing=("request", 0.15))
+ [("music", "mureka/v9.5/generate/instrumental")], badges=["new"], pricing=("request", 0.15), prompt_max=True)
model("mureka-9-instrumental", "Mureka 9 Instrumental", "Mureka", "mureka", "audio", "Instrumental tracks and beds, no vocals",
- [("music", "mureka/v9/generate/instrumental")], badges=["new"], pricing=("request", 0.045))
+ [("music", "mureka/v9/generate/instrumental")], badges=["new"], pricing=("request", 0.045), prompt_max=True)
# Mureka's earlier versions stay on the versioned route (fal serves 7.6, O2 and 8 there; 9 and 9.5 have routes of their own).
# Its duration is a 9.5 field only, and its Version is always sent (the route's own default is 9.5). With lyrics 7.6 costs
# $0.03, O2 and 8 $0.045; from a prompt all three $0.30.
@@ -1195,21 +1207,22 @@ model("mureka-8", "Mureka 8", "Mureka", "mureka", "audio", "Mureka's earlier ver
# required: a run with none asks for an instrumental.
model("minimax-music-3", "MiniMax Music 3 · both engines", "MiniMax", "minimax-music", "audio", "Full songs with expressive vocals up to 5 minutes, from your lyrics and a style",
[("music", "minimax/music-3")], badges=["new", "top"], defaults={"duration": 120}, options={"durations": [30, 60, 120, 180, 240, 300], "seed": True},
- api_defaults={"lyrics": "[instrumental]"},
+ api_defaults={"lyrics": "[instrumental]"}, length_range=True,
licence={"licence": "MiniMax-Music3 Community License", "commercial": True,
"note": "MIT-style grant with notice and an Acceptable Use Policy; commercial products show \"MiniMax-Music3\" in their interface; "
"above US$20M yearly revenue needs MiniMax's written authorisation. The Comfy-Org repack is tagged Apache-2.0.", "checked": "2026-11-01"})
# Its seed only goes with a composition plan (its schema says so), which Fuobe doesn't send: a prompt and a length.
model("elevenlabs-music-2-5", "ElevenLabs Music v2.5", "ElevenLabs", "elevenlabs", "audio", "Studio-quality songs and scores up to 10 minutes",
[("music", "elevenlabs/music/v2.5", "fal", {"drop": ["seed"]})], badges=["new"], pricing=("minute", 0.6, "billed per started minute", {"roundUp": True}),
- defaults={"duration": 60}, options={"durations": [15, 30, 60, 120, 180, 300, 600]})
+ defaults={"duration": 60}, options={"durations": [15, 30, 60, 120, 180, 300, 600]}, prompt_max=True, length_range=True)
# Mureka's song tools (Audio → Extend & remix, and a music result's Extend, Remix and Stems): the song is one of Mureka's own
# (params.extra.songId, kept on its results) or a file sent first through Mureka's files/upload ($0.01, Pricing.uploadUsd).
model("mureka-extend", "Mureka Extend", "Mureka", "mureka", "audio", "Makes a song longer with new lyrics, after its end or before its start",
[("song-extend", "mureka/v8/song/extend")], badges=["new"], pricing=("request", 0.004, "plus $0.01 to send a song Mureka didn't make", {"uploadUsd": 0.01}),
controls=[("extend_type", "Where", {"tail": "After the end", "head": "Before the start"})])
model("mureka-remix", "Mureka Remix", "Mureka", "mureka", "audio", "A new arrangement of a song in the style you describe, with its lyrics",
- [("song-remix", "mureka/v8/song/remix")], badges=["new"], pricing=("request", 0.20, "plus $0.01 to send a song Mureka didn't make", {"uploadUsd": 0.01}))
+ [("song-remix", "mureka/v8/song/remix")], badges=["new"], pricing=("request", 0.20, "plus $0.01 to send a song Mureka didn't make", {"uploadUsd": 0.01}),
+ prompt_max=True)
# Its stems come back as a zip (zip_url): the fal provider opens it and keeps each track as a result of its own.
model("mureka-stems", "Mureka Stems", "Mureka", "mureka", "audio", "A song split into its vocal and instrument tracks",
[("song-stems", "mureka/api/song/stem")], badges=["new"], pricing=("request", 0.20, "audio-separation-3, the default"))
@@ -1567,10 +1580,13 @@ K6_HELPER = {"param": "promptHelper", "label": "Prompt helper", "values": ["off"
"labels": {"off": "Off · your words as typed", "on": "On · Kandinsky writes a fuller caption"}}
K6_LICENCE = {"licence": "MIT", "commercial": True, "note": "Kandinsky Lab's weights (Pro, Lite, VSR) on Hugging Face; the Qwen2.5-VL text encoder is Apache-2.0",
"checked": "2026-11-02"}
-_k6 = lambda op, v: (op, f"fal-ai/kandinsky6-{v}/{K6_OPS[op]}", "fal", {"when": {"param": "variant", "value": v}})
+# From a first frame fal's aspect_ratio defaults to "auto" (the supported ratio closest to the picture's, centre-cropped to it):
+# the composer offers no shape there, so the frame keeps its own, never the model's 16:9 default.
+_K6_FRAME = {"drop": ["aspectRatio"], "fixed": {"aspect_ratio": "auto"}}
+_k6 = lambda op, v: (op, f"fal-ai/kandinsky6-{v}/{K6_OPS[op]}", "fal", {"when": {"param": "variant", "value": v}, **(_K6_FRAME if op == "i2v" else {})})
model("kandinsky-6", "Kandinsky 6.0", "Kandinsky Lab", "kandinsky", "video",
"Kandinsky 6.0 · both engines: 5 s clips with dialogue, lip sync and sound from words or a first frame · MIT",
- [_k6("t2v", "pro"), _k6("t2v", "lite"), _k6("i2v", "pro"), _k6("i2v", "lite")], badges=["new", "audio"],
+ [_k6("t2v", "pro"), _k6("t2v", "lite"), _k6("i2v", "pro"), _k6("i2v", "lite")], badges=["new", "audio"], fit_values=True,
defaults={"aspectRatio": "16:9", "duration": 5, "resolution": "480p"}, api_defaults={"enable_prompt_expansion": False},
pricing=("video", K6_PRICES["pro"]["t2v"]["20"], "a 5 s clip at 480p: Pro about $0.027 a step ($0.24 Fast, $0.56 Standard, $1.35 Best), Lite about $0.013 ($0.08, $0.16, $0.24); from a first frame a little more",
{"steps": {"variantKey": "variant", "stepsKey": "num_inference_steps", "prices": K6_PRICES}}),
@@ -1807,7 +1823,7 @@ def map_fields(fmap):
out += lora_field_names(v)
elif k == "size":
out += [v["key"]] if v.get("key") else [v["width"], v["height"]]
- elif k in ("seedRange", "maskFormat", "ranges", "ignore", "maxImages", "omitEmptyPrompt", "promptMax"):
+ elif k in ("seedRange", "maskFormat", "ranges", "ignore", "maxImages", "omitEmptyPrompt", "promptMax", "closedFields"):
continue
elif isinstance(v, str):
out.append(v)
@@ -2504,6 +2520,22 @@ def build_route(op, ep, provider, m, opts, ropts=None):
fmap["lyrics"] = {"inPrompt": True, **({"max": most} if most else {})}
opts["lyrics"] = {"inPrompt": True, **({"max": most} if most else {})}
part4_ranges(op, inputs, fmap)
+ # A song's length inside the API's own limits (length_range): Mureka 9.5's whole seconds from 120 to 300, ElevenLabs Music
+ # v2.5's 3,000 to 600,000 ms. The composer offers lengths inside them; an API caller's is kept there.
+ if m.get("length_range") and fmap.get("duration"):
+ lkey = fmap["duration"]["key"]
+ lspec = inputs.get(lkey) or {}
+ lo, hi = num(lspec.get("minimum")), num(lspec.get("maximum"))
+ whole = lspec.get("type") == "integer"
+ # A list of every whole second in a run (Replicate's H3 Lite: 4 to 15) is that range in whole seconds.
+ vals = lspec.get("values") or []
+ if lspec.get("type") == "enum" and vals and all(isinstance(v, int) and not isinstance(v, bool) for v in vals) and sorted(vals) == list(range(min(vals), max(vals) + 1)):
+ lo, hi, whole = min(vals), max(vals), True
+ r = {**({"min": lo} if lo is not None else {}), **({"max": hi} if hi is not None else {}), **({"integer": True} if whole else {})}
+ if r:
+ fmap.setdefault("ranges", {})[lkey] = r
+ else:
+ warn(f"{m['id']}: {ep} states no limits for {lkey}")
# Text-to-speech etc. carry the prompt in "text".
if ropts.get("fixed"):
m = {**m, "fixed": {**m["fixed"], **ropts["fixed"]}}
@@ -2567,6 +2599,11 @@ def build_route(op, ep, provider, m, opts, ropts=None):
# A route's own limit, stated per use in words (PixVerse V6 Max: 5,000 characters, 2,048 with an image).
if ropts.get("prompt_max"):
fmap["promptMax"] = ropts["prompt_max"]
+ # A prompt that comes with lyrics, where the API reads fewer characters of it ("With lyrics, it acts as a music-style control
+ # and supports up to 1,024 characters": Mureka's songs): ModelOptions.lyrics.promptMax, checked by the plan.
+ with_lyrics = re.search(r"[Ww]ith lyrics\b[^.]*?up to ([\d,]+) characters", (pspec or {}).get("desc") or "")
+ if with_lyrics and isinstance(opts.get("lyrics"), dict):
+ opts["lyrics"]["promptMax"] = int(with_lyrics.group(1).replace(",", ""))
if "numOutputs" in fmap:
mx = num((inputs.get(fmap["numOutputs"]) or {}).get("maximum")) or 4
opts["maxOutputs"] = max(opts.get("maxOutputs", 1), min(4, mx))
@@ -2590,6 +2627,14 @@ def build_route(op, ep, provider, m, opts, ropts=None):
# A route's own limits on a number Fuobe fills (Replicate's Stable Audio 2.5: whole seconds, 1 to 190).
if ropts.get("ranges"):
fmap["ranges"] = {**(fmap.get("ranges") or {}), **ropts["ranges"]}
+ # An endpoint whose input schema takes no other field (additionalProperties: false: fal's H3 Max relight, insert and looks)
+ # answers 422 to one: FieldMap.closedFields lists its fields, so a params.extra key it doesn't name is left out.
+ if ropts.get("closed"):
+ fmap["closedFields"] = sorted(inputs)
+ # File lists the API reads as plain strings, not file fields (Replicate's H3 Lite reference_*_urls: "Public URLs"):
+ # FieldMap.publicLinks, so the server sends each file as a public https link, never a data: URI or a Files API link.
+ if ropts.get("publicLinks"):
+ fmap["publicLinks"] = True
route = {"op": op, "provider": provider, "endpoint": f"{ep}:{version}" if ropts.get("pin") else ep, "map": fmap}
if ropts.get("note"):
route["note"] = ropts["note"]
diff --git a/src/lib/catalog/cloud-models.generated.ts b/src/lib/catalog/cloud-models.generated.ts
index 4a15cef7..301525df 100644
--- a/src/lib/catalog/cloud-models.generated.ts
+++ b/src/lib/catalog/cloud-models.generated.ts
@@ -8781,7 +8781,15 @@ export const CLOUD_MODELS: ModelDef[] = [
0,
2147483647
],
- "resolution": "resolution"
+ "resolution": {
+ "key": "resolution",
+ "accepts": [
+ "480P",
+ "768P",
+ "1080P",
+ "2K"
+ ]
+ }
}
}
],
@@ -8836,10 +8844,27 @@ export const CLOUD_MODELS: ModelDef[] = [
"image": "reference_image_url",
"video": "video_url",
"seed": "seed",
- "resolution": "resolution",
+ "resolution": {
+ "key": "resolution",
+ "accepts": [
+ "480P",
+ "768P",
+ "1080P",
+ "2K"
+ ]
+ },
"fixed": {
"aspect_ratio": "adaptive"
- }
+ },
+ "closedFields": [
+ "aspect_ratio",
+ "enable_safety_checker",
+ "reference_image_url",
+ "resolution",
+ "seed",
+ "sync_mode",
+ "video_url"
+ ]
}
}
],
@@ -8905,12 +8930,31 @@ export const CLOUD_MODELS: ModelDef[] = [
0,
2147483647
],
- "resolution": "resolution",
+ "resolution": {
+ "key": "resolution",
+ "accepts": [
+ "480p",
+ "768p"
+ ]
+ },
"duration": {
"key": "duration",
"type": "number"
},
- "promptMax": 50000
+ "promptMax": 50000,
+ "closedFields": [
+ "color_match",
+ "duration",
+ "enable_prompt_expansion",
+ "prompt",
+ "reference_image_urls",
+ "reference_video_urls",
+ "resolution",
+ "resume_time",
+ "seed",
+ "start_time",
+ "video_url"
+ ]
}
}
],
@@ -8970,7 +9014,14 @@ export const CLOUD_MODELS: ModelDef[] = [
"key": "duration",
"type": "number"
},
- "promptMax": 49815
+ "promptMax": 49815,
+ "closedFields": [
+ "aspect_ratio",
+ "duration",
+ "image_url",
+ "prompt",
+ "seed"
+ ]
}
},
{
@@ -8995,7 +9046,14 @@ export const CLOUD_MODELS: ModelDef[] = [
"key": "duration",
"type": "number"
},
- "promptMax": 49815
+ "promptMax": 49815,
+ "closedFields": [
+ "aspect_ratio",
+ "duration",
+ "image_url",
+ "prompt",
+ "seed"
+ ]
}
}
],
@@ -9054,7 +9112,14 @@ export const CLOUD_MODELS: ModelDef[] = [
"key": "duration",
"type": "number"
},
- "promptMax": 49868
+ "promptMax": 49868,
+ "closedFields": [
+ "aspect_ratio",
+ "duration",
+ "image_url",
+ "prompt",
+ "seed"
+ ]
}
},
{
@@ -9079,7 +9144,14 @@ export const CLOUD_MODELS: ModelDef[] = [
"key": "duration",
"type": "number"
},
- "promptMax": 49868
+ "promptMax": 49868,
+ "closedFields": [
+ "aspect_ratio",
+ "duration",
+ "image_url",
+ "prompt",
+ "seed"
+ ]
}
}
],
@@ -9138,7 +9210,14 @@ export const CLOUD_MODELS: ModelDef[] = [
"key": "duration",
"type": "number"
},
- "promptMax": 49914
+ "promptMax": 49914,
+ "closedFields": [
+ "aspect_ratio",
+ "duration",
+ "image_url",
+ "prompt",
+ "seed"
+ ]
}
},
{
@@ -9163,7 +9242,14 @@ export const CLOUD_MODELS: ModelDef[] = [
"key": "duration",
"type": "number"
},
- "promptMax": 49914
+ "promptMax": 49914,
+ "closedFields": [
+ "aspect_ratio",
+ "duration",
+ "image_url",
+ "prompt",
+ "seed"
+ ]
}
}
],
@@ -9222,7 +9308,14 @@ export const CLOUD_MODELS: ModelDef[] = [
"key": "duration",
"type": "number"
},
- "promptMax": 49864
+ "promptMax": 49864,
+ "closedFields": [
+ "aspect_ratio",
+ "duration",
+ "image_url",
+ "prompt",
+ "seed"
+ ]
}
},
{
@@ -9247,7 +9340,14 @@ export const CLOUD_MODELS: ModelDef[] = [
"key": "duration",
"type": "number"
},
- "promptMax": 49864
+ "promptMax": 49864,
+ "closedFields": [
+ "aspect_ratio",
+ "duration",
+ "image_url",
+ "prompt",
+ "seed"
+ ]
}
}
],
@@ -9306,7 +9406,15 @@ export const CLOUD_MODELS: ModelDef[] = [
"key": "duration",
"type": "number"
},
- "promptMax": 49910
+ "promptMax": 49910,
+ "closedFields": [
+ "aspect_ratio",
+ "damage_level",
+ "duration",
+ "image_url",
+ "prompt",
+ "seed"
+ ]
}
},
{
@@ -9331,7 +9439,15 @@ export const CLOUD_MODELS: ModelDef[] = [
"key": "duration",
"type": "number"
},
- "promptMax": 49910
+ "promptMax": 49910,
+ "closedFields": [
+ "aspect_ratio",
+ "damage_level",
+ "duration",
+ "image_url",
+ "prompt",
+ "seed"
+ ]
}
}
],
@@ -9396,8 +9512,25 @@ export const CLOUD_MODELS: ModelDef[] = [
"endpoint": "minimax/h3-max-turbo/text-to-video",
"map": {
"seed": "seed",
- "aspectRatio": "aspect_ratio",
- "resolution": "resolution",
+ "aspectRatio": {
+ "key": "aspect_ratio",
+ "accepts": [
+ "21:9",
+ "16:9",
+ "4:3",
+ "1:1",
+ "3:4",
+ "9:16"
+ ]
+ },
+ "resolution": {
+ "key": "resolution",
+ "accepts": [
+ "480P",
+ "768P",
+ "1080P"
+ ]
+ },
"duration": {
"key": "duration",
"type": "number"
@@ -9416,7 +9549,14 @@ export const CLOUD_MODELS: ModelDef[] = [
"image": "image_url",
"endImage": "end_image_url",
"seed": "seed",
- "resolution": "resolution",
+ "resolution": {
+ "key": "resolution",
+ "accepts": [
+ "480P",
+ "768P",
+ "1080P"
+ ]
+ },
"duration": {
"key": "duration",
"type": "number"
@@ -9435,7 +9575,14 @@ export const CLOUD_MODELS: ModelDef[] = [
"image": "image_url",
"endImage": "end_image_url",
"seed": "seed",
- "resolution": "resolution",
+ "resolution": {
+ "key": "resolution",
+ "accepts": [
+ "480P",
+ "768P",
+ "1080P"
+ ]
+ },
"duration": {
"key": "duration",
"type": "number"
@@ -9718,6 +9865,13 @@ export const CLOUD_MODELS: ModelDef[] = [
14,
15
]
+ },
+ "ranges": {
+ "duration": {
+ "min": 4,
+ "max": 15,
+ "integer": true
+ }
}
}
},
@@ -9762,6 +9916,13 @@ export const CLOUD_MODELS: ModelDef[] = [
14,
15
]
+ },
+ "ranges": {
+ "duration": {
+ "min": 4,
+ "max": 15,
+ "integer": true
+ }
}
}
},
@@ -9807,6 +9968,13 @@ export const CLOUD_MODELS: ModelDef[] = [
14,
15
]
+ },
+ "ranges": {
+ "duration": {
+ "min": 4,
+ "max": 15,
+ "integer": true
+ }
}
}
},
@@ -9853,7 +10021,15 @@ export const CLOUD_MODELS: ModelDef[] = [
14,
15
]
- }
+ },
+ "ranges": {
+ "duration": {
+ "min": 4,
+ "max": 15,
+ "integer": true
+ }
+ },
+ "publicLinks": true
}
}
],
@@ -9945,6 +10121,13 @@ export const CLOUD_MODELS: ModelDef[] = [
14,
15
]
+ },
+ "ranges": {
+ "duration": {
+ "min": 4,
+ "max": 15,
+ "integer": true
+ }
}
}
},
@@ -9972,6 +10155,13 @@ export const CLOUD_MODELS: ModelDef[] = [
15
]
},
+ "ranges": {
+ "duration": {
+ "min": 4,
+ "max": 15,
+ "integer": true
+ }
+ },
"fixed": {
"ratio": "adaptive"
}
@@ -10002,6 +10192,13 @@ export const CLOUD_MODELS: ModelDef[] = [
15
]
},
+ "ranges": {
+ "duration": {
+ "min": 4,
+ "max": 15,
+ "integer": true
+ }
+ },
"fixed": {
"ratio": "adaptive"
}
@@ -10043,7 +10240,15 @@ export const CLOUD_MODELS: ModelDef[] = [
14,
15
]
- }
+ },
+ "ranges": {
+ "duration": {
+ "min": 4,
+ "max": 15,
+ "integer": true
+ }
+ },
+ "publicLinks": true
}
}
],
@@ -11385,6 +11590,13 @@ export const CLOUD_MODELS: ModelDef[] = [
"key": "duration",
"type": "number"
},
+ "ranges": {
+ "duration": {
+ "min": 3,
+ "max": 16,
+ "integer": true
+ }
+ },
"promptMax": 5000
}
},
@@ -11421,6 +11633,13 @@ export const CLOUD_MODELS: ModelDef[] = [
"key": "duration",
"type": "number"
},
+ "ranges": {
+ "duration": {
+ "min": 3,
+ "max": 16,
+ "integer": true
+ }
+ },
"promptMax": 5000
}
}
@@ -15936,6 +16155,13 @@ export const CLOUD_MODELS: ModelDef[] = [
"key": "lyrics",
"max": 5000
},
+ "ranges": {
+ "duration": {
+ "min": 120,
+ "max": 300,
+ "integer": true
+ }
+ },
"promptMax": 2000,
"ignore": [
"model"
@@ -15946,6 +16172,7 @@ export const CLOUD_MODELS: ModelDef[] = [
"options": {
"lyrics": {
"max": 5000,
+ "promptMax": 1024,
"instrumentalModel": "mureka-9-5-instrumental"
},
"durations": [
@@ -15990,6 +16217,7 @@ export const CLOUD_MODELS: ModelDef[] = [
"options": {
"lyrics": {
"max": 5000,
+ "promptMax": 1024,
"instrumentalModel": "mureka-9-instrumental"
}
},
@@ -16085,8 +16313,8 @@ export const CLOUD_MODELS: ModelDef[] = [
"options": {
"lyrics": {
"max": 5000,
- "instrumentalModel": "mureka-9-instrumental",
- "promptMax": 1024
+ "promptMax": 1024,
+ "instrumentalModel": "mureka-9-instrumental"
},
"controls": [
{
@@ -16135,6 +16363,12 @@ export const CLOUD_MODELS: ModelDef[] = [
"lyrics": {
"key": "lyrics"
},
+ "ranges": {
+ "duration": {
+ "min": 1,
+ "max": 300
+ }
+ },
"defaults": {
"lyrics": "[instrumental]"
}
@@ -16190,6 +16424,13 @@ export const CLOUD_MODELS: ModelDef[] = [
"type": "number",
"multiplier": 1000
},
+ "ranges": {
+ "music_length_ms": {
+ "min": 3000,
+ "max": 600000,
+ "integer": true
+ }
+ },
"promptMax": 4100
}
}
@@ -20434,7 +20675,7 @@ export const CLOUD_MODELS: ModelDef[] = [
"fixed": {
"enable_pbr": true
},
- "promptMax": 600
+ "promptMax": 800
}
}
],
@@ -20492,7 +20733,7 @@ export const CLOUD_MODELS: ModelDef[] = [
"fixed": {
"enable_pbr": true
},
- "promptMax": 600
+ "promptMax": 800
}
}
],
@@ -21016,7 +21257,16 @@ export const CLOUD_MODELS: ModelDef[] = [
"negativePrompt": "negative_prompt",
"seed": "seed",
"generateAudio": "generate_audio",
- "aspectRatio": "aspect_ratio",
+ "aspectRatio": {
+ "key": "aspect_ratio",
+ "accepts": [
+ "16:9",
+ "9:16",
+ "1:1",
+ "4:3",
+ "3:4"
+ ]
+ },
"defaults": {
"enable_prompt_expansion": false
},
@@ -21039,7 +21289,16 @@ export const CLOUD_MODELS: ModelDef[] = [
"map": {
"seed": "seed",
"generateAudio": "generate_audio",
- "aspectRatio": "aspect_ratio",
+ "aspectRatio": {
+ "key": "aspect_ratio",
+ "accepts": [
+ "16:9",
+ "9:16",
+ "1:1",
+ "4:3",
+ "3:4"
+ ]
+ },
"defaults": {
"enable_prompt_expansion": false
},
@@ -21064,15 +21323,8 @@ export const CLOUD_MODELS: ModelDef[] = [
"image": "image_url",
"seed": "seed",
"generateAudio": "generate_audio",
- "aspectRatio": {
- "key": "aspect_ratio",
- "accepts": [
- "16:9",
- "9:16",
- "1:1",
- "4:3",
- "3:4"
- ]
+ "fixed": {
+ "aspect_ratio": "auto"
},
"defaults": {
"enable_prompt_expansion": false
@@ -21097,15 +21349,8 @@ export const CLOUD_MODELS: ModelDef[] = [
"image": "image_url",
"seed": "seed",
"generateAudio": "generate_audio",
- "aspectRatio": {
- "key": "aspect_ratio",
- "accepts": [
- "16:9",
- "9:16",
- "1:1",
- "4:3",
- "3:4"
- ]
+ "fixed": {
+ "aspect_ratio": "auto"
},
"defaults": {
"enable_prompt_expansion": false
diff --git a/src/lib/catalog/payload.ts b/src/lib/catalog/payload.ts
index 1111fee7..a2a37f77 100644
--- a/src/lib/catalog/payload.ts
+++ b/src/lib/catalog/payload.ts
@@ -547,7 +547,11 @@ export function buildPayload(map: FieldMap, input: GenInput): Record<string, unk
// Options → Prompt helper (params.extra.promptHelper) is Fuobe's own: it goes out as the API's prompt expansion, below.
// Song lyrics (params.extra.lyrics) go out only where the route says (FieldMap.lyrics), in the models' own form.
const ignore = new Set([...(map.ignore ?? []), LAYOUT_PARAM, PROMPT_HELPER_PARAM, LYRICS_PARAM, SONG_ID_PARAM, ...(asked ? [map.size!.key!] : [])]);
- for (const [k, v] of Object.entries({ ...map.fixed, ...input.extra })) if (!(map.timeline && k === "timeline") && !ignore.has(k)) setPath(out, k, v);
+ // An endpoint that refuses fields it doesn't name (FieldMap.closedFields) gets only those.
+ const closed = map.closedFields ? new Set(map.closedFields) : undefined;
+ for (const [k, v] of Object.entries({ ...map.fixed, ...input.extra })) {
+ if (!(map.timeline && k === "timeline") && !ignore.has(k) && (!closed || closed.has(k.split(".")[0]))) setPath(out, k, v);
+ }
// A song tool's song: one of the provider's own by its id (the fal provider sends any other song first, FieldMap.songSource).
const songId = input.extra?.[SONG_ID_PARAM];
if (map.songSource && typeof songId === "string" && songId.trim()) out[map.songSource.songId] = songId.trim();
diff --git a/src/lib/catalog/types.ts b/src/lib/catalog/types.ts
index f1401714..7abcff2a 100644
--- a/src/lib/catalog/types.ts
+++ b/src/lib/catalog/types.ts
@@ -610,6 +610,17 @@ export interface FieldMap {
promptMax?: number;
/** params.extra keys this route has no field for (a model-wide control only its other routes read): left out. */
ignore?: string[];
+ /**
+ * Every field the endpoint takes, when its input schema refuses any other (additionalProperties: false: fal's H3 Max relight,
+ * insert and looks answer 422): a params.extra key (an API call, Assist, Canvas) it doesn't name is left out.
+ */
+ closedFields?: string[];
+ /**
+ * The route's file lists are plain strings the API passes on as text, not file fields (Replicate's H3 Lite and HighSpeed
+ * reference_*_urls: "Public URLs", with no uri format): each file must go as a public https link. Replicate fetches a
+ * data: URI or a Files API link only for a file field, so neither works here.
+ */
+ publicLinks?: boolean;
/**
* Song lyrics (params.extra.lyrics, section tags such as [Verse] on lines of their own: src/lib/lyrics.ts): the API's lyrics
* field and the most characters it takes, or (`inPrompt`) written after the prompt for an API that reads them there
diff --git a/src/lib/composer.ts b/src/lib/composer.ts
index c9df41e0..c771c331 100644
--- a/src/lib/composer.ts
+++ b/src/lib/composer.ts
@@ -44,6 +44,8 @@ export interface SettingsShape {
count: boolean;
draft: boolean;
audio: boolean;
+ /** The operation's routes send no sound setting (fal's Vidu Q4 from a first frame always has sound): the switch can't change it. */
+ audioFixed?: boolean;
multiShot: boolean;
enhance: boolean;
sliders: boolean;
@@ -103,6 +105,7 @@ export function settingsShape(
count: (kind === "image" || kind === "video") && !single,
draft: !!o.draft,
audio: o.audio === true,
+ audioFixed: o.audio === true && !takes.audio,
multiShot: !!o.multiShot,
enhance: showPrompt,
sliders: !!o.sliders?.length,
@@ -172,7 +175,8 @@ export function settingsSummary(shape: SettingsShape, params: GenParams, model?:
if (shape.count) parts.push(`×${params.numOutputs ?? 1}`);
if (shape.multiShot && !params.shots && params.multiShot === "auto") parts.push("Multi-shot");
if (shape.draft && params.draft) parts.push("Draft");
- if (shape.audio && params.generateAudio === false) parts.push("No audio");
+ // A route that sends no sound setting makes its own sound: "No audio" would not be true.
+ if (shape.audio && !shape.audioFixed && params.generateAudio === false) parts.push("No audio");
if (shape.fps) {
const fps = params.targetFps ?? d.targetFps;
if (fps) parts.push(`${fps} fps`);
diff --git a/src/lib/lyrics.ts b/src/lib/lyrics.ts
index 0dafc87b..b8797b03 100644
--- a/src/lib/lyrics.ts
+++ b/src/lib/lyrics.ts
@@ -201,8 +201,21 @@ export function songFormat(contentType: string | undefined, name: string | undef
return ext === "mpeg" || ext === "mpga" ? "mp3" : ext;
}
-/** Why a song tool can't take this song, in plain words; null when it can (what isn't known yet is not held against it). */
-export function songToolProblem(op: string, song: { format?: string; bytes?: number; seconds?: number }): string | null {
+/**
+ * What Mureka's files/upload takes for a song Extend or Remix didn't make (platform.mureka.ai, POST /v1/files/upload, read
+ * 2026-11-06): "audio: Supported format (mp3, m4a), size limit: 10 MB" (Extend's upload_audio_id) and "remix: Supported format
+ * (mp3, m4a)" (Remix's). One of Mureka's own songs goes by its id and is never uploaded.
+ */
+export const UPLOAD_FORMATS = ["mp3", "m4a"];
+export const EXTEND_UPLOAD_MAX_BYTES = 10 * 1000 * 1000;
+
+/**
+ * Why a song tool can't take this song, in plain words; null when it can (what isn't known yet is not held against it).
+ * `byId`: true when the song is one of Mureka's own, sent by its id (params.extra.songId), so its file is never uploaded; false
+ * when it goes through Mureka's files/upload, whose format and size rules then apply. A caller that doesn't say is not held to
+ * them, so one of Mureka's own songs is never refused for its file.
+ */
+export function songToolProblem(op: string, song: { format?: string; bytes?: number; seconds?: number }, byId?: boolean): string | null {
if (op === "song-stems") {
if (song.format && !STEMS_FORMATS.includes(song.format)) return `Stems take an MP3 or M4A song: this one is a ${song.format.toUpperCase()} file. Save it as an MP3 and add it again`;
if (song.bytes && song.bytes > STEMS_MAX_BYTES) {
@@ -212,6 +225,13 @@ export function songToolProblem(op: string, song: { format?: string; bytes?: num
if (op === "song-remix" && song.seconds && (song.seconds < REMIX_SECONDS.min || song.seconds > REMIX_SECONDS.max)) {
return `Remix takes a song of ${songLength(REMIX_SECONDS.min)} to ${songLength(REMIX_SECONDS.max)}: this one is ${songLength(song.seconds)}`;
}
+ if ((op === "song-extend" || op === "song-remix") && byId === false) {
+ const tool = op === "song-extend" ? "Extend" : "Remix";
+ if (song.format && !UPLOAD_FORMATS.includes(song.format)) return `${tool} takes an MP3 or M4A song: this one is a ${song.format.toUpperCase()} file. Save it as an MP3 and add it again`;
+ if (op === "song-extend" && song.bytes && song.bytes > EXTEND_UPLOAD_MAX_BYTES) {
+ return `Extend takes a song of up to 10 MB: this one is ${Math.ceil(song.bytes / 100_000) / 10} MB. Save it as a smaller MP3 and add it again`;
+ }
+ }
return null;
}
diff --git a/src/lib/output-actions.ts b/src/lib/output-actions.ts
index ac7e7a11..e3094a3b 100644
--- a/src/lib/output-actions.ts
+++ b/src/lib/output-actions.ts
@@ -223,7 +223,10 @@ export function outputActions(g: Generation, index: number, ctx: ActionContext =
// that runs open models only. Remix only where there are vocals to keep (with the song's lyrics, which it needs whole),
// Stems only on an MP3 or M4A song (what Mureka separates).
if (g.op && SONG_OPS.has(g.op) && ctx.engineMode !== "open") {
- const song = typeof o.meta?.songId === "string" ? `&song=${q(o.meta.songId)}` : "";
+ // Mureka takes a song by its id only for a month ("Only supports songs generated within the last month": its song/extend
+ // and song/remix reference): an older song goes as its file (files/upload).
+ const byId = typeof o.meta?.songId === "string" && Date.now() - (g.completedAt ?? g.createdAt) < MUREKA_SONG_ID_MS;
+ const song = byId ? `&song=${q(o.meta!.songId as string)}` : "";
link("extend-song", "Extend song", `/audio/song?model=mureka-extend&audio=${q(o.url)}${song}`);
if (!instrumentalSong(g)) {
// The whole song's words: an extension's run holds only its new part's.
@@ -301,6 +304,9 @@ export function outputActions(g: Generation, index: number, ctx: ActionContext =
/** Results that are songs: made, extended or remixed. */
const SONG_OPS = new Set<Generation["op"]>(["music", "song-extend", "song-remix"]);
+/** How long one of Mureka's songs goes to its tools by id: its API takes ids of songs from the last month (a day kept spare). */
+const MUREKA_SONG_ID_MS = 29 * 24 * 60 * 60 * 1000;
+
/** Music models that make instrumentals only, and those that make one when they're given no words to sing. */
const INSTRUMENTAL_MODELS = new Set(["mureka-9-instrumental", "mureka-9-5-instrumental", "sonilo-music", "stable-audio-3-music", "stable-audio-2-5"]);
const INSTRUMENTAL_WITHOUT_WORDS = new Set(["minimax-music-3", "oss-minimax-music-3", "oss-ace-step"]);
diff --git a/tests/h3-turbo-windows.test.ts b/tests/h3-turbo-windows.test.ts
index 38dc983e..7e881084 100644
--- a/tests/h3-turbo-windows.test.ts
+++ b/tests/h3-turbo-windows.test.ts
@@ -57,8 +57,7 @@ describe("MiniMax H3 and H3 Max Turbo windows", () => {
expect([4, 7, 9, 14, 15, 20].map(take)).toEqual([4, 7, 9, 14, 15, 15]);
});
- // Skipped until scripts/gen-cloud-models.py gives minimax-h3 options.maxReferences 12 (a generator change).
- it.skip("MiniMax H3 holds its references to 12 files in all, as Turbo does (fal: \"must add up to at most 12 files\")", () => {
+ it("MiniMax H3 holds its references to 12 files in all, as Turbo does (fal: \"must add up to at most 12 files\")", () => {
const n = (k: number) => Array.from({ length: k }, (_, i) => `https://x/${i}.png`);
const req = { inputs: { images: n(9), videos: n(3).map((u) => u.replace(".png", ".mp4")), audios: ["https://x/a.wav"] } };
for (const m of [h3, refs]) expect(hostedInputProblem(m, "ref2v", "Image 1 dances", {}, req)).toMatch(/up to 12 references in all .* this run has 13: remove 1/);
diff --git a/tests/h3max-tools-fields.test.ts b/tests/h3max-tools-fields.test.ts
new file mode 100644
index 00000000..a08a6a7d
--- /dev/null
+++ b/tests/h3max-tools-fields.test.ts
@@ -0,0 +1,109 @@
+import { describe, expect, it } from "vitest";
+import { tempDir } from "./helpers/temp-dir";
+
+/**
+ * fal's H3 Max lip sync, relight and insert, held to fal's own schemas (https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=
+ * minimax/h3-max/lip-sync/image-to-video, …/relight, …/insert-video, read 2026-11-06): a seed inside 0–2147483647 where the
+ * schema bounds it (FieldMap.seedRange), and the resolution in each endpoint's own case (lip sync and relight "768P", insert
+ * "768p"). Before, a typed seed past 2147483647, a batch's seed + index past it, or "768p" on lip sync went out as given, and fal
+ * answers 422 to each. Pure functions only.
+ */
+process.env.FUOBE_DATA_DIR = tempDir("fuobe-h3max-tools-fields-");
+process.env.COMFYUI_URL = "http://127.0.0.1:9";
+
+const { getModel, getPreset } = await import("@/lib/catalog");
+const { buildPayload } = await import("@/lib/catalog/payload");
+const { planGeneration, routesFor } = await import("@/lib/catalog/plan");
+type Req = import("@/lib/catalog/types").GenerationRequest;
+
+const IMG = "https://example.com/a.png";
+const CLIP = "https://example.com/a.mp4";
+const VOICE = "https://example.com/a.mp3";
+const INPUTS: Record<string, Req["inputs"]> = {
+ "minimax-h3-max-lipsync": { images: [IMG], audio: VOICE },
+ "minimax-h3-max-relight": { video: CLIP, images: [IMG] },
+ "minimax-h3-max-insert": { video: CLIP },
+};
+const FEATURE: Record<string, string> = { "minimax-h3-max-lipsync": "lipsync", "minimax-h3-max-relight": "video-tools", "minimax-h3-max-insert": "video-edit" };
+
+/** The body the route sends for a run with these params (the server's plan; the seed as the hand-over sets it: the batch's + index). */
+function body(modelId: string, params: Record<string, unknown>, seed?: number) {
+ const plan = planGeneration(
+ { feature: FEATURE[modelId], modelId, prompt: "", inputs: INPUTS[modelId], params: { startTime: 2, endTime: 3, sourceDuration: 8, ...params } } as Req,
+ getModel,
+ getPreset,
+ );
+ const r = routesFor(plan.model, plan.op)[0];
+ return buildPayload(r.map!, { ...plan.params, prompt: plan.prompt, ...INPUTS[modelId], ...(seed !== undefined && { seed }) } as never);
+}
+
+describe("H3 Max lip sync, relight and insert: the fields as fal's schemas take them", () => {
+ it("a seed stays inside 0–2147483647 on lip sync and insert: a typed seed past it, and a batch's seed + index", () => {
+ for (const id of ["minimax-h3-max-lipsync", "minimax-h3-max-insert"]) {
+ for (const seed of [2147483647, 2147483648, 4000000000, 9999999999]) {
+ const s = body(id, {}, seed).seed as number;
+ expect(Number.isInteger(s), `${id} ${seed}`).toBe(true);
+ expect(s, `${id} ${seed}`).toBeGreaterThanOrEqual(0);
+ expect(s, `${id} ${seed}`).toBeLessThanOrEqual(2147483647);
+ }
+ // A seed inside the range goes as it is.
+ expect(body(id, {}, 123456789).seed).toBe(123456789);
+ }
+ // Relight's seed has no bounds in its schema: sent as it is.
+ expect(body("minimax-h3-max-relight", {}, 9999999999).seed).toBe(9999999999);
+ expect(getModel("minimax-h3-max-lipsync")!.routes[0].map!.seedRange).toEqual([0, 2147483647]);
+ });
+
+ it("the resolution goes in each endpoint's own case, whatever case an API call or Assist sends", () => {
+ expect(body("minimax-h3-max-lipsync", { resolution: "768p" }).resolution).toBe("768P");
+ expect(body("minimax-h3-max-lipsync", { resolution: "2k" }).resolution).toBe("2K");
+ expect(body("minimax-h3-max-relight", { resolution: "1080p" }).resolution).toBe("1080P");
+ expect(body("minimax-h3-max-insert", { resolution: "768P" }).resolution).toBe("768p");
+ expect(body("minimax-h3-max-insert", { resolution: "480P" }).resolution).toBe("480p");
+ // The composer's own values are unchanged.
+ expect(body("minimax-h3-max-lipsync", { resolution: "1080P" }).resolution).toBe("1080P");
+ expect(body("minimax-h3-max-insert", { resolution: "768p" }).resolution).toBe("768p");
+ });
+});
+
+describe("H3 Max relight, insert and looks take no field their schema doesn't name (additionalProperties: false)", () => {
+ it("an API caller's unknown params.extra key is left out; the schema's own optional fields still go", () => {
+ // Relight's schema has enable_safety_checker; insert's has color_match.
+ for (const [id, own] of [["minimax-h3-max-relight", "enable_safety_checker"], ["minimax-h3-max-insert", "color_match"]] as const) {
+ const sent = body(id, { extra: { foo: 1, [own]: false } });
+ expect(sent, id).not.toHaveProperty("foo");
+ expect(sent[own], id).toBe(false);
+ expect(getModel(id)!.routes[0].map!.closedFields, id).toContain(own);
+ }
+ const vhs = getModel("minimax-h3-max-look-vhs")!.routes[0];
+ const sent = buildPayload(vhs.map!, { prompt: "a dancer", extra: { damage_level: "heavy", tape_speed: "lp" } } as never);
+ expect(sent).toMatchObject({ prompt: "a dancer", damage_level: "heavy" });
+ expect(sent).not.toHaveProperty("tape_speed");
+ });
+
+ it("an open schema (lip sync) still takes any key, as fal ignores it there", () => {
+ expect(getModel("minimax-h3-max-lipsync")!.routes[0].map!.closedFields).toBeUndefined();
+ expect(body("minimax-h3-max-lipsync", { extra: { enable_transcription: false } }).enable_transcription).toBe(false);
+ });
+});
+
+describe("H3 Max Turbo from words or frames: the values fal's schemas take", () => {
+ // fal's minimax/h3-max-turbo/{text,image}-to-video: resolution 480P | 768P | 1080P; aspect_ratio 21:9 … 9:16 (no "auto").
+ const turbo = (op: "t2v" | "i2v", params: Record<string, unknown>) => {
+ const r = getModel("minimax-h3-max-turbo")!.routes.find((x) => x.op === op)!;
+ return buildPayload(r.map!, { prompt: "a slow push-in", images: op === "i2v" ? [IMG] : [], ...params } as never);
+ };
+
+ it("an API caller's 2K or 4K goes as 1080P, the largest it makes", () => {
+ for (const op of ["t2v", "i2v"] as const) {
+ expect(turbo(op, { resolution: "2K" }).resolution, op).toBe("1080P");
+ expect(turbo(op, { resolution: "4K" }).resolution, op).toBe("1080P");
+ expect(turbo(op, { resolution: "768p" }).resolution, op).toBe("768P");
+ }
+ });
+
+ it("from words, a shape it doesn't take goes as the nearest it does", () => {
+ expect(turbo("t2v", { aspectRatio: "2:3" }).aspect_ratio).toBe("3:4");
+ expect(turbo("t2v", { aspectRatio: "21:9" }).aspect_ratio).toBe("21:9");
+ });
+});
diff --git a/tests/music-spec-limits.test.ts b/tests/music-spec-limits.test.ts
new file mode 100644
index 00000000..fb8508a5
--- /dev/null
+++ b/tests/music-spec-limits.test.ts
@@ -0,0 +1,91 @@
+/**
+ * The music routes' limits as fal's own OpenAPI schemas state them (queue openapi.json?endpoint_id=…, read 2026-11-06), and
+ * Mureka's files/upload rules from its own API reference (platform.mureka.ai, POST /v1/files/upload): a request outside them
+ * is refused in Fuobe's words before it is paid for, or an API caller's length is kept inside them.
+ */
+import { describe, expect, it } from "vitest";
+import { getModel, getPreset } from "@/lib/catalog";
+import { buildPayload } from "@/lib/catalog/payload";
+import { planGeneration } from "@/lib/catalog/plan";
+import type { Generation, GenerationRequest, ModelRoute } from "@/lib/catalog/types";
+import { songToolProblem } from "@/lib/lyrics";
+import { outputActions } from "@/lib/output-actions";
+
+const route = (id: string): ModelRoute => getModel(id)!.routes[0];
+const payload = (id: string, input: Record<string, unknown>) => buildPayload(route(id).map!, { prompt: "", ...input } as never);
+const planError = (req: Omit<GenerationRequest, "feature">) => {
+ try {
+ planGeneration({ feature: "audio", ...req }, getModel, getPreset);
+ return null;
+ } catch (e) {
+ return (e as Error).message;
+ }
+};
+const words = (n: number) => "Glossy synth-pop, confident vocal, punchy drums. ".repeat(Math.ceil(n / 49)).slice(0, n - 1) + "x";
+const LYRICS = "[Verse]\nNeon light on the runway tonight\n\n[Chorus]\nWalk it, own it";
+
+describe("the prompt limits in fal's schemas", () => {
+ it("refuses a prompt longer than the endpoint takes, before it is sent", () => {
+ // maxLength: Mureka's songs 2,000, its instrumentals and Remix 1,024, ElevenLabs Music v2.5 4,100, Lyria 3.5 5,000.
+ expect(planError({ modelId: "mureka-song", prompt: words(2000) })).toBeNull();
+ expect(planError({ modelId: "mureka-song", prompt: words(2001) })).toBe("Mureka 9.5 takes up to 2,000 characters of prompt, and this one has 2,001: shorten it");
+ expect(planError({ modelId: "mureka-9", prompt: words(2001) })).toMatch(/^Mureka 9 takes up to 2,000 characters/);
+ expect(planError({ modelId: "mureka-9-5-instrumental", prompt: words(1024) })).toBeNull();
+ expect(planError({ modelId: "mureka-9-5-instrumental", prompt: words(1025) })).toMatch(/^Mureka 9.5 Instrumental takes up to 1,024 characters/);
+ expect(planError({ modelId: "mureka-9-instrumental", prompt: words(1025) })).toMatch(/^Mureka 9 Instrumental takes up to 1,024 characters/);
+ expect(planError({ modelId: "elevenlabs-music-2-5", prompt: words(4101) })).toMatch(/^ElevenLabs Music v2.5 takes up to 4,100 characters/);
+ expect(planError({ modelId: "lyria-3-5", prompt: words(5001) })).toMatch(/^Lyria 3.5 takes up to 5,000 characters/);
+ const remix = { modelId: "mureka-remix", inputs: { audio: "/api/files/s.mp3" }, params: { extra: { lyrics: LYRICS } } };
+ expect(planError({ ...remix, prompt: words(1024) })).toBeNull();
+ expect(planError({ ...remix, prompt: words(1025) })).toMatch(/^Mureka Remix takes up to 1,024 characters/);
+ });
+
+ it("with lyrics, a Mureka song reads 1,024 characters of description (its schema: 'With lyrics, it … supports up to 1,024')", () => {
+ expect(getModel("mureka-song")!.options.lyrics?.promptMax).toBe(1024);
+ expect(getModel("mureka-9")!.options.lyrics?.promptMax).toBe(1024);
+ const sung = (modelId: string, n: number) => planError({ modelId, prompt: words(n), params: { extra: { lyrics: LYRICS } } });
+ expect(sung("mureka-song", 1024)).toBeNull();
+ expect(sung("mureka-song", 1025)).toBe("With lyrics, Mureka 9.5 takes a style of up to 1,024 characters, and this one has 1,025: shorten it");
+ expect(sung("mureka-9", 1500)).toMatch(/^With lyrics, Mureka 9 takes a style of up to 1,024 characters/);
+ // Without lyrics the description is the whole song's: up to 2,000.
+ expect(planError({ modelId: "mureka-song", prompt: words(1500) })).toBeNull();
+ });
+});
+
+describe("the length limits in fal's schemas", () => {
+ it("keeps an API caller's length inside them (Mureka 9.5 whole seconds 120-300, MiniMax Music 3 up to 300, ElevenLabs v2.5 3-600 s)", () => {
+ expect(payload("mureka-song", { duration: 100 }).duration).toBe(120);
+ expect(payload("mureka-song", { duration: 150.5 }).duration).toBe(151);
+ expect(payload("mureka-song", { duration: 240 }).duration).toBe(240);
+ expect(payload("minimax-music-3", { duration: 301 }).duration).toBe(300);
+ expect(payload("minimax-music-3", { duration: 47 }).duration).toBe(47);
+ expect(payload("elevenlabs-music-2-5", { duration: 2 }).music_length_ms).toBe(3000);
+ expect(payload("elevenlabs-music-2-5", { duration: 47.25 }).music_length_ms).toBe(47250);
+ expect(payload("elevenlabs-music-2-5", { duration: 900 }).music_length_ms).toBe(600000);
+ });
+});
+
+describe("a song Mureka's files/upload takes (Extend and Remix of a song it didn't make)", () => {
+ it("is an MP3 or M4A, and for Extend 10 MB at most; one of Mureka's own goes by its id and is never uploaded", () => {
+ expect(songToolProblem("song-extend", { format: "wav", seconds: 60 }, false)).toBe("Extend takes an MP3 or M4A song: this one is a WAV file. Save it as an MP3 and add it again");
+ expect(songToolProblem("song-remix", { format: "flac", seconds: 60 }, false)).toBe("Remix takes an MP3 or M4A song: this one is a FLAC file. Save it as an MP3 and add it again");
+ expect(songToolProblem("song-extend", { format: "mp3", bytes: 10_500_000 }, false)).toBe("Extend takes a song of up to 10 MB: this one is 10.5 MB. Save it as a smaller MP3 and add it again");
+ expect(songToolProblem("song-extend", { format: "m4a", bytes: 9_000_000 }, false)).toBeNull();
+ expect(songToolProblem("song-remix", { format: "mp3", bytes: 12_000_000, seconds: 300 }, false)).toBeNull();
+ // A caller that doesn't say how the song goes (the server before it passes songById) is not held to the upload's rules.
+ expect(songToolProblem("song-extend", { format: "wav", bytes: 50_000_000 })).toBeNull();
+ // By id: no upload, so neither the file's format nor its size matters.
+ expect(songToolProblem("song-extend", { format: "wav", bytes: 50_000_000 }, true)).toBeNull();
+ expect(songToolProblem("song-remix", { format: "wav", seconds: 120 }, true)).toBeNull();
+ // Remix's own length rule comes first, by id or not.
+ expect(songToolProblem("song-remix", { format: "wav", seconds: 400 }, true)).toBe("Remix takes a song of 0:10 to 5:50: this one is 6:40");
+ });
+
+ it("a Mureka song goes by its id for a month only ('Only supports songs generated within the last month'), then as its file", () => {
+ const gen = (createdAt: number) =>
+ ({ id: "g1", status: "succeeded", op: "music", feature: "audio", modelId: "mureka-song", request: { feature: "audio", modelId: "mureka-song" }, outputs: [{ url: "/api/files/song.mp3", kind: "audio", meta: { songId: "song_1" } }], createdAt, completedAt: createdAt }) as unknown as Generation;
+ const extend = (g: Generation) => outputActions(g, 0, {}).find((a) => a.id === "extend-song")!.href;
+ expect(extend(gen(Date.now() - 2 * 86_400_000))).toBe("/audio/song?model=mureka-extend&audio=%2Fapi%2Ffiles%2Fsong.mp3&song=song_1");
+ expect(extend(gen(Date.now() - 31 * 86_400_000))).toBe("/audio/song?model=mureka-extend&audio=%2Fapi%2Ffiles%2Fsong.mp3");
+ });
+});
diff --git a/tests/music3-cloud.test.ts b/tests/music3-cloud.test.ts
index 0f8a559d..a4ac7eca 100644
--- a/tests/music3-cloud.test.ts
+++ b/tests/music3-cloud.test.ts
@@ -130,7 +130,7 @@ describe("Mureka's versions", () => {
it("a Mureka song sings words: an instrumental is its instrumental model", () => {
expect(planError({ modelId: "mureka-song", prompt: "pop", params: { extra: { lyrics: "[Instrumental]" } } })).toBe("Mureka 9.5 sings the lyrics you write: for an instrumental, pick Mureka 9.5 Instrumental");
expect(planError({ modelId: "mureka-9", prompt: "pop", params: { extra: { lyrics: "[Instrumental]" } } })).toBe("Mureka 9 sings the lyrics you write: for an instrumental, pick Mureka 9 Instrumental");
- expect(getModel("mureka-song")!.options.lyrics).toEqual({ max: 5000, instrumentalModel: "mureka-9-5-instrumental" });
+ expect(getModel("mureka-song")!.options.lyrics).toEqual({ max: 5000, promptMax: 1024, instrumentalModel: "mureka-9-5-instrumental" });
});
it("MiniMax Music 2.5 makes an instrumental by its own switch, with no words written for it", () => {
@@ -218,7 +218,7 @@ describe("lyrics in the plan", () => {
describe("a music result's song tools", () => {
const gen = (o: Partial<Generation> = {}, meta: Record<string, unknown> = {}): Generation =>
- ({ id: "g1", status: "succeeded", op: "music", feature: "audio", modelId: "mureka-song", request: { feature: "audio", modelId: "mureka-song" }, outputs: [{ url: "/api/files/song.mp3", kind: "audio", meta }], createdAt: 0, ...o }) as unknown as Generation;
+ ({ id: "g1", status: "succeeded", op: "music", feature: "audio", modelId: "mureka-song", request: { feature: "audio", modelId: "mureka-song" }, outputs: [{ url: "/api/files/song.mp3", kind: "audio", meta }], createdAt: Date.now(), ...o }) as unknown as Generation;
const ids = (g: Generation, engineMode?: "both" | "open" | "cloud") => outputActions(g, 0, { engineMode }).filter((a) => ["extend-song", "remix-song", "song-stems"].includes(a.id));
it("Extend song, Remix and Stems open Extend & remix with the song (and Mureka's id for its own)", () => {
@@ -257,8 +257,11 @@ describe("a music result's song tools", () => {
expect(songToolProblem("song-stems", { format: "flac" })).toBe("Stems take an MP3 or M4A song: this one is a FLAC file. Save it as an MP3 and add it again");
expect(songToolProblem("song-stems", { format: "mp3", bytes: 9_000_000 })).toBeNull();
expect(songToolProblem("song-remix", { seconds: 351 })).toBe("Remix takes a song of 0:10 to 5:50: this one is 5:51");
- expect(songToolProblem("song-remix", { seconds: 120, format: "wav" })).toBeNull();
- expect(songToolProblem("song-extend", { seconds: 900, format: "wav" })).toBeNull();
+ // A song Mureka didn't make goes through its files/upload, which takes an MP3 or M4A; one of its own goes by its id.
+ expect(songToolProblem("song-remix", { seconds: 120, format: "wav" }, false)).toBe("Remix takes an MP3 or M4A song: this one is a WAV file. Save it as an MP3 and add it again");
+ expect(songToolProblem("song-remix", { seconds: 120, format: "wav" }, true)).toBeNull();
+ expect(songToolProblem("song-extend", { seconds: 900, format: "wav" }, false)).toBe("Extend takes an MP3 or M4A song: this one is a WAV file. Save it as an MP3 and add it again");
+ expect(songToolProblem("song-extend", { seconds: 900, format: "wav" }, true)).toBeNull();
// The remix of an instrumental is refused in the plan.
expect(planError({ modelId: "mureka-remix", prompt: "jazz", inputs: { audio: "/api/files/s.mp3" }, params: { extra: { lyrics: "[Instrumental]" } } })).toMatch(/^Write the remix's lyrics.*not instrumentals\)$/);
});
diff --git a/tests/replicate-spec-h3-nano.test.ts b/tests/replicate-spec-h3-nano.test.ts
new file mode 100644
index 00000000..e719b72e
--- /dev/null
+++ b/tests/replicate-spec-h3-nano.test.ts
@@ -0,0 +1,76 @@
+import { describe, expect, it } from "vitest";
+import { tempDir } from "./helpers/temp-dir";
+
+/**
+ * Replicate routes checked against the models' own API pages (read 2026-11-06), with pure functions only (no key, no call):
+ * - minimax/h3-lite and minimax/h3-highspeed: "Reference audio needs to be combined with a reference image or video", and
+ * reference_image_urls / reference_video_urls / reference_audio_urls are "Public URLs" (plain strings, not file fields).
+ * - google/nano-banana-pro: aspect_ratio is one of match_input_image, 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9
+ * (no "auto"; its default, match_input_image, follows the input picture).
+ */
+
+process.env.FUOBE_DATA_DIR = tempDir("fuobe-replicate-spec-");
+
+const { getModel, getPreset } = await import("@/lib/catalog");
+const { planGeneration } = await import("@/lib/catalog/plan");
+const { buildPayload } = await import("@/lib/catalog/payload");
+type Req = import("@/lib/catalog/types").GenerationRequest;
+
+const IMG = "https://example.com/a.png";
+const CLIP = "https://example.com/a.mp4";
+const VOICE = "https://example.com/a.mp3";
+const NANO_REPLICATE_RATIOS = ["match_input_image", "1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9"];
+
+describe("H3 Lite and HighSpeed references on Replicate", () => {
+ const plan = (modelId: string, inputs: Req["inputs"]) => planGeneration({ feature: "video", modelId, prompt: "Image 1 sings", inputs } as Req, getModel, getPreset);
+ for (const [id, name] of [
+ ["minimax-h3-lite", "MiniMax H3 Lite"],
+ ["minimax-h3-highspeed", "MiniMax H3 HighSpeed"],
+ ] as const) {
+ it(`${name}: sound clips go with a picture or a clip, never alone`, () => {
+ expect(() => plan(id, { audios: [VOICE] })).toThrow(`${name} uses sound clips together with a reference picture or clip: add one of those too`);
+ expect(() => plan(id, { audios: [VOICE, VOICE] })).toThrow(/together with a reference picture or clip/);
+ expect(plan(id, { images: [IMG], audios: [VOICE] }).op).toBe("ref2v");
+ expect(plan(id, { videos: [CLIP], audios: [VOICE] }).op).toBe("ref2v");
+ expect(plan(id, { images: [IMG, IMG] }).op).toBe("ref2v");
+ });
+
+ it(`${name}: only the reference route asks for public links`, () => {
+ const routes = getModel(id)!.routes;
+ expect(routes.filter((r) => r.map?.publicLinks).map((r) => r.op)).toEqual(["ref2v"]);
+ const refs = routes.find((r) => r.op === "ref2v")!.map!;
+ expect([refs.images, refs.videos, refs.audios]).toEqual(["reference_image_urls", "reference_video_urls", "reference_audio_urls"]);
+ });
+ }
+
+ it("the rule is theirs alone: fal's H3 Max Turbo references take sound on its own", () => {
+ expect(plan("minimax-h3-max-turbo-refs", { audios: [VOICE] }).op).toBe("ref2v");
+ });
+});
+
+describe("Nano Banana Pro's shape on Replicate", () => {
+ const routes = getModel("nano-banana-pro")!.routes;
+ const on = (provider: string, op: string) => routes.find((r) => r.provider === provider && r.op === op)!;
+ const payload = (provider: string, op: string, aspectRatio: string, images: string[] = []) =>
+ buildPayload(on(provider, op).map ?? {}, { prompt: "a quiet harbour at dawn", images, aspectRatio, resolution: "1K" } as never);
+
+ it("Auto leaves aspect_ratio out on Replicate (its default follows the input), and stays auto on fal", () => {
+ for (const op of ["t2i", "edit"]) {
+ const sent = payload("replicate", op, "auto", op === "edit" ? [IMG] : []);
+ expect(sent).not.toHaveProperty("aspect_ratio");
+ expect(sent.resolution).toBe("1K");
+ }
+ expect(payload("fal", "t2i", "auto").aspect_ratio).toBe("auto");
+ expect(payload("fal", "edit", "auto", [IMG]).aspect_ratio).toBe("auto");
+ });
+
+ it("every shape the studio offers goes to Replicate as one it takes", () => {
+ for (const ratio of getModel("nano-banana-pro")!.options.aspectRatios ?? []) {
+ for (const op of ["t2i", "edit"]) {
+ const sent = payload("replicate", op, ratio, op === "edit" ? [IMG] : []);
+ if (ratio === "auto") expect(sent).not.toHaveProperty("aspect_ratio");
+ else expect(NANO_REPLICATE_RATIOS).toContain(sent.aspect_ratio);
+ }
+ }
+ });
+});
diff --git a/tests/vidu-kandinsky-spec.test.ts b/tests/vidu-kandinsky-spec.test.ts
new file mode 100644
index 00000000..4cfbebcb
--- /dev/null
+++ b/tests/vidu-kandinsky-spec.test.ts
@@ -0,0 +1,84 @@
+import { describe, expect, it } from "vitest";
+import { getModel, getPreset } from "@/lib/catalog";
+import { hasReferenceVoiceWindow, referenceVoiceProblem } from "@/lib/catalog/clip-windows";
+import { settingsShape, settingsSummary } from "@/lib/composer";
+import { buildPayload, extractOutputs } from "@/lib/catalog/payload";
+import { planGeneration, routesFor } from "@/lib/catalog/plan";
+import type { GenerationRequest, Operation } from "@/lib/catalog/types";
+
+/**
+ * fal's Vidu Q4 and Kandinsky 6.0 routes as fal's own OpenAPI schemas describe them (read 2026-11-06 from
+ * https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=<endpoint>). Kandinsky 6.0 from a first frame takes aspect_ratio
+ * "auto" (its default: the supported ratio closest to the picture's, centre-cropped to it) or one of five; from words, one of
+ * the five. Vidu Q4 answers with a cover_image (a still) next to its video, and takes reference voices of 3 to 12 s each.
+ * The composer shows no shape for a first frame (src/lib/composer.ts settingsShape).
+ */
+const k6 = getModel("kandinsky-6")!;
+const K6_RATIOS = ["16:9", "9:16", "1:1", "4:3", "3:4"];
+
+function sent(op: Operation, req: Partial<GenerationRequest>) {
+ const p = planGeneration({ feature: "video", modelId: k6.id, op, prompt: "she smiles and says “hi”", ...req } as GenerationRequest, getModel, getPreset);
+ const route = routesFor(k6, op, p.params)[0];
+ const images = op === "i2v" ? ["https://v3b.fal.media/files/b/test/start.png"] : [];
+ return { endpoint: route.endpoint, body: buildPayload(route.map!, { ...p.params, prompt: p.prompt, images }) };
+}
+
+describe("Kandinsky 6.0 on fal sends the shapes fal takes", () => {
+ it("keeps a first frame's own shape (aspect_ratio auto) on Pro and Lite, never the model's 16:9 default", () => {
+ for (const quality of ["pro-standard", "lite-fast"]) {
+ for (const params of [{}, { aspectRatio: "9:16" }]) {
+ const { endpoint, body } = sent("i2v", { inputs: { images: ["/api/files/uploads/start.png"] }, params: { ...params, extra: { quality } } });
+ expect(endpoint).toMatch(/^fal-ai\/kandinsky6-(pro|lite)\/image-to-video$/);
+ expect(body.aspect_ratio, `${quality} ${JSON.stringify(params)}`).toBe("auto");
+ }
+ }
+ });
+
+ it("from words, sends the ratio asked for, and one fal doesn't take as the nearest it does", () => {
+ for (const quality of ["pro-standard", "lite-fast"]) {
+ for (const r of K6_RATIOS) expect(sent("t2v", { params: { aspectRatio: r, extra: { quality } } }).body.aspect_ratio).toBe(r);
+ expect(sent("t2v", { params: { aspectRatio: "21:9", extra: { quality } } }).body.aspect_ratio).toBe("16:9");
+ }
+ });
+});
+
+describe("Vidu Q4 on fal", () => {
+ it("its result is its video: the cover still fal sends with it is not a second result", () => {
+ const video = "https://v3b.fal.media/files/b/0a8c9189/n9z3uUDPqmU2msAtqr25-_output.mp4";
+ const body = { video: { url: video }, cover_image: { url: "https://v3b.fal.media/files/b/0a8c9189/cover.png", content_type: "image/png", width: 1280, height: 720 }, seed: 42 };
+ for (const op of ["i2v", "ref2v"] as const) expect(extractOutputs(body, op).map((o) => [o.kind, o.url])).toEqual([["video", video]]);
+ expect(extractOutputs({ video: { url: video }, cover_image: null, seed: 42 }, "i2v")).toHaveLength(1);
+ });
+
+ it("takes reference voices of 3 to 12 s each, and says which one is outside", () => {
+ const vidu = getModel("vidu-q4")!;
+ expect(hasReferenceVoiceWindow(vidu)).toBe(true);
+ expect(referenceVoiceProblem(vidu, 2, 2)).toBe("Vidu Q4 needs voice clips of at least 3 s, and Voice 2 is 2 s: use a longer one");
+ expect(referenceVoiceProblem(vidu, 12.9)).toBe("Vidu Q4 takes voice clips up to 12 s, and Voice 1 is 12.9 s: trim it first");
+ for (const s of [3, 7.5, 12, 12.04]) expect(referenceVoiceProblem(vidu, s), `${s} s`).toBeNull();
+ // Models without a window, and a header that says no length, are left alone.
+ expect(hasReferenceVoiceWindow(getModel("minimax-h3-max-turbo")!)).toBe(false);
+ expect(referenceVoiceProblem(getModel("minimax-h3-max-turbo")!, 1)).toBeNull();
+ expect(referenceVoiceProblem(vidu, 0)).toBeNull();
+ });
+});
+
+describe("Vidu Q4's sound switch", () => {
+ // fal's fal-ai/vidu/q4/image-to-video has no sound field (its clips always have sound); reference-to-video has `audio`.
+ const vidu = getModel("vidu-q4")!;
+
+ it("from a first frame the switch can't change the sound, and the summary never says No audio", () => {
+ const shape = settingsShape(vidu, "i2v", "video", true);
+ expect(shape.audio).toBe(true);
+ expect(shape.audioFixed).toBe(true);
+ expect(settingsSummary(shape, { generateAudio: false }, vidu)).not.toContain("No audio");
+ });
+
+ it("from references it sends the switch, and Off reads No audio", () => {
+ const shape = settingsShape(vidu, "ref2v", "video", true);
+ expect(shape.audioFixed).toBe(false);
+ expect(settingsSummary(shape, { generateAudio: false }, vidu)).toContain("No audio");
+ const route = routesFor(vidu, "ref2v")[0];
+ expect(buildPayload(route.map!, { prompt: "hi", images: ["https://x/a.png"], generateAudio: false }).audio).toBe(false);
+ });
+});