Claude builds a per-client AI usage billing meter
Henry Alfano used Claude to build a client billing meter that separates locally measured Claude Code usage from estimated cloud allocation, reconciles totals and prepares invoices for approval.
Suggested prompt
Suggested prompt written by Agents In Use, not the source author. Replace bracketed inputs and review tool permissions first.
Build a client billing meter from my local session logs and document-workflow artifacts. Separate measured usage from estimated cloud allocation, show independent batch-count and byte-volume derivations, reconcile totals and prepare invoice drafts for my approval.
Reach people exploring AI agents
See placements →Evidence at a glance
Sourced account- Source author
- Henry Alfano
- Original account
- Read the source ↗
- Published
- Source link checked
- Reported result
- Henry Alfano used Claude to build a client billing meter that separates locally measured Claude Code usage from estimated cloud allocation, reconciles totals and prepares invoices for approval.
- Human involvement
- Alfano approves invoices before sending. Cloud allocation is a disclosed estimate based on work artifacts, not measured cloud token usage or an externally audited client bill.
A linked account supports attribution. It does not mean we independently reproduced its result.
Report an issue with this case
Open correction emailOpens your email app with the case link included. Nothing is sent automatically.
How the agent did it
- Price local Claude Code logs with ccusage and attribute repository folders.
- Exclude other command-line tools from the measured Claude usage pool.
- Allocate remaining cloud overage by both batch count and rewritten bytes.
Henry Alfano passes AI costs through to consulting clients. After an unexpectedly large extra-usage bill, he used Claude to design and code a billing meter that distinguishes two different levels of evidence rather than treating the vendor total as a detailed usage record.
Local Claude Code session logs form the measured pool. The ccusage tool prices those sessions at list rates, while repository folders identify clients. Other command-line tools, including Codex, are excluded. This produces client-attributable local records; it does not explain every cloud interaction.
The remaining overage becomes a separate estimated cloud pool. Alfano’s Cowork document workflows leave directive files, snapshots and reports. A Python script counts executed document batches and rewritten bytes per project. It calculates allocation independently using each measure, bills their midpoint and displays both results as a bracket. Columns reconcile to the dashboard total to the penny. Another script adds AWS charges from the separate account used for each client.
Shell aliases produce the reports, and a Claude skill with a monthly scheduled task turns them into draft invoices. Alfano approves invoices before sending. He reports a five-minute month-end process, without an independent time study.
The transferable distinction is measured local receipts versus a disclosed allocation estimate. Exact reconciliation does not make cloud allocation measured token usage, and the account does not demonstrate agreement from clients or an external billing audit.
Prompt
Suggested prompt (written by Agents In Use, not the author's)
Source: Blog · Henry Alfano
Frequently asked questions
Which usage has local evidence?
Claude Code sessions are priced with ccusage and attributed by repository folder; other command-line tools are excluded.
How is cloud usage allocated?
The remaining pool is split separately by executed batch counts and rewritten bytes; the midpoint is billed and both derivations are shown.
Does reconciliation prove cloud attribution?
No. Matching the total to the penny checks arithmetic, while the project-level cloud split remains an explicitly disclosed estimate.
More details
Remaining steps
- Show the midpoint and bracket and reconcile to the dashboard total.
- Add per-client AWS charges and approve the prepared invoice draft.
About this account
Claude builds the meter; a skill and monthly task consume its reports to prepare draft invoices. Python counters and cost-report scripts supply the underlying calculations.
Firsthand account by Henry Alfano; original publication date verified against Primary post JSON-LD datePublished 2026-09-23T02:00:43.932Z and time datetime 2026-09-23T02:00:43.932174Z. Outcomes are the author’s reports, not independently reproduced. Suggested prompt written by Agents In Use; not the author’s original prompt.
Credit: Henry Alfano
Source published
Added to Agents In Use
Source checked
Tools and topics
Claude Code · ccusage · Python · Cowork work artifacts · AWS Cost Explorer
Client usage reconciliation · Measured versus estimated cost · Invoice approval
Editorial completeness: 100/100. Measures documented fields, not agent performance or verified outcomes.