Skip to content

agentix.pricing

pricing

USD cost estimation from token usage.

Provider adapters that know their model's pricing set ModelResponse.cost_usd; the loop sums it into AgentOutcome.cost_usd. This module holds a small price table for current Claude models and a helper to compute cost. Prices are USD per 1M tokens as (input, output) and may drift — override via register_price.

register_price

register_price(
    model: str,
    input_per_mtok: float,
    output_per_mtok: float,
) -> None

Add or override pricing for a model id.

cost_usd

cost_usd(
    model: str, input_tokens: int, output_tokens: int
) -> float

Estimate the USD cost of a call. Returns 0.0 for unknown models.