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

5 lines
201 B
Python
Raw Permalink Normal View History

2025-06-09 11:13:05 +00:00
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}"