If you are exposing AI video generation as an API, you will eventually face upstream instability. The robust answer is multi-upstream routing: map one internal model code to several real providers, and switch automatically.
A minimal routing layer needs:
- A model registry (code -> list of upstreams with prices and capabilities).
- A health signal per upstream (recent success rate, latency).
- A retry policy with backoff and a hard attempt cap.
- A task ledger that records which upstream produced which result.
Design tips:
- Keep the model code stable for callers. Internally resolve it to a route; do not make clients care which upstream won.
- Lower-cost routes can be tried first, premium routes as fallback — or the reverse, depending on your SLA.
- Always reconcile terminal states. A task stuck in 'running' should be swept and resolved, not left burning credits.
Multi-upstream routing turns a brittle integration into a dependable service. For AI video, where generation is slow and expensive, that dependability is everything.
