MCPInstall

cpa-codex-manager-openai-pool

Manage OpenAI account pools with automated registration, CLIProxyAPI monitoring, and intelligent auto-replenishment

Installs
252
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/reason-machines/codex-skills --skill cpa-codex-manager-openai-pool
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads cpa-codex-manager-openai-pool automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

CPA-Codex-Manager OpenAI Account Pool Management

Skill by ara.so — Codex Skills collection.

CPA-Codex-Manager is a high-performance management panel for OpenAI account pools, featuring automated batch registration, real-time CLIProxyAPI platform monitoring, and intelligent maintenance systems.

What It Does

  • Batch Account Registration: Parallel (up to 50 threads, 1000 tasks) and pipeline modes with random intervals
  • CLIProxyAPI Auto-Inspection: Detects 401 auth failures and quota exhaustion, auto-removes invalid accounts
  • Smart Auto-Replenishment: Monitors pool health, triggers automated replenishment when accounts fall below threshold
  • Real-time Monitoring: WebSocket-based log streaming and progress visualization
  • Multi-Email Support: Integrates Outlook, TempMail, CloudMail services
  • Emergency Defense: Dynamic threshold protection with configurable cooling periods

Installation

Standard Installation

# Using uv (recommended)
uv sync

# Or using pip
pip install -r requirements.txt

Environment Configuration

cp .env.example .env

Edit .env with your configuration:

# Web UI Configuration
WEBUI_HOST=0.0.0.0
WEBUI_PORT=8000
WEBUI_ACCESS_PASSWORD=your_secure_password

# Database (SQLite default)
APP_DATABASE_URL=data/database.db

# Or PostgreSQL
# APP_DATABASE_URL=postgresql://user:password@host:5432/dbname

Docker Installation

mkdir -p ~/CPA-Codex-Manager/data ~/CPA-Codex-Manager/logs
cd ~/CPA-Codex-Manager
curl -O https://raw.githubusercontent.com/Maoleio/CPA-Codex-Manager/main/docker-compose.yml
docker compose up -d

Desktop Mode

pip install pywebview
python desktop.py

Running the Application

Web Mode

python webui.py

Access at http://localhost:8000

Docker Mode

docker compose up -d
docker compose logs -f  # View logs
docker compose pull && docker compose up -d  # Update

Core Python API Usage

Database Models

from app.models import (
    AccountPool,
    RegistrationTask,
    CPAService,
    InspectionHistory
)
from app.database import get_db

# Query account pool
with get_db() as db:
    accounts = db.query(AccountPool).filter(
        AccountPool.status == 'ready'
    ).all()
    
    print(f"Ready accounts: {len(accounts)}")
    for acc in accounts:
        print(f"Email: {acc.email}, Token: {acc.refresh_token}")

Registration Task Creation

from app.services.registration import RegistrationService
from app.schemas import RegistrationTaskCreate

async def create_batch_registration():
    service = RegistrationService()
    
    task_data = RegistrationTaskCreate(
        count=100,
        email_service="outlook",  # outlook, tempmail, cloudmail
        mode="parallel",  # parallel or pipeline
        max_workers=50,
        random_interval_min=5,
        random_interval_max=15
    )
    
    task = await service.create_task(task_data)
    print(f"Task created: {task.id}")
    
    # Start registration
    await service.start_task(task.id)

CPA Service Integration

from app.services.cpa_service import CPAServiceManager

async def configure_cpa():
    manager = CPAServiceManager()
    
    # Add CPA service
    cpa = await manager.add_service(
        name="Production CPA",
        base_url="https://your-cpa-instance.com",
        admin_token="${CPA_ADMIN_TOKEN}",
        enabled=True
    )
    
    # Configure auto-inspection
    await manager.update_inspection_config(
        cpa.id,
        enabled=True,
        interval_minutes=60,
        check_401=True,
        check_quota=True,
        auto_remove=True
    )

Auto-Replenishment Configuration

from app.services.replenishment import ReplenishmentService

async def setup_auto_replenish():
    service = ReplenishmentService()
    
    # Configure replenishment rules
    await service.configure(
        cpa_service_id=1,
        enabled=True,
        threshold=50,  # Trigger when ready accounts < 50
        replenish_count=100,
        mode="parallel",
        email_service="outlook"
    )

Manual Account Inspection

from app.services.inspection import InspectionService

async def run_inspection():
    service = InspectionService()
    
    result = await service.inspect_cpa_accounts(
        cpa_service_id=1,
        check_401=True,
        check_quota=True,
        auto_remove=True
    )
    
    print(f"Inspection complete:")
    print(f"  Total checked: {result['total_checked']}")
    print(f"  Valid: {result['valid_count']}")
    print(f"  Invalid (401): {result['invalid_401']}")
    print(f"  Quota exhausted: {result['quota_exhausted']}")
    print(f"  Removed: {result['removed_count']}")

