Skip to main content

ducto.breakdown module

Aggregated cost breakdown produced by PricingEngine.calculate().

The CostBreakdown model holds per-category credit costs and computes a total via a model validator.

class ducto.breakdown.CostBreakdown(*, model_credits: float = 0.0, tool_credits: float = 0.0, search_credits: float = 0.0, cache_savings: float = 0.0, fixed_credits: float = 0.0, total: float = 0.0, breakdown: dict[str, ~typing.Any]=)

Bases: BaseModel

Granular credit cost report for a usage event or batch.

total is automatically computed from the component fields during initialisation and is capped at 0.0 from below.

breakdown : dict[str, Any]

cache_savings : float

fixed_credits : float

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_credits : float

search_credits : float

tool_credits : float

total : float