litellm/tests/unit/llms/gemini/realtime
owen-hj 8717147b20
fix(vertex_ai): request TEXT in the default Live setup for text-only realtime models (#54657)
* fix(vertex_ai): request TEXT in the default Live setup for text-only realtime models

The Vertex default Live setup now comes from the same builder as the session.update setup, so text-only models such as transcribe-live get TEXT instead of AUDIO and stop closing with 1007

The realtime cost map lookup also checks vertex_ai/<model>, so a model listed only under vertex_ai is recognized as text-only and gets its input transcription usage estimate

* fix(gemini): keep text-only Live detection when a deployment sets model_info mode realtime

A deployment's model_info.mode overwrites the shared cost map mode, so mode audio_transcription alone stopped marking gemini-3.5-transcribe-live as text-only. Also read supported_endpoints and supported_output_modalities, and add them to vertex_ai/gemini-3.5-transcribe-live

* fix(gemini): bill the Live audio-duration estimate only for audio-in, text-out transcription models

The widened text-only rule also matched Live chat models whose outputs are
text only, so their sessions got the transcription estimate on top of the
usageMetadata Google already reports

* fix(vertex_ai): read the vertex_ai cost map row before the AI Studio row for Live setup

Vertex Live setup looked up gemini/<model> before vertex_ai/<model>, so an AI Studio
deployment's model_info could change what a Vertex deployment of the same model sent,
and AI Studio sessions borrowed vertex_ai-only rows. The cost map lookup now takes its
provider prefixes from the config class: Gemini reads gemini/ only, Vertex reads
vertex_ai/ then gemini/

* fix(vertex_ai): read a Live field the vertex_ai cost map row lacks from the gemini row

Taking the first cost map row whole let a vertex_ai row without the realtime
fields hide the gemini row's, so on an older cost map a deployment with
model_info mode realtime sent AUDIO again and stopped estimating usage. Each
field now comes from the first row that has a value for it

* fix(vertex_ai): health check Vertex models listed only on Live endpoints over realtime by default

* fix(vertex_ai): fail the realtime health check when Live closes the session setup

* fix(vertex_ai): bound the realtime health check's wait for the Live setup reply

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-30 21:25:41 +00:00
..
__init__.py test(unit): make every tests/unit directory a package so pytest collection is unique 2026-09-20 11:50:59 +00:00
test_gemini_realtime_transformation.py fix(vertex_ai): request TEXT in the default Live setup for text-only realtime models (#54657) 2026-11-30 21:25:41 +00:00