Skip to content

fix(realtime)!: send the Gemini Live setup at the first content so session.update settings apply - #39864

Merged
mateo-berri merged 19 commits into
mainfrom
litellm_lit_6974_gemini_live_lazy_setup
Oct 30, 2026
Merged

mateo-berri merged 19 commits into
mainfrom
litellm_lit_6974_gemini_live_lazy_setup

Conversation

@mateo-berri

@mateo-berri mateo-berri commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Gemini and Vertex Live sessions on /v1/realtime dropped the client's session.update, since the proxy sent its own audio setup at connect and Gemini takes only one. Text clients got audio, and instructions and tools never reached the model

Now the setup goes out with the first content, built from every session.update before it. What Gemini can't apply gets an error event unless drop_params is on

Original

TLDR

Problem this solves:

  • Text clients get audio answers from Gemini Live
  • Instructions and tools in session.update never reach the model
  • Push-to-talk turns never get an answer

How it solves it:

  • Setup goes out with the first content, not at connect
  • Earlier session.update frames merge in and get acked
  • Updates Gemini can't apply get an error event
Full TLDR

Problem this solves:

  • The proxy sends its default audio setup at connect, so the client's session.update is dropped with only a debug log
  • Both the GA output_modalities and beta modalities shapes are lost, along with instructions, tools, and VAD settings
  • Text answers get billed and labelled as audio
  • A push-to-talk client (turn_detection with create_response: false, or turn_detection: null) never gets an answer, since Gemini needs explicit activity markers when automatic detection is off

How it solves it:

  • Gemini and Vertex Live setup now goes out with the client's first content frame, built from every session.update sent before it, each acknowledged with session.updated
  • While a session.update is held, the first messages and input audio wait for response.create, any other event, or 1 second, so an update sent between them, like the one Pipecat sends before its first response.create, joins the setup
  • A session that sends content first still gets the model's default setup, and a session with no content after 240 seconds sends its setup anyway, since Vertex refuses a setup 300 seconds after connect
  • Only content (conversation.item.create, response.create, and input audio) sends the setup, so a control event like response.cancel sent first leaves it open for the next session.update
  • A pre_call guardrail that blocks the first typed message sends the setup first, so the session stays open
  • Push-to-talk turns are wrapped in Gemini's activityStart and activityEnd messages, and response.create closes an open turn. turn_detection: null turns Gemini's automatic activity detection off on AI Studio and Vertex
  • With a realtime_input_transcription guardrail on, Gemini audio input gets an audio_input_not_screenable error and is not sent, since Gemini only transcribes a turn after it starts answering it, so the guardrail could not check it first. Text turns still go through the guardrail
  • A session.update after the first content gets session.updated when it leaves the setup unchanged, like the resend Pipecat sends with each response. A changed one answers a session_update_not_applied error unless drop_params is set, which drops it
  • A request whose output modalities the model cannot produce at all answers an invalid_request_error event unless drop_params is set, in which case the value is dropped. A text and audio pair collapses to the one the model can produce
  • A voice outside Google's 30 documented Live voices gets an invalid_value error event, or is dropped with drop_params, on Vertex and AI Studio's native-audio models, since those close the socket with 1007 on a voice they do not know. AI Studio's 3.x Live models take any name, so it is forwarded there
  • OpenAI voice names that Gemini TTS already maps, like fable to Umbriel and onyx to Orus, pass the Live voice check as their Gemini voice
  • Realtime tools in the flat {"type": "function", "name": ...} shape go through Gemini's schema conversion, so $defs, $ref, and nullable types work
  • Two requested modalities collapse to one, a bare string modality is read as a list, and max_output_tokens: "inf" is not forwarded, since Gemini closes the socket with 1007 on each of those
  • Held session.update frames past 10 MB answer session_update_too_large
  • A Gemini socket that closes before a held setup goes out logs as a normal session, not a refused one
  • The Admin UI playground sends the same session.update, with server VAD, at connect and when recording starts, so Gemini acks the second one
  • Deferred mode (gemini_live_defer_setup) merges held updates the same way, sends the default setup before content that comes first, and sends a session.update that follows buffered audio as the setup at once
  • Providers whose builds_setup_from_session_update() returns False keep the connect-time setup, and Bedrock reuses the same rejection type

User Flow

Before: a Vertex Gemini Live app asks for text answers with instructions, and both are ignored

  1. They open wss://litellm-domain/v1/realtime?model=vertex_ai/gemini-live-2.5-flash and get session.created
  2. They send session.update with output_modalities: ["text"], instructions, and tools, and get no session.updated
  3. They send a message with conversation.item.create and response.create, or push-to-talk audio and a commit
  4. Audio comes back as response.output_audio.delta without the instructions, and push-to-talk audio gets no answer

After: the same session acks the update, answers in text, and follows the instructions

  1. They open wss://litellm-domain/v1/realtime?model=vertex_ai/gemini-live-2.5-flash and get session.created
  2. The same session.update gets session.updated with output_modalities: ["text"]
  3. They send a message with conversation.item.create and response.create, or push-to-talk audio and a commit
  4. Text comes back as response.output_text.delta with the instructions applied, and push-to-talk audio gets answered

Relevant issues

Fixes #46685

Related: #44825

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Last updated: 9eb50c9. QA ran on 6b58477. Changes since QA: an injectable lazy setup clock that defaults to time.monotonic, plus tests. Proof and /live-pr-risk remain valid because no caller passes the clock. Verification: realtime unit tests, make check, affected unit tests

Both legs ran a websockets client through /v1/realtime on a 2-worker proxy against real Vertex AI, Gemini, and OpenAI

