You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@burr.apache.org by sk...@apache.org on 2026/09/11 21:12:28 UTC
(burr) branch main updated: fix: harden token cost refresh script (#918)
This is an automated email from the ASF dual-hosted git repository.
skrawcz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/burr.git
The following commit(s) were added to refs/heads/main by this push:
new 24f05e37 fix: harden token cost refresh script (#918)
24f05e37 is described below
commit 24f05e37ace7914791005083bc948ab619257781
Author: Rolly Calma <11...@users.noreply.github.com>
AuthorDate: Sat Sep 12 05:12:23 2026 +0800
fix: harden token cost refresh script (#918)
---
telemetry/ui/scripts/token_costs.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/telemetry/ui/scripts/token_costs.py b/telemetry/ui/scripts/token_costs.py
index 2eb03769..7ef1ba9b 100644
--- a/telemetry/ui/scripts/token_costs.py
+++ b/telemetry/ui/scripts/token_costs.py
@@ -21,7 +21,8 @@ url = "https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_c
import requests
import json
-response = requests.get(url)
+response = requests.get(url, timeout=30)
+response.raise_for_status()
data = response.json()
keys_wanted = ["input_cost_per_token", "output_cost_per_token", "max_tokens", "max_input_tokens", "max_output_tokens"]
@@ -34,5 +35,5 @@ for model_entry in data:
del data[model_entry][key]
# save the data
-with open("model_costs.json", "w") as f:
+with open("model_costs.json", "w", encoding="utf-8") as f:
json.dump(data, f)