mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-06 12:45:00 +00:00
feat: Update cost extraction to capture non-zero input/output costs
This commit is contained in:
parent
44e5525e6f
commit
2651d99676
1 changed files with 4 additions and 4 deletions
|
@ -254,10 +254,10 @@ class ModelInfoManager:
|
||||||
context_size = int(context_str)
|
context_size = int(context_str)
|
||||||
else:
|
else:
|
||||||
context_size = None
|
context_size = None
|
||||||
input_cost_match = re.search(r"\$\s*0\s*/M input tokens", text, re.IGNORECASE)
|
input_cost_match = re.search(r"\$\s*([\d.]+)\s*/M input tokens", text, re.IGNORECASE)
|
||||||
output_cost_match = re.search(r"\$\s*0\s*/M output tokens", text, re.IGNORECASE)
|
output_cost_match = re.search(r"\$\s*([\d.]+)\s*/M output tokens", text, re.IGNORECASE)
|
||||||
input_cost = 0 if input_cost_match else None
|
input_cost = float(input_cost_match.group(1)) if input_cost_match else None
|
||||||
output_cost = 0 if output_cost_match else None
|
output_cost = float(output_cost_match.group(1)) if output_cost_match else None
|
||||||
params = {"max_input_tokens": context_size, "input_cost": input_cost, "output_cost": output_cost}
|
params = {"max_input_tokens": context_size, "input_cost": input_cost, "output_cost": output_cost}
|
||||||
print(f"Model '{model}': Parsed parameters: {params}")
|
print(f"Model '{model}': Parsed parameters: {params}")
|
||||||
return params
|
return params
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue