← Back to Skills Marketplace
ppaibb

Codex Switcher

by ppaibb · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
242
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install codex-switcher
Description
Local OpenClaw skill for managing multiple OpenAI Codex accounts through auth snapshots. Use when the user wants to add a Codex account, switch between Codex...
README (SKILL.md)

Codex Switcher

Use this skill to manage multiple local Codex accounts on one OpenClaw host with a simple snapshot workflow.

Bundled executable:

  • scripts/cs.sh

What this skill is

This is a small local account manager for Codex on OpenClaw.

Core idea:

  • keep OpenClaw's active Codex slot as openai-codex:default
  • store each account as a separate snapshot under ~/.openclaw/auth-snapshots/
  • switch accounts by injecting snapshot credentials into ~/.openclaw/agents/main/agent/auth-profiles.json
  • inspect account identity and quota from the active token itself
  • refresh snapshot tokens before expiry

This avoids filling openclaw.json with a growing roster of Codex aliases.

Commands

cs list

Show all saved snapshots with:

  • alias
  • decoded email
  • remaining time before expiry

cs current

Show the real active account email, not just the internal profile id.

cs quota

Read the current active token and query remaining Codex usage quota.

cs switch \x3Calias>

Switch to a saved account snapshot by updating only the active Codex credentials in:

  • ~/.openclaw/agents/main/agent/auth-profiles.json

After switching, show:

  • current active email
  • current quota summary

cs add [alias]

Start a new OAuth login flow for a brand-new account.

Workflow:

  1. run cs add or cs add \x3Calias>
  2. sign in in browser
  3. run cs add --apply '\x3Ccallback-url>' [alias]
  4. if alias was omitted, derive it from the email automatically
  5. create a new snapshot file for that account

cs refresh \x3Calias>

Force-refresh one snapshot using its refresh token.

cs refresh-all

Scan every snapshot and automatically refresh only those expiring within 24 hours.

This is intended for cron usage.

Sensitive files

This skill touches high-sensitivity local auth material. Main files involved:

  • ~/.openclaw/agents/main/agent/auth-profiles.json
  • ~/.openclaw/auth-snapshots/*.json
  • ~/.openclaw/auth-snapshots/backups/*
  • temporary pending OAuth state files under ~/.openclaw/

Treat all snapshot files as secrets. Never expose full access tokens or refresh tokens in chat.

Safety rules

  • Do not run curl | bash installers.
  • Do not fetch and execute third-party account-switch scripts blindly.
  • Prefer local reviewed logic only.
  • Back up auth material before risky operations.
  • Validate alias names before writing files.
  • Use atomic writes for snapshot and auth updates.
  • Do not edit unrelated OpenClaw config unless truly required.
  • Do not assume a snapshot alias is truthful; decode token email when verifying.

Recommended workflow

Add a new account

  • cs add or cs add \x3Calias>
  • finish browser login
  • cs add --apply '\x3Ccallback-url>' [alias]
  • cs list

Switch accounts

  • cs switch \x3Calias>
  • verify output shows the expected email and quota

Keep snapshots fresh

Run cs refresh-all from cron once or twice per day.

References

  • For security concerns around third-party relogin installers, read references/security-notes.md.
  • For local implementation notes, read scripts/README-local-flow.md.
Usage Guidance
This tool is coherent with its stated purpose but operates on high-sensitivity auth material. Before installing or running: 1) Review the bundled scripts (scripts/cs.sh) yourself — it will write access and refresh tokens to ~/.openclaw/auth-snapshots/*.json and update auth-profiles.json. 2) Consider supplying your own OAuth client (set CS_OAUTH_CLIENT_ID) instead of the embedded default client_id if you want tokens tied to your application. 3) Ensure Python3 and the requests library are available (the script uses embedded Python code and requests for network calls). 4) Back up ~/.openclaw/agents/main/agent/auth-profiles.json before use and keep snapshot files restricted (permissions). 5) Be cautious about enabling automated cron refresh: it will use stored refresh tokens to obtain new access tokens. If you want stronger assurance, run the script manually and inspect the callback/token exchange steps during the first account add.
Capability Analysis
Type: OpenClaw Skill Name: codex-switcher Version: 1.0.0 The codex-switcher skill is a utility for managing multiple OpenAI Codex accounts locally by swapping authentication snapshots. The implementation in scripts/cs.sh uses standard OAuth 2.0 PKCE flows, communicates exclusively with official OpenAI endpoints (auth.openai.com and chatgpt.com), and includes security-conscious practices such as atomic file writes, local backups of sensitive configuration files, and explicit warnings against executing untrusted remote code. No evidence of data exfiltration, malicious persistence, or harmful prompt injection was found.
Capability Assessment
Purpose & Capability
The name/description (Codex multi-account snapshot manager) matches what the script does: create/manage snapshots under ~/.openclaw/auth-snapshots, inject the chosen snapshot into ~/.openclaw/agents/main/agent/auth-profiles.json, and refresh tokens via OpenAI OAuth endpoints. No unrelated services, credentials or system components are requested.
Instruction Scope
SKILL.md and scripts instruct only local file operations (reading/writing snapshots, backing up auth-profiles.json) and legitimate OAuth/token operations against auth.openai.com. The scripts accept a callback URL from the user and exchange codes for tokens. Note: the code performs network calls (token exchange, quota checks) and will write tokens/refresh tokens to local snapshot files; SKILL.md warns these are secrets, but users must ensure they review and protect these files.
Install Mechanism
No install spec or remote downloads are present. The skill is instruction-only with a bundled local script; nothing is fetched from external URLs by an installer. This is lower risk than downloading/executing remote archives.
Credentials
The skill requires no special environment variables by default. It does include optional CS_* environment overrides (client id, authorize/token URLs, redirect, scope, originator) and uses OPENCLAW_STATE_DIR. The presence of a hard-coded default CLIENT_ID (app_EMoamEEZ73f0CkXaXp7hrann) and ORIGINATOR may be surprising; they are overridable via env vars. No unrelated credentials are demanded.
Persistence & Privilege
The skill is not set to always:true and does not request elevated system-wide privileges. It writes only into the OpenClaw state directory (by default ~/.openclaw) which is consistent with its purpose. The refresh-all mode is intended for cron use — users should consider the implications of storing long-lived refresh tokens locally if automating.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install codex-switcher
  3. After installation, invoke the skill by name or use /codex-switcher
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release. - Add local Codex multi-account snapshot workflow - Support add / switch / current / list / quota - Support refresh and refresh-all for expiring snapshots - Use minimal auth snapshot storage - Avoid bloating openclaw.json with account roster entries 初始版本发布。 - 支持本地 Codex 多账号快照管理 - 支持 add / switch / current / list / quota - 支持 refresh / refresh-all - 使用最小化快照存储凭据 - 不依赖在 openclaw.json 中维护账号花名册
Metadata
Slug codex-switcher
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Codex Switcher?

Local OpenClaw skill for managing multiple OpenAI Codex accounts through auth snapshots. Use when the user wants to add a Codex account, switch between Codex... It is an AI Agent Skill for Claude Code / OpenClaw, with 242 downloads so far.

How do I install Codex Switcher?

Run "/install codex-switcher" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Codex Switcher free?

Yes, Codex Switcher is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Codex Switcher support?

Codex Switcher is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Codex Switcher?

It is built and maintained by ppaibb (@ppaibb); the current version is v1.0.0.

💬 Comments