costUsd
function costUsd(usage, rate): number;Defined in: core/src/usage.ts:79
USD for one call.
A cost the provider reported wins outright, including a reported 0: a free call priced at the rate would be billed for something nobody charged.
Cached and written tokens are SUBSETS of input, not additions to it: the
miss part bills at the full rate, the hit part at the cache rate, the write
part at the write rate. cached is clamped to input so an over-reporting
provider can neither drive the miss count negative nor bill for more prompt
than it was sent.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
usage |
TokenUsage |
rate |
ModelRate |
Returns
Section titled “Returns”number