Skip to main content

Module token_ledger

Module token_ledger 

Source
Expand description

The token accounting both submilli:llm and submilli:embedding budget against: a per-execution reservation that also charges a server-wide aggregate, with held reserve for spend a provider never reported.

This module owns the arithmetic and the concurrency. It knows nothing about either capability’s error type, flag names, or message text: a refusal comes back as a LedgerRefusal naming which ceiling was hit, and the capability wrapper renders it in its own vocabulary.

Structs§

LedgerLimits
The two ceilings one execution’s ledger enforces. The server-wide cap lives on the SharedTokenBudget.
SharedTokenBudget
An aggregate token budget several executions reserve against.
TokenLedger
One execution’s reservations against its own ceiling and the shared aggregate together.

Enums§

LedgerRefusal
Which ceiling refused a reservation, with the numbers the capability’s message needs.