Sort providers by metric on AI Gateway: ▪︎ 𝚜𝚘𝚛𝚝: '𝚌𝚘𝚜𝚝' → cheapest first ▪︎ 𝚜𝚘𝚛𝚝: '𝚝𝚝𝚏𝚝' → lowest latency first ▪︎ 𝚜𝚘𝚛𝚝: '𝚝𝚙𝚜' → highest throughput first https://t.co/BwcAn8SFsy
Vercel AI Gateway Automates Provider Selection Based on Cost and Performance
Vercel· Updated
Vercel added a programmatic sort feature to its AI Gateway that ranks model providers by cost, latency, or throughput at the request level. This update moves the logic of AI economics into the infrastructure layer, allowing applications to automatically route to the cheapest or fastest available provider without code changes.
sort capability for its AI Gateway. This service allows developers to rank the multiple providers hosting a single model using specific metrics like cost (lowest price), ttft (time to first token latency), or tps (tokens per second throughput).As inference (running a model to generate outputs) becomes commoditized, the same model is often available through dozens of hosts with fluctuating pricing. This update mirrors an industry shift toward automated routing, similar to OpenRouter's Pareto Code or Warp's open-weight model selection, where infrastructure handles the best bang-for-the-buck calculus.
You can implement this by adding a sort parameter to providerOptions.gateway within the Vercel AI SDK. The AI Gateway computes rankings at request time, automatically bypassing degraded providers. This is particularly useful for Vercel's agentic workload index where high token volumes make margin optimization a primary engineering requirement.
Still wondering? A few quick answers below.
Every HeadsUpAI update is written based on its original source and reviewed before it's published. Read our editorial standards →

