Skip to content

Releases: shx2005/codex-account-switcher

v0.3.0 · 账号导入导出 / Account export and import

Choose a tag to compare

@shx2005 shx2005 released this 20 Oct 06:11

导出 / 导入账号,迁移到自己的另一台电脑

你是否厌倦了 Codex 多个账号之间来回切换?现在可以把已经登录的账号导出到文件,在自己的另一台电脑导入。

# 在原电脑导出全部已保存账号
codex-account export --all -o accounts.codex-accounts.json

# 通过可信方式传到自己的另一台电脑后导入
codex-account import accounts.codex-accounts.json
  • 支持导出当前登录、指定账号或全部已保存账号。
  • 导入支持改名、显式替换同名账号,以及原始官方 auth.json。
  • 导入只添加存档,当前登录保留;相同身份优先保留较新的凭据。
  • 整包校验名称、身份、格式和版本,拒绝路径穿越、重复账号、符号链接和超大文件。
  • 普通写入失败会回滚;回滚失败时保留恢复副本。
  • 导出文件权限为 600,默认不覆盖文件,不向终端输出凭据。
  • 更新中英文 README、安全说明和忽略规则;运行时仍无第三方 Python 依赖。

导出文件含明文登录凭据,请只在自己拥有的可信设备之间传输,并在导入后删除。导入不验证在线有效性;失效时请通过官方登录重新认证。

验证:GitHub CI 的 macOS/Linux × Python 3.11–3.14 共 8 组检查全部通过;64 项自动化测试通过;在独立虚拟环境中完成安装后的 save → export → import → list → use 流程验证,均使用虚构凭据。


Export / import accounts between your devices

Export your current login, a named profile, or all saved profiles to a file and import them on another computer you own.

  • Optional renaming and explicit replacement of conflicting names; official raw auth.json imports are supported.
  • Import preserves the active login and selects newer same-identity credentials.
  • Validate the complete bundle before writing, including names, identities, format, version, and size.
  • Reject path traversal and symlinks; roll back ordinary write failures and preserve recovery backups if rollback fails.
  • Export files have mode 600; existing files are preserved by default, and credentials are never printed.
  • Updated bilingual documentation and security guidance, with no added Python runtime dependencies.

Exports contain plaintext login credentials. Transfer only between trusted devices you own and delete the file after importing. Import does not verify online validity; sign in again through the official CLI if credentials have expired.

Validation: all 8 GitHub CI jobs passed across macOS/Linux and Python 3.11–3.14; 64 automated tests passed, plus an installed-CLI save → export → import → list → use check in an isolated virtual environment using synthetic credentials.

v0.2.0 · 首次开源发布 / Open-source release

Choose a tag to compare

@shx2005 shx2005 released this 19 Oct 16:19

你是否厌倦了 Codex 多个账号之间来回切换?

Codex Account Switcher 现已开源:给本地账号起名字,调用官方 Codex 登录,查看各账号额度,并在退出客户端后快速切换。

  • 默认中文 README,附完整英文版,包含安装、特性、命令和支持范围。
  • 支持命名账号、官方浏览器/设备码/API key 登录,以及当前、指定和全部账号额度查询。
  • 提供 JSON 输出、查询超时、凭据备份和原子切换。
  • 新增 Python 包安装与 codex-account --version。
  • 加入 MIT 许可证、贡献指南、安全说明及 Star History。
  • CI 覆盖 macOS/Linux 和 Python 3.11–3.14。

套餐字段保持原有显示规则:额度接口返回 unknown 时仍显示 unknown,不从登录信息回退或推断套餐。

pipx install 'git+https://github.com/shx2005/codex-account-switcher.git@v0.2.0'

Tired of switching back and forth between multiple Codex accounts?

Codex Account Switcher is now open source: name your local profiles, sign in through the official Codex CLI, compare usage, and switch accounts after closing Codex clients.

  • Chinese default README and a complete English version with installation, features, commands, and supported scope.
  • Named profiles, official browser/device-code/API key login, and current, named, or all-profile usage queries.
  • JSON output, query timeouts, credential backups, and atomic switching.
  • Installable Python package and codex-account --version.
  • MIT license, contributing and security guides, and Star History.
  • CI for macOS/Linux and Python 3.11–3.14.

Plan display retains its existing behavior: a usage response of unknown stays unknown, without token-metadata fallback or plan inference.