claude-receipts

Bring receipts from your Claude Code sessions

626
Stars
40
Forks
TypeScript
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/chrishutchinson/claude-receipts

快速入门

使用 claude-receipts 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

Claude Receipts

A note from the author:

This has been one of my favourite creative side projects yet (and just in time for Opus 4.6).

I picked up a second hand receipt printer and hooked it up to Claude Code's SessionEnd hook. With some ccusage wrangling, a receipt is printed, showing a breakdown of that session's spend by model, along with token counts.

It's dumb, the receipts are beautiful, and I love it so much.

I hope you enjoy it too.

A photos of an example printed receipt

Full thermal receipt

A photos of an example printed receipt

HTML receipt

A screenshot of an example receipt

Installation

npx claude-receipts setup

This will:

  • Configure the SessionEnd hook in your global ~/.claude/settings.json

  • Create a config file at ~/.claude-receipts.config.json

From now on, every time you exit a Claude Code session, your receipt will be generated and opened in your browser.

Manual generation

Generate a receipt for your most recent session:

npx claude-receipts generate

Commands

generate

Generate a receipt for a Claude Code session.

# Generate for most recent session
npx claude-receipts generate

# Generate HTML (saved to ~/.claude-receipts/projects/)
npx claude-receipts generate --output html

# Print to thermal printer
npx claude-receipts generate --output printer --printer usb

# Multiple outputs (HTML + printer)
npx claude-receipts generate --output html,printer

# Specific session by UUID prefix
npx claude-receipts generate --session 9356d5e2

# Override location
npx claude-receipts generate --location "Paris, France"

Options:

  • -s, --session <id> - Generate for a specific session ID or UUID prefix

  • -o, --output <format> - Output format: "html", "console", or "printer" (supports multiple, comma-separated)

  • -l, --location <text> - Override location detection

  • -p, --printer <name> - Printer interface (e.g., "usb", "tcp://192.168.1.100")

Output Formats:

  • html - Beautiful styled receipt saved to ~/.claude-receipts/projects/

  • console - ASCII art display in terminal

  • printer - Send to thermal printer (requires Epson TM-T88V or compatible)

setup

Configure automatic receipt generation.

# Run interactive setup
npx claude-receipts setup

# Uninstall the hook
npx claude-receipts setup --uninstall

This modifies ~/.claude/settings.json to add a SessionEnd hook that automatically generates receipts.

config

Manage your receipt configuration.

# Show current configuration
npx claude-receipts config --show

# Set a configuration value
npx claude-receipts config --set location="Kuala Lumpur, Malaysia"
npx claude-receipts config --set timezone="Asia/Kuala_Lumpur"
npx claude-receipts config --set printer=usb

# Reset to defaults
npx claude-receipts config --reset

Available settings:

  • location - Default location (string)

  • timezone - Timezone for dates (string, e.g., "Asia/Macau")

  • printer - Default printer interface (string, e.g., "usb" or "tcp://192.168.1.100")

Configuration

Configuration is stored at ~/.claude-receipts.config.json.

Default configuration:

{
  "version": "1.0.0"
}

Optional settings:

  • location - Custom location string (otherwise auto-detected)

  • timezone - Custom timezone for date formatting

  • printer - Default printer interface for thermal printing

Location Detection

Location is determined in this order:

  • --location flag (if provided)

  • Config file location setting

  • Auto-detection via IP geolocation (offline, using geoip-lite)

  • Fallback: "The Cloud"

How It Works

  • SessionEnd Hook: When you exit Claude Code, it calls npx claude-receipts generate --output html via stdin with the session ID

  • Data Collection: The package calls ccusage session --id <session-id> to get accurate session token/cost data

  • Transcript Parsing: Reads the session transcript JSONL to extract metadata (session name, timestamps, message count)

HTML output

  • Receipt Generation: If --output html is specified, generates a styled HTML receipt with token breakdowns by model

  • Output: Saves HTML to ~/.claude-receipts/projects/[session-name].html and/or prints to thermal printer

  • Auto-open: Opens the HTML receipt in your default browser automatically (hook mode only)

Printer output

  • Thermal Printing: If --output printer is specified, sends the receipt to a thermal receipt printer

Requirements

  • Node.js >= 22.0.0

  • Claude Code (for automatic generation)

Thermal Printing

claude-receipts supports printing to Epson TM-T88V thermal printers (and compatible models) via:

  • USB: Auto-detect via --printer usb (or config --set printer=usb)

  • Network: Direct TCP via --printer tcp://192.168.1.100

[!WARNING] Your mileage with printing may vary. I have tested with an Epson TM-T88V, printing from macOS and it works well, but other models may have different capabilities or require adjustments to the code. I am more than happy to accept PRs to improve printer compatibility.

The receipt includes:

  • Claude ASCII logo

  • Session details and location

  • Token breakdown by model (input, output, cache read/write)

  • Total cost

  • QR code linking to the GitHub repo

Troubleshooting

"Cannot determine transcript path"

This means you're trying to manually generate a receipt but the most recent session doesn't have a valid project path. Solutions:

  • Run from within a SessionEnd hook (use setup command)

  • Work in a Claude Code session and let it auto-generate

"No session data found"

ccusage couldn't find any sessions. Make sure you've used Claude Code recently and that ccusage is working:

npx ccusage session --json

Hook not triggering

Check that the hook is installed:

cat ~/.claude/settings.json

You should see a SessionEnd hook pointing to claude-receipts.

Session shows wrong cost or is missing

Very short sessions (e.g., just "hello world" + immediate exit) may not appear in ccusage yet. The hook will exit silently rather than printing a wrong receipt. For sessions that exist, the package now uses ccusage session --id to fetch accurate totals rather than sub-session slices.

Printer not found

If using --printer usb, ensure:

  • Printer is connected via USB

  • Printer is an Epson TM-T88V or compatible ESC/POS model

  • On Linux, you may need permission to access USB devices (/dev/usb/lp*)

For network printers, use --printer tcp://<ip-address> with port 9100 (default ESC/POS port).

Contributing

Roadmap

  • HTML receipts with auto-open in browser

  • Console ASCII art mode

  • Real thermal receipt printing (Epson TM-T88V)

  • Accurate session cost tracking (via ccusage --id)

  • Session matching by UUID or prefix

  • Image export (PNG/JPEG)

  • Plugin for Opencode (opencode issue)

License

MIT

常见问题

What is claude-receipts?

claude-receipts is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by chrishutchinson. Bring receipts from your Claude Code sessions. It has 626 GitHub stars.

Is claude-receipts safe to use?

claude-receipts returned warnings in SkillsLLM's automated security scan. It has no critical vulnerabilities, but review the flagged issues in the Security Report section before adding it to your workflow.

How do I install claude-receipts?

Clone the repository with "git clone https://github.com/chrishutchinson/claude-receipts" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is claude-receipts written in?

claude-receipts is primarily written in TypeScript. It is open-source under chrishutchinson on GitHub, so you can review or fork the full source.

Are there alternatives to claude-receipts?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh claude-receipts against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情