AI Gateway でプロバイダーをコスト、レイテンシ、スループット順に並べ替え可能に
本文の状態
日本語全文を表示中
詳細モードで約3分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
Vercel Blog
Vercel は AI Gateway の新機能として、モデル背後のプロバイダーをコスト、初トークンまでの時間(TTFT)、またはスループット(TPS)の基準で明示的に並べ替える機能を追加した。これにより、各プロバイダー間の価格や速度の違いが大きい場合でも、ユーザーは最適な次元でランキングを制御できるようになった。
Source Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。
AI Gateway では、モデル背後のプロバイダーをコスト、最初のトークンまでの時間 (TTFT)、またはスループット (TPS) で並べ替えることができるようになりました。
デフォルトのプロバイダー順序は、プロバイダーの信頼性、モデル出力の品質、コスト、応答速度を組み合わせたものです。現在は sort を使用して、ランキング基準を明示的に制御できるようになりました。
多数のプロバイダーがあり、コストや速度に顕著なばらつきがあるモデルの場合、sort を使用して選択した次元で最適化できます。ランキングはリクエスト時に計算されるため、新たに追加されたプロバイダー、価格変更、観測されるレイテンシまたはスループットの変化も、コードの変更なしに自動的に反映されます。
providerOptions.gateway に sort を設定し、以下の 3 つの値のいずれかを指定してください:
Value
Description
Direction
When to use
'cost'
プロバイダーがリストした百万トークンあたりの入力価格で並べ替え
最安値から
高ボリュームでコストに敏感なワークロード
'ttft'
最初のトークンまでの中央値時間 (ミリ秒) で並べ替え
最小レイテンシから
応答速度が重要なレイテンシ敏感型ワークロード
'tps'
1 秒あたりのトークン数スループットの中央値で並べ替え
最高値から
総応答時間が最も重要となる長文生成
基本的な使用方法
sort を使用して、選択した指標の最適化を確実に実行します。
この例では、GPT OSS 120B には価格が異なる 5 つ以上のプロバイダーが存在するため、コストで並べ替えることは、最安値のプロバイダー経由でルーティングしたいリクエストにとって有用なオプションです。
プロバイダーは並べ替え順に試行されます。上位ランクのプロバイダーが利用できない場合にのみ、次のプロバイダーへフォールバックします。
他のルーティング制御と組み合わせる
sort は、ゼロデータ保持(ZDR)などの他のゲートウェイのルーティングオプションと互換性があります。
以下の例では、遅延とデータ保持が重要なインタラクティブなリクエストに対して deepseek/deepseek-v4-pro を使用します。AI Gateway は、まずゼロデータ保持を持つ Deepseek V4 Pro のプロバイダーのみをフィルタリングし、その後、残りのプロバイダーを最初のトークンまでの時間(TTFT)でソートします。
sort は order と組み合わせることも可能です。リストされた順序のプロバイダーが最前面に優先され、残りのプロバイダーは要求されたソート基準に従います。
ルーティング判断の検証
各リクエストがなぜ特定の場所に振り分けられたのかを正確に確認できます。すべてのレスポンスには、ルーティングメタデータ内に sort ブロックが含まれており、考慮されたプロバイダー、ランク付けに使用されたメトリック値、試行された順序、および健康状態の低下により優先度が下げられたプロバイダーが示されます。
AI Gateway によるソートに関する詳細については、ドキュメントをご覧ください。
続きを読む
原文を表示
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
Basic 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.
Combine 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).
sort also composes with order: providers listed in order are promoted to the front, and the remaining providers follow the requested sort criterion.
Inspecting 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.
For more information on sorting via AI Gateway, read the documentation.
Read more
関連記事
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み