A focused Playwright helper for setting up one xAI account and creating one API key.
Languages: English · Bahasa Indonesia · Español · 简体中文 · 日本語
- Opens the official xAI console in a visible browser.
- Fills the account and team forms.
- Pauses for the verification code delivered to your email.
- Creates an API key from the xAI API Keys page.
- Writes the result to a local JSON file with restrictive permissions.
The project intentionally does not automate disposable inboxes, bypass CAPTCHA or anti-abuse controls, accept terms on your behalf, or purchase credits. Use an email address you control.
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
playwright install chromium
python xai_account_setup.pyThe script asks for your email, name, team name, API-key name, and password. When xAI sends the six-digit code, enter it in the terminal. If xAI presents a CAPTCHA or payment choice, complete or review it yourself.
The default output is xai_credentials.json. It contains the API key, so it
is excluded by .gitignore and should be treated like a password. Override
the path with XAI_OUTPUT when needed.
Interactive prompts can be replaced with environment variables:
export XAI_EMAIL="you@example.com"
export XAI_FIRST_NAME="Ada"
export XAI_LAST_NAME="Lovelace"
export XAI_TEAM_NAME="Personal API"
export XAI_KEY_NAME="Primary API Key"
export XAI_PASSWORD="use-a-private-password"
export XAI_OUTPUT="./private/xai_credentials.json"
python xai_account_setup.pyXAI_BROWSER_PROFILE controls the persistent Playwright profile directory.
Never commit that directory or an output file containing a key.
Run this for an account you are authorized to create. Respect xAI's terms, rate limits, billing rules, and verification requirements. This repository is intentionally a one-account setup helper, not a bulk account generator.
MIT. See LICENSE.