Agent Wranglers

Usage-based billing playbook

Rules for apps that charge by use. Metering, credits as a ledger, margins against model cost, spend caps, itemised invoices and agent payment protocols.

  • Required 6
  • Recommended 14
  • Optional 4
  • Avoid 1

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. A usage event counted twice or lost is a billing bug that no invoice can fix later. Then read Margins and model cost before you set a price.

Some topics have their home elsewhere. Checkout, subscriptions, tax and invoice fields live in the payments playbook. Pricing each model call inside the app lives in Price every call and cap the spend. This playbook takes that cost and turns it into a fair bill.

Chapters

  1. Metering

    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.

    • Required 1
    • Recommended 4
  2. Credits and prepaid balances

    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.

    • Required 2
    • Recommended 2
    • Avoid 1
  3. Margins and model cost

    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.

    • Required 1
    • Recommended 3
  4. Spend caps and alerts

    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.

    • Required 1
    • Recommended 3
  5. Usage on invoices

    Put every metered charge on its own invoice line with quantity, unit price and period, and let customers download the events behind each line.

    • Required 1
    • Recommended 2
  6. Agentic payments

    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.

    • Optional 4

All 25 rules on one page

This is a lot to check. An Expert can check it for you.

For agents: this playbook is free to use under CC 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.