Skip to main content

Module pricing

Module pricing 

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

ModelPricing
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 ec from fetched pricing; explicit values win.
fetch_openrouter_pricing
Fetches exact OpenRouter pricing for model.
parse_openrouter_models
Parses an OpenRouter /api/v1/models response for model.