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
+51 -37
View File
@@ -1,60 +1,74 @@
# Codex 协议密钥生成工具
> 为 ChatGPT 注册生成 Codex 协议所需的 Access Key 和 Refresh Key
该目录提供基于 DuckMail 的纯 HTTP Codex OAuth 注册与 token 生成脚本。
## 功能
## 主要能力
- 🔑 自动生成 Access Key (ak)
- 🔄 自动生成 Refresh Key (rk)
- 📤 支持上传到 Codex / CPA 面板
- ⚡ 支持并发生成
- 纯 HTTP 注册 ChatGPT 账号
- 通过 DuckMail API 创建邮箱并读取验证码
- 获取 `access_token``refresh_token``id_token`
- 生成 CLIProxyAPI v6 兼容的 token JSON 文件名
- 可选上传到 CPA 管理接口
## 配置 (config.json)
## 配置文件
只提交示例文件:
```bash
copy config.example.json config.json
```
示例配置字段:
```json
{
"total_accounts": 800,
"concurrent_workers": 8,
"total_accounts": 10,
"concurrent_workers": 2,
"headless": false,
"proxy": "http://127.0.0.1:7890",
"cf_worker_domain": "你的 Cloudflare Worker 域名",
"cf_email_domain": "你的 Cloudflare 邮箱域名",
"cf_admin_password": "你的 Cloudflare 管理密码",
"upload_api_url": "https://你的CPA地址/v0/management/auth-files",
"upload_api_token": "你的CPA密码",
"cli_proxy_api_base": "你的CPA基础URL",
"cli_proxy_management_url": "http://你的CPA地址/management.html#/oauth",
"cli_proxy_password": "你的CPA密码"
"proxy": "http://127.0.0.1:7897",
"duckmail_api_base": "https://api.duckmail.sbs",
"duckmail_api_key": "",
"oauth_issuer": "https://auth.openai.com",
"oauth_client_id": "app_EMoamEEZ73f0CkXaXp7hrann",
"oauth_redirect_uri": "http://localhost:1455/auth/callback",
"upload_api_url": "http://localhost:8317/v0/management/auth-files",
"upload_api_token": "",
"accounts_file": "accounts.txt",
"csv_file": "registered_accounts.csv",
"ak_file": "ak.txt",
"rk_file": "rk.txt",
"token_json_dir": "codex_accounts_tokens"
}
```
| 配置项 | 说明 |
|--------|------|
| total_accounts | 生成账号数量 |
| concurrent_workers | 并发数 |
| proxy | 代理地址 |
| cf_worker_domain | Cloudflare Worker 域名 |
| upload_api_url | CPA 上传 API |
| cli_proxy_api_base | CPA CLI 代理 API |
## 使用
```bash
python protocol_keygen.py
```
## 输出
## 输出文件
- `ak.txt` - Access Keys
- `rk.txt` - Refresh Keys
- `registered_accounts.csv` - CSV 格式账号
运行后会在本地生成:
## 接入 CPA 面板
- `accounts.txt`
- `registered_accounts.csv`
- `ak.txt`
- `rk.txt`
- `codex_accounts_tokens/` 或你配置的 token 输出目录
生成后可以自动上传到 CPA 面板:
这些文件都应保留本地使用,不应提交到仓库。
1. 部署 CPA 面板: https://github.com/dongshuyan/CPA-Dashboard
2. 配置 `upload_api_url``upload_api_token`
3. 运行后自动上传
## 与原项目的差异
> 文档: https://help.router-for.me/cn/
相比上游项目,本目录的核心改动是将邮箱接收能力切换为 DuckMail:
- 使用 `POST /accounts` 创建临时邮箱
- 使用 `POST /token` 获取 DuckMail Bearer Token
- 使用 `GET /messages``GET /messages/{id}` 轮询验证码邮件
## CPA 使用说明
- 生成的 token JSON 适配 CLIProxyAPI v6 命名格式
- `refresh_token` 会一并保存,供 CPA 自动刷新 access token
- 如果配置了 `upload_api_url`,脚本会自动上传生成的 auth file
+18
View File
@@ -0,0 +1,18 @@
{
"total_accounts": 10,
"concurrent_workers": 2,
"headless": false,
"proxy": "http://127.0.0.1:7897",
"duckmail_api_base": "https://api.duckmail.sbs",
"duckmail_api_key": "",
"oauth_issuer": "https://auth.openai.com",
"oauth_client_id": "app_EMoamEEZ73f0CkXaXp7hrann",
"oauth_redirect_uri": "http://localhost:1455/auth/callback",
"upload_api_url": "",
"upload_api_token": "",
"accounts_file": "accounts.txt",
"csv_file": "registered_accounts.csv",
"ak_file": "ak.txt",
"rk_file": "rk.txt",
"token_json_dir": "codex_accounts_tokens"
}
-21
View File
@@ -1,21 +0,0 @@
{
"total_accounts": 800,
"concurrent_workers": 8,
"headless": false,
"proxy": "",
"cf_worker_domain": "",
"cf_email_domain": "",
"cf_admin_password": "",
"oauth_issuer": "https://auth.openai.com",
"oauth_client_id": "app_EMoamEEZ73f0CkXaXp7hrann",
"oauth_redirect_uri": "http://localhost:1455/auth/callback",
"upload_api_url": "https://你的CPA地址/v0/management/auth-files",
"upload_api_token": "你的CPA密码",
"cli_proxy_api_base": "你的CPA基础URL",
"cli_proxy_management_url": "http://你的CPA地址/management.html#/oauth",
"cli_proxy_password": "你的CPA密码",
"accounts_file": "accounts.txt",
"csv_file": "registered_accounts.csv",
"ak_file": "ak.txt",
"rk_file": "rk.txt"
}
+493 -228
View File
File diff suppressed because it is too large Load Diff