token-receipt
Skill27 starsChanged 8 months agoMITView on GitHub
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".
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- ameyalambat128/token-receipttheir own version, first seen Jun 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- ameyalambat128/token-receipt★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository21 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- backlog-managerSkill
- disk-cleanerSkill
- doc-mindmapSkill
- file-masterSkill
- file-organizerSkill
- flow-mediaSkill
- generate-transcriptSkill
- jordan-peterson-perspectiveSkill
- loop-or-notSkill
- pdf-to-imagesSkill
- podcast-downloaderSkill
- ppt-classifySkill
- ppt-narrative-reviewSkill
- ppt-research-setupSkill
- srt-title-generatorSkill
- ttsSkill
- twitter-downloaderSkill
- visual-deckSkill
- visual-slidesSkill
- youtube-downloaderSkill
The file
Files
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)
ccusageCLI 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
# 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 browserThe script prints the output path on success.
Options
| Flag | Default | Meaning |
--period | month | month or week billing cycle |
--which | latest | latest, or YYYY-MM (month) / YYYY-MM-DD week-start |
--agent | all | restrict to one ccusage agent |
--customer | Burn Wang | name printed on the receipt (or RECEIPT_CUSTOMER env) |
--out | ~/Desktop/token-receipt-<period>.png | output path |
--scale | 2 | device scale factor (2 = retina; 3 = bigger) |
--html-only | off | emit HTML instead of PNG (for design tweaks) |
How it works
- Pulls JSON from
ccusage <agent?> <monthly|weekly>and, for the per-day chart,ccusage dailyfiltered to the chosen month/week window. - Shapes it into receipt sections and renders a self-contained HTML (monospace, dotted leader lines, ASCII train, CSS barcode, torn edges).
- Screenshots with headless Chrome at retina scale, then
magick -trimcrops 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 inbuild_html— paper color, accent (--accent, currently green-train teal#1f6f5c), fonts, spacing. Iterate fast with--html-only, then re-render to PNG.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

