Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Merge pull request #39239 from BerriAI/litellm_lit_6342_claude_subagent_router

Mateo Wang8c58b93572ab
diff --cc litellm/router.py
index 9353e391e76,2d8b4a43759..f9a0253520f
--- a/litellm/router.py
+++ b/litellm/router.py
@@@ -354,14 -353,9 +354,16 @@@ _PreRoutingStrategyT = TypeVar("_PreRou
_ALIAS_PARAMS_NEVER_FORWARDED: Final = frozenset({"model", "api_base", "api_key", "api_version"})
_ALIAS_MARKER_FORWARDED_PARAMS_KWARG: Final = "_alias_marker_forwarded_params"
+ _CLAUDE_CODE_SESSION_ID_RE: Final = re.compile(r"^[a-zA-Z0-9_\-]{8,}$")
+ _CLAUDE_CODE_SESSION_ROUTER_TTL_SECONDS: Final = 3600
+_RUNTIME_TOGGLEABLE_PRE_CALL_CHECKS: Final[Mapping[str, type[CustomLogger]]] = MappingProxyType(
+ {
+ "prompt_caching": PromptCachingDeploymentCheck,
+ "enforce_model_rate_limits": ModelRateLimitingCheck,
+ }
+)
+
def _stream_chunks_have_generated_content(chunks: Sequence[ModelResponseStream]) -> bool:
for chunk in chunks: