📦 Codex Account Switcher

v0.2.0

查询 OpenAI Codex OAuth account quotas in OpenClaw, switch the preferred account by emAIl/性能分析 id, and optionally auto-switch when 5h quota drops below a...

0· 0·0 当前·0 累计
0
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
medium confidence
The 技能's files and instructions coherently implement an OpenClaw Codex account quota 检查er and automatic 性能分析 switcher; it reads/writes local OpenClaw auth files and queries ChatGPT's WHAM usage 端点 using stored OAuth 访问 令牌s — behavior matches the description, but it performs network calls and writes 令牌s into OpenClaw 性能分析s so review before use.
评估建议
This 技能 应用ears to do what it says: it reads your OpenClaw auth 性能分析s, uses each 性能分析's OAuth 访问 令牌 to 查询 the ChatGPT WHAM usage 端点, and can reorder auth-状态.json to make another 性能分析 primary. Before 安装ing/运行ning: 1) Inspect the scripts locally (they are bundled) and confirm the WHAM_URL (chatgpt.com) is acceptable for your 环境. 2) Understand codex-命令行工具-同步 will 导入 令牌s from ~/.codex/auth.json into OpenClaw 性能分析s (令牌s end up on disk in auth-性能分析s.json) — ensure you trust the machine and 仓库. 3) 运行 wi...
详细分析 ▾
用途与能力
Name/description clAIm: manage openAI-codex OAuth 性能分析s and switch preferred account based on quota. The scripts read OpenClaw auth/性能分析 files, 查询 quota 端点s, and reorder auth-状态.json. The declared required binary ('OpenClaw') and provided scripts match the 状态d purpose.
指令范围
运行time instructions and bundled scripts read local OpenClaw 代理 files (auth-性能分析s.json, auth-状态.json, 代理 dir), optionally read ~/.codex/auth.json, call an external quota 端点 (https://chatgpt.com/backend-API/wham/usage) using each 性能分析's 访问 令牌, and may rewrite auth-状态.json (to switch accounts). The 技能.md promises 令牌s won't be printed; the code 应用ears careful not to print 令牌 values. This is in-scope but is sensitive: the scripts do transmit local 访问 令牌s to the chatgpt.com usage 端点 (necessary for quota 检查s).
安装机制
No 安装 spec; the 技能 is instruction- and script-based and 运行s local Python scripts. Nothing is 下载ed from external URLs or written to non-standard 系统 locations beyond the OpenClaw 代理 directory and 记录s, so 安装 risk is low.
凭证需求
Registry metadata declares no required env vars; 技能.md 列出s optional env vars the scripts use (OpenClaw_HOME, OpenClaw_代理_ID, etc.). The scripts 访问 local auth/性能分析 files (and may 导入 ~/.codex/auth.json). They copy 访问/refresh 令牌s into OpenClaw 性能分析s (codex-命令行工具-同步) and use 令牌s to call the WHAM 端点 — this is proportional to the task but is sensitive 访问 to local 凭证s and 结果s in 令牌s being present in OpenClaw 性能分析 files.
持久化与权限
技能 does not 请求 always:true and does not attempt to modify other 技能s or 系统-wide 设置tings beyond the OpenClaw auth 状态 and 性能分析s it legitimately manages. It writes 备份s before changing files. It can be 运行 manually or as cron; autonomy is the 平台 default but not elevated here.
安全有层次,运行前请审查代码。

运行时依赖

无特殊依赖

安装命令

点击复制
官方npx clawhub@latest install unknownshu-codex-account-switcher
镜像加速npx clawhub@latest install unknownshu-codex-account-switcher --registry https://cn.longxiaskill.com

技能文档

Codex Account Switcher 使用内置脚本管理 openai-codex OAuth 配置文件,无需暴露令牌。

命令(在此技能目录下执行): 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

行为 从所选 agent 目录读取 OpenClaw 认证配置元数据; 使用各配置文件的 OAuth 访问令牌直接向 ChatGPT WHAM 查询配额; 绝不打印 access token、refresh token、API key 或凭据文件内容; 切换账号仅重写 openai-codex 的 auth-state.json 中的 provider 顺序; codex-cli-sync.py 为高级/显式操作:先将当前 Codex CLI ~/.codex/auth.json 登录信息导入 OpenClaw 并写入备份。

自动切换默认仅在活跃账号 5 小时剩余配额低于 20% 时触发。

环境变量 export OPENCLAW_HOME="$HOME/.openclaw" export OPENCLAW_AGENT_ID="main" export OPENCLAW_CODEX_SWITCH_THRESHOLD=20 export OPENCLAW_CODEX_SWITCH_SUFFICIENT_THRESHOLD=20

定时任务请使用脚本绝对路径,并将输出重定向到日志。

安全 勿将含本地路径的脚本输出直接粘贴至公开处; 勿提交 auth-state.json、auth-profiles.json、.env、日志或含账号邮箱的截图,除非有意共享。

数据来源ClawHub ↗ · 中文优化:龙虾技能库