171 lines
4.6 KiB
Markdown
171 lines
4.6 KiB
Markdown
# gptplus_machine
|
||
|
||
ChatGPT 账号自动注册 / Plus 支付链接生成工具,以及 Codex CLI OAuth 登录工具。
|
||
|
||
当前临时邮箱 provider 支持:
|
||
|
||
- `vmail`
|
||
- `mailtm`
|
||
- `yyds`
|
||
|
||
## 功能
|
||
|
||
- **register** — 自动注册新 ChatGPT 账号,输出邮箱、密码、邮箱凭证、access token
|
||
- **checkout** — 注册账号后生成 Plus 支付链接,在浏览器完成支付
|
||
- **codex-login** — 对已有账号执行 Codex CLI OAuth 登录,纯 HTTP 实现,无需浏览器
|
||
- **temp mail** — 支持 `vmail` / `mailtm` / `yyds`
|
||
|
||
## 安装
|
||
|
||
### 方式 1:直接当命令行工具安装
|
||
|
||
```bash
|
||
uv tool install .
|
||
# 安装后即可直接执行
|
||
gptplus-auto --help
|
||
```
|
||
|
||
如果想装到当前项目虚拟环境里:
|
||
|
||
```bash
|
||
uv sync
|
||
uv run gptplus-auto --help
|
||
```
|
||
|
||
### 方式 2:源码方式运行
|
||
|
||
```bash
|
||
uv sync
|
||
```
|
||
|
||
## 配置
|
||
|
||
复制并编辑 `.env`:
|
||
|
||
```env
|
||
# 代理(推荐美国 IP)
|
||
SOCKS5_PROXY=socks5://user:pass@host:port
|
||
|
||
# 临时邮箱服务(可选:vmail / mailtm / yyds)
|
||
MAIL_PROVIDER=vmail
|
||
|
||
# vmail.dev(MAIL_PROVIDER=vmail 时需要)
|
||
VMAIL_API_KEY=your_vmail_api_key
|
||
|
||
# YYDS Mail(MAIL_PROVIDER=yyds 时需要)
|
||
YYDS_API_KEY=your_yyds_api_key
|
||
|
||
# YesCaptcha(注册功能需要)
|
||
YESCAPTCHA_API_KEY=your_key_here
|
||
|
||
# 支付地区(checkout 命令使用)
|
||
COUNTRY=US
|
||
CURRENCY=usd
|
||
```
|
||
|
||
### 临时邮箱 provider 说明
|
||
|
||
| Provider | `MAIL_PROVIDER` 值 | 说明 |
|
||
|---|---|---|
|
||
| vmail.dev | `vmail` | 需要 `VMAIL_API_KEY`;注册时会返回 `mailbox_id`,部分邮箱还会返回 `mailbox_password` |
|
||
| mail.tm | `mailtm` | 不需要 API key;支持自动创建邮箱并轮询 OTP |
|
||
| YYDS Mail | `yyds` | 需要 `YYDS_API_KEY`;支持自动创建邮箱并轮询 OTP |
|
||
|
||
> `register` / `checkout` 都支持以上三种 provider。
|
||
> `codex-login` 如需自动拉取邮箱 OTP,建议优先使用 `vmail` 或 `yyds`;`mailtm` 当前更适合手动通过 `--otp` 传入验证码。
|
||
|
||
## 使用
|
||
|
||
### 仅注册账号
|
||
|
||
```bash
|
||
gptplus-auto register
|
||
# 或源码方式
|
||
uv run python src/main.py register
|
||
```
|
||
|
||
输出示例:
|
||
|
||
```
|
||
=== Account Created ===
|
||
email: abc123@vmail.dev
|
||
password: Xk9#mPqLwZ2!vBnR
|
||
mailbox_id: aBcDeFgHiJkLmNoPq
|
||
mailbox_password: (空则无需密码)
|
||
access_token: eyJhbGci...
|
||
```
|
||
|
||
### 注册账号 + 获取 Plus 支付链接
|
||
|
||
```bash
|
||
gptplus-auto checkout
|
||
# 或源码方式
|
||
uv run python src/main.py checkout
|
||
```
|
||
|
||
输出示例:
|
||
|
||
```
|
||
=== Account Created ===
|
||
email: abc123@vmail.dev
|
||
password: Xk9#mPqLwZ2!vBnR
|
||
mailbox_id: aBcDeFgHiJkLmNoPq
|
||
|
||
=== Plus Checkout URL ===
|
||
https://pay.openai.com/c/pay/cs_live_a1...
|
||
```
|
||
|
||
在浏览器打开链接,按页面提示完成支付。优惠、价格和可用性以实际返回页面为准。
|
||
|
||
### Codex CLI OAuth 登录
|
||
|
||
```bash
|
||
gptplus-auto codex-login --email user@example.com --password yourpassword
|
||
# 或源码方式
|
||
uv run python src/main.py codex-login --email user@example.com --password yourpassword
|
||
```
|
||
|
||
可选参数:
|
||
|
||
| 参数 | 说明 |
|
||
|------|------|
|
||
| `--email` | 账号邮箱 |
|
||
| `--password` | 账号密码 |
|
||
| `--otp` | 邮箱 OTP(如需要)|
|
||
| `--workspace-id` | 指定 workspace ID |
|
||
| `--authorize-url` | 自定义 OAuth authorize URL |
|
||
| `--mailbox-id` | 邮箱 provider 返回的 mailbox/account ID(自动获取 OTP 时使用) |
|
||
| `--mailbox-password` | 邮箱密码(部分 provider 需要) |
|
||
|
||
成功后输出 `localhost:1455/auth/callback?code=...` 回调 URL,交给 Codex CLI 完成登录。
|
||
|
||
如果是用本项目刚注册的邮箱继续登录,建议保留 `register` / `checkout` 输出中的:
|
||
|
||
- `email`
|
||
- `mailbox_id`
|
||
- `mailbox_password`(如果有)
|
||
|
||
## 项目结构
|
||
|
||
```
|
||
src/
|
||
├── __init__.py # 包入口
|
||
├── __main__.py # python -m gptplus_auto
|
||
├── main.py # 入口(register / checkout / codex-login)
|
||
├── config.py # 配置(pydantic-settings,读取 .env)
|
||
├── http_client.py # HTTP 客户端(curl_cffi Chrome 模拟)
|
||
├── vmail_client.py # 临时邮箱客户端(vmail / mailtm / yyds)
|
||
├── captcha_solver.py # YesCaptcha hCaptcha 解题
|
||
├── chatgpt_register_http_reverse.py # 注册流程
|
||
├── chatgpt_payment.py # Stripe checkout 流程
|
||
├── codex_oauth_http_flow.py # Codex CLI OAuth 登录
|
||
└── nodatadog.js # sentinel token 抓包参考数据
|
||
```
|
||
|
||
## 注意事项
|
||
|
||
- 建议使用美国 IP 代理,避免触发风控
|
||
- 同 IP 短时间内多次注册可能被封,建议间隔使用
|
||
- checkout 链接有时效,生成后尽快使用
|
||
- 不同邮箱 provider 返回字段略有区别,属正常现象
|