# Send Codex Multi Subscription Auth Fallbacks to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "codex-multi-subscription-auth-fallbacks",
    "name": "Codex Multi Subscription Auth Fallbacks",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/Markeljan/codex-multi-subscription-auth-fallbacks",
    "canonicalUrl": "https://clawhub.ai/Markeljan/codex-multi-subscription-auth-fallbacks",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/codex-multi-subscription-auth-fallbacks",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=codex-multi-subscription-auth-fallbacks",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "SKILL.md",
      "scripts/codex-add-profile.sh",
      "references/config-templates.md"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "codex-multi-subscription-auth-fallbacks",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-01T23:40:37.231Z",
      "expiresAt": "2026-05-08T23:40:37.231Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=codex-multi-subscription-auth-fallbacks",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=codex-multi-subscription-auth-fallbacks",
        "contentDisposition": "attachment; filename=\"codex-multi-subscription-auth-fallbacks-1.1.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "codex-multi-subscription-auth-fallbacks"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/codex-multi-subscription-auth-fallbacks"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/codex-multi-subscription-auth-fallbacks",
    "downloadUrl": "https://openagent3.xyz/downloads/codex-multi-subscription-auth-fallbacks",
    "agentUrl": "https://openagent3.xyz/skills/codex-multi-subscription-auth-fallbacks/agent",
    "manifestUrl": "https://openagent3.xyz/skills/codex-multi-subscription-auth-fallbacks/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/codex-multi-subscription-auth-fallbacks/agent.md"
  }
}
```
## Documentation

### Codex Auth Fallback

Multi-provider auth setup for OpenClaw with automatic failover between Anthropic and multiple OpenAI Codex OAuth sessions.

### Overview

OpenClaw supports multiple auth profiles per provider. When one profile hits a rate limit, the platform can fail over to another. This skill covers:

Adding Codex OAuth profiles via device-flow login
Configuring openclaw.json for provider fallback order
Setting up auth-profiles.json with multiple profiles
Deploying a cron job to auto-switch models on cooldown

### Prerequisites

OpenClaw instance running
codex CLI installed (npm i -g @openai/codex) — this also ensures node is available
One or more OpenAI accounts with Codex access

### Security & Safety

What this skill accesses:

FileAccessPurpose~/.codex/auth.jsonRead + Temporary WriteTemporarily 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.jsonRead + WriteImported OAuth tokens (access + refresh) are written here. A timestamped backup is created before any modification.

Important safety notes:

Tokens stay local. No tokens are sent to any external endpoint. The script reads tokens from the local Codex CLI auth file and writes them to the local OpenClaw auth-profiles file.
Backups are always created. Both files are backed up with timestamps before any modification. If login fails or the script is interrupted, a trap handler restores the original Codex CLI auth automatically.
Interactive confirmation. The script prompts for confirmation before clearing the Codex CLI auth file, so you can abort if needed.
No elevated privileges. The script runs as your user and does not require sudo or any special permissions.
Back up manually first. Despite the automatic backups, it is recommended to manually back up ~/.codex/auth.json and your OpenClaw configs before running, especially on first use.
Test with a non-production account. For initial testing, consider using a throwaway or non-production OpenAI account.

### Step 1: Add Codex OAuth Profiles

Run the bundled script for each OpenAI account:

./scripts/codex-add-profile.sh <profile-name>

The script:

Backs up ~/.codex/auth.json and auth-profiles.json
Clears Codex CLI auth to force fresh device-flow login
Runs codex auth login (opens browser for OAuth)
Extracts tokens and imports them into OpenClaw's auth-profiles.json
Restores the original Codex CLI auth

Repeat for each account. Profile names should be short identifiers (e.g., the OpenAI username).

### Step 2: Configure openclaw.json

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 mode
auth.order — Set failover priority per provider
agents.defaults.model — Set primary model + fallbacks

### Step 3: Auth Profiles JSON Structure

OpenClaw 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.

### Step 4: Model Cooldown Auto-Switch Cron (Optional)

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:

Runs openclaw models status to check cooldown state
Picks the best available model (priority: opus > codex profiles in order)
Updates the session model override if needed
Logs state to a local memory file; only notifies on change

Before enabling:

Test manually first: run openclaw models status to verify your profiles are working
Review the cron job template in references/config-templates.md — the job only runs local commands and writes to a local state file
The job runs in an isolated session and does not affect your main chat unless a model switch occurs

Add the job to cron/jobs.json using the template in the references.

### File Layout

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
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: Markeljan
- Version: 1.1.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-01T23:40:37.231Z
- Expires at: 2026-05-08T23:40:37.231Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/codex-multi-subscription-auth-fallbacks)
- [Send to Agent page](https://openagent3.xyz/skills/codex-multi-subscription-auth-fallbacks/agent)
- [JSON manifest](https://openagent3.xyz/skills/codex-multi-subscription-auth-fallbacks/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/codex-multi-subscription-auth-fallbacks/agent.md)
- [Download page](https://openagent3.xyz/downloads/codex-multi-subscription-auth-fallbacks)