codex-account-switcher

Query OpenAI Codex OAuth account quotas in OpenClaw, switch the preferred account by email/profile id, and optionally auto-switch when 5h quota drops below a threshold. Use for OpenClaw model account management and quota-aware failover.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "codex-account-switcher" with this command: npx skills add unknown-shu/unknownshu-codex-account-switcher

Codex Account Switcher

Use the bundled scripts to manage openai-codex OAuth profiles without exposing tokens.

Commands

From this skill directory:

python3 scripts/openclaw-accounts-query.py
python3 scripts/openclaw-account-switch.py user@example.com --dry-run
python3 scripts/openclaw-account-switch.py user@example.com
python3 scripts/codex-cli-sync.py --dry-run
python3 scripts/codex-cli-sync.py
python3 scripts/openai-codex-auto-switch.py --dry-run
python3 scripts/openai-codex-quota-query.py --json

Behavior

  • Reads OpenClaw auth profile metadata from the selected agent directory.
  • Queries quota directly from ChatGPT WHAM usage using each profile's OAuth access token.
  • Never prints access tokens, refresh tokens, API keys, or credential file contents.
  • Account switching only rewrites auth-state.json provider order for openai-codex.
  • codex-cli-sync.py is advanced/explicit: it imports the current Codex CLI ~/.codex/auth.json login into OpenClaw and writes backups first.
  • Auto-switch defaults to switching only when the active account's 5h remaining quota is below 20%.

Useful environment variables

export OPENCLAW_HOME="$HOME/.openclaw"
export OPENCLAW_AGENT_ID="main"
export OPENCLAW_CODEX_SWITCH_THRESHOLD=20
export OPENCLAW_CODEX_SWITCH_SUFFICIENT_THRESHOLD=20

For cron, use an absolute path to scripts/openai-codex-auto-switch.py and redirect output to logs.

Safety

Do not paste script output containing local paths into public places without review. Do not commit auth-state.json, auth-profiles.json, .env, logs, or screenshots containing account emails unless you intend to share them.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

Auto Login Assistant

Help the agent recover from login walls on websites by detecting sign-in states, collecting user-approved credentials, filling common login forms, and handli...

Registry SourceRecently Updated
3500Profile unavailable
Automation

NotebookLM Ops

Manage NotebookLM MCP auth lifecycle on Linux by automating GUI startup, auth refresh, status check, and cleanup for frequent cookie expiry.

Registry SourceRecently Updated
7200Profile unavailable
Security

Auth Guard

Standardize API credential handling and startup auth checks to prevent "missing key" regressions across sessions. Use when an agent repeatedly loses auth sta...

Registry Source
3730Profile unavailable
Coding

Generate Immigration Law Firm Client Education Handout

Create a clear, polished immigration law firm handout with visuals, FAQs, and next steps to educate clients effectively.

Registry SourceRecently Updated