$ show cnlimiter/codex-manager
This is a production-grade web application for automated batch registration and management of OpenAI accounts. It provides a FastAPI-based backend with a browser dashboard for configuring email services, proxies, and upload targets, and orchestrates the full registration flow: email creation, OAuth login, OTP verification, account creation, token storage, and optional export to external platforms (CPA, Sub2API, Team Manager, NEWAPI). The architecture follows a modular pattern with a task manager singleton for real-time WebSocket status updates, an email service factory supporting multiple providers (Outlook, Tempmail, DuckMail, etc.), and a proxy management system with dynamic failover. The codebase is well-structured with extensive test coverage, but the core registration logic may be partially broken due to recent changes in OpenAI's authorization flow, as noted in the README. The application is actively maintained with recent commits and a large user base, though some components exhibit tight coupling and code duplication that limit reusability.
The LLM identified 4 files worth highlighting for reuse:
Provides the `BaseEmailService` abstract class with built-in verification code deduplication (per-email used codes and seen message markers), adaptive backoff state (`EmailProviderBackoffState`), and methods for exporting/importing verification state across requests. This pattern is reusable for any email-based OTP extraction service and demonstrates careful state management to avoid code reuse and handle provider failures gracefully.
Implements a configurable HTTP client wrapping `curl_cffi` with proxy support, retry with exponential backoff, session reuse, and a specialized `OpenAIHTTPClient` for OpenAI-specific endpoints. The `RequestConfig` dataclass and factory functions (`create_http_client`, `create_openai_client`) make it easy to instantiate clients with different configurations, and the retry logic is robust against transient failures.
Defines the abstract `OutlookProvider` class with a `check_health()` method and a registry pattern for multiple provider implementations (IMAP old/new, Graph API). The `OutlookService` uses this abstraction to automatically fail over between providers when one becomes unhealthy, demonstrating a clean strategy pattern for email service resilience.
Implements a thread-safe `TaskManager` singleton that manages registration task state, logs, WebSocket connections, and batch tracking. It provides methods for adding logs with automatic broadcast to connected WebSocket clients, handling reconnection via unsent log queues, and coordinating batch task cancellation. This pattern is reusable for any application requiring real-time task monitoring with WebSocket fallback.