Routing across model providers 00:00:01 An invoice almost outlives its deadline One invoice enters a gateway with a regional processing rule and a request for a typed amount. Three providers are ready. One lies outside the allowed region and another is running slowly. Bea needs a route that satisfies both time and scope. A provider gateway chooses an execution path for each request. First remove routes that violate hard requirements such as data residency, supported modalities or a required structured-output contract. Then compare feasible routes using a quality estimate, remaining deadline, expected retries and price. A model that is cheap per token can be expensive per accepted invoice. First remove the ineligible route. Subtract the time already spent before deciding whether a second attempt can finish under the remaining deadline. A new connection does not reset the customer's clock. 00:00:57 Preserve one billing identity A router may use a learned predictor of relative model quality or simple task rules. A policy filter placed ahead of that optimization prevents an apparently cheap route from silently moving private data into a prohibited region. A US-only route is healthy and inexpensive, but is absent from the candidate set for an EU-only invoice. Reserve enough time for the alternative to finish. Propagate cancellation and record whether any user-visible output or external action has already occurred. A retry after partial streaming needs an explicit continuation or replacement policy. With 450 milliseconds remaining, a fallback whose measured service time is 700 milliseconds would miss the deadline even with an empty queue. Divide all attempt costs, including failed attempts, by the count of accepted tasks. Track the denominator by route and request type. A shift toward easy requests can otherwise look like a routing improvement. One hundred invoices cost 2 dollars in total across providers. If only eighty pass validation, the observed cost is 0.025 dollars per accepted invoice. Keep a record of the decision and the resolved model version. Instrument attempts separately from the business task so retries count toward cost but never count as extra successful tasks. While an unhealthy route recovers, a circuit breaker limits new attempts. If no eligible route remains, the system needs an explicit deferred or human-review outcome. 00:02:34 Trace one eligible retry The tenant requires EU processing and a typed amount field. A third provider fails residency and never receives the input. A fresh request takes the fast route. After a timeout the remaining budget and circuit state determine whether another attempt can still finish. The permitted alternative decodes the receipt under its own schema support. The gateway validates value and currency before counting the result. Both attempts share one business ID. Record both costs, one completion and the end-to-end latency. 00:03:09 Which route still has time? Only an out-of-region route can meet the deadline. Which response respects the contract? A latency target cannot override the policy defining where the data may be processed. Keep total attempts, provider costs and one accepted invoice on the same receipt. The fastest available provider is useful only while it can honor the request's data, output and time constraints.