Module pricing
Expand description
Live model pricing: a single process-global snapshot of token prices
fetched from providers’ own /models listings (with the models.dev catalog
as a secondary source for models the gateway doesn’t price), used as a
FALLBACK beneath the operator’s [cost.rates] config.
Structs§
Functions§
- current_
snapshot - Non-blocking read of the current price snapshot. Returns an
Arcclone of whatever the last successful refresh produced (empty if none yet). Never fetches, never.awaits; safe to call from the synchronous cost path. - lookup
- model_
id_ candidates - Model-id candidate forms, most specific first: the id verbatim, then the
path-suffix form (
vendor/slug→slug). The single owner of the candidate policy: snapshot assembly (match_pricing) and lookup both consume it, and the config-rate resolver mirrors it. - spawn_
refresher - Spawn the background price refresher, once per process.