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(bedrock): prevent double UUID in create_file S3 key (#21650)

Zhenting Huangd53ea88598c0
diff --git a/litellm/llms/custom_httpx/llm_http_handler.py b/litellm/llms/custom_httpx/llm_http_handler.py
index 0a5364bfcfe..5087f2e0078 100644
--- a/litellm/llms/custom_httpx/llm_http_handler.py
+++ b/litellm/llms/custom_httpx/llm_http_handler.py
@@ -3014,8 +3014,11 @@ class BaseLLMHTTPHandler:
raise ValueError(f"Unsupported transformed_request type: {type(transformed_request)}")
# Store the upload URL in litellm_params for the transformation method
+ # Honour the URL already set by transform_create_file_request (e.g. Bedrock pre-signed S3 uploads),
+ # fall back to api_base for providers that do not set it.
litellm_params_with_url = dict(litellm_params)
- litellm_params_with_url["upload_url"] = api_base
+ if "upload_url" not in litellm_params:
+ litellm_params_with_url["upload_url"] = api_base
return provider_config.transform_create_file_response(
model=None,