Repository navigation
Unsure about the meaning of the 'cacheRead' value. #1481
|
While adding a model in the code i stumbled accross this required value i need to set whihc is does that refer to the input token price? Guys, I certainly need some serious help about it to get it right! |
Replies: 1 comment 1 reply
|
No, it's a separate price. You can see it in It's also optional, not required ( Quick check with the flash-lite prices: 1M input tokens, 800k of them cached and no output, comes to $0.027 with |
No, it's a separate price.
cacheReadis the USD price per 1M cached input tokens (prompt cache hits), next toinputandoutput, which are also per 1M tokens. Use whatever the provider lists as "cached input" or "context caching" for that model.You can see it in
estimateCost: cached tokens are subtracted from the input count and billed atcacheRead, everything else atinput. The cached count comes from the AI SDK'sinputTokenDetails.cacheReadTokens(agent.ts).It's also optional, not required (
ModelPricing). If you leave it out, cached tokens are billed at the fullinputprice, so the cost estimate just comes out a bit high. A few entries likegpt-5.5-proand most of the grok models alrea…