Files
wevads-platform/activate-keys.sh
2026-02-26 04:53:11 +01:00

78 lines
3.4 KiB
Bash
Executable File

#!/bin/bash
# ═══════════════════════════════════════════════
# WEVADS - Quick Key Activator
# Usage: ./activate-keys.sh
# ═══════════════════════════════════════════════
API="http://127.0.0.1:5821/api/ia-provider-factory.php"
echo "╔══════════════════════════════════════════╗"
echo "║ WEVADS IA Provider Key Activator ║"
echo "╚══════════════════════════════════════════╝"
echo ""
# Show pending accounts
echo "📋 Pending accounts needing API keys:"
echo "─────────────────────────────────────────"
curl -s "$API?action=pending" | python3 -c "
import sys,json
d=json.load(sys.stdin)
for a in d.get('accounts',[]):
persona = f\"{a.get('first_name','')} {a.get('last_name','')}\".strip() or 'Primary'
print(f\" ID:{a['id']:>3} | {a['provider_name']:<12} | {a.get('account_email',''):30} | Signup: {a.get('signup_url','-')} [{persona}]\")
print(f\"\n Total: {d.get('pending_count',0)} pending\")
"
echo ""
# Priority signup order
echo "🎯 Signup Priority (FREE providers, highest value first):"
echo "─────────────────────────────────────────"
echo " 1. Groq → console.groq.com (fast, 500K tok/day)"
echo " 2. Cerebras → cloud.cerebras.ai (fast, 1M tok/day)"
echo " 3. Mistral → console.mistral.ai (quality, 500K tok/day)"
echo " 4. Cohere → dashboard.cohere.com (1M tok/day)"
echo " 5. Together → api.together.xyz (500K tok/day)"
echo " 6. OpenRouter → openrouter.ai (aggregator, 1M tok/day)"
echo " 7. Hyperbolic → app.hyperbolic.xyz (500K tok/day)"
echo " 8. SambaNova → cloud.sambanova.ai (500K tok/day)"
echo " 9. Novita → novita.ai (500K tok/day)"
echo " 10. Lepton → lepton.ai (1M tok/day)"
echo ""
# Interactive key entry
while true; do
read -p "Enter account ID (or 'q' to quit): " ACID
[[ "$ACID" == "q" ]] && break
read -p "Enter API key: " AKEY
if [[ -z "$ACID" || -z "$AKEY" ]]; then
echo "❌ Both ID and key required"
continue
fi
RESULT=$(curl -s -X POST "$API" -H 'Content-Type: application/json' \
-d "{\"action\":\"update_key\",\"account_id\":$ACID,\"api_key\":\"$AKEY\"}")
echo "$RESULT"
echo ""
done
echo ""
echo "🔍 Testing all keys..."
curl -s "$API?action=scan" | python3 -c "
import sys,json
d=json.load(sys.stdin)
for r in d.get('results',[]):
icon = '✅' if r['status']=='active' else '❌' if r['status']=='error' else '⚠️'
print(f\" {icon} {r['provider']:<12} {r['status']:<14} {r['latency']}\")
print(f\"\n Tested: {d.get('tested',0)} keys\")
"
echo ""
echo "📊 Final Status:"
curl -s "$API?action=status" | python3 -c "
import sys,json
d=json.load(sys.stdin)
s=d.get('stats',{})
b=d.get('token_budget',{})
print(f\" Health: {d.get('health')} | Active: {s.get('active')}/{s.get('total')} | Budget: {b.get('daily_limit',0):,} tokens/day\")
"