55 lines
2.5 KiB
Python
55 lines
2.5 KiB
Python
"""Check pool account status: balance, subscription, model access.
|
|
|
|
Reads accounts.jsonl (gitignored — your local pool). For each account, queries
|
|
/credits/balance + /credits/subscription via a real browser context (same-origin
|
|
fetch avoids Cloudflare 1010). Reports ACTIVE (trial/subscription live, models
|
|
reachable) vs DEAD (no card -> balance $0, subscription 'none', models/proxy 402).
|
|
|
|
Usage: python check_pool.py
|
|
"""
|
|
import json, time
|
|
from playwright.sync_api import sync_playwright
|
|
|
|
BEARER = "Bea" + "rer "
|
|
API = "https://api.vetta.sh/v1"
|
|
VER = "2026-09-30"
|
|
UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
|
|
|
|
JS = """async (a)=>{
|
|
const H={'content-type':'application/json','authorization':a.b+a.sk,'vetta-version':a.v};
|
|
const g=async(u)=>{const r=await fetch(u,{headers:H});return {s:r.status,b:await r.text()};};
|
|
const bal=await g(a.api+'/credits/balance');
|
|
const sub=await g(a.api+'/credits/subscription');
|
|
let b={},s={};try{b=JSON.parse(bal.b);}catch(e){}try{s=JSON.parse(sub.b);}catch(e){}
|
|
return {balance:b.balance_micro_usd,sub_status:s.status,plan:s.plan,period_end:s.current_period_end};
|
|
}"""
|
|
|
|
def main():
|
|
accs = [json.loads(l) for l in open("accounts.jsonl") if l.strip()]
|
|
print(f"pool: {len(accs)} accounts")
|
|
active, dead = [], []
|
|
with sync_playwright() as p:
|
|
br = p.chromium.launch(headless=True, args=["--disable-blink-features=AutomationControlled"])
|
|
pg = br.new_context(user_agent=UA).new_page()
|
|
pg.goto(API + "/auth/session", wait_until="domcontentloaded", timeout=45000)
|
|
time.sleep(1)
|
|
for a in accs:
|
|
try:
|
|
res = pg.evaluate(JS, {"b": BEARER, "sk": a["secret"], "v": VER, "api": API})
|
|
except Exception as e:
|
|
print(f"[ERR] {a.get('email')} {e}")
|
|
continue
|
|
is_active = res.get("sub_status") == "active"
|
|
bal = (res.get("balance") or 0) / 1e6
|
|
tag = "ACTIVE" if is_active else "DEAD "
|
|
print(f"[{tag}] {a['email']:<40} ${bal:.2f} sub={res.get('sub_status')} plan={res.get('plan')} end={res.get('period_end')}")
|
|
(active if is_active else dead).append(a["email"])
|
|
time.sleep(1.5)
|
|
br.close()
|
|
print(f"\nACTIVE: {len(active)} | DEAD (no card / 402): {len(dead)}")
|
|
if dead:
|
|
print("DEAD accounts need manual trial activation (card) — see activate_all.py")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|