Codex Quota Tracker
中文 | English
中文
一个用于在 VS Code 中查看 Codex 实时额度的扩展。
当前版本会通过 ChatGPT 账号授权自动读取 Codex 的额度信息,并在侧边栏中以深色卡片样式展示:
5 小时限额
周限额
- 每个额度窗口的下次刷新时间
- 剩余可用额度百分比
- 横向进度条
- 最近一次同步状态与错误信息
功能特性
- 优先复用本机已有的官方 Codex CLI 登录态
- 如果本机没有可导入的登录信息,则自动拉起浏览器完成 ChatGPT 登录
- 登录成功后自动请求 ChatGPT / Codex usage 接口
- 侧边栏使用卡片式 Webview UI 展示额度信息
- 状态栏显示最近一个额度窗口距离刷新还有多久
- 支持自动后台刷新和手动刷新
工作方式
扩展会优先尝试读取本机 ~/.codex/auth.json 中已有的登录态。
如果读取不到可用 token,则会打开系统浏览器,走 ChatGPT 的 OAuth 登录流程。登录成功后:
- token 会保存到 VS Code Secret Storage
- 最近一次额度快照会保存到 VS Code globalState
- 扩展会自动请求额度接口并刷新侧边栏 UI
当前 UI 说明
侧边栏弹窗展示,展示逻辑如下:

- 百分比显示的是“剩余可用额度”
- 进度条长度也表示“剩余可用额度”
5 小时限额 和 周限额 分别显示独立的刷新时间
- 底部展示同步状态和上次同步时间
使用方式
打开左侧活动栏中的 Codex Quota 视图后:
- 点击
连接 ChatGPT 账号
- 如果你本机已经登录过官方 Codex CLI,扩展会自动导入该登录态
- 如果没有可导入的登录态,扩展会打开系统浏览器引导你登录
- 登录完成后,扩展会自动同步额度数据
- 之后你可以随时点击
刷新额度
可配置项
可以在 VS Code Settings 中搜索 Codex Quota Tracker,当前支持:
codexQuotaTracker.showStatusBar
是否在状态栏显示最近一个额度窗口的倒计时
codexQuotaTracker.autoRefreshEnabled
是否启用后台自动刷新
codexQuotaTracker.refreshIntervalMinutes
后台自动刷新间隔,单位分钟
codexQuotaTracker.enableDebugLogs
是否输出调试日志到 Output Channel
codexQuotaTracker.displayLanguage
侧边栏与状态栏的显示语言,可选 zh-CN 或 en
English
An extension for viewing live Codex quota usage directly inside VS Code.
The current version signs in with your ChatGPT account, reads Codex usage data automatically, and shows it in a dark sidebar card UI with:
5-hour quota
Weekly quota
- Next reset time for each quota window
- Remaining quota percentage
- Horizontal progress bars
- Latest sync status and error details
Features
- Reuses an existing official Codex CLI sign-in session when available
- Falls back to browser-based ChatGPT sign-in if no local session can be imported
- Requests the ChatGPT / Codex usage API after sign-in succeeds
- Displays quota data in a sidebar Webview panel
- Shows a countdown for the nearest reset window in the status bar
- Supports both automatic background refresh and manual refresh
How It Works
The extension first tries to read an existing session from ~/.codex/auth.json.
If no valid token is found, it opens the system browser and starts the ChatGPT OAuth sign-in flow. After sign-in:
- The token is stored in VS Code Secret Storage
- The latest quota snapshot is stored in VS Code
globalState
- The extension requests quota data and refreshes the sidebar UI
UI Overview
The sidebar presents the quota dashboard like this:

- The percentage represents remaining available quota
- The progress bar length also represents remaining quota
5-hour quota and Weekly quota have independent reset times
- The footer shows sync status and last update time
Usage
After opening the Codex Quota view in the activity bar:
- Click
Connect ChatGPT Account
- If the official Codex CLI is already signed in on your machine, the extension imports that session automatically
- If no session can be imported, the extension opens the browser and guides you through sign-in
- Once sign-in completes, quota data is synced automatically
- You can manually click
Refresh Quota at any time later
Settings
Search for Codex Quota Tracker in VS Code Settings. The extension currently supports:
codexQuotaTracker.showStatusBar
Whether to show the countdown to the nearest quota reset in the status bar
codexQuotaTracker.autoRefreshEnabled
Whether to enable automatic background refresh
codexQuotaTracker.refreshIntervalMinutes
Background refresh interval in minutes
codexQuotaTracker.enableDebugLogs
Whether to output detailed debug logs to the Output channel
codexQuotaTracker.displayLanguage
Display language for the sidebar and status bar. Supported values: zh-CN and en