Codex Account Switcher

v0.2.0

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

0· 41·0 current·0 all-time

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for unknown-shu/unknownshu-codex-account-switcher.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "Codex Account Switcher" (unknown-shu/unknownshu-codex-account-switcher) from ClawHub.
Skill page: https://clawhub.ai/unknown-shu/unknownshu-codex-account-switcher
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Required binaries: python3, openclaw
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install unknownshu-codex-account-switcher

ClawHub CLI

Package manager switcher

npx clawhub@latest install unknownshu-codex-account-switcher
Security Scan
Capability signals
Requires OAuth tokenRequires sensitive credentials
These labels describe what authority the skill may exercise. They are separate from suspicious or malicious moderation verdicts.
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
medium confidence
Purpose & Capability
Name/description claim: manage openai-codex OAuth profiles and switch preferred account based on quota. The scripts read OpenClaw auth/profile files, query quota endpoints, and reorder auth-state.json. The declared required binary ('openclaw') and provided scripts match the stated purpose.
Instruction Scope
Runtime instructions and bundled scripts read local OpenClaw agent files (auth-profiles.json, auth-state.json, agent dir), optionally read ~/.codex/auth.json, call an external quota endpoint (https://chatgpt.com/backend-api/wham/usage) using each profile's access token, and may rewrite auth-state.json (to switch accounts). The SKILL.md promises tokens won't be printed; the code appears careful not to print token values. This is in-scope but is sensitive: the scripts do transmit local access tokens to the chatgpt.com usage endpoint (necessary for quota checks).
Install Mechanism
No install spec; the skill is instruction- and script-based and runs local Python scripts. Nothing is downloaded from external URLs or written to non-standard system locations beyond the OpenClaw agent directory and logs, so install risk is low.
Credentials
Registry metadata declares no required env vars; SKILL.md lists optional env vars the scripts use (OPENCLAW_HOME, OPENCLAW_AGENT_ID, etc.). The scripts access local auth/profile files (and may import ~/.codex/auth.json). They copy access/refresh tokens into OpenClaw profiles (codex-cli-sync) and use tokens to call the WHAM endpoint — this is proportional to the task but is sensitive access to local credentials and results in tokens being present in OpenClaw profile files.
Persistence & Privilege
Skill does not request always:true and does not attempt to modify other skills or system-wide settings beyond the OpenClaw auth state and profiles it legitimately manages. It writes backups before changing files. It can be run manually or as cron; autonomy is the platform default but not elevated here.
Assessment
This skill appears to do what it says: it reads your OpenClaw auth profiles, uses each profile's OAuth access token to query the ChatGPT WHAM usage endpoint, and can reorder auth-state.json to make another profile primary. Before installing/running: 1) Inspect the scripts locally (they are bundled) and confirm the WHAM_URL (chatgpt.com) is acceptable for your environment. 2) Understand codex-cli-sync will import tokens from ~/.codex/auth.json into OpenClaw profiles (tokens end up on disk in auth-profiles.json) — ensure you trust the machine and repository. 3) Run with --dry-run first to confirm behavior and check backups created (profiles/state backups are made). 4) Confirm OpenClaw and the scripts run under an account with appropriate permissions; consider limiting runtime to a dedicated user or container if you are nervous. 5) If you use notifications, verify NapCat/sendUrl configuration so messages do not leak account details to unintended recipients. If you want higher assurance, run the scripts manually from a secure shell and audit network traffic during a dry-run.

Like a lobster shell, security has layers — review code before you run it.

Runtime requirements

🔁 Clawdis
Binspython3, openclaw
accountsvk971pbkwrqd0y6s6j3558qcqnn85q5mvauthvk971pbkwrqd0y6s6j3558qcqnn85q5mvautomationvk971pbkwrqd0y6s6j3558qcqnn85q5mvlatestvk971pbkwrqd0y6s6j3558qcqnn85q5mvopenai-codexvk971pbkwrqd0y6s6j3558qcqnn85q5mvquotavk971pbkwrqd0y6s6j3558qcqnn85q5mv
41downloads
0stars
2versions
Updated 4h ago
v0.2.0
MIT-0

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.

Comments

Loading comments...