Codex Auth Fallback for Openclaw

A robust multi-provider authentication and failover system designed to manage OpenAI Codex OAuth sessions for uninterrupted AI agent performance.

markeljan
v1.1.0
Feb 18, 2026
3
1.9k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install codex-multi-subscription-auth-fallbacks

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install codex-multi-subscription-auth-fallbacks using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Codex Auth Fallback?

Codex Auth Fallback is a specialized utility for developers using Openclaw Skills who need to maintain high availability across multiple OpenAI accounts. It solves the problem of API rate-limiting by enabling a sophisticated multi-profile authentication strategy. By leveraging the OpenAI Codex CLI device flow, this skill allows users to easily add, manage, and cycle through multiple OAuth profiles.

The core value of this integration lies in its ability to automate the failover process. When a specific provider or account hits a rate limit or cooldown period, the system can automatically transition to a secondary profile. This ensures that your development environment remains responsive and that Openclaw Skills can continue performing complex tasks without manual intervention or credential management hurdles.

Codex Auth Fallback Use Cases

  • Managing multiple OpenAI Codex accounts to bypass individual rate limits during heavy production workloads.
  • Automating the retrieval and rotation of OAuth access and refresh tokens via the device flow.
  • Configuring resilient failover hierarchies between different AI models like GPT-4 and Codex profiles.
  • Setting up background monitoring to automatically switch active models when a provider enters a cooldown state within Openclaw Skills.

How Codex Auth Fallback Works

  1. The user runs a specialized shell script to initiate an OAuth device flow login for a new OpenAI profile.
  2. The system creates timestamped backups of existing authentication files to ensure no data loss during the configuration process.
  3. The script interacts with the Codex CLI to capture fresh JWT access and refresh tokens.
  4. These tokens are extracted and injected into the local OpenClaw authentication profiles directory.
  5. The main configuration file is updated to establish a priority order for the newly added profiles.
  6. An optional background process monitors usage statistics and triggers a failover if the primary account becomes restricted.

Codex Auth Fallback Setup

To begin using this skill, ensure you have the OpenClaw environment ready and the Codex CLI installed globally.

# Install the necessary Codex CLI dependency
npm i -g @openai/codex

# Run the profile importer for each account you wish to add
./scripts/codex-add-profile.sh <profile-name>

Once the profiles are added, you must manually update your openclaw.json file to define the auth.order and fallback priority for your Openclaw Skills. Check the provided templates in the references directory for the exact JSON structure required.

Codex Auth Fallback Data Schema & Taxonomy

The skill organizes its authentication and configuration data across a specific set of local files to ensure security and portability. The data is structured as follows:

File Path Role in Workflow
~/.codex/auth.json Primary storage for temporary CLI tokens during the OAuth handshake.
~/.openclaw/agents/main/agent/auth-profiles.json The persistent store for Openclaw Skills authentication profiles.

Each profile entry in the auth-profiles schema contains:

  • type: The authentication method (e.g., "oauth").
  • provider: The specific AI service (e.g., "openai-codex").
  • access: The active JWT access token used for requests.
  • refresh: The token used to generate new access tokens.
  • expires: The Unix timestamp indicating when the current token expires.
  • accountId: The unique identifier for the OpenAI account.

Codex Auth Fallback Advanced Features

  • Automatic timestamped backups for all sensitive configuration files before any write operations occur.
  • Trap-based recovery handlers that restore original CLI authentication states if the OAuth process is interrupted.
  • Support for cron-based model switching that picks the best available model based on real-time status and priority logic.
  • Isolated state tracking that allows Openclaw Skills to monitor cooldowns without affecting the main chat session.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*