跳到正文
Skillpedia
通用编程280k · #426

token-card

它能做什么

创建一张可视化卡片(SVG 图片),展示你使用 AI 编程工具的 Token 用量、对应的等价费用以及最近的进度。这张卡片会直接保存到你的代码文件中。

适用场景

  • ✓当你想在项目中展示自己使用 AI 编程助手的情况时。
  • ✓当你想要一份便于分享的 AI 编程活动摘要时。
  • ✓当你想查看 AI 用量摘要,但不想依赖在线服务时。

技能链接

https://github.com/affaan-m/ECC/blob/main/skills/token-card/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/affaan-m/ECC/blob/main/skills/token-card/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“为我的项目生成一张 Token 用量卡片。”

每周 5 个新技能,1 分钟读完。

工作原理

这个工具会读取你电脑上 Claude Code、Gemini 等 AI 程序的用量日志,然后根据这些信息生成一张 SVG 图片,并保存到项目中的一个文件夹里。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Token Card

Produce an SVG card summarising this machine's AI coding agent usage — total tokens, equivalent API cost, current streak, and the split across agents — and write it into the working tree as a file the README can reference.

The card is a committed artifact rather than a hosted image, so it renders from the repository itself and does not depend on a third-party endpoint staying up.

When to Activate

  • Someone wants a usage figure visible in a README or docs page.
  • Someone asks for a shareable summary of their agent activity across tools.

Use /cost-report instead when the question is "what did I spend this week". The two read different sources and produce different things:

/cost-report Token Card
Source ~/.claude/metrics/costs.jsonl, written by ECC's stop:cost-tracker hook The agents' own session logs
Agents Claude Code Claude Code, Codex, Gemini CLI, OpenCode
Output Terminal summary, optional CSV An SVG file committed to the repo

The tool this runs

@tokenchit/cli, MIT licensed: https://github.com/iyashjayesh/tokenchit

Pinned to an exact version, deliberately. @latest resolves to whatever the registry currently serves, and this tool reads local session logs — so a compromised future release would be executed with access to them before anyone had reviewed it. Pin, and raise the pin knowingly:

TOKENCHIT_VERSION=0.10.0

To check the pinned artifact before running it the first time:

npm view @tokenchit/cli@0.10.0 dist.integrity dist.tarball

Workflow

  1. Ask before the first download. npx fetches the package from the npm registry and executes it. That is a remote download of code that will read local logs, so get explicit confirmation from the user before the first run on a machine. If they decline, stop here and say what would have run.

  2. Configure, unless this is a dry run. If .tokenchit.json is absent, run:

    npx -y @tokenchit/cli@0.10.0 init
    

    It detects which agents have logs on this machine and records them. The file is meant to be committed and never contains a credential.

    Skip this entirely when the user passed --dry-run, and report that .tokenchit.json would be created. A preview that writes a config file is not a preview.

  3. Render the card. The bare command writes to the configured output — tokenchit.svg unless .tokenchit.json names another path:

    npx -y @tokenchit/cli@0.10.0 sync
    

    Append only the flags the user actually asked for, each spelled exactly as below. Do not copy a placeholder into the command — sync ignores an unrecognised positional argument rather than refusing it, so a bracketed [--dry-run] reaches the CLI as junk and the card is written anyway, which is the opposite of what was asked.

    Flag Effect
    --out <path> Write somewhere other than the configured output
    --theme auto | light | dark Card theme; auto adapts to the reader's system
    --dry-run Print what would be written and touch nothing

    sync reads local files and sends nothing: no prompts, no code, no file contents leave the machine, and it transmits nothing to any server. The npx invocation around it is a registry download — that is the network access in this workflow, and step 1 is where it is agreed.

  4. Report and offer. Print the figures it produced — tokens, equivalent cost, streak, per-agent split — and the path written. If the repository has a README that does not yet reference the card, offer to add:

    ![tokenchit](./tokenchit.svg)
    

    sync prints the path relative to the repository root. A Markdown image resolves relative to the file it sits in, so rewrite it for the README being edited: a card at docs/usage.svg is ./docs/usage.svg from the root README but ../usage.svg from docs/zh-CN/README.md. Pasting the printed path into a nested README points at docs/zh-CN/docs/usage.svg and renders broken.

    Do not edit the README without being asked.

Stop after step 4. Publishing to the public leaderboard is a separate publish command that requires explicit opt-in, and is not part of this workflow — run it only if the user asks for it by name. unpublish removes the row and the account again.

Output

…

常见问题

卡片上会显示哪些信息?

会显示 Token 的总用量、大致的金额花费、你当前的连续使用天数,以及各个 AI 工具的用量分布。

我需要安装什么东西吗?

这个工具使用 `npx`,它会即时下载所需程序,不会在你的电脑上永久安装任何东西。你只需要先安装 Node.js 即可。

这个工具会把我的数据发送到别处吗?

不会。它只会读取电脑上的本地日志并生成图片。除了最初下载程序之外,不会有任何内容发送到互联网上。

详情

作者的原始描述

Render a token-usage stat card from local Claude Code, Codex, Gemini CLI, and OpenCode session logs and commit it into the repository as a file. Use when someone wants a current usage figure in a README, or asks for a shareable card of their coding-agent activity.

repo: affaan-m/ECC

热度

GitHub 星标
280k
排名
#426
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能