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

@anglyaoy/token-usage

v0.4.3

Published

Collect local AI coding token usage and sync it to 4Ever.

Readme

@anglyaoy/token-usage

Local Token usage collector for 4Ever.

Install

npm install -g @anglyaoy/token-usage

Bind To 4Ever

Generate a CLI key in the 4Ever Token统计 module, then run the interactive setup:

forever-token init

The CLI will show the API URL it will use, then prompt for the CLI key:

4Ever API URL: https://www.4everapi.top
Token统计 CLI Key:

After saving the config, init immediately runs one sync.

For a local development backend, use:

forever-token init local

For a non-default backend, pass only the API URL and still paste the key into the prompt:

forever-token init --api-url https://your-4ever.example.com

Then sync once:

forever-token sync

For continuous sync:

forever-token daemon --interval 300000

The collector reads local usage from Codex, Claude Code, Gemini CLI, Qwen Code, OpenCode, and OpenClaw where available. It aggregates usage into 30-minute buckets, extracts session activity, and uploads to /api/token-usage/ingest. Total Token counts include input, output, cached, and reasoning tokens so the CLI, API dashboard, hourly heatmap, and leaderboard use the same accounting.

Do not pass the CLI key as a command argument. Keeping the key in the interactive forever-token init prompt avoids writing it into shell history.

Local Commands

这些命令只读取本机日志,不会上传数据:

forever-token
forever-token usage
forever-token monthly
forever-token dayly
forever-token daily
forever-token hourly
forever-token status
forever-token version
forever-token help
  • forever-token / forever-token usage:展示当前本机累计 Token 消耗。
  • forever-token monthly:按月展示本机 Token 消耗。
  • forever-token dayly:按日展示近三个月本机 Token 消耗。daily 是同义别名。
  • forever-token hourly:按 GMT+8 展示今日每小时 Token 消耗,用来核对前端小时热力图。
  • forever-token status:展示绑定状态、可发现的数据目录和本地快照。
  • forever-token version:展示 CLI 版本号。
  • forever-token help:展示中文命令说明。

本地按日、按月、按小时输出与前端一致使用 GMT+8 统计口径。统计输出统一使用简写单位:低于 1B 时显示为 M Tokens,达到 1B 及以上显示为 B Tokens。例如 3,100,000 tokens 显示为 3.1M Tokens310,000,000 tokens 显示为 310M Tokens1,000,000,000 tokens 显示为 1B Tokens