Check for existing issues
What happened?
The /v1/audio/speech endpoint does not work with vertex_ai/ Gemini TTS models, despite being documented in the Text-to-Speech docs. Requests fail with 400 INVALID_ARGUMENT from Vertex AI.
VertexGeminiConfig.get_supported_openai_params() in litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py (~line 275) does not include "audio" in its return list. The audio parameter is silently filtered out before reaching map_openai_params() (~line 659), which already has the correct audio → speechConfig mapping.
The speech-to-completion bridge correctly sends modalities: ["audio"] and audio: {"voice": "..."} to litellm.completion(), but by the time the request reaches Vertex AI, the audio param has been dropped. Vertex receives audio modality with no speech config and returns 400 INVALID_ARGUMENT.
Note: This is specific to the vertex_ai/ provider. The gemini/ (AI Studio) provider may not be affected.
Expected behavior: /v1/audio/speech with vertex_ai/gemini-2.5-flash-preview-tts should return audio, matching the documented curl example.
Related issues: #18178 (same provider, closed with docs-only workaround in #20255), #17735 (same provider, closed by #17851 which fixed a different layer). The underlying code bug — "audio" missing from VertexGeminiConfig.get_supported_openai_params() — was not addressed in either fix.
Steps to Reproduce
Config:
model_list:
- model_name: vertex-tts
litellm_params:
model: vertex_ai/gemini-2.5-flash-preview-tts
vertex_project: my-project
vertex_location: us-central1
vertex_credentials: /path/to/creds.json
Test 1 — /v1/audio/speech (fails):
curl http://0.0.0.0:4000/v1/audio/speech \
-H "Authorization: Bearer sk-1234" \
-H "Content-Type: application/json" \
-d '{
"model": "vertex-tts",
"input": "Hello world, this is a test.",
"voice": "Kore"
}' --output speech.wav
Result: 500 → logs show Vertex_aiException BadRequestError - {"error": {"code": 400, "message": "Request contains an invalid argument.", "status": "INVALID_ARGUMENT"}}.
Test 2 — /v1/chat/completions (also fails without workaround):
curl http://0.0.0.0:4000/v1/chat/completions \
-H "Authorization: Bearer sk-1234" \
-H "Content-Type: application/json" \
-d '{
"model": "vertex-tts",
"modalities": ["audio"],
"audio": {"voice": "Kore", "format": "pcm16"},
"messages": [{"role": "user", "content": "Say hello world"}]
}'
Same 400 INVALID_ARGUMENT — the audio param is silently dropped.
Test 3 — with allowed_openai_params workaround (succeeds):
Adding allowed_openai_params: [audio] to the model config makes Test 2 return audio successfully. This confirms the mapping logic works — only the supported params list is missing "audio".
Note: the allowed_openai_params workaround does not fix /v1/audio/speech (Test 1), because the speech-to-completion bridge calls litellm.completion() internally and deployment-level config overrides aren't passed through.
Relevant log output
litellm.exceptions.BadRequestError: litellm.BadRequestError: Vertex_aiException BadRequestError - {
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
}
LiteLLM Retried: 2 times
What part of LiteLLM is this about?
Proxy
What LiteLLM version are you on ?
v1.81.9-stable
Twitter / LinkedIn details
No response
Check for existing issues
What happened?
The
/v1/audio/speechendpoint does not work withvertex_ai/Gemini TTS models, despite being documented in the Text-to-Speech docs. Requests fail with400 INVALID_ARGUMENTfrom Vertex AI.VertexGeminiConfig.get_supported_openai_params()inlitellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py(~line 275) does not include"audio"in its return list. Theaudioparameter is silently filtered out before reachingmap_openai_params()(~line 659), which already has the correctaudio→speechConfigmapping.The speech-to-completion bridge correctly sends
modalities: ["audio"]andaudio: {"voice": "..."}tolitellm.completion(), but by the time the request reaches Vertex AI, theaudioparam has been dropped. Vertex receives audio modality with no speech config and returns400 INVALID_ARGUMENT.Note: This is specific to the
vertex_ai/provider. Thegemini/(AI Studio) provider may not be affected.Expected behavior:
/v1/audio/speechwithvertex_ai/gemini-2.5-flash-preview-ttsshould return audio, matching the documented curl example.Steps to Reproduce
Config:
Test 1 —
/v1/audio/speech(fails):Result:
500→ logs showVertex_aiException BadRequestError - {"error": {"code": 400, "message": "Request contains an invalid argument.", "status": "INVALID_ARGUMENT"}}.Test 2 —
/v1/chat/completions(also fails without workaround):Same
400 INVALID_ARGUMENT— theaudioparam is silently dropped.Test 3 — with
allowed_openai_paramsworkaround (succeeds):Adding
allowed_openai_params: [audio]to the model config makes Test 2 return audio successfully. This confirms the mapping logic works — only the supported params list is missing"audio".Note: the
allowed_openai_paramsworkaround does not fix/v1/audio/speech(Test 1), because the speech-to-completion bridge callslitellm.completion()internally and deployment-level config overrides aren't passed through.Relevant log output
litellm.exceptions.BadRequestError: litellm.BadRequestError: Vertex_aiException BadRequestError - { "error": { "code": 400, "message": "Request contains an invalid argument.", "status": "INVALID_ARGUMENT" } } LiteLLM Retried: 2 timesWhat part of LiteLLM is this about?
Proxy
What LiteLLM version are you on ?
v1.81.9-stable
Twitter / LinkedIn details
No response