#!/bin/bash
[ -z "$1" ] && exit 1
data=$(curl -s --max-time 3 https://zenmux.ai/api/v1/management/subscription/detail \
  -H "Authorization: Bearer $1" 2>/dev/null)
[ -z "$data" ] && exit 1
echo "$data" | python3 -c "
import sys,json
d=json.load(sys.stdin)['data']
h5=d['quota_5_hour']['usage_percentage']*100
d7=d['quota_7_day']['usage_percentage']*100
print(f'Zenmux 5h:{h5:.0f}% 7d:{d7:.0f}%')
" 2>/dev/null || exit 1
