Skip to main content

Module pricing

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§

ModelRates

Functions§

current_snapshot
Non-blocking read of the current price snapshot. Returns an Arc clone 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/slugslug). 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.

Type Aliases§

PriceSnapshot