Skip to main content

compute_cache_key

Function compute_cache_key 

Source
pub fn compute_cache_key(
    model: &str,
    system: System<'_>,
    tools: Option<&Value>,
) -> String
Expand description

Stable scope key for (model, system, tools).

Returns "{KEY_PREFIX}:{model}:sha256:{hex}". tools must be a JSON array (or None); each element is canonicalized.

Everything after the last cache_control in system is dropped to match Anthropic’s cached prefix. Tools always participate because Anthropic includes them in the cached prefix.