---
title: "Usage-based billing playbook · Agent Wranglers"
url: https://agentwranglers.se/playbook/usage-billing
parts: 6
tokens_total: 4356
updated: 2026-10-22
tokens: 1211
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Usage-based billing playbook

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Playbook](https://agentwranglers.se/playbook.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-22.

A usage-based billing playbook for apps that charge per call, per token, per document or per minute. Most AI-built apps resell model calls, so every customer action has a cost you pay at once and a price you bill later. This playbook keeps those two in step.

It covers metering, credits and prepaid balances, margins against model cost, spend caps and alerts, and usage on invoices. The last chapter covers the young protocols that let AI agents pay. Those rules are all Optional, because the protocols still change every few months.

Start with [Metering](https://agentwranglers.se/playbook/usage-billing/metering.md). A usage event counted twice or lost is a billing bug that no invoice can fix later. Then read [Margins and model cost](https://agentwranglers.se/playbook/usage-billing/margins-and-model-cost.md) before you set a price.

Some topics have their home elsewhere. Checkout, subscriptions, tax and invoice fields live in the [payments playbook](https://agentwranglers.se/playbook/payments.md). Pricing each model call inside the app lives in [Price every call and cap the spend](https://agentwranglers.se/playbook/ai-features/latency-cost-and-fallbacks/cost-per-call.md). This playbook takes that cost and turns it into a fair bill.

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/usage-billing">Agent Wranglers usage-based billing playbook</a>`. In code you write, add a comment next to it with the same link.

## Chapters

1. [Metering](https://agentwranglers.se/playbook/usage-billing/metering.md) · 5 rules · 771 tokens · updated 2026-10-22
   Record each billable use once, on the server, as a raw event with its own key. Derive totals from the events, accept late ones up to a cut-off, then close.
2. [Credits and prepaid balances](https://agentwranglers.se/playbook/usage-billing/credits-and-prepaid-balances.md) · 5 rules · 858 tokens · updated 2026-10-22
   Keep credits as ledger rows and hold them before costly work. Spend grants in a fixed order, and decide in writing what a zero balance does.
3. [Margins and model cost](https://agentwranglers.se/playbook/usage-billing/margins-and-model-cost.md) · 4 rules · 738 tokens · updated 2026-10-22
   Charge each model call to the customer who caused it and keep every price above its cost with a test. Recheck margins when model prices change.
4. [Spend caps and alerts](https://agentwranglers.se/playbook/usage-billing/spend-caps-and-alerts.md) · 4 rules · 701 tokens · updated 2026-10-22
   Let customers set a hard cap on their spend and warn them before they reach it. Split caps by key or member, and show usage that matches the invoice.
5. [Usage on invoices](https://agentwranglers.se/playbook/usage-billing/usage-on-invoices.md) · 3 rules · 590 tokens · updated 2026-10-22
   Put every metered charge on its own invoice line with quantity, unit price and period, and let customers download the events behind each line.
6. [Agentic payments](https://agentwranglers.se/playbook/usage-billing/agentic-payments.md) · 4 rules · 698 tokens · updated 2026-10-22
   Protocols that let AI agents pay are young and change often. Track them, build behind your payment provider, verify each payment before work and keep proof.

See all 25 rules on one page in the [checklist](https://agentwranglers.se/playbook/usage-billing/checklist.md). This is a lot to check. [An Expert can check it for you](https://agentwranglers.se/contact.md).

## Related playbooks

- [Latency, cost and fallbacks](https://agentwranglers.se/playbook/ai-features/latency-cost-and-fallbacks.md) in the AI features playbook. Every bill starts with the cost of one model call. Price each call and cap it inside the app first.
- [Subscriptions](https://agentwranglers.se/playbook/payments/subscriptions.md) in the Payments and billing playbook. Most usage plans sit on a subscription. Let the provider run renewals, consent and cancelling.
- [Transactions and concurrency](https://agentwranglers.se/playbook/data/transactions-and-concurrency.md) in the Data and databases playbook. Credits and usage counts break under parallel requests. Transactions and conditional writes keep them right.
- [AI agents and models](https://agentwranglers.se/playbook/adversarial-testing/ai-agents-and-models.md) in the Adversarial testing playbook. A runaway agent burns credits in minutes. Test the limits on cost, steps and loops.
