Context
PR #194 added model-rules.ts with per-model Zod schemas to normalize duration values before sending to providers. Currently ModelDurationRules only handles duration — but there are many other model-specific input constraints in the if/else chains in fal.ts (lines 520-720).
What needs to happen
Expand model-rules.ts into full provider input schemas that validate and normalize all model-specific fields:
aspect_ratio — some models use video_size instead, some restrict to specific ratios
resolution — Grok Imagine defaults "720p"
generate_audio — Kling v3/v2.6 and LTX-2 default to true
delete_video — Sora 2 needs false to keep URLs accessible
video_size — LTX-2 uses this instead of aspect_ratio
num_frames — LTX-2 converts duration * fps to frame count
end_image_url — supported by Kling v3/v2.6 and LTX-2
Once complete, rename ModelDurationRules → ModelInputRules and consolidate the remaining if/else logic in fal.ts into the Zod schemas.
Related
- Gateway companion issue: vargHQ/gateway#88
- Current implementation:
src/ai-sdk/providers/model-rules.ts
Context
PR #194 added
model-rules.tswith per-model Zod schemas to normalizedurationvalues before sending to providers. CurrentlyModelDurationRulesonly handles duration — but there are many other model-specific input constraints in theif/elsechains infal.ts(lines 520-720).What needs to happen
Expand
model-rules.tsinto full provider input schemas that validate and normalize all model-specific fields:aspect_ratio— some models usevideo_sizeinstead, some restrict to specific ratiosresolution— Grok Imagine defaults"720p"generate_audio— Kling v3/v2.6 and LTX-2 default totruedelete_video— Sora 2 needsfalseto keep URLs accessiblevideo_size— LTX-2 uses this instead ofaspect_rationum_frames— LTX-2 convertsduration * fpsto frame countend_image_url— supported by Kling v3/v2.6 and LTX-2Once complete, rename
ModelDurationRules→ModelInputRulesand consolidate the remainingif/elselogic infal.tsinto the Zod schemas.Related
src/ai-sdk/providers/model-rules.ts