Skip to main content

Function: selectLowestCostSttEntry()

selectLowestCostSttEntry(entries, prices, options): LowestCostSttSelection | undefined

Defined in: packages/agentos/src/io/voice-pipeline/LowestCostStt.ts:124

Selects the lowest effective price among offered, available hosted entries.

Equal prices keep the order of entries. A credited candidate costs zero for selection only when its complete estimated list-price liability fits after outstanding reservations. Each other vendor contributes at most its best entry as a fallback; the selected vendor contributes no fallback. Invalid credit is ignored, but an available offered entry with no valid price is an error. Device entries belong to the host's separate policy.

This is a pure decision, not an allocation. The host reads the snapshot and acquires the resulting hold in one transaction before opening a provider. Persisted usage continues using list prices and actual settlement funding.

Parameters​

entries​

readonly string[]

Offered hosted entries, in tie-breaking order, without duplicates.

prices​

readonly SttPriceRow[]

Exact applicable streaming rows in whole micro-dollars per minute.

options​

LowestCostSttOptions

Availability, admission quantity, decision time and optional credit.

Returns​

LowestCostSttSelection | undefined

A frozen selection, or undefined when no offered vendor is available.

Throws​

For malformed entries, duplicate entries or price rows, invalid prices or admission inputs, an invalid language, an unpriced available entry, or a quote outside the safe integer range.