preferLatencyUnderMs when waiting costs you more than the price difference.
The default: cheapest serves
Without the field, the cheapest source serves and you are charged its price.Prefer a faster source
AddpreferLatencyUnderMs to the request body, in milliseconds:
- Sources whose published median response time is under your target go first, and the cheapest of those serves.
- If none is that fast, the request is still served, by whichever source offers the best speed for its price.
- Sources we have not timed are tried last.
It can cost more
When the cheapest source misses your target, a faster and dearer one serves, and you are quoted and charged its price. You can compare before you call, without a key.GET /catalog publishes each source’s
pricing next to health.latencyP50Ms, the median routing reads:
The median describes past requests. It is not a ceiling on yours, and it excludes any
waiting your own request asks for, such as a
waitFor on a page render. Treat it as an
observation, not a deadline.When it does nothing
The field is accepted on every API and does nothing in these cases:
A cursor pins the walk to one source. See Pagination.
Example
costUsd on calls with and without the field to see the trade in your own numbers.