pub enum PromptCache {
Implicit,
Ephemeral,
}Expand description
Whether to mark the prompt prefix as cacheable.
Providers split two ways. OpenAI and DeepSeek cache a matching prefix
implicitly and need nothing in the request. Anthropic caches only what the
request marks with cache_control, and forwards that field through
OpenAI-compatible gateways such as OpenRouter — so reaching a Claude model
without marking anything re-charges the system prompt and the whole tool
block at full input price on every turn.
Default is Self::Implicit: an unmarked request is correct everywhere,
where a marked one restructures the system message and is wasted on an
endpoint that ignores it.
Variants§
Implicit
Send no breakpoints — right for implicit-caching providers and for local servers, whose KV cache keys on the prefix bytes rather than a field.
Ephemeral
Mark the tool block and the system message as cacheable.
Trait Implementations§
Source§impl Clone for PromptCache
impl Clone for PromptCache
Source§fn clone(&self) -> PromptCache
fn clone(&self) -> PromptCache
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more