Skip to content

Comments

fix(vertex_ai): add 'audio' to supported OpenAI params for TTS#21869

Open
edwiniac wants to merge 2 commits intoBerriAI:mainfrom
edwiniac:fix-vertex-tts-audio-param
Open

fix(vertex_ai): add 'audio' to supported OpenAI params for TTS#21869
edwiniac wants to merge 2 commits intoBerriAI:mainfrom
edwiniac:fix-vertex-tts-audio-param

Conversation

@edwiniac
Copy link

Problem

/v1/audio/speech fails with 400 INVALID_ARGUMENT when using vertex_ai/ Gemini TTS models.

Root Cause

VertexGeminiConfig.get_supported_openai_params() does not include "audio" in its return list. The audio parameter is silently filtered out before reaching map_openai_params(), which already has the correct audiospeechConfig mapping.

Fix

Add "audio" to the list of supported OpenAI params in VertexGeminiConfig.get_supported_openai_params().

Changes

  • litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py: Added "audio" to supported params list
  • tests/test_litellm/test_utils.py: Added test case to verify audio param is supported

Testing

The mapping logic already exists and works — this fix just ensures the param reaches it.

Fixes #21702

The `audio` parameter was missing from `VertexGeminiConfig.get_supported_openai_params()`,
causing it to be filtered out before reaching `map_openai_params()`. This broke TTS
functionality via `/v1/audio/speech` for vertex_ai Gemini models.

The mapping logic in `map_openai_params()` already correctly transforms `audio` → `speechConfig`,
but the parameter was never reaching that code because it wasn't in the supported list.

Fixes BerriAI#21702
@vercel
Copy link

vercel bot commented Feb 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Feb 22, 2026 3:16am

Request Review

@CLAassistant
Copy link

CLAassistant commented Feb 22, 2026

CLA assistant check
All committers have signed the CLA.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 22, 2026

Greptile Summary

This PR fixes a bug where the audio parameter was silently filtered out before reaching map_openai_params() in the Vertex AI Gemini config, causing /v1/audio/speech TTS requests to fail with 400 INVALID_ARGUMENT. The fix adds "audio" to VertexGeminiConfig.get_supported_openai_params() so the existing audiospeechConfig mapping logic can execute.

  • Adds "audio" to the supported params list in VertexGeminiConfig.get_supported_openai_params() — the mapping in map_openai_params() at line 979 already handles the translation correctly
  • Adds a unit test verifying the param is present for TTS models
  • Minor inconsistency: GoogleAIStudioGeminiConfig conditionally adds "audio" only for TTS models ("tts" in model), while this change adds it unconditionally for all Vertex Gemini models

Confidence Score: 4/5

  • This PR is safe to merge — it adds one string to a supported params list with an existing, tested mapping pathway.
  • The change is minimal (1 line of production code) and the mapping logic already exists and works. The only concern is that "audio" is added unconditionally rather than gated to TTS models, which is inconsistent with the GoogleAIStudioGeminiConfig approach but won't cause functional issues.
  • Minor attention on litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py for consistency with the sibling GoogleAIStudioGeminiConfig.

Important Files Changed

Filename Overview
litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py Adds "audio" to the supported OpenAI params list. The fix is correct for TTS models but is applied unconditionally, unlike the sibling GoogleAIStudioGeminiConfig which gates it on TTS models only.
tests/test_litellm/test_utils.py Adds a unit test asserting "audio" is in supported params for the TTS model. Test is local-only (no network calls) and follows existing patterns in the test file.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Client sends /v1/audio/speech\nwith audio param"] --> B["get_optional_params()"]
    B --> C["get_supported_openai_params()"]
    C --> D{{"'audio' in\nsupported_params?"}}
    D -->|"No (before fix)"| E["audio param filtered out"]
    E --> F["map_openai_params() never\nsees audio param"]
    F --> G["400 INVALID_ARGUMENT"]
    D -->|"Yes (after fix)"| H["audio param kept"]
    H --> I["map_openai_params()\naudio → speechConfig"]
    I --> J["Vertex AI TTS succeeds"]
Loading

Last reviewed commit: 890b56e

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

"logprobs",
"top_logprobs",
"modalities",
"audio",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

audio added unconditionally for all models

The sibling GoogleAIStudioGeminiConfig (in litellm/llms/gemini/chat/transformation.py:98) conditionally adds "audio" only for TTS models via is_model_gemini_audio_model(model) (which checks "tts" in model). This PR adds "audio" unconditionally to VertexGeminiConfig for all Gemini models, which is inconsistent.

While this won't cause a runtime error (the mapping in map_openai_params handles it safely), it means get_supported_openai_params("gemini-1.5-pro") will report "audio" as supported even for non-TTS models, which is misleading.

Consider guarding this the same way GoogleAIStudioGeminiConfig does:

Suggested change
"audio",
"audio" if "tts" in model else None,

Or better yet, add it conditionally after the list like the penalty params:

if "tts" in model:
    supported_params.append("audio")

Address review feedback: make audio param addition consistent with
GoogleAIStudioGeminiConfig by only adding it when 'tts' is in model name.
@edwiniac
Copy link
Author

Thanks for the review feedback! Updated to add audio conditionally only for TTS models ("tts" in model), consistent with GoogleAIStudioGeminiConfig.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: vertex_ai/ Gemini TTS fails on /v1/audio/speechaudio param missing from get_supported_openai_params()

2 participants