Emergency Defense Configuration

from app.services.emergency import EmergencyDefenseService

async def configure_emergency_defense():
    service = EmergencyDefenseService()
    
    await service.configure(
        enabled=True,
        threshold_percentage=50,  # Trigger if ready% < 50%
        cleanup_percentage=50,    # Remove 50% of accounts
        cooldown_minutes=5        # Wait 5min before retry
    )

WebSocket Integration for Real-time Logs

from fastapi import WebSocket
import asyncio

# Server-side WebSocket handler
async def websocket_log_stream(websocket: WebSocket, task_id: int):
    await websocket.accept()
    
    # Stream registration logs
    async for log_line in get_task_logs(task_id):
        await websocket.send_json({
            "type": "log",
            "task_id": task_id,
            "message": log_line,
            "timestamp": datetime.utcnow().isoformat()
        })
    
    await websocket.close()

Common Patterns

Full Registration Workflow

from app.services.registration import RegistrationService
from app.services.cpa_service import CPAServiceManager

async def full_registration_workflow():
    # Create and start registration task
    reg_service = RegistrationService()
    task = await reg_service.create_task(
        count=200,
        email_service="outlook",
        mode="parallel",
        max_workers=50
    )
    
    # Monitor progress
    await reg_service.start_task(task.id)
    
    while True:
        status = await reg_service.get_task_status(task.id)
        print(f"Progress: {status['success']}/{status['total']} "
              f"({status['progress_percentage']:.1f}%)")
        
        if status['status'] in ['completed', 'failed']:
            break
        
        await asyncio.sleep(5)
    
    # Upload successful accounts to CPA
    cpa_manager = CPAServiceManager()
    uploaded = await cpa_manager.upload_accounts(
        cpa_service_id=1,
        task_id=task.id
    )
    
    print(f"Uploaded {uploaded} accounts to CPA")

Scheduled Inspection with Auto-Replenish

import asyncio
from app.services.inspection import InspectionService
from app.services.replenishment import ReplenishmentService

async def scheduled_maintenance():
    inspection = InspectionService()
    replenish = ReplenishmentService()
    
    while True:
        # Run inspection
        result = await inspection.inspect_cpa_accounts(
            cpa_service_id=1,
            check_401=True,
            check_quota=True,
            auto_remove=True
        )
        
        # Check if replenishment needed
        ready_count = result['valid_count']
        if ready_count < 50:
            print(f"Low account count ({ready_count}), triggering replenishment")
            await replenish.trigger_replenish(
                cpa_service_id=1,
                count=100
            )
        
        # Wait 1 hour
        await asyncio.sleep(3600)

Query Account Pool Statistics

from app.database import get_db
from app.models import AccountPool
from sqlalchemy import func

def get_pool_statistics():
    with get_db() as db:
        stats = db.query(
            AccountPool.status,
            func.count(AccountPool.id).label('count')
        ).group_by(AccountPool.status).all()
        
        return {status: count for status, count in stats}

# Example output: {'ready': 150, 'invalid': 10, 'quota_exhausted': 5}

Configuration Best Practices

Inspection Configuration

# config.py or .env
INSPECTION_CONFIG = {
    "interval_minutes": 60,  # Check every hour
    "check_401": True,       # Enable auth failure detection
    "check_quota": True,     # Enable quota exhaustion detection
    "auto_remove": True,     # Auto-remove invalid accounts
    "emergency_threshold": 50,  # Trigger emergency if ready% < 50%
}

Replenishment Configuration

REPLENISHMENT_CONFIG = {
    "enabled": True,
    "threshold": 50,          # Trigger when ready accounts < 50
    "replenish_count": 100,   # Add 100 accounts per trigger
    "mode": "parallel",       # Use parallel mode for speed
    "email_service": "outlook",
    "max_workers": 50
}

Registration Modes

Parallel Mode (fast, high volume):

parallel_config = {
    "mode": "parallel",
    "max_workers": 50,
    "count": 1000
}

Pipeline Mode (stealth, bypass rate limits):

pipeline_config = {
    "mode": "pipeline",
    "random_interval_min": 10,
    "random_interval_max": 30,
    "count": 100
}

Troubleshooting

Registration Failures

# Check failed registrations
from app.models import RegistrationTask

with get_db() as db:
    failed_tasks = db.query(RegistrationTask).filter(
        RegistrationTask.status == 'failed'
    ).all()
    
    for task in failed_tasks:
        print(f"Task {task.id}: {task.error_message}")

CPA Connection Issues

from app.services.cpa_service import CPAServiceManager

async def test_cpa_connection():
    manager = CPAServiceManager()
    
    try:
        health = await manager.check_health(cpa_service_id=1)
        print(f"CPA Status: {health['status']}")
    except Exception as e:
        print(f"Connection failed: {e}")
        # Check base_url and admin_token in database

Account Pool Health Check

from app.services.inspection import InspectionService

async def health_check():
    service = InspectionService()
    
    result = await service.inspect_cpa_accounts(
        cpa_service_id=1,
        check_401=True,
        check_quota=True,
        auto_remove=False  # Don't remove, just check
    )
    
    total = result['total_checked']
    valid = result['valid_count']
    health_percentage = (valid / total * 100) if total > 0 else 0
    
    print(f"Pool health: {health_percentage:.1f}%")
    
    if health_percentage < 50:
        print("⚠️  Pool health critical, consider manual intervention")

Database Migration

# If using PostgreSQL, migrate from SQLite
from app.database import init_db
from app.models import Base

# Initialize new database schema
init_db()

# Manual data migration (example)
import sqlite3
from app.database import get_db

sqlite_conn = sqlite3.connect('data/database.db')
sqlite_cursor = sqlite_conn.cursor()

accounts = sqlite_cursor.execute(
    "SELECT email, password, refresh_token, status FROM account_pool"
).fetchall()

with get_db() as db:
    for email, password, token, status in accounts:
        account = AccountPool(
            email=email,
            password=password,
            refresh_token=token,
            status=status
        )
        db.add(account)
    db.commit()

Desktop Packaging

macOS

chmod +x scripts/build_macos_dmg.sh
./scripts/build_macos_dmg.sh
# Output: dist/CPA-Codex-Manager.dmg

Windows

scripts\build_windows.bat
REM Output: dist\CPA-Codex-Manager\CPA-Codex-Manager.exe

Environment Variables Reference

VariableDefaultDescription
WEBUI_HOST127.0.0.1Web UI bind address
WEBUI_PORT8000Web UI port
WEBUI_ACCESS_PASSWORD-Admin password (required)
APP_DATABASE_URLdata/database.dbDatabase connection string

All secrets should be stored in environment variables or .env file, never hardcoded.

FAQ

What does the cpa-codex-manager-openai-pool skill do?

Manage OpenAI account pools with automated registration, CLIProxyAPI monitoring, and intelligent auto-replenishment

How do I install cpa-codex-manager-openai-pool?

Run npx skills add https://github.com/reason-machines/codex-skills --skill cpa-codex-manager-openai-pool in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/cpa-codex-manager-openai-pool/ (personal) or .claude/skills/cpa-codex-manager-openai-pool/ (project).

Which AI agents can use cpa-codex-manager-openai-pool?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is cpa-codex-manager-openai-pool safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains cpa-codex-manager-openai-pool?

It is published by reason-machines in reason-machines/codex-skills. It has 252 recorded installs.

More from reason-machines/codex-skills

View all →

academic-research-skills-codex

reason-machines/codex-skills

AI-assisted academic research workflows for literature review, paper writing, peer review, and research pipelines

codexplusplus-launcher

reason-machines/codex-skills

Enhanced launcher for Codex App that unlocks plugins, enables session deletion, exports conversations, and syncs provider sessions via CDP injection

Security286 installs

codex-plugin-claude-code

reason-machines/codex-skills

Use OpenAI Codex from inside Claude Code for code reviews, adversarial reviews, and delegating tasks to Codex as a subagent.

AI & Agents277 installs

codex-plusplus-tweak-system

reason-machines/codex-skills

Expert in developing, installing, and managing tweaks for the Codex++ desktop app extension system

274 installs

awesome-codex-skills-curator

reason-machines/codex-skills

Curate, install, and manage Codex skills from the awesome-codex-skills collection for AI coding agents.

274 installs

awesome-codex-subagents

reason-machines/codex-skills

A curated collection of 136+ specialized Codex subagents for development tasks across 10 categories

AI & Agents273 installs

Popular ai & agents skills

View category →

google-agents-cli-publish

google/agents-cli

This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).

AI & Agents513.9K installs

google-agents-cli-eval

google/agents-cli

This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).

AI & Agents513.5K installs

skill-creator

anthropics/skills

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

OfficialAI & Agents416.4K installs

codex-pet

prime-skills/runcomfy-agent-skills

Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.

AI & Agents402.1K installs

full-output-enforcement

leonxlnx/taste-skill

Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.

AI & Agents401K installs

executing-plans

obra/superpowers

Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available

AI & Agents245.7K installs