Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3088546
Add debugger settings to debug single worker proxy_server per request.
harish-berri Apr 21, 2026
d58f657
Replace assertions with simple if conditions. assertions raise an exc…
harish-berri Apr 21, 2026
984287d
Implement CacheCodec for DualCache serialization and deserialization.…
harish-berri Apr 21, 2026
9cfc5fc
update tests
harish-berri Apr 21, 2026
595f42d
Refactor caching logic in auth_checks and user_api_key_auth to utiliz…
harish-berri Apr 23, 2026
d4a26ff
Enhance caching mechanism by integrating CacheCodec for serialization…
harish-berri Apr 24, 2026
655e752
Enhance team endpoint tests by integrating AsyncMock for cache method…
harish-berri Apr 24, 2026
d9292e7
Update test for CacheCodec serialization to clarify validation error …
harish-berri Apr 24, 2026
1af843f
Merge branch 'litellm_internal_staging' of https://github.com/BerriAI…
harish-berri Apr 24, 2026
a9761e1
Merge remote-tracking branch 'origin/litellm_internal_staging' into l…
harish-berri Apr 24, 2026
ce087aa
refactor(proxy): update documentation and code references for enable_…
harish-berri Apr 24, 2026
7784775
feat(auth): add Prometheus metrics for combined_view SQL queries
harish-berri Apr 25, 2026
b3c6566
Merge origin/litellm_internal_staging into litellm_token_verification…
harish-berri Apr 25, 2026
f08a853
fix failing test
harish-berri Apr 25, 2026
3c2c61e
refactor(proxy): replace DualCache with UserApiKeyCache for user API …
harish-berri Apr 28, 2026
354ad40
fix DualCache import error in CI and update docstrings for cache coor…
harish-berri Apr 28, 2026
84b6bd6
update test cases to match new behaviour. The earlier test cases assu…
harish-berri Apr 28, 2026
1899632
update test cases to fix handle_jwt test cases
harish-berri Apr 28, 2026
13ffb9a
update auth metric increment comment from greptile
harish-berri Apr 28, 2026
9039643
lint styling update
harish-berri Apr 28, 2026
33d9190
correct team_id key bug
harish-berri Apr 29, 2026
1d62ca0
Merge branch 'litellm_internal_staging' into litellm_token_verificati…
harish-berri Apr 29, 2026
b6e13cb
fix linting
harish-berri Apr 29, 2026
bff26f6
fix unused imports
harish-berri Apr 29, 2026
8df24b5
Merge branch 'litellm_internal_staging' into litellm_token_verificati…
harish-berri Apr 30, 2026
54f762e
remove unrelated debugger tooling
harish-berri Apr 30, 2026
4dc950a
fix linting
harish-berri Apr 30, 2026
1f72ae5
fix: add type hint ignore for user_api_key_cache and update docstring…
harish-berri Apr 30, 2026
76fb9d3
refactor: remove AuthMetrics and related combined_view query metrics
harish-berri Apr 30, 2026
3bff192
fix linting
harish-berri Apr 30, 2026
6fb1de9
refactor: replace DualCache with UserApiKeyCache in multiple modules
harish-berri Apr 30, 2026
7c8fe86
Merge branch 'litellm_internal_staging' into litellm_token_verificati…
harish-berri May 1, 2026
8671ec6
fix import error
harish-berri May 1, 2026
896e102
fix linting
harish-berri May 1, 2026
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ test.py
litellm_config.yaml
!.github/observatory/litellm_config.yaml
.cursor
.vscode/launch.json
litellm/proxy/to_delete_loadtest_work/*
update_model_cost_map.py
tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py
Expand All @@ -100,4 +99,5 @@ STABILIZATION_TODO.md
**/test-results
**/playwright-report
**/*.storageState.json
**/coverage
**/coverage
test-config
19 changes: 19 additions & 0 deletions litellm/caching/dual_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,25 @@ def update_cache_ttl(
if default_redis_ttl is not None:
self.default_redis_ttl = default_redis_ttl

def attach_redis_cache(
self,
redis_cache: Optional[RedisCache] = None,
*,
default_redis_ttl: Optional[float] = None,
) -> None:
"""
Attach a Redis backend if this DualCache does not already have one.

No-op when ``redis_cache`` is None or when Redis was already set (constructor
or a prior attach). Use this for lazy wiring after a shared Redis client exists.
Does not backfill in-memory-only keys to Redis.
"""
if redis_cache is None or self.redis_cache is not None:
return
self.redis_cache = redis_cache
if default_redis_ttl is not None:
self.default_redis_ttl = default_redis_ttl

def set_cache(self, key, value, local_only: bool = False, **kwargs):
# Update both Redis and in-memory cache
try:
Expand Down
10 changes: 9 additions & 1 deletion litellm/caching/redis_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,13 @@ async def script_callable(keys: List[str], args: List[Any]) -> Any:
async def async_set_cache(self, key, value, **kwargs):
from redis.asyncio import Redis

if key is None:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran into a few instances where writing None keys to redis showed up as exceptions. I think this is a valid assumption and would not break anything

verbose_logger.debug(
"LiteLLM Redis Caching: async set() skipped — key is None, value=%r",
value,
)
return None

start_time = time.time()
try:
_redis_client: Redis = self.init_async_client() # type: ignore
Expand All @@ -569,8 +576,9 @@ async def async_set_cache(self, key, value, **kwargs):
)
)
verbose_logger.error(
"LiteLLM Redis Caching: async set() - Got exception from REDIS %s, Writing value=%s",
"LiteLLM Redis Caching: async set() - Got exception from REDIS %s, key=%r, value=%r",
str(e),
key,
value,
)
raise e
Expand Down
1 change: 1 addition & 0 deletions litellm/integrations/prometheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ def __init__( # noqa: PLR0915
########################################
# LiteLLM Virtual API KEY metrics
########################################

# Remaining MODEL RPM limit for API Key
self.litellm_remaining_api_key_requests_for_model = self._gauge_factory(
"litellm_remaining_api_key_requests_for_model",
Expand Down
Loading
Loading