Expand description
Automatic pricing lookup from providers that expose exact, public per-token prices.
Two sources are supported:
OpenRouter:GET /api/v1/modelscarries exact per-tokenprompt,completion,input_cache_readandinput_cache_writeprices with no authentication.- AWS Bedrock: the public AWS Price List offers
AmazonBedrock(Nova, Llama, Mistral, …) andAmazonBedrockFoundationModels(Anthropic Claude, Cohere, …) publish exact per-model input/output/cache-read/ cache-write prices per region. Both are fetched at startup and mapped to the configured model id.
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 (Azure Retail Prices).
Structs§
- Model
Pricing - Exact per-1M-token prices for a model.
- Pricing
Outcome - Outcome of an automatic pricing pass.
Functions§
- apply_
auto_ pricing - Applies automatic pricing to every endpoint.
- 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.