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]

clean imports

Michal Otmianowski3b6462236c5b
diff --git a/litellm/caching/s3_cache.py b/litellm/caching/s3_cache.py
index e3142ea1359..180964605f6 100644
--- a/litellm/caching/s3_cache.py
+++ b/litellm/caching/s3_cache.py
@@ -13,7 +13,7 @@ import asyncio
import json
from functools import partial
from typing import Optional
-from datetime import datetime
+from datetime import datetime, timezone, timedelta
from litellm._logging import print_verbose, verbose_logger
@@ -70,10 +70,9 @@ class S3Cache(BaseCache):
if ttl is not None:
cache_control = f"immutable, max-age={ttl}, s-maxage={ttl}"
- import datetime
# Calculate expiration time
- expiration_time = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(seconds=ttl)
+ expiration_time = datetime.now(timezone.utc) + timedelta(seconds=ttl)
# Upload the data to S3 with the calculated expiration time
self.s3_client.put_object(
Bucket=self.bucket_name,