mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-28 01:32:17 +00:00
Both from the automated review on #40617, both real. Vertex never recorded the declared rate. VertexAIRealtimeConfig handles session.update in its own transform_realtime_request and returns without reaching the parent's _handle_session_update, so the recording call added in the previous commit never ran on that path and a Vertex client's declaration was silently discarded. Recorded in the Vertex branch too, before the first-setup/subsequent-setup split, matching where the parent records it. A later declaration could reprice audio already sent. The estimate accumulated raw bytes and divided by the rate current at consume time, so a client could stream at 16kHz and then declare 24kHz before the estimate was read, billing two thirds of what it actually sent while the backend processed all of it. Audio is now converted to seconds at append time, at the rate in force when the chunk arrived, so a mid-stream redeclaration cannot reach backwards. Mixed-rate sessions bill each chunk at its own rate. Also bounded the accepted rate to 8000-48000 Hz. The value is client-controlled and now feeds the spend estimate directly; an unclamped declaration of 100 MHz would bill a long session as a few milliseconds. Out-of-range declarations are ignored with a warning and the native default stands. 6 tests added or extended, each verified to fail without these changes. tests/test_litellm/llms/{gemini,vertex_ai}/realtime: 103 passed. |
||
|---|---|---|
| .. | ||
| a2a_protocol | ||
| anthropic_interface | ||
| batches | ||
| chat_completions | ||
| completion_extras | ||
| compression | ||
| endpoints | ||
| enterprise | ||
| integrations | ||
| litellm_core_utils | ||
| llms | ||
| messages | ||
| models | ||
| ocr | ||
| passthrough | ||
| rag | ||
| realtime_api | ||
| repositories | ||
| router_strategy | ||
| router_utils | ||
| rust_bridge | ||
| sandbox | ||
| skills | ||
| test_router | ||
| types | ||
| videos | ||
| __init__.py | ||
| AGENTS.md | ||
| conftest.py | ||
| test_package_layout.py | ||
| test_socket_policy.py | ||