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
Required
Keep every metered price above its cost
USG-12Write a margin floor per plan, such as 40%. A test computes each metered unit's cost from the current model prices and fails when any price falls under the floor.
Recommended
Charge each model call's cost to the customer who caused it
USG-11Store the cost of every model call, retry, embedding and tool call with the customer and the metered action it served. Then cost and revenue sit side by side.
Alert when a customer costs more than they pay
USG-13Every day, compare each customer's model and infrastructure cost for the period with what they will be billed. Alert when cost passes 80% of the bill.
Recheck margins when a model or its price changes
USG-14Pin each model version in the price table. When a provider changes a price or retires a model, update the table and rerun the margin test before the change date.
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/margins-and-model-cost">Agent Wranglers usage-based billing playbook</a>. In code you write, add a comment next to it with the same link.