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(ovhcloud): migrate reasoning_content->reasoning and duration->seconds fields
KunalG676b591c34f141
diff --git a/litellm/llms/ovhcloud/audio_transcription/transformation.py b/litellm/llms/ovhcloud/audio_transcription/transformation.pyindex 7ff6dc986be..e3c8308d507 100644--- a/litellm/llms/ovhcloud/audio_transcription/transformation.py+++ b/litellm/llms/ovhcloud/audio_transcription/transformation.py@@ -156,5 +156,13 @@ class OVHCloudAudioTranscriptionConfig(BaseAudioTranscriptionConfig):text = response_json.get("text") or response_json.get("transcript") or ""response = TranscriptionResponse(text=text)+ # OVHCloud field migration (deadline: 2026-05-11):+ # `duration` is replaced by `seconds` in STT responses.+ # Prefer `seconds`, fall back to `duration`, normalize to `duration`+ # so downstream consumers see a consistent key.+ duration = response_json.get("seconds") or response_json.get("duration")+ if duration is not None:+ response_json["duration"] = duration+response._hidden_params = response_jsonreturn responsediff --git a/litellm/llms/ovhcloud/chat/transformation.py b/litellm/llms/ovhcloud/chat/transformation.pyindex ae9271ddb16..4100c548f2c 100644--- a/litellm/llms/ovhcloud/chat/transformation.py+++ b/litellm/llms/ovhcloud/chat/transformation.py@@ -98,10 +98,16 @@ class OVHCloudChatCompletionStreamingHandler(BaseModelResponseIterator):new_choices = []for choice in chunk["choices"]:- if "delta" in choice and "reasoning" in choice["delta"]:- choice["delta"]["reasoning_content"] = choice["delta"].get(- "reasoning"- )+ if "delta" in choice:+ delta = choice["delta"]+ # OVHCloud field migration (deadline: 2026-05-11):+ # `reasoning_content` is replaced by `reasoning`.+ # Normalise to `reasoning_content` so downstream consumers+ # see a consistent key during the transition window.+ reasoning_new = delta.get("reasoning")+ reasoning_legacy = delta.get("reasoning_content")+ if reasoning_new is not None and reasoning_legacy is None:+ delta["reasoning_content"] = reasoning_newnew_choices.append(choice)return ModelResponseStream(diff --git a/tests/test_litellm/llms/ovhcloud/test_ovhcloud_audio_transcription_transformation.py b/tests/test_litellm/llms/ovhcloud/test_ovhcloud_audio_transcription_transformation.pyindex 8cc46dc98d0..e9abf50ba75 100644--- a/tests/test_litellm/llms/ovhcloud/test_ovhcloud_audio_transcription_transformation.py+++ b/tests/test_litellm/llms/ovhcloud/test_ovhcloud_audio_transcription_transformation.py@@ -54,3 +54,46 @@ def test_ovhcloud_audio_transcription_config_installed():assert config is not Noneassert isinstance(config, BaseAudioTranscriptionConfig)++++class TestOVHCloudDurationFieldMigration:+ """Tests for OVHCloud duration -> seconds field migration."""++ def test_seconds_field_mapped_to_duration(self):+ """New `seconds` field should be normalized to `duration`."""+ from litellm.llms.ovhcloud.audio_transcription.transformation import (+ OVHCloudAudioTranscriptionConfig,+ )+ from unittest.mock import MagicMock++ config = OVHCloudAudioTranscriptionConfig()+ mock_response = MagicMock()+ mock_response.json.return_value = {+ "text": "Hello world",+ "seconds": 3.14,+ }++ result = config.transform_audio_transcription_response(mock_response)++ assert result.text == "Hello world"+ assert result._hidden_params["duration"] == 3.14++ def test_legacy_duration_field_still_works(self):+ """Legacy `duration` field should still be accepted."""+ from litellm.llms.ovhcloud.audio_transcription.transformation import (+ OVHCloudAudioTranscriptionConfig,+ )+ from unittest.mock import MagicMock++ config = OVHCloudAudioTranscriptionConfig()+ mock_response = MagicMock()+ mock_response.json.return_value = {+ "text": "Hello world",+ "duration": 2.71,+ }++ result = config.transform_audio_transcription_response(mock_response)++ assert result.text == "Hello world"+ assert result._hidden_params["duration"] == 2.71\ No newline at end of filediff --git a/tests/test_litellm/llms/ovhcloud/test_ovhcloud_chat_transformation.py b/tests/test_litellm/llms/ovhcloud/test_ovhcloud_chat_transformation.pyindex a1b3b31f786..88ce3b4c296 100644--- a/tests/test_litellm/llms/ovhcloud/test_ovhcloud_chat_transformation.py+++ b/tests/test_litellm/llms/ovhcloud/test_ovhcloud_chat_transformation.py@@ -292,3 +292,76 @@ def test_ovhcloud_with_custom_base_url():if __name__ == "__main__":pytest.main([__file__, "-v"])+++class TestOVHCloudReasoningFieldMigration:+ """Tests for OVHCloud reasoning_content -> reasoning field migration."""++ def test_streaming_new_reasoning_field(self):+ """New `reasoning` field should be mapped to `reasoning_content`."""+ handler = OVHCloudChatCompletionStreamingHandler(+ streaming_response=iter([]),+ sync_stream=True,+ )+ chunk = {+ "id": "test-id",+ "created": 1234567890,+ "model": "test-model",+ "choices": [+ {+ "delta": {+ "role": "assistant",+ "reasoning": "Let me think...",+ },+ "index": 0,+ }+ ],+ }+ result = handler.chunk_parser(chunk)+ assert result.choices[0]["delta"]["reasoning_content"] == "Let me think..."++ def test_streaming_legacy_reasoning_content_unchanged(self):+ """Legacy `reasoning_content` field should pass through untouched."""+ handler = OVHCloudChatCompletionStreamingHandler(+ streaming_response=iter([]),+ sync_stream=True,+ )+ chunk = {+ "id": "test-id",+ "created": 1234567890,+ "model": "test-model",+ "choices": [+ {+ "delta": {+ "role": "assistant",+ "reasoning_content": "Already correct field.",+ },+ "index": 0,+ }+ ],+ }+ result = handler.chunk_parser(chunk)+ assert result.choices[0]["delta"]["reasoning_content"] == "Already correct field."++ def test_streaming_both_fields_legacy_wins(self):+ """When both fields present, existing `reasoning_content` is not overwritten."""+ handler = OVHCloudChatCompletionStreamingHandler(+ streaming_response=iter([]),+ sync_stream=True,+ )+ chunk = {+ "id": "test-id",+ "created": 1234567890,+ "model": "test-model",+ "choices": [+ {+ "delta": {+ "reasoning": "new field",+ "reasoning_content": "legacy field",+ },+ "index": 0,+ }+ ],+ }+ result = handler.chunk_parser(chunk)+ assert result.choices[0]["delta"]["reasoning_content"] == "legacy field"\ No newline at end of file