ModelRate
Defined in: core/src/usage.ts:33
USD per million tokens, as every vendor prints its price sheet, so a row can be checked against one without arithmetic.
Properties
Section titled “Properties”cacheRead
Section titled “cacheRead”cacheRead: number;Defined in: core/src/usage.ts:41
Cache-HIT input. Providers auto-cache repeated prefixes and bill the hit portion far cheaper: 0.1× on Anthropic, ~0.1× on Gemini, 0.5× on some OpenAI models. In an agent loop the re-sent context is overwhelmingly hits, so billing it at the miss rate overcounts by up to 10×.
cacheWrite?
Section titled “cacheWrite?”optional cacheWrite?: number;Defined in: core/src/usage.ts:45
Input WRITTEN to cache. Anthropic bills this ABOVE the input rate
(1.25×); the OpenAI-shape auto-cachers bill it at the input rate.
Defaults to input when a vendor does not price it separately.
hosted?
Section titled “hosted?”optional hosted?: Partial<Record< | "web_search" | "web_fetch" | "code_execution" | "file_search"| "image_generation", number>>;Defined in: core/src/usage.ts:49
USD per hosted tool call (a search, a fetch, a code run), by type, as the vendor’s price sheet states it. Billed beside the tokens; a type left out bills nothing.
input: number;Defined in: core/src/usage.ts:35
Cache-MISS input: fresh tokens the provider had to read.
output
Section titled “output”output: number;Defined in: core/src/usage.ts:36