grok-register README

The project's README from github.com/xinxinshuhao-create/grok-register. As one markdown file: README.md.

grok-register

Automated account registration toolkit for x.ai (Grok) with SSO token extraction, OAuth Device Flow minting, and auto-replenish daemon for API gateway integration.

Features

Prerequisites

Quick Start

# Clone
git clone https://github.com/xinxinshuhao-create/grok-register.git
cd grok-register

# Install dependencies
uv sync

# Configure
cp .env.example .env
# Edit .env with your API keys

# Create output directory
mkdir -p keys

# Run registration
uv run python grok.py

Configuration

Copy .env.example to .env and fill in:

Variable Required Description
YESCAPTCHA_KEY Yes YesCaptcha API key for Turnstile solving
EMAIL_PROVIDER No Email provider: luckmail / mailnest / gptmail / tmail / fce / gmail (default: luckmail)
LUCKMAIL_API_KEY If luckmail LuckMail API key
LUCKMAIL_PROJECT_CODE No LuckMail project code (default: grok)
LUCKMAIL_EMAIL_TYPE No Email type (default: ms_imap)
LUCKMAIL_DOMAIN No Email domain (default: outlook.com)
THREADS No Concurrent registration threads (default: 1)
GROK2API_BASE No API gateway URL for auto-replenish (default: http://127.0.0.1:8000)
GROK2API_USER No API gateway admin user (default: admin)
GROK2API_PASS No API gateway admin password
GROK_PROXY No HTTP proxy for registration (default: http://127.0.0.1:7897)

Email providers (email domains matter for xAI)

Provider Cost Email domain Headed Chrome Notes
luckmail (default) Paid (¥0.02/inbox) Outlook.com addresses No Verified for Grok codes (76-99s)
gmail Free Your own Gmail (+alias) No Highest trust; set GMAIL_BASE_EMAIL + GMAIL_APP_PASSWORD
fce Free Platform domains: @ditapi.info, @fce.email No Pure REST API; set FCE_API_KEY. Gmail/Outlook addresses are NOT accepted as inboxes; custom domains require paid plans ($29/mo+). Free tier has rate limits; OTP endpoint returns __DETECTED__ on free tier — codes are parsed from messages instead
tmail Free Shared eu.org domains Yes Anonymous, no key
gptmail Free Shared disposable domains Yes xAI does not deliver codes to these domains (use for other platforms)
outlook Free Your own Outlook/Hotmail (+tag alias) No High trust (personal domain). Set OUTLOOK_ACCOUNTS + OUTLOOK_TOKENS_FILE; requires one-time Microsoft OAuth authorization per account (see below)
mailnest Paid Outlook-based No Set MAILNEST_API_KEY + MAILNEST_PROJECT_CODE

⚠️ xAI actively blocks shared disposable-mail domains (mail.tm, gptmail domains). For Grok registration prefer luckmail (Outlook addresses) or gmail/outlook (your own accounts). Maintainer's production setup uses luckmail. The free providers above are provided as options for other users; their availability may change without notice.

Outlook provider authorization (one-time per account)

The outlook provider reads codes via Microsoft OAuth (XOAUTH2 IMAP). Authorize each account once:

# uses the same authorization flow as unified-mail's graph_auth.py
uv run python outlook_auth.py [email protected]

The resulting refresh token is stored in OUTLOOK_TOKENS_FILE (default ./outlook_tokens.json), format: {"[email protected]": {"refresh_token": "..."}}. Only accounts with a valid refresh token are used for registration.

Usage

Register accounts

# Basic
uv run python grok.py

# With luckmail provider and 8 threads
uv run python grok.py --email-provider luckmail --threads 8

Output:

Mint CPA tokens from SSO

uv run python sso_to_cpa.py --all

Converts SSO tokens to OAuth access/refresh tokens via Device Flow.

Run auto-replenish daemon

uv run python auto_replenish.py --daemon 600 --min 2

Monitors account pool every 600s, registers new accounts when pool drops below 2.

Run token refresh daemon

uv run python token_daemon.py

Re-mint revoked OAuth tokens

When xAI invalidates refresh tokens (happens on model releases or account policy changes), re-mint them:

uv run python remint_oauth.py

Re-runs Device Flow with existing SSO tokens to obtain fresh access/refresh tokens.

Start Turnstile solver

uv run python turnstile_solver_local.py

Local HTTP service for CAPTCHA solving (Patchright + system Chrome).

Start CloakBrowser solver (stealth)

# Install CloakBrowser (once)
pip install cloakbrowser
cloakbrowser install

# Start the HTTP service
uv run python cloakbrowser_solver.py

Uses CloakBrowser's stealth Chromium to pass Cloudflare Turnstile without a paid API. Set GROK_PROXY env var to route through a proxy (optional).

One-shot solve with CloakBrowser

uv run python cloakbrowser_solver.py --once --url https://example.com --key YOUR_SITE_KEY

Supported Models

Registered accounts and minted tokens can be used with grok2api to access the following models.

Free (Basic-tier accounts, no payment required)

These are the models you get immediately after registration — no SuperGrok subscription needed:

Model Capability How to get
grok-chat-fast Chat (fast mode) SSO token → Web pool
grok-imagine-image Image generation (lite) SSO token → Web pool
grok-4.5 Chat + reasoning + search, 1M output tokens SSO → Device Flow (sso_to_cpa.py) → Build pool
grok-4.6 Chat + reasoning + search, 500K context, long-running agents, xhigh reasoning SSO → Device Flow (sso_to_cpa.py) → Build pool

✅ All four models above have been tested and confirmed working end-to-end as of 2026-09-05.

Note: After Grok 4.6 release, xAI temporarily removed grok-4.5 from the Build pool (8/14), but it has been reinstated via CPA auths import API (2026-09-05). Both grok-4.5 and grok-4.6 are now available in the Build pool. Use remint_oauth.py or the grok2api admin import API to re-mint tokens if xAI revokes them.

Image generation: Only grok-imagine-image-lite is available for free accounts (fixed 832×1248 portrait, basic prompt following). grok-imagine-image-quality-lite is currently returning 502 errors. HD/edit/video models require Super subscription.

Paid (requires SuperGrok / Heavy subscription)

The following models are available in the codebase but require a paid account tier:

Model Capability Tier
grok-chat-auto Chat (auto mode) Super
grok-chat-expert Chat (expert mode) Super
grok-chat-heavy Chat (heavy mode) Heavy
grok-imagine-image-quality Image generation (HD) Super
grok-imagine-image-edit Image editing Super
grok-imagine-video Video generation Super

Other Build/Console models available via Device Flow: grok-4.3, grok-4.20-0309-reasoning, grok-4.20-0309-non-reasoning, grok-4.20-multi-agent-0309, grok-build-0.1 (code/composer, 256K output).

OAuth Device Flow

The sso_to_cpa.py script implements OAuth 2.0 Device Flow with the corrected scope:

openid profile email offline_access grok-cli:access api:access

This was validated against the upstream OAuth endpoint and successfully mints access/refresh tokens.

Acknowledgments

This project builds upon and references work from:

License

MIT

⚠️ Disclaimer / 免责声明

本工具仅用于教育和技术研究目的。使用者须自行承担全部责任。

This project is for educational and research purposes only. Users assume all responsibility.

grok-register (xinxinshuhao-create/grok-register)

Searching Database…

Что это?grok-register — автоматизированный набор инструментов, который регистрирует аккаунты x.ai (Grok), извлекает их SSO-токены, выпускает OAuth access/refresh-токены через Device Flow и держит демон, пополняющий пул аккаунтов для API-шлюза вроде grok2api.
Это библиотека для импорта или набор скриптов для запуска?Это набор самостоятельных Python-скриптов и демонов (grok.py, ssotocpa.py, autoreplenish.py, tokendaemon.py, remintoauth.py), запускаемых из командной строки, а не импортируемая библиотека.
Как его запустить?Установите Python 3.12+ с uv (или pip), скопируйте .env.example в .env и впишите свои ключи, затем запустите grok.py для регистрации аккаунтов или autoreplenish.py для запуска демона пополнения.
Что нужно, прежде чем регистрировать аккаунты?Нужны API-ключ YesCaptcha для решения Turnstile и аккаунт почтового провайдера — LuckMail или MailNest это платные рекомендуемые варианты, а бесплатные альтернативы вроде Gmail, Outlook или Tmail тоже поддерживаются.
Регистрация всегда срабатывает, какую бы почту я ни взял?Нет — xAI активно блокирует общие домены одноразовой почты вроде mail.tm и gptmail, так что нужен доверенный домен (Outlook через LuckMail или ваш собственный Gmail/Outlook), чтобы коды реально приходили.
Какие бесплатные модели я получу после регистрации аккаунта?Свежезарегистрированный аккаунт сразу даёт доступ к grok-chat-fast и lite-генерации изображений, а после запуска выпуска SSO-to-OAuth вы также получаете модели чата и рассуждений grok-4.5 и grok-4.6 без какой-либо подписки.
Что будет, если xAI отзовёт мои OAuth-токены?Когда xAI инвалидирует refresh-токены (это случается вокруг релизов моделей или смен политики), вы перезапускаете remintoauth.py, чтобы заново выпустить свежие access/refresh-токены из имеющихся SSO-токенов через Device Flow.
Как он проходит Cloudflare Turnstile?Он может использовать YesCaptcha как платный API решения, запустить собственный локальный решатель с Patchright и системным Chrome или задействовать стелс-Chromium от CloakBrowser, чтобы пройти Turnstile без каких-либо платных сервисов.
Можно ли гонять регистрации через прокси?Да, clashrotator.py ротирует прокси Clash для регистраций, а переменная окружения GROKPROXY позволяет провести и решатели CAPTCHA через HTTP-прокси.
Size
0.2 MB
Stars
521
Updated
CommitSep 22
Age
2mo
Commits · 90 Days