Files
gptplus_machine/README.md

137 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# gptplus_machine
ChatGPT 账号自动注册工具,以及 Codex CLI OAuth 登录工具。
## 功能
- **register** — 自动注册新 ChatGPT 账号,输出邮箱、密码、邮箱凭证
- **checkout** — 注册账号后生成 Plus 支付链接(首月免费),在浏览器完成支付即可开通
- **codex-login** — 对已有账号执行 Codex CLI OAuth 登录,纯 HTTP 实现,无需浏览器
## 安装
### 方式 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
MAIL_PROVIDER=vmail
# YesCaptcha注册功能需要
YESCAPTCHA_API_KEY=your_key_here
# 支付地区checkout 命令使用)
COUNTRY=US
CURRENCY=usd
```
## 使用
### 仅注册账号
```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...
```
在浏览器打开链接填入信用卡信息完成支付新账号享首月免费优惠Plus 即开通。
### 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` | vmail.dev mailbox ID自动获取 OTP|
| `--mailbox-password` | vmail.dev mailbox 密码 |
成功后输出 `localhost:1455/auth/callback?code=...` 回调 URL交给 Codex CLI 完成登录。
## 项目结构
```
src/
├── main.py # 入口register / checkout / codex-login
├── config.py # 配置pydantic-settings读取 .env
├── http_client.py # HTTP 客户端curl_cffi Chrome 模拟)
├── vmail_client.py # 临时邮箱客户端
├── captcha_solver.py # YesCaptcha hCaptcha 解题
├── chatgpt_register_http_reverse.py # 注册流程
├── chatgpt_payment.py # Stripe checkout 流程
└── codex_oauth_http_flow.py # Codex CLI OAuth 登录
```
## 注意事项
- 建议使用美国 IP 代理,避免触发风控
- 同 IP 短时间内多次注册可能被封,建议间隔使用
- checkout 链接有时效约30分钟生成后尽快使用