# compute-pool-client Bring-your-own-credentials client for the [modeloc.com](https://modeloc.com) compute pool. One account per run, pure HTTP, no browser automation. The interesting part is not "register an account" — modeloc has no passwords at all, auth is OAuth only (GitHub / NodeLoc / Google). The interesting part is the exact sequence that decides whether the account lands with a usable credit balance, and the four places where a naive implementation silently fails. ## What the flow actually is ``` GET /i/ -> Set-Cookie: ara_invite (grants the onboarding credit) GET /auth/oauth/github -> 302 github.com/login/oauth/authorize GET github authorize -> 200 consent page POST github authorize -> fields incl. authorize=1 -> 302 modeloc.com/auth/oauth/github/callback?code=... -> Set-Cookie: ara_session GET /pool/balance -> {"spendable":"...", "enrolled":bool} POST /pool/enroll -> {"enrolled":true,"endpoint":"/pool/v1"} POST /pool/keys -> {"key":"pk_..."} GET /pool/v1/models -> catalog POST /pool/v1/chat/completions -> OpenAI-compatible ``` ## Traps (each one cost real debugging time) | # | Symptom | Cause | Fix | |---|---------|-------|-----| | 1 | `200 already authorized` instead of `?code=` | the HTTP client installed a NoRedirect handler | keep a second opener bound to the **same** cookie jar that follows redirects | | 2 | redirect never captured | header case: `location` vs `Location` | case-insensitive header lookup | | 3 | `404` right after consent | the consent page has **two** submit buttons named `authorize`: `value="0"` = Cancel, `value="1"` = Authorize | pick the one with `value="1"`, not the first in DOM order | | 4 | `422 {"detail":[{"type":"dict_type"}]}` on `/pool/keys` | body not recognised as JSON | send `Content-Type: application/json` explicitly | | 5 | `403 error code 1010` on `/pool/v1/*` | Cloudflare TLS fingerprint blocks bare `urllib`/`requests` | `curl_cffi` with `impersonate="chrome"` | | 6 | balance looks like `0E+4` | scientific-notation zero from the API | it is a real zero — don't string-replace it into `10000` | Also worth knowing: a key can exist while `/pool/v1/models` answers 200 and `chat/completions` answers 402 — the key is valid, the balance is not. `429` from Cloudflare is throttling, not a dead key: retry sequentially with a few seconds of delay before writing the key off. ## Install ```bash python3 -m venv .venv && . .venv/bin/activate pip install -r requirements.txt # curl_cffi (needed for /pool/v1) ``` ## Use ```bash # GitHub session cookie from your own browser (DevTools -> Application -> Cookies -> github.com) export GH_COOKIE='user_session=...; _gh_sess=...; logged_in=yes' python pool_client.py --invite YOURCODE --model deepseek-v4-flash ``` Batch: ```bash python pool_client.py --cookie-file cookies.txt --invite YOURCODE --json > out.jsonl ``` Balance only (no key creation): ```bash python pool_client.py --no-key --invite YOURCODE ``` Behind a proxy: `--proxy http://host:port` (or `HTTPS_PROXY` in env). ## Output `run_account()` returns a dict: ```json { "ok": true, "gh_login": "octocat", "oauth": {"ok": true}, "balance": {"credits": "...", "spendable": "...", "enrolled": true}, "key": "pk_...", "models": {"http": 200, "models": 144}, "probe": {"http": 200}, "secs": 27.4 } ``` Secrets stay in your process. Nothing is written to disk unless you redirect stdout. ## Scope and honesty * This tool does not create GitHub accounts, does not solve captchas and does not bypass any verification. You bring a session you already own. * It does not include invite codes. If you have one you are entitled to use, pass it. * Credit grants, model catalogues and limits are modeloc's business decisions and change without notice — the tool reports what the API returns, nothing more. * No warranty. Use it on accounts you control and within modeloc's terms. ## Attribution Built while reverse-engineering the modeloc.com compute pool. 👻 [иишко](https://t.me/AlStack) — [@AlStack](https://t.me/AlStack) ## License MIT — see [LICENSE](LICENSE).