Skip to content

armgit / fuobe

Public Imported from GitHub
0

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

Fixes 5: Happy Horse video edit costs $0.28 a second of clip at 720p, not twice that

Claude554ea768ec6b
diff --git a/docs/research/paid-model-apis-3.json b/docs/research/paid-model-apis-3.json
index d46b2dfd..d1b950b7 100644
--- a/docs/research/paid-model-apis-3.json
+++ b/docs/research/paid-model-apis-3.json
@@ -8635,12 +8635,13 @@
"price": "For every second of 720p video you generated, you will be charged $0.28/second ($0.14 per input second and 0.14 per output second). For 1080p video you will be charged $0.56/second.",
"pricing": {
"usd": 0.28,
- "unit": "second (720p, input+output)",
- "note": "For every second of 720p video you generated, you will be charged $0.28/second ($0.14 per input second and 0.14 per output second). For 1080p video you will be charged $0.56/second."
+ "unit": "second (720p, per second of the clip: $0.14 per input second + $0.14 per output second, already summed)",
+ "note": "For every second of 720p video you generated, you will be charged $0.28/second ($0.14 per input second and 0.14 per output second). For 1080p video you will be charged $0.56/second.",
+ "correction": "2026-10-29 (fixes-5): $0.28/s (720p) and $0.56/s (1080p) are the whole price per second of the clip, input and output halves together; an earlier reading billed the input seconds again on top (about twice the real price)."
},
"replicateEquivalent": null,
"license": "commercial",
- "notes": "Takes 3-60 s sources (the longest window of any edit model found), <=5 reference images (@Image1..), audio_setting auto|origin (keep the original track). $0.28/s at 720p (input+output seconds), $0.56/s at 1080p. Best fit for Shorts Studio's 'restyle your footage' without splitting.",
+ "notes": "Takes 3-60 s sources (the longest window of any edit model found), <=5 reference images (@Image1..), audio_setting auto|origin (keep the original track). $0.28/s at 720p, $0.56/s at 1080p, per second of the clip (fal's $0.14 per input second + $0.14 per output second, already summed; corrected 2026-10-29). The output matches the input but is capped at 15 s (longer inputs are cut to their first 15 s), so cut longer clips first. Best fit for Shorts Studio's 'restyle your footage' without splitting.",
"verified": true,
"sourceUrl": "https://fal.ai/models/alibaba/happy-horse/video-edit/api",
"schemaUrl": "https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=alibaba/happy-horse/video-edit",
diff --git a/docs/research/paid-model-apis-3.md b/docs/research/paid-model-apis-3.md
index 54adae03..dbe23e71 100644
--- a/docs/research/paid-model-apis-3.md
+++ b/docs/research/paid-model-apis-3.md
@@ -49,7 +49,7 @@ This was checked on a scratch copy of the script:
| **Cinema Studio: Soul Cast (AI actors)** | `higgsfield:higgsfield-ai/soul/v2/standard (cast prompt compiled from the 17 fields)` | prompt from the Soul Cast form; batch up to 10 | higgsfield:higgsfield/ai-influencer (character sheet); fal-ai/instant-character (keep a cast member consistent from one photo); fal-ai/nano-banana-pro |
| **Cinema Studio: Soul Location** | `bytedance/seedream/v5/pro/text-to-image (16:9 empty set; part 1)` | prompt <=2,500 chars; another view = horizontal_angle/vertical_angle/zoom on the set image | fal-ai/qwen-image-edit-2511-multiple-angles ('another view'); fal-ai/image-editing/scene-composition (place the cast in the set); higgsfield:higgsfield-ai/soul/cinema |
| **Cinema Studio: 3D scene blocking -> shot** | `minimax/h3-max/3d-to-video` | video_url (Blender proxy <=15 s), prompt, reference_image_urls, resolution 480P\|768P\|1080P | fal-ai/qwen-image-edit-2511-multiple-angles (re-render a still from the chosen camera); image-to-3d: fal-ai/hunyuan-3d/v3.1/pro/image-to-3d |
-| **Shorts Studio (restyle your footage: <=2 min in, <=10 s segments out)** | `google/gemini-omni-flash/v1.1/edit (part 1; the model Higgsfield's Shorts Studio runs on)` | pipeline: fal-ai/ffmpeg-api/metadata (validate 4-120 s, <=200 MB) -> fal-ai/workflow-utilities/trim-video (start_time,end_time per <=10 s segment) -> edit model (video_url, prompt = preset text, style reference images) -> fal-ai/workflow-utilities/scale-video (9:16 or 16:9) -> fal-ai/ffmpeg-api/merge-videos ('stitch') -> fal-ai/workflow-utilities/auto-subtitle (type presets) | alibaba/happy-horse/video-edit (3-60 s sources, no split needed); decart/lucy-edit/pro; replicate:decart/lucy-edit-2 ($0.04/s); fal-ai/kling-video/o3/pro/video-to-video/edit (part 1) / fal-ai/kling-video/o3/4k/video-to-video/edit; luma/agent/ray/v3.2/video-to-video (part 2); replicate:runwayml/aleph-2; replicate:wan-video/wan-2.7-videoedit; xai/grok-imagine-video/edit-video (<=8 s); fal-ai/bernini-r/reference-edit-video; higgsfield:higgsfield/genjutsu/restyle/v1.0 (Higgsfield's own preset restyle) |
+| **Shorts Studio (restyle your footage: <=2 min in, <=10 s segments out)** | `google/gemini-omni-flash/v1.1/edit (part 1; the model Higgsfield's Shorts Studio runs on)` | pipeline: fal-ai/ffmpeg-api/metadata (validate 4-120 s, <=200 MB) -> fal-ai/workflow-utilities/trim-video (start_time,end_time per <=10 s segment) -> edit model (video_url, prompt = preset text, style reference images) -> fal-ai/workflow-utilities/scale-video (9:16 or 16:9) -> fal-ai/ffmpeg-api/merge-videos ('stitch') -> fal-ai/workflow-utilities/auto-subtitle (type presets) | alibaba/happy-horse/video-edit (3-60 s sources, but at most 15 s out: split longer clips; corrected 2026-10-29); decart/lucy-edit/pro; replicate:decart/lucy-edit-2 ($0.04/s); fal-ai/kling-video/o3/pro/video-to-video/edit (part 1) / fal-ai/kling-video/o3/4k/video-to-video/edit; luma/agent/ray/v3.2/video-to-video (part 2); replicate:runwayml/aleph-2; replicate:wan-video/wan-2.7-videoedit; xai/grok-imagine-video/edit-video (<=8 s); fal-ai/bernini-r/reference-edit-video; higgsfield:higgsfield/genjutsu/restyle/v1.0 (Higgsfield's own preset restyle) |
| **Mixed Media (stylized VFX looks on video)** | `fal-ai/workflow-utilities/extract-nth-frame -> fal-ai/telestyle-v2 (per frame, fixed seed) -> fal-ai/ffmpeg-api/images-to-video -> fal-ai/ffmpeg-api/merge-audio-video` | extract-nth-frame: video_url, frame_interval (source fps / target fps), max_frames <=500; images-to-video: images[{url, frames}] (<=200) + fps | fal-ai/ltx-2.3-22b/reference-video-to-video (preprocessor depth\|canny\|pose + restyled first frame image_url); fal-ai/ltx-2.3-quality/reference-video-to-video; decart/lucy-edit/pro; fal-ai/ltx-2.3-quality/render-to-real; fal-ai/workflow-utilities/blend-video (grain/light-leak overlays); per-frame editor alternatives: fal-ai/nano-banana-2/edit, fal-ai/flux-pro/kontext (part 1); minimax/h3-max/styles/* (generation in VHS/16-bit/hand-drawn/low-poly/retro-toon looks) |
| **Video trimming / splitting / assembly utilities** | `fal-ai/workflow-utilities/trim-video` | trim: video_url, start_time, end_time (or duration); compose: tracks[{id,type,keyframes[{url,timestamp ms,duration ms}]}] -> video_url | fal-ai/ffmpeg-api/merge-videos; fal-ai/ffmpeg-api/compose (timeline with audio tracks); fal-ai/workflow-utilities/scale-video; fal-ai/workflow-utilities/reverse-video; fal-ai/workflow-utilities/extract-audio; fal-ai/ffmpeg-api/extract-frame; fal-ai/ffmpeg-api/metadata; fal-ai/ffmpeg-api/loudnorm |
| **Transcription** | `fal-ai/elevenlabs/speech-to-text/scribe-v2` | audio_url, language_code, diarize, keyterms -> text + words[{text,start,end,type,speaker_id}] | fal-ai/whisper (word chunks, diarize); fal-ai/wizper; replicate:elevenlabs/scribe-v2; replicate:victor-upmeet/whisperx; replicate:xai/grok-speech-to-text; fal-ai/elevenlabs/forced-alignment (known script -> word timings) |
@@ -214,7 +214,7 @@ Replicate's Recraft V4.1 and the Ideogram 4/4.5 endpoints (fal and Replicate) ha
| `fal-ai/kling-video/o3/4k/video-to-video/edit` | fal | restyle | `prompt`*, `video_url`*, `image_urls`, `elements`, `keep_audio` | `video.url` | $0.42/second | 4K output of Kling O3 edit (the pro/standard edit endpoints are in part 1). Reference the source as @Video1, images as @Image1.. (max 4 images+elements). Source .mp4/.mov 3-15 s, 720-3840 px, <=200 MB. $0.42/s. |
| `fal-ai/kling-video/o3/4k/video-to-video/reference` | fal | ref2v | `prompt`*, `video_url`*, `image_urls`, `elements`, `keep_audio`, `aspect_ratio`, `duration` | `video.url` | $0.42/second | New video that takes camera/motion/style from the reference video (Ad Multiplier 'same ad, new product'). duration is a STRING enum '3'..'15'. |
| `xai/grok-imagine-video/edit-video` | fal | restyle | `prompt`*, `video_url`*, `resolution` | `video.url` | $0.05/second of output (+$0.01 per second of input, 480p) | Text-instructed edit. The source is resized to <=854x480 area and TRUNCATED TO 8 s, so split Shorts Studio clips first. $0.05/s output + $0.01/s input at 480p. |
-| `alibaba/happy-horse/video-edit` | fal | restyle | `prompt`*, `video_url`*, `reference_image_urls`, `resolution`, `audio_setting`, `seed` | `video.url` | $0.28/second (720p, input+output) | Takes 3-60 s sources (the longest window of any edit model found), <=5 reference images (@Image1..), audio_setting auto\|origin (keep the original track). $0.28/s at 720p (input+output seconds), $0.56/s at 1080p. |
+| `alibaba/happy-horse/video-edit` | fal | restyle | `prompt`*, `video_url`*, `reference_image_urls`, `resolution`, `audio_setting`, `seed` | `video.url` | $0.28/second of the clip (720p; $0.14 per input second + $0.14 per output second, already summed) | Takes 3-60 s sources, but the output is capped at 15 s (longer inputs are cut to their first 15 s), <=5 reference images (@Image1..), audio_setting auto\|origin (keep the original track). $0.28/s at 720p, $0.56/s at 1080p, per second of the clip. *Corrected 2026-10-29: the input seconds are not billed again on top, and the 15 s output cap was missed.* |
| `fal-ai/bernini-r/edit-video` | fal | restyle | `prompt`*, `video_url`*, `negative_prompt`, `seed` | `video.url` | $0.08/second | Instruction edit on open Bernini-R weights (also in Fuobe's ComfyUI library for relight). num_frames 5-121 (4k+1), fps 4-30, max_image_size 256-1280 (848 default). $0.08/s at 848 px, x0.5 <=576, x2 at 1280. |
| `fal-ai/bernini-r/reference-edit-video` | fal | restyle | `prompt`*, `video_url`*, `reference_image_urls`*, `negative_prompt`, `seed` | `video.url` | $0.08/second | Edit guided by 1-5 reference images (e.g. a style frame or a product). Same pricing as edit-video. |
| `minimax/h3-max/recast` | fal | character-swap | `video_url`*, `reference_image_urls`*, `prompt`, `resolution`, `seed` | `video.url` | $0.3/second | Replace the people in a 5-30 s video (no shot >15 s) with 1-4 new people (one photo each, left-to-right by default; prompt says who becomes whom). For Ad Multiplier 'change cast'. $0.30/s 768P, $0.45/s 1080P. |
@@ -245,7 +245,7 @@ Replicate's Recraft V4.1 and the Ideogram 4/4.5 endpoints (fal and Replicate) ha
| Model | Source length | Refs | Keeps audio | $/s (default res) |
|---|---|---|---|---|
-| `alibaba/happy-horse/video-edit` | **3-60 s** | ≤5 images | `audio_setting: origin` | 0.28 (720p) |
+| `alibaba/happy-horse/video-edit` | **3-60 s** in, at most 15 s out (corrected 2026-10-29) | ≤5 images | `audio_setting: origin` | 0.28 (720p; input and output halves together) |
| Replicate `runwayml/aleph-2` | 2-30 s (<16 MB) | ≤5 edited keyframes | (unspecified) | 0.336 |
| `minimax/h3-max/recast` (cast swap) | 5-30 s | 1-4 people | yes | 0.30 (768P) |
| `fal-ai/kling-video/o3/{pro,4k}/video-to-video/edit` | 3-15 s | ≤4 images/elements | `keep_audio` | 0.42 (4K); pro/std in part 1 |
diff --git a/scripts/gen-cloud-models.py b/scripts/gen-cloud-models.py
index 2f46c3d1..04f03aaa 100644
--- a/scripts/gen-cloud-models.py
+++ b/scripts/gen-cloud-models.py
@@ -710,10 +710,13 @@ model("wan-vace-reframe", "Wan VACE Reframe (hosted)", "Alibaba Wan", "wan", "vi
[("reframe", "fal-ai/wan-vace-14b/reframe")], defaults={"aspectRatio": "9:16"})
# ----- Video restyle / edit (research part 3; Shorts Studio, Mixed Media, Ad Multiplier)
+# fal: "$0.28/second ($0.14 per input second and 0.14 per output second)" at 720p, $0.56 at 1080p: the whole price
+# per second of the clip, both halves already summed (fixes-5: it was charged twice over, input seconds again on top).
+# The output matches the input, capped at 15 s.
model("happy-horse-video-edit", "Happy Horse Video Edit", "Alibaba", "happy-horse", "video",
- "Restyle or swap things in 3–60 s clips, with up to 5 reference images",
+ "Restyle or swap things in 3–15 s clips, with up to 5 reference images",
[("v2v", "alibaba/happy-horse/video-edit")], badges=["new", "audio"], defaults={"resolution": "720p"},
- pricing=("second", 0.28, "720p, input + output seconds; 1080p $0.56", {"byResolution": {"720p": 0.28, "1080p": 0.56}, "inputSeconds": True}),
+ pricing=("second", 0.28, "720p, input and output seconds together; 1080p $0.56", {"byResolution": {"720p": 0.28, "1080p": 0.56}}),
controls=[("audio_setting", "Audio")])
# Happy Horse 1.1 (build plan O7): fal hosts Alibaba's three endpoints (partnerEndpoints, read
# 2026-10-27): $0.14/s at 720p, $0.18/s at 1080p; 3-15 s; up to 9 reference images.
@@ -1996,7 +1999,7 @@ for m in M:
pricing = None
if m["pricing"]:
u, usd, *rest = m["pricing"]
- # Optional: a note, then extra Pricing fields (byResolution, inputSeconds).
+ # Optional: a note, then extra Pricing fields (byResolution, factors, …).
note = [x for x in rest if isinstance(x, str)]
extra = next((x for x in rest if isinstance(x, dict)), {})
pricing = {"unit": u, "usd": usd, **({"note": note[0]} if note else {}), **extra}
diff --git a/src/lib/catalog/cloud-models.generated.ts b/src/lib/catalog/cloud-models.generated.ts
index 6d728157..2787884b 100644
--- a/src/lib/catalog/cloud-models.generated.ts
+++ b/src/lib/catalog/cloud-models.generated.ts
@@ -7582,7 +7582,7 @@ export const CLOUD_MODELS: ModelDef[] = [
"family": "happy-horse",
"engine": "cloud",
"kind": "video",
- "tagline": "Restyle or swap things in 3\u201360 s clips, with up to 5 reference images",
+ "tagline": "Restyle or swap things in 3\u201315 s clips, with up to 5 reference images",
"routes": [
{
"op": "v2v",
@@ -7623,12 +7623,11 @@ export const CLOUD_MODELS: ModelDef[] = [
"pricing": {
"unit": "second",
"usd": 0.28,
- "note": "720p, input + output seconds; 1080p $0.56",
+ "note": "720p, input and output seconds together; 1080p $0.56",
"byResolution": {
"720p": 0.28,
"1080p": 0.56
- },
- "inputSeconds": true
+ }
}
},
{
diff --git a/src/lib/catalog/genjutsu.ts b/src/lib/catalog/genjutsu.ts
index 207af1ea..c2d70414 100644
--- a/src/lib/catalog/genjutsu.ts
+++ b/src/lib/catalog/genjutsu.ts
@@ -535,7 +535,7 @@ export const MAKERS: Maker[] = [
engine: "cloud",
modes: ["restyle"],
label: "Happy Horse Video Edit",
- note: "Closed model · reads up to 4 of the look's images · billed on the clip's seconds too",
+ note: "Closed model · reads up to 4 of the look's images · pieces of up to 10 s",
source: "partner",
refs: { min: 0, max: 0 },
keepsSound: false,
diff --git a/src/lib/catalog/marketing.ts b/src/lib/catalog/marketing.ts
index 8bf57a9b..d3b4f00d 100644
--- a/src/lib/catalog/marketing.ts
+++ b/src/lib/catalog/marketing.ts
@@ -1036,8 +1036,8 @@ export const MULTIPLIER_MODELS: Record<Engine, ModelChoice[]> = {
/**
* The longest part of the reference a cloud edit model recreates (docs/research/paid-model-apis-3/4.json): Kling O3's
- * edit takes 3–15 s clips; Happy Horse's takes up to 60 s but returns at most the first 15 s (and bills the input
- * seconds too). A longer selection is cut to its first seconds, and the run says so.
+ * edit takes 3–15 s clips; Happy Horse's takes up to 60 s but returns at most the first 15 s. A longer selection is
+ * cut to its first seconds (so no second is sent that doesn't come back), and the run says so.
*/
export const MULTIPLIER_WINDOW: Readonly<Record<string, number>> = { "kling-o3": 15, "happy-horse-video-edit": 15 };
diff --git a/src/lib/catalog/plan.ts b/src/lib/catalog/plan.ts
index 8c24ce22..ce068e0c 100644
--- a/src/lib/catalog/plan.ts
+++ b/src/lib/catalog/plan.ts
@@ -696,7 +696,7 @@ export function estimateCost(model: ModelDef, params: GenParams, jobs = 1, op?:
const seconds = clip ?? voice ?? params.duration ?? model.defaults?.duration ?? 5;
const mp = p.videoMegapixel ? videoMegapixels(model, params, seconds) : undefined;
const rate = p.videoMegapixel && (withLoras && p.videoMegapixel.withLoras !== undefined ? p.videoMegapixel.withLoras : p.videoMegapixel.usd);
- per = mp !== undefined && rate ? Math.ceil(mp - 1e-9) * rate : usd * seconds * (p.inputSeconds ? 2 : 1);
+ per = mp !== undefined && rate ? Math.ceil(mp - 1e-9) * rate : usd * seconds;
}
if (p.unit === "minute") per = (usd * (voice ?? params.duration ?? 60)) / 60;
// Settings that change the price (60 fps, a Pro tier, a cheaper model).
diff --git a/src/lib/catalog/shorts-models.ts b/src/lib/catalog/shorts-models.ts
index b71c120c..0f543fae 100644
--- a/src/lib/catalog/shorts-models.ts
+++ b/src/lib/catalog/shorts-models.ts
@@ -50,7 +50,8 @@ export function reframes(modelId: string, engine?: Engine): boolean {
*/
const SOURCE_SECONDS: Record<string, { min?: number; max?: number }> = {
"kling-o3-4k-edit": { min: 3, max: 15 },
- "happy-horse-video-edit": { min: 3, max: 60 },
+ // It reads 3–60 s but returns at most the first 15 s.
+ "happy-horse-video-edit": { min: 3, max: 15 },
"runway-aleph-2": { min: 2, max: 30 },
"wan-2-7": { min: 2, max: 10 },
// Higgsfield feeds Gemini Omni Flash ≤10 s segments.
@@ -87,8 +88,8 @@ export interface RestyleModelInfo {
}
/**
- * What one unit costs at the resolution the studios ask for, counting input seconds when the model bills them. Fuobe
- * Shorts in the cloud bills frames ÷ 16 as seconds: a second of a 30 fps clip, the common case, is shown.
+ * What one unit costs at the resolution the studios ask for. Fuobe Shorts in the cloud bills frames ÷ 16 as seconds:
+ * a second of a 30 fps clip, the common case, is shown.
*/
export function unitPrice(m: ModelDef): number | null {
const p = m.pricing;
@@ -96,7 +97,7 @@ export function unitPrice(m: ModelDef): number | null {
const res = resolutionFor(m.id, m.engine) ?? m.defaults?.resolution;
const usd = (res && p.byResolution?.[res]) || p.usd;
if (m.id === SHORTS_ORIGINAL && p.unit === "second") return (usd * SHORTS.original.maxFps) / SHORTS.original.billFps;
- return p.unit === "second" && p.inputSeconds ? usd * 2 : usd;
+ return usd;
}
const UNIT: Record<string, string> = { second: "s", megapixel: "MP" };
diff --git a/src/lib/catalog/types.ts b/src/lib/catalog/types.ts
index 89c2753e..41384943 100644
--- a/src/lib/catalog/types.ts
+++ b/src/lib/catalog/types.ts
@@ -589,8 +589,6 @@ export interface Pricing {
note?: string;
/** The price per unit at each resolution (params.resolution), when it differs (Gemini Omni Flash: 360p $0.03/s … 4K $0.30/s); `usd` is the default resolution's. */
byResolution?: Record<string, number>;
- /** Billed on the input clip's seconds as well as the output's (Happy Horse video edit): a restyle costs about twice the clip's length. */
- inputSeconds?: boolean;
/**
* A launch price that runs to the end of `until` (UTC, YYYY-MM-DD); `usd` / `byResolution` are the list
* prices after it. The catalog applies whichever holds when it loads (FLUX 3 Max: $0.0425/s until 2026-11-07, then $0.17/s).
diff --git a/tests/marketing-api.test.ts b/tests/marketing-api.test.ts
index b51d9ca1..accf57d8 100644
--- a/tests/marketing-api.test.ts
+++ b/tests/marketing-api.test.ts
@@ -429,7 +429,7 @@ describe("Ad Multiplier", () => {
const imgs = [upload("a.png"), upload("b.png")];
const v = video();
const hh = mk.planMultiplier({ engine: "cloud", video: v, duration: 30, images: imgs, mode: "prompt", prompt: "Swap the bottle for @image_2", quality: "720p", modelId: "happy-horse-video-edit" }, {});
- // The first 15 s are cut first (Happy Horse returns at most 15 s and bills the input seconds too).
+ // The first 15 s are cut first (Happy Horse returns at most 15 s).
expect(hh.steps.map((s) => s.key)).toEqual(["clip", "edit"]);
expect(hh.steps[0].request.params).toEqual({ startTime: 0, endTime: 15 });
expect(hh.notes.join(" ")).toMatch(/Happy Horse Video Edit recreates up to 15 s: the first 15 s of your selection are used/);
diff --git a/tests/shorts-pricing.test.ts b/tests/shorts-pricing.test.ts
index 8267373f..92561516 100644
--- a/tests/shorts-pricing.test.ts
+++ b/tests/shorts-pricing.test.ts
@@ -1,5 +1,6 @@
import { describe, expect, it } from "vitest";
import { getModel } from "@/lib/catalog";
+import { getMaker, planGenjutsu } from "@/lib/catalog/genjutsu";
import { MIXED_MODELS, MIXED_PRESETS, defaultValues, mixedFrames, planMixed, type MixedPlanInput } from "@/lib/catalog/mixed-media";
import { estimateCost, routesFor } from "@/lib/catalog/plan";
import { clipLengthProblem, lookFromPreset, planCloudSegments, planShorts, SHORTS_MODELS, SHORTS_PRESETS, type ShortsPlanInput } from "@/lib/catalog/shorts";
@@ -31,11 +32,45 @@ describe("restyle prices", () => {
expect(modelInfos(["gemini-omni-flash"])[0].price).toBe("$0.10 / s");
});
- it("counts the input seconds for Happy Horse (billed on input + output): about twice the clip", () => {
+ it("prices Happy Horse video edit at $0.28 a second of clip at 720p: fal's $0.14 per input second plus $0.14 per output second, not twice that", () => {
const hh = getModel("happy-horse-video-edit")!;
- expect(estimateCost(hh, { resolution: "720p", duration: 10 })).toBeCloseTo(5.6);
- expect(estimateCost(hh, { resolution: "1080p", duration: 10 })).toBeCloseTo(11.2);
- expect(modelInfos(["happy-horse-video-edit"])[0].price).toBe("$0.56 / s");
+ expect(estimateCost(hh, { resolution: "720p", duration: 10 })).toBeCloseTo(2.8);
+ expect(estimateCost(hh, { resolution: "1080p", duration: 10 })).toBeCloseTo(5.6);
+ expect(unitPrice(hh)).toBeCloseTo(0.28);
+ expect(modelInfos(["happy-horse-video-edit"])[0].price).toBe("$0.28 / s");
+ // It reads up to 60 s but returns at most the first 15 s: a longer cut is refused before it's paid for.
+ expect(sourceSeconds("happy-horse-video-edit")).toEqual({ min: 3, max: 15 });
+ // Every studio that restyles on it pays $0.28 for each second of the selection at 720p (what they ask for).
+ const shortsPlan = planShorts(shorts({ modelId: "happy-horse-video-edit", maxRefs: 4, resolution: "720p" }));
+ const looks = shortsPlan.steps.filter((s) => s.request.modelId === "happy-horse-video-edit");
+ expect(looks).toHaveLength(5);
+ expect(looks.reduce((n, s) => n + estimateCost(hh, s.request.params!, 1, s.request.op)!, 0)).toBeCloseTo(0.28 * 47, 2);
+ const fast = planMixed({
+ engine: "cloud",
+ title: "Sketch · skate",
+ preset: MIXED_PRESETS[0],
+ values: defaultValues(MIXED_PRESETS[0]),
+ source: { url: "/api/files/skate.mp4", duration: 12, hasAudio: true },
+ range: { start: 1, end: 9 },
+ fps: 8,
+ resolution: "1K",
+ modelId: "happy-horse-video-edit",
+ mode: "fast",
+ }).steps.find((s) => s.request.modelId === "happy-horse-video-edit")!;
+ expect(estimateCost(hh, fast.request.params!, 1, fast.request.op)).toBeCloseTo(0.28 * 8, 2);
+ const genjutsu = planGenjutsu({
+ engine: "cloud",
+ mode: "restyle",
+ maker: getMaker("happy-horse-video-edit", "cloud")!,
+ title: "Genjutsu",
+ source: { url: "/api/files/clip.mp4", duration: 20, fps: 30, width: 1280, height: 720, hasAudio: true },
+ range: { start: 0, end: 20 },
+ quality: "720p",
+ references: [],
+ look: { kind: "preset", id: "shorts-claymation" },
+ }).steps.filter((s) => s.request.modelId === "happy-horse-video-edit");
+ expect(genjutsu.length).toBeGreaterThan(0);
+ expect(genjutsu.reduce((n, s) => n + estimateCost(hh, s.request.params!, 1, s.request.op)!, 0)).toBeCloseTo(0.28 * 20, 2);
});
it("never tells a restyle model a length: each keeps its clip's (Wan's 5 s default would cut segments short)", () => {