[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-74869":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":16,"starSnapshotCount":16,"syncStatus":14,"lastSyncTime":30,"discoverSource":31},74869,"codex-auth","Loongphy\u002Fcodex-auth","Loongphy","A CLI tool to switch and manage Codex accounts","",null,"Zig",2069,123,2,14,0,49,133,429,147,108.28,"MIT License",false,"main",true,[],"2026-06-12 04:01:16","# Codex Auth [![latest release](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fv\u002Frelease\u002FLoongphy\u002Fcodex-auth?sort=semver&label=latest)](https:\u002F\u002Fgithub.com\u002FLoongphy\u002Fcodex-auth\u002Freleases\u002Flatest) [![latest pre-release](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fv\u002Frelease\u002FLoongphy\u002Fcodex-auth?include_prereleases&sort=semver&filter=*-*&label=pre-release)](https:\u002F\u002Fgithub.com\u002FLoongphy\u002Fcodex-auth\u002Freleases)\n\n![command list](https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F6c13a2d6-f9da-47ea-8ec8-0394fc072d40)\n\n`codex-auth` is a command-line tool for switching Codex accounts.\n\n> [!IMPORTANT]\n> For **Codex CLI** and **Codex App** users, switch accounts, then restart the client for the new account to take effect.\n>\n> If you use the CLI and want seamless automatic account switching without restarting, use the forked [`codext`](https:\u002F\u002Fgithub.com\u002FLoongphy\u002Fcodext), an enhanced Codex CLI. Install it with `npm i -g @loongphy\u002Fcodext` and run `codext`.\n\n## Supported Platforms\n\n`codex-auth` works with these Codex clients:\n\n- Codex CLI\n- VS Code extension\n- Codex App\n\nFor the best experience, install the Codex CLI even if you mainly use the VS Code extension or the App, because it makes adding accounts easier:\n\n```shell\nnpm install -g @openai\u002Fcodex\n```\n\nAfter that, you can use `codex login`, `codex login --device-auth`, `codex-auth login`, or `codex-auth login --device-auth` to sign in and add accounts more easily.\n\n## Install\n\nInstall with npm:\n\n```shell\nnpm install -g @loongphy\u002Fcodex-auth\n```\n\n  You can also run it without a global install:\n\n```shell\nnpx @loongphy\u002Fcodex-auth list\n```\n\n  npm packages currently support Linux x64, Linux arm64, macOS x64, macOS arm64, Windows x64, and Windows arm64.\n\n### Uninstall\n\n#### npm\n\nRemove the npm package:\n\n```shell\nnpm uninstall -g @loongphy\u002Fcodex-auth\n```\n\n## Commands\n\nDetailed command documentation lives in [docs\u002Fcommands\u002FREADME.md](.\u002Fdocs\u002Fcommands\u002FREADME.md).\n\n### Account Management\n\n| Command | Description |\n|---------|-------------|\n| [`codex-auth list [--live] [--active] [--api\\|--skip-api]`](.\u002Fdocs\u002Fcommands\u002Flist.md) | List stored accounts and usage state |\n| [`codex-auth login [--device-auth]`](.\u002Fdocs\u002Fcommands\u002Flogin.md) | Run `codex login`, then add the current account |\n| [`codex-auth switch [--live] [--api\\|--skip-api]`](.\u002Fdocs\u002Fcommands\u002Fswitch.md) | Switch the active account interactively |\n| [`codex-auth switch \u003Cquery>`](.\u002Fdocs\u002Fcommands\u002Fswitch.md) | Switch directly by row number or account selector |\n| [`codex-auth remove [--live] [--api\\|--skip-api]`](.\u002Fdocs\u002Fcommands\u002Fremove.md) | Remove accounts interactively |\n| [`codex-auth remove \u003Cquery> [\u003Cquery>...]`](.\u002Fdocs\u002Fcommands\u002Fremove.md) | Remove accounts by selector |\n| [`codex-auth remove --all`](.\u002Fdocs\u002Fcommands\u002Fremove.md) | Remove all stored accounts |\n\n### Import and Maintenance\n\n| Command | Description |\n|---------|-------------|\n| [`codex-auth import \u003Cpath> [--alias \u003Calias>]`](.\u002Fdocs\u002Fcommands\u002Fimport.md) | Import a single auth file or batch import a folder |\n| [`codex-auth import --cpa [\u003Cpath>]`](.\u002Fdocs\u002Fcommands\u002Fimport.md) | Import CLIProxyAPI token JSON |\n| [`codex-auth import --purge [\u003Cpath>]`](.\u002Fdocs\u002Fcommands\u002Fimport.md) | Rebuild `registry.json` from auth files |\n| [`codex-auth export [\u003Cdir>]`](.\u002Fdocs\u002Fcommands\u002Fexport.md) | Export stored account auth files |\n| [`codex-auth export --cpa [\u003Cdir>]`](.\u002Fdocs\u002Fcommands\u002Fexport.md) | Export CLIProxyAPI token JSON |\n| [`codex-auth clean`](.\u002Fdocs\u002Fcommands\u002Fclean.md) | Delete managed backup and stale account files |\n\n### Configuration\n\n| Command | Description |\n|---------|-------------|\n| [`codex-auth config live --interval \u003Cseconds>`](.\u002Fdocs\u002Fcommands\u002Fconfig.md) | Configure live TUI refresh interval |\n\n## Quick Examples\n\n```shell\ncodex-auth list\ncodex-auth list --active\ncodex-auth switch\ncodex-auth switch 02\ncodex-auth remove work\ncodex-auth import \u002Fpath\u002Fto\u002Fauth.json --alias personal\ncodex-auth list --skip-api\n```\n\n## Q&A\n\n### Why is my usage limit not refreshing?\n\nAPI-backed refresh is the default. When you pass `--skip-api`, `codex-auth` reads the newest `~\u002F.codex\u002Fsessions\u002F**\u002Frollout-*.jsonl` file instead. Recent Codex builds often write `token_count` events with `rate_limits: null`. The local files may still contain older usable usage limit data, but in practice they can lag by several hours, so local-only refresh may show a usage limit snapshot from hours ago instead of your latest state.\n\n- Upstream Codex issue: [openai\u002Fcodex#14880](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fcodex\u002Fissues\u002F14880)\n\nRun the API-backed default with:\n\n```shell\ncodex-auth list\n```\n\nRun one local-only command with:\n\n```shell\ncodex-auth list --skip-api\n```\n\nVerify with:\n\n```shell\ncodex exec \"say hello\"\n```\n\n## Disclaimer\n\nThis project is provided as-is and use is at your own risk.\n\n**Usage Data Refresh Source:**\n`codex-auth` supports two sources for refreshing account usage\u002Fusage limit information:\n\n1. **API (default):** The tool makes direct HTTPS requests to OpenAI's endpoints using your account's access token. This enables both usage refresh and team name refresh. npm installs already satisfy the runtime requirement.\n2. **Local-only:** With per-command `--skip-api`, the tool scans local `~\u002F.codex\u002Fsessions\u002F*\u002Frollout-*.jsonl` files for usage data and skips team name refresh API calls. This mode is safer, but it can be less accurate because recent Codex rollout files often contain `rate_limits: null`, so the latest local usage limit data may lag by several hours.\n\n**API Call Declaration:**\nBy using the default API-backed refresh, this tool will send your ChatGPT access token to OpenAI's servers, including `https:\u002F\u002Fchatgpt.com\u002Fbackend-api\u002Fwham\u002Fusage` for usage limit and `https:\u002F\u002Fchatgpt.com\u002Fbackend-api\u002Faccounts\u002Fcheck\u002Fv4-2023-04-27` for team name. This behavior may be detected by OpenAI and could violate their terms of service, potentially leading to account suspension or other risks. The decision to use this feature and any resulting consequences are entirely yours.\n","`codex-auth` 是一个用于切换和管理Codex账户的命令行工具。它支持添加、切换、删除以及导入Codex账号，并且兼容Codex CLI、VS Code扩展及Codex App等多种客户端环境。该工具采用Zig语言开发，具有跨平台特性，目前支持Linux、macOS和Windows操作系统上的多种架构。对于需要频繁切换不同Codex账户进行开发或测试工作的用户来说非常实用，尤其是当同时使用多个Codex服务时，通过简单的命令即可轻松实现账户间的无缝转换。","2026-06-11 03:51:12","high_star"]