fix: Adjust input and output cost calculations to use million scale

This commit is contained in:
Stefan Hladnik 2025-03-18 03:38:24 +07:00
parent 29587cd07c
commit 4765a90f97

View file

@ -256,8 +256,8 @@ class ModelInfoManager:
context_size = None
input_cost_match = re.search(r"\$\s*([\d.]+)\s*/M input tokens", text, re.IGNORECASE)
output_cost_match = re.search(r"\$\s*([\d.]+)\s*/M output tokens", text, re.IGNORECASE)
input_cost = float(input_cost_match.group(1)) if input_cost_match else None
output_cost = float(output_cost_match.group(1)) if output_cost_match else None
input_cost = float(input_cost_match.group(1)) / 1000000 if input_cost_match else None
output_cost = float(output_cost_match.group(1)) / 1000000 if output_cost_match else None
params = {
"max_input_tokens": context_size,
"max_tokens": context_size,