TokenHarbor Auto-Reg Farm

Full pipeline for mass-registering TokenHarbor accounts, harvesting thk_live_* API keys and deploying them to a new-api VPS gateway as round-robin channels.

Note (Oct 2026): the $5 welcome gift has been turned off by TokenHarbor. The claim step (claim_gift) now no-ops / fails gracefully — the rest of the pipeline (register -> verify -> API key -> deploy, free models) still works.

Scale achieved: 762 accounts processed, 1064 keys harvested, 357+ keys deployed as new-api channels (claude-haiku-5.5, mimo, deepseek-flash :free models).

Architecture

t-online.de mail pool (17k accounts, IMAP)
        |
        v
th_tonline_claim.py  -- Chrome CDP :9222 --> tokenharbor.ai
   login -> verify email (IMAP) -> claim $5 -> create API key
        |
        v
tokenharbor_keys.txt  (email | thk_live_... | timestamp)
        |
        +---> push to key-aggregator gateway (POST /provider/add)
        +---> th_sync_vps.py --> new-api channels on VPS (1 key = 1 channel)

th_pipeline.py = watchdog loop: CDP alive -> claim chunk -> sync VPS -> repeat
th_proxy_router.py = rotating upstream proxy (127.0.0.1:8077) for fresh exit IPs

Files

File Purpose
th_tonline_claim.py Main worker. t-online.de pool: login -> trigger verify -> IMAP wait -> verify -> $5 claim -> API key -> gateway push
th_gmail_reg.py Backup mode: Gmail +alias signup flow (alias delivery gets blocked after first account)
th_local_api.py Local HTTP API: /register?count=N, /status, /keys, /push-all, /check-all-balances
th_sync_vps.py Validate new keys (live /v1/models) -> stop new-api -> INSERT channels+abilities into one-api.db -> start
th_pipeline.py Endless loop: CDP watchdog + claim chunks + auto-sync. Lock file prevents double instances
th_proxy_router.py Rotating HTTP/CONNECT proxy for Chrome --proxy-server=http://127.0.0.1:8077
th_reg_v2.py Signup-mode variant (fresh registration instead of pool login)
th_verify_fix.py Re-runs verify step for accounts stuck unverified
th_batch_runner.py Simple batch wrapper
th_stealth.py Camoufox/playwright stealth variant
th_parallel.py Multi-tab parallel CDP variant

Quick start

# 0. secrets into .env (see .env.example)
cp .env.example .env  # fill values

# 1. mail pool: email:password lines, one per account (t-online.de IMAP)
#    -> working_mails.txt

# 2. Chrome with CDP (Chrome 151+ REQUIRES --remote-allow-origins=*)
chrome.exe --remote-debugging-port=9222 --remote-allow-origins=* --user-data-dir=%USERPROFILE%/.chrome-cdp-profile

# 3. optional rotating proxy
python th_proxy_router.py &

# 4. farm N accounts
python th_tonline_claim.py 100

# 5. deploy fresh keys to VPS new-api
python th_sync_vps.py

# or full auto loop
python th_pipeline.py 300 15

Critical pitfalls (learned the hard way)

  1. $5 gift requires verified email. /api/welcome/claim returns 403 email_not_verified otherwise. Dashboard "Verify your email" button sends a FRESH letter — use it, then IMAP-wait with baseline UIDs only (60s timeout).
  2. Gmail +alias gets blocked by TokenHarbor after the first account — letters stop arriving. Use a real mail pool (t-online.de works).
  3. React inputs: input.value = x does nothing. You must use the native setter:
    var nativeSet = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,'value').set;
    nativeSet.call(inp, v); inp.dispatchEvent(new Event('input',{bubbles:true}));
    
  4. Next.js routing: window.location.href = '/dashboard/api-keys' leaves the page in LOADING forever. Use CDP Page.navigate + wait for "API keys" in text and "LOADING" not in text.
  5. Hidden buttons: API-keys page has many invisible Create key buttons from other rows — always check b.offsetParent !== null && !b.disabled.
  6. Gift claim is two-step: header button ("1 gift ready to claim") opens modal, THEN "Claim" inside modal, 2s sleep between.
  7. Rate limit: >1 account/min starts rejecting signups (redirect to /login?mode=signup). Sleep 2s+, back off to 5-10s on mass fails.
  8. new-api SQLite writes: ALWAYS systemctl stop new-api before writing one-api.db, start after — otherwise GORM/WAL cache drops your channels on restart.
  9. API key creation fails ~7-8% (Next.js race) — normal, move on.
  10. Orphan workers: killing the pipeline does NOT kill child th_tonline_claim.py — they fight over CDP and produce 0 keys. Kill by cmdline match first (psutil).
  11. free-models toggle: some accounts have free models OFF -> channel returns 403 on mimo-*:free. Probe each channel, strip mimo from models+abilities if off.
  12. Channel config that survives: auto_ban=0, weight=10, RetryTimes=10, RetryCooldownSeconds=90.

new-api channel schema (per key)

  • type=1, status=1, base_url=https://tokenharbor.ai, tag=tokenharbor
  • models: claude-haiku-5.5,mimo-v2.6-flash,mimo-v2.5,deepseek-v4.1-flash-th,deepseek-v4-flash-th
  • model_mapping: public name -> <upstream>:free
  • abilities: one row per model

Key format

thk_live_ + 64 chars [a-zA-Z0-9_-]. Validate with GET https://tokenharbor.ai/v1/models + Authorization: Bearer <key>.

Channel

More farms, gateways and free-tier abuse writeups: @AlStack

Disclaimer

Research/automation toolkit. Bring your own mail pool, proxies and infrastructure. Secrets live in .env (gitignored) — nothing sensitive in this repo.

S
Description
recovered from suspended github account aaronjaworski710 | published from the @AlStack channel: https://t.me/AlStack
https://t.me/AlStack Readme
82 KiB
Languages
Python 100%