Skip to main content
Glama
README.md
# PromptBill

[![CI](https://github.com/danielneuron/promptbill/actions/workflows/ci.yml/badge.svg)](https://github.com/danielneuron/promptbill/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)
[![Live Preview](https://img.shields.io/badge/Live%20Calculator-GitHub%20Pages-175cd3)](https://danielneuron.github.io/promptbill/)
[![PromptBill MCP server on Glama](https://glama.ai/mcp/servers/danielneuron/promptbill/badges/score.svg)](https://glama.ai/mcp/servers/danielneuron/promptbill)

**Stop eating your AI coding bill on client projects.**

PromptBill is a **100% local-first, zero-dependency, open-core** CLI & web studio that scans your local **Claude Code**, **OpenAI Codex CLI**, **Gemini CLI**, **Cline**, **Roo Code**, and **Anthropic / OpenAI / OpenRouter / Cursor CSV** usage logs, attributes every token to its **Git repository**, and turns it into **client-ready PDF & Xero/QuickBooks invoices** in 10 seconds.

![PromptBill CLI & Client PDF Invoice Preview](./assets/preview.svg)

- **Zero telemetry. Zero cloud uploads.** Your prompts, code, and usage logs never leave your machine.
- **Zero runtime dependencies.** No Puppeteer, no Chromium download — installs & runs instantly on Linux, macOS, and Windows (Node.js `>= 18`).

---

## Try It in 5 Seconds (Demo Mode)

```bash
npx github:danielneuron/promptbill scan --demo
npx github:danielneuron/promptbill ui --demo
```

Or scan your real local Claude Code (`~/.claude/projects`), Codex CLI (`~/.codex/sessions`), Gemini CLI (`~/.gemini/tmp`), and Cline / Roo Code (`globalStorage/*/tasks`) logs right away:

```bash
npx github:danielneuron/promptbill scan --days 30
npx github:danielneuron/promptbill ui
```

---

## Key Features

### Free Open-Source Core (MIT)
- **Local Multi-Tool Parsers**: Reads Claude Code JSONL (with streaming `requestId` deduplication so tokens are never double-counted), OpenAI Codex CLI JSONL (with delta tracking), Gemini CLI JSON (`~/.gemini/tmp`), and **Cline / Roo Code** task logs (`ui_messages.json` + workspace CWD extraction across VS Code, Cursor, Windsurf, and VSCodium).
- **API CSV Importer**: Import usage exports from Anthropic Console, OpenAI, OpenRouter, or Cursor (`promptbill import usage.csv --project my-client-repo`).
- **Automatic Git Repo Attribution**: Maps working directories to enclosing Git repository names via `.git/config`.
- **Up-to-Date Pricing + Custom Overrides**: Built-in 2026 pricing for Claude 4.x/3.x, GPT-5/Codex/o-series, Gemini 2.5/3, and DeepSeek — override anytime via `~/.promptbill/pricing.json`.
- **Interactive Local Studio UI**: Inspect repo spend, toggle billable repos, configure labor hours + pass-through markup + GST/VAT, and preview/download PDF invoices.
- **Standard Repo Summary CSV & JSON Export**.

### PromptBill Pro ($19 One-Time) & Agency Team ($49 One-Time) via Polar.sh
> Pays for itself on your very first client invoice. No subscriptions, lifetime v1.x updates, 14-day refund guarantee.

- **Unwatermarked, Branded Client-Ready PDF Invoices** (native PDF 1.4 generator).
- **Page 2 Sanitized AI Compute Audit Appendix**: Date, repo, model, token totals, USD cost & optional sanitized git commit titles — proving AI spend to clients without leaking raw code or prompts.
- **One-Click Xero & QuickBooks Online Invoice CSV Exports**.
- **Unlimited Multi-Client & Multi-Repo Profiles**.
- **Agency Multi-Developer Rollup (`promptbill merge`)**: Merge multiple engineers' `promptbill scan --json` exports into one deduplicated client invoice (up to 25 machines with `PromptBill Agency`).

Unlock Pro, Agency, or the Best-Value Bundle ([preview a real 2-page Sample Pro PDF](https://danielneuron.github.io/promptbill/sample-invoice-pro.pdf)):
- **[Get PromptBill Pro — $19 one-time (Solo, up to 3 machines)](https://buy.polar.sh/polar_cl_nt4ZjAvyc4GPO6MTtMLon47i8uMXyr64IF2nM0Omm4A)**
- **[Get Dev CLI & MCP Pro Bundle — $39 one-time (Save $9: PromptBill Pro + AuditDeck Pro)](https://buy.polar.sh/polar_cl_UVB0LzPKWpKwgE16tHFYvTlwOpsRzQN6IyYGT4Y87zn)**
- **[Get PromptBill Agency — $49 one-time (Team, up to 25 machines)](https://buy.polar.sh/polar_cl_lajb5iAwoAUYcQRH7uULbztm29fBT2aDGYadh1HmFAn)**

```bash
promptbill activate PBILL-XXXX-XXXX-XXXX   # or PBAGY-XXXX-XXXX-XXXX for Agency
```

### VS Code / Cursor / Windsurf / VSCodium Extension
Download the prebuilt zero-dependency `.vsix` (47 KB) from [GitHub Releases](https://github.com/danielneuron/promptbill/releases/latest) to see live 30-day AI spend per workspace repo in your status bar & sidebar:
```bash
code --install-extension promptbill-1.4.0.vsix   # or cursor --install-extension ...
```

---

## MCP Server (Claude Code, Cursor, Windsurf, Cline & Claude Desktop)

Run PromptBill as a **zero-dependency local stdio MCP server** so you can ask your coding agent directly:
> *"How much AI compute did we spend on `acme-payments-api` this month? Export a client PDF invoice with 15% markup and 10% GST."*

Add to your MCP client config (`~/.claude.json`, `.mcp.json`, Cursor MCP settings, or `claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "promptbill": {
      "command": "npx",
      "args": ["-y", "github:danielneuron/promptbill", "mcp"]
    }
  }
}
```

**Exposed MCP Tools:**
- `promptbill_scan_usage` — Scan local Claude Code, Codex CLI, Gemini CLI, Cline, Roo Code & imported CSVs grouped by Git repo.
- `promptbill_repo_spend` — Detailed spend, models & pass-through billing estimate for a specific Git repository.
- `promptbill_generate_invoice_pdf` — Generate a native PDF 1.4 client invoice on disk (with optional labor, markup %, GST/VAT & Pro audit appendix).
- `promptbill_export_csv` — Export Repo Summary CSV (Free) or Xero / QuickBooks Online invoice CSV (Pro/Agency).

---

## CLI Reference

```bash
# Scan local AI coding usage for the last 30 days
promptbill scan --days 30

# Launch interactive local studio UI (default http://127.0.0.1:4319)
promptbill ui

# Generate a client PDF invoice (AI pass-through + optional hourly engineering)
promptbill invoice \
  --client "Acme FinTech Pty Ltd" \
  --repos "acme-payments-api,acme-web-portal" \
  --hours 12 --rate 135 --markup 15 --tax 10 --currency USD \
  --audit --out acme-nov-2026.pdf

# Import OpenRouter / Anthropic / OpenAI / Cursor CSV
promptbill import openrouter-nov.csv --project acme-payments-api

# Export repo summary (Free) or Xero / QuickBooks invoice CSV (Pro)
promptbill export --format csv --out repos.csv
promptbill export --format xero --client "Acme FinTech" --repos "acme-payments-api" --out xero.csv
```

---

## Privacy & Security

PromptBill reads local JSONL/CSV files strictly on your machine. The **only** outbound network request PromptBill ever makes is when you explicitly run `promptbill activate`, `promptbill status`, or `promptbill deactivate`, which communicates solely with Polar.sh's public Customer Portal License Key API (`/v1/customer-portal/license-keys/*`).

## Related Open-Source Tools by DanielNeuron
- **[AuditDeck](https://github.com/danielneuron/auditdeck)** — Local-first CLI & MCP server that audits any Git repository (secrets, lockfiles, CI/tests, bus-factor, docs) and generates boardroom-ready Client Codebase Audit & Project Handover PDFs.

## License

MIT — see [LICENSE](./LICENSE).

TDQS

A3.5/5.0

Scored across 4 tools

Disambiguation4/5

Each tool has a distinct output shape: aggregate scan, single-repo detail, PDF invoice generation, and CSV export. The main risk is confusion between promptbill_scan_usage and promptbill_repo_spend, since both report tokens, models, and USD spend; only the descriptions clarify that one is cross-repo and the other repo-scoped.

Naming Consistency4/5

All tools use a consistent snake_case pattern with a uniform promptbill_ prefix, which makes the family obvious. promptbill_repo_spend breaks the verb_noun convention (it reads as noun_verb/noun_noun) while the others start with an action verb, a minor deviation.

Tool Count4/5

Four tools map cleanly onto a narrow pipeline: scan usage, inspect one repo, produce an invoice, and export data. The set is small but each tool earns its place; a couple more (e.g. time-range filtering or invoice history) could be justified but are not required.

Completeness4/5

The surface covers the core lifecycle: discover local usage, drill into a repo, generate a client invoice, and export CSV for accounting systems. Gaps are minor — no tool for managing or re-listing previously generated invoices, and no explicit time-range/reporting configuration tool, though parameters may cover this.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues