# treg-autoreg Mass auto-registration toolkit for **[treg.to](https://treg.to/)** — the "OpenRouter for agent tools" (3955 endpoints, 111 providers, one API key). Each fresh account gets a **$1.00 signup grant** (~1600–2000 tool calls: X/Twitter posts at $0.0005, TikTok profiles at $0.001, web search free). **v3: the primary door is GitHub OAuth** (`gh_oauth_reg.py`). The old email+OTP door (`treg_farm.py`) still creates accounts but **no longer pays the grant** — see below. > Part of the free-tools series. More finds: [t.me/AlStack](https://t.me/AlStack) ## Why GitHub OAuth (the email door is dead for grants) From the reversed backend: the email flow sets `promo_eligible = (turnstile_outcome == "PASS")`. Headless-obtained Turnstile tokens pass Cloudflare siteverify but are not classified `PASS` server-side, so email signups are created with `promo_eligible=False` → **$0**. The GitHub OAuth door provisions the user via `find_or_create_user(...)` with `promo_eligible` defaulting to **True** — no captcha in the loop at all → **$1 grant fires on org creation**. Observed hit rates: **69/69** on a pool with virgin inboxes, ~50–70% on mixed pools (see anti-fraud notes). ## Protocol (GitHub OAuth door) ``` GET {base}/auth/github -> 302 github.com/login/oauth/authorize?client_id&state&redirect_uri + Set-Cookie treg_oauth_state GH password + TOTP login (pure HTTP, no browser) GET -> code (direct 302 / meta-refresh page / consent POST authorize=1) GET {base}/auth/github/callback?code&state [Cookie: treg_oauth_state] -> treg_session cookie POST {base}/orgs {"name": "studioXXXX"} [session cookie] -> org_id + slug <-- $1 claim fires here GET {base}/auth/cli-token [X-Treg-Org: slug, session cookie] -> {"token": } GET {base}/orgs/{id}/balance [X-Treg-Token + X-Treg-Key-Protocol: 1] -> {"balance_micro": 1000000} ``` Auth notes: - Balance/team endpoints require `X-Treg-Token: ` + `X-Treg-Key-Protocol: 1`. Plain `Authorization: Bearer` gets **401** on team resources. - Tokens minted before the Oct-2026 scopes deploy are BOOTSTRAP-scoped → **403 "finish team setup first"** on every team endpoint (balance included). Fresh logins mint proper team tokens. ## Anti-fraud notes (why some accounts get $0) - `SignupPromoClaim` is **unique per normalized inbox**: `+tag` is stripped for every domain, dots are stripped for gmail. One grant per mailbox, forever. - Retrying a $0 account with a second org does **not** pay again — the claim is already consumed. - Gmail `+alias` / dot-alias farms are therefore dead for this promo. Only genuinely fresh inboxes pay (separate real mailboxes, e.g. independent GH accounts with unique emails). - Flagged/suspended GitHub accounts bounce off `authorize` (redirect to `/dashboard` without a `code`) — the script reports it and moves on. ## Setup ```bash # Python 3.10+ pip install pyotp requests cp config.example.json config.json # optional; env overrides work too # GH pool: JSON array of accounts # [{"login": "...", "password": "...", "totp": "", "email": "..."}] ``` No secrets in the repo — `config.json`, pools, banks and state files are gitignored. ## Usage ```bash # register N accounts from the pool (resumable via gh_reg_state.json) python gh_oauth_reg.py 25 # env overrides GH_POOL=/path/to/pool.json GH_STATE=my_state.json python gh_oauth_reg.py 50 ``` Output: - `treg_gh_bank.jsonl` — the bank: `{ts, email, gh_login, org, org_id, token, balance_usd, via}` - `gh_reg_state.json` — resumable pool index Pacing is built in (8–15 s/account, `pace` in config.json). ## Using the keys ```bash # tool calls take Bearer: curl https://treg.to/call/treg.web.search \ -H "Authorization: Bearer ***" \ -H "Content-Type: application/json" \ -d '{"q": "hello world"}' # team/balance endpoints take X-Treg-Token: curl "https://treg.to/orgs//balance?limit=3" \ -H "X-Treg-Token: ***" -H "X-Treg-Key-Protocol: 1" # official CLI pip install "tools-registry[proxy]" treg login --token *** treg call treg.x.user.posts --data '{"username": "elonmusk", "limit": 3}' ``` Prices (live-verified): X user posts **$0.0005**, X search $0.00075, TikTok profile **$0.001**, web search **free** (19 providers), image gen ~$0.04, video gen ~$0.21. Platform margin 0% — you pay provider cost. BYOK keys are unmetered. ## Legacy: email+OTP door (treg_farm.py / verify_bank.py) Kept for reference. Flow: `POST /auth/email/start` → 6-digit OTP in the mail SUBJECT → `/auth/email/verify` → org → cli-token. Still registers fine, but grants are **$0** since the Turnstile-PASS gate (Oct 2026). Pitfalls it solves (IMAP `noop()` staleness, session-cookie-only cli-token mint, org-name filter, IP budget 30 starts/15 min, per-user grant lock) are documented in its file header. ## Disclaimer For authorized security research / personal API usage on your own accounts only. Respect treg.to ToS. --- [t.me/AlStack](https://t.me/AlStack) — free AI tools, APIs, proxies & farming drops