Skip to content

feat(pricing): add gemini-live-2.5-flash-native-audio to model cost map - #38573

Closed
mubashir1osmani wants to merge 6 commits into
BerriAI:litellm_internal_stagingfrom
mubashir1osmani:litellm_gemini_live_native_audio_pricing
Closed

feat(pricing): add gemini-live-2.5-flash-native-audio to model cost map#38573
mubashir1osmani wants to merge 6 commits into
BerriAI:litellm_internal_stagingfrom
mubashir1osmani:litellm_gemini_live_native_audio_pricing

Conversation

@mubashir1osmani

@mubashir1osmani mubashir1osmani commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • vertex_ai/gemini-live-2.5-flash-native-audio logged zero usage and $0 spend
  • The model was missing from the cost map entirely
  • Missing entry also meant TEXT modality was never coerced to AUDIO, so sessions hung

How it solves it:

  • Adds the vertex_ai and gemini entries with GA pricing and gemini_native_audio: true
  • Adds chirp-3 and veo-3.1-lite-generate-001 for vertex_ai in the same pass
  • Native-audio detection now resolves the model, so responseModalities is coerced to AUDIO
  • Carries the same caching and search-grounding costs as the preview alias of the same model

User Flow

Before: a proxy operator using vertex_ai/gemini-live-2.5-flash-native-audio sees no usage logged

  1. Client connects to wss://litellm-domain/v1/realtime?model=vertex_ai/gemini-live-2.5-flash-native-audio
  2. Client sends session.update with modalities: ["text"]
  3. The session never completes a turn, so no response.done arrives
  4. https://litellm-domain/ui/?page=logs shows the request at $0 spend with no token counts

After: the same connection produces a completed response with real usage

  1. Client connects to wss://litellm-domain/v1/realtime?model=vertex_ai/gemini-live-2.5-flash-native-audio
  2. Client sends session.update with modalities: ["text"]
  3. response.done arrives with non-zero audio token counts
  4. https://litellm-domain/ui/?page=logs shows the request at non-zero spend, billed at $3.00/M audio in and $12.00/M audio out

Relevant issues

Linear ticket

Pre-Submission checklist

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/test_litellm/<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
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Screenshots / Proof of Fix

Proof requires a live proxy with this model deployed; connecting once it is available on the gateway

Type

🐛 Bug Fix

Caveats (if any)

Low

  • Gemini-provider tpm/rpm copied from the dated preview alias of the same model

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

Missing entry caused a cascade: _model_cost_entry returned {} for
vertex_ai/gemini-live-2.5-flash-native-audio, so _is_audio_only_live_model
returned False, _coerce_response_modalities never coerced TEXT -> AUDIO in
the Vertex setup message, the session hung, and no usage was ever logged.

Add bare key (vertex_ai-language-models provider) and gemini/ prefixed key
(gemini provider) with GA pricing: $0.50/M text in, $3.00/M audio in,
$2.00/M text out, $12.00/M audio out, gemini_native_audio=true.

Also extend the existing parametrized tests to assert the vertex_ai/ prefix
resolves correctly through _model_cost_entry's stripped-prefix fallback.
…ex_ai/chirp-3, vertex_ai/veo-3.1-lite-generate-001
Resolved conflicts in both pricing JSON files (kept our /v1/realtime
endpoint addition for vertex_ai entry, plus adopted upstream's
supports_prompt_caching and search_context_cost_per_query additions).

Also adopted upstream's transformation.py refactor (which dropped
_is_native_audio_model), updated tests accordingly: removed the stale
test for the now-absent method, added a catalog regression test that
reads the JSON file directly instead of relying on the mocked fixture.
@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds Gemini Live 2.5 Flash native-audio catalog metadata so realtime model detection and audio-token spend calculation recognize the GA model.

  • Adds the Gemini-prefixed model entry with native-audio capability and GA pricing metadata.
  • Advertises /v1/realtime support on the Vertex AI catalog entry.
  • Extends realtime transformation tests to cover bare, Gemini-prefixed, and Vertex-prefixed model names.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
model_prices_and_context_window.json Adds the Gemini API catalog entry and realtime endpoint metadata for the GA native-audio model; no blocking issue identified.
litellm/model_prices_and_context_window_backup.json Keeps the packaged fallback catalog synchronized with the primary model-cost map.
tests/test_litellm/llms/gemini/realtime/test_gemini_realtime_transformation.py Adds catalog-presence and audio-only detection coverage for the new model spellings.

Reviews (2): Last reviewed commit: "fix(pricing): add tpm/rpm to gemini/gemi..." | Re-trigger Greptile

@mubashir1osmani

Copy link
Copy Markdown
Contributor Author

bugbot run

@mubashir1osmani

Copy link
Copy Markdown
Contributor Author

@greptile-apps

@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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8fa9622. Configure here.

"supports_vision": true,
"supports_web_search": true,
"tpm": 8000000,
"gemini_native_audio": true

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.

Gemini catalog entry missing sibling cost fields

Medium Severity

The new gemini/gemini-live-2.5-flash-native-audio entry sets supports_web_search to true but omits search_context_cost_per_query, and also drops supports_prompt_caching. Both the Vertex GA twin and the Gemini preview alias include those fields, so search grounding on this alias is billed at $0 and caching is treated as unsupported.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8fa9622. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, fixed in d517397. Added cache_read_input_token_cost, supports_prompt_caching, and search_context_cost_per_query, matching the preview alias and both Vertex twins.

@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed-hq

codspeed-hq Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing mubashir1osmani:litellm_gemini_live_native_audio_pricing (d517397) with litellm_internal_staging (67c7b97)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_internal_staging (7083c47) during the generation of this report, so 67c7b97 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Superseded by the rolling registry PR #38693, which absorbs this change (core pricing verified against https://ai.google.dev/gemini-api/docs/pricing; cache_read/tpm/rpm dropped as not published there). Standing policy: one open model-pricing registry PR at a time.

pull Bot pushed a commit to chizee/litellm that referenced this pull request Aug 29, 2026
… native audio (from BerriAI#38573), anthropic sources

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.

1 participant