Skip to content

fix(speech): avoid double WAV headers for Gemini TTS - #44545

Closed
axelray-dev wants to merge 1 commit into
BerriAI:mainfrom
axelray-dev:litellm_fix_gemini_wav_header
Closed

axelray-dev wants to merge 1 commit into
BerriAI:mainfrom
axelray-dev:litellm_fix_gemini_wav_header

Conversation

@axelray-dev

@axelray-dev axelray-dev commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #44541.

Gemini TTS can return audio that is already wrapped in a WAV container. Preserve that payload for WAV/default responses, and extract the PCM frames when PCM is requested. Raw PCM and non-Gemini responses keep their existing behavior.

Tests: uv run --no-sync pytest tests/unit/endpoints/speech/speech_to_completion_bridge/test_transformation.py -q (15 passed).

@codspeed

codspeed Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

⚠️ 1 benchmark spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 31 untouched benchmarks


Comparing axelray-dev:litellm_fix_gemini_wav_header (91f665a) with main (aa879f7)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (e226016) during the generation of this report, so aa879f7 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@axelray-dev
axelray-dev force-pushed the litellm_fix_gemini_wav_header branch from a000202 to 91f665a Compare October 14, 2026 06:37
@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

Copy link
Copy Markdown
Contributor

#44541 was fixed by #51145 on main, so this pull request is closed. Reopen it if something was missed.

@github-actions github-actions Bot closed this Nov 24, 2026
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]: /v1/audio/speech returns a double WAV header for gemini-3.8 TTS models

1 participant