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]

fix(auth_checks.py): handle writing team object to redis caching correctly

Krrish Dholakia92b539b42a39
diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yaml
index b712afaf0eb..d13fb3f37af 100644
--- a/litellm/proxy/_new_secret_config.yaml
+++ b/litellm/proxy/_new_secret_config.yaml
@@ -3,3 +3,7 @@ model_list:
litellm_params:
model: "*"
+litellm_settings:
+ cache: true
+ cache_params:
+ type: redis
\ No newline at end of file
diff --git a/litellm/proxy/auth/auth_checks.py b/litellm/proxy/auth/auth_checks.py
index 7c5356a379f..75f5dd10866 100644
--- a/litellm/proxy/auth/auth_checks.py
+++ b/litellm/proxy/auth/auth_checks.py
@@ -373,12 +373,13 @@ async def _cache_team_object(
proxy_logging_obj: Optional[ProxyLogging],
):
key = "team_id:{}".format(team_id)
- await user_api_key_cache.async_set_cache(key=key, value=team_table)
+ value = team_table.model_dump_json(exclude_unset=True)
+ await user_api_key_cache.async_set_cache(key=key, value=value)
## UPDATE REDIS CACHE ##
if proxy_logging_obj is not None:
await proxy_logging_obj.internal_usage_cache.async_set_cache(
- key=key, value=team_table
+ key=key, value=value
)