preferLatencyUnderMs when waiting costs you more than the price difference does.
The default: cheapest serves
Send nothing and routing is unchanged. The cheapest source serves, and you are charged its price. This is the behavior every API has always had, and it stays the behavior for every request that omits the field.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
This is the trade you are making. When the cheapest source misses your target, a faster and dearer one serves, and you are quoted and charged its price. You can see the difference before you call, without a key.GET /catalog publishes each
source’s pricing next to health.latencyP50Ms, and that median is exactly the number
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 is a no-op in three cases, so you can send it without special-casing your code:
The pagination rule follows from how cursors work: a cursor pins the walk to one source so
your pages stay consistent. See Pagination.
Example
costUsd on the response is what you were actually charged, so compare it across a
call with and without the field to see the trade in your own numbers.