compass.utilities.costs.compute_cost_from_totals#

compute_cost_from_totals(totals)[source]#

Compute total cost from total tracked usage

Parameters:

totals (dict) – Dictionary where keys are model names and their corresponding usage statistics are values. Each usage statistics dictionary should contain “prompt_tokens” and “response_tokens” keys indicating the number of tokens used for prompts and responses, respectively. This dictionary is typically obtained from the tracker_totals property of a compass.services.usage.UsageTracker instance.

Returns:

float – Total cost based on the tracked usage.