Standalone OpenAI Pool CLI

一个纯 CLI 版的 OpenAI Pool Orchestrator可直接从 /root/standalone_cli 运行,不依赖原仓库路径。

目录结构

/root/standalone_cli/
|- main.py                         # 主 CLI 入口
|- run.py                          # 便捷启动脚本
|- support.py                      # 配置/同步/状态辅助逻辑
|- requirements.txt                # 运行依赖
|- README.md                       # 使用说明
|- config/
|  `- sync_config.example.json     # 配置模板
|- data/
|  |- sync_config.json             # 实际运行配置
|  |- state.json                   # 成功/失败统计
|  `- tokens/                      # 本地 token 文件
`- openai_pool_orchestrator/
   |- register.py                  # 注册核心逻辑
   |- pool_maintainer.py           # CPA/Sub2Api 维护逻辑
   `- mail_providers.py            # 邮箱提供商适配

安装依赖

cd /root/standalone_cli
pip install -r requirements.txt

如果你想用可编辑安装:

cd /root/standalone_cli
pip install -e .
openai-pool-standalone --help

初始化配置

python3 /root/standalone_cli/main.py config init

如果你希望像向导一样逐步填写配置,直接用:

python3 /root/standalone_cli/run.py config setup

config init 只是初始化配置文件;config setup 才是交互式配置引导。

config setup 现在也支持交互式填写 PostgreSQL 入库配置。

初始化后请编辑:

  • /root/standalone_cli/data/sync_config.json

至少按需填写:

  • proxy
  • cpa_base_url
  • cpa_token
  • base_url
  • bearer_tokenemail + password
  • 邮箱提供商配置 mail_provider_configs

如果你希望注册成功后把邮箱、GPT 密码、邮箱密码、姓名、生日等信息写入 PostgreSQL还需要填写

  • db_enabled
  • db_host
  • db_port
  • db_name
  • db_user
  • db_password
  • db_table
  • db_source

当前你这边实际使用的数据库名是:mail_accounts_db

现在不仅 oauth=ok 的成功注册会入库,oauth=failed 的失败注册也会尽量记录当前已拿到的信息。

当前这台机器实测可用的代理是:

  • http://127.0.0.1:17891

说明:这个 proxy 用于 OpenAI 注册流程,邮箱服务接口默认直连,不走代理。

如果你在 DuckMail 配置里填写了 domain,程序会固定使用这个域名创建邮箱,不会随机切换到其他 DuckMail 域名。

模板里的 URL 现在使用了更明确的占位值:

  • https://your-cpa.example.com
  • https://your-sub2api.example.com

留空的字段表示需要你自行填写真实值,例如:

  • cpa_token
  • bearer_token
  • password
  • proxy_pool_api_key

常用命令

查看帮助

python3 /root/standalone_cli/main.py --help
python3 /root/standalone_cli/run.py --help

查看当前配置

python3 /root/standalone_cli/main.py --json config show

单次注册

python3 /root/standalone_cli/main.py register --once

循环注册

python3 /root/standalone_cli/main.py register --sleep-min 5 --sleep-max 30

指定代理注册

python3 /root/standalone_cli/main.py register --proxy http://127.0.0.1:7897 --once

如果你直接使用当前机器的代理,建议改成:

python3 /root/standalone_cli/main.py register --proxy http://127.0.0.1:17891 --once

查看本地 token

python3 /root/standalone_cli/main.py tokens --limit 20

CPA 维护

python3 /root/standalone_cli/main.py cpa status
python3 /root/standalone_cli/main.py cpa check
python3 /root/standalone_cli/main.py cpa maintain
python3 /root/standalone_cli/main.py cpa upload-all

Sub2Api 维护

python3 /root/standalone_cli/main.py sub2api status
python3 /root/standalone_cli/main.py sub2api check
python3 /root/standalone_cli/main.py sub2api sync-all
python3 /root/standalone_cli/main.py sub2api maintain
python3 /root/standalone_cli/main.py sub2api dedupe --apply

统计信息

python3 /root/standalone_cli/main.py stats

运行方式

两种方式等价:

python3 /root/standalone_cli/main.py --help
python3 /root/standalone_cli/run.py --help

其中 python3 /root/standalone_cli/run.py 在不带参数时会自动显示帮助,更适合首次使用。

安装为命令行后也可以这样运行:

openai-pool-standalone --help
openai-pool-standalone register --once

Docker

构建镜像:

cd /root/standalone_cli
docker build -t openai-pool-standalone .

运行容器:

docker run --rm -it \
  -v /root/standalone_cli/data:/app/data \
  openai-pool-standalone config show

或使用 compose

cd /root/standalone_cli
docker compose up --build

当前 compose 默认执行 daemon 常驻模式,会一直运行直到你手动停止。

在这个模式下:

  • 按配置周期检查号池状态
  • 号池不足且 auto_register = true 时自动补号
  • threshold - candidates 估算补号差值;当 auto_register_max_per_loop = 0 时按差值动态补齐,否则受该值限制
  • 单个补号失败不会终止整轮补号,会继续尝试后续账号
  • 号池满足阈值时不执行注册
  • maintain_interval_minutes / sub2api_maintain_interval_minutes 自动维护

由于当前代理是宿主机 127.0.0.1:17891compose 已使用 host 网络模式。

常用命令:

cd /root/standalone_cli
docker compose up --build -d
docker compose logs -f
docker compose down

验证命令

python3 -m compileall /root/standalone_cli
python3 /root/standalone_cli/main.py --json config show
python3 /root/standalone_cli/main.py --json stats
python3 /root/standalone_cli/run.py --help

说明

  • 这个目录现在已经包含独立的核心代码,不再依赖 /root/openai_pool_orchestrator-main
  • 运行配置与 token 只写入 /root/standalone_cli/data/
  • 不要把真实密钥、token、邮箱密码提交到版本库
Description
Standalone CLI for automated OpenAI registration and account-pool maintenance
Readme 338 KiB
Languages
Python 99.8%
Dockerfile 0.2%