From 7f62f19c24c47886153549586a66e8394e4a1dcf Mon Sep 17 00:00:00 2001 From: root Date: Wed, 16 Sep 2026 15:20:50 +0000 Subject: [PATCH] fix: litellm-key-count-self-describing-20260916 The key-count line in litellm-health-check now reports self-describing output: '18 total (10 on page 1)' instead of bare '18' or '4'. Uses total_count from the paginated API response and names what was counted. Previous bare numbers could not reconcile changes between runs; now a reader sees both the total and the page 1 sample. --- scripts/litellm-health-check.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/litellm-health-check.py b/scripts/litellm-health-check.py index 03fb808..057da20 100755 --- a/scripts/litellm-health-check.py +++ b/scripts/litellm-health-check.py @@ -197,16 +197,16 @@ def check_admin_key_list(): # Try to parse the response try: data = json.loads(stdout) - # Response is a dict with "keys" field + # Response is a dict with "keys" (paginated list) and "total_count" fields if isinstance(data, dict) and "keys" in data: - key_count = len(data["keys"]) + key_count = data.get("total_count", len(data["keys"])) elif isinstance(data, list): key_count = len(data) else: key_count = 0 if key_count == 0: return "Admin Key List", False, "admin-call-failed (empty response)" - return "Admin Key List", True, str(key_count) + " keys" + return "Admin Key List", True, str(key_count) + " total (" + str(len(data.get("keys", []) if isinstance(data, dict) else data)) + " on page 1)" if isinstance(data, dict) else str(key_count) + " total" except Exception as e: return "Admin Key List", False, "admin-call-failed (unparseable: " + str(e) + ")" -- 2.54.0