[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-2613":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":15,"starSnapshotCount":15,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},2613,"token-receipt","Hchen1218\u002Ftoken-receipt","Hchen1218","Turn AI token usage into a receipt with a punchline.","",null,"Python",112,11,61,0,3,4,25,9,3.24,false,"main",true,[],"2026-06-12 02:00:42","\u003Cdiv align=\"center\">\n  \u003Cp>\n    \u003Ca href=\".\u002FREADME.md\">English\u003C\u002Fa> |\n    \u003Ca href=\".\u002FREADME.zh-CN.md\">简体中文\u003C\u002Fa>\n  \u003C\u002Fp>\n  \u003Ch1>token-receipt\u003C\u002Fh1>\n  \u003Cp>\u003Cstrong>Turn AI token usage into a receipt with a punchline.\u003C\u002Fstrong>\u003C\u002Fp>\n  \u003Cp>\n    \u003Ccode>ASCII-native\u003C\u002Fcode>\n    \u003Ccode>pricing-aware\u003C\u002Fcode>\n    \u003Ccode>software-aware\u003C\u002Fcode>\n    \u003Ccode>Claude Code\u003C\u002Fcode>\n    \u003Ccode>Codex\u003C\u002Fcode>\n    \u003Ccode>Trae\u003C\u002Fcode>\n    \u003Ccode>Kimi Code\u003C\u002Fcode>\n    \u003Ccode>OpenCode\u003C\u002Fcode>\n  \u003C\u002Fp>\n  \u003Cp>\n    No dashboard. No spreadsheet. No spiritual coping mechanism.\n    \u003Cbr \u002F>\n    Just a bill that shows up before your denial does.\n  \u003C\u002Fp>\n\u003C\u002Fdiv>\n\n## Why this exists\n\nMost token tools explain usage.\n\n`token-receipt` itemizes the damage.\n\nIt turns invisible AI spend into a thermal-paper artifact you can paste into chat, screenshot instantly, and post with a straight face.\n\nThree rules run the whole project:\n\n- `Visual first`\n  The output should look like checkout, not admin UI.\n- `Data honest`\n  Real local logs first. Official pricing second. Unknowns stay unknown.\n- `Artifact over analytics`\n  If it is not screenshot-worthy, it is not finished.\n\n---\n\n## Preview\n\n```text\n                    ▐▛███▜▌\n                   ▝▜█████▛▘\n                     ▘▘ ▝▝\n                  CLAUDE CODE\n\n        THANK YOU FOR CODING WITH Claude\n      RECEIPT #: CC_20260427_151928_7CE382\n           DATE: 2026-04-27 15:19:28\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\nPROVIDER                               ANTHROPIC\nMODEL                          claude-sonnet-4.5\nCONTEXT USED                              12,487\n────────────────────────────────────────────────\nITEM                                      TOKENS\n────────────────────────────────────────────────\nInput Tokens                              12,487\nOutput Tokens                              3,215\nCache Read Tokens                          8,742\nReasoning Tokens                             128\nCache Write Tokens                         1,024\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\nTOTAL                              15,702 TOKENS\n────────────────────────────────────────────────\nUSD ESTIMATE                           $0.062851\nPRICE                          claude-sonnet-4.5\nPRICE DATE                            2026-04-25\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n    THE LOGO LOOKS CALM. THE BILL DOES NOT.\n\n        ||| ||||| || ||| | | || |||  | |\n           CC_20260427_151928_7CE382\n```\n\n### The footer is the feature\n\nThe footer is not decoration.\nIt is the coup de grace.\n\nThis project is built around the idea that the last line on the receipt should feel like the model watched you spend context on one more revision and decided to leave a note.\n\nThat now splits into two modes:\n\n- the default receipt footer stays cold and mildly hostile\n- the HTML tip flow can switch the receipt into a different closing voice, where the footer gets more grateful, more performative, and much more aware that you just added money on top\n- in tip mode, English footers no longer keep starting from the product name, and Chinese footers now actually react to tone and bill weight instead of pretending to\n\nExamples:\n\n- `THE LOGO LOOKS CALM. THE BILL DOES NOT.`\n- `REASONING WAS BILLED SEPARATELY.`\n- `THE LAST REVISION WAS NOT THE LAST.`\n- `画面稳了，预算死了。`\n- `最后一版这个词，本来就不诚实。`\n\nIf the user adds a tip in HTML, the footer is rewritten instead of extended.\nIt stops acting like a dry bill and starts acting like a register that knows you tipped.\n\nIf the receipt looks good but the footer has no sting, the job is not done.\n\n---\n\n## Install\n\nRecommended: install it with the Skills CLI.\n\n```bash\nnpx skills add https:\u002F\u002Fgithub.com\u002FHchen1218\u002Ftoken-receipt -g -y\n```\n\nIf you only want it in a specific host, install it there:\n\n```bash\nnpx skills add https:\u002F\u002Fgithub.com\u002FHchen1218\u002Ftoken-receipt -a codex -y\nnpx skills add https:\u002F\u002Fgithub.com\u002FHchen1218\u002Ftoken-receipt -a claude-code -y\nnpx skills add https:\u002F\u002Fgithub.com\u002FHchen1218\u002Ftoken-receipt -a opencode -y\n```\n\n---\n\n## How to trigger it\n\n### 1. Trigger it inside chat\n\nIf you installed this repo as a skill, the normal path is not “open terminal and figure it out.”\n\nThe normal path is: say what you want in the chat box of the software you are already using.\n\nStrong trigger phrases:\n\n- `token receipt`\n- `token bill`\n- `usage receipt`\n- `token 小票`\n- `对话发票`\n- `AI 用量账单`\n- `把这次对话打成小票`\n- `看看这轮 token 消耗`\n- `查看本次对话 Token 消耗`\n\nYou can also be explicit about language:\n\n- `token receipt in English`\n- `中文版 token 小票`\n\n### 2. Let Claude Code do it automatically\n\nClaude Code can auto-print a receipt on `SessionEnd`.\n\nInstall the hook:\n\n```bash\npython3 scripts\u002Finstall_claude_auto_trigger.py\n```\n\nAfter that, ending a Claude Code session will auto-fire the receipt without an extra chat message.\n\n---\n\n## Software support\n\nIt bills the software you are actually using.\nIt does not quietly switch to another app's newer logs.\n\n| Software | Status | Data source | Notes |\n| --- | --- | --- | --- |\n| Codex | `supported now` | Codex JSONL sessions | Reads local session logs directly |\n| Claude Code | `supported now` | Claude usage-data + projects | Uses usage logs for tokens and transcripts for model lookup |\n| Trae | `manual mode now` | Trae app storage | Auto transcript import is not shipped yet |\n| Kimi Code | `supported now` | kimi-cli `context.jsonl` (`~\u002F.kimi\u002Fsessions\u002F` or `KIMI_SHARE_DIR`) | Reads cumulative `_usage.token_count`; USD estimate omitted (no API split); use manual flags if you need priced input\u002Foutput |\n| OpenCode | `supported now` | `opencode*.db` SQLite under `~\u002F.local\u002Fshare\u002Fopencode\u002F` (see `OPENCODE_DATA_DIR`, `XDG_DATA_HOME`) | Reads `session`\u002F`message` rows (`message.data` JSON: `tokens`, `modelID`); supports `--scope latest-turn` \\| `session` |\n\nNotes:\n\n- Some Trae builds use `Trae CN` \u002F `.trae-cn` instead of `Trae`.\n- Inside Codex, the runtime can be detected and `token-receipt` reads Codex logs.\n- Inside Claude Code's SessionEnd hook, `token-receipt` reads Claude Code usage logs.\n- If you run the script from a plain shell and more than one local software log exists, pass `--agent-tool` explicitly. Cross-software guessing is intentionally disabled.\n- In current releases, `--agent-tool trae` is honest: it tells you to use manual mode instead of pretending Trae has clean JSONL session logs.\n\n---\n\n## Model coverage\n\nThere are two layers of support:\n\n1. `Receipt rendering`\n   Any model name can be rendered in manual mode.\n2. `Price estimation`\n   Cost only shows up when the model exists in `references\u002Fpricing.json`.\n\nCurrent mapped model families include:\n\n- `OpenAI`\n  GPT-5 family, Codex family, GPT-4.1, GPT-4o, `o3`, `o4-mini`\n- `Anthropic`\n  Claude Opus, Sonnet, and Haiku families\n- `Google`\n  Gemini 2.x and 3.x families\n- `Moonshot`\n  Kimi K2 family\n- `DeepSeek`\n  DeepSeek V4 family\n- `Alibaba`\n  Qwen family\n- `Zhipu`\n  GLM family\n- `Xiaomi`\n  MiMo family\n- `MiniMax`\n  M2 family\n\nIf your model is not mapped yet, the receipt still renders.\nThe price just refuses to roleplay.\n\n---\n\n## What it actually reads\n\nCurrent receipts intentionally stay conservative about what they print:\n\n- `Input Tokens`\n- `Output Tokens`\n- `Cache Read Tokens`\n- `TOTAL`\n- `Reasoning Tokens` when actually available\n- `Cache Write Tokens` when actually available\n\nThat policy is deliberate.\n\nBetter to omit a field than lie with confidence.\n\n---\n\n## Printable HTML\n\nThe main artifact is still the monospace receipt inside chat.\n\nHTML is the secondary route: useful when you want browser print preview, real printer output, or a cleaner handoff to thermal-printer workflows.\n\n```bash\npython3 scripts\u002Ftoken_receipt.py --agent-tool claude-code --output html --write .\u002Freceipt.html\n```\n\nOpen `receipt.html` in a browser, hit `Print receipt`, and let the browser talk to the printer.\n\nIf your host can render local file links, the cleaner flow is dual export:\n\n```bash\npython3 scripts\u002Ftoken_receipt.py --agent-tool claude-code --write \u002Ftmp\u002Ftoken-receipt.txt --write-html \u002Ftmp\u002Ftoken-receipt.html\n```\n\nThat keeps the monospace receipt in chat while also giving you a clickable printable HTML file.\n\nThe new default path is the unified chat-reply mode:\n\n```bash\npython3 scripts\u002Ftoken_receipt.py --agent-tool codex --chat-reply\npython3 scripts\u002Ftoken_receipt.py --agent-tool claude-code --chat-reply\npython3 scripts\u002Ftoken_receipt.py --agent-tool kimi-code --chat-reply\npython3 scripts\u002Ftoken_receipt.py --agent-tool opencode --chat-reply\n```\n\nThat prints the full receipt as the main chat artifact, automatically saves `\u002Ftmp\u002Ftoken-receipt.html`, and returns the local `[Printable HTML](\u002Ftmp\u002Ftoken-receipt.html)` link in the same reply.\n\nThe current HTML path is tuned for the same three things people actually notice:\n\n- a gray preview stage with a white receipt body, so the receipt edges stay visible on screen\n- a pure white print result, so the browser preview does not lie about the final paper\n- software-aware logos in HTML too: Claude Code uses a dedicated vector mark, while Codex and Trae use embedded image assets\n\nAnd now it behaves more like a live checkout surface instead of a dead export:\n\n- an `EN \u002F 中文` toggle outside the receipt, so one printable page can flip languages without regenerating the file\n- an external `Add tip` panel, so the controls stay off the paper until you explicitly opt in\n- the tip panel only appears when the receipt has a real priced subtotal; unmapped receipts do not fake a gratuity flow\n- `SUBTOTAL \u002F TIP \u002F GRAND TOTAL` only show up inside the receipt after a tip is selected\n- tip mode replaces the original footer entirely; it does not bolt a canned thank-you tail onto the end\n- tipped receipts switch into a different checkout voice: less cold, more grateful, more willing to flatter you for the extra money\n- language switching now updates the page state as well, so the browser preview is not only visually switched but also semantically in the right language\n\n---\n\n## Claude Code auto-trigger\n\nInstall:\n\n```bash\npython3 scripts\u002Finstall_claude_auto_trigger.py\n```\n\nUninstall:\n\n```bash\npython3 scripts\u002Funinstall_claude_auto_trigger.py\n```\n\nThis wires `token-receipt` into Claude Code's `SessionEnd` hook.\n\nThe conversation ends.\nThe receipt arrives.\nThe denial window closes.\n\n---\n\n## Changelog\n\nSee [CHANGELOG.md](\u002FUsers\u002Fcecilialiu\u002FDocuments\u002FCodex\u002Ftoken-receipt\u002FCHANGELOG.md) for the running update log.\n\n---\n\n## Roadmap\n\n- `Shipped now`\n  Printable HTML export with language switching, external tip controls, and a live checkout-style print surface.\n- `Next up`\n  Printer-first presets for common paper widths and cleaner print defaults.\n- `Also planned`\n  Trae automatic session import once its local storage shape is stable enough to trust.\n\n---\n\n## One-line thesis\n\nEvery prompt leaves a tab.\n\n`token-receipt` just prints it before you can emotionally recover.\n\n---\n\n> Inspired by [chrishutchinson\u002Fclaude-receipts](https:\u002F\u002Fgithub.com\u002Fchrishutchinson\u002Fclaude-receipts).  \n> Same receipt instinct. Different attitude. More software. Meaner footer.\n","token-receipt 是一个将 AI 令牌使用情况转化为收据并附带一句妙语的工具。它采用 Python 编写，支持多种 AI 模型（如 Claude Code、Codex 等），能够生成 ASCII 风格的收据，直观展示令牌消耗与成本估算。项目强调视觉呈现优先，确保数据真实无误，并且注重最终输出的可分享性。适用于需要快速查看和分享 AI 资源使用情况的开发者或团队，尤其是那些希望以一种轻松幽默的方式了解自己 AI 开销的人士。",2,"2026-06-11 02:50:30","CREATED_QUERY"]