From dde62d74ba181bacf07cd9e975b16c4c9430f561 Mon Sep 17 00:00:00 2001 From: Emerson Gomes Date: Tue, 15 Sep 2026 13:13:20 -0500 Subject: [PATCH] fix(vertex-ai): recognize provider-stripped TTS model names --- litellm/utils.py | 6 +++++- tests/test_litellm/llms/gemini/test_gemini_tts.py | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/litellm/utils.py b/litellm/utils.py index 1c590f2b495..210dd33e369 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -736,7 +736,11 @@ def is_gemini_tts_model(model: str, custom_llm_provider: str | None = None) -> b else model ) bundled_model_cost: Final = _get_bundled_model_cost_map() - bundled_model_info: Final = bundled_model_cost.get(provider_model) or bundled_model_cost.get(model) + bundled_model_info: Final = ( + bundled_model_cost.get(provider_model) + or bundled_model_cost.get(model) + or (bundled_model_cost.get(f"vertex_ai/{model}") if custom_llm_provider is None else None) + ) return ( bundled_model_info is not None and bundled_model_info.get("mode") == "audio_speech" diff --git a/tests/test_litellm/llms/gemini/test_gemini_tts.py b/tests/test_litellm/llms/gemini/test_gemini_tts.py index ae6f7a3abd8..0710590cb97 100644 --- a/tests/test_litellm/llms/gemini/test_gemini_tts.py +++ b/tests/test_litellm/llms/gemini/test_gemini_tts.py @@ -531,12 +531,13 @@ if __name__ == "__main__": @pytest.mark.parametrize("voice_key", ["name", "voiceName", "voice_name", "voice"]) @pytest.mark.parametrize("wrapper", [None, "speechConfig", "speech_config"]) -def test_speech_bridge_preserves_single_speaker_voice_mapping(voice_key: str, wrapper: str | None): +@pytest.mark.parametrize("model", ["gemini-2.5-flash-tts", "gemini-2.5-pro-tts", GEMINI_3_1_FLASH_TTS_MODEL]) +def test_speech_bridge_preserves_single_speaker_voice_mapping(voice_key: str, wrapper: str | None, model: str): handler = SpeechToCompletionBridgeTransformationHandler() config = {voice_key: "Umbriel", "language_code": "en-US"} voice = {wrapper: config} if wrapper else config result = handler.transform_request( - model=f"vertex_ai/{GEMINI_3_1_FLASH_TTS_MODEL}", + model=model, input="Hello", voice=voice, optional_params={},