IgorSlinko commited on
Commit
cc395f5
·
1 Parent(s): 26e685e

fix: consistent cost calculation for original vs routed models

Browse files

Ensure Original Cost uses the same simulation logic as Routed Cost to prevent negative savings when using identity routing. Also bump version to 0.3.18.

Files changed (2) hide show
  1. app.py +1 -4
  2. pyproject.toml +1 -1
app.py CHANGED
@@ -2079,10 +2079,7 @@ def build_app():
2079
  routing_costs_list.append({"name": rm["name"], "tokens": tokens, "costs": costs, "cost": cost})
2080
  total_routing_cost += cost
2081
 
2082
- if total_original_cost_from_df is not None:
2083
- total_original_cost = total_original_cost_from_df
2084
- else:
2085
- total_original_cost = calc_cost(total_original_tokens, base_prices)
2086
 
2087
  total_routed_cost = total_base_cost + total_routing_cost
2088
  savings = total_original_cost - total_routed_cost
 
2079
  routing_costs_list.append({"name": rm["name"], "tokens": tokens, "costs": costs, "cost": cost})
2080
  total_routing_cost += cost
2081
 
2082
+ total_original_cost = calc_cost(total_original_tokens, base_prices)
 
 
 
2083
 
2084
  total_routed_cost = total_base_cost + total_routing_cost
2085
  savings = total_original_cost - total_routed_cost
pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
  [project]
2
  name = "routing-money-calculation"
3
- version = "0.1.0"
4
  description = "Rough estimate of routing cost for AI agents"
5
  readme = "README.md"
6
  license = "Apache-2.0"
 
1
  [project]
2
  name = "routing-money-calculation"
3
+ version = "0.3.18"
4
  description = "Rough estimate of routing cost for AI agents"
5
  readme = "README.md"
6
  license = "Apache-2.0"