Skip to content

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

Description

@eddiechapman

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

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 audiospeechConfig 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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions