Token Receipt logo

Token Receipt

Community
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".

Overview

Publishercrazynomad
Repositoryskills
Skill nametoken-receipt
Stars
27
Forks
8
Bundled files
2
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by crazynomad on GitHub. Read the source before you install it.

Installation

Install the Token Receipt AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/crazynomad/skills/tree/master/token-receipt
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

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
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Token Receipt in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Token Receipt on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Token Receipt is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Token Receipt AI skill do?

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".

Why use Token Receipt on TypingMind?

Because you install it once and use it with any model. Token Receipt is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Token Receipt in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/crazynomad/skills/tree/master/token-receipt. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Token Receipt?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Token Receipt?

As many as you like. As long as a model supports skills, you can use Token Receipt with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Token Receipt AI skill free?

Yes. It is published on GitHub by crazynomad under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