SuperAPI AI Directory

receipt

Posts an itemized AI cost comment (tokens and dollars by model) on every pull request; tracks Claude Code, Cursor, Copilot, Aider, and any OpenAI/Anthropic API. Local ledger, never stores prompts. Open-source (MIT).

Open website

About this tool

Purpose

receipt is used to view the tokens actually consumed by AI coding agents and the corresponding dollar cost, and to display the cost breakdown directly on each pull request (PR), making it easy for teams to understand the AI cost of a change before merging code. It tracks Claude Code, Cursor, Copilot, Aider, Codex, and any tool compatible with the OpenAI or Anthropic API.

Main capabilities

  • PR cost comment: Generates a sticky comment on the PR showing total spend, token count, number of calls, number of retries, a budget consumption progress bar, comparison with the median PR, historical spend trends, and tool call details.
  • Local ledger: Uses an append-only local ledger (.receipt/ledger.jsonl) to record token counts, model names, costs, timestamps, and the git branch or commit, without storing prompts or completions.
  • Multiple capture methods:
    • Via importer:receipt import claude-code reads ~/.claude/projects Claude Code session logs in;receipt import generic usage.json normalizes any JSON/JSONL export file containing prompt_tokens/completion_tokens or input_tokens/output_tokens . The importer deduplicates based on the provider's request ID.
    • Via proxy: The proxy sits between the tool and the provider, forwards requests as-is, reads the usage block from the response, prices it, and writes to the ledger. It supports Anthropic (/v1/messages) and OpenAI (/v1/chat/completions, /v1/responses) formats, including streaming responses. The proxy only records token counts and latency, not request or response bodies.
  • GitHub Action: Through the example examples/github-workflow.yml configuration, the Action reads .receipt/ledger.jsonland automatically publishes or updates the PR comment. It can also be run locally with receipt post to publish the same comment.
  • Budget control: Set a budget cap, and the PR comment displays a progress bar. It shows green within budget, turns yellow above 80%, and shows red with the overspend amount when over budget.
  • Session window tracking: For Claude subscriptions, tracks usage percentages for the 5-hour and weekly rolling windows and converts them into an intuitive description of "how much more can be done." Supports reading provider rate limit headers through the proxy or using receipt calibrate to calibrate the real quota.
  • Status bar integration: Displays a real-time usage meter in the Claude Code status bar, which can be turned off via .receipt/config.json in "usage": false .
  • Optimization suggestions:receipt advice analyzes usage, points out pure waste (such as cache rebuilds, repeated sends on retries, using expensive models for mechanical reads, etc.), ranks by impact, and gives computable dollar savings.
  • Session health:receipt health evaluates the risk of session quality degradation based on signals such as context fill rate, session length, cache reuse, auto-compaction, and loops, and suggests /compact、/clearwhen needed, starting a new session, or /rewind。receipt guard can be used as a Claude Code hook to automate reminders.
  • Dashboard:receipt dashboard provides a local view showing spending by time, model, and branch, as well as the most expensive calls, with no external network requests.
  • Library use: Can be integrated into other tools as a library.

How to use

  • Claude Code users: import session logs directly, with no reconfiguration needed:
    receipt import claude-code
    
  • Other tools: point the tool at the logging proxy.
  • View current branch cost:receipt show.
  • Publish a PR comment: configure the GitHub Action, or run locally receipt post.
  • View status:receipt fuel shows current window usage.
  • Calibrate limits:receipt calibrate(can add --window week Calibrate the weekly window).
  • View help: add to any command --help.

Use cases

  • Teams want to understand the AI coding cost of each PR during the code review stage.
  • Using multiple AI coding tools, needing unified tracking of tokens and costs.
  • Need to break down AI expenses by branch, by author, and by model.
  • Want to identify and reduce token waste without sacrificing code quality.
  • Need to monitor session health to avoid context degradation affecting output quality.

Limitations

  • Prices are based on public list prices (USD per million tokens), accompanied by src/prices.json to indicate the month checked, which users can override; actual contract prices may differ.
  • For models without prices, only tokens are counted and marked as "unpriced"; zero cost is not fabricated.
  • The proxy does not record request and response bodies, and the ledger is not included in git by default (see .gitignore); commit it only when you want CI to read it.
  • Anthropic has not published an exact token budget; receipt provides estimated values based on the plan and marks them as estimates; the real limits can be obtained by having the proxy read rate limit headers or through calibration.
  • Copilot usage must be imported through the generic importer.
  • Built-in providers support Anthropic, OpenAI, and Google Gemini.

License

MIT © Noah. See LICENSE for details.

Other information

  • Project URL:https://github.com/noah-thing/receipt
  • Issues and PRs are welcome; see CONTRIBUTING.md.
  • See the documentation in the repository for the security policy.