2.9 KiB
2.9 KiB
Multi-Bank Key/Account Audit Pattern
When you need a full inventory of ALL API keys and accounts across every farm, use this script pattern. Scans all known bank files (JSONL/JSON/CSV), extracts key counts and status distributions, and outputs structured JSON.
Script Template
import json, os, glob, csv
from collections import Counter
R = {}
def jl(p):
"""Load JSONL file, return list of dicts or None."""
try:
return [json.loads(l) for l in open(p, encoding='utf-8', errors='replace') if l.strip()]
except Exception:
return None
def stat(name, rows, keyf='api_key'):
"""Count rows, keys, and status distribution."""
if rows is None:
R[name] = 'NO FILE'
return
withk = [r for r in rows if r.get(keyf)]
st = Counter(r.get('status', '?') for r in rows)
R[name] = {'total': len(rows), 'with_key': len(withk), 'status': dict(st.most_common(5))}
# Known bank paths — update this dict as new farms are added
banks = {
'miarouter': 'Desktop/farm/miarouter/accounts.jsonl',
'codex_relay': 'tmp/codex_relay/accounts.jsonl',
'llmsrelay': 'tmp/llmsrelay_farm/accounts.jsonl',
'tookenclub_live': 'tmp/tookenclub_live.jsonl',
'seekai': 'tmp/seekai_farm/seekai_accounts.jsonl',
'conol': 'Desktop/_PROJECTS/conol_autoreg/accounts.jsonl',
'notion': 'tmp/notion_autoreg/farm_accounts.jsonl',
'vani': 'tmp/vani_autoreg/vani_accounts.jsonl',
'cleanapis': 'tmp/freeapi_3pack/cleanapis_accounts.jsonl',
'terrapolis': 'tmp/freeapi_3pack/terrapolis_accounts.jsonl',
'kiro_bid': 'tmp/aws_kiro/bid_accounts.jsonl',
'miarouter_verified': 'Desktop/farm/miarouter/verified.jsonl',
}
for name, p in banks.items():
if os.path.exists(p):
rows = jl(p)
kf = 'token' if 'tokens' in name else 'api_key'
stat(name, rows, kf)
else:
R[name] = 'NO FILE'
# CSV banks: count rows
csv_banks = {
'MASTER_NEWAPI_KEYS': 'tmp/MASTER_NEWAPI_KEYS.csv',
'ALL_LIVE_KEYS_FINAL': 'tmp/ALL_LIVE_KEYS_FINAL.csv',
'POOL_FINAL2': 'tmp/free_newapi_reg/POOL_FINAL2.csv',
}
for name, p in csv_banks.items():
try:
with open(p, encoding='utf-8', errors='replace') as f:
n = sum(1 for _ in f) - 1 # minus header
R[name] = {'rows': n}
except Exception:
R[name] = 'ERR'
print(json.dumps(R, indent=1, ensure_ascii=False))
Common Key Field Variance
Different farms use different key field names:
api_key— most common (miarouter, codex, conol, cleanapis)token— token-only banks (codex_tokens)key— raw key field (some gateways)- No key field — email-only/registration-only banks (omnirush, gname)
Status Codes by Farm
full— account registered, key extracted, smoke testedreg_fail/reg_ok_login_fail— partial progress, retry possiblesignup_fail/login_fail— blocked at auth stageno_code/no_key— registration succeeded but key extraction failed