From 0d5ffede05eafe993dc23ed304104918ec390539 Mon Sep 17 00:00:00 2001 From: Inferencebot Date: Fri, 13 Nov 2026 20:48:02 +0000 Subject: [PATCH] README: the spend check compares day by day over the shared window --- README.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e0a5523..92d02ce 100644 --- a/README.md +++ b/README.md @@ -249,12 +249,19 @@ Four jobs run inside the container via `CloudronManifest.json` → `addons.sched failed *soft*: its copy of the gateway's LiteLLM DB credential had gone stale, the query returned nothing, and every surface showed $0 while looking clean — the portal was the thing that was wrong. `check_spend_consistency()` compares two - genuinely independent reads: the portal's SpendLogs aggregate over its own DB - credential, and LiteLLM's own HTTP API (`/global/spend/keys`) over the master key. - An EMPTY/$0 portal aggregate while LiteLLM reports real spend is a FAILURE named - as the stale-credential case, and an API side with no keys is a failure rather - than agreement. Silent when they agree; a read that cannot be made is `skipped`, - never clean. On demand: `POST /admin/spend-check`. + genuinely independent reads — the portal's SpendLogs aggregate over its own DB + credential, and LiteLLM's own HTTP API (`/global/spend/teams`) over the master key + — **day by day over the window both sides cover**, which localises drift instead of + hiding it in a sum. Two traps are encoded here: LiteLLM's per-day view reaches back + only a fixed number of days (31) while our table holds everything, so a + sum-vs-all-time test reports the missing window as drift ($107.63 of it on + 2026-11-13, against a real agreement of $0.07); and `/global/spend/keys` follows + each key's own budget cycle, so it is not an all-time figure either + (`/global/spend/report` would be, but is Enterprise-gated). An EMPTY/$0 portal + aggregate while LiteLLM reports real spend is a FAILURE named as the + stale-credential signature — judged *before* the window overlap, since in that + failure there are no shared days to compare. Silent when they agree; a read that + cannot be made is `skipped`, never clean. On demand: `POST /admin/spend-check`. **Notice policy (all of the above):** email `info@` only when there is a problem, and only about what is NEW. What a human has been told is a growing SET