Expand description
Pricing tables per model. Values are a manually-curated snapshot taken
from provider pricing pages; they are NOT refreshed automatically.
effective_at records when each rate took effect and lets us replay
historical telemetry against the correct rate. To refresh rates, edit
data/pricing.toml and append new entries — see scripts/refresh-pricing.sh
for the manual workflow. See also docs/02-provider-adapter-guide.md.
Rates live in a versioned data file (data/pricing.toml), embedded at build
time and parsed once into a PricingCatalog. Provider adapters delegate
to catalog instead of hardcoding rate tables, so a price refresh is a
data edit — decoupled from a Rust release. The catalog keeps a per-model
price history, enabling PricingCatalog::at to price historical
telemetry against the rate that was in effect at request time.
Structs§
- Model
Info - Model
Pricing - Pricing
Catalog - In-memory pricing catalog: per
(provider, model), a price history sorted ascending byeffective_at. Built once from the embedded TOML.
Enums§
Functions§
- catalog
- The process-wide pricing catalog, parsed once from the embedded
data/pricing.toml. Panics at first use only if that bundled file is malformed — which a unit test guards against, so it cannot reach a release. - is_
stale - Whether
newest(the catalog’s maxeffective_at) is more thanmax_daysbeforenow. An empty catalog (None) is treated as not stale.