npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cc-costline-zhipu

v0.3.0

Published

Enhanced statusline for Claude Code with cost tracking, usage limits, Zhipu GLM usage, and leaderboard

Readme

English | 日本語 | Français | Español

cc-costline-zhipu

Claude Code 打造的增强状态栏 — 在终端中显示费用追踪、使用限额、智谱用量和排行榜排名。

cc-costline-zhipu 截图

526.3k $16.3 · 57% glm-4.7 / 7d:$137 / ZHIPU:124.0M ~ $74.4 · 5h:27% · MCP:10/100 · M:380.5M ~ $228

安装

npm i -g cc-costline-zhipu && cc-costline-zhipu install

打开一个新的 Claude Code 会话即可看到增强状态栏。需要 Node.js >= 22。

功能一览

| 模块 | 示例 | 说明 | |------|------|------| | Token ~ 费用 / 上下文 | 526.3k ~ $16.3 / 57% glm-4.7 | 会话 token 数量、费用、上下文使用率和模型 | | 使用限额 | 5h: 27% | Claude 5 小时使用率(颜色同上下文) | | 周期费用 | 7d: $13730d: $246 | 本地计算的滚动费用(可配置:none/7d/30d/both) | | 智谱用量 | ZHIPU:124.0M ~ $74.4 · 5h:27% · MCP:10/100 · M:380.5M ~ $228 | 智谱 24h 用量、5h 配额、MCP 月度使用、本月累计 | | 排行榜 | #2/22 $67.0 | ccclub 排名(需安装) |

状态栏示例

默认配置(period=7d, showResetTime=false)

526.3k $16.3 · 57% glm-4.7 / 7d:$137 / ZHIPU:124.0M ~ $74.4 · 5h:27% · MCP:10/100 · M:380.5M ~ $228

最小配置(period=none, showZhipu=false)

526.3k $16.3 · 57% glm-4.7 / 5h:27%

完整配置(period=both, showResetTime=true)

526.3k $16.3 · 57% glm-4.7 / 7d:$137 · 30d:$246 / ZHIPU:124.0M ~ $74.4 · 5h:27% (17:16) · MCP:10/100 · M:380.5M ~ $228

配额超限(5h > 100%)

526.3k $16.3 · 57% glm-4.7 / ZHIPU:124.0M ~ $74.4 · 5h:2:30 · MCP:10/100 · M:380.5M ~ $228

5h:2:30 显示距离刷新的倒计时(2 小时 30 分钟)

智谱用量详情

| 显示项 | 示例 | 说明 | |--------|------|------| | 24 小时模型用量 | ZHIPU:124.0M ~ $74.4 | 24 小时 Token 总量和预估成本 | | 5 小时配额 | 5h:27%5h:2:30 | 5 小时 Token 使用率,≥100% 时显示倒计时 | | MCP 月度使用 | MCP:10/100 | MCP 工具月度调用次数(search-prime + web-reader + zread) | | 本月累计 | M:380.5M ~ $228 | 从 1 号到今天的累计 Token 和成本 |

颜色规则

  • 上下文和使用限额 — 绿色(< 60%)→ 橙色(60-79%)→ 红色(≥ 80%)
  • 排行榜排名 — 第 1 名金色,第 2 名白色,第 3 名橙色,其余蓝色
  • 周期费用 — 黄色

可选集成

  • Claude 使用限额 — 自动从 macOS 钥匙串读取 OAuth 凭证。只需 claude login 即可。
  • 智谱用量查询 — 自动从 ~/.claude/settings.json 读取 ANTHROPIC_AUTH_TOKENANTHROPIC_BASE_URL(智谱兼容配置)。
  • ccclub 排行榜 — 安装 ccclubnpm i -g ccclub && ccclub init),排名自动显示。

三者均为零配置:不可用时对应模块静默隐藏。

命令

cc-costline-zhipu install              # 设置 Claude Code 集成
cc-costline-zhipu uninstall            # 从设置中移除
cc-costline-zhipu refresh              # 手动重新计算费用缓存

# 配置显示周期
cc-costline-zhipu config --period none   # 不显示 7d/30d 成本
cc-costline-zhipu config --period 7d     # 只显示 7 天成本
cc-costline-zhipu config --period 30d    # 只显示 30 天成本
cc-costline-zhipu config --period both   # 同时显示 7 天和 30 天成本

# 智谱用量配置
cc-costline-zhipu config --zhipu true    # 显示智谱用量(默认)
cc-costline-zhipu config --zhipu false   # 隐藏智谱用量
cc-costline-zhipu config --reset-time true   # 显示 5h 配额刷新时间
cc-costline-zhipu config --reset-time false  # 不显示刷新时间(默认)

工作原理

  1. install 配置 ~/.claude/settings.json — 设置状态栏命令并添加会话结束 hook 以自动刷新。你的现有设置会被保留。
  2. render 读取 Claude Code 的 stdin JSON 和费用缓存,输出格式化的状态栏。
  3. refresh 扫描 ~/.claude/projects/**/*.jsonl,提取 token 用量,按模型定价计算,写入 ~/.cc-costline/cache.json
  4. Claude 使用率api.anthropic.com/api/oauth/usage 获取,60 秒文件缓存于 /tmp/sl-claude-usage
  5. 智谱用量从智谱 API 获取(/api/monitor/usage/model-usage/api/monitor/usage/quota/limit),60 秒文件缓存于 /tmp/sl-zhipu-usage
  6. ccclub 排名ccclub.dev/api/rank 获取,120 秒文件缓存于 /tmp/sl-ccclub-rank

每百万 token 价格(美元):

| 模型 | 输入 | 输出 | 缓存写入 | 缓存读取 | |------|-----:|-----:|---------:|---------:| | Opus 4.6 | $5 | $25 | $6.25 | $0.50 | | Opus 4.5 | $5 | $25 | $6.25 | $0.50 | | Opus 4.1 | $15 | $75 | $18.75 | $1.50 | | Sonnet 4.5 | $3 | $15 | $3.75 | $0.30 | | Sonnet 4 | $3 | $15 | $3.75 | $0.30 | | Haiku 4.5 | $1 | $5 | $1.25 | $0.10 | | Haiku 3.5 | $0.80 | $4 | $1.00 | $0.08 |

未知模型按系列名称回退,默认使用 Sonnet 定价。

每百万 token 价格(美元),来源 LiteLLM

| 模型 | 输入 | 输出 | 缓存读取 | |------|-----:|-----:|---------:| | zai/glm-4.7 | $0.60 | $2.20 | $0.11 | | zai/glm-4.6 | $0.60 | $2.20 | $0.11 | | zai/glm-4.5-air | $0.20 | $1.10 | - | | zai/glm-5 | $1.00 | $3.20 | $0.20 |

注意:成本计算统一使用输入价格($0.60/M),不区分输入/输出 Token。

开发

npm test    # 构建 + 运行单元测试(node:test,零依赖)
npm i -g .  # 本地安装测试

卸载

cc-costline-zhipu uninstall
npm uninstall -g cc-costline-zhipu

致谢

许可证

MIT