From 4765a90f97722b124ea9166c7442b4baec6d48ef Mon Sep 17 00:00:00 2001 From: Stefan Hladnik Date: Tue, 18 Mar 2025 03:38:24 +0700 Subject: [PATCH] fix: Adjust input and output cost calculations to use million scale --- aider/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aider/models.py b/aider/models.py index 1ca6276fd..3499e7820 100644 --- a/aider/models.py +++ b/aider/models.py @@ -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,