cost_calculator
cost_calculator
¶
Cost calculator -- estimate monthly cloud API costs for common use cases.
Classes¶
CostEstimate
dataclass
¶
CostEstimate(
provider: str,
label: str,
monthly_cost: float,
annual_cost: float,
input_cost: float,
output_cost: float,
total_calls_per_month: int,
)
Estimated cost for a provider given a usage scenario.
Scenario
dataclass
¶
Scenario(
name: str,
label: str,
description: str,
calls_per_month: int,
avg_input_tokens: int,
avg_output_tokens: int,
)
A prebuilt usage scenario.
Functions:¶
estimate_monthly_cost
¶
estimate_monthly_cost(
calls_per_month: int,
avg_input_tokens: int,
avg_output_tokens: int,
provider_key: str,
) -> CostEstimate
Estimate monthly cost for a provider given usage parameters.
Source code in src/diapason/server/cost_calculator.py
estimate_scenario
¶
estimate_scenario(scenario_name: str) -> List[CostEstimate]
Estimate costs for all providers for a named scenario.
Source code in src/diapason/server/cost_calculator.py
estimate_all_scenarios
¶
estimate_all_scenarios() -> Dict[str, List[CostEstimate]]