SAG / ARCHITECTURE NOTE

Usage Reservations and Ledgers: A Structure for Accurately Settling AI Costs

Explains the definition and need for a usage ledger, how it works, criteria for applying it to SAG architecture, and a practical checklist, drawing on research and official documentation.

Download Markdown

Definition in One Sentence

A usage ledger is a method that reserves a limit before work begins and settles completion or cancellation through append-only events.

Key answer: If concurrent jobs read and decrement a simple current value, they can exceed the limit. If failures and retries cause double deductions, customer trust is lost.

Why Is This Technology Needed?

If concurrent jobs read and decrement a simple current value, they can exceed the limit. If failures and retries cause double deductions, customer trust is lost.

How It Works

In a short transaction, lock and reserve the available amount. On completion, record an exactly-once settlement, and account for late events through separate reconciliation.

When designing the system, do not consider accuracy alone. Define latency, cost, data boundaries, refresh intervals, and behavior in case of failure together so that results can be reproduced in production. For values that automation cannot determine with confidence, it is safer to leave them marked as unmeasured or requiring review rather than changing them to zero or success.

Connection to SAG Technology

SAG uses tenant-specific quota reservations, a usage ledger, and idempotency keys. Fixture tokens are kept separate from actual provider costs, and when there are no external calls, a cost of zero is not interpreted as an estimate of actual costs.

Practical Checklist

  • Test that concurrent reservations do not exceed the limit
  • Allow each job to be settled only once
  • Separate customer credits from provider costs
  • Distinguish the states for failures, empty results, and permission errors from success
  • Revalidate before and after changes under the same conditions

Research and Official Documentation

Reference documents support the principles and recommendations. They do not guarantee search visibility, AI mentions, rankings, or revenue. The actual impact of implementation must be verified through service data and observations under the same conditions.

Technical References by Topic

How to Explore Related Technologies

Review tenant permissions, job retries, caches, and approval history.

Articles