From 2ff8193c553b49c0529b2c4dd8641ebfd90991c8 Mon Sep 17 00:00:00 2001 From: inference-bot Date: Sat, 26 Sep 2026 16:14:33 -0600 Subject: [PATCH] =?UTF-8?q?Dashboard=20usage:=20prefer=20model=5Fgroup=20a?= =?UTF-8?q?lias=20(provider/model=20names)=20=E2=80=94=20fixes=20support?= =?UTF-8?q?=20#5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index 2d56eba..60237ba 100644 --- a/app/main.py +++ b/app/main.py @@ -1521,7 +1521,11 @@ async def broker_get_usage(email: str) -> dict: for row in rows if isinstance(rows, list) else []: if row.get("team_id") != team_id: continue - model = row.get("model") or "unknown" + # Prefer model_group: it carries our provider/model alias (e.g. + # greenpt/green-r) when present; the raw `model` field holds + # messy upstream/internal names. Older rows predating the alias + # convention have model_group empty, so fall back to `model`. + model = row.get("model_group") or row.get("model") or "unknown" m = models.setdefault(model, {"spend": 0.0, "tokens": 0, "calls": 0}) m["spend"] += float(row.get("spend") or 0.0) m["tokens"] += int(row.get("total_tokens") or 0)