Skip to main content
Codex Multi-Auth uses a unified settings system with three configuration layers: settings file, optional override files, and environment variables.

Configuration Layers

Runtime configuration is resolved in this order:
LayerPathPurpose
Unified settings~/.codex/multi-auth/settings.jsonDashboard display and backend pluginConfig
Optional config overrideCODEX_MULTI_AUTH_CONFIG_PATH=<path>External config file source
Root overrideCODEX_MULTI_AUTH_DIR=<path>Re-home settings/accounts/cache/log directories

Settings File Structure

The unified settings file (settings.json) contains two main sections:
{
  "version": 1,
  "dashboardDisplaySettings": {
    "menuAutoFetchLimits": true,
    "menuSortEnabled": true,
    "menuSortMode": "ready-first",
    "menuShowQuotaSummary": true,
    "menuShowQuotaCooldown": true,
    "menuLayoutMode": "compact-details"
  },
  "pluginConfig": {
    "codexMode": true,
    "liveAccountSync": true,
    "sessionAffinity": true,
    "proactiveRefreshGuardian": true,
    "preemptiveQuotaEnabled": true,
    "fetchTimeoutMs": 60000,
    "streamStallTimeoutMs": 45000
  }
}

Dashboard Display Settings

Control the interactive CLI dashboard appearance:
SettingTypeDefaultDescription
menuAutoFetchLimitsbooleantrueAuto-fetch quota limits on dashboard load
menuSortEnabledbooleantrueEnable account sorting in menu
menuSortModestring"ready-first"Sort mode: "ready-first", "health", "email"
menuShowQuotaSummarybooleantrueDisplay quota summary in menu
menuShowQuotaCooldownbooleantrueShow cooldown timers in menu
menuLayoutModestring"compact-details"Layout: "compact", "compact-details", "full"

Plugin Configuration

Core runtime behavior settings:
SettingTypeDefaultDescription
codexModebooleantrueEnable Codex CLI parity mode
liveAccountSyncbooleantrueSync account state across CLI sessions
sessionAffinitybooleantrueKeep same account for conversation (20min TTL)
proactiveRefreshGuardianbooleantrueRefresh tokens before expiration (60s interval)
preemptiveQuotaEnabledbooleantrueDefer requests when quota critically low
fetchTimeoutMsnumber60000HTTP request timeout (minimum 1000ms)
streamStallTimeoutMsnumber45000SSE stream stall timeout (minimum 1000ms)
perProjectAccountsbooleantrueStore accounts per-project instead of globally
sessionRecoverybooleantruePersist conversation state for recovery
autoResumebooleantrueAuto-resume interrupted conversations

Environment Variable Overrides

Environment variables override settings file values.

Stable Overrides

Safe for day-to-day use:
VariableTypeDescription
CODEX_MULTI_AUTH_DIRpathOverride root directory for plugin-managed files
CODEX_MULTI_AUTH_CONFIG_PATHpathLoad configuration from alternate path
CODEX_MODE0|1Disable or enable Codex mode
CODEX_TUI_V20|1Disable or enable TUI v2
CODEX_TUI_COLOR_PROFILEtruecolor|ansi256|ansi16Color profile selection
CODEX_TUI_GLYPHSascii|unicode|autoGlyph mode selection
CODEX_AUTH_FETCH_TIMEOUT_MSnumberHTTP request timeout override
CODEX_AUTH_STREAM_STALL_TIMEOUT_MSnumberStream stall timeout override
CODEX_AUTH_SESSION_AFFINITY0|1Enable/disable session affinity
CODEX_AUTH_LIVE_ACCOUNT_SYNC0|1Enable/disable live account sync

Advanced Overrides

For debugging, benchmarking, or maintainer workflows:
# Refresh lease tuning
export CODEX_AUTH_REFRESH_LEASE_TTL_MS=15000

# Sync with Codex CLI state
export CODEX_MULTI_AUTH_SYNC_CODEX_CLI=1

# Real Codex binary path
export CODEX_MULTI_AUTH_REAL_CODEX_BIN=/usr/local/bin/codex

# Bypass plugin (emergency fallback)
export CODEX_MULTI_AUTH_BYPASS=1

# CLI accounts path override
export CODEX_CLI_ACCOUNTS_PATH=/custom/path/accounts.json
Advanced overrides are intended for debugging only. Incorrect values can break authentication or cause data loss. See development/CONFIG_FIELDS.md for full inventory.

Resolution Precedence

Plugin runtime config resolution order:
1

Check unified settings

Load pluginConfig from ~/.codex/multi-auth/settings.json if present and valid.
2

Fallback to file config

If unified settings are absent or invalid, load from CODEX_MULTI_AUTH_CONFIG_PATH or legacy compatibility paths.
3

Apply defaults

Merge with hardcoded defaults for any missing settings.
4

Apply environment overrides

Environment variables override individual runtime settings (last priority, highest precedence).
Dashboard display values are resolved from persisted dashboardDisplaySettings and then normalized defaults. For most production environments, keep these enabled:
  • menuAutoFetchLimits — Ensures accurate quota display
  • menuSortEnabled — Improves account selection UX
  • liveAccountSync — Prevents stale account state across sessions
  • sessionAffinity — Maintains conversation continuity
  • proactiveRefreshGuardian — Prevents mid-conversation token expiration
  • preemptiveQuotaEnabled — Avoids quota exhaustion errors

Editing Settings

Via Settings Hub (Interactive)

Launch the interactive settings editor:
codex auth settings
Navigation:
  • Arrow keys: Move between settings
  • Space/Enter: Toggle or edit value
  • S: Save and exit
  • Q: Cancel without saving (discards changes)
Theme live-preview changes are restored to baseline on cancel (Q). Settings are written to ~/.codex/multi-auth/settings.json with EBUSY/EPERM retry logic (max 4 retries, exponential backoff).

Via Manual Edit

Edit the settings file directly:
# macOS/Linux
nano ~/.codex/multi-auth/settings.json

# Windows
notepad %USERPROFILE%\.codex\multi-auth\settings.json
Ensure the JSON is valid before saving. Invalid JSON will cause the plugin to fall back to defaults.

Via Environment Variables

For temporary overrides (e.g., CI/CD pipelines):
# Disable session affinity for this session
export CODEX_AUTH_SESSION_AFFINITY=0
codex auth check

# Increase fetch timeout for slow networks
export CODEX_AUTH_FETCH_TIMEOUT_MS=120000
codex auth forecast --live

Timeout Settings

Fetch Timeout

HTTP request timeout for account/token requests:
{
  "fetchTimeoutMs": 60000
}
Or via environment:
export CODEX_AUTH_FETCH_TIMEOUT_MS=90000
  • Default: 60000ms (60 seconds)
  • Minimum: 1000ms (1 second)
  • Use case: Increase for slow or unstable networks

Stream Stall Timeout

Detects stalled SSE streams during response streaming:
{
  "streamStallTimeoutMs": 45000
}
Or via environment:
export CODEX_AUTH_STREAM_STALL_TIMEOUT_MS=60000
  • Default: 45000ms (45 seconds)
  • Minimum: 1000ms (1 second)
  • Use case: Increase if you see false-positive stall warnings

Quota Deferral Settings

Preemptive quota scheduler defers requests when quota is critically low:
{
  "preemptiveQuotaEnabled": true,
  "preemptiveQuotaRemainingPercent5h": 5,
  "preemptiveQuotaRemainingPercent7d": 5,
  "preemptiveQuotaMaxDeferralMs": 7200000
}
SettingDefaultDescription
preemptiveQuotaEnabledtrueEnable/disable quota deferral
preemptiveQuotaRemainingPercent5h55-hour window threshold (0-100%)
preemptiveQuotaRemainingPercent7d57-day window threshold (0-100%)
preemptiveQuotaMaxDeferralMs7200000Max deferral time (2 hours)
When remaining quota falls below the threshold, the scheduler defers requests up to preemptiveQuotaMaxDeferralMs to wait for quota replenishment.

Live Account Sync Settings

Synchronize account state across CLI sessions and processes:
{
  "liveAccountSync": true,
  "liveAccountSyncDebounceMs": 250,
  "liveAccountSyncPollMs": 2000
}
SettingDefaultDescription
liveAccountSynctrueEnable live sync
liveAccountSyncDebounceMs250Debounce interval (min 50ms)
liveAccountSyncPollMs2000Polling interval (min 500ms)

Session Affinity Settings

Control session-to-account affinity:
{
  "sessionAffinity": true,
  "sessionAffinityTtlMs": 1200000,
  "sessionAffinityMaxEntries": 512
}
SettingDefaultDescription
sessionAffinitytrueEnable session affinity
sessionAffinityTtlMs1200000TTL per session (20 minutes)
sessionAffinityMaxEntries512Max tracked sessions (min 8)

Proactive Refresh Settings

Background token refresh before expiration:
{
  "proactiveRefreshGuardian": true,
  "proactiveRefreshIntervalMs": 60000,
  "proactiveRefreshBufferMs": 300000
}
SettingDefaultDescription
proactiveRefreshGuardiantrueEnable proactive refresh
proactiveRefreshIntervalMs60000Check interval (min 5000ms)
proactiveRefreshBufferMs300000Refresh buffer (min 30000ms)
Tokens are refreshed when expires_at - now < proactiveRefreshBufferMs.

Validating Configuration

Verify effective configuration with these commands:
# Check overall status
codex auth status

# List accounts (verifies storage paths)
codex auth list

# Health check (verifies timeouts and sync)
codex auth check

# Live forecast (verifies quota settings)
codex auth forecast --live

Storage Paths

Default storage locations (customizable via CODEX_MULTI_AUTH_DIR):
FilePath
Settings~/.codex/multi-auth/settings.json
Global accounts~/.codex/multi-auth/openai-codex-accounts.json
Project accounts~/.codex/multi-auth/projects/<key>/openai-codex-accounts.json
Flagged accounts~/.codex/multi-auth/openai-codex-flagged-accounts.json
Quota cache~/.codex/multi-auth/quota-cache.json
Audit log~/.codex/multi-auth/audit.log
See Storage Paths Reference for full details.

Legacy Compatibility

Legacy config files are discovered during migration:
  • ~/.codex/codex-multi-auth-config.json (legacy)
  • ~/.codex/openai-codex-auth-config.json (legacy)
These paths are checked only if unified settings are absent. Prefer unified settings for new setups.

Build docs developers (and LLMs) love