---
title: "Metering · Agent Wranglers"
url: https://agentwranglers.se/playbook/usage-billing/metering
parts: 5
tokens_total: 3958
updated: 2026-10-22
tokens: 675
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Metering

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

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). 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.

**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/metering">Agent Wranglers usage-based billing playbook</a>`. In code you write, add a comment next to it with the same link.

## Required

- USG-1 [Give every usage event a key and count it once](https://agentwranglers.se/playbook/usage-billing/metering/idempotent-usage-events.md) · 1,041 tokens · updated 2026-10-22
  Give each usage event a key made from the work it bills, such as the request ID. Store it under a unique constraint, so a retry never bills twice.

## Recommended

- USG-2 [Meter on the server after the work succeeds](https://agentwranglers.se/playbook/usage-billing/metering/server-side-metering.md) · 606 tokens · updated 2026-10-22
  Record usage only on the server that did the work, after it succeeded, with the quantity it measured. Never take a quantity from the browser or the app.
- USG-3 [Keep raw events and derive every total from them](https://agentwranglers.se/playbook/usage-billing/metering/raw-usage-events.md) · 915 tokens · updated 2026-10-22
  Keep every raw usage event for as long as you keep the invoice it fed. Compute period totals from the events, and never keep only a running counter.
- USG-4 [Accept late events up to a fixed cut-off](https://agentwranglers.se/playbook/usage-billing/metering/late-usage-cutoff.md) · 610 tokens · updated 2026-10-22
  Bill each event by the time it happened. Accept late events for a fixed grace window, such as 24 hours after the period ends, then close the period.
- USG-5 [Match your usage totals with the provider before each invoice](https://agentwranglers.se/playbook/usage-billing/metering/usage-reconciliation.md) · 786 tokens · updated 2026-10-22
  Before a usage invoice is finalised, compare your total per customer and meter with the total the billing provider holds. Hold the invoice when they differ.

- Next: [Credits and prepaid balances](https://agentwranglers.se/playbook/usage-billing/credits-and-prepaid-balances.md)
- [All chapters](https://agentwranglers.se/playbook/usage-billing.md)
