Files
autoreg-skills-max/skills/ai-provider-autoreg/references/codex-relay-autoreg.md

5.0 KiB

codex-relay.codes autoreg

Project: C:\Users\User\tmp\codex_relay\ (core.py, stage_a.py, stage_b.py, stage_b_par.py, imap_read.py, proxy_pool.py, rescue.py, refresh_proxies.py, kill_py.py)

Flow (per account)

  1. stage_a.py — Telethon session pool (C:/Users/User/Desktop/CLEAN_ALIVE_SESSIONS/, API_ID 2040) joins channel codex_relay, /start to @ihatecodexbot, extracts join token j[0-9a-f]{24} from URL button → tokens.jsonl (one-time use)
  2. stage_b.py (sequential) / stage_b_par.py [N] [W] (W parallel workers over disjoint token/email slices) per account: sticky proxy (ONE IP for whole flow) → solve Turnstile(action=signup, sitekey 0x4AAAAAAFKlKzKi8SKbAV7e) → GET /api/verification?email=&turnstile= → IMAP code from t-online (secureimap.t-online.de:993) → solve Turnstile(page="/login", action="login") → POST /api/user/register?turnstile= with header X-Relay-Join: <token> → POST /api/user/login?turnstile= → access_token → POST /api/token/ {name:main,remain_quota:500000,expired_time:-1,unlimited_quota:true} → api_key (full key in create response, else GET /api/token/{id}/key; add sk- prefix if missing)
  3. Bonus: 5,000,000 quota ($10) per TG-join account. Affiliate: ?aff=uxpC
  4. Models on relay (verified via live sk-key /v1/models): gpt-5.5, gpt-5.6-luna/sol/terra, gpt-6-astra/luna/sol, gpt-6.1-sol, gemini-3-flash/3.1-flash-lite/3.1-pro/3.5-flash-lite/3.6/3.7/3.8-flash, grok-4.5/4.6/4.7, glm-5.3, glm-5.3-flash, codex-auto-review. Pricing via /api/pricing (public).

CRITICAL PITFALLS

  1. Paid captcha APIs are IP-BLOCKED from this network (Anti-Captcha: DNS resolves but TCP dead from home IP AND all free proxies; 2captcha/YesCaptcha keys dead). USE FREE LOCAL SOLVER ONLY: cs_sidecar http://127.0.0.1:8877/solve {"type":"turnstile","sitekey":...,"url":...,"action":...,"real_page":true} → token 752 chars in 4-30s, $0. Do NOT keep a paid fallback in the code path — it just burns minutes on TCP timeouts; retry the sidecar instead (tries=5).
  2. cs_sidecar intermittently returns 408/500 on cold browser — transient; retry the /solve call (2-5 tries) before declaring failure. Health check /health stays 200 even while solves fail — diagnose via solve, not health.
  3. Login 403 anti-bot = IP mismatch or stale turnstile-page binding. One sticky proxy for verification+register+login (per-request proxy rotation → each step exits a different IP → 403). Solve the login turnstile against page="/login" with action="login". Even with sticky proxy some logins 403 → save to rescue.jsonl and re-login LATER with a fresh sticky proxy (rescue.py works: ~80% succeed on retry).
  4. access_token in accounts.jsonl goes 401 fast — for account self/quota checks re-login first (rescue flow). The sk- API key works directly on /v1/models, /v1/chat/completions, /v1/dashboard/billing/subscription, /api/pricing.
  5. t-online verification emails often arrive LATER than 140s — fetch_code timeout must be 300s; some t-online addresses never receive (backend drops) → mark dead_emails on no_email_code, rotate next email.
  6. SMTP 451 "try again later" on /api/verification under load → retry with backoff 60+30*attempt, rotate email.
  7. Process accumulation kills throughput: repeated background launches leave many stage_b instances racing on the same state.json/emails/sidecar (observed 10 procs → everything stalls; get_working_proxies alone took 164s). Before each restart, kill by cmdline pattern (stage_b, rescue.py, refresh_proxies, diag, heredoc - <<) — see kill_py.py. NEVER blanket-kill all python.exe: that takes down hermes, MCP servers, and the sidecar. Protect sidecar via cmdline/cwd match cs_sidecar.
  8. Free proxy pool dies in hours — refresh_proxies.py (TheSpeedX + proxyscrape v4 + monosans → parallel ipify test → live_http_proxies.txt, ~150 live from 4000, ~6 min) AND delete proxy_cache.json afterwards, else stale cached-good entries hang requests. Stale-pool symptom: verification request hangs with no response.
  9. stage_b_par.py must not wrap stdout twice — importing stage_b already replaces sys.stdout with a TextIOWrapper; wrapping again in the parent closes the first one → ValueError: I/O operation on closed file at first print. Inherit: import stage_b; sys.stdout = stage_b.sys.stdout. Always construct stdout wrappers with line_buffering=True (killed processes otherwise lose all buffered log output).
  10. Gmail +aliases: /api/verification accepts them but code NEVER arrives. t-online.de IMAP pool (17k, C:/Users/User/Desktop/avtoreg/working_mails.txt) is the only working email source.
  11. psutil.process_iter() on Windows raises AccessDenied for some pids — wrap cmdline() in try/except.

Files

  • accounts.jsonl — email/username/password/access_token/api_key per OK account
  • rescue.jsonl + rescue.py — accounts registered but login-403: re-login later with fresh sticky proxy
  • state.json — used_emails/done_tokens/dead_emails
  • tokens.jsonl — TG join tokens harvested (one-time use)