ai-usage
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAI CLI Usage Checker
AI CLI 用量检查器
Check remaining quota and usage for AI coding assistants: Claude Code, OpenAI Codex, Gemini CLI, and Z.AI.
Uses the cclimits npm package.
查询以下AI编码助手的剩余配额和使用情况:Claude Code、OpenAI Codex、Gemini CLI和Z.AI。
基于cclimits npm包实现。
When to Use This Skill
何时使用该技能
- User asks "how much quota do I have left?"
- User asks "check my usage" or "am I rate limited?"
- User wants to know which AI tool has capacity
- Before starting a large task, to verify quota availability
- User asks about token limits or remaining requests
- 用户询问“我还剩多少配额?”
- 用户询问“查询我的使用情况”或者“我被限流了吗?”
- 用户想要了解哪款AI工具还有可用容量
- 启动大型任务前,验证配额是否充足
- 用户询问token限制或剩余请求次数
Running the Command
运行命令
bash
undefinedbash
undefinedCheck all tools (detailed)
检查所有工具(详细模式)
npx cclimits
npx cclimits
Compact one-liner (5h window)
精简单行输出(5小时窗口)
npx cclimits --oneline
npx cclimits --oneline
Compact one-liner (7d window)
精简单行输出(7天窗口)
npx cclimits --oneline 7d
npx cclimits --oneline 7d
Check specific tools
检查指定工具
npx cclimits --claude
npx cclimits --codex
npx cclimits --gemini
npx cclimits --zai
npx cclimits --claude
npx cclimits --codex
npx cclimits --gemini
npx cclimits --zai
JSON output (for scripting)
JSON格式输出(用于脚本开发)
npx cclimits --json
undefinednpx cclimits --json
undefinedCredential Locations
凭证存储位置
Credentials are auto-discovered from these locations:
| Tool | Location |
|---|---|
| Claude | |
| Codex | |
| Gemini | |
| Z.AI | |
凭证会从以下位置自动扫描获取:
| 工具 | 存储位置 |
|---|---|
| Claude | |
| Codex | |
| Gemini | |
| Z.AI | |
Setup (One-Time)
配置(仅需一次)
If credentials are missing, run the corresponding CLI tool to authenticate:
bash
claude # Login to Claude Code
codex login # Login to OpenAI Codex
gemini # Login to Gemini CLI
export ZAI_KEY=your-key # Add to ~/.zshrc如果找不到凭证,运行对应CLI工具完成身份验证:
bash
claude # 登录Claude Code
codex login # 登录OpenAI Codex
gemini # 登录Gemini CLI
export ZAI_KEY=your-key # 可添加到~/.zshrc中永久生效Output Interpretation
输出解读
Quota Windows
配额统计窗口
Most tools use rolling windows:
- 5-hour window: Short-term rate limit
- 7-day window: Weekly quota limit
大部分工具采用滚动窗口统计:
- 5小时窗口:短期速率限制
- 7天窗口:每周配额限制
Percentage Used
使用百分比
- 0-50%: Plenty of capacity
- 50-70%: Moderate usage, plan accordingly
- 70-90%: High usage, may want to switch tools
- 90-100%: Near limit, expect rate limiting
- 0-50%:容量充足
- 50-70%:使用量适中,合理规划即可
- 70-90%:使用量较高,可以考虑切换工具
- 90-100%:接近限额,可能会被限流
Status Icons
状态图标
| Icon | Meaning |
|---|---|
| ✅ | Under 70% - plenty of capacity |
| ⚠️ | 70-90% - moderate usage |
| 🔴 | 90-100% - near limit |
| ❌ | 100% or unavailable |
| 图标 | 含义 |
|---|---|
| ✅ | 使用率低于70% - 容量充足 |
| ⚠️ | 使用率70-90% - 使用量适中 |
| 🔴 | 使用率90-100% - 接近限额 |
| ❌ | 使用率100%或服务不可用 |
Gemini Tiers
Gemini 配额层级
Gemini models are grouped by quota tier (models in same tier share quota):
| Tier | Models |
|---|---|
| 3-Flash | gemini-3-flash-preview |
| Flash | gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.0-flash |
| Pro | gemini-2.5-pro, gemini-3-pro-preview |
Gemini模型按配额层级分组(同一层级的模型共享配额):
| 层级 | 包含模型 |
|---|---|
| 3-Flash | gemini-3-flash-preview |
| Flash | gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.0-flash |
| Pro | gemini-2.5-pro, gemini-3-pro-preview |
Example Output
输出示例
Compact One-liner (--oneline)
精简单行输出(--oneline)
Claude: 4.0% (5h) ✅ | Codex: 0% (5h) ✅ | Z.AI: 1% ✅ | Gemini: ( 3-Flash 7% ✅ | Flash 1% ✅ | Pro 10% ✅ )Claude: 4.0% (5h) ✅ | Codex: 0% (5h) ✅ | Z.AI: 1% ✅ | Gemini: ( 3-Flash 7% ✅ | Flash 1% ✅ | Pro 10% ✅ )Detailed Output (default)
详细输出(默认)
🔍 AI CLI Usage Checker
2025-12-31 21:30:00
==================================================
Claude Code
==================================================
🔑 Auth: Bearer token
✅ Connected
5-Hour Window:
Used: 15.2%
Remaining: 84.8%
Resets in: 3h 24m
7-Day Window:
Used: 42.0%
Remaining: 58.0%
Resets in: 4d 12h
==================================================
OpenAI Codex
==================================================
🔑 Auth: OAuth (ChatGPT)
✅ Connected
📊 Plan: pro
5h Window:
Used: 8%
Remaining: 92%
Resets in: 2h 15m
==================================================
Gemini CLI
==================================================
🔑 Auth: OAuth (Google Account)
✅ Connected
📊 Tier: standard
Quota by Tier:
3-Flash: 7.0% used, 93.0% remaining
Flash: 1.0% used, 99.0% remaining
Pro: 10.0% used, 90.0% remaining
==================================================
Z.AI (GLM-4)
==================================================
✅ Connected
Token Quota:
Used: 1%
Remaining: 99%
(10,000 / 1,000,000 tokens)🔍 AI CLI Usage Checker
2025-12-31 21:30:00
==================================================
Claude Code
==================================================
🔑 Auth: Bearer token
✅ Connected
5-Hour Window:
Used: 15.2%
Remaining: 84.8%
Resets in: 3h 24m
7-Day Window:
Used: 42.0%
Remaining: 58.0%
Resets in: 4d 12h
==================================================
OpenAI Codex
==================================================
🔑 Auth: OAuth (ChatGPT)
✅ Connected
📊 Plan: pro
5h Window:
Used: 8%
Remaining: 92%
Resets in: 2h 15m
==================================================
Gemini CLI
==================================================
🔑 Auth: OAuth (Google Account)
✅ Connected
📊 Tier: standard
Quota by Tier:
3-Flash: 7.0% used, 93.0% remaining
Flash: 1.0% used, 99.0% remaining
Pro: 10.0% used, 90.0% remaining
==================================================
Z.AI (GLM-4)
==================================================
✅ Connected
Token Quota:
Used: 1%
Remaining: 99%
(10,000 / 1,000,000 tokens)Troubleshooting
故障排查
"No credentials found"
- Run the CLI tool to authenticate (see Setup section)
- For Z.AI, ensure environment variable is set
"Token expired"
- Claude: Run to re-authenticate
claude - Codex: Run
codex login - Gemini: Run (or wait for auto-refresh)
gemini
API errors
- Check internet connectivity
- Verify the CLI tool works directly
- Check if the service is down
“未找到凭证”
- 运行对应CLI工具完成身份验证(参考配置章节)
- 对于Z.AI,请确认环境变量已正确设置
“Token已过期”
- Claude:运行重新验证身份
claude - Codex:运行
codex login - Gemini:运行(或等待自动刷新)
gemini
API错误
- 检查网络连接
- 直接运行对应CLI工具确认是否可用
- 检查对应服务是否宕机
Package Info
包信息
npm package: cclimits
GitHub: cruzanstx/cclimits
Requires: Node.js 16+ and Python 3.10+
npm包: cclimits
GitHub: cruzanstx/cclimits
依赖要求:Node.js 16+ 和 Python 3.10+