Token Receiptのロゴ

Token Receipt

コミュニティ
crazynomad
token-receipt

Generate a printer-receipt styled PNG bill of AI token usage and cost from local ccusage data, for the 绿皮火车 channel. Use when the user wants a token usage "账单"/"小票"/"收银台"/receipt/invoice, a shareable spend breakdown by model / input / output / cached / by day, or 节目素材 about token 消耗/花费. Triggers on "生成账单", "token 收据", "做张小票", "用量账单", "token receipt", "spend breakdown image".

概要

公開者crazynomad
リポジトリskills
スキル名token-receipt
スター
27
フォーク
8
同梱ファイル
2
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 2個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    crazynomadがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルToken ReceiptをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/crazynomad/skills/tree/master/token-receipt
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/crazynomad/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/token-receipt .claude/skills/token-receipt
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでToken Receiptを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にToken Receiptを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Token Receiptは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

token-receipt

Turns real ccusage usage data into a fun, printer-receipt styled PNG bill — designed as 节目 (show) material for the 绿皮火车 channel's token-consumption segments. The receipt shows token usage, a token-type mix bar, cost broken down by model, and a per-day spend chart, ending in a big TOTAL.

When to use

  • "帮我生成 (这个月/这周的) token 账单 / 小票 / 收据"
  • "做张图展示我的 token 花在哪了 / 花费分布"
  • "节目里要讲 token 消耗,给我一张可上镜的账单图"
  • English: "make a token usage receipt", "spend breakdown image by model/day"

Prerequisites (all already present on this Mac)

  • ccusage CLI on PATH (ccusage --version)
  • Google Chrome at /Applications/Google Chrome.app (headless screenshot)
  • ImageMagick magick (auto-trims the screenshot to the receipt edge)
  • python3 (stdlib only — no pip installs)

Usage

bash
# Latest month, all agents → ~/Desktop/token-receipt-YYYY-MM.png
python3 scripts/gen_receipt.py

# This week
python3 scripts/gen_receipt.py --period week

# A specific month or a specific week (week = its start date)
python3 scripts/gen_receipt.py --period month --which 2026-05
python3 scripts/gen_receipt.py --period week  --which 2026-06-15

# One agent only (claude / codex / opencode / pi / ...); default = all agents
python3 scripts/gen_receipt.py --agent claude

# Custom name, output path, sharper export, or HTML-only (tweak the design)
python3 scripts/gen_receipt.py --customer "绿皮火车" --out ~/Desktop/bill.png
python3 scripts/gen_receipt.py --scale 3
python3 scripts/gen_receipt.py --html-only   # writes .html, open in a browser

The script prints the output path on success.

Options

FlagDefaultMeaning
--periodmonthmonth or week billing cycle
--whichlatestlatest, or YYYY-MM (month) / YYYY-MM-DD week-start
--agentallrestrict to one ccusage agent
--customerBurn Wangname printed on the receipt (or RECEIPT_CUSTOMER env)
--out~/Desktop/token-receipt-<period>.pngoutput path
--scale2device scale factor (2 = retina; 3 = bigger)
--html-onlyoffemit HTML instead of PNG (for design tweaks)

How it works

  1. Pulls JSON from ccusage <agent?> <monthly|weekly> and, for the per-day chart, ccusage daily filtered to the chosen month/week window.
  2. Shapes it into receipt sections and renders a self-contained HTML (monospace, dotted leader lines, ASCII train, CSS barcode, torn edges).
  3. Screenshots with headless Chrome at retina scale, then magick -trim crops to the receipt and adds an even margin.

Honesty notes (matters for the show)

  • Numbers are best-effort estimates from local logs, not a real billing API (stated on the receipt footer).
  • ccusage exposes cost per model, not cost per token-type. So the receipt splits cost by model (accurate) and token volume by type (accurate); it never fabricates a per-token-type dollar split.
  • Cache-read tokens dominate volume (often ~95%) and are cheap per token (~1/10 of input), but at heavy-usage volume they can still be the largest cost line — verified: in one June sample cache-read was 96% of opus-4-8 tokens and 61% of its cost. The real point: caching saves ~10x vs paying full input price for that re-sent context. The footer states this.

Customizing the look

Open scripts/gen_receipt.py:

  • TRAIN — the ASCII art header.
  • TOKEN_KINDS — token categories, labels, and colors of the mix bar.
  • The <style> block in build_html — paper color, accent (--accent, currently green-train teal #1f6f5c), fonts, spacing. Iterate fast with --html-only, then re-render to PNG.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Token Receipt」では何ができますか?

Generate a printer-receipt styled PNG bill of AI token usage and cost from local ccusage data, for the 绿皮火车 channel. Use when the user wants a token usage "账单"/"小票"/"收银台"/receipt/invoice, a shareable spend breakdown by model / input / output / cached / by day, or 节目素材 about token 消耗/花费. Triggers on "生成账单", "token 收据", "做张小票", "用量账单", "token receipt", "spend breakdown image".

TypingMindでToken Receiptを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Token Receiptはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにToken Receiptをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/crazynomad/skills/tree/master/token-receiptを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Token Receiptを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Token Receiptは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもToken Receiptを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Token Receipt」は無料ですか?

はい。crazynomadがGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