transcription-cost-usage-re.../backend/app/utils/calc_api_usage.py

5 lines
201 B
Python

def calculate_api_usage(price: float, billing_unit: int, usage: float) -> str:
num_billing_units = (usage / billing_unit)
total_cost = num_billing_units * price
return f"{total_cost:.10f}"