Skip to main content

Module pricing

Module pricing 

Source
Expand description

LLM pricing and retry policy.

Contains the shared RetryPolicy struct used by all provider implementations, the per-model ModelPricing struct, and lookup helpers that consult the bundled providers.toml preset catalog.

Structs§

ModelPricing
Per-million-token pricing for one model. USD.
RetryPolicy
Retry policy for transient LLM provider failures (network timeouts, 5xx).

Functions§

context_window_tokens_for_model
Returns the context window size in tokens for the given model.
context_window_tokens_for_model_effective
Like context_window_tokens_for_model but consults the effective catalog (remote cache + bundled + providers.d/) rather than the compile-time providers.toml alone. Mirrors [find_model_pricing_effective]: the TUI’s /model picker lists models with their effective context_window, so the input-box context gauge must read the same source — otherwise it shows a stale bundled value for a model the user has overridden to a different window in providers.d/.
default_compact_threshold_chars
Compute the default compaction character-count threshold for a model.
default_compact_threshold_tokens
Compute the default compaction token threshold for a model.
pricing_for
Returns pricing for a model by looking it up in the effective preset catalog (remote cache + bundled + providers.d/), so per-token cost reflects upstream catalog refreshes rather than just the compile-time providers.toml. Returns None if the model is not listed or has no pricing field.