Case Before After
pttAudioVertex No answer Tool call, ARRR
pttGuardVertex 1007 close audio_input_not_screenable error
gaText Audio, unacked Text, acked
betaHeaderText Audio, unacked Text, acked
controlFirstVertex Audio, unacked Text, acked
pirate38AiStudio Instructions ignored ARRR
pirateNativeVertex Instructions ignored ARRR
guardBlockFirst Blocked, open Blocked, open
openaiGaText Text, acked Text, acked
betaText Audio, unacked Text, acked
nativeGaText Audio, unacked Audio, invalid_value error
nativeDropParams Audio, unacked Audio, acked
aiStudio38GaText Audio, unacked Audio, invalid_value error
twoUpdates Audio, unacked Text, 2 acks
guardTwoUpdates Audio, unacked Text, 2 acks
lateUpdate Dropped silently session_update_not_applied error
badVoiceVertex Answers, voice ignored invalid_value error, answers
gaBothExtras Audio, unacked Audio, acked
gaInfTokens Audio, unacked Text, acked
gaTextString Audio, unacked Text, acked
gaVideo Audio, unacked Audio, invalid_value error
idle70Vertex Answers Answers, acked
idle310Vertex Answers Answers, acked
pipecatResendVertex Audio, unacked Text, 2 acks
pipecatResendNative Instructions ignored ARRR, 2 acks
vNovaDropParams Answers, unacked Answers, acked
pttManualVertex No answer Tool call, ARRR
deferTwoUpdates Audio, 1 ack Text, 2 acks
deferResend Text, 1 ack Text, 2 acks
deferLateUpdate 1007 close Answers, session_update_not_applied error
deferControlFirst Text, acked Text, acked
deferAudioFirst Text, ARRR, acked Text, ARRR, acked
flatRefToolVertex Tool ignored Tool called
flatRefTool38AiStudio Tool ignored Tool called
pipecatFirstTurnVertex Audio, no ARRR Text, ARRR, 2 acks
pipecatFirstTurnNative Instructions ignored ARRR, 2 acks
audioMidUpdateVertex No answer Tool call, ARRR
deferPipecatFirstTurn Text, no ARRR Text, ARRR, 2 acks
badVoiceAiStudio Answers, unacked invalid_value error, answers
aiStudioNovaDropParams Answers, unacked Answers, acked
nova38AiStudio Answers, unacked Answers, acked
Admin UI playground cases

Each leg replays its own tree's RealtimePlayground.tsx frames, a typed turn and then a recorded one, through this client

Case Before After
pgTextVoiceVertex Both answer, unacked Both answer, 2 acks
pgVoiceVertex Answers, unacked Answers, 2 acks
pgTextVoiceStudio Both answer, unacked Both answer, 2 acks
pgFableNativeVertex Both answer, unacked Both answer, 2 acks
pgOnyxNativeVertex Both answer, unacked Both answer, 2 acks
pgNovaNativeStudio Both answer, unacked invalid_value error, both answer
pgTextVoiceOpenAI Both answer, 2 acks Both answer, 2 acks
Shared setup

Both legs booted from this config. gemini-live-2.5-flash is only served at global and the native-audio model only regionally, so the config pins each

model_list:
  - model_name: vertex_ai/gemini-live-2.5-flash
    litellm_params:
      model: vertex_ai/gemini-live-2.5-flash
      vertex_location: global
      vertex_project: os.environ/VERTEXAI_PROJECT
  - model_name: vertex_ai/gemini-live-2.5-flash-native-audio
    litellm_params:
      model: vertex_ai/gemini-live-2.5-flash-native-audio
      vertex_project: os.environ/VERTEXAI_PROJECT
      vertex_location: us-central1
  - model_name: native-audio-drop-params
    litellm_params:
      model: vertex_ai/gemini-live-2.5-flash-native-audio
      vertex_project: os.environ/VERTEXAI_PROJECT
      vertex_location: us-central1
      drop_params: true
  - model_name: vertex_ai/gemini-3.8-live
    litellm_params:
      model: vertex_ai/gemini-3.8-live
      vertex_project: os.environ/VERTEXAI_PROJECT
      vertex_location: global
  - model_name: gemini/gemini-3.8-live
    litellm_params:
      model: gemini/gemini-3.8-live
      api_key: os.environ/GEMINI_API_KEY
  - model_name: gemini/gemini-2.5-flash-native-audio-preview-12-2025
    litellm_params:
      model: gemini/gemini-2.5-flash-native-audio-preview-12-2025
      api_key: os.environ/GEMINI_API_KEY
  - model_name: aistudio-native-drop-params
    litellm_params:
      model: gemini/gemini-2.5-flash-native-audio-preview-12-2025
      api_key: os.environ/GEMINI_API_KEY
      drop_params: true
  - model_name: openai/gpt-realtime-2.1
    litellm_params:
      model: openai/gpt-realtime-2.1
      api_key: os.environ/OPENAI_API_KEY
guardrails:
  - guardrail_name: rt-content-filter
    litellm_params:
      guardrail: litellm_content_filter
      mode: realtime_input_transcription
      default_on: false
      blocked_words:
        - keyword: zebrafruit
          action: BLOCK
  - guardrail_name: rt-pre-call-filter
    litellm_params:
      guardrail: litellm_content_filter
      mode: pre_call
      default_on: false
      blocked_words:
        - keyword: zebrafruit
          action: BLOCK
general_settings:
  master_key: os.environ/LITELLM_MASTER_KEY

Each case runs rt_client.py with these flags, and a case without --text asks "What color is the sky on a clear day? One word."

idle70Vertex	--out text --order instr --wait-before-text 70
idle310Vertex	--out text --order instr --wait-before-text 310 --timeout 90
pipecatResendVertex	--out text --order resend
pipecatResendNative	--out audio --order resend --instructions 'You are a pirate. Always begin with ARRR.' --text 'Say hello to me.'
vNovaDropParams	--out audio --voice Nova --order first
pttManualVertex	--out audio --ptt manual --audio @AUDIO@ --instructions 'You are a pirate. Always begin every answer with the word ARRR. Use get_weather for weather questions.' --text unused
pttAudioVertex	--out audio --ptt no-auto-response --audio @AUDIO@ --instructions 'You are a pirate. Always begin every answer with the word ARRR. Use get_weather for weather questions.' --text unused
gaText	--out text --field output_modalities
pirate38AiStudio	--order instr --instructions 'You are a pirate. Always begin with ARRR.' --text 'Say hello to me.'
pirateNativeVertex	--order instr --instructions 'You are a pirate. Always begin with ARRR.' --text 'Say hello to me.'
guardBlockFirst	--order instr --instructions 'Answer in at most five words.' --text 'Tell me about zebrafruit.'
openaiGaText	--out text --field output_modalities
betaText	--out text --field modalities
nativeGaText	--out text --field output_modalities
nativeDropParams	--out text --field output_modalities
aiStudio38GaText	--out text --field output_modalities
twoUpdates	--out text --order two
guardTwoUpdates	--out text --order two
lateUpdate	--out text --field output_modalities --order late
badVoiceVertex	--out audio --voice Nova --order first
gaBothExtras	--out both --extras
gaInfTokens	--out text --extras --max-tokens inf
gaTextString	--out text-string
gaVideo	--out video
deferTwoUpdates	--out text --order two
deferResend	--out text --order resend
deferLateUpdate	--out text --field output_modalities --order late
controlFirstVertex	--out text --order control
pttGuardVertex	--out audio --ptt no-auto-response --audio @AUDIO@ --instructions 'You are a pirate. Always begin every answer with the word ARRR. Use get_weather for weather questions.' --text unused --timeout 25
betaHeaderText	--out text --field modalities --beta-header
deferControlFirst	--out text --order control
deferAudioFirst	--out text --ptt auto --audio @AUDIO@ --order audiofirst --instructions 'You are a pirate. Always begin every answer with the word ARRR.' --text unused
flatRefToolVertex	--out text --ref-tool --text 'What is the weather in Paris, France right now?'
flatRefTool38AiStudio	--out audio --ref-tool --text 'What is the weather in Paris, France right now?'
pipecatFirstTurnVertex	--out text --order pipecat --instructions 'You are a pirate. Always begin every answer with the word ARRR.' --text 'Say hello to me.'
pipecatFirstTurnNative	--out audio --order pipecat --instructions 'You are a pirate. Always begin every answer with the word ARRR.' --text 'Say hello to me.'
audioMidUpdateVertex	--out audio --ptt no-auto-response --audio @AUDIO@ --order audiomid --instructions 'You are a pirate. Always begin every answer with the word ARRR. Use get_weather for weather questions.' --text unused
deferPipecatFirstTurn	--out text --order pipecat --instructions 'You are a pirate. Always begin every answer with the word ARRR.' --text 'Say hello to me.'
badVoiceAiStudio	--out audio --voice Nova --order first
aiStudioNovaDropParams	--out audio --voice Nova --order first
nova38AiStudio	--out audio --voice Nova --order first

The client connects to /v1/realtime?model=... and sends session.update with {"type": "realtime", "<field>": [...], "instructions": "Answer in at most five words."}, then conversation.item.create with the text and response.create. It prints the event types with repeat counts, every session.* event's modalities, any error event, the transcript, and the response.done usage. --field picks the GA output_modalities or beta modalities key, --out both asks for text and audio, --out text-string sends the bare string "text", --out video asks for a modality Gemini Live cannot produce, --extras adds the SDK-style audio, tool, and token-limit fields, --max-tokens inf sends the OpenAI SDK default, --order two sends an instructions-only session.update before the full one, --order instr sends only the instructions, --order late sends the update after the message, --voice sets the output voice, and --wait-before-text N waits N seconds before the message. --ptt no-auto-response sets turn_detection to server VAD with create_response: false and the weather tool, streams --audio (a 24 kHz PCM clip of "What is the weather in Paris right now?" made with OpenAI gpt-4o-mini-tts) through input_audio_buffer.append, then sends input_audio_buffer.commit and response.create, and answers the tool call with a fixed forecast

The defer* cases ran on a proxy booted with LITELLM_GEMINI_LIVE_DEFER_SETUP=true, and the rest without it. --order resend sends session.update, then the item, the same session.update again, and response.create, like Pipecat. --ptt manual sends turn_detection: null, and --ptt auto sends server VAD with the default auto-response. --order control sends response.cancel before session.update, --order audiofirst streams the audio and commits before session.update, and --beta-header adds OpenAI-Beta: realtime=v1. --order pipecat sends session.update without the instructions and tools, then the item, the full session.update, and response.create, like Pipecat's first turn when its context comes after session.created. --order audiomid streams the audio between the two updates and commits after the second. --ref-tool sends a get_weather tool whose parameters use $defs, $ref, and "type": ["string", "null"]. pttGuardVertex's key carries the rt-content-filter guardrail

The client, config, case table, and runner are in this gist

Before (c98641f)

gaText

  1. Run the client with output_modalities: ["text"]
$ curl -s -X POST http://127.0.0.1:31224/key/generate -H 'Authorization: Bearer <master-key>' -d '{"key_alias": "qa-base-c98641fd5a-223127-gaText"}'   # -> <virtual-key>
$ python rt_client.py --url http://127.0.0.1:31224 --key <virtual-key> --model vertex_ai/gemini-live-2.5-flash --out text --field output_modalities --text 'What color is the sky on a clear day? One word.'
events: session.created response.created response.output_item.added conversation.item.added response.content_part.added response.output_audio_transcript.deltax2 response.output_audio.deltax4 response.output_audio.done response.content_part.done response.output_item.done response.done
session events: session.created=['audio']
transcript: Blue.
response.done status: completed usage: {"input_tokens": 13, "input_tokens_details": {"audio_tokens": null, "cached_tokens": 0, "cached_tokens_details": null, "image_tokens": null, "text_tokens": 13, "video_tokens": null}, "output_tokens": 2, "output_tokens_details": {"audio_tokens": 0, "reasoning_tokens": 0, "text_tokens": 2}, "total_tokens": 15, "cost": null, "input_token_details": {"cached_tokens": 0, "text_tokens": 13, "audio_tokens": 0}, "output_token_details": {"text_tokens": 2, "audio_tokens": 0, "reasoning_tokens": 0}}
client exit=0 wall=1s
Spend log
  1. Read the spend log
$ curl -s 'http://127.0.0.1:31224/spend/logs?api_key=<virtual-key>' -H 'Authorization: Bearer <master-key>' | jq -c '.[] | {model, spend, prompt_tokens, completion_tokens}'
{"model":"vertex_ai/gemini-live-2.5-flash","spend":0.0,"prompt_tokens":13,"completion_tokens":2}
Other cases

pttAudioVertex

  1. Create a virtual key and run the client
$ curl -s -X POST http://127.0.0.1:31224/key/generate -H 'Authorization: Bearer <master-key>' -d '{"key_alias": "qa-base-c98641fd5a-223127-pttAudioVertex"}'   # -> <virtual-key>
$ python rt_client.py --url http://127.0.0.1:31224 --key <virtual-key> --model vertex_ai/gemini-live-2.5-flash-native-audio --out audio --ptt no-auto-response --audio weather24k.pcm --instructions 'You are a pirate. Always begin every answer with the word ARRR. Use get_weather for weather questions.' --text unused
timed out after 60s
input transcript: 
events: session.created
session events: session.created=['audio']
transcript: 
function calls: none
response.done count: 0
response.done status: None usage: null
client exit=1 wall=60s
  1. Read the spend log
