Skip to main content

reply_prefix_tokens

Function reply_prefix_tokens 

Source
pub fn reply_prefix_tokens(history: &[SharedMessage]) -> u64
Expand description

Conservative token estimate of the part of the history’s last message (the turn’s final reply) that the cached prefix will hold: its content minus thinking blocks, which the API strips when the next request re-sends the reply (they were billed as output, never cached). Ping 1 may write at most this (plus the last request’s uncached input) without counting as a partial miss.