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, plus the provider's reasoning-effort
settings where a change is documented to move the cached prefix (see
_EFFORT_CACHE_IDENTITY_PROVIDERS). Comparing whole model_params maps
instead would report a model change for every unrelated knob -- temperature
or max_tokens, for example -- 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.