from grantex import Grantex
with Grantex(api_key="gx_live_...") as client:
# Check current period usage
current = client.usage.current()
print(f"Period: {current.period}")
print(f"Total requests: {current.total_requests}")
print(f" Authorizations: {current.authorizations}")
print(f" Token exchanges: {current.token_exchanges}")
print(f" Verifications: {current.verifications}")
# Get last 30 days of usage
history = client.usage.history(days=30)
total_month = sum(e.total_requests for e in history.entries)
print(f"\nLast 30 days: {total_month} total requests")
# Find peak usage day
peak = max(history.entries, key=lambda e: e.total_requests)
print(f"Peak day: {peak.date} ({peak.total_requests} requests)")