Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion lib/crewai/src/crewai/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,8 @@ def _matches_provider_pattern(cls, model: str, provider: str) -> bool:

if provider == "anthropic" or provider == "claude":
return any(
model_lower.startswith(prefix) for prefix in ["claude-", "anthropic."]
model_lower.startswith(prefix)
for prefix in ["claude-", "anthropic.", "anthropic--"]
)

if provider == "gemini" or provider == "google":
Expand Down Expand Up @@ -2084,6 +2085,16 @@ def _format_messages_for_provider(
"Invalid message format. Each message must be a dict with 'role' and 'content' keys"
)

# Strip cache-breakpoint flags before sending to LiteLLM.
# Native providers already handle this via BaseLLM._format_messages,
# but the LiteLLM fallback path uses this method directly.
from crewai.llms.cache import strip_cache_breakpoint

messages = [dict(msg) for msg in messages]
for msg in messages:
strip_cache_breakpoint(msg)

# Handle O1 models specially
if "o1" in self.model.lower():
formatted_messages = []
for msg in messages:
Expand Down