From 070320e94c48cd18b2d5c9a1016a8ead41a1ad81 Mon Sep 17 00:00:00 2001 From: Vojtech Rysanek Date: Mon, 17 Aug 2026 16:36:59 +0200 Subject: [PATCH] fix: let s3_bucket_name reach litellm_params OPTIONAL_KWARGS_KEYS carries gcs_bucket_name and the generic bucket_name but not s3_bucket_name, so a Bedrock deployment that sets s3_bucket_name in its litellm_params loses it before the request reaches the provider. get_configured_s3_bucket_name in llms/bedrock/files/transformation.py resolves the bucket from the trusted credential snapshot in litellm_params, then falls back to AWS_S3_BUCKET_NAME. With the key filtered out, that environment variable is the only way to configure the bucket, and GET /v1/files/{id}/content on a Bedrock batch output fails with "S3 bucket_name is required" no matter what the model config says. Vertex is unaffected because gcs_bucket_name is already in the set. --- litellm/litellm_core_utils/get_litellm_params.py | 1 + .../litellm_core_utils/test_get_litellm_params.py | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/litellm/litellm_core_utils/get_litellm_params.py b/litellm/litellm_core_utils/get_litellm_params.py index 3eb8c163d5c..0f8e83f600b 100644 --- a/litellm/litellm_core_utils/get_litellm_params.py +++ b/litellm/litellm_core_utils/get_litellm_params.py @@ -35,6 +35,7 @@ OPTIONAL_KWARGS_KEYS: Final = ( "azure_scope", "timeout", "gcs_bucket_name", + "s3_bucket_name", "bucket_name", "vertex_credentials", "vertex_project", diff --git a/tests/test_litellm/litellm_core_utils/test_get_litellm_params.py b/tests/test_litellm/litellm_core_utils/test_get_litellm_params.py index fb4cb494bee..ca53d8553b3 100644 --- a/tests/test_litellm/litellm_core_utils/test_get_litellm_params.py +++ b/tests/test_litellm/litellm_core_utils/test_get_litellm_params.py @@ -73,6 +73,17 @@ class TestGetLitellmParamsKwargsExtraction: for key in _OPTIONAL_KWARGS_KEYS: assert result[key] == f"val_{key}" + def test_s3_bucket_name_survives_extraction(self): + """s3_bucket_name reaches litellm_params, like its gcs_bucket_name counterpart. + + Bedrock file retrieval resolves the bucket from litellm_params or the + AWS_S3_BUCKET_NAME environment variable. Dropping the key here left the + environment variable as the only way to configure it. + """ + result = get_litellm_params(s3_bucket_name="my-bucket", gcs_bucket_name="my-gcs-bucket") + assert result["s3_bucket_name"] == "my-bucket" + assert result["gcs_bucket_name"] == "my-gcs-bucket" + class TestGetLitellmParamsBaseModel: """Verify base_model resolution precedence."""