api.services.ai.pricing ======================= .. py:module:: api.services.ai.pricing .. autoapi-nested-parse:: Model price catalog for the AI settings page, in USD per million tokens: Anthropic from the list prices used for cost estimates, OpenRouter from its public models endpoint (no key needed, cached). Attributes ---------- .. autoapisummary:: api.services.ai.pricing.logger api.services.ai.pricing.OPENROUTER_MODELS_URL api.services.ai.pricing.CACHE_SECONDS api.services.ai.pricing.RETRY_SECONDS Functions --------- .. autoapisummary:: api.services.ai.pricing.anthropic_models api.services.ai.pricing.openrouter_models api.services.ai.pricing.catalog Module Contents --------------- .. py:data:: logger .. py:data:: OPENROUTER_MODELS_URL :value: 'https://openrouter.ai/api/v1/models' .. py:data:: CACHE_SECONDS :value: 21600 .. py:data:: RETRY_SECONDS :value: 600 .. py:function:: anthropic_models() -> list[dict[str, Any]] .. py:function:: openrouter_models(get: collections.abc.Callable[..., Any] = requests.get, now: collections.abc.Callable[[], float] = time.time) -> list[dict[str, Any]] Models with a known per-token price; the last good list on failure. .. py:function:: catalog() -> dict[str, list[dict[str, Any]]]