calculateUsageCost
Purpose and behavior
Section titled “Purpose and behavior”Estimate token charges in the table’s currency from Usage.models. Rates are per million tokens. Cache reads and writes are charged once using each model’s input convention; omitted cache rates use the input rate. Missing model attribution, prices or usage return complete: false and a lower bound. Invalid counters or prices throw. This is an estimate, not an invoice.
Complete example and detailed rules.
Parameters and properties
Section titled “Parameters and properties”usageRequiredUsageAggregate token usage with optional model-attributed counters.pricesRequiredModelPriceTableExplicit rates and currency used for this estimate.

