fix(quotas): list unpriced models by recorded cost; integer token limits in status

The unpriced-model notice asked the live registry whether a model has a
price, so a priced model whose provider was later disabled showed up as
unpriced. It now lists models whose calls this period were all recorded at
$0. Token limits are serialized as integers.
This commit is contained in:
Alex committed 2026-09-21 12:14:14 +01:00
1 parent 1eacfdd3d0
commit 6db9014dfb
4 files changed
+21 -15

No files matched your search

+5 -3
View File
@@ -151,13 +151,15 @@ def _delete_policy(scope: str, subject_id: Optional[str]):
def _unpriced_models(conn) -> list[dict]:
"""Catalog models used this period that no cost limit can see."""
"""Models used this period whose calls were all recorded at $0 for want of a price."""
start, _ = window_bounds(settings.QUOTA_PERIOD)
return [
row
for row in TokenUsageRepository(conn).tokens_by_model(start=start)
# BYOM ids are UUIDs; those calls are $0 by design, not by omission.
if not looks_like_uuid(row["model_id"]) and not is_priced(row["model_id"])
# Judged by what was recorded, so a priced model whose provider has since
# been disabled is not listed. BYOM ids are UUIDs and $0 by design; a
# model explicitly priced at $0 is free, not unpriced.
if row["cost"] == 0 and not looks_like_uuid(row["model_id"]) and not is_priced(row["model_id"])
]