Dashboard usage: prefer model_group alias (provider/model names) — fixes support #5

This commit is contained in:
inference-bot committed 2026-09-26 16:14:33 -06:00
1 parent 5c269bf243
commit 2ff8193c55
1 file changed
+5 -1
+5 -1
View File
@@ -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)