Skip to main content

Module pricing

Module pricing 

Source
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§

ModelInfo
ModelPricing
PricingCatalog
In-memory pricing catalog: per (provider, model), a price history sorted ascending by effective_at. Built once from the embedded TOML.

Enums§

Capability

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 max effective_at) is more than max_days before now. An empty catalog (None) is treated as not stale.