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]

[Bug fix] WatsonX audio transcriptions, don't force content type in request headers (#17546)

Ishaan Jaff77cce4202ed7
diff --git a/litellm/llms/watsonx/audio_transcription/transformation.py b/litellm/llms/watsonx/audio_transcription/transformation.py
index 8fe8b4a4248..368d755777c 100644
--- a/litellm/llms/watsonx/audio_transcription/transformation.py
+++ b/litellm/llms/watsonx/audio_transcription/transformation.py
@@ -8,7 +8,10 @@ from typing import Any, Dict, List, Optional
import litellm
from litellm.litellm_core_utils.audio_utils.utils import process_audio_file
-from litellm.types.llms.openai import OpenAIAudioTranscriptionOptionalParams
+from litellm.types.llms.openai import (
+ AllMessageValues,
+ OpenAIAudioTranscriptionOptionalParams,
+)
from litellm.types.llms.watsonx import WatsonXAudioTranscriptionRequestBody
from litellm.types.utils import FileTypes
@@ -32,6 +35,35 @@ class IBMWatsonXAudioTranscriptionConfig(
for authentication and URL construction.
"""
+ def validate_environment(
+ self,
+ headers: Dict,
+ model: str,
+ messages: List[AllMessageValues],
+ optional_params: Dict,
+ litellm_params: dict,
+ api_key: Optional[str] = None,
+ api_base: Optional[str] = None,
+ ) -> Dict:
+ """
+ Validate environment for audio transcription.
+
+ Removes Content-Type header so httpx can set multipart/form-data automatically.
+ """
+ result = IBMWatsonXMixin.validate_environment(
+ self,
+ headers=headers,
+ model=model,
+ messages=messages,
+ optional_params=optional_params,
+ litellm_params=litellm_params,
+ api_key=api_key,
+ api_base=api_base,
+ )
+ # Remove Content-Type so httpx sets multipart/form-data automatically
+ result.pop("Content-Type", None)
+ return result
+
def get_supported_openai_params(
self, model: str
) -> List[OpenAIAudioTranscriptionOptionalParams]:
diff --git a/tests/test_litellm/llms/watsonx/audio_transcription/test_watsonx_audio_transcription_transformation.py b/tests/test_litellm/llms/watsonx/audio_transcription/test_watsonx_audio_transcription_transformation.py
index 1286c2d4fe6..049285343d4 100644
--- a/tests/test_litellm/llms/watsonx/audio_transcription/test_watsonx_audio_transcription_transformation.py
+++ b/tests/test_litellm/llms/watsonx/audio_transcription/test_watsonx_audio_transcription_transformation.py
@@ -63,6 +63,9 @@ class TestWatsonXAudioTranscription:
assert "Authorization" in captured_request["headers"]
assert "Bearer test-bearer-token" in captured_request["headers"]["Authorization"]
+ # Validate Content-Type is NOT set (httpx sets multipart/form-data automatically)
+ assert "Content-Type" not in captured_request["headers"]
+
# Validate project_id is in form data, not URL
assert captured_request["data"].get("project_id") == "test-project-123"