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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(bedrock): keep /v1/responses batch metadata through the chat bridge
milan6def61e672d9
diff --git a/litellm/llms/bedrock/files/transformation.py b/litellm/llms/bedrock/files/transformation.pyindex 0aa832780e5..baa2630556a 100644--- a/litellm/llms/bedrock/files/transformation.py+++ b/litellm/llms/bedrock/files/transformation.py@@ -640,6 +640,7 @@ class BedrockFilesConfig(BaseAWSLLM, BaseFilesConfig):(key, value) for key, value in openai_request_body.items() if key not in ("model", "input"))),+ metadata=openai_request_body.get("metadata"),)return _frozen_mapping((key, value) for key, value in chat_body.items() if key != "tools" or value)diff --git a/tests/test_litellm/llms/bedrock/files/test_bedrock_files_transformation.py b/tests/test_litellm/llms/bedrock/files/test_bedrock_files_transformation.pyindex 87b03b02e1a..09aa6b1cf2d 100644--- a/tests/test_litellm/llms/bedrock/files/test_bedrock_files_transformation.py+++ b/tests/test_litellm/llms/bedrock/files/test_bedrock_files_transformation.py@@ -1337,6 +1337,23 @@ class TestBedrockBatchNonChatEndpointRecords:assert "input" not in model_inputassert "max_output_tokens" not in model_input+ def test_responses_record_keeps_metadata(self):+ """`metadata` reaches the bridge, which reads it as its own kwarg."""+ model_input = self._transform(+ {+ "custom_id": "4b",+ "method": "POST",+ "url": "/v1/responses",+ "body": {+ "model": self.PASSTHROUGH_MODEL,+ "input": "hi",+ "metadata": {"tenant": "acct-1"},+ },+ }+ )++ assert model_input["metadata"] == {"tenant": "acct-1"}+@pytest.mark.parametrize("body",[