diff --git a/litellm/integrations/anthropic_cache_control_hook.py b/litellm/integrations/anthropic_cache_control_hook.py index 32f1b098514..de4158f66bd 100644 --- a/litellm/integrations/anthropic_cache_control_hook.py +++ b/litellm/integrations/anthropic_cache_control_hook.py @@ -72,7 +72,7 @@ MAX_CACHE_CONTROL_BLOCKS: Final = 4 CACHE_BREAKPOINT_KEYS: Final = ("cache_control", "prompt_cache_breakpoint") OPENAI_PROMPT_CACHE_BREAKPOINT_MIN_GPT_VERSION: Final = (5, 6) -_GPT_VERSION_PATTERN: Final = re.compile(r"^gpt-(\d+)(?:[.-](\d{1,2})(?!\d))?") +_GPT_VERSION_PATTERN: Final = re.compile(r"^gpt-(\d+)(?:[.-](0|[1-9]\d?)(?![\da-z]))?") _FINE_TUNED_BASE_PATTERN: Final = re.compile(r"^ft:([^:]+)") _O_SERIES_PATTERN: Final = re.compile(r"^o\d+(?:-|$)") OPENAI_PROMPT_CACHE_BREAKPOINT_BLOCK_TYPES: Final = frozenset( diff --git a/tests/unit/integrations/test_anthropic_cache_control_hook.py b/tests/unit/integrations/test_anthropic_cache_control_hook.py index 7e0a21020da..05c35ea90d2 100644 --- a/tests/unit/integrations/test_anthropic_cache_control_hook.py +++ b/tests/unit/integrations/test_anthropic_cache_control_hook.py @@ -3486,6 +3486,9 @@ class TestOpenAIPromptCacheBreakpoint: ("gpt-5-6-sol", True), ("gpt-6-1", True), ("gpt-5-4-mini", False), + ("gpt-5-32k", False), + ("gpt-5-6b", False), + ("gpt-5-06", False), ("gpt-5-2026-03-01", False), ("gpt-4-1106-preview", False), ("o3", False),