Expand description
Automatic pricing lookup from providers that expose exact, public per-token prices.
Today only OpenRouter qualifies: its GET /api/v1/models response
carries exact per-token prompt, completion, input_cache_read and
input_cache_write prices with no authentication. Other providers either
expose no public price API (OpenAI, Groq, xAI, DeepSeek, Google) or
expose prices that cannot be mapped to a model exactly without heuristics
(AWS Bedrock Price List, Azure Retail Prices).
Structs§
- Model
Pricing - Exact per-1M-token prices for a model.
Functions§
- apply_
auto_ pricing - Applies automatic pricing to every endpoint that opts in.
- apply_
pricing - Fills unset pricing fields on
ecfrom fetchedpricing; explicit values win. - fetch_
openrouter_ pricing - Fetches exact
OpenRouterpricing formodel. - parse_
openrouter_ models - Parses an
OpenRouter/api/v1/modelsresponse formodel.