From 2ba1016ca84811bf8ef223418c4ab0d9f58ccdaf Mon Sep 17 00:00:00 2001 From: root Date: Sat, 12 Sep 2026 12:45:50 +0000 Subject: [PATCH] Fix LiteLLM API key source and auth header - Load API key from durable file /root/.abiba-workspace/secrets/litellm-key.txt (works in cron) - Fix http_get to use Bearer token instead of Basic Auth for API endpoint check - All 6 LiteLLM checks now pass (was 5/6) --- scripts/daily-infra-report.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/daily-infra-report.py b/scripts/daily-infra-report.py index e1468b7..15200c5 100755 --- a/scripts/daily-infra-report.py +++ b/scripts/daily-infra-report.py @@ -29,7 +29,13 @@ LITELLM_PUBLIC = "https://litellm.sysloggh.net" LITELLM_BACKEND = "192.168.68.116" AUTH_HOST = "192.168.68.11" -SYNTHETIC_API_KEY = "sk-U_ydi3B-wfGU-_xESkoU1Q" +# Load LiteLLM API key from file (durable, works in cron) +LITELLM_KEY_FILE = "/root/.abiba-workspace/secrets/litellm-key.txt" +try: + with open(LITELLM_KEY_FILE) as f: + SYNTHETIC_API_KEY = f.read().strip() +except: + SYNTHETIC_API_KEY = "sk-U_ydi3B-wfGU-_xESkoU1Q" NOW = datetime.datetime.now() DATE_STR = NOW.strftime("%Y-%m-%d") @@ -68,7 +74,7 @@ def http_get(url, auth=None, timeout=10): cmd = f'curl -sfk --connect-timeout {timeout} -o /dev/null -w "%{{http_code}}" "{url}"' if auth: cmd = cmd.replace('"', '\\"') - cmd = f'curl -sfk --connect-timeout {timeout} -u "{auth}" -o /dev/null -w "%{{http_code}}" "{url}"' + cmd = f'curl -sfk --connect-timeout {timeout} -H "Authorization: Bearer {auth}" -o /dev/null -w "%{{http_code}}" "{url}"' r = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=timeout+2) return r.stdout.strip() or "000" except: