CACHE_IDENTITY_PARAM_KEYS = frozenset(
{'prompt_cache_key', 'prompt_cache_options', 'prompt_cache_retention'}
)Invocation params that select or invalidate a provider cache entry.
The identity check compares only these. Comparing whole model_params maps
instead would report a model change for every unrelated knob -- /effort
rewrites reasoning_effort wholesale, and temperature or max_tokens are
just as inert for caching -- and the modal would then assert that "the previous
cached prefix cannot be reused" when nothing about the prefix moved. A modal
that fires on a false premise trains users into the permanent suppression.
cache_control is deliberately absent: AnthropicPromptCachingMiddleware
overwrites model_settings["cache_control"] with its own TTL on every
Anthropic request (see _ANTHROPIC_MIDDLEWARE_TTL_SECONDS), so a
user-supplied value never reaches the wire. Comparing it would report an
identity change for a setting the effective requests never differed on.