diff --git a/litellm/llms/bedrock/chat/invoke_transformations/anthropic_claude3_transformation.py b/litellm/llms/bedrock/chat/invoke_transformations/anthropic_claude3_transformation.py index 02f0579c845..7a95356d054 100644 --- a/litellm/llms/bedrock/chat/invoke_transformations/anthropic_claude3_transformation.py +++ b/litellm/llms/bedrock/chat/invoke_transformations/anthropic_claude3_transformation.py @@ -170,8 +170,13 @@ class AmazonAnthropicClaudeConfig(AmazonInvokeConfig, AnthropicConfig): anthropic_request.pop("model", None) anthropic_request.pop("stream", None) anthropic_request.pop("output_format", None) - if not _supports_factory( - model=model, custom_llm_provider="bedrock", key="supports_output_config" + if not ( + _supports_factory( + model=model, + custom_llm_provider=None, + key="supports_output_config", + ) + or AnthropicConfig._model_supports_effort_param(model) ): anthropic_request.pop("output_config", None) if "anthropic_version" not in anthropic_request: diff --git a/litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py b/litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py index a17b158f4a0..49f4bbfb440 100644 --- a/litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py +++ b/litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py @@ -561,8 +561,13 @@ class AmazonAnthropicClaudeMessagesConfig( # 5b. Bedrock Invoke supports output_config (effort) for Claude 4.6+ models, # but older models do not — strip it to avoid request rejection. # Ref: https://github.com/BerriAI/litellm/issues/22797 - if not _supports_factory( - model=model, custom_llm_provider="bedrock", key="supports_output_config" + if not ( + _supports_factory( + model=model, + custom_llm_provider=None, + key="supports_output_config", + ) + or AnthropicConfig._model_supports_effort_param(model) ): anthropic_messages_request.pop("output_config", None) diff --git a/litellm/llms/vertex_ai/vertex_llm_base.py b/litellm/llms/vertex_ai/vertex_llm_base.py index ab193406aba..ae2fbafccfb 100644 --- a/litellm/llms/vertex_ai/vertex_llm_base.py +++ b/litellm/llms/vertex_ai/vertex_llm_base.py @@ -966,6 +966,7 @@ class VertexBase: credential_project_id, ) ) + # Clean up the entry automatically when the task finishes so # that long-running proxies with many credential keys do not # accumulate stale references. diff --git a/litellm/llms/xai/chat/transformation.py b/litellm/llms/xai/chat/transformation.py index eb445626ccd..3161e3c968c 100644 --- a/litellm/llms/xai/chat/transformation.py +++ b/litellm/llms/xai/chat/transformation.py @@ -226,9 +226,7 @@ class XAIChatConfig(OpenAIGPTConfig): verbose_logger.debug(f"Error extracting X.AI web search usage: {e}") self._fold_reasoning_tokens_into_completion(response) - self._normalize_openai_compatible_usage_totals( - getattr(response, "usage", None) - ) + self._normalize_openai_compatible_usage_totals(getattr(response, "usage", None)) return response @staticmethod diff --git a/tests/test_litellm/llms/bedrock/chat/invoke_transformations/test_bedrock_chat_invoke_transformations_anthropic_claude3_transformation.py b/tests/test_litellm/llms/bedrock/chat/invoke_transformations/test_bedrock_chat_invoke_transformations_anthropic_claude3_transformation.py index b2e254901f4..066a4eedf42 100644 --- a/tests/test_litellm/llms/bedrock/chat/invoke_transformations/test_bedrock_chat_invoke_transformations_anthropic_claude3_transformation.py +++ b/tests/test_litellm/llms/bedrock/chat/invoke_transformations/test_bedrock_chat_invoke_transformations_anthropic_claude3_transformation.py @@ -449,7 +449,7 @@ def test_bedrock_chat_invoke_checks_output_config_support_with_bedrock_provider( mock_supports_factory.assert_called_once_with( model="us.anthropic.claude-opus-4-7", - custom_llm_provider="bedrock", + custom_llm_provider=None, key="supports_output_config", ) assert result["output_config"] == {"effort": "high"} diff --git a/tests/test_litellm/llms/bedrock/messages/invoke_transformations/test_anthropic_claude3_transformation.py b/tests/test_litellm/llms/bedrock/messages/invoke_transformations/test_anthropic_claude3_transformation.py index 6a52b5d9707..4af4f8fd50e 100644 --- a/tests/test_litellm/llms/bedrock/messages/invoke_transformations/test_anthropic_claude3_transformation.py +++ b/tests/test_litellm/llms/bedrock/messages/invoke_transformations/test_anthropic_claude3_transformation.py @@ -694,7 +694,7 @@ def test_bedrock_messages_checks_output_config_support_with_bedrock_provider(): mock_supports_factory.assert_called_with( model="us.anthropic.claude-opus-4-7", - custom_llm_provider="bedrock", + custom_llm_provider=None, key="supports_output_config", ) assert result["output_config"] == {"effort": "high"} @@ -1148,7 +1148,7 @@ def test_bedrock_messages_allowlist_filters_anthropic_only_fields(): } result = cfg.transform_anthropic_messages_request( - model="anthropic.claude-3-haiku-20240307-v1:0", + model="anthropic.claude-opus-4-7", messages=messages, anthropic_messages_optional_request_params=optional_params, litellm_params=GenericLiteLLMParams(),