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

v0.2.4

Published

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

Readme

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

cc-costline

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

cc-costline 截图

14.6k ~ $2.42 / 40% by Opus 4.6 | 5h: 45% / 7d: 8% | 30d: $866 | #2/22 $67.0

安装

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

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

功能一览

| 模块 | 示例 | 说明 | |------|------|------| | Token ~ 费用 / 上下文 | 14.6k ~ $2.42 / 40% by Opus 4.6 | 会话 token 数量、费用、上下文使用率和模型 | | 使用限额 | 5h: 45% / 7d: 8% | Claude 5 小时和 7 天使用率(颜色同上下文) | | 周期费用 | 30d: $866 | 滚动费用合计(可配置:7d 或 30d) | | 排行榜 | #2/22 $67.0 | ccclub 排名(需安装) |

颜色规则

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

可选集成

  • Claude 使用限额 — 自动从 macOS 钥匙串读取 OAuth 凭证。只需 claude login 即可。
  • ccclub 排行榜 — 安装 ccclubnpm i -g ccclub && ccclub init),排名自动显示。

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

命令

cc-costline install              # 设置 Claude Code 集成
cc-costline uninstall            # 从设置中移除
cc-costline refresh              # 手动重新计算费用缓存
cc-costline config --period 30d  # 显示 30 天费用(默认)
cc-costline config --period 7d   # 显示 7 天费用

工作原理

  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. 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 定价。

卸载

cc-costline uninstall
npm uninstall -g cc-costline

致谢

许可证

MIT