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: litellm_internal_staging into litellm_bedrock_batch_sse_kms

mateo-berri2cc65a94c305
diff --cc litellm/llms/bedrock/files/transformation.py
index d1674b260b4,399f11a94cf..b4c4a270bd7
--- a/litellm/llms/bedrock/files/transformation.py
+++ b/litellm/llms/bedrock/files/transformation.py
@@@ -762,8 -750,7 +754,8 @@@ class BedrockFilesConfig(BaseAWSLLM, Ba
content: str,
api_base: str,
optional_params: dict,
+ s3_encryption_key_id: str | None = None,
- ) -> Tuple[dict, str]:
+ ) -> tuple[dict, str]:
"""
Sign S3 PUT request using the same proven logic as S3Logger.
Reuses the exact pattern from litellm/integrations/s3_v2.py
@@@ -792,18 -779,10 +784,18 @@@
)
# Calculate SHA256 hash of the content (REQUIRED for S3)
- content_hash = hashlib.sha256(content.encode("utf-8")).hexdigest()
+ content_hash: Final = hashlib.sha256(content.encode("utf-8")).hexdigest()
# Prepare headers with required S3 headers (same as s3_v2.py)
- sse_headers = (
++ sse_headers: Final = (
+ {
+ "x-amz-server-side-encryption": "aws:kms",
+ "x-amz-server-side-encryption-aws-kms-key-id": s3_encryption_key_id,
+ }
+ if s3_encryption_key_id
+ else {}
+ )
- request_headers = {
+ request_headers: Final = {
"Content-Type": "application/json", # JSONL files are JSON content
"x-amz-content-sha256": content_hash, # REQUIRED by S3
"Content-Language": "en",