explaingit

highkay/keytoauth

13PythonAudience · developerComplexity · 4/5Setup · hard

TLDR

A Python automation script that logs in to ChatGPT accounts using activation key codes, retrieves one-time email codes via an API, and saves the resulting session credentials in two output formats.

Mindmap

mindmap
  root((keytoauth))
    What it does
      Batch ChatGPT login
      Session credential export
      Key-to-session pipeline
    Components
      Patchright browser
      FlareSolverr bypass
      Email API for codes
      Proxy routing
    Outputs
      CPA format
      Sub2API format
      Per-account folders
    Config
      Keys text file input
      Proxy settings
      Wait time tuning
    Tech Stack
      Python
      Playwright Patchright
      FlareSolverr
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Batch-process a list of ChatGPT activation keys to extract usable session credentials without manual login steps.

USE CASE 2

Export ChatGPT session tokens into CPA or Sub2API format for use with downstream API proxy tooling.

USE CASE 3

Route headless browser login sessions through SOCKS5 or HTTP proxies to reduce IP-based blocks during automation.

Tech stack

PythonPatchrightPlaywrightFlareSolverr

Getting it running

Difficulty · hard Time to first run · 1h+

Requires a running FlareSolverr instance, Patchright (modified Playwright for Chrome), and a mail API to retrieve one-time verification codes.

No license information is provided in this repository.

In plain English

This is a Python script that automates the process of logging in to ChatGPT accounts using activation key codes and extracting the resulting session credentials. Given a list of keys, the tool uses a headless browser to visit the ChatGPT login page, retrieve a one-time verification code from an email API, complete the login flow, and then save the extracted session data in two formats: CPA (for use with CLIProxyAPI) and Sub2API. The README is written in Chinese and describes a pipeline involving several components: the Patchright browser library (a modified version of Playwright for Chrome), a locally running FlareSolverr instance to handle Cloudflare protection on the ChatGPT login page, a mail server API that retrieves verification codes, and an optional CLIProxyAPI management server to skip accounts that already have valid sessions. Typical usage involves providing a text file of keys, one per line, and running the script. The tool works through each key in sequence, opens a browser window, fills in the email address tied to that key, waits for a one-time code from the email API, submits it, and once logged in extracts the session JSON from the ChatGPT API endpoint. Output files are written to an output folder named after each account email address. The project includes support for proxy connections (HTTP, HTTPS, SOCKS4, SOCKS5) routed through both the browser and FlareSolverr. Configurable wait times help the script stay stable on slow proxy connections. Logs, screenshots, and HTML snapshots are saved on failure to help with debugging. The codebase is small, consisting of a few Python modules for API calls, browser automation, configuration, session conversion, and a command-line entry point. Tests for helper functions are included.

Copy-paste prompts

Prompt 1
I have a text file of ChatGPT activation keys and a running FlareSolverr instance. Walk me through configuring and running keytoauth to extract session credentials for all keys.
Prompt 2
Using keytoauth, how do I configure a SOCKS5 proxy so both the Patchright browser and FlareSolverr route their traffic through it during login?
Prompt 3
keytoauth saved credentials to the output folder in CPA and Sub2API formats. What is the difference between the two formats and where would I use each one?
Open on GitHub → Explain another repo

← highkay on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.