Codex Relay 是一个本地多 GPT / Codex 账号管理、额度查看与会话维护工具,提供图形界面和命令行模式。
核心功能:自动触发额度重置计时
新账号或尚未消耗额度的账号可能一直显示100%,同时没有重置时间。Codex Relay 检测到这种状态后,可以自动在 Work 中发送一条hello,触发首次额度重置倒计时。该请求必须走 Work,普通聊天不会用于签到。
它可以在每次检测时按需执行两项相互独立的维护操作:
- 当 Work 额度剩余 100% 且尚无重置时间时,在 Work 中发送一条
hello,用于触发首次重置计时。 - 当 session 有效期不足 24 小时时,使用刷新令牌续签 session 到期时间。
- 通过多个独立的
auth.json集中管理多个 GPT / Codex 账号 - 自动为“剩余 100% 且无重置时间”的账号执行 Work 签到,触发首次重置计时
- 查看 Codex / ChatGPT 当前额度、已用比例和本地重置时间
- 显示会话额度、小时额度和每周额度
- Work 自动签到和 session 自动续签可分别启用
- 多个
auth.json路径管理,导入后默认勾选 - 路径、勾选状态、语言和 GUI 开关自动持久化
- GUI 与 CLI 两种使用方式
- 支持脱敏 JSON 输出,不输出 access token、refresh token 等凭据
- 自动检测系统语言;无法识别时使用英语
English、简体中文、繁體中文、日本語、한국어、Español、Français、Deutsch、العربية、Português、Русский、Italiano、हिन्दी、Türkçe、Tiếng Việt、ไทย、Bahasa Indonesia。
额度窗口名称也会随语言切换,包括“当前会话额度”“小时额度”和“每周额度”。
仅在同时满足以下条件时触发:
- 已启用 Work 自动签到;
- Codex Work 剩余额度为
100%; - 服务端尚未返回重置倒计时或重置时间。
触发后,Codex Relay 会向 Work 发送一条 hello,然后重新查询额度,确认重置时间已经出现。普通聊天不用于该操作。
仅在同时满足以下条件时触发:
- 已启用 session 自动续签;
- access token 中可以取得有效的到期时间;
- 剩余有效期严格少于 24 小时;
auth.json中存在可用的 refresh token。
续签成功后会原子更新对应的 auth.json。如果新 token 没有延长有效期,原文件不会被替换。
两项功能彼此独立。启用其中一项不会隐式启用另一项。
- Python 3.10 或更高版本
- GUI 模式需要 Python 包含 Tkinter
- 无第三方 Python 依赖
- 需要能够访问 OpenAI / ChatGPT 相关服务
下载 Python 版 CodexRelay.py 后运行:
python CodexRelay.py无参数运行默认打开图形界面。也可以显式指定:
python CodexRelay.py --guiWindows 用户也可以直接下载 CodexRelay.exe。双击打开 GUI,或在终端中使用与 Python 版相同的参数:
.\CodexRelay.exe --cli默认读取:
~/.codex/auth.json
也可以在 GUI 中导入一个或多个 auth.json。
查询默认或已保存且勾选的路径:
python CodexRelay.py --cli指定一个或多个文件:
python CodexRelay.py --cli --auth "/path/to/auth.json"
python CodexRelay.py --cli --auth "/path/one/auth.json" --auth "/path/two/auth.json"启用 Work 签到:
python CodexRelay.py --cli --auto-checkin启用 session 续签:
python CodexRelay.py --cli --auto-refresh-session同时启用两项维护功能:
python CodexRelay.py --cli --auto-checkin --auto-refresh-session输出脱敏 JSON:
python CodexRelay.py --json选择输出语言:
python CodexRelay.py --cli --language zh-CN
python CodexRelay.py --cli --language en
python CodexRelay.py --cli --language es保存传入的路径并默认勾选:
python CodexRelay.py --auth "/path/to/auth.json" --save-paths --cli查看所有已保存路径:
python CodexRelay.py --list-paths启用或停用路径:
python CodexRelay.py --enable-path "/path/to/auth.json" --list-paths
python CodexRelay.py --disable-path "/path/to/auth.json" --list-paths可以使用自定义配置文件:
python CodexRelay.py --config "/path/to/codex-relay.json" --cli默认配置保存在:
~/.codex/codex-relay.json
配置中只保存:
- 界面语言
auth.json文件路径和勾选状态- GUI 中两项维护功能的开关状态
配置文件不会保存 access token 或 refresh token。旧版的 codex-endurance-station.json 可以自动读取。
| 参数 | 说明 |
|---|---|
--gui |
启动图形界面 |
--cli |
输出文字摘要 |
--json |
输出脱敏 JSON |
--auth PATH |
添加一个 auth.json,可以重复传入 |
--language CODE |
设置界面或摘要语言 |
--auto-checkin |
启用本次 Work 自动签到 |
--auto-refresh-session |
启用本次 session 自动续签 |
--save-paths |
保存本次传入的路径并默认勾选 |
--list-paths |
列出已保存路径和勾选状态 |
--enable-path PATH |
新增或启用持久化路径 |
--disable-path PATH |
新增或停用持久化路径 |
--config PATH |
使用自定义配置文件 |
--timeout SECONDS |
设置单个请求的超时时间 |
运行以下命令可查看完整参数:
python CodexRelay.py --helpauth.json含有敏感登录凭据,请勿提交到 Git、发送给他人或放入公开日志。- Work 签到会发送一条真实的
hello请求,可能产生少量额度消耗。 - Session 续签会修改所选的
auth.json,写入过程采用临时文件和原子替换。 - 自动维护在运行检测时执行;Codex Relay 本身不是后台定时服务。
- 服务端接口和返回字段可能变化。如果查询失效,请先更新项目版本。
- 本项目是社区工具,与 OpenAI 无隶属或官方认可关系。请仅用于你有权访问的账户和文件,并遵守适用的服务条款。
Codex Relay is a local multi-account manager, quota viewer, and session maintenance utility for GPT / Codex, with both GUI and CLI modes.
Core feature: automatically start the quota reset timer
A new or unused account may remain at100%with no reset time. When Codex Relay detects this state, it can sendhellothrough Work to start the initial quota reset countdown. This check-in must use Work; a regular chat is not used.
On each check, it can independently perform two optional maintenance actions:
- Send
helloin Work when the Work quota is at 100% remaining and no reset time exists, which starts the initial reset timer. - Refresh the session expiry when less than 24 hours remain.
- Manage multiple GPT / Codex accounts through separate
auth.jsonfiles - Automatically check in through Work at 100% with no reset time, starting the initial reset timer
- View current Codex / ChatGPT usage, remaining quota, and reset time in local time
- Display session, hourly, and weekly quota windows
- Enable Work check-in and session refresh independently
- Manage multiple
auth.jsonfiles; newly imported paths are checked by default - Persist paths, checked states, language, and GUI options
- Use either a graphical interface or the command line
- Produce sanitized JSON without access tokens, refresh tokens, or other credentials
- Detect the system language automatically and fall back to English when unsupported
English, Simplified Chinese, Traditional Chinese, Japanese, Korean, Spanish, French, German, Arabic, Portuguese, Russian, Italian, Hindi, Turkish, Vietnamese, Thai, and Indonesian.
Quota window names—including current-session, hourly, and weekly quotas—are localized as well.
The check-in runs only when all of these conditions are met:
- Work check-in is enabled;
- the Codex Work quota has
100%remaining; - the service has not provided a reset countdown or reset timestamp.
Codex Relay then sends hello specifically through Work and checks the quota again until a reset time appears. A regular chat is not used for this action.
The refresh runs only when all of these conditions are met:
- session refresh is enabled;
- a valid expiry can be read from the access token;
- strictly less than 24 hours remain;
- a usable refresh token exists in
auth.json.
After a successful refresh, the matching auth.json is updated atomically. If the new token does not extend the expiry, the original file is preserved.
These features are independent. Enabling one never implicitly enables the other.
- Python 3.10 or later
- A Python build with Tkinter for GUI mode
- No third-party Python dependencies
- Network access to the relevant OpenAI / ChatGPT services
Download the Python version, CodexRelay.py, then run:
python CodexRelay.pyRunning without arguments opens the GUI. You can also request it explicitly:
python CodexRelay.py --guiWindows users can alternatively download CodexRelay.exe. Double-click it to open the GUI, or use the same CLI options as the Python version:
.\CodexRelay.exe --cliThe default credential path is:
~/.codex/auth.json
You may also import one or more auth.json files in the GUI.
Check the default path, or all saved and enabled paths:
python CodexRelay.py --cliSpecify one or more files:
python CodexRelay.py --cli --auth "/path/to/auth.json"
python CodexRelay.py --cli --auth "/path/one/auth.json" --auth "/path/two/auth.json"Enable Work check-in:
python CodexRelay.py --cli --auto-checkinEnable session refresh:
python CodexRelay.py --cli --auto-refresh-sessionEnable both maintenance actions:
python CodexRelay.py --cli --auto-checkin --auto-refresh-sessionPrint sanitized JSON:
python CodexRelay.py --jsonSelect the output language:
python CodexRelay.py --cli --language en
python CodexRelay.py --cli --language zh-CN
python CodexRelay.py --cli --language esSave input paths and enable them by default:
python CodexRelay.py --auth "/path/to/auth.json" --save-paths --cliList all saved paths:
python CodexRelay.py --list-pathsEnable or disable a path:
python CodexRelay.py --enable-path "/path/to/auth.json" --list-paths
python CodexRelay.py --disable-path "/path/to/auth.json" --list-pathsUse a custom configuration file:
python CodexRelay.py --config "/path/to/codex-relay.json" --cliThe default configuration file is:
~/.codex/codex-relay.json
It stores only:
- the selected language;
auth.jsonpaths and their checked states;- the two GUI maintenance toggles.
Access tokens and refresh tokens are never copied into this configuration. The legacy codex-endurance-station.json configuration can still be read automatically.
| Option | Description |
|---|---|
--gui |
Open the graphical interface |
--cli |
Print a text summary |
--json |
Print sanitized JSON |
--auth PATH |
Add an auth.json path; may be repeated |
--language CODE |
Select the GUI or summary language |
--auto-checkin |
Enable Work check-in for this run |
--auto-refresh-session |
Enable session refresh for this run |
--save-paths |
Persist input paths and enable them by default |
--list-paths |
List saved paths and checked states |
--enable-path PATH |
Add or enable a persistent path |
--disable-path PATH |
Add or disable a persistent path |
--config PATH |
Use a custom configuration file |
--timeout SECONDS |
Set the per-request timeout |
Run the following command for the complete option list:
python CodexRelay.py --helpauth.jsoncontains sensitive login credentials. Never commit it to Git, share it, or include it in public logs.- Work check-in sends a real
hellorequest and may consume a small amount of quota. - Session refresh modifies the selected
auth.jsonusing a temporary file and atomic replacement. - Automatic maintenance runs when a check is performed; Codex Relay is not a background scheduler by itself.
- Server endpoints and response fields may change. Update the project first if checks stop working.
- This is a community project and is not affiliated with or endorsed by OpenAI. Use it only with accounts and files you are authorized to access, and follow all applicable terms of service.