feat(stove-api): expose estimate and operator controls

This commit is contained in:
anor
2026-11-26 20:22:55 +10:00
parent de624297ed
commit a98aa460d4
19 changed files with 1074 additions and 12 deletions
+6
View File
@@ -395,3 +395,9 @@ def _tariff_view(db, username: str) -> dict:
except Exception: # noqa: BLE001 — цена справочная, ронять из-за неё нельзя
_log.exception("limits_snapshot: не удалось определить действующую цену")
return view
def global_cap_reached() -> bool:
"""Read-only global AI cost gate for external API; never toggles chat kill switch."""
import db
return db.total_cost_since(time.time() - WINDOW_SECONDS) >= _float_setting("GLOBAL_DAILY_COST_USD", 20.0)