37 lines
1.4 KiB
Bash
37 lines
1.4 KiB
Bash
#!/bin/bash
|
||
|
||
echo "╔══════════════════════════════════════════════════════╗"
|
||
echo "║ 📊 GLM CODING PLAN QUOTA ║"
|
||
echo "╚══════════════════════════════════════════════════════╝"
|
||
|
||
response=$(curl -s -X GET "https://api.z.ai/api/monitor/usage/quota/limit" \
|
||
-H "Authorization: Bearer $GLM_API_KEY" \
|
||
-H "Content-Type: application/json")
|
||
|
||
if echo "$response" | grep -q "error"; then
|
||
echo "❌ Error: $response"
|
||
exit 1
|
||
fi
|
||
|
||
echo "$response" | python3 -c "
|
||
import json, sys
|
||
data = json.load(sys.stdin)
|
||
|
||
limits = data.get('data', {}).get('limits', [])
|
||
for l in limits:
|
||
ltype = l.get('type', 'Unknown')
|
||
pct = l.get('percentage', 0)
|
||
remaining = l.get('remaining', 0)
|
||
total = l.get('number', 0)
|
||
|
||
if ltype == 'TIME_LIMIT':
|
||
print(f\"\n⏱️ Límite de tiempo: {remaining/1000/60:.1f} minutos restantes\")
|
||
elif ltype == 'TOKENS_LIMIT':
|
||
print(f\"\n🔢 Límite de tokens: {remaining/1001000:.1f}M restantes\")
|
||
|
||
print(f\"📊 Usado: {pct:.1f}%\")
|
||
"
|
||
|
||
echo ""
|
||
echo "═══════════════════════════════════════════════════════"
|