Overview
Codex Multi-Auth includes powerful forecasting and repair tools that help you maintain healthy accounts, predict availability, and automatically fix common issues. These features reduce downtime and provide actionable insights into account health.Account Forecasting
The forecast engine analyzes all accounts and recommends the best one to use based on multiple health signals.Readiness Forecast
Evaluates account availability across three states: ready, delayed, or unavailable based on cooldowns, rate limits, and quota pressure.
Risk Scoring
Assigns risk scores (0-100) considering token health, quota usage, refresh failures, and account age. Lower scores indicate healthier accounts.
Live Quota Probing
Use
--live mode to fetch real-time quota data from ChatGPT headers for stronger forecasting decisions.Wait Time Calculations
Provides precise estimates for when delayed accounts will become available based on cooldown timers and rate limit resets.
Basic Forecast
- Evaluates all enabled accounts
- Assigns availability status and risk level
- Recommends the best account to use
- Shows wait times for delayed accounts
Live Quota Mode
- Cached quota data may be stale
- Making critical account selection decisions
- Debugging quota-related issues
JSON Output
Risk Assessment
The forecast engine calculates risk scores based on multiple factors:| Factor | Risk Impact | Notes |
|---|---|---|
| Hard refresh failure (401, invalid_grant) | +90 | Token revoked or expired |
| Account disabled | +95 | Manually disabled accounts |
| Cooldown active | +45 | Recent auth or network failure |
| Rate limit active | +35 | Temporary quota exhaustion |
| Quota 98%+ used | +55 | Critical quota pressure |
| Quota 90-97% used | +35 | High quota usage |
| Quota 80-89% used | +20 | Moderate quota usage |
| Quota 70-79% used | +10 | Elevated quota usage |
| Refresh warning | +25 | Soft refresh errors |
| Account unused >7 days | +10 | Stale account penalty |
| Current account bonus | -5 | Prefer keeping current account |
- Low (0-39): Safe to use immediately
- Medium (40-74): Usable with caution
- High (75-100): Avoid unless no alternatives
Auto-Fix Workflow
Thefix command detects and repairs common storage and account issues automatically.
What It Fixes
Storage Corruption
Recovers from WAL journal, backup files, or repairs invalid JSON structures.
Duplicate Accounts
Removes duplicate entries based on accountId, refreshToken, or email (case-insensitive).
Invalid Active Index
Clamps activeIndex to valid range after deletions or deduplication.
Stale Tokens
Proactively refreshes tokens approaching expiry (default: 5-minute buffer).
Fix Options
Dry Run Example
Diagnostic Doctor
Thedoctor command performs comprehensive health checks and suggests remediation.
Health Checks
Diagnostic Areas
- Storage Integrity: File permissions, corruption, backup availability
- Token Health: Expiry times, refresh token validity, JWT structure
- Account State: Cooldowns, rate limits, quota usage, disabled status
- Configuration: Project root detection, worktree setup, storage paths
- Network: OAuth server reachability, API connectivity
- CLI State: Codex CLI sync status, state file integrity
Doctor Output
Report Command
Generate structured reports for support or automation:Integration Examples
CI/CD Health Check
Automated Repair
Related Commands
codex auth check- Quick account health checkcodex auth forecast- Detailed forecast with live quotacodex auth fix- Automatic repair workflowcodex auth doctor- Comprehensive diagnosticscodex auth report- Generate JSON health report