plexus.scores.core.CostAccumulator module
- class plexus.scores.core.CostAccumulator.CostAccumulator
Bases:
objectGeneric cost accumulator that any score type can use to record measurable costs.
Tracks both aggregate totals and a list of component line items for debugging/auditing.
- __init__() None
- add_api_call(provider: str, model: str | None = None, prompt_tokens: int = 0, completion_tokens: int = 0, cached_tokens: int = 0, usd: Decimal | None = None, duration_ms: int | None = None, metadata: Dict[str, Any] | None = None) None
- add_compute(seconds: float, usd_per_second: Decimal | None = None, metadata: Dict[str, Any] | None = None) None
- add_custom(label: str, usd: Decimal | None = None, metadata: Dict[str, Any] | None = None) None
- add_db_io(engine: str, operation: str, usd: Decimal | None = None, metadata: Dict[str, Any] | None = None) None
- add_http_call(service: str, usd: Decimal | None = None, duration_ms: int | None = None, metadata: Dict[str, Any] | None = None) None
- to_dict() Dict[str, Any]