Reference images, video clips, and audio are what turn a generic text-to-video call into controlled, consistent output. But when you route across multiple upstreams, reference handling gets tricky.

The challenge: every provider names reference fields differently. One wants image_urls, another reference_image, another a multipart array. A routing layer should normalize this.

A practical approach:

  • Accept a single canonical payload from your caller (images[], videos[], audios[]).
  • Per upstream, translate to that provider's field names.
  • Enforce per-route limits (count, file size, total duration) before submit — not after.
  • On failover, re-translate the same canonical payload for the next route.

Also watch out for ordering: many models map 'Image 1 / Image 2' references to the order of uploaded files. A careless reorder during failover silently changes the meaning of the prompt.

Get normalization right and multi-route generation becomes transparent: your users supply references once, and every upstream receives them in the shape it expects.

ai #video #api #python #tutorial