Prepare public codex auto register repo

This commit is contained in:
Ttungx
2026-03-06 11:19:56 +08:00
parent d3f3ee5f2e
commit f2acd3592a
9 changed files with 935 additions and 365 deletions
+93 -57
View File
@@ -1,87 +1,123 @@
# ChatGPT 批量自动注册工具
# codex_auto_register
> 使用 DuckMail 临时邮箱,并发自动注册 ChatGPT 账号
基于 DuckMail 的 ChatGPT / Codex 自动注册与 OAuth Token 生成工具集。
## 功能
## 致谢
- 📨 自动创建临时邮箱 (DuckMail)
- 📥 自动获取 OTP 验证码
- ⚡ 支持并发注册多个账号
- 🔄 自动处理 OAuth 登录
- ☁️ 支持代理配置
- 📤 支持上传账号到 Codex / CPA 面板
本项目基于原项目 https://github.com/adminlove520/chatgpt_register 改造而来。
## 环境
当前仓库的主要差异:
- 将注册codex邮箱服务从原先方案替换为 DuckMail API
- 保留并扩展 Codex 协议 OAuth 流程
- 输出 CLIProxyAPI v6 可识别的 Codex auth files
- 增加更适合公开仓库的示例配置与忽略规则
## 包含内容
- `chatgpt_register.py`:根目录下的 DuckMail 注册脚本
- `codex/protocol_keygen.py`:纯 HTTP 的 Codex OAuth 注册与 token 生成脚本
- `duckmaildoc.md`DuckMail API 参考文档(https://raw.githubusercontent.com/MoonWeSif/DuckMail/main/public/llm-api-docs.txt)
## 环境依赖
根目录脚本:
```bash
pip install curl_cffi
```
## 配置 (config.json)
Codex 脚本:
```json
{
"total_accounts": 5,
"duckmail_api_base": "https://api.duckmail.sbs",
"duckmail_bearer": "你的 DuckMail API Token",
"proxy": "http://127.0.0.1:7890",
"output_file": "registered_accounts.txt",
"enable_oauth": true,
"oauth_redirect_uri": "http://localhost:1455/auth/callback",
"ak_file": "ak.txt",
"rk_file": "rk.txt"
}
```bash
pip install requests urllib3
```
| 配置项 | 说明 |
|--------|------|
| total_accounts | 注册账号数量 |
| duckmail_bearer | DuckMail API Token |
| proxy | 代理地址 (可选) |
| output_file | 输出账号文件 |
| enable_oauth | 启用 OAuth 登录 |
| ak_file | Access Key 文件 |
| rk_file | Refresh Key 文件 |
## 配置方式
## CPA 面板集成
仓库只提交示例配置,不提交真实配置。
注册完成后,可以自动上传账号到 CPA 面板
使用前复制
| 配置项 | 说明 | 参考 |
|--------|------|------|
| upload_api_url | CPA 面板上传 API 地址 | https://help.router-for.me/cn/ |
| upload_api_token | CPA 面板登录密码 | 你的 CPA 面板密码 |
```bash
copy config.example.json config.json
copy codex\config.example.json codex\config.json
```
> CPA 面板仓库: https://github.com/dongshuyan/CPA-Dashboard
然后把你自己的 DuckMail、代理和 CPA 参数填进去。
## 使用
## 根目录脚本
运行:
```bash
python chatgpt_register.py
```
## 输出
对应示例配置见 `config.example.json`
注册成功的账号会保存到 `registered_accounts.txt`
主要配置项:
## 目录结构
| 配置项 | 说明 |
| ----------------- | ------------------------ |
| total_accounts | 注册账号数量 |
| duckmail_api_base | DuckMail API 地址 |
| duckmail_bearer | DuckMail Bearer Token |
| proxy | HTTP/HTTPS 代理 |
| output_file | 注册结果输出文件 |
| enable_oauth | 是否执行 OAuth |
| oauth_required | 是否要求 OAuth 成功 |
| upload_api_url | 可选,上传到 CPA 的接口 |
| upload_api_token | 可选,CPA 管理接口 Token |
## Codex 协议脚本
运行:
```bash
python codex\protocol_keygen.py
```
对应示例配置见 `codex/config.example.json`
该脚本会:
- 使用 DuckMail 创建临时邮箱
- 完成 ChatGPT 注册流程
- 执行 Codex OAuth 登录并换取 token
- 生成 CLIProxyAPI v6 兼容文件名的 token JSON
- 可选上传到 CPA 管理接口
## 输出说明
运行过程中通常会生成以下本地文件,这些都已加入 `.gitignore`,不会进入新仓库:
- `config.json`
- `codex/config.json`
- `registered_accounts.txt`
- `codex/accounts.txt`
- `codex/ak.txt`
- `codex/rk.txt`
- `codex/registered_accounts.csv`
- `codex/codex_tokens/`
- `codex/codex_accounts_tokens/`
## 仓库结构
```text
chatgpt_register/
├── chatgpt_register.py # 主程序
├── config.json # 配置文件
├── README.md # 本文档
├── codex/ # Codex 协议密钥生成
│ ├── config.json
── protocol_keygen.py
├── registered_accounts.txt # 输出的账号
├── ak.txt # Access Keys
└── rk.txt # Refresh Keys
├── chatgpt_register.py
├── config.example.json
├── duckmaildoc.md
├── README.md
└── codex/
── config.example.json
├── protocol_keygen.py
└── README.md
```
## 注意事项
## 说明
- 需要有效的代理才能注册成功
- DuckMail API Token 需要从 https://duckmail.sbs 获取
- 建议使用代理避免 IP 被封
- 使用 CPA 面板需要先部署面板服务
- 需要可用代理,否则注册、OAuth 和 CPA 自动刷新都会失败
- `config.json``codex/config.json` 仅保留在本地使用,不应提交
- 如果你使用 CLIProxyAPI,建议保持 `refresh_token` 与 token JSON 文件完整保存