#!/usr/bin/env python3 """验证候选 deepseek keys,输出 usable 列表。""" import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent)) from deep_verify import deep_verify, DEEP_CONFIGS from verify_cache import CachedVerifier KEYS_FILE = "/tmp/ds_to_verify.txt" def main(): keys = [] for line in open(KEYS_FILE, errors="replace"): line = line.strip() if not line: continue parts = line.split("|") if len(parts) >= 3 and parts[0] == "LIVE": keys.append(parts[2]) print(f"loaded {len(keys)} keys", flush=True) usable, nobal, noacc, dead, unknown = [], [], [], [], [] with CachedVerifier("deepseek_batch", lambda k: (deep_verify("DeepSeek", k), "")) as ver: from concurrent.futures import ThreadPoolExecutor, as_completed with ThreadPoolExecutor(max_workers=16) as pool: futs = {pool.submit(ver, k): k for k in keys} done = 0 for fut in as_completed(futs): k = futs[fut] done += 1 try: v, _ = fut.result() except Exception as e: v, _ = "UNKNOWN", f"exc:{e}" if v == "USABLE": usable.append(k) elif v == "NO_BALANCE": nobal.append(k) elif v == "NO_ACCESS": noacc.append(k) elif v == "DEAD": dead.append(k) else: unknown.append(k) if done % 100 == 0: print(f" [{done}/{len(keys)}] usable={len(usable)} nobal={len(nobal)} dead={len(dead)}", flush=True) print(f"\n=== 结果 ===") print(f"USABLE: {len(usable)}") print(f"NO_BALANCE: {len(nobal)}") print(f"NO_ACCESS: {len(noacc)}") print(f"DEAD: {len(dead)}") print(f"UNKNOWN: {len(unknown)}") with open("/tmp/ds_verified_usable.txt", "w") as f: f.write("\n".join(usable) + "\n") print(f"\nusable 写入 /tmp/ds_verified_usable.txt") if __name__ == "__main__": main()