Install
openclaw skills install codex-multi-subscription-auth-fallbacksSet up OpenClaw multi-provider auth with OpenAI Codex OAuth fallback profiles and automatic model switching. Use when configuring multiple OpenAI Codex accounts for rate-limit failover, adding new Codex OAuth profiles via device flow, or setting up a cron job to auto-switch models when a provider hits cooldown.
openclaw skills install codex-multi-subscription-auth-fallbacksMulti-provider auth setup for OpenClaw with automatic failover between Anthropic and multiple OpenAI Codex OAuth sessions.
OpenClaw supports multiple auth profiles per provider. When one profile hits a rate limit, the platform can fail over to another. This skill covers:
openclaw.json for provider fallback orderauth-profiles.json with multiple profilescodex CLI installed (npm i -g @openai/codex) — this also ensures node is availableWhat this skill accesses:
| File | Access | Purpose |
|---|---|---|
~/.codex/auth.json | Read + Temporary Write | Temporarily cleared to force a fresh device-flow login, then restored from backup. Original tokens are never deleted — a timestamped backup is created first. |
~/.openclaw/agents/main/agent/auth-profiles.json | Read + Write | Imported OAuth tokens (access + refresh) are written here. A timestamped backup is created before any modification. |
Important safety notes:
~/.codex/auth.json and your OpenClaw configs before running, especially on first use.Run the bundled script for each OpenAI account:
./scripts/codex-add-profile.sh <profile-name>
The script:
~/.codex/auth.json and auth-profiles.jsoncodex auth login (opens browser for OAuth)auth-profiles.jsonRepeat for each account. Profile names should be short identifiers (e.g., the OpenAI username).
Add auth profile declarations and fallback model config. See references/config-templates.md for the exact JSON blocks to add to openclaw.json.
Key sections:
auth.profiles — Declare each profile with provider and modeauth.order — Set failover priority per provideragents.defaults.model — Set primary model + fallbacksOpenClaw stores live tokens in agents/main/agent/auth-profiles.json. See references/config-templates.md for the schema.
Each Codex profile contains:
type: "oauth"provider: "openai-codex"access: JWT access token (auto-populated by the add-profile script)refresh: Refresh token (auto-populated)expires: Token expiry in ms (parsed from JWT)accountId: OpenAI account ID (parsed from JWT)The order object controls which profile is tried first per provider. The usageStats object tracks rate limits and cooldowns automatically.
This step is entirely optional. The auth profiles from Steps 1-3 work on their own with OpenClaw's built-in failover. This cron job adds automatic model switching, which means your active model may change without manual intervention. Only enable it if you understand and want this behavior.
Deploy a cron job that checks cooldown state every 10 minutes and switches the active model. See references/config-templates.md for the full cron job definition.
The cron job:
openclaw models status to check cooldown stateBefore enabling:
openclaw models status to verify your profiles are workingreferences/config-templates.md — the job only runs local commands and writes to a local state fileAdd the job to cron/jobs.json using the template in the references.
codex-auth-fallback/
├── SKILL.md # This file
├── scripts/
│ └── codex-add-profile.sh # Device-flow profile importer
└── references/
└── config-templates.md # openclaw.json, auth-profiles, cron templates