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.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Cloud catalog: plan the new operations, reference clips, API defaults
Claude5e4a5fed674b
diff --git a/scripts/gen-cloud-models.py b/scripts/gen-cloud-models.pyindex d088f2f6..d8f81a87 100644--- a/scripts/gen-cloud-models.py+++ b/scripts/gen-cloud-models.py@@ -48,12 +48,13 @@ 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):+ sliders=None, controls=None, api_defaults=None):"""sliders / controls: [(field, label)] read from each route's research inputs (dotted = nested field):- numeric fields with minimum/maximum become sliders, enums become composer controls; both travel as params.extra."""+ numeric fields with minimum/maximum become sliders, enums become composer controls; both travel as params.extra.+ fixed: fields always sent. api_defaults: fields sent unless the request sets them (FieldMap.defaults)."""M.append(dict(id=id, name=name, vendor=vendor, family=family, kind=kind, tagline=tagline, routes=routes,badges=badges or [], pricing=pricing, defaults=defaults or {}, options=options or {}, fixed=fixed or {}, hidden=hidden,- sliders=sliders or [], controls=controls or []))+ sliders=sliders or [], controls=controls or [], api_defaults=api_defaults or {}))# ----- Image@@ -140,14 +141,16 @@ model("imagen-4", "Imagen 4", "Google", "imagen", "image", "Google's photoreal tmodel("recraft-4-1-pro", "Recraft V4.1 Pro", "Recraft", "recraft", "image","Recraft's top tier — 2K design-grade images in your exact palette",[("t2i", "fal-ai/recraft/v4.1/pro/text-to-image")], badges=["pro"], defaults={"aspectRatio": "1:1"})+# The style comes from 1-10 reference images (or a saved style_id): with neither the call fails, so these run as+# edits only. A text-to-image route can come back once something in Fuobe saves style ids (a moodboard element).model("recraft-4-style", "Recraft V4 Styles", "Recraft", "recraft", "image",- "Generate in a saved Recraft style, or one made on the fly from up to 10 reference images",- [("t2i", "recraft/v4/style/text-to-image"), ("edit", "recraft/v4/style/text-to-image")],+ "A new picture in the style of 1–10 reference images",+ [("edit", "recraft/v4/style/text-to-image")],pricing=("image", 0.035, "+$0.005 when a new style is made from references"), defaults={"aspectRatio": "1:1"},controls=[("style_match", "Style match")])model("recraft-4-style-pro", "Recraft V4 Styles Pro", "Recraft", "recraft", "image",- "Recraft styles at Pro quality",- [("t2i", "recraft/v4/style/pro/text-to-image"), ("edit", "recraft/v4/style/pro/text-to-image")],+ "Recraft styles from your references, at Pro quality",+ [("edit", "recraft/v4/style/pro/text-to-image")],badges=["pro"], pricing=("image", 0.1, "+$0.005 when a new style is made from references"), defaults={"aspectRatio": "1:1"},controls=[("style_match", "Style match")])model("ideogram-3", "Ideogram 3.0", "Ideogram", "ideogram", "image",@@ -185,9 +188,10 @@ model("fashn-tryon", "FASHN Try-On 1.6", "FASHN", "fashn", "image",model("google-try-on", "Google Virtual Try-On", "Google", "imagen", "image","Google's try-on: a person photo and a product photo",[("edit", "google/virtual-try-on")], pricing=("image", 0.075))+# garment_type is required and has no API default: tops unless the Garment control says otherwise.model("leffa-tryon", "Leffa Virtual Try-On", "Leffa", "leffa", "image","Open-weights try-on for tops, bottoms and dresses",- [("edit", "fal-ai/leffa/virtual-tryon")], fixed={"garment_type": "upper_body"}, controls=[("garment_type", "Garment")])+ [("edit", "fal-ai/leffa/virtual-tryon")], api_defaults={"garment_type": "upper_body"}, controls=[("garment_type", "Garment")])model("bria-product-shot", "Bria Product Shot", "Bria", "bria", "image","Your product photo in a new scene — describe it or add a reference scene",[("edit", "fal-ai/bria/product-shot")], controls=[("placement_type", "Placement")])@@ -209,7 +213,8 @@ model("seedance-2-5", "Seedance 2.5", "ByteDance", "seedance", "video",("extend", "bytedance/seedance-2.5/reference-to-video", "fal", {"fixed": {"task": "extension"}, "videoArray": True}),("finalize", "bytedance/seedance-2.5/draft/complete")],badges=["top", "audio", "new"], pricing=("second", 0.473, "720p"), defaults={"aspectRatio": "16:9", "duration": 5, "resolution": "720p"},- options={"multiShot": {"mode": "prompt", "maxShots": 6}})+ # fal's schema gives no count for 2.5's reference clips; Higgsfield's and Replicate's 2.5 schemas say up to 10 (30 s in all).+ options={"multiShot": {"mode": "prompt", "maxShots": 6}, "maxVideos": 10, "maxAudios": 10})model("seedance-2-0", "Seedance 2.0", "ByteDance", "seedance", "video","Smooth multi-shot motion with audio",[("t2v", "bytedance/seedance-2.0/text-to-video"), ("i2v", "bytedance/seedance-2.0/image-to-video", "fal", "+flf2v"),@@ -244,9 +249,11 @@ model("kling-o1", "Kling O1 Omni", "Kuaishou", "kling", "video","Reference-driven video and natural-language video editing",[("i2v", "fal-ai/kling-video/o1/image-to-video", "fal", "+flf2v"), ("ref2v", "fal-ai/kling-video/o1/reference-to-video"),("v2v", "fal-ai/kling-video/o1/video-to-video/edit")], defaults={"aspectRatio": "16:9", "duration": 5})+# character_orientation is required with no default: follow the driving video (the API's advice for complex motion).model("kling-motion-control", "Kling 3.0 Motion Control", "Kuaishou", "kling", "video","Copy the motion of a reference video onto your character",- [("motion-transfer", "fal-ai/kling-video/v3/pro/motion-control")], defaults={})+ [("motion-transfer", "fal-ai/kling-video/v3/pro/motion-control")], defaults={},+ api_defaults={"character_orientation": "video"}, controls=[("character_orientation", "Facing")])model("kling-2-6-pro", "Kling 2.6 Pro", "Kuaishou", "kling", "video","Cinematic motion with native audio and dialogue",[("t2v", "fal-ai/kling-video/v2.6/pro/text-to-video"), ("i2v", "fal-ai/kling-video/v2.6/pro/image-to-video", "fal", "+flf2v")],@@ -418,8 +425,10 @@ model("elevenlabs-dubbing", "ElevenLabs Dubbing", "ElevenLabs", "elevenlabs", "vmodel("mirelo-sfx-2", "Mirelo SFX 2.0", "Mirelo", "mirelo", "audio", "Higgsfield's sound-effects model — layered, cinematic SFX up to 10 minutes",[("sfx", "mirelo-ai/sfx2.0/text-to-audio")], badges=["top", "new"], defaults={"duration": 5}, options={"durations": [2, 5, 10, 30, 60]},pricing=("second", 0.01, "intro price until 2026-12-13, then $0.015"))+# Sonilo answers in AAC unless asked: MP3 plays and downloads everywhere.model("sonilo-sfx", "Sonilo SFX 1.1", "Sonilo", "sonilo", "audio", "Fast, cheap sound effects up to 3 minutes",- [("sfx", "sonilo/v1.1/text-to-sound-effects")], badges=["fast"], defaults={"duration": 5}, options={"durations": [2, 5, 8, 15, 30]})+ [("sfx", "sonilo/v1.1/text-to-sound-effects")], badges=["fast"], defaults={"duration": 5}, options={"durations": [2, 5, 8, 15, 30]},+ fixed={"audio_format": "mp3"})model("stable-audio-3-sfx", "Stable Audio 3 SFX", "Stability AI", "stable-audio", "audio", "Stability's small SFX model — crisp one-shots and ambiences",[("sfx", "fal-ai/stable-audio-3/small/sfx/text-to-audio")], defaults={"duration": 10}, options={"durations": [5, 10, 30, 60]})model("cassette-sfx", "CassetteAI Sound Effects", "CassetteAI", "cassette", "audio", "One-cent sound effects up to 30 s",@@ -432,13 +441,15 @@ model("lyria-3", "Lyria 3", "Google", "lyria", "audio", "Google DeepMind's music[("music", "fal-ai/lyria3"), ("music", "google/lyria-3", "replicate")])model("lyria-3-pro", "Lyria 3 Pro", "Google", "lyria", "audio", "Longer, richer Lyria 3 tracks",[("music", "fal-ai/lyria3/pro"), ("music", "google/lyria-3-pro", "replicate")], badges=["pro"])-model("minimax-music-2-5", "MiniMax Music 2.5", "MiniMax", "minimax-music", "audio", "Songs with vocals, or instrumentals",- [("music", "fal-ai/minimax-music/v2.5")])+# A prompt alone has no lyrics to sing: lyrics_optimizer writes them from the prompt.+model("minimax-music-2-5", "MiniMax Music 2.5", "MiniMax", "minimax-music", "audio", "Songs with vocals, lyrics written from your prompt",+ [("music", "fal-ai/minimax-music/v2.5")], fixed={"lyrics_optimizer": True})model("stable-audio-3-music", "Stable Audio 3 Music", "Stability AI", "stable-audio", "audio", "Quick, cheap loops and beds up to 2 minutes",[("music", "fal-ai/stable-audio-3/small/music/text-to-audio")], badges=["fast"], defaults={"duration": 30}, options={"durations": [10, 30, 60, 120]})model("mureka-song", "Mureka 9.5", "Mureka", "mureka", "audio", "Full songs with vocals in many genres",[("music", "mureka/api/generate/song")], pricing=("request", 0.75, "prompt-to-song on mureka-9.5; with lyrics $0.225"),- controls=[("model", "Version"), ("gender", "Voice")])+ # Its vocal gender only applies to lyrics-to-song, which Fuobe doesn't send yet.+ controls=[("model", "Version")])model("stable-audio-2-5", "Stable Audio 2.5", "Stability AI", "stable-audio", "audio", "Sound design and music beds up to 3 minutes",[("sfx", "fal-ai/stable-audio-25/text-to-audio"), ("music", "fal-ai/stable-audio-25/text-to-audio"),("sfx", "stability-ai/stable-audio-2.5", "replicate"), ("music", "stability-ai/stable-audio-2.5", "replicate")],@@ -460,8 +471,10 @@ model("lightx-relight", "LightX Relight", "LightX", "lightx", "video", "Relightoptions={"controls": [{"param": "relight_parameters.bg_source", "label": "Light from", "values": ["Left", "Right", "Top", "Bottom"], "default": "Left"}]})model("mmaudio-cloud", "MMAudio", "hkchengrex", "mmaudio", "video", "Add matching sound to a silent video",[("v2a", "fal-ai/mmaudio-v2")], pricing=("second", 0.001))+# Its duration defaults to 10 s and is clamped to the video: ask for the maximum so the whole clip gets sound.model("mirelo-sfx-2-video", "Mirelo SFX 2.0 for video", "Mirelo", "mirelo", "video", "Sound effects in sync with your video, speech kept",- [("v2a", "mirelo-ai/sfx2.0/video-to-video")], badges=["top", "new"], pricing=("second", 0.01, "intro price until 2026-12-13, then $0.015"))+ [("v2a", "mirelo-ai/sfx2.0/video-to-video")], badges=["top", "new"], pricing=("second", 0.01, "intro price until 2026-12-13, then $0.015"),+ api_defaults={"duration": 600})# ----- Image tools: layers, text layers, cut-outs, vectors (research part 3; Higgsfield Layers)model("seedream-5-layers", "Seedream 5.0 Layers", "ByteDance", "seedream", "image",@@ -469,7 +482,8 @@ model("seedream-5-layers", "Seedream 5.0 Layers", "ByteDance", "seedream", "imag[("layers", "bytedance/seedream/v5/pro/layerize")], badges=["top", "new"], defaults={"resolution": "auto"},pricing=("request", 0.17, "$0.034 per layer, ≈5 layers; double above 1536²"))model("seedream-5-flash-layers", "Seedream 5.0 Flash Layers", "ByteDance", "seedream", "image", "Faster, cheaper Seedream layer split",- [("layers", "bytedance/seedream/v5/flash/layerize")], badges=["fast"], defaults={"resolution": "auto"})+ [("layers", "bytedance/seedream/v5/flash/layerize")], badges=["fast"], defaults={"resolution": "auto"},+ pricing=("request", 0.135, "$0.027 per layer, ≈5 layers"))model("qwen-image-layered-cloud", "Qwen-Image Layered (hosted)", "Alibaba Qwen", "qwen-image", "image","Open-weights layer split: 1–10 full-canvas RGBA layers",[("layers", "fal-ai/qwen-image-layered"), ("layers", "qwen/qwen-image-layered", "replicate")])@@ -489,19 +503,23 @@ model("trim-video", "Trim video", "fal", "utility", "video", "Keep the part betwpricing=("request", 0.001, "billed per compute second"), hidden=True)model("merge-audio-video", "Add soundtrack", "fal", "utility", "video", "Replace a video's sound with an audio track",[("mux", "fal-ai/ffmpeg-api/merge-audio-video")], pricing=("second", 0.0002), hidden=True)-model("auto-subtitle", "Auto Subtitle", "fal", "captions", "video", "Transcribes and burns in TikTok-style karaoke captions",+# Auto Subtitle has no language detection (its language defaults to English): the spoken language is a picker.+model("auto-subtitle", "Auto Subtitle", "fal", "captions", "video", "TikTok-style karaoke captions; English unless you pick the spoken language",[("captions", "fal-ai/workflow-utilities/auto-subtitle")], badges=["top"],sliders=[("words_per_subtitle", "Words per caption"), ("font_size", "Size")],controls=[("font_weight", "Weight"), ("font_color", "Colour"), ("highlight_color", "Highlight"), ("position", "Position")])model("veed-subtitles", "VEED Subtitles", "VEED", "veed", "video", "30 designed caption styles, with optional translation",- [("captions", "veed/subtitles", "fal", {"drop": ["language"]})], fixed={"preset": "simple"}, controls=[("preset", "Style")])+ [("captions", "veed/subtitles")], fixed={"preset": "simple"}, controls=[("preset", "Style")],+ pricing=("minute", 0.1, "basic styles; dynamic styles (glass, whisper, glide, fusion, terminal, handwritten, backdrop) and >1080p 2x; translation +$0.20/min"))model("scribe-v2", "ElevenLabs Scribe v2", "ElevenLabs", "elevenlabs", "text", "Word-timed transcripts with speakers and sound events",[("transcribe", "fal-ai/elevenlabs/speech-to-text/scribe-v2"), ("transcribe", "elevenlabs/scribe-v2", "replicate")], badges=["top"],pricing=("minute", 0.008, "+30% with key terms"))-model("wizper", "Wizper (Whisper v3)", "fal", "whisper", "text", "Fast Whisper large-v3 transcripts in segments",- [("transcribe", "fal-ai/wizper")], badges=["fast"])-model("whisper", "Whisper large-v3", "OpenAI", "whisper", "text", "Whisper with word timings and speaker labels",- [("transcribe", "fal-ai/whisper")])+# Wizper's language defaults to English; null makes it detect the language (unless one is picked).+model("wizper", "Wizper (Whisper v3)", "fal", "whisper", "text", "Fast Whisper large-v3 transcripts in segments, any language",+ [("transcribe", "fal-ai/wizper")], badges=["fast"], api_defaults={"language": None})+# Word-level chunks: the transcript's cues are built from word timings (segment chunks are the API default).+model("whisper", "Whisper large-v3", "OpenAI", "whisper", "text", "Whisper large-v3 with word timings, any language",+ [("transcribe", "fal-ai/whisper")], fixed={"chunk_level": "word"})model("demucs", "Demucs stem split", "Meta", "demucs", "audio", "Split a track into vocals, drums, bass and the rest",[("separate-audio", "fal-ai/demucs")], fixed={"model": "htdemucs"})@@ -619,11 +637,35 @@ def add_slider(opts, param, label, spec):"default": spec.get("default", lo)})-def add_control(opts, param, label, spec):- vals = [v for v in ((spec or {}).get("values") or []) if v != ""]+def is_sentinel(v, default):+ """An enum value that means "let the API decide": the composer's own Auto option already sends nothing."""+ s = str(v).strip().lower()+ return s == "auto" or (s == "none" and str(default).strip().lower() == "none")+++def add_control(opts, param, label, spec, fallback=None):+ """fallback: what Fuobe sends when the control is left on Auto (a FieldMap default), shown as the control's default."""+ default = fallback if fallback is not None else (spec or {}).get("default")+ vals = [v for v in ((spec or {}).get("values") or []) if v != "" and not is_sentinel(v, default)]if not vals or any(c["param"] == param for c in opts.get("controls", [])):return- opts.setdefault("controls", []).append({"param": param, "label": label, "values": vals, **({"default": spec["default"]} if "default" in spec else {})})+ keep = default is not None and not is_sentinel(default, default)+ opts.setdefault("controls", []).append({"param": param, "label": label, "values": vals, **({"default": default} if keep else {})})+++def map_fields(fmap):+ """Every top-level provider field a FieldMap can write (canonical keys, fixed and default fields)."""+ out = []+ for k, v in fmap.items():+ if k in ("fixed", "defaults"):+ out += list(v)+ elif k in ("seedRange", "maskFormat"):+ continue+ elif isinstance(v, str):+ out.append(v)+ elif isinstance(v, dict):+ out += [v[f] for f in ("key", "background", "shotType", "flag") if isinstance(v.get(f), str)]+ return [f.split(".")[0] for f in out]def mask_format(ep):@@ -646,13 +688,20 @@ def build_route(op, ep, provider, m, opts, ropts=None):kf.pop(k, None)# Part 3 slot names that are the same canonical input: the person in a try-on is the main image,# style references are the reference images, a garment / scene / style image is the second image.+ labels = [None, None]if "person" in kf and "image" not in kf:kf["image"] = kf.pop("person")+ labels[0] = "person photo"if "styleImages" in kf and "images" not in kf and (inputs.get(kf["styleImages"]) or {}).get("type") == "array":kf["images"] = kf["styleImages"]- for k in ("garment", "sceneImage", "styleImage"):+ for k, label in (("garment", "garment"), ("sceneImage", "scene reference"), ("styleImage", "style image")):if k in kf and "image2" not in kf and (inputs.get(kf[k]) or {}).get("type") != "array":kf["image2"] = kf[k]+ labels[1] = label+ # Two-image APIs whose second image is required (try-on garments) can't run on one picture.+ if "image2" in kf and (inputs.get(kf["image2"]) or {}).get("required") and (inputs.get(kf.get("image", "")) or {}).get("required"):+ opts["minImages"] = 2+ opts["imageLabels"] = [labels[0] or "image", labels[1] or "second image"]# Transcription and stem splitting work from the audio; ignore any prompt-like hint field.if op in ("transcribe", "separate-audio"):kf.pop("prompt", None)@@ -688,7 +737,7 @@ def build_route(op, ep, provider, m, opts, ropts=None):for path, label in m.get("sliders") or []:add_slider(opts, path, label, spec_at(inputs, path))for path, label in m.get("controls") or []:- add_control(opts, path, label, spec_at(inputs, path))+ add_control(opts, path, label, spec_at(inputs, path), (m.get("api_defaults") or {}).get(path))for k, v in inputs.items():# Voice settings belong to speech models; a transcriber's "temperature" is not a voice's variety.if k in SLIDER_LABELS and isinstance(v, dict) and (op in ("tts", "voice-change", "dialogue") or k == "strength"):@@ -697,12 +746,24 @@ def build_route(op, ep, provider, m, opts, ropts=None):# Some APIs call their boolean sound switch "audio" (Wan 3.0); that's generateAudio, not an audio file.if "audio" in kf and (inputs.get(kf["audio"]) or {}).get("type") == "boolean":kf.setdefault("generateAudio", kf.pop("audio"))+ # Part 3 names for clip lists (merge-videos' video_urls, Seed Audio's reference audio_urls).+ for k in ("videos", "audios"):+ if k in kf and (inputs.get(kf[k]) or {}).get("type") == "array":+ kf.setdefault(k[:-1], kf.pop(k))for k in ["negativePrompt", "image", "images", "endImage", "mask", "video", "audio", "numOutputs", "seed", "generateAudio"]:if k in kf:if k in ("video", "audio", "image", "endImage", "mask") and (inputs.get(kf[k]) or {}).get("type") == "array":if k == "video" and ropts.get("videoArray"):fmap["videoArray"] = kf[k]- continue # other array-of-media inputs (reference videos/audios) aren't wired yet+ elif k in ("video", "audio"):+ # Lists of clips: reference videos / audio for reference-to-video (Seedance @Video1, @Audio1),+ # fed from inputs.videos / inputs.audios.+ fmap[k + "s"] = kf[k]+ spec = inputs.get(kf[k]) or {}+ cap = num(spec.get("maxItems")) or num((re.search(r"\bup to (\d+)", spec.get("desc") or "", re.I) or [None, None])[1]) or 3+ key = "maxVideos" if k == "video" else "maxAudios"+ opts[key] = max(opts.get(key, 0), cap)+ continuefmap[k] = kf[k]# Multi-shot, draft mode and draft completion (research part 2 key fields).if "multiShot" in kf and op in ("t2v", "i2v", "ref2v") and (inputs.get(kf["multiShot"]) or {}).get("type") in ("array", "string"):@@ -744,7 +805,11 @@ def build_route(op, ep, provider, m, opts, ropts=None):# The language of the speech: transcription, captions and dubbing take it as their "language".src_lang = kf.get("sourceLanguage") or (kf.get("language") if op in ("transcribe", "captions", "dub") else None)if src_lang:- fmap["sourceLanguage"] = src_lang+ enum = [v for v in ((inputs.get(src_lang) or {}).get("values") or []) if isinstance(v, str) and v]+ # An API with its own list (VEED's "es-ES", Wizper's "es") gets the matching entry; the picker offers ISO codes.+ fmap["sourceLanguage"] = {"key": src_lang, "values": enum} if enum else src_lang+ codes = union([], [v.split("-")[0].lower() for v in enum if re.fullmatch(r"[a-z]{2,3}", v.split("-")[0].lower())]) if enum else ISO_LANGUAGES+ opts["sourceLanguages"] = union(opts.get("sourceLanguages", []), codes)# Transcribers take a video file in their audio field too.if op == "transcribe" and "audio" in kf and "video" not in kf:fmap["video"] = kf["audio"]@@ -817,6 +882,23 @@ def build_route(op, ep, provider, m, opts, ropts=None):warn(f"{m['id']}: fixed fields {missing} not in {ep} inputs")if not fmap["fixed"]:del fmap["fixed"]+ if m.get("api_defaults"):+ fmap["defaults"] = {k: v for k, v in m["api_defaults"].items() if k.split(".")[0] in inputs}+ missing = [k for k in m["api_defaults"] if k.split(".")[0] not in inputs]+ if missing:+ warn(f"{m['id']}: default fields {missing} not in {ep} inputs")+ if not fmap["defaults"]:+ del fmap["defaults"]+ # Inputs the API requires that no canonical field fills: send the API's own documented default+ # (MiniMax H3 Max's prompt_expansion_mode), or warn when there is none to send.+ sent = set(map_fields(fmap)) | ({"prompt"} if "prompt" not in fmap else set())+ for k, spec in inputs.items():+ if not isinstance(spec, dict) or not spec.get("required") or k in sent:+ continue+ if spec.get("default") is not None:+ fmap.setdefault("defaults", {})[k] = spec["default"]+ else:+ warn(f"{m['id']}: {ep} requires {k}, which no field of this route fills")if "numOutputs" in fmap:mx = num((inputs.get(fmap["numOutputs"]) or {}).get("maximum")) or 4opts["maxOutputs"] = max(opts.get("maxOutputs", 1), min(4, mx))@@ -880,6 +962,9 @@ for m in M:if not routes:warn(f"{m['id']}: no routes, skipping model")continue+ # No route sends a prompt (try-on, 3D, transcription): planning and the composer don't ask for one.+ if all(r["map"].get("prompt") is False for r in routes):+ opts["promptless"] = Trueopts.update(m["options"])pricing = Noneif m["pricing"]:diff --git a/scripts/gen-higgsfield-models.py b/scripts/gen-higgsfield-models.pyindex 92baf7ff..7e82be86 100644--- a/scripts/gen-higgsfield-models.py+++ b/scripts/gen-higgsfield-models.py@@ -55,10 +55,22 @@ def field_map(op, ep, inputs, opts):if end and op in ("i2v", "flf2v"):fm["endImage"] = endopts["endFrame"] = True+ clips = op not in ("t2i", "t2v", "i2v", "flf2v") # text/frame routes stay clean, as with image_urlsif "video_url" in inputs:fm["video"] = "video_url"+ # Seedance 2.5 edit / extend take reference clips beside the video they work on.+ if "video_urls" in inputs and clips:+ fm["videos"] = "video_urls"elif "video_urls" in inputs and op in ("v2v", "extend"):fm["videoArray"] = "video_urls"+ elif "video_urls" in inputs and clips:+ # Reference videos (Cinema Studio 4.0, Seedance, Wan, MiniMax reference-to-video): inputs.videos.+ fm["videos"] = "video_urls"+ if "audio_urls" in inputs and clips:+ fm["audios"] = "audio_urls"+ for field, key, canon in (("video_urls", "maxVideos", "videos"), ("audio_urls", "maxAudios", "audios")):+ if fm.get(canon) == field:+ opts[key] = max(opts.get(key, 0), int(inputs[field].get("maxItems") or 3))if "audio_url" in inputs and inputs["audio_url"].get("required"):fm["audio"] = "audio_url"if "negative_prompt" in inputs:diff --git a/src/app/api/generations/route.ts b/src/app/api/generations/route.tsindex 855a61ac..79506fe1 100644--- a/src/app/api/generations/route.ts+++ b/src/app/api/generations/route.ts@@ -21,6 +21,8 @@ const RequestSchema = z.object({voiceAudio: z.string().optional(),voiceAudio2: z.string().optional(),videos: z.array(z.string()).max(24).optional(),+ // Reference audio clips for reference-to-video (Seedance 2.5 / Cinema Studio take up to 10).+ audios: z.array(z.string()).max(10).optional(),}).optional(),params: zdiff --git a/src/lib/catalog/cloud-models.generated.ts b/src/lib/catalog/cloud-models.generated.tsindex d2d5458b..547e1516 100644--- a/src/lib/catalog/cloud-models.generated.ts+++ b/src/lib/catalog/cloud-models.generated.ts@@ -1823,37 +1823,8 @@ export const CLOUD_MODELS: ModelDef[] = ["family": "recraft","engine": "cloud","kind": "image",- "tagline": "Generate in a saved Recraft style, or one made on the fly from up to 10 reference images",+ "tagline": "A new picture in the style of 1\u201310 reference images","routes": [- {- "op": "t2i",- "provider": "fal",- "endpoint": "recraft/v4/style/text-to-image",- "map": {- "images": "image_urls",- "styleId": "style_id",- "palette": {- "key": "colors",- "format": "rgb-object",- "background": "background_color"- },- "aspectRatio": {- "key": "image_size",- "values": {- "1:1": "square_hd",- "4:3": "landscape_4_3",- "3:4": "portrait_4_3",- "16:9": "landscape_16_9",- "9:16": "portrait_16_9",- "3:2": "landscape_4_3",- "2:3": "portrait_4_3",- "21:9": "landscape_16_9",- "5:4": "landscape_4_3",- "4:5": "portrait_4_3"- }- }- }- },{"op": "edit","provider": "fal",@@ -1925,37 +1896,8 @@ export const CLOUD_MODELS: ModelDef[] = ["family": "recraft","engine": "cloud","kind": "image",- "tagline": "Recraft styles at Pro quality",+ "tagline": "Recraft styles from your references, at Pro quality","routes": [- {- "op": "t2i",- "provider": "fal",- "endpoint": "recraft/v4/style/pro/text-to-image",- "map": {- "images": "image_urls",- "styleId": "style_id",- "palette": {- "key": "colors",- "format": "rgb-object",- "background": "background_color"- },- "aspectRatio": {- "key": "image_size",- "values": {- "1:1": "square_hd",- "4:3": "landscape_4_3",- "3:4": "portrait_4_3",- "16:9": "landscape_16_9",- "9:16": "portrait_16_9",- "3:2": "landscape_4_3",- "2:3": "portrait_4_3",- "21:9": "landscape_16_9",- "5:4": "landscape_4_3",- "4:5": "portrait_4_3"- }- }- }- },{"op": "edit","provider": "fal",@@ -2121,7 +2063,6 @@ export const CLOUD_MODELS: ModelDef[] = ["param": "style","label": "Style","values": [- "AUTO","GENERAL","REALISTIC","DESIGN"@@ -2605,6 +2546,11 @@ export const CLOUD_MODELS: ModelDef[] = [}],"options": {+ "minImages": 2,+ "imageLabels": [+ "person photo",+ "garment"+ ],"controls": [{"param": "category",@@ -2612,10 +2558,8 @@ export const CLOUD_MODELS: ModelDef[] = ["values": ["tops","bottoms",- "one-pieces",- "auto"- ],- "default": "auto"+ "one-pieces"+ ]},{"param": "mode",@@ -2631,16 +2575,15 @@ export const CLOUD_MODELS: ModelDef[] = ["param": "garment_photo_type","label": "Garment photo","values": [- "auto","model","flat-lay"- ],- "default": "auto"+ ]}],"seed": true,"maxOutputs": 4,- "maxImages": 2+ "maxImages": 2,+ "promptless": true},"badges": ["top"@@ -2672,8 +2615,14 @@ export const CLOUD_MODELS: ModelDef[] = [}],"options": {+ "minImages": 2,+ "imageLabels": [+ "person photo",+ "garment"+ ],"maxOutputs": 4,- "maxImages": 2+ "maxImages": 2,+ "promptless": true},"pricing": {"unit": "image",@@ -2697,13 +2646,18 @@ export const CLOUD_MODELS: ModelDef[] = ["prompt": false,"image": "human_image_url","image2": "garment_image_url",- "fixed": {+ "defaults": {"garment_type": "upper_body"}}}],"options": {+ "minImages": 2,+ "imageLabels": [+ "person photo",+ "garment"+ ],"controls": [{"param": "garment_type",@@ -2712,10 +2666,12 @@ export const CLOUD_MODELS: ModelDef[] = ["upper_body","lower_body","dresses"- ]+ ],+ "default": "upper_body"}],- "maxImages": 2+ "maxImages": 2,+ "promptless": true},"pricing": {"unit": "request",@@ -2785,7 +2741,8 @@ export const CLOUD_MODELS: ModelDef[] = [}],"options": {- "maxImages": 1+ "maxImages": 1,+ "promptless": true},"pricing": {"unit": "image",@@ -2915,6 +2872,8 @@ export const CLOUD_MODELS: ModelDef[] = ["endpoint": "bytedance/seedance-2.5/reference-to-video","map": {"images": "image_urls",+ "videos": "video_urls",+ "audios": "audio_urls","seed": "seed","generateAudio": "generate_audio","draft": "draft",@@ -2933,6 +2892,7 @@ export const CLOUD_MODELS: ModelDef[] = ["map": {"images": "image_urls","videoArray": "video_urls",+ "audios": "audio_urls","seed": "seed","generateAudio": "generate_audio","aspectRatio": "aspect_ratio",@@ -2985,6 +2945,8 @@ export const CLOUD_MODELS: ModelDef[] = [],"endFrame": true,"maxImages": 4,+ "maxVideos": 10,+ "maxAudios": 10,"seed": true,"multiShot": {"mode": "prompt",@@ -3069,6 +3031,8 @@ export const CLOUD_MODELS: ModelDef[] = ["endpoint": "bytedance/seedance-2.0/reference-to-video","map": {"images": "image_urls",+ "videos": "video_urls",+ "audios": "audio_urls","generateAudio": "generate_audio","aspectRatio": "aspect_ratio","resolution": "resolution",@@ -3107,6 +3071,8 @@ export const CLOUD_MODELS: ModelDef[] = [],"endFrame": true,"maxImages": 9,+ "maxVideos": 3,+ "maxAudios": 3,"multiShot": {"mode": "prompt","maxShots": 6@@ -3187,6 +3153,8 @@ export const CLOUD_MODELS: ModelDef[] = ["endpoint": "bytedance/seedance-2.0/fast/reference-to-video","map": {"images": "image_urls",+ "videos": "video_urls",+ "audios": "audio_urls","generateAudio": "generate_audio","aspectRatio": "aspect_ratio","resolution": "resolution",@@ -3222,7 +3190,9 @@ export const CLOUD_MODELS: ModelDef[] = [15],"endFrame": true,- "maxImages": 9+ "maxImages": 9,+ "maxVideos": 3,+ "maxAudios": 3},"badges": ["fast",@@ -3822,11 +3792,25 @@ export const CLOUD_MODELS: ModelDef[] = ["endpoint": "fal-ai/kling-video/v3/pro/motion-control","map": {"image": "image_url",- "video": "video_url"+ "video": "video_url",+ "defaults": {+ "character_orientation": "video"+ }}}],"options": {+ "controls": [+ {+ "param": "character_orientation",+ "label": "Facing",+ "values": [+ "image",+ "video"+ ],+ "default": "video"+ }+ ],"maxImages": 1},"pricing": {@@ -4443,6 +4427,7 @@ export const CLOUD_MODELS: ModelDef[] = ["endpoint": "google/gemini-omni-flash/v1.1/reference-to-video","map": {"images": "image_urls",+ "videos": "reference_video_urls","aspectRatio": "aspect_ratio","resolution": "resolution","duration": {@@ -4473,7 +4458,8 @@ export const CLOUD_MODELS: ModelDef[] = ["4k"],"endFrame": true,- "maxImages": 10+ "maxImages": 10,+ "maxVideos": 3},"badges": ["new",@@ -4551,6 +4537,8 @@ export const CLOUD_MODELS: ModelDef[] = ["endpoint": "alibaba/wan-3.0/reference-to-video","map": {"images": "reference_image_urls",+ "videos": "reference_video_urls",+ "audios": "reference_audio_urls","seed": "seed","generateAudio": "audio","aspectRatio": "aspect_ratio",@@ -4578,7 +4566,9 @@ export const CLOUD_MODELS: ModelDef[] = ["1080p"],"endFrame": true,- "maxImages": 10+ "maxImages": 10,+ "maxVideos": 5,+ "maxAudios": 5},"badges": ["new",@@ -4655,6 +4645,8 @@ export const CLOUD_MODELS: ModelDef[] = ["endpoint": "alibaba/wan-3.0-prime/reference-to-video","map": {"images": "reference_image_urls",+ "videos": "reference_video_urls",+ "audios": "reference_audio_urls","seed": "seed","generateAudio": "audio","aspectRatio": "aspect_ratio",@@ -4682,7 +4674,9 @@ export const CLOUD_MODELS: ModelDef[] = ["1080p"],"endFrame": true,- "maxImages": 10+ "maxImages": 10,+ "maxVideos": 5,+ "maxAudios": 5},"badges": ["pro",@@ -4763,6 +4757,7 @@ export const CLOUD_MODELS: ModelDef[] = ["map": {"negativePrompt": "negative_prompt","images": "reference_image_urls",+ "videos": "reference_video_urls","seed": "seed","aspectRatio": "aspect_ratio","resolution": "resolution",@@ -4822,7 +4817,8 @@ export const CLOUD_MODELS: ModelDef[] = [15],"endFrame": true,- "maxImages": 4+ "maxImages": 4,+ "maxVideos": 3},"badges": ["audio"@@ -4884,6 +4880,7 @@ export const CLOUD_MODELS: ModelDef[] = ["endpoint": "wan/v2.6/reference-to-video","map": {"negativePrompt": "negative_prompt",+ "videos": "video_urls","seed": "seed","aspectRatio": "aspect_ratio","resolution": "resolution",@@ -4914,6 +4911,7 @@ export const CLOUD_MODELS: ModelDef[] = [15],"maxImages": 1,+ "maxVideos": 3,"multiShot": {"mode": "prompt","maxShots": 6@@ -5066,6 +5064,8 @@ export const CLOUD_MODELS: ModelDef[] = ["endpoint": "minimax/h3/reference-to-video","map": {"images": "reference_image_urls",+ "videos": "reference_video_urls",+ "audios": "reference_audio_urls","seed": "seed","aspectRatio": "aspect_ratio","resolution": "resolution",@@ -5093,7 +5093,9 @@ export const CLOUD_MODELS: ModelDef[] = ["4K"],"endFrame": true,- "maxImages": 9+ "maxImages": 9,+ "maxVideos": 3,+ "maxAudios": 3},"badges": ["new"@@ -5126,6 +5128,9 @@ export const CLOUD_MODELS: ModelDef[] = ["duration": {"key": "duration","type": "number"+ },+ "defaults": {+ "prompt_expansion_mode": "balanced"}}},@@ -5141,6 +5146,9 @@ export const CLOUD_MODELS: ModelDef[] = ["duration": {"key": "duration","type": "number"+ },+ "defaults": {+ "prompt_expansion_mode": "balanced"}}},@@ -5156,6 +5164,9 @@ export const CLOUD_MODELS: ModelDef[] = ["duration": {"key": "duration","type": "number"+ },+ "defaults": {+ "prompt_expansion_mode": "balanced"}}},@@ -5167,12 +5178,17 @@ export const CLOUD_MODELS: ModelDef[] = ["image": "image_url","images": "reference_image_urls","endImage": "end_image_url",+ "videos": "reference_video_urls",+ "audios": "reference_audio_urls","seed": "seed","aspectRatio": "aspect_ratio","resolution": "resolution","duration": {"key": "duration","type": "number"+ },+ "defaults": {+ "prompt_expansion_mode": "balanced"}}},@@ -5182,6 +5198,7 @@ export const CLOUD_MODELS: ModelDef[] = ["endpoint": "minimax/h3-max/extend-video","map": {"video": "video_url",+ "audios": "reference_audio_urls","seed": "seed","aspectRatio": "aspect_ratio","resolution": "resolution",@@ -5210,7 +5227,9 @@ export const CLOUD_MODELS: ModelDef[] = ["2K"],"endFrame": true,- "maxImages": 9+ "maxImages": 9,+ "maxVideos": 3,+ "maxAudios": 3},"badges": ["pro"@@ -5847,7 +5866,8 @@ export const CLOUD_MODELS: ModelDef[] = ["resolutions": ["720p","1080p"- ]+ ],+ "promptless": true},"defaults": {"aspectRatio": "9:16"@@ -5936,10 +5956,8 @@ export const CLOUD_MODELS: ModelDef[] = ["param": "audio_setting","label": "Audio","values": [- "auto","origin"- ],- "default": "auto"+ ]}],"seed": true,@@ -6134,10 +6152,8 @@ export const CLOUD_MODELS: ModelDef[] = ["values": ["depth","canny",- "pose",- "none"- ],- "default": "none"+ "pose"+ ]},{"param": "camera_lora",@@ -6149,10 +6165,8 @@ export const CLOUD_MODELS: ModelDef[] = ["dolly_right","jib_up","jib_down",- "static",- "none"- ],- "default": "none"+ "static"+ ]}],"negativePrompt": true,@@ -6364,7 +6378,8 @@ export const CLOUD_MODELS: ModelDef[] = [}],"options": {- "maxImages": 1+ "maxImages": 1,+ "promptless": true},"badges": ["new"@@ -6394,7 +6409,9 @@ export const CLOUD_MODELS: ModelDef[] = [}}],- "options": {},+ "options": {+ "promptless": true+ },"pricing": {"unit": "minute","usd": 5@@ -6469,7 +6486,8 @@ export const CLOUD_MODELS: ModelDef[] = ["1440p","2160p"],- "maxImages": 1+ "maxImages": 1,+ "promptless": true},"pricing": {"unit": "megapixel",@@ -6496,7 +6514,8 @@ export const CLOUD_MODELS: ModelDef[] = [}],"options": {- "maxImages": 1+ "maxImages": 1,+ "promptless": true},"pricing": {"unit": "image",@@ -6525,7 +6544,9 @@ export const CLOUD_MODELS: ModelDef[] = [}}],- "options": {},+ "options": {+ "promptless": true+ },"pricing": {"unit": "second","usd": 0.02@@ -6559,7 +6580,8 @@ export const CLOUD_MODELS: ModelDef[] = ["1080p","1440p","2160p"- ]+ ],+ "promptless": true},"pricing": {"unit": "megapixel",@@ -6590,7 +6612,8 @@ export const CLOUD_MODELS: ModelDef[] = [}],"options": {- "maxImages": 1+ "maxImages": 1,+ "promptless": true},"pricing": {"unit": "image",@@ -7380,7 +7403,8 @@ export const CLOUD_MODELS: ModelDef[] = ["default": 0}],- "seed": true+ "seed": true,+ "promptless": true},"badges": ["new"@@ -8242,8 +8266,7 @@ export const CLOUD_MODELS: ModelDef[] = ["Slovenian","Catalan","Nynorsk",- "Afrikaans",- "auto"+ "Afrikaans"]}]@@ -8386,7 +8409,8 @@ export const CLOUD_MODELS: ModelDef[] = ["hint": "Wise, Mature, Balanced \u00b7 american"}],- "seed": true+ "seed": true,+ "promptless": true},"defaults": {"voice": "JBFqnCBsd6RMkjVDRZzb"@@ -8417,7 +8441,8 @@ export const CLOUD_MODELS: ModelDef[] = [}],"options": {- "voiceClone": true+ "voiceClone": true,+ "promptless": true},"pricing": {"unit": "minute",@@ -8624,7 +8649,8 @@ export const CLOUD_MODELS: ModelDef[] = ["Zulu (South Africa)","English - Your Accent","English - American Accent"- ]+ ],+ "promptless": true},"badges": ["top"@@ -8834,7 +8860,8 @@ export const CLOUD_MODELS: ModelDef[] = ["Zulu (South Africa)","English - Your Accent","English - American Accent"- ]+ ],+ "promptless": true},"badges": ["fast"@@ -8900,7 +8927,42 @@ export const CLOUD_MODELS: ModelDef[] = ["vi","hu","no"- ]+ ],+ "sourceLanguages": [+ "en",+ "es",+ "fr",+ "de",+ "it",+ "pt",+ "pl",+ "hi",+ "ja",+ "ko",+ "zh",+ "ar",+ "ru",+ "tr",+ "nl",+ "sv",+ "id",+ "fil",+ "uk",+ "el",+ "cs",+ "ro",+ "da",+ "fi",+ "bg",+ "hr",+ "sk",+ "ms",+ "ta",+ "vi",+ "hu",+ "no"+ ],+ "promptless": true},"pricing": {"unit": "minute",@@ -8973,6 +9035,9 @@ export const CLOUD_MODELS: ModelDef[] = ["duration": {"key": "duration","type": "number"+ },+ "fixed": {+ "audio_format": "mp3"}}}@@ -9093,7 +9158,8 @@ export const CLOUD_MODELS: ModelDef[] = ["endpoint": "bytedance/seed-audio-1.0","map": {"voice": "voice",- "image": "image_url"+ "image": "image_url",+ "audios": "audio_urls"}},{@@ -9102,7 +9168,8 @@ export const CLOUD_MODELS: ModelDef[] = ["endpoint": "bytedance/seed-audio-1.0","map": {"voice": "voice",- "image": "image_url"+ "image": "image_url",+ "audios": "audio_urls"}}],@@ -9124,6 +9191,7 @@ export const CLOUD_MODELS: ModelDef[] = ["hint": "en \u00b7 es \u00b7 id \u00b7 pt \u00b7 zh"}],+ "maxAudios": 3,"maxImages": 1,"sliders": [{@@ -9266,13 +9334,17 @@ export const CLOUD_MODELS: ModelDef[] = ["family": "minimax-music","engine": "cloud","kind": "audio",- "tagline": "Songs with vocals, or instrumentals",+ "tagline": "Songs with vocals, lyrics written from your prompt","routes": [{"op": "music","provider": "fal","endpoint": "fal-ai/minimax-music/v2.5",- "map": {}+ "map": {+ "fixed": {+ "lyrics_optimizer": true+ }+ }}],"options": {},@@ -9354,14 +9426,6 @@ export const CLOUD_MODELS: ModelDef[] = ["mureka-9.5"],"default": "mureka-9.5"- },- {- "param": "gender",- "label": "Voice",- "values": [- "female",- "male"- ]}]},@@ -9544,7 +9608,9 @@ export const CLOUD_MODELS: ModelDef[] = [}}],- "options": {},+ "options": {+ "promptless": true+ },"pricing": {"unit": "second","usd": 0.0@@ -9573,7 +9639,9 @@ export const CLOUD_MODELS: ModelDef[] = [}}],- "options": {},+ "options": {+ "promptless": true+ },"pricing": {"unit": "second","usd": 0.05@@ -9610,7 +9678,8 @@ export const CLOUD_MODELS: ModelDef[] = ["480p","720p","1080p"- ]+ ],+ "promptless": true},"pricing": {"unit": "second",@@ -9717,6 +9786,9 @@ export const CLOUD_MODELS: ModelDef[] = ["duration": {"key": "duration","type": "number"+ },+ "defaults": {+ "duration": 600}}}@@ -9812,8 +9884,9 @@ export const CLOUD_MODELS: ModelDef[] = ["resolution": "auto"},"pricing": {- "unit": "image",- "usd": 0.027+ "unit": "request",+ "usd": 0.135,+ "note": "$0.027 per layer, \u22485 layers"}},{@@ -9908,7 +9981,8 @@ export const CLOUD_MODELS: ModelDef[] = [}],"options": {- "maxImages": 1+ "maxImages": 1,+ "promptless": true},"badges": ["fast"@@ -9947,7 +10021,8 @@ export const CLOUD_MODELS: ModelDef[] = [}],"options": {- "maxImages": 1+ "maxImages": 1,+ "promptless": true},"badges": ["top"@@ -9997,7 +10072,8 @@ export const CLOUD_MODELS: ModelDef[] = ["default": "spline"}],- "maxImages": 1+ "maxImages": 1,+ "promptless": true},"badges": ["fast"@@ -10034,7 +10110,9 @@ export const CLOUD_MODELS: ModelDef[] = [}}],- "options": {},+ "options": {+ "promptless": true+ },"pricing": {"unit": "request","usd": 0.001,@@ -10066,7 +10144,9 @@ export const CLOUD_MODELS: ModelDef[] = [}}],- "options": {},+ "options": {+ "promptless": true+ },"pricing": {"unit": "second","usd": 0.0002@@ -10080,7 +10160,7 @@ export const CLOUD_MODELS: ModelDef[] = ["family": "captions","engine": "cloud","kind": "video",- "tagline": "Transcribes and burns in TikTok-style karaoke captions",+ "tagline": "TikTok-style karaoke captions; English unless you pick the spoken language","routes": [{"op": "captions",@@ -10173,7 +10253,42 @@ export const CLOUD_MODELS: ModelDef[] = [],"default": "bottom"}- ]+ ],+ "sourceLanguages": [+ "en",+ "es",+ "fr",+ "de",+ "it",+ "pt",+ "pl",+ "hi",+ "ja",+ "ko",+ "zh",+ "ar",+ "ru",+ "tr",+ "nl",+ "sv",+ "id",+ "fil",+ "uk",+ "el",+ "cs",+ "ro",+ "da",+ "fi",+ "bg",+ "hr",+ "sk",+ "ms",+ "ta",+ "vi",+ "hu",+ "no"+ ],+ "promptless": true},"badges": ["top"@@ -10200,6 +10315,175 @@ export const CLOUD_MODELS: ModelDef[] = ["prompt": false,"targetLanguage": "translation_language","video": "video_url",+ "sourceLanguage": {+ "key": "language",+ "values": [+ "af-ZA",+ "am-ET",+ "ar-AE",+ "ar-BH",+ "ar-DZ",+ "ar-EG",+ "ar-IL",+ "ar-IQ",+ "ar-JO",+ "ar-KW",+ "ar-LB",+ "ar-MA",+ "ar-OM",+ "ar-PS",+ "ar-QA",+ "ar-SA",+ "ar-TN",+ "ast-ES",+ "az-AZ",+ "ba",+ "bas",+ "be-BY",+ "bg-BG",+ "br",+ "bs-BA",+ "ca-ES",+ "ceb-PH",+ "ckb-IQ",+ "cs-CZ",+ "cy-GB",+ "da-DK",+ "de-DE",+ "dyu",+ "el-GR",+ "en-AU",+ "en-GB",+ "en-IN",+ "en-NZ",+ "en-US",+ "eo",+ "es-AR",+ "es-BO",+ "es-CL",+ "es-CO",+ "es-CR",+ "es-DO",+ "es-EC",+ "es-ES",+ "es-GT",+ "es-HN",+ "es-MX",+ "es-NI",+ "es-PA",+ "es-PE",+ "es-PR",+ "es-PY",+ "es-SV",+ "es-US",+ "es-UY",+ "es-VE",+ "et-EE",+ "eu-ES",+ "fa-IR",+ "ff",+ "fi-FI",+ "fil-PH",+ "fo",+ "fr-CA",+ "fr-FR",+ "fy",+ "ga",+ "gd",+ "gl-ES",+ "ha-NG",+ "haw",+ "he-IL",+ "hr-HR",+ "hsb",+ "ht",+ "hu-HU",+ "hy-AM",+ "id-ID",+ "ig",+ "is-IS",+ "it-IT",+ "ja-JP",+ "ja-Latn-JP",+ "jv-ID",+ "ka-GE",+ "kab",+ "kam-KE",+ "kea-CV",+ "kk-KZ",+ "ko-KR",+ "ku",+ "ky-KG",+ "la",+ "lb-LU",+ "lg",+ "lij",+ "ln-CD",+ "lo-LA",+ "lt-LT",+ "luo-KE",+ "lv-LV",+ "mg",+ "mi-NZ",+ "mk-MK",+ "mn-MN",+ "ms-MY",+ "mt-MT",+ "nb-NO",+ "nl-NL",+ "nso-ZA",+ "ny-MW",+ "oc-FR",+ "pl-PL",+ "ps-AF",+ "pt-BR",+ "pt-PT",+ "ro-RO",+ "roh",+ "ru-RU",+ "rw-RW",+ "sah",+ "sk-SK",+ "sl-SI",+ "sm",+ "sn-ZW",+ "so-SO",+ "sq-AL",+ "sr-Latn-RS",+ "sr-RS",+ "srd",+ "ss",+ "su-ID",+ "sv-SE",+ "sw-KE",+ "sw-TZ",+ "tg-TJ",+ "th-TH",+ "tk",+ "tn",+ "tok",+ "ton",+ "tr-TR",+ "ts-ZA",+ "tt",+ "uk-UA",+ "umb-AO",+ "ur-IN",+ "ur-PK",+ "uz-UZ",+ "vi-VN",+ "vro",+ "wo-SN",+ "xh-ZA",+ "yi",+ "yo-NG",+ "yue-Hant-HK",+ "zh",+ "zh-HK",+ "zh-TW",+ "zu-ZA"+ ]+ },"fixed": {"preset": "simple"}@@ -10460,11 +10744,134 @@ export const CLOUD_MODELS: ModelDef[] = ["vegas"]}- ]+ ],+ "sourceLanguages": [+ "af",+ "am",+ "ar",+ "ast",+ "az",+ "ba",+ "bas",+ "be",+ "bg",+ "br",+ "bs",+ "ca",+ "ceb",+ "ckb",+ "cs",+ "cy",+ "da",+ "de",+ "dyu",+ "el",+ "en",+ "eo",+ "es",+ "et",+ "eu",+ "fa",+ "ff",+ "fi",+ "fil",+ "fo",+ "fr",+ "fy",+ "ga",+ "gd",+ "gl",+ "ha",+ "haw",+ "he",+ "hr",+ "hsb",+ "ht",+ "hu",+ "hy",+ "id",+ "ig",+ "is",+ "it",+ "ja",+ "jv",+ "ka",+ "kab",+ "kam",+ "kea",+ "kk",+ "ko",+ "ku",+ "ky",+ "la",+ "lb",+ "lg",+ "lij",+ "ln",+ "lo",+ "lt",+ "luo",+ "lv",+ "mg",+ "mi",+ "mk",+ "mn",+ "ms",+ "mt",+ "nb",+ "nl",+ "nso",+ "ny",+ "oc",+ "pl",+ "ps",+ "pt",+ "ro",+ "roh",+ "ru",+ "rw",+ "sah",+ "sk",+ "sl",+ "sm",+ "sn",+ "so",+ "sq",+ "sr",+ "srd",+ "ss",+ "su",+ "sv",+ "sw",+ "tg",+ "th",+ "tk",+ "tn",+ "tok",+ "ton",+ "tr",+ "ts",+ "tt",+ "uk",+ "umb",+ "ur",+ "uz",+ "vi",+ "vro",+ "wo",+ "xh",+ "yi",+ "yo",+ "yue",+ "zh",+ "zu"+ ],+ "promptless": true},"pricing": {"unit": "minute",- "usd": 0.1+ "usd": 0.1,+ "note": "basic styles; dynamic styles (glass, whisper, glide, fusion, terminal, handwritten, backdrop) and >1080p 2x; translation +$0.20/min"}},{@@ -10499,7 +10906,43 @@ export const CLOUD_MODELS: ModelDef[] = [}}],- "options": {},+ "options": {+ "sourceLanguages": [+ "en",+ "es",+ "fr",+ "de",+ "it",+ "pt",+ "pl",+ "hi",+ "ja",+ "ko",+ "zh",+ "ar",+ "ru",+ "tr",+ "nl",+ "sv",+ "id",+ "fil",+ "uk",+ "el",+ "cs",+ "ro",+ "da",+ "fi",+ "bg",+ "hr",+ "sk",+ "ms",+ "ta",+ "vi",+ "hu",+ "no"+ ],+ "promptless": true+ },"badges": ["top"],@@ -10516,7 +10959,7 @@ export const CLOUD_MODELS: ModelDef[] = ["family": "whisper","engine": "cloud","kind": "text",- "tagline": "Fast Whisper large-v3 transcripts in segments",+ "tagline": "Fast Whisper large-v3 transcripts in segments, any language","routes": [{"op": "transcribe",@@ -10525,12 +10968,221 @@ export const CLOUD_MODELS: ModelDef[] = ["map": {"prompt": false,"audio": "audio_url",- "sourceLanguage": "language",- "video": "audio_url"+ "sourceLanguage": {+ "key": "language",+ "values": [+ "af",+ "am",+ "ar",+ "as",+ "az",+ "ba",+ "be",+ "bg",+ "bn",+ "bo",+ "br",+ "bs",+ "ca",+ "cs",+ "cy",+ "da",+ "de",+ "el",+ "en",+ "es",+ "et",+ "eu",+ "fa",+ "fi",+ "fo",+ "fr",+ "gl",+ "gu",+ "ha",+ "haw",+ "he",+ "hi",+ "hr",+ "ht",+ "hu",+ "hy",+ "id",+ "is",+ "it",+ "ja",+ "jw",+ "ka",+ "kk",+ "km",+ "kn",+ "ko",+ "la",+ "lb",+ "ln",+ "lo",+ "lt",+ "lv",+ "mg",+ "mi",+ "mk",+ "ml",+ "mn",+ "mr",+ "ms",+ "mt",+ "my",+ "ne",+ "nl",+ "nn",+ "no",+ "oc",+ "pa",+ "pl",+ "ps",+ "pt",+ "ro",+ "ru",+ "sa",+ "sd",+ "si",+ "sk",+ "sl",+ "sn",+ "so",+ "sq",+ "sr",+ "su",+ "sv",+ "sw",+ "ta",+ "te",+ "tg",+ "th",+ "tk",+ "tl",+ "tr",+ "tt",+ "uk",+ "ur",+ "uz",+ "vi",+ "yi",+ "yo",+ "zh"+ ]+ },+ "video": "audio_url",+ "defaults": {+ "language": null+ }}}],- "options": {},+ "options": {+ "sourceLanguages": [+ "af",+ "am",+ "ar",+ "as",+ "az",+ "ba",+ "be",+ "bg",+ "bn",+ "bo",+ "br",+ "bs",+ "ca",+ "cs",+ "cy",+ "da",+ "de",+ "el",+ "en",+ "es",+ "et",+ "eu",+ "fa",+ "fi",+ "fo",+ "fr",+ "gl",+ "gu",+ "ha",+ "haw",+ "he",+ "hi",+ "hr",+ "ht",+ "hu",+ "hy",+ "id",+ "is",+ "it",+ "ja",+ "jw",+ "ka",+ "kk",+ "km",+ "kn",+ "ko",+ "la",+ "lb",+ "ln",+ "lo",+ "lt",+ "lv",+ "mg",+ "mi",+ "mk",+ "ml",+ "mn",+ "mr",+ "ms",+ "mt",+ "my",+ "ne",+ "nl",+ "nn",+ "no",+ "oc",+ "pa",+ "pl",+ "ps",+ "pt",+ "ro",+ "ru",+ "sa",+ "sd",+ "si",+ "sk",+ "sl",+ "sn",+ "so",+ "sq",+ "sr",+ "su",+ "sv",+ "sw",+ "ta",+ "te",+ "tg",+ "th",+ "tk",+ "tl",+ "tr",+ "tt",+ "uk",+ "ur",+ "uz",+ "vi",+ "yi",+ "yo",+ "zh"+ ],+ "promptless": true+ },"badges": ["fast"]@@ -10542,7 +11194,7 @@ export const CLOUD_MODELS: ModelDef[] = ["family": "whisper","engine": "cloud","kind": "text",- "tagline": "Whisper with word timings and speaker labels",+ "tagline": "Whisper large-v3 with word timings, any language","routes": [{"op": "transcribe",@@ -10551,12 +11203,221 @@ export const CLOUD_MODELS: ModelDef[] = ["map": {"prompt": false,"audio": "audio_url",- "sourceLanguage": "language",- "video": "audio_url"+ "sourceLanguage": {+ "key": "language",+ "values": [+ "af",+ "am",+ "ar",+ "as",+ "az",+ "ba",+ "be",+ "bg",+ "bn",+ "bo",+ "br",+ "bs",+ "ca",+ "cs",+ "cy",+ "da",+ "de",+ "el",+ "en",+ "es",+ "et",+ "eu",+ "fa",+ "fi",+ "fo",+ "fr",+ "gl",+ "gu",+ "ha",+ "haw",+ "he",+ "hi",+ "hr",+ "ht",+ "hu",+ "hy",+ "id",+ "is",+ "it",+ "ja",+ "jw",+ "ka",+ "kk",+ "km",+ "kn",+ "ko",+ "la",+ "lb",+ "ln",+ "lo",+ "lt",+ "lv",+ "mg",+ "mi",+ "mk",+ "ml",+ "mn",+ "mr",+ "ms",+ "mt",+ "my",+ "ne",+ "nl",+ "nn",+ "no",+ "oc",+ "pa",+ "pl",+ "ps",+ "pt",+ "ro",+ "ru",+ "sa",+ "sd",+ "si",+ "sk",+ "sl",+ "sn",+ "so",+ "sq",+ "sr",+ "su",+ "sv",+ "sw",+ "ta",+ "te",+ "tg",+ "th",+ "tk",+ "tl",+ "tr",+ "tt",+ "uk",+ "ur",+ "uz",+ "vi",+ "yi",+ "yo",+ "zh"+ ]+ },+ "video": "audio_url",+ "fixed": {+ "chunk_level": "word"+ }}}],- "options": {}+ "options": {+ "sourceLanguages": [+ "af",+ "am",+ "ar",+ "as",+ "az",+ "ba",+ "be",+ "bg",+ "bn",+ "bo",+ "br",+ "bs",+ "ca",+ "cs",+ "cy",+ "da",+ "de",+ "el",+ "en",+ "es",+ "et",+ "eu",+ "fa",+ "fi",+ "fo",+ "fr",+ "gl",+ "gu",+ "ha",+ "haw",+ "he",+ "hi",+ "hr",+ "ht",+ "hu",+ "hy",+ "id",+ "is",+ "it",+ "ja",+ "jw",+ "ka",+ "kk",+ "km",+ "kn",+ "ko",+ "la",+ "lb",+ "ln",+ "lo",+ "lt",+ "lv",+ "mg",+ "mi",+ "mk",+ "ml",+ "mn",+ "mr",+ "ms",+ "mt",+ "my",+ "ne",+ "nl",+ "nn",+ "no",+ "oc",+ "pa",+ "pl",+ "ps",+ "pt",+ "ro",+ "ru",+ "sa",+ "sd",+ "si",+ "sk",+ "sl",+ "sn",+ "so",+ "sq",+ "sr",+ "su",+ "sv",+ "sw",+ "ta",+ "te",+ "tg",+ "th",+ "tk",+ "tl",+ "tr",+ "tt",+ "uk",+ "ur",+ "uz",+ "vi",+ "yi",+ "yo",+ "zh"+ ],+ "promptless": true+ }},{"id": "demucs",@@ -10580,7 +11441,9 @@ export const CLOUD_MODELS: ModelDef[] = [}}],- "options": {},+ "options": {+ "promptless": true+ },"pricing": {"unit": "second","usd": 0.0007@@ -10617,7 +11480,8 @@ export const CLOUD_MODELS: ModelDef[] = ["default": "Normal"}],- "maxImages": 1+ "maxImages": 1,+ "promptless": true},"badges": ["top",@@ -10649,7 +11513,8 @@ export const CLOUD_MODELS: ModelDef[] = [}],"options": {- "maxImages": 1+ "maxImages": 1,+ "promptless": true},"badges": ["fast"@@ -10693,7 +11558,8 @@ export const CLOUD_MODELS: ModelDef[] = ["1024","1536"],- "maxImages": 1+ "maxImages": 1,+ "promptless": true},"defaults": {"resolution": "1024"@@ -10746,7 +11612,8 @@ export const CLOUD_MODELS: ModelDef[] = [}],"seed": true,- "maxImages": 1+ "maxImages": 1,+ "promptless": true},"pricing": {"unit": "request",diff --git a/src/lib/catalog/higgsfield-models.generated.ts b/src/lib/catalog/higgsfield-models.generated.tsindex ae4b6158..83b657e5 100644--- a/src/lib/catalog/higgsfield-models.generated.ts+++ b/src/lib/catalog/higgsfield-models.generated.ts@@ -431,6 +431,8 @@ export const HIGGSFIELD_MODELS: ModelDef[] = ["endpoint": "higgsfield/cinema-studio/4.0","map": {"images": "image_urls",+ "videos": "video_urls",+ "audios": "audio_urls","aspectRatio": "aspect_ratio","resolution": "resolution","duration": {@@ -638,6 +640,8 @@ export const HIGGSFIELD_MODELS: ModelDef[] = []}],+ "maxVideos": 10,+ "maxAudios": 10,"maxImages": 30},"defaults": {@@ -1014,6 +1018,8 @@ export const HIGGSFIELD_ROUTES: Record<string, ModelRoute[]> = {"endpoint": "bytedance/seedance-2.5/reference-to-video","map": {"images": "image_urls",+ "videos": "video_urls",+ "audios": "audio_urls","aspectRatio": "aspect_ratio","resolution": "resolution","duration": {@@ -1030,6 +1036,8 @@ export const HIGGSFIELD_ROUTES: Record<string, ModelRoute[]> = {"map": {"images": "image_urls","video": "video_url",+ "videos": "video_urls",+ "audios": "audio_urls","resolution": "resolution","generateAudio": "generate_audio"}@@ -1041,6 +1049,8 @@ export const HIGGSFIELD_ROUTES: Record<string, ModelRoute[]> = {"map": {"images": "image_urls","video": "video_url",+ "videos": "video_urls",+ "audios": "audio_urls","resolution": "resolution","duration": {"key": "duration",@@ -1101,6 +1111,8 @@ export const HIGGSFIELD_ROUTES: Record<string, ModelRoute[]> = {"endpoint": "bytedance/seedance-2.0/reference-to-video","map": {"images": "image_urls",+ "videos": "video_urls",+ "audios": "audio_urls","aspectRatio": "aspect_ratio","resolution": "resolution","duration": {@@ -1501,6 +1513,8 @@ export const HIGGSFIELD_ROUTES: Record<string, ModelRoute[]> = {"endpoint": "minimax/h3/reference-to-video","map": {"images": "image_urls",+ "videos": "video_urls",+ "audios": "audio_urls","aspectRatio": "aspect_ratio","resolution": "resolution","duration": {@@ -1691,6 +1705,8 @@ export const HIGGSFIELD_ROUTES: Record<string, ModelRoute[]> = {"endpoint": "alibaba/wan-3.0/reference-to-video","map": {"images": "image_urls",+ "videos": "video_urls",+ "audios": "audio_urls","seed": "seed","aspectRatio": "aspect_ratio","resolution": "resolution",@@ -1758,6 +1774,8 @@ export const HIGGSFIELD_ROUTES: Record<string, ModelRoute[]> = {"endpoint": "alibaba/wan-3.0-prime/reference-to-video","map": {"images": "image_urls",+ "videos": "video_urls",+ "audios": "audio_urls","seed": "seed","aspectRatio": "aspect_ratio","resolution": "resolution",@@ -1835,6 +1853,7 @@ export const HIGGSFIELD_ROUTES: Record<string, ModelRoute[]> = {"endpoint": "wan/v2.7/reference-to-video","map": {"images": "image_urls",+ "videos": "video_urls","negativePrompt": "negative_prompt","seed": "seed","seedRange": [diff --git a/src/lib/catalog/payload.ts b/src/lib/catalog/payload.tsindex b3e7a3ed..115db910 100644--- a/src/lib/catalog/payload.ts+++ b/src/lib/catalog/payload.ts@@ -1,4 +1,4 @@-import type { DurationField, EnumField, FieldMap, GenInput, MediaKind, Operation } from "./types";+import { OPERATION_OUTPUT, type DurationField, type EnumField, type FieldMap, type GenInput, type MediaKind, type Operation } from "./types";function enumValue(field: string | EnumField, value: string): [string, unknown] {if (typeof field === "string") return [field, value];@@ -65,9 +65,36 @@ export function paletteValue(format: PaletteFormat, palette: string[]): unknownreturn colors.map((c) => colorValue(format, c.rgb, c.hex));}+/** The ISO 639 code in "de", "de-DE", "pt_BR" or "German (de)"; undefined for a bare name. */+function languageCode(v: string): string | undefined {+ return (/\(([a-z]{2,3})(?:-[A-Za-z]+)?\)\s*$/i.exec(v)?.[1] ?? /^([a-z]{2,3})(?:[-_][A-Za-z0-9]+)*$/i.exec(v)?.[1])?.toLowerCase();+}++/**+ * The entry of an API's language list that means `lang`: the same value ("es-MX"), else the entry for+ * its ISO code: the bare code (Wizper's "es"), its home locale ("es-ES", "de-DE"), US English, or the+ * first locale listed ("ko-KR"). Undefined when the API doesn't know it, so the field is left out and+ * the API falls back to detecting it.+ */+export function languageValue(values: string[], lang: string): string | undefined {+ const v = lang.trim();+ const exact = values.find((x) => x.toLowerCase() === v.toLowerCase().replace("_", "-"));+ if (exact) return exact;+ const code = languageCode(v);+ if (!code) return undefined;+ const lower = values.map((x) => x.toLowerCase());+ for (const want of [code, `${code}-${code}`, `${code}-us`]) {+ const i = lower.indexOf(want);+ if (i >= 0) return values[i];+ }+ return values.find((x) => x.toLowerCase().startsWith(`${code}-`));+}+/** Build a provider payload from canonical input using a route's {@link FieldMap}. Pure + unit-tested. */export function buildPayload(map: FieldMap, input: GenInput): Record<string, unknown> {const out: Record<string, unknown> = {};+ // Fallbacks first: every canonical field and params.extra below overrides them.+ for (const [k, v] of Object.entries(map.defaults ?? {})) setPath(out, k, v);if (map.prompt !== false && input.prompt !== undefined) setPath(out, map.prompt ?? "prompt", input.prompt);if (map.negativePrompt && input.negativePrompt) out[map.negativePrompt] = input.negativePrompt;@@ -81,6 +108,7 @@ export function buildPayload(map: FieldMap, input: GenInput): Record<string, unkif (map.videoArray && input.video) out[map.videoArray] = [input.video];if (map.videos && input.videos?.length) out[map.videos] = input.videos;if (map.audio && input.audio) out[map.audio] = input.audio;+ if (map.audios && input.audios?.length) out[map.audios] = input.audios;if (map.aspectRatio && input.aspectRatio) {const [k, v] = enumValue(map.aspectRatio, input.aspectRatio);@@ -124,7 +152,15 @@ export function buildPayload(map: FieldMap, input: GenInput): Record<string, unkout[d.key] = input.dialogue.map((l) => ({ [d.text]: l.text, [d.voice]: l.voice ?? input.voice }));}if (map.targetLanguage && input.targetLanguage) out[map.targetLanguage] = input.targetLanguage;- if (map.sourceLanguage && input.sourceLanguage) out[map.sourceLanguage] = input.sourceLanguage;+ if (map.sourceLanguage && input.sourceLanguage?.trim()) {+ const s = map.sourceLanguage;+ // Free-text language fields take ISO codes ("de-DE" and "German (de)" are sent as "de").+ if (typeof s === "string") out[s] = languageCode(input.sourceLanguage.trim()) ?? input.sourceLanguage.trim();+ else {+ const v = languageValue(s.values, input.sourceLanguage);+ if (v !== undefined) out[s.key] = v;+ }+ }if (map.draftId && input.draftId) out[map.draftId] = input.draftId;// Trims, frame rates, palettes, saved styles and layer counts (research part 3).@@ -420,7 +456,7 @@ function transcriptOutputs(response: unknown): ExtractedOutput[] {if (!text && !cues.length) return [];const languages = (o.languages ?? o.inferred_languages) as unknown;const language = str(o.language_code) ?? str(o.language) ?? (Array.isArray(languages) ? str(languages[0]) : undefined);- return [{ url: textDataUri(text), kind: "text", contentType: "text/plain", text, meta: compact({ cues, language }) }];+ return [{ url: textDataUri(text), kind: "text", contentType: "text/plain", text, meta: compact({ cues: cues.length ? cues : undefined, language }) }];}/**@@ -461,8 +497,9 @@ function stemOutputs(response: unknown): ExtractedOutput[] {/*** Every result of a provider response, with structure the operation defines: layers (name, z, bbox),- * text blocks, transcripts (text + cues), 3D models and audio stems. A response with no media but- * text comes back as one text output instead of nothing.+ * text blocks, transcripts (text + cues), 3D models and audio stems. A text operation's response with+ * no media but text comes back as one text output; for media operations a text-only answer (a refusal)+ * is no result — {@link noOutputsError} turns it into the job's error.*/export function extractOutputs(response: unknown, op?: Operation): ExtractedOutput[] {let out: ExtractedOutput[];@@ -490,18 +527,23 @@ export function extractOutputs(response: unknown, op?: Operation): ExtractedOutpconst t = transcriptOutputs(response)[0];if (t) out = [{ ...out[0], meta: { ...out[0].meta, transcript: t.text, ...(t.meta?.cues ? { cues: t.meta.cues } : {}) } }, ...out.slice(1)];}- if (!out.length) {- const text = textOf(response)?.trim();- if (text) out = transcriptOutputs(response);- }+ if (!out.length && (op === undefined || OPERATION_OUTPUT[op] === "text") && textOf(response)?.trim()) out = transcriptOutputs(response);const r = body(response);if (isObj(r)) {// Recraft makes a style from reference images on the fly and returns its id: keep it to reuse the style.const styleId = str(r.style_id);if (styleId) out = out.map((o) => ({ ...o, meta: { ...o.meta, styleId } }));- // Cut-out endpoints (Bria extract-object) return the matte next to the image.+ // Cut-out endpoints (Bria extract-object) return the matte next to the image: it rides along on the+ // cut-out (meta.mask) instead of landing in the feed as a second result.const mask = fileOf(r.mask)?.url;- if (mask) out = out.map((o) => (o.url === mask ? { ...o, meta: { ...o.meta, role: "mask" } } : o));+ if (mask && out.some((o) => o.url !== mask)) out = out.filter((o) => o.url !== mask).map((o) => ({ ...o, meta: { ...o.meta, mask } }));}return out;}++/** The job's error when a response held no result: the model's own words when it answered in text. */+export function noOutputsError(response: unknown): string {+ const text = textOf(response)?.trim();+ if (text) return `The model replied: ${text.length > 300 ? `${text.slice(0, 300)}…` : text}`;+ return `No media in response: ${JSON.stringify(response).slice(0, 300)}`;+}diff --git a/src/lib/catalog/plan.ts b/src/lib/catalog/plan.tsindex fbdb8556..0e2ff7c4 100644--- a/src/lib/catalog/plan.ts+++ b/src/lib/catalog/plan.ts@@ -15,6 +15,8 @@ export function inferOperation(model: ModelDef, req: Pick<GenerationRequest, "opif (req.op) return req.op;const ops = new Set(model.routes.map((r) => r.op));const imgs = req.inputs?.images?.length ?? 0;+ // Reference clips (Cinema Studio, Seedance) only fit reference-to-video.+ const clipRefs = (req.inputs?.videos?.length ?? 0) + (req.inputs?.audios?.length ?? 0);const has = (op: Operation) => ops.has(op);if (model.kind === "video") {if (req.inputs?.video && req.inputs?.audio && has("lipsync")) return "lipsync";@@ -23,7 +25,7 @@ export function inferOperation(model: ModelDef, req: Pick<GenerationRequest, "opif (req.inputs?.video && has("v2v")) return "v2v";if (req.inputs?.video && has("extend")) return "extend";if (imgs && req.inputs?.endImage && has("flf2v")) return "flf2v";- if (imgs > 1 && has("ref2v")) return "ref2v";+ if ((imgs > 1 || clipRefs > 0) && has("ref2v")) return "ref2v";if (imgs && has("i2v")) return "i2v";if (has("t2v")) return "t2v";}@@ -94,9 +96,20 @@ const PROMPTLESS = new Set<Operation>(["concat", "frame", "color-match", "finalize", "reframe", "dialogue", "voice-change", "dub", "bg-remove-video", "depth-video", "upscale-image", "upscale-video", "bg-remove","interpolate", "v2a", "face-swap", "motion-transfer", "lipsync", "avatar",// round 3: tools that work from their inputs (open caption burn-in takes timed lines as its prompt and says so when they're missing)- "trim", "transcribe", "mux", "separate-audio", "layers", "image-to-3d", "captions",+ "trim", "transcribe", "mux", "separate-audio", "layers", "image-to-3d", "captions", "text-layers", "vectorize",]);+/**+ * The prompt can be left empty: the operation works from its inputs, the model takes no prompt at all+ * (try-on, transcription, 3D), or (when the routes' field maps are known, on the server) none of the+ * routes for this operation sends one.+ */+export function promptOptional(model: ModelDef, op: Operation): boolean {+ if (PROMPTLESS.has(op) || model.options.promptless) return true;+ const routes = routesFor(model, op);+ return routes.length > 0 && routes.every((r) => r.map?.prompt === false);+}+export function planGeneration(req: GenerationRequest,getModel: (id: string) => ModelDef | undefined,@@ -182,11 +195,11 @@ export function planGeneration(throw new Error(op === "tts" ? "Pick or record the voice to speak with" : "Pick or record the voice to change into");}if (op === "dub" && !req.inputs?.video && !req.inputs?.audio) throw new Error("Add the video to translate");- if (!prompt && !PROMPTLESS.has(op)) {+ if (!prompt && !promptOptional(model, op)) {throw new Error("Write a prompt first");}- const missing = missingInputs(op, req);+ const missing = missingInputs(op, req) ?? unreadInputs(model, op, req) ?? missingImages(model, req);if (missing) throw new Error(missing);const presets = model.options.presets;if (presets?.required && !params.extra?.[presets.param]) throw new Error(`Pick a ${presets.label.toLowerCase()} first`);@@ -198,13 +211,17 @@ export function planGeneration(return { model, op, prompt, params: { ...params, numOutputs: perJobOutputs }, loras, jobs, perJobOutputs };}-const NEEDS: Partial<Record<Operation, { images?: number; video?: boolean; videos?: number; audio?: boolean; endImage?: boolean; mask?: boolean; msg: string }>> = {+type InputKey = keyof NonNullable<GenerationRequest["inputs"]>;++const NEEDS: Partial<+ Record<Operation, { images?: number; video?: boolean; videos?: number; audio?: boolean; endImage?: boolean; mask?: boolean; oneOf?: InputKey[]; msg: string }>+> = {edit: { images: 1, msg: "Add an image to edit" },inpaint: { images: 1, mask: true, msg: "Add an image and paint the area to change" },outpaint: { images: 1, msg: "Add an image to extend" },i2v: { images: 1, msg: "Add a start frame" },flf2v: { images: 1, endImage: true, msg: "Add a start and an end frame" },- ref2v: { images: 1, msg: "Add reference images" },+ ref2v: { oneOf: ["images", "videos", "audios"], msg: "Add reference images" },v2v: { video: true, msg: "Add a video" },avatar: { images: 1, audio: true, msg: "Add a portrait and a voice track" },lipsync: { video: true, audio: true, msg: "Add a video and a voice track" },@@ -230,8 +247,15 @@ const NEEDS: Partial<Record<Operation, { images?: number; video?: boolean; videocaptions: { video: true, msg: "Add the video to caption" },layers: { images: 1, msg: "Add the image to split into layers" },"image-to-3d": { images: 1, msg: "Add a product or object photo" },+ // round 3 (cloud catalog)+ "text-layers": { images: 1, msg: "Add the image to lift the text from" },+ vectorize: { images: 1, msg: "Add the image to turn into an SVG" },+ transcribe: { oneOf: ["audio", "video"], msg: "Add the audio or video to transcribe" },+ "separate-audio": { oneOf: ["audio", "video"], msg: "Add the audio or video to split" },};+const given = (v: unknown) => (Array.isArray(v) ? v.length > 0 : !!v);+/** Human message for the first missing input of an operation, or null. */export function missingInputs(op: Operation, req: Pick<GenerationRequest, "inputs">): string | null {const n = NEEDS[op];@@ -243,9 +267,50 @@ export function missingInputs(op: Operation, req: Pick<GenerationRequest, "inputif (n.audio && !i.audio) return n.msg;if (n.endImage && !i.endImage) return n.msg;if (n.mask && !i.mask) return n.msg;+ if (n.oneOf && !n.oneOf.some((k) => given(i[k]))) return n.msg;return null;}+const INPUT_WORDS: Partial<Record<InputKey, string>> = {+ images: "reference images",+ videos: "reference videos",+ audios: "reference audio",+ audio: "audio",+ video: "video",+};++/** Whether a route's field map has a place for this input. */+function readsInput(map: NonNullable<ModelRoute["map"]>, k: InputKey): boolean {+ if (k === "images") return !!(map.image || map.images);+ if (k === "video") return !!(map.video || map.videoArray);+ return !!map[k as keyof typeof map];+}++/**+ * For "this or that" inputs: what was attached is something none of the model's routes can send+ * (Demucs splits audio, not a video; a reference-to-video model that only takes images was given clips).+ * Needs the routes' field maps, so only the server (full catalog) checks it.+ */+function unreadInputs(model: ModelDef, op: Operation, req: Pick<GenerationRequest, "inputs">): string | null {+ const keys = NEEDS[op]?.oneOf;+ const routes = routesFor(model, op);+ if (!keys || !routes.length || routes.some((r) => !r.map)) return null;+ const i = req.inputs ?? {};+ const attached = keys.filter((k) => given(i[k]));+ const reads = (k: InputKey) => routes.some((r) => readsInput(r.map!, k));+ if (!attached.length || attached.some(reads)) return null;+ const words = keys.filter(reads).map((k) => INPUT_WORDS[k] ?? k);+ return words.length ? `${model.name} works from ${words.join(" or ")} — add one` : null;+}++/** Models that need several images (try-on: the person, then the garment). */+function missingImages(model: ModelDef, req: Pick<GenerationRequest, "inputs">): string | null {+ const min = model.options.minImages ?? 0;+ if ((req.inputs?.images?.length ?? 0) >= min) return null;+ const labels = model.options.imageLabels?.slice(0, min);+ return labels?.length === min ? `Add the ${labels.join(" and the ")}` : `${model.name} needs ${min} images`;+}+/** Rough USD estimate for a plan (BYO-key cloud runs). Open-source runs are free. */export function estimateCost(model: ModelDef, params: GenParams, jobs = 1): number | null {if (model.engine === "open" || !model.pricing) return model.engine === "open" ? 0 : null;diff --git a/src/lib/catalog/types.ts b/src/lib/catalog/types.tsindex b29cf871..73797c41 100644--- a/src/lib/catalog/types.ts+++ b/src/lib/catalog/types.ts@@ -192,7 +192,7 @@ export interface FieldMap {video?: string;/** Video field that takes an array (receives the one input video). */videoArray?: string;- /** Array field that receives every clip of `inputs.videos`, in order (join clips). */+ /** Array field that receives every clip of `inputs.videos`, in order (join clips; reference videos for reference-to-video). */videos?: string;audio?: string;aspectRatio?: string | EnumField;@@ -234,11 +234,22 @@ export interface FieldMap {styleId?: string;/** How many layers to split an image into. */numLayers?: string;- sourceLanguage?: string;+ /**+ * Language of the speech. With `values` (the API's own list, e.g. VEED's "es-ES"), the request's+ * language is matched to an entry by exact value or ISO code, and left out when nothing matches.+ */+ sourceLanguage?: string | { key: string; values: string[] };/** Second image field (inputs.images[1]): a try-on garment, a product shot's scene reference, a style image. */image2?: string;/** Static fields always sent (e.g. safety checker switches). */fixed?: Record<string, unknown>;+ /** Array field that receives `inputs.audios` (reference audio clips: Seedance / Cinema Studio reference-to-video). */+ audios?: string;+ /**+ * Fields sent unless the request sets them (a canonical field or params.extra wins): Wizper's+ * `language: null` (detect instead of assuming English), Mirelo's full-length soundtrack.+ */+ defaults?: Record<string, unknown>;}export interface ModelRoute {@@ -286,6 +297,17 @@ export interface ModelOptions {sliders?: { param: string; label: string; min: number; max: number; step: number; default: number }[];/** Extra enum settings sent as-is (Cinema Studio's genre, lens, light, grade, camera move…). */controls?: { param: string; label: string; values: (string | number)[]; default?: string | number }[];+ /** Images it needs before it can run (try-on: the person and the garment). */+ minImages?: number;+ /** What each image is, in order ("person photo", "garment"): blockers and slot labels. */+ imageLabels?: string[];+ /** None of its routes takes a prompt (try-on, 3D, transcription): the composer can hide the prompt box. */+ promptless?: boolean;+ /** Max reference videos / audio clips it accepts (reference-to-video: inputs.videos / inputs.audios). */+ maxVideos?: number;+ maxAudios?: number;+ /** Spoken languages it can be told (transcription, captions): sent as params.sourceLanguage; unset = its default. */+ sourceLanguages?: string[];}export interface Pricing {@@ -382,8 +404,10 @@ export interface GenerationRequest {voiceAudio?: string;/** Second speaker's reference voice (open-source dialogue). */voiceAudio2?: string;- /** Several clips in order (join clips). */+ /** Several clips in order (join clips), or reference videos (reference-to-video: Seedance, Cinema Studio). */videos?: string[];+ /** Reference audio clips (reference-to-video: voices, music or sound the clip should follow). */+ audios?: string[];};params?: GenParams;/** Values for preset option pickers (apps). */@@ -427,6 +451,7 @@ export interface GenInput extends GenParams {voiceAudio?: string;voiceAudio2?: string;videos?: string[];+ audios?: string[];loras?: LoraRef[];}diff --git a/src/server/generations.ts b/src/server/generations.tsindex f76c9e33..4c814a88 100644--- a/src/server/generations.ts+++ b/src/server/generations.ts@@ -550,6 +550,7 @@ async function submit(voiceAudio: await prep(req.inputs?.voiceAudio),voiceAudio2: await prep(req.inputs?.voiceAudio2),videos: (await Promise.all((req.inputs?.videos ?? []).map(prep))).filter(Boolean) as string[],+ audios: (await Promise.all((req.inputs?.audios ?? []).map(prep))).filter(Boolean) as string[],loras: plan.loras,// Vary seeds across a batch so N jobs don't return N identical results.seed: plan.params.seed !== undefined && plan.params.seed >= 0 ? plan.params.seed + index : undefined,diff --git a/src/server/providers/fal.ts b/src/server/providers/fal.tsindex 28905729..33c873c5 100644--- a/src/server/providers/fal.ts+++ b/src/server/providers/fal.ts@@ -1,6 +1,6 @@import "server-only";import { createFalClient } from "@fal-ai/client";-import { buildPayload, extractOutputs } from "@/lib/catalog/payload";+import { buildPayload, extractOutputs, noOutputsError } from "@/lib/catalog/payload";import { getSetting } from "../settings";import { ProviderError, type ProviderAdapter } from "./types";@@ -95,7 +95,7 @@ export const falProvider: ProviderAdapter = {const result = await falFetch(meta.responseUrl as string);// Layers, text blocks, transcripts, 3D models and stems keep their structure (OutputFile.meta / text).const outputs = extractOutputs(result, route?.op);- if (!outputs.length) return { state: "failed", error: `No media in response: ${JSON.stringify(result).slice(0, 300)}` };+ if (!outputs.length) return { state: "failed", error: noOutputsError(result) };// Seedance draft mode: keep the id that finishes this take at 1080p.const draftId = /"draft_id"\s*:\s*"([^"]+)"/.exec(JSON.stringify(result))?.[1];return { state: "succeeded", outputs: draftId ? outputs.map((o) => ({ ...o, draftId })) : outputs };diff --git a/src/server/providers/higgsfield.ts b/src/server/providers/higgsfield.tsindex 440d4675..dbf39ef9 100644--- a/src/server/providers/higgsfield.ts+++ b/src/server/providers/higgsfield.ts@@ -1,5 +1,5 @@import "server-only";-import { buildPayload, extractOutputs } from "@/lib/catalog/payload";+import { buildPayload, extractOutputs, noOutputsError } from "@/lib/catalog/payload";import type { Operation } from "@/lib/catalog/types";import { getSetting } from "../settings";import { ProviderError, type ProviderAdapter, type RemoteOutput } from "./types";@@ -124,7 +124,7 @@ export const higgsfieldProvider: ProviderAdapter = {return { state: "running", message: "Generating" };case "completed": {const outputs = higgsfieldOutputs(s, route?.op);- return outputs.length ? { state: "succeeded", outputs } : { state: "failed", error: `No media in response: ${JSON.stringify(s).slice(0, 300)}` };+ return outputs.length ? { state: "succeeded", outputs } : { state: "failed", error: noOutputsError(s) };}case "nsfw":return { state: "failed", error: "Higgsfield's moderation blocked this prompt or result (not charged)" };diff --git a/src/server/providers/replicate.ts b/src/server/providers/replicate.tsindex 2101e1b6..9482d84c 100644--- a/src/server/providers/replicate.ts+++ b/src/server/providers/replicate.ts@@ -1,5 +1,5 @@import "server-only";-import { buildPayload, extractOutputs } from "@/lib/catalog/payload";+import { buildPayload, extractOutputs, noOutputsError } from "@/lib/catalog/payload";import { getSetting } from "../settings";import { toDataUri } from "../storage";import { ProviderError, type ProviderAdapter } from "./types";@@ -74,7 +74,7 @@ export const replicateProvider: ProviderAdapter = {if (p.status === "succeeded") {// Object outputs (Scribe's {text, words}) are read as the result itself; URL lists keep their order (layers).const outputs = extractOutputs({ output: p.output }, route?.op);- if (!outputs.length) return { state: "failed", error: "No media in output" };+ if (!outputs.length) return { state: "failed", error: noOutputsError({ output: p.output }) };return { state: "succeeded", outputs };}return { state: "failed", error: p.error ?? p.status };diff --git a/src/server/storage.ts b/src/server/storage.tsindex e0b5017b..a668bca2 100644--- a/src/server/storage.ts+++ b/src/server/storage.ts@@ -23,6 +23,7 @@ const EXT_BY_TYPE: Record<string, string> = {"audio/ogg": "ogg","audio/flac": "flac","audio/mp4": "m4a",+ "audio/aac": "aac",// Text outputs (transcripts, translations, scripts) and 3D models."text/plain": "txt","application/x-subrip": "srt",@@ -47,6 +48,7 @@ const TYPE_BY_EXT: Record<string, string> = {ogg: "audio/ogg",flac: "audio/flac",m4a: "audio/mp4",+ aac: "audio/aac",txt: "text/plain",srt: "application/x-subrip",vtt: "text/vtt",diff --git a/tests/cloud-catalog-fixes.test.ts b/tests/cloud-catalog-fixes.test.tsnew file mode 100644index 00000000..de6f9a46--- /dev/null+++ b/tests/cloud-catalog-fixes.test.ts@@ -0,0 +1,205 @@+/**+ * Round-3 review fixes for the cloud catalog: planning the new operations (prompts, inputs, try-on),+ * reference clips for reference-to-video (Cinema Studio, Seedance), API defaults, spoken languages,+ * control lists, and a research-driven check that every input an API requires can be filled.+ */+import fs from "node:fs";+import { describe, expect, it } from "vitest";+import { getModel, getPreset, MODELS } from "@/lib/catalog";+import { buildPayload, languageValue } from "@/lib/catalog/payload";+import { planGeneration } from "@/lib/catalog/plan";+import type { FieldMap, GenerationRequest, ModelRoute, Operation } from "@/lib/catalog/types";++type Spec = { required?: boolean };+type Endpoint = { provider: string; endpoint: string; inputs?: Record<string, Spec> };+const research = ["paid-model-apis.json", "paid-model-apis-2.json", "paid-model-apis-3.json"].flatMap(+ (f) => (JSON.parse(fs.readFileSync(`docs/research/${f}`, "utf8")) as { endpoints: Endpoint[] }).endpoints,+);+const byId = new Map<string, Endpoint>();+for (const e of research) byId.set(`${e.provider}:${e.endpoint}`, { ...byId.get(`${e.provider}:${e.endpoint}`), ...e });++/** Every top-level provider field a FieldMap can write: canonical keys, fixed fields and defaults. */+function sentFields(map: FieldMap): Set<string> {+ const out: string[] = [];+ for (const [k, v] of Object.entries(map)) {+ if (k === "fixed" || k === "defaults") out.push(...Object.keys(v as object));+ else if (k === "seedRange" || k === "maskFormat") continue;+ else if (typeof v === "string") out.push(v);+ else if (v && typeof v === "object") for (const f of ["key", "background", "shotType", "flag"]) if (typeof (v as Record<string, unknown>)[f] === "string") out.push((v as Record<string, string>)[f]);+ }+ // A map without a prompt key sends the prompt as "prompt".+ if (map.prompt === undefined) out.push("prompt");+ return new Set(out.map((f) => f.split(".")[0]));+}++const route = (id: string, op?: Operation, provider = "fal"): ModelRoute => {+ const r = getModel(id)?.routes.find((x) => (!op || x.op === op) && x.provider === provider);+ if (!r) throw new Error(`${id} has no ${provider} ${op} route`);+ return r;+};++type Req = Omit<GenerationRequest, "feature">;+const plan = (req: Req) => planGeneration({ feature: "x", ...req }, getModel, getPreset);+const planError = (req: Req) => {+ try {+ plan(req);+ return null;+ } catch (e) {+ return (e as Error).message;+ }+};++describe("research-driven route checks", () => {+ it("every input an API requires can be filled: by a canonical field, a fixed value or a default", () => {+ const bad: string[] = [];+ for (const m of MODELS) {+ for (const r of m.routes) {+ if (r.provider !== "fal" && r.provider !== "replicate") continue;+ const e = byId.get(`${r.provider}:${r.endpoint}`);+ if (!e) continue;+ const map = r.map ?? {};+ const inputs = e.inputs ?? {};+ const sent = sentFields(map);+ if (map.prompt === undefined && !("prompt" in inputs)) bad.push(`${m.id} ${r.op}: sends "prompt", which ${r.endpoint} doesn't take`);+ for (const [k, spec] of Object.entries(inputs)) if (spec?.required && !sent.has(k)) bad.push(`${m.id} ${r.op}: ${r.endpoint} requires ${k}`);+ // A required second image (a try-on garment) is only sent when two images are attached: planning must ask for both.+ if (map.image2 && inputs[map.image2]?.required && (m.options.minImages ?? 0) < 2) bad.push(`${m.id}: needs minImages 2 for ${map.image2}`);+ }+ }+ expect(bad).toEqual([]);+ });+});++describe("planning the new operations", () => {+ it("never asks for a prompt a model throws away", () => {+ expect(plan({ modelId: "scribe-v2", op: "transcribe", inputs: { audio: "/a.mp3" } }).op).toBe("transcribe");+ expect(plan({ modelId: "hunyuan-3d-3-1-pro", inputs: { images: ["/a.png"] } }).op).toBe("image-to-3d");+ expect(plan({ modelId: "fashn-tryon", inputs: { images: ["/p.png", "/g.png"] } }).op).toBe("edit");+ expect(plan({ modelId: "product-photography", inputs: { images: ["/p.png"] } }).op).toBe("edit");+ expect(plan({ modelId: "ideogram-3-text-layers", inputs: { images: ["/a.png"] } }).op).toBe("text-layers");+ expect(plan({ modelId: "recraft-vectorize", inputs: { images: ["/a.png"] } }).op).toBe("vectorize");+ for (const id of ["fashn-tryon", "scribe-v2", "hunyuan-3d-3-1-pro", "demucs", "auto-subtitle", "trim-video"]) expect(getModel(id)!.options.promptless, id).toBe(true);+ // Models that read a prompt still ask for one.+ expect(planError({ modelId: "bria-extract-object", inputs: { images: ["/a.png"] } })).toBe("Write a prompt first");+ expect(getModel("nano-banana-pro")!.options.promptless).toBeUndefined();+ });++ it("asks for the input each new operation works from before anything reaches the provider", () => {+ expect(planError({ modelId: "scribe-v2", op: "transcribe" })).toBe("Add the audio or video to transcribe");+ expect(plan({ modelId: "scribe-v2", op: "transcribe", inputs: { video: "/v.mp4" } }).op).toBe("transcribe");+ expect(planError({ modelId: "hunyuan-3d-3-1-pro", op: "image-to-3d", prompt: "x" })).toBe("Add a product or object photo");+ expect(planError({ modelId: "ideogram-3-text-layers", op: "text-layers" })).toBe("Add the image to lift the text from");+ expect(planError({ modelId: "recraft-vectorize", op: "vectorize" })).toBe("Add the image to turn into an SVG");+ expect(planError({ modelId: "trim-video", op: "trim", params: { startTime: 1, endTime: 2 } })).toBe("Add the video to trim");+ expect(planError({ modelId: "merge-audio-video", op: "mux", inputs: { video: "/v.mp4" } })).toBe("Add a video and the soundtrack to put on it");+ expect(planError({ modelId: "demucs", op: "separate-audio" })).toBe("Add the audio or video to split");+ // Demucs reads audio only: a video alone is turned away, saying what it needs.+ expect(planError({ modelId: "demucs", op: "separate-audio", inputs: { video: "/v.mp4" } })).toBe("Demucs stem split works from audio — add one");+ expect(plan({ modelId: "demucs", op: "separate-audio", inputs: { audio: "/a.mp3" } }).op).toBe("separate-audio");+ });++ it("try-on needs the person and the garment", () => {+ for (const id of ["fashn-tryon", "google-try-on", "leffa-tryon"]) {+ expect(getModel(id)!.options).toMatchObject({ minImages: 2, imageLabels: ["person photo", "garment"] });+ expect(planError({ modelId: id, inputs: { images: ["/p.png"] } }), id).toBe("Add the person photo and the garment");+ }+ // The product shot's scene image is optional.+ expect(getModel("bria-product-shot")!.options.minImages).toBeUndefined();+ expect(plan({ modelId: "bria-product-shot", prompt: "on marble", inputs: { images: ["/p.png"] } }).op).toBe("edit");+ });++ it("Recraft Styles run only with references (no text-to-image route that can't work)", () => {+ for (const id of ["recraft-4-style", "recraft-4-style-pro"]) {+ expect(getModel(id)!.routes.map((r) => r.op), id).toEqual(["edit"]);+ expect(planError({ modelId: id, prompt: "a fox" }), id).toBe("Add an image to edit");+ }+ });+});++describe("reference clips (Cinema Studio, Seedance 2.5)", () => {+ it("sends reference videos and audio as the API's clip lists", () => {+ const refs = { prompt: "@Video1 dances to @Audio1", images: ["face.png"], videos: ["moves.mp4", "cam.mp4"], audios: ["song.mp3"] };+ const clips = { video_urls: ["moves.mp4", "cam.mp4"], audio_urls: ["song.mp3"] };+ expect(buildPayload(route("seedance-2-5", "ref2v").map!, refs)).toMatchObject({ image_urls: ["face.png"], ...clips });+ expect(buildPayload(route("cinema-studio-4", "ref2v", "higgsfield").map!, refs)).toMatchObject({ image_urls: ["face.png"], ...clips });+ expect(buildPayload(route("seedance-2-5", "ref2v", "higgsfield").map!, refs)).toMatchObject(clips);+ expect(buildPayload(route("wan-3", "ref2v").map!, refs)).toMatchObject({ reference_video_urls: ["moves.mp4", "cam.mp4"], reference_audio_urls: ["song.mp3"] });+ // Higgsfield's Seedance edit keeps the clip it edits apart from the reference clips.+ expect(buildPayload(route("seedance-2-5", "v2v", "higgsfield").map!, { prompt: "p", video: "take.mp4", videos: ["ref.mp4"] })).toMatchObject({ video_url: "take.mp4", video_urls: ["ref.mp4"] });+ // The fal extend route sends the clip it continues as its one-item list.+ expect(buildPayload(route("seedance-2-5", "extend").map!, { prompt: "p", video: "take.mp4", audios: ["a.mp3"] })).toMatchObject({ video_urls: ["take.mp4"], audio_urls: ["a.mp3"], task: "extension" });+ // Text-to-video routes never carry clips.+ expect(buildPayload(route("cinema-studio-4", "t2v", "higgsfield").map!, refs)).not.toHaveProperty("video_urls");+ });++ it("says how many clips each model takes", () => {+ expect(getModel("seedance-2-5")!.options).toMatchObject({ maxVideos: 10, maxAudios: 10 });+ expect(getModel("cinema-studio-4")!.options).toMatchObject({ maxVideos: 10, maxAudios: 10 });+ expect(getModel("wan-3")!.options).toMatchObject({ maxVideos: 5, maxAudios: 5 });+ expect(getModel("seedance-2-0")!.options).toMatchObject({ maxVideos: 3, maxAudios: 3 });+ expect(getModel("kling-3")!.options.maxVideos).toBeUndefined();+ });++ it("plans clips as reference-to-video, and turns them away where they can't go", () => {+ expect(plan({ modelId: "seedance-2-5", prompt: "x", inputs: { videos: ["/v.mp4"] } }).op).toBe("ref2v");+ expect(plan({ modelId: "cinema-studio-4", prompt: "x", inputs: { audios: ["/a.mp3"] } }).op).toBe("ref2v");+ expect(plan({ modelId: "seedance-2-5", prompt: "x", inputs: { images: ["/a.png"], videos: ["/v.mp4"] } }).op).toBe("ref2v");+ // One image and no clips is still a start frame.+ expect(plan({ modelId: "seedance-2-5", prompt: "x", inputs: { images: ["/a.png"] } }).op).toBe("i2v");+ expect(planError({ modelId: "kling-o3", op: "ref2v", prompt: "x", inputs: { videos: ["/v.mp4"] } })).toBe("Kling O3 Omni works from reference images — add one");+ expect(planError({ modelId: "seedance-2-5", op: "ref2v", prompt: "x" })).toBe("Add reference images");+ });+});++describe("defaults the APIs would get wrong", () => {+ it("sends API defaults unless the request says otherwise", () => {+ // Wizper detects the language instead of assuming English; a picked language wins.+ expect(buildPayload(route("wizper").map!, { audio: "a.mp3" })).toEqual({ audio_url: "a.mp3", language: null });+ expect(buildPayload(route("wizper").map!, { audio: "a.mp3", sourceLanguage: "es" })).toEqual({ audio_url: "a.mp3", language: "es" });+ expect(buildPayload(route("wizper").map!, { audio: "a.mp3", sourceLanguage: "Klingon" })).toEqual({ audio_url: "a.mp3", language: null });+ // Mirelo for video covers the whole clip (the API clamps to its length), unless a duration is asked for.+ expect(buildPayload(route("mirelo-sfx-2-video").map!, { video: "v.mp4" })).toMatchObject({ duration: 600 });+ expect(buildPayload(route("mirelo-sfx-2-video").map!, { video: "v.mp4", duration: 8 })).toMatchObject({ duration: 8 });+ // Leffa: tops unless the Garment control says otherwise, and the control shows it.+ expect(buildPayload(route("leffa-tryon").map!, { images: ["p.png", "d.png"] })).toMatchObject({ garment_type: "upper_body" });+ expect(buildPayload(route("leffa-tryon").map!, { images: ["p.png", "d.png"], extra: { garment_type: "dresses" } })).toMatchObject({ garment_type: "dresses" });+ expect(getModel("leffa-tryon")!.options.controls).toEqual([{ param: "garment_type", label: "Garment", values: ["upper_body", "lower_body", "dresses"], default: "upper_body" }]);+ // Required fields with a documented default, and one with none (Kling follows the driving video).+ expect(buildPayload(route("minimax-h3-max", "t2v").map!, { prompt: "p" })).toMatchObject({ prompt_expansion_mode: "balanced" });+ expect(buildPayload(route("kling-motion-control").map!, { images: ["c.png"], video: "d.mp4" })).toMatchObject({ character_orientation: "video" });+ });++ it("matches the spoken language to each API's own list", () => {+ const veed = route("veed-subtitles").map!;+ expect(buildPayload(veed, { video: "v.mp4", sourceLanguage: "es" })).toMatchObject({ language: "es-ES" });+ expect(buildPayload(veed, { video: "v.mp4", sourceLanguage: "en" })).toMatchObject({ language: "en-US" });+ expect(buildPayload(veed, { video: "v.mp4", sourceLanguage: "es-MX" })).toMatchObject({ language: "es-MX" });+ expect(buildPayload(veed, { video: "v.mp4", sourceLanguage: "ko" })).toMatchObject({ language: "ko-KR" });+ expect(buildPayload(veed, { video: "v.mp4", sourceLanguage: "German (de)" })).toMatchObject({ language: "de-DE" });+ expect(buildPayload(veed, { video: "v.mp4" })).not.toHaveProperty("language");+ expect(languageValue(["en", "es"], "auto")).toBeUndefined();+ // Free-text language fields get ISO codes.+ expect(buildPayload(route("scribe-v2").map!, { audio: "a.mp3", sourceLanguage: "pt-BR" })).toMatchObject({ language_code: "pt" });+ expect(buildPayload(route("auto-subtitle").map!, { video: "v.mp4", sourceLanguage: "Spanish (es)" })).toMatchObject({ language: "es" });+ for (const id of ["auto-subtitle", "veed-subtitles", "scribe-v2", "wizper", "whisper"]) expect(getModel(id)!.options.sourceLanguages, id).toContain("es");+ });++ it("asks each API for what Fuobe can use", () => {+ expect(buildPayload(route("sonilo-sfx").map!, { prompt: "rain" })).toMatchObject({ audio_format: "mp3" });+ expect(buildPayload(route("minimax-music-2-5").map!, { prompt: "lofi" })).toEqual({ prompt: "lofi", lyrics_optimizer: true });+ expect(buildPayload(route("whisper").map!, { audio: "a.mp3" })).toMatchObject({ chunk_level: "word" });+ expect(getModel("mureka-song")!.options.controls!.map((c) => c.param)).toEqual(["model"]);+ expect(getModel("seedream-5-flash-layers")!.pricing).toMatchObject({ unit: "request", usd: 0.135 });+ expect(getModel("veed-subtitles")!.pricing?.note).toMatch(/dynamic styles .* 2x/);+ });++ it("controls don't repeat the composer's own Auto", () => {+ for (const m of MODELS) {+ for (const c of m.options.controls ?? []) {+ expect(c.values.some((v) => String(v).toLowerCase() === "auto"), `${m.id} ${c.param}`).toBe(false);+ if (String(c.default).toLowerCase() === "none") expect(c.values, `${m.id} ${c.param}`).not.toContain("none");+ }+ }+ expect(getModel("fashn-tryon")!.options.controls!.find((c) => c.param === "category")).toEqual({ param: "category", label: "Garment", values: ["tops", "bottoms", "one-pieces"] });+ });+});diff --git a/tests/cloud-catalog.test.ts b/tests/cloud-catalog.test.tsindex 3d2a3705..a6aa5f5b 100644--- a/tests/cloud-catalog.test.ts+++ b/tests/cloud-catalog.test.ts@@ -16,14 +16,14 @@ for (const e of research) byId.set(`${e.provider}:${e.endpoint}`, { ...byId.get(function fieldsOf(map: FieldMap): string[] {const out: string[] = [];for (const [k, v] of Object.entries(map)) {- if (k === "fixed" || k === "seedRange" || k === "maskFormat") continue;+ if (k === "fixed" || k === "defaults" || k === "seedRange" || k === "maskFormat") continue;if (typeof v === "string") out.push(v);else if (v && typeof v === "object") {const o = v as Record<string, unknown>;for (const f of ["key", "background", "shotType", "flag"]) if (typeof o[f] === "string") out.push(o[f] as string);}}- return [...out, ...Object.keys(map.fixed ?? {})].map((f) => f.split(".")[0].replace("[]", ""));+ return [...out, ...Object.keys(map.fixed ?? {}), ...Object.keys(map.defaults ?? {})].map((f) => f.split(".")[0].replace("[]", ""));}/** The models this round added (research part 3), with the operation each is for. */@@ -37,8 +37,8 @@ const ROUND3: Record<string, Operation> = {"recraft-vectorize": "vectorize",image2svg: "vectorize","recraft-4-1-pro": "t2i",- "recraft-4-style": "t2i",- "recraft-4-style-pro": "t2i",+ "recraft-4-style": "edit",+ "recraft-4-style-pro": "edit","ideogram-3": "t2i","krea-2-style": "edit","flux-redux-ultra": "edit",@@ -223,11 +223,12 @@ describe("round-3 payloads", () => {image_url: "bottle.png",ref_image_url: "scene.png",});- expect(buildPayload(route("recraft-4-style", "t2i").map!, { prompt: "a fox", styleId: "st-123", aspectRatio: "16:9" })).toEqual({+ expect(buildPayload(route("recraft-4-style", "edit").map!, { prompt: "a fox", images: ["a.png", "b.png"], aspectRatio: "16:9" })).toEqual({prompt: "a fox",- style_id: "st-123",+ image_urls: ["a.png", "b.png"],image_size: "landscape_16_9",});+ expect(buildPayload(route("recraft-4-style", "edit").map!, { prompt: "a fox", images: ["a.png"], styleId: "st-123" })).toMatchObject({ style_id: "st-123" });expect(buildPayload(route("qwen-image-layered-cloud").map!, { prompt: "a poster", images: ["a.png"], numLayers: 6 })).toEqual({ prompt: "a poster", image_url: "a.png", num_layers: 6 });expect(buildPayload(route("qwen-image-layered-cloud", "layers", "replicate").map!, { prompt: "a poster", images: ["a.png"], numLayers: 6 })).toEqual({description: "a poster",diff --git a/tests/outputs.test.ts b/tests/outputs.test.tsindex e9fe0871..ee0be9fe 100644--- a/tests/outputs.test.ts+++ b/tests/outputs.test.ts@@ -1,5 +1,5 @@import { describe, expect, it } from "vitest";-import { extractOutputs, textDataUri, wordsToCues } from "@/lib/catalog/payload";+import { extractOutputs, noOutputsError, textDataUri, wordsToCues } from "@/lib/catalog/payload";// Response fixtures follow docs/research/paid-model-apis-3.json → outputFields / outputShape of each endpoint.const file = (url: string, content_type?: string) => ({ url, file_name: url.split("/").pop(), file_size: 1234, ...(content_type ? { content_type } : {}) });@@ -155,6 +155,17 @@ describe("transcripts", () => {expect(extractOutputs({ text: "A red mug on a table." })).toMatchObject([{ kind: "text", text: "A red mug on a table." }]);expect(extractOutputs({ output: ["A ", "red ", "mug"] })).toMatchObject([{ kind: "text", text: "A red mug" }]);expect(extractOutputs({ seed: 1, timings: {} })).toEqual([]);+ // Text operations answer in text too; a plain answer has no empty cue list in its meta.+ expect(extractOutputs({ text: "Hola." }, "translate")).toMatchObject([{ kind: "text", text: "Hola.", meta: {} }]);+ expect(extractOutputs({ text: "Hola." }, "transcribe")[0].meta).toEqual({});+ });++ it("a media operation's text-only answer (a refusal) is no result, and its words become the error", () => {+ const refusal = { images: [], text: "Sorry, I can't make that." };+ expect(extractOutputs(refusal, "t2i")).toEqual([]);+ expect(extractOutputs({ output: "I can't help with that." }, "t2v")).toEqual([]);+ expect(noOutputsError(refusal)).toBe("The model replied: Sorry, I can't make that.");+ expect(noOutputsError({ seed: 1 })).toMatch(/^No media in response: \{"seed":1\}/);});});@@ -200,10 +211,11 @@ describe("3D models, stems and other extras", () => {]);});- it("keeps Recraft's new style id and labels Bria's matte", () => {+ it("keeps Recraft's new style id and puts Bria's matte on the cut-out", () => {expect(extractOutputs({ images: [file("https://v3.fal.media/files/a.png", "image/png")], style_id: "style-9" }, "t2i")[0].meta).toEqual({ styleId: "style-9" });const cut = extractOutputs({ image: file("https://v3.fal.media/files/cut.png", "image/png"), mask: file("https://v3.fal.media/files/mask.png", "image/png") }, "edit");- expect(cut.map((o) => o.meta)).toEqual([undefined, { role: "mask" }]);+ // One result in the feed: the matte rides along instead of being a second picture.+ expect(cut).toEqual([{ url: "https://v3.fal.media/files/cut.png", kind: "image", contentType: "image/png", meta: { mask: "https://v3.fal.media/files/mask.png" } }]);});it("plain media responses come back unchanged", () => {diff --git a/tests/pipeline.test.ts b/tests/pipeline.test.tsindex ee62fb15..2bcc502a 100644--- a/tests/pipeline.test.ts+++ b/tests/pipeline.test.ts@@ -67,7 +67,7 @@ describe("createPipeline validation", () => {setSetting("falKey", "fal-test-key");try {// The fixtures run on fal (now "connected"); the LLM has nothing to run on.- expect(() => createPipeline([step("words", "test-transcribe"), { ...step("es", "text-llm", { op: "translate", params: { targetLanguage: "Spanish" } }), after: "words", chain: [{ slot: "prompt" }] }])).toThrow(+ expect(() => createPipeline([step("words", "test-transcribe", { inputs: { audio: "/api/files/placeholder.wav" } }), { ...step("es", "text-llm", { op: "translate", params: { targetLanguage: "Spanish" } }), after: "words", chain: [{ slot: "prompt" }] }])).toThrow(/Step “es” would run as a demo \(Claude needs Claude or Ollama\)/,);expect(() => assertOneMode([{ label: "Joining clips", modelId: "join-clips", op: "concat" }, { label: "Writing", modelId: "text-llm", op: "write" }])).toThrow(/Writing needs Claude or Ollama/);