Skip to main content

Module pricing

Module pricing 

Source
Expand description

Canonical per-million-token pricing for known LLM models.

This is the single source of truth for model pricing. Every subsystem (TUI cost badge, cost guardrail, benchmark runner) must delegate here rather than maintaining its own table.

Prices are best-effort retail USD per 1M tokens (input, output). Unknown models fall back to a conservative default.

Functions§

cache_read_multiplier
Multiplier applied to input_price for cache-read tokens. Varies by provider family:
cache_write_multiplier
Multiplier applied to input_price for cache-write tokens. Only Anthropic/Bedrock bill a surcharge for cache writes (1.25×). For providers that cache implicitly (OpenAI, Gemini, GLM) this is 0.0 because the write is bundled into the regular input price.
pricing_for_model
Return (input_price_per_million, output_price_per_million) in USD for a given model identifier. Matching is case-insensitive substring.
session_cost_usd
Estimate the running cost (USD) of the current session, using the global crate::telemetry::TOKEN_USAGE counters and pricing_for_model. Applies provider-specific prompt-cache multipliers via cache_read_multiplier and cache_write_multiplier.