MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / get_spending

Method get_spending

uncommon_route/spend_control.py:218–224  ·  view source on GitHub ↗
(self, window: Literal["hourly", "daily", "session"])

Source from the content-addressed store, hash-verified

216 self._save()
217
218 def get_spending(self, window: Literal["hourly", "daily", "session"]) -> float:
219 now = self._now()
220 if window == "hourly":
221 return self._window_total(now - HOUR_S, now)
222 if window == "daily":
223 return self._window_total(now - DAY_S, now)
224 return self._session_spent
225
226 def get_remaining(self, window: Literal["hourly", "daily", "session"]) -> float | None:
227 limit = getattr(self._limits, window, None)

Callers 2

get_remainingMethod · 0.95

Calls 1

_window_totalMethod · 0.95

Tested by 1