
Research
/Security News
Mini Shai-Hulud Campaign Hits Red Hat Cloud Services npm Packages
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.
cc-third-party-usage
Advanced tools
AI API Usage Monitor - Track Kimi and GLM API usage with automatic configuration detection
在 Claude Code 状态栏中监控第三方 AI 模型(Kimi / GLM)API 用量的 CLI 工具

为什么不建议使用 npx/bunx? npx/bunx 每次调用都需要 1-2 秒进行包解析和锁文件管理。对于要求快速响应的工具(如带有执行超时的状态栏集成),这一开销会导致超时问题。全局安装可彻底消除此开销。
# 使用 npm
npm install -g cc-third-party-usage
# 使用 Bun(更快)
bun install -g cc-third-party-usage
# 安装后即可在任何地方运行(30ms 响应)
cc-third-party-usage
⚠️ 不推荐通过 npx/bunx 运行。 每次调用额外增加 1-2 秒开销,请使用全局安装。
# 使用 npx
npx cc-third-party-usage
# 使用 bunx(稍快)
bunx cc-third-party-usage
# 附带参数
npx cc-third-party-usage --json
git clone https://github.com/abrahamgreyson/cc-third-party-usage.git
cd cc-third-party-usage
# 最快方式(Node 约 30ms,Bun 约 18ms)
node dist/usage.js
bun dist/usage.js
| 方式 | 响应时间 | 说明 |
|---|---|---|
node dist/usage.js | ~30ms | 直接执行文件,最快 |
bun dist/usage.js | ~18ms | Bun 运行时,更快 |
cc-third-party-usage(全局安装) | ~900ms | Node 启动 + SQLite 初始化 |
bunx cc-third-party-usage | ~1100ms | 每次都需要包解析 |
npx cc-third-party-usage | ~2500ms | 最慢,npm 解析开销最大 |
本工具采用即时响应架构:同步读取缓存数据后立即输出退出,同时启动独立的守护进程在后台获取最新 API 数据供下次调用使用。脚本本身执行始终在 30ms 以内——上表中的时间差异完全来自运行时的启动开销。
在 Claude Code 设置文件(~/.claude/settings.json)中添加:
{
"statusLine": {
"command": "cc-third-party-usage"
}
}
如需最快响应,可先克隆并构建,然后使用绝对路径:
git clone https://github.com/abrahamgreyson/cc-third-party-usage.git
cd cc-third-party-usage && bun run build
{
"statusLine": {
"command": "node /path/to/cc-third-party-usage/dist/usage.js"
}
}
在 ccstatusline 中作为 Custom Command 组件使用:
cc-third-party-usage(需全局安装)node /path/to/cc-third-party-usage/dist/usage.js(最快)t 键)# 首先设置环境变量(或通过本地代理配置)
export ANTHROPIC_BASE_URL=https://api.kimi.com
export ANTHROPIC_API_KEY=your-api-key
# 默认输出(为状态栏优化)
cc-third-party-usage
# 输出:Kimi: 45.2% used | 2h30m left
# JSON 输出
cc-third-party-usage --json
# 自定义模板
cc-third-party-usage --template "{provider}: {used}/{total} ({percent}%)"
# 详细模式(调试用)
cc-third-party-usage --verbose
# 自定义缓存时长(默认 60 秒)
cc-third-party-usage --cache-duration 120
# 帮助信息
cc-third-party-usage --help
# 版本号
cc-third-party-usage --version
Kimi: 45.2% used | 2h30m left
--json){
"provider": "kimi",
"quotas": [
{
"window": "5h",
"total": 100,
"used": 45,
"remaining": 55,
"percent": 45.2,
"reset": "2h30m",
"reset_timestamp": "2026-04-02T12:00:00Z"
}
],
"fetchedAt": "2026-04-02T10:30:00Z"
}
--template)支持的占位符:
{provider} — 服务商名称(Kimi/GLM){total} — 总配额(最短窗口){used} — 已用配额(最短窗口){remaining} — 剩余配额(最短窗口){percent} — 用量百分比(最短窗口){reset} — 重置时间(最短窗口){5h_total}, {5h_used} 等 — 指定窗口的值示例:
cc-third-party-usage --template "{provider}: {used}/{total}"
# 输出:Kimi: 45/100
cc-third-party-usage --template "{percent}% used, {remaining} remaining"
# 输出:45.2% used, 55 remaining
工具会自动检测 API 凭据,优先级如下:
ANTHROPIC_BASE_URL 指向 localhost 时)— 适用于代理用户ANTHROPIC_API_KEY 或 ANTHROPIC_AUTH_TOKENANTHROPIC_BASE_URL 或 BASE_URL| 服务商 | API 地址 | 说明 |
|---|---|---|
| Kimi | api.kimi.com | 月之暗面 |
| GLM | open.bigmodel.cn | 智谱 AI |
缓存文件存储在系统临时目录:
/tmp/cc-usage-cache/cc-usage-{provider}-cache.json--cache-duration 配置)v1.0(当前版本)
v1.1(规划中)
MIT 许可证 — 详见 LICENSE。
FAQs
AI API Usage Monitor - Track Kimi and GLM API usage with automatic configuration detection
We found that cc-third-party-usage demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.

Research
/Security News
The North Korean malware loader hides in a Packagist-listed package and its GitHub branch to fetch and execute remote code in a likely Contagious Interview-style lure.

Security News
The Rust project is moving toward formal rules on LLM use in contributions after months of internal debate over maintainer burden, code quality, and contributor experience.