{"_id":"@anglyaoy/token-usage","_rev":"5-f37758fe87e60f70a70198004071390a","name":"@anglyaoy/token-usage","dist-tags":{"latest":"0.4.3"},"versions":{"0.1.0":{"name":"@anglyaoy/token-usage","version":"0.1.0","license":"MIT","_id":"@anglyaoy/token-usage@0.1.0","maintainers":[{"name":"anglyao","email":"anglyao778@gmail.com"}],"bin":{"forever-token":"bin/forever-token.js"},"dist":{"shasum":"f8722f5625163b8a5391bd27136a8305fece8478","tarball":"https://registry.npmjs.org/@anglyaoy/token-usage/-/token-usage-0.1.0.tgz","fileCount":4,"integrity":"sha512-YHHMVnSxj0xboM54Hn48i/KBFMioeJPKiXHT7IwMO46xOmEbaHe1t/6kISLBV0SlbLaU2rdbBPobBc/w2/5Zyw==","signatures":[{"sig":"MEUCIE52mpPFL5eEw3huNqZzruGYAxD/INNNrtckIFYir1n/AiEA9fcAcMClu9JVnymP1hLc0iZuH39pnzM5HEi4kQMsHLk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":37785},"type":"module","engines":{"node":">=18.0.0"},"gitHead":"712c708376832a98a88daaca1c3ccf10bef39ab7","scripts":{"sync":"node bin/forever-token.js sync","start":"node bin/forever-token.js","pack:check":"npm pack --dry-run"},"_npmUser":{"name":"anglyao","email":"anglyao778@gmail.com"},"_npmVersion":"10.9.4","description":"Collect local AI coding token usage and sync it to 4Ever.","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/token-usage_0.1.0_1780110086217_0.39911814415032465","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@anglyaoy/token-usage","version":"0.2.0","license":"MIT","_id":"@anglyaoy/token-usage@0.2.0","maintainers":[{"name":"anglyao","email":"anglyao778@gmail.com"}],"bin":{"forever-token":"bin/forever-token.js"},"dist":{"shasum":"ddd4b84f2d88e5d7ac8d15071aebbd7c143cc77a","tarball":"https://registry.npmjs.org/@anglyaoy/token-usage/-/token-usage-0.2.0.tgz","fileCount":5,"integrity":"sha512-BNFmy6nzFXTsCgUNcMlJkiWxCB0bCL2mkIBKUJo2ATaAzICerLK2MEWGdKqE1UMPbn09oQgpxc8l8HSNijWkwg==","signatures":[{"sig":"MEQCIGvB7VeJuXQLJ5kp9Ty5Rn8r44fJyWRpqKUx73AgEl+iAiBHEv93TCm73CNISdlXpR+eembSZfmcLBu68lhqhxxHqA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":56725},"type":"module","engines":{"node":">=18.0.0"},"gitHead":"712c708376832a98a88daaca1c3ccf10bef39ab7","scripts":{"sync":"node bin/forever-token.js sync","start":"node bin/forever-token.js","pack:check":"npm pack --dry-run"},"_npmUser":{"name":"anglyao","email":"anglyao778@gmail.com"},"_npmVersion":"10.9.4","description":"Collect local AI coding token usage and sync it to 4Ever.","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/token-usage_0.2.0_1780140584664_0.47744793583972345","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@anglyaoy/token-usage","version":"0.4.0","license":"MIT","_id":"@anglyaoy/token-usage@0.4.0","maintainers":[{"name":"anglyao","email":"anglyao778@gmail.com"}],"bin":{"forever-token":"bin/forever-token.js"},"dist":{"shasum":"482ecbbb74b58802ebb29a5a146f4eb601021b99","tarball":"https://registry.npmjs.org/@anglyaoy/token-usage/-/token-usage-0.4.0.tgz","fileCount":5,"integrity":"sha512-teZjpArKrCYrU3elS/gBSJYm+g+NC4gd3ED4EHljaIo3LLCYiEgVhmq3Av/VqUJwOvlgtVLgKIXyUPzZ/he+oA==","signatures":[{"sig":"MEQCIGeglIOTEIDQt6lVduaONrHDJf3Nwbr+SsukUiO+BjDpAiA4wHw7AEk/y9unt7wwuaELPv4TR/kD41IXHce4w/oQgQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":66774},"type":"module","engines":{"node":">=18.0.0"},"gitHead":"37fe38cd4ba7f9efabf91ae6258d2d29d7521b10","scripts":{"sync":"node bin/forever-token.js sync","start":"node bin/forever-token.js","pack:check":"npm pack --dry-run"},"_npmUser":{"name":"anglyao","email":"anglyao778@gmail.com"},"_npmVersion":"10.9.4","description":"Collect local AI coding token usage and sync it to 4Ever.","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/token-usage_0.4.0_1780358778427_0.6557156541785085","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"name":"@anglyaoy/token-usage","version":"0.4.1","license":"MIT","_id":"@anglyaoy/token-usage@0.4.1","maintainers":[{"name":"anglyao","email":"anglyao778@gmail.com"}],"bin":{"forever-token":"bin/forever-token.js"},"dist":{"shasum":"675708668e9a06a23c17be4ff223720c1aa87b0a","tarball":"https://registry.npmjs.org/@anglyaoy/token-usage/-/token-usage-0.4.1.tgz","fileCount":5,"integrity":"sha512-8nwsAnkpyqrjLQ2Jb+M4wyr+puOkbjYlXZIpXPxLWQkajrK0gVEnmJLv5E7B07ykn/8dqcTq/989RqIfPXLHFA==","signatures":[{"sig":"MEQCIH/8Dgv0YUVzcdKl9AqUIsBO3lgX1zpUI9buS8grw6EhAiBG+iqK9OkIIPS1K49eUUnGg/hTEB1AjOHcLPp3LsuzBg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":67838},"type":"module","engines":{"node":">=18.0.0"},"gitHead":"37fe38cd4ba7f9efabf91ae6258d2d29d7521b10","scripts":{"sync":"node bin/forever-token.js sync","start":"node bin/forever-token.js","pack:check":"npm pack --dry-run"},"_npmUser":{"name":"anglyao","email":"anglyao778@gmail.com"},"_npmVersion":"10.9.4","description":"Collect local AI coding token usage and sync it to 4Ever.","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/token-usage_0.4.1_1780362569863_0.30286285642108646","host":"s3://npm-registry-packages-npm-production"}},"0.4.3":{"name":"@anglyaoy/token-usage","version":"0.4.3","type":"module","description":"Collect local AI coding token usage and sync it to 4Ever.","license":"MIT","publishConfig":{"access":"public"},"bin":{"forever-token":"bin/forever-token.js"},"scripts":{"start":"node bin/forever-token.js","sync":"node bin/forever-token.js sync","pack:check":"npm pack --dry-run"},"engines":{"node":">=18.0.0"},"_id":"@anglyaoy/token-usage@0.4.3","gitHead":"19e8d69d157c0aa18de72950e740d641acc22227","_nodeVersion":"22.22.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-VEZUhxHByQckqF64kJUjN0vHG9t2u4UrmXqWnYR4myYpgEk7x0bL4aZ2TTMnAf/LkQ78ZA1yMk9Qsoomi71nYA==","shasum":"713cb91af9b69eb68f052dbd78c0bab37f9d0c42","tarball":"https://registry.npmjs.org/@anglyaoy/token-usage/-/token-usage-0.4.3.tgz","fileCount":5,"unpackedSize":68368,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIBQDsX4HktjImFmhuODmGW9kqValesiu2sVzZOu6OdGFAiBiTQGVzGQH33k/KQdHEhWEPgNqhHCPCiaxCNiVkif0RQ=="}]},"_npmUser":{"name":"anglyao","email":"anglyao778@gmail.com"},"directories":{},"maintainers":[{"name":"anglyao","email":"anglyao778@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/token-usage_0.4.3_1780897185881_0.691681554160605"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-30T03:01:26.044Z","modified":"2026-06-08T05:39:46.146Z","0.1.0":"2026-05-30T03:01:26.365Z","0.2.0":"2026-05-30T11:29:44.809Z","0.4.0":"2026-06-02T00:06:18.583Z","0.4.1":"2026-06-02T01:09:30.004Z","0.4.3":"2026-06-08T05:39:46.017Z"},"license":"MIT","description":"Collect local AI coding token usage and sync it to 4Ever.","maintainers":[{"name":"anglyao","email":"anglyao778@gmail.com"}],"readme":"# @anglyaoy/token-usage\n\nLocal Token usage collector for 4Ever.\n\n## Install\n\n```bash\nnpm install -g @anglyaoy/token-usage\n```\n\n## Bind To 4Ever\n\nGenerate a CLI key in the 4Ever `Token统计` module, then run the interactive setup:\n\n```bash\nforever-token init\n```\n\nThe CLI will show the API URL it will use, then prompt for the CLI key:\n\n```text\n4Ever API URL: https://www.4everapi.top\nToken统计 CLI Key:\n```\n\nAfter saving the config, `init` immediately runs one sync.\n\nFor a local development backend, use:\n\n```bash\nforever-token init local\n```\n\nFor a non-default backend, pass only the API URL and still paste the key into the prompt:\n\n```bash\nforever-token init --api-url https://your-4ever.example.com\n```\n\nThen sync once:\n\n```bash\nforever-token sync\n```\n\nFor continuous sync:\n\n```bash\nforever-token daemon --interval 300000\n```\n\nThe 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.\n\nDo 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.\n\n## Local Commands\n\n这些命令只读取本机日志，不会上传数据：\n\n```bash\nforever-token\nforever-token usage\nforever-token monthly\nforever-token dayly\nforever-token daily\nforever-token hourly\nforever-token status\nforever-token version\nforever-token help\n```\n\n- `forever-token` / `forever-token usage`：展示当前本机累计 Token 消耗。\n- `forever-token monthly`：按月展示本机 Token 消耗。\n- `forever-token dayly`：按日展示近三个月本机 Token 消耗。`daily` 是同义别名。\n- `forever-token hourly`：按 GMT+8 展示今日每小时 Token 消耗，用来核对前端小时热力图。\n- `forever-token status`：展示绑定状态、可发现的数据目录和本地快照。\n- `forever-token version`：展示 CLI 版本号。\n- `forever-token help`：展示中文命令说明。\n\n本地按日、按月、按小时输出与前端一致使用 GMT+8 统计口径。统计输出统一使用简写单位：低于 `1B` 时显示为 `M Tokens`，达到 `1B` 及以上显示为 `B Tokens`。例如 `3,100,000 tokens` 显示为 `3.1M Tokens`，`310,000,000 tokens` 显示为 `310M Tokens`，`1,000,000,000 tokens` 显示为 `1B Tokens`。\n","readmeFilename":"README.md"}