$ curl -s 'http://127.0.0.1:31224/spend/logs?api_key=<virtual-key>' -H 'Authorization: Bearer <master-key>' | jq -c '.[] | {model, spend, prompt_tokens, completion_tokens}'
{"model":"vertex_ai/gemini-live-2.5-flash-native-audio","spend":0.0,"prompt_tokens":0,"completion_tokens":0}

pttGuardVertex

  1. Create a virtual key, run the client, and read the spend log. Full output

betaHeaderText

  1. Create a virtual key, run the client, and read the spend log. Full output

controlFirstVertex

  1. Create a virtual key, run the client, and read the spend log. Full output

pirate38AiStudio

  1. Create a virtual key, run the client, and read the spend log. Full output

pirateNativeVertex

  1. Create a virtual key, run the client, and read the spend log. Full output

guardBlockFirst

  1. Create a virtual key, run the client, and read the spend log. Full output

openaiGaText

  1. Create a virtual key, run the client, and read the spend log. Full output

betaText

  1. Create a virtual key, run the client, and read the spend log. Full output

nativeGaText

  1. Create a virtual key, run the client, and read the spend log. Full output

nativeDropParams

  1. Create a virtual key, run the client, and read the spend log. Full output

aiStudio38GaText

  1. Create a virtual key, run the client, and read the spend log. Full output

twoUpdates

  1. Create a virtual key, run the client, and read the spend log. Full output

guardTwoUpdates

  1. Create a virtual key, run the client, and read the spend log. Full output

lateUpdate

  1. Create a virtual key and run the client
$ curl -s -X POST http://127.0.0.1:31224/key/generate -H 'Authorization: Bearer <master-key>' -d '{"key_alias": "qa-base-c98641fd5a-223127-lateUpdate"}'   # -> <virtual-key>
$ python rt_client.py --url http://127.0.0.1:31224 --key <virtual-key> --model vertex_ai/gemini-live-2.5-flash --out text --field output_modalities --order late --text 'What color is the sky on a clear day? One word.'
events: session.created response.created response.output_item.added conversation.item.added response.content_part.added response.output_audio_transcript.deltax2 response.output_audio.deltax4 response.output_audio.done response.content_part.done response.output_item.done response.done
session events: session.created=['audio']
transcript: Blue.
response.done status: completed usage: {"input_tokens": 13, "input_tokens_details": {"audio_tokens": null, "cached_tokens": 0, "cached_tokens_details": null, "image_tokens": null, "text_tokens": 13, "video_tokens": null}, "output_tokens": 2, "output_tokens_details": {"audio_tokens": 0, "reasoning_tokens": 0, "text_tokens": 2}, "total_tokens": 15, "cost": null, "input_token_details": {"cached_tokens": 0, "text_tokens": 13, "audio_tokens": 0}, "output_token_details": {"text_tokens": 2, "audio_tokens": 0, "reasoning_tokens": 0}}
client exit=0 wall=1s
  1. Read the spend log
$ curl -s 'http://127.0.0.1:31224/spend/logs?api_key=<virtual-key>' -H 'Authorization: Bearer <master-key>' | jq -c '.[] | {model, spend, prompt_tokens, completion_tokens}'
{"model":"vertex_ai/gemini-live-2.5-flash","spend":0.0,"prompt_tokens":13,"completion_tokens":2}

badVoiceVertex

  1. Create a virtual key, run the client, and read the spend log. Full output

gaBothExtras

  1. Create a virtual key, run the client, and read the spend log. Full output

gaInfTokens

  1. Create a virtual key, run the client, and read the spend log. Full output

gaTextString

  1. Create a virtual key, run the client, and read the spend log. Full output

gaVideo

  1. Create a virtual key, run the client, and read the spend log. Full output

idle70Vertex

  1. Create a virtual key, run the client, and read the spend log. Full output

idle310Vertex

  1. Create a virtual key, run the client, and read the spend log. Full output

pipecatResendVertex

  1. Create a virtual key, run the client, and read the spend log. Full output

pipecatResendNative

  1. Create a virtual key, run the client, and read the spend log. Full output

vNovaDropParams

  1. Create a virtual key, run the client, and read the spend log. Full output

pttManualVertex

  1. Create a virtual key, run the client, and read the spend log. Full output

deferTwoUpdates

  1. Create a virtual key, run the client, and read the spend log. Full output

deferResend

  1. Create a virtual key, run the client, and read the spend log. Full output

deferLateUpdate

  1. Create a virtual key, run the client, and read the spend log. Full output

deferControlFirst

  1. Create a virtual key, run the client, and read the spend log. Full output

deferAudioFirst

  1. Create a virtual key, run the client, and read the spend log. Full output

flatRefToolVertex

  1. Create a virtual key, run the client, and read the spend log. Full output

flatRefTool38AiStudio

  1. Create a virtual key, run the client, and read the spend log. Full output

pipecatFirstTurnVertex

  1. Create a virtual key, run the client, and read the spend log. Full output

pipecatFirstTurnNative

  1. Create a virtual key, run the client, and read the spend log. Full output

audioMidUpdateVertex

  1. Create a virtual key, run the client, and read the spend log. Full output

deferPipecatFirstTurn

  1. Create a virtual key, run the client, and read the spend log. Full output

badVoiceAiStudio

  1. Create a virtual key, run the client, and read the spend log. Full output

aiStudioNovaDropParams

  1. Create a virtual key, run the client, and read the spend log. Full output

nova38AiStudio

  1. Create a virtual key, run the client, and read the spend log. Full output

pgTextVoiceVertex

  1. Replay the playground's frames for a typed turn, then a recorded one. Full output

pgVoiceVertex

  1. Replay the playground's frames for a recorded turn. Full output

pgTextVoiceStudio

  1. Replay the playground's frames for a typed turn, then a recorded one. Full output

pgFableNativeVertex

  1. Replay the playground's frames for a typed turn, then a recorded one. Full output

pgOnyxNativeVertex

  1. Replay the playground's frames for a typed turn, then a recorded one. Full output

pgNovaNativeStudio

  1. Replay the playground's frames for a typed turn, then a recorded one. Full output

pgTextVoiceOpenAI

  1. Replay the playground's frames for a typed turn, then a recorded one. Full output

After (6b58477)

gaText

  1. Run the same client
$ curl -s -X POST http://127.0.0.1:31258/key/generate -H 'Authorization: Bearer <master-key>' -d '{"key_alias": "qa-head-6b58477f86-223130-gaText"}'   # -> <virtual-key>
$ python rt_client.py --url http://127.0.0.1:31258 --key <virtual-key> --model vertex_ai/gemini-live-2.5-flash --out text --field output_modalities --text 'What color is the sky on a clear day? One word.'
events: session.created session.updated response.created response.output_item.added conversation.item.added response.content_part.added response.output_text.deltax2 response.output_text.done response.content_part.done response.output_item.done response.done
session events: session.created=['audio'] session.updated=['text']
transcript: Blue.
response.done status: completed usage: {"input_tokens": 20, "input_tokens_details": {"audio_tokens": null, "cached_tokens": 0, "cached_tokens_details": null, "image_tokens": null, "text_tokens": 20, "video_tokens": null}, "output_tokens": 2, "output_tokens_details": {"audio_tokens": null, "reasoning_tokens": 0, "text_tokens": 2}, "total_tokens": 22, "cost": null, "input_token_details": {"cached_tokens": 0, "text_tokens": 20, "audio_tokens": 0}, "output_token_details": {"text_tokens": 2, "audio_tokens": 0, "reasoning_tokens": 0}}
client exit=0 wall=0s
Spend log
  1. Read the spend log
$ curl -s 'http://127.0.0.1:31258/spend/logs?api_key=<virtual-key>' -H 'Authorization: Bearer <master-key>' | jq -c '.[] | {model, spend, prompt_tokens, completion_tokens}'
{"model":"vertex_ai/gemini-live-2.5-flash","spend":0.0,"prompt_tokens":20,"completion_tokens":2}
Other cases

pttAudioVertex

  1. Create a virtual key and run the client
$ curl -s -X POST http://127.0.0.1:31258/key/generate -H 'Authorization: Bearer <master-key>' -d '{"key_alias": "qa-head-6b58477f86-223130-pttAudioVertex"}'   # -> <virtual-key>
$ python rt_client.py --url http://127.0.0.1:31258 --key <virtual-key> --model vertex_ai/gemini-live-2.5-flash-native-audio --out audio --ptt no-auto-response --audio weather24k.pcm --instructions 'You are a pirate. Always begin every answer with the word ARRR. Use get_weather for weather questions.' --text unused
input transcript: What is the weather in Paris right now?
events: session.created session.updated conversation.item.input_audio_transcription.completed response.createdx2 response.output_item.addedx2 conversation.item.addedx2 response.function_call_arguments.delta response.function_call_arguments.done response.output_item.donex2 response.donex2 response.content_part.added response.output_audio_transcript.deltax10 response.output_audio.deltax24 response.output_audio.done response.content_part.done
session events: session.created=['audio'] session.updated=['audio']
transcript: ARRR, the weather in Paris is light rain with 18 degrees Celsius!
function calls: get_weather({"city": "Paris"})
response.done count: 2
response.done status: completed usage: {"input_tokens": 176, "input_tokens_details": {"audio_tokens": 120, "cached_tokens": 0, "cached_tokens_details": null, "image_tokens": null, "text_tokens": 56, "video_tokens": null}, "output_tokens": 144, "output_tokens_details": {"audio_tokens": 127, "reasoning_tokens": 0, "text_tokens": 17}, "total_tokens": 320, "cost": null, "input_token_details": {"cached_tokens": 0, "text_tokens": 56, "audio_tokens": 120}, "output_token_details": {"text_tokens": 17, "audio_tokens": 127, "reasoning_tokens": 0}}
client exit=0 wall=6s
  1. Read the spend log
$ curl -s 'http://127.0.0.1:31258/spend/logs?api_key=<virtual-key>' -H 'Authorization: Bearer <master-key>' | jq -c '.[] | {model, spend, prompt_tokens, completion_tokens}'
{"model":"vertex_ai/gemini-live-2.5-flash-native-audio","spend":0.001946,"prompt_tokens":176,"completion_tokens":144}

pttGuardVertex

  1. Create a virtual key, run the client, and read the spend log. Full output

betaHeaderText

  1. Create a virtual key, run the client, and read the spend log. Full output

controlFirstVertex

  1. Create a virtual key, run the client, and read the spend log. Full output

pirate38AiStudio

  1. Create a virtual key, run the client, and read the spend log. Full output

pirateNativeVertex

  1. Create a virtual key, run the client, and read the spend log. Full output

guardBlockFirst

  1. Create a virtual key, run the client, and read the spend log. Full output

openaiGaText

  1. Create a virtual key, run the client, and read the spend log. Full output

betaText

  1. Create a virtual key, run the client, and read the spend log. Full output

nativeGaText

  1. Create a virtual key, run the client, and read the spend log. Full output

nativeDropParams

  1. Create a virtual key, run the client, and read the spend log. Full output

aiStudio38GaText

  1. Create a virtual key, run the client, and read the spend log. Full output

twoUpdates

  1. Create a virtual key, run the client, and read the spend log. Full output

guardTwoUpdates

  1. Create a virtual key, run the client, and read the spend log. Full output

lateUpdate

  1. Create a virtual key and run the client
$ curl -s -X POST http://127.0.0.1:31258/key/generate -H 'Authorization: Bearer <master-key>' -d '{"key_alias": "qa-head-6b58477f86-223130-lateUpdate"}'   # -> <virtual-key>
$ python rt_client.py --url http://127.0.0.1:31258 --key <virtual-key> --model vertex_ai/gemini-live-2.5-flash --out text --field output_modalities --order late --text 'What color is the sky on a clear day? One word.'
error event: {"type": "invalid_request_error", "code": "session_update_not_applied", "message": "Gemini Live accepts one session configuration per connection, and this session already sent its configuration, so this session.update was not applied. Put every setting in session.update before the first conversation content, or set drop_params to drop it instead", "param": "session", "event_id": null}
events: session.created error response.created response.output_item.added conversation.item.added response.content_part.added response.output_audio_transcript.deltax2 response.output_audio.deltax6 response.output_audio.done response.content_part.done response.output_item.done response.done
session events: session.created=['audio']
transcript: Blue.
response.done status: completed usage: {"input_tokens": 13, "input_tokens_details": {"audio_tokens": null, "cached_tokens": 0, "cached_tokens_details": null, "image_tokens": null, "text_tokens": 13, "video_tokens": null}, "output_tokens": 27, "output_tokens_details": {"audio_tokens": 25, "reasoning_tokens": 0, "text_tokens": 2}, "total_tokens": 40, "cost": null, "input_token_details": {"cached_tokens": 0, "text_tokens": 13, "audio_tokens": 0}, "output_token_details": {"text_tokens": 2, "audio_tokens": 25, "reasoning_tokens": 0}}
client exit=0 wall=1s
  1. Read the spend log
$ curl -s 'http://127.0.0.1:31258/spend/logs?api_key=<virtual-key>' -H 'Authorization: Bearer <master-key>' | jq -c '.[] | {model, spend, prompt_tokens, completion_tokens}'
{"model":"vertex_ai/gemini-live-2.5-flash","spend":0.0,"prompt_tokens":13,"completion_tokens":27}

badVoiceVertex

  1. Create a virtual key, run the client, and read the spend log. Full output

gaBothExtras

  1. Create a virtual key, run the client, and read the spend log. Full output

gaInfTokens

  1. Create a virtual key, run the client, and read the spend log. Full output

gaTextString

  1. Create a virtual key, run the client, and read the spend log. Full output

gaVideo

  1. Create a virtual key, run the client, and read the spend log. Full output

idle70Vertex

  1. Create a virtual key, run the client, and read the spend log. Full output

idle310Vertex

  1. Create a virtual key, run the client, and read the spend log. Full output

pipecatResendVertex

  1. Create a virtual key, run the client, and read the spend log. Full output

pipecatResendNative

  1. Create a virtual key, run the client, and read the spend log. Full output

vNovaDropParams

  1. Create a virtual key, run the client, and read the spend log. Full output

pttManualVertex

  1. Create a virtual key, run the client, and read the spend log. Full output

deferTwoUpdates

  1. Create a virtual key, run the client, and read the spend log. Full output

deferResend

  1. Create a virtual key, run the client, and read the spend log. Full output

deferLateUpdate

  1. Create a virtual key, run the client, and read the spend log. Full output

deferControlFirst

  1. Create a virtual key, run the client, and read the spend log. Full output

deferAudioFirst

  1. Create a virtual key, run the client, and read the spend log. Full output

flatRefToolVertex

  1. Create a virtual key, run the client, and read the spend log. Full output

flatRefTool38AiStudio

  1. Create a virtual key, run the client, and read the spend log. Full output

pipecatFirstTurnVertex

  1. Create a virtual key, run the client, and read the spend log. Full output

pipecatFirstTurnNative

  1. Create a virtual key, run the client, and read the spend log. Full output

audioMidUpdateVertex

  1. Create a virtual key, run the client, and read the spend log. Full output

deferPipecatFirstTurn

  1. Create a virtual key, run the client, and read the spend log. Full output

badVoiceAiStudio

  1. Create a virtual key, run the client, and read the spend log. Full output

aiStudioNovaDropParams

  1. Create a virtual key, run the client, and read the spend log. Full output

nova38AiStudio

  1. Create a virtual key, run the client, and read the spend log. Full output

pgTextVoiceVertex

  1. Replay the playground's frames for a typed turn, then a recorded one. Full output

pgVoiceVertex

  1. Replay the playground's frames for a recorded turn. Full output

pgTextVoiceStudio

  1. Replay the playground's frames for a typed turn, then a recorded one. Full output

pgFableNativeVertex

  1. Replay the playground's frames for a typed turn, then a recorded one. Full output

pgOnyxNativeVertex

  1. Replay the playground's frames for a typed turn, then a recorded one. Full output

pgNovaNativeStudio

  1. Replay the playground's frames for a typed turn, then a recorded one. Full output

pgTextVoiceOpenAI

  1. Replay the playground's frames for a typed turn, then a recorded one. Full output
  • gemini-live-2.5-flash spend reads 0.0 on both legs, pre-existing
  • Native-audio Vertex sometimes ends typed turns empty, both legs (runs)
/live-pr-risk at 6b58477

Breaking

Each was found at e9644a0 and fixed in 6b58477

  • The playground sent a second, different session.update when recording started, so on AI Studio gemini-3.8-live the recorded turn got session_update_not_applied and no answer (e9644a018c). It now sends one config for both turns, and both answer (pgTextVoiceStudio)
  • fable got invalid_value on Vertex native audio, though Gemini TTS maps it to Umbriel (e9644a018c), and onyx hit the same check. The Live voice check now maps OpenAI's TTS names first, and both are acked (pgFableNativeVertex, pgOnyxNativeVertex)
  • A Gemini socket that closed before a held setup went out was logged as a refused session. It now logs as a normal session. This was traced and is unit-tested only

Backward incompatible

  • The setup goes out at the first content instead of at connect, so a setup Gemini refuses errors at the first message. tin-berri approved this in the PR review at 9391a2a, which already held the setup
  • A changed late session.update gets session_update_not_applied, a modality the model cannot produce gets invalid_value (f34e5aa), and an undocumented voice gets invalid_value (58089df, ef52e61). drop_params drops each one instead, per litellm's convention for a param the provider cannot take (mateo-berri)
  • A realtime_input_transcription guardrail refuses Gemini audio with audio_input_not_screenable, where the session used to close with 1007. Fixed in ef52e61

Regression risk

  • ?intent=transcription on Gemini with a transcription guardrail now holds its setup too. No test or case drives it, and it needs a Gemini transcription client
  • input_audio_buffer.clear while audio is held, and a held setup whose send fails, have no test. Each needs a client that sends that event, or an upstream that drops the socket mid-send
  • Logs and callbacks for a rejected or unchanged session.update have no assertion. A logging callback on a lateUpdate run would show it
  • Proxy-wide litellm_settings.drop_params was traced but not run. The cases set it on the deployment

Dependency graph

Dependent State
Text and audio clients on Gemini and Vertex Verified live
Admin UI playground frames Verified live
Pipecat first turn and resends Verified live
Push-to-talk and manual VAD Verified live
pre_call and transcription guardrails Verified live
gemini_live_defer_setup mode Verified live
Spend rows per session Verified live
Realtime e2e suite, Gemini and Vertex 4 failed to 4 passed
Realtime e2e suite, deferred mode 4 passed both legs
OpenAI realtime Verified live
Meta, Soniox, Vertex Chirp, xAI, Azure Tested
Bedrock Nova Sonic rejection Tested
Vertex realtime health check Tested
SDK litellm._arealtime Tested
Outage before a held setup Tested
Gemini intent=transcription Untested
input_audio_buffer.clear while held Untested
Logs for rejected updates Untested
litellm-docs realtime pages Stale until the docs follow-up

Not verified

  • The playground in a real browser. No browser driver runs on the QA box, and the replay sends the same frames
  • The outage log fix on a real Gemini outage
  • The frames on the wire to Gemini, since the proof reads the client side only

Type

🐛 Bug Fix

Caveats (if any)

Medium

  • A changed session.update after the setup errors without drop_params, which Pipecat apps need
  • Without drop_params, text on a native-audio model rejects the whole update
  • A transcript guardrail refuses Gemini audio, and only text works
  • A setup Gemini refuses, like a wrong model, errors at the first message, not at connect

Low

Low caveats
  • AI Studio also gets the 240 s setup deadline that Vertex needs, and the deadline has no env var
  • session.updated echoes only the modalities, instructions, and model, under the beta modalities key
  • Content follows the setup without waiting for setupComplete
  • A voice outside Google's 30 documented Live voices is refused until the list is updated
  • The playground offers nova, which Gemini native audio refuses without drop_params
  • On the first turn, input audio sent while a session.update is held reaches Gemini up to 1 s later
  • A turn that ends at a tool call logs 0 tokens and no spend, and this PR changes no usage code
  • docs.litellm.ai still says session.update is ignored until a docs follow-up
  • buildkite/e2e-tests fails on every PR because its Buildkite queue is missing, and it is not required
Caveat details
  • Medium: Gemini takes one setup per connection. Updates sent before the setup goes out merge into it, including Pipecat's second update between its first items and response.create (pipecatFirstTurnVertex, pipecatFirstTurnNative). A change after that, like Pipecat's LLMSetToolsFrame adding tools mid-call or a context that arrives after the user's audio already sent the setup, gets session_update_not_applied. An unchanged resend gets session.updated (pipecatResendVertex). With drop_params: true the change is dropped and the session keeps its setup. Pipecat 1.15.0 ends the session on any error event other than a cancel, so this error and the invalid_value errors below stop a Pipecat call unless drop_params is on
  • Medium: OpenAI also rejects a whole invalid session.update (nativeGaText), and it does the same for an unknown voice. With drop_params: true only the modality is dropped and the rest applies (nativeDropParams)
  • Medium: Gemini Live sends the input transcript only after the turn ends and its answer starts, so a realtime_input_transcription guardrail cannot check audio before the model answers it. Before this PR that audio closed the session with 1007 (pttGuardVertex). Text turns still go through the guardrail
  • Medium: Gemini checks the model and the rest of the setup only when the setup goes out, so each held session.update is acked before Gemini has seen it. A wrong model name on Vertex now gets session.updated and then an error with a 1008 close at the first message, where before this PR it closed about 1 s after connect. Checking it at connect would mean sending the setup there, which is what dropped the client's session.update
  • Low: an AI Studio client whose first session.update comes after 4 minutes gets the default setup, then the late-update error. Vertex closes a socket with no setup at 300 s (idle310Vertex). A new env var needs its docs row first, and nobody asked for one
  • Low: the ack comes from the existing session.updated builder that every provider shares, so widening it is a separate change
  • Low: Gemini reads the setup and the first content in order. On direct Vertex with the same setup, typed turns ended empty 6 of 30 times with the wait and 1 of 30 without it, so waiting would not help
  • Low: Vertex and the AI Studio native-audio model close the socket with 1007 on a voice they do not know, so the list is what turns that close into an invalid_value error. With drop_params: true the voice is dropped (badVoiceVertex, vNovaDropParams, badVoiceAiStudio, aiStudioNovaDropParams). AI Studio's gemini-3.8-live accepts any name, a made-up one included, so the voice is forwarded there unchecked (nova38AiStudio)
  • Low: the playground lists OpenAI's TTS voices, and nova has no Gemini match, so a native-audio model without drop_params refuses the update and runs on its default voice (pgNovaNativeStudio). Filtering the list per provider is a separate UI change
  • Low: while a session.update is held, the first content waits up to 1 s for a following update, and response.create or any other event sends it at once. In default mode input audio waits too, so an update that arrives while the user speaks joins the setup (audioMidUpdateVertex). Deferred mode sends the setup at once when audio is buffered
  • Low: the tool-only turn's usage comes from the existing Gemini usage mapping. Tools now reach Gemini without deferred mode, so more sessions reach that path
  • Low: the e2e pipeline refuses its own upload with Queue 'litellm-e2e' does not exist, the same failure as another PR's build, before any test runs

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR
Bugbot summary

[!NOTE]
High Risk
Breaking change to core /v1/realtime session timing for Gemini/Vertex Live affects modality, billing, guardrails, and client error handling across a large proxy surface area.

Overview
Gemini and Vertex Live no longer receive a connect-time setup when builds_setup_from_session_update() is true. RealTimeStreaming holds and merges pre-content session.update frames, acks each with session.updated, then sends one setup with the first content (or after a 240s idle deadline / 1s grace while content is held). Late or invalid updates surface RealtimeSessionUpdateRejection errors (shared with Bedrock) unless drop_params drops them.

Gemini/Vertex mapping gains stricter session validation (modalities, documented voices, tools with $ref schemas), activityStart/activityEnd for manual turn detection, and refusal of audio under realtime_input_transcription guardrails via audio_input_not_screenable. Connect-time setup is unchanged for providers like Bedrock. The dashboard Realtime playground reuses one session.update (server VAD) at connect and when recording starts.

Reviewed by Cursor Bugbot for commit 9eb50c9. Bugbot is set up for automated code reviews on this repo. Configure here.

…o session.update modalities apply

Gemini and Vertex AI Live accept exactly one setup per session, and the proxy sent its
default audio setup at connect, so a client's session.update (GA output_modalities or
beta modalities) was dropped and every answer came back as audio. The setup now goes
out on the client's first message: a session.update becomes that setup, anything else
gets the model default. Bedrock Nova Sonic keeps its connect-time setup through a
provider hook. Text setups label deltas response.output_text.delta, and downgrading
TEXT to AUDIO on an audio-only model logs a warning
@greptile-apps

greptile-apps Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The current changes appear safe to merge, with no outstanding correctness or repository-rule finding identified.

Summary

This PR delays Gemini and Vertex Live setup until initial content so preceding session.update settings can be merged into the provider’s single allowed setup.

  • Applies requested modalities, instructions, tools, voices, and activity-detection settings before content.
  • Adds explicit handling for late or unsupported updates, push-to-talk activity boundaries, and transcription guardrails.
  • Preserves provider behavior for configurations that do not build setup from session updates.
  • Replaces timing-sensitive unit assertions with an injected monotonic clock and moves merge-cost tracking into CodSpeed.

Reviews (14) · Last reviewed commit: "fix(realtime): take the lazy setup clock..." · Reviewed by Greptile

@codspeed

codspeed Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 42 untouched benchmarks
🆕 1 new benchmark

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 test_merging_a_session_update_that_repeats_every_nested_level N/A 6.2 ms N/A

Comparing litellm_lit_6974_gemini_live_lazy_setup (9eb50c9) with main (e81dd34)

Open in CodSpeed

@codecov

codecov Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.06094% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
litellm/litellm_core_utils/realtime_streaming.py 97.92% 4 Missing ⚠️
litellm/llms/gemini/realtime/transformation.py 98.44% 2 Missing ⚠️
litellm/llms/base_llm/realtime/transformation.py 92.85% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

…nt frame into the Gemini Live setup

Gemini and Vertex Live accept one setup per connection, so the bridge used to
turn only the first session.update into that setup and drop the rest without
telling the client. Now every session.update that arrives before the first
content frame is held, deep-merged (later values win per field), acknowledged
with a session.updated built from the setup it would produce, and the merged
session becomes the one setup sent with the first conversation item, audio
frame, or tool result. The session events also surface the systemInstruction
text as instructions, which the old string check never matched because the
setup carries it as a Content object.
@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

…tector accepts it

_merge_session_fields recurses once per nested mapping level, so CI's
recursive_detector flagged it. Bound the descent at eight levels (the OpenAI
session object nests four deep at most), replace anything deeper wholesale
with the later session.update's value, and list the helper with the other
depth-capped functions the detector allows.
@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@mateo-berri mateo-berri added run-ci and removed run-ci labels Sep 5, 2026
…e cannot produce

A bare string output_modalities is read as a one-element list and modality values Gemini Live cannot produce are dropped with a warning instead of reaching the backend, so a malformed session.update no longer costs the session. Transcription guardrails now fold their VAD disable into the first held session.update only, so the merged setup carries it exactly once.
@mateo-berri mateo-berri added run-ci and removed run-ci labels Sep 5, 2026
@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@mateo-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@tin-berri tin-berri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@yuneng-berri
yuneng-berri deleted the branch main September 13, 2026 04:49
auto-merge was automatically disabled September 13, 2026 04:49

Pull request was closed

@mateo-berri mateo-berri reopened this Sep 13, 2026
@mateo-berri
mateo-berri changed the base branch from litellm_internal_staging to main September 13, 2026 05:14
@aniruddhad-max

Copy link
Copy Markdown

Thanks for this fix — I believe we're hitting the behaviour it describes, and would like to confirm which release contains it.
Symptom: session.update is silently ignored for Gemini realtime models on our proxy — no session.updated, no error, no effect. The same event on openai/gpt-realtime-mini, same proxy and key, is acknowledged and applied.

Reproduced on gemini/gemini-3.8-live, gemini/gemini-3.1-flash-live-preview and vertex_ai/gemini-live-2.5-flash-native-audio.

Repro: connect to /v1/realtime?model=gemini/gemini-3.1-flash-live-preview, send session.update with instructions: "You are a pirate. Always begin with ARRR." as the client's first message, then conversation.item.create + response.create. Gemini replies as a generic assistant; the same sequence on gpt-realtime-mini replies "ARRR…". Same result via raw websockets and the OpenAI SDK.

Questions:

  1. Which release version includes this fix?
  2. Is there any config that would retain the old connect-time setup behaviour after upgrading?

Separately: would you accept a PR adding context_window_compression to the Gemini realtime supported params? It's currently dropped silently. Happy to submit it in the same shape as #41408.

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

…ni_live_lazy_setup

# Conflicts:
#	litellm/litellm_core_utils/realtime_streaming.py
#	litellm/llms/custom_httpx/llm_http_handler.py
…p outage spend rows, share the playground session config

The Live voice gate now judges the Gemini voice an OpenAI TTS name maps to, so fable and onyx reach Vertex as Umbriel and Orus again. An upstream close before the held setup was sent is logged as a session, not a refusal. The playground sends one server_vad session config for typed and voice turns, and the e2e, integration, and dashboard tests follow lazy setup.
@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

… run on a stepped clock

The deadline and grace tests waited on real 50 ms timers, and the merge cost
check compared wall-clock runs. The session now reads an injected clock,
time.monotonic by default, the two tests step it, and the merge cost check
moves to the CodSpeed benchmarks. The Nova Sonic style handler test passes
the backend through wrap_backend, which main added after the test was written
@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@mateo-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@mateo-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 9eb50c9. Configure here.

@mateo-berri
mateo-berri merged commit 4c8b909 into main Oct 30, 2026
96 of 97 checks passed
@mateo-berri
mateo-berri deleted the litellm_lit_6974_gemini_live_lazy_setup branch October 30, 2026 08:31
yuneng-berri added a commit that referenced this pull request Oct 30, 2026
…ed changes (#49310)

Seven integration tests fail on main for reasons that are not product bugs. Two are order or race bugs in the tests, one reads rows other tests wrote, one passed on an error body, and three still expect behavior that #48644, #39864 and #39540 changed on purpose
tech-carrement added a commit to tech-carrement/litellm that referenced this pull request Nov 21, 2026
BerriAI#39864 holds client content until the first setup and sends it right after the
setup; Gemini Live still drops what reaches it before setupComplete, so that
content now waits with the other pending frames. The barge-in speech_started is
emitted once per open response, ahead of the close events BerriAI#39864 added, and the
manual-activity activityEnd counts as the generation request.
tech-carrement added a commit to tech-carrement/litellm that referenced this pull request Nov 21, 2026
… covers

Since BerriAI#39864 the Gemini Live setup goes out with the first content, and a client
that sends session.update, an item and response.create back to back is answered
20 times out of 20 against Vertex eu (gemini-3.8-live) on main. The explicit
response.create of the transcription-guardrail test now hands the floor to the
model, per the response.create fix of this branch.
tech-carrement added a commit to tech-carrement/litellm that referenced this pull request Nov 21, 2026
…etes

Since BerriAI#39864 the setup goes out with the first content and the content follows
right away. An audio setup completes fast enough, but a Live Avatar (video)
setup does not: Gemini answers the first item with the text "Error: Session is
not set up yet" and drops it. Every client frame except the session.update that
triggers the setup, held content included, now waits for setupComplete.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:high Sensitive, broad, or high-risk change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Gemini/Vertex Realtime silently drops client tools and instructions with eager setup

5 participants