惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
Jina AI
Jina AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
美团技术团队
V
Visual Studio Blog
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
有赞技术团队
有赞技术团队
GbyAI
GbyAI
宝玉的分享
宝玉的分享
腾讯CDC
M
MIT News - Artificial intelligence
博客园 - 【当耐特】
Google DeepMind News
Google DeepMind News
月光博客
月光博客
MyScale Blog
MyScale Blog
Last Week in AI
Last Week in AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 司徒正美
Recent Announcements
Recent Announcements
MongoDB | Blog
MongoDB | Blog

Vercel News

Vercel Open Source Program: Winter 2026 cohort How Notion Workers run untrusted code at scale with Vercel Sandbox How we run Vercel's CDN in front of Discourse From idea to secure checkout in minutes with Stripe Building Slack agents can be easy Scaling redirects to infinity on Vercel Advancing Python typing Gamma builds design-first agents with Vercel How Avalara turns pipe dreams into patent-pending with v0 Keeping community human while scaling with agents How OpenEvidence built a healthcare AI that physicians actually trust Security boundaries in agentic architectures Skills Night: 69,000+ ways agents are getting smarter Video Generation with AI Gateway We Ralph Wiggumed WebStreams to make them 10x faster How Stably ships AI testing agents in hours, not weeks How we built AEO tracking for coding agents Anyone can build agents, but it takes a platform to run them Introducing Geist Pixel The Vercel AI Accelerator is back with $6m in credits Making agent-friendly pages with content negotiation The Vercel OSS Bug Bounty program is now available Introducing the new v0 Run untrusted code with Vercel Sandbox, now generally available How Stripe built a game-changing app in a single flight with v0 How Sensay went from zero to product in six weeks AGENTS.md outperforms skills in our agent evals Agent skills explained: An FAQ Testing if "bash is all you need" AWS databases are now live on the Vercel Marketplace and v0
Sort providers by cost, latency, or throughput on AI Gate...
Walter KormanSoftware EngineerJerilyn ZhengProduct, AI Gateway · 2026-05-15 · via Vercel News

You can now sort the providers behind a model by cost, time to first token (TTFT), or throughput (TPS) in AI Gateway.

The default provider order blends provider reliability, quality of model output, cost, and speed of response. You can now use sort for explicit control over ranking criteria.

For models with many providers and noticeable cost or speed variation, you can use sort to optimize on your dimension of choice. Ranking is computed at request time, so newly added providers, price changes, and shifts in observed latency or throughput flow through automatically without any code changes.

Set sort on providerOptions.gateway to one of the three values:

Value

Description

Direction

When to use

'cost'

Sort by the provider's listed input price per million tokens

Lowest price first

High-volume, cost-sensitive work

'ttft'

Sort by median time to first token, in ms

Lowest latency first

Latency-sensitive workloads where response speed matters

'tps'

Sort by median tokens per second throughput

Highest first

Long-output generation where total response time matters most

Link to headingBasic usage

Use sort to ensure optimizing for your metric of choice.

In this example, AI Gateway has over five providers for GPT OSS 120B with different prices, so sorting by cost is a useful option for requests that want to route through the lowest price provider.

Providers are tried in sort order. Fallback to the next provider only happens when the higher-ranked one is unavailable.

import { streamText } from 'ai';

const result = streamText({

model: 'openai/gpt-oss-120b',

prompt: 'Summarize this internal document.',

providerOptions: {

gateway: {

sort: 'cost', // Use the lowest cost provider first

},

},

});

Sort example by cost for GPT OSS 120B

Link to headingCombine with other routing controls

sort is compatible with other gateway routing options like Zero Data Retention (ZDR).

The example below uses deepseek/deepseek-v4-pro for an interactive request where latency and data retention matter: AI Gateway filters to only providers for Deepseek V4 Pro that have zero data retention, and then sorts the remaining providers by time to first token (TTFT).

import { streamText } from 'ai';

const result = streamText({

model: 'deepseek/deepseek-v4-pro',

prompt,

providerOptions: {

gateway: {

zeroDataRetention: true,

sort: 'ttft', // Among ZDR-compliant providers in this set, try the lowest latency first

},

},

});

Sample ZDR filtering and TTFT sorting for DeepSeek V4 Pro

sort also composes with order: providers listed in order are promoted to the front, and the remaining providers follow the requested sort criterion.

Link to headingInspecting routing decisions

See exactly why each request landed where it did. Every response includes a sort block in the routing metadata showing which providers were considered, the metric values used to rank them, the order they were attempted, and any that were deprioritized due to degraded health.

{

"gateway": {

"routing": {

"sort": {

"option": "cost",

"executionOrder": ["novita", "groq", "fireworks", "baseten", "cerebras"],

"metrics": {

"novita": 0.10,

"groq": 0.15,

"cerebras": 0.20,

"fireworks": 0.22,

"baseten": 0.25

},

"deprioritizedProviders": ["cerebras"]

}

}

}

}

Sample execution order for GPT OSS 120B

For more information on sorting via AI Gateway, read the documentation.