How soju06/codex-lb works
codex-lb pools ChatGPT accounts behind an OpenAI-compatible proxy. A client request enters the proxy, is routed to an eligible pooled account, and is forwarded upstream; account credentials and usage are managed through the dashboard and persisted for reporting and control. The README documents API-key limits, dashboard authentication, model synchronization, and automation capabilities. The graph uses documented product behavior and paths from the tree; sampled excerpts were partial, so uncertain internal call wiring is not asserted.
Main entry points: models.py Application database · proxy/service.py Proxy service · api.py Dashboard APIs · accounts/service.py Account management
Components 23
Proxy and routing
- Proxy endpoints
app/modules/proxy/api.py - Proxy service
app/modules/proxy/service.py - Account selection
app/modules/proxy/load_balancer.py - Codex transport
app/core/clients/codex.py - Model synchronization
app/core/openai/model_refresh_scheduler.py
Accounts and identity
- Account endpoints
app/modules/accounts/api.py - Account management
app/modules/accounts/service.py - Token refresh
app/modules/accounts/auth_manager.py - OAuth management
app/modules/oauth/service.py
Dashboard and controls
- Dashboard interface
frontend/src/App.tsx - Dashboard APIs
app/modules/dashboard/api.py - Dashboard authentication
app/modules/dashboard_auth/service.py - API key controls
app/modules/api_keys/service.py - Account automations
app/modules/automations/service.py
Usage and reporting
- Usage tracking
app/modules/usage/service.py - Live usage ingest
app/modules/usage/live_ingest.py - Request logs
app/modules/request_logs/repository.py - Reports
app/modules/reports/service.py
Runtime and persistence
- Application database
app/db/models.py - Application runtime
app/main.py
Other components
- OpenAI clients
- ChatGPT upstream
- Dashboard users
Connections 27
- OpenAI clients → Proxy endpoints: sends requests
- Proxy endpoints → Proxy service: dispatches
- Proxy service → Account selection: selects account
- Proxy service → Codex transport: forwards request
- Codex transport → ChatGPT upstream: sends upstream
- ChatGPT upstream → Codex transport: returns response
- Dashboard users → Dashboard interface: uses dashboard
- Dashboard interface → Dashboard APIs: calls APIs
- Dashboard APIs → Dashboard authentication: checks access
- Dashboard APIs → Account management: manages accounts
- Account endpoints → Account management: dispatches
- Account management → Application database: reads and writes
- Account management → Token refresh: refreshes credentials
- OAuth management → Account management: updates credentials
- Dashboard APIs → API key controls: manages keys
- API key controls → Application database: reads and writes
- Dashboard APIs → Account automations: manages jobs
- Account automations → Application database: reads and writes
- Proxy service → Usage tracking: updates usage
- Usage tracking → Application database: reads and writes
- Live usage ingest → Application database: persists snapshots
- Proxy service → Request logs: records requests
- Request logs → Application database: writes and queries
- Reports → Request logs: queries aggregates
- Reports → Dashboard interface: serves dashboard data
- Model synchronization → ChatGPT upstream: fetches models
- Application runtime → Proxy endpoints: hosts routes