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
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.




