Skip to main content

AnthropicModel

Type Alias AnthropicModel 

Source
pub type AnthropicModel = CompletionModel;

Aliased Type§

pub struct AnthropicModel {
    pub model: String,
    pub default_max_tokens: Option<u64>,
    pub prompt_caching: bool,
    pub automatic_caching: bool,
    pub automatic_caching_ttl: Option<CacheTtl>,
    /* private fields */
}

Fields§

§model: String§default_max_tokens: Option<u64>§prompt_caching: bool

Enable automatic prompt caching (adds cache_control breakpoints to system prompt and messages)

§automatic_caching: bool

Enable Anthropic’s automatic prompt caching (adds a top-level cache_control field to the request). The API automatically places the breakpoint on the last cacheable block and moves it forward as the conversation grows. No beta header is required.

§automatic_caching_ttl: Option<CacheTtl>

TTL for automatic caching. None uses the API default (5 minutes). Set to Some(CacheTtl::OneHour) for a 1-hour TTL (requires the extended-cache-ttl-2025-04-11 beta header).