Skip to content

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

Closed
mubashir1osmani wants to merge 4 commits into
litellm_internal_stagingfrom
litellm_gemini_live_native_audio_pricing
Closed

mubashir1osmani wants to merge 4 commits into
litellm_internal_stagingfrom
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 on every request
  • The model was absent from the pricing JSON, causing a cascade: TEXT modality was never coerced to AUDIO in the Vertex setup message, so the session hung and never produced a response.done

How it solves it:

  • Adds gemini-live-2.5-flash-native-audio (vertex_ai-language-models provider) and gemini/gemini-live-2.5-flash-native-audio (gemini provider) with GA pricing and gemini_native_audio: true to both the primary and backup cost map files
  • Existing _model_cost_entry fallback (strip vertex_ai/ prefix, look up bare key) now resolves the model correctly

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://proxy/v1/realtime?model=vertex_ai/gemini-live-2.5-flash-native-audio
  2. Client sends session.update with modalities: ["text"]
  3. Proxy forwards responseModalities: ["TEXT"] to Vertex AI (native-audio model only supports AUDIO), session never completes a turn
  4. response.done never arrives, usage field is null, spend logged as $0

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

  1. Client connects to wss://proxy/v1/realtime?model=vertex_ai/gemini-live-2.5-flash-native-audio
  2. Client sends session.update with modalities: ["text"]
  3. Proxy detects the model as native-audio-only (via the new pricing entry) and coerces to responseModalities: ["AUDIO"]
  4. response.done arrives with non-zero audio token counts; spend is logged at the published rate ($3.00/M audio in, $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; connect below once it's available on the gateway.

Type

🐛 Bug Fix

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

Note

Low Risk
Changes are limited to pricing JSON and test coverage; runtime behavior depends on existing cost-map lookup and modality coercion with no new code paths.

Overview
Registers gemini-live-2.5-flash-native-audio in the LiteLLM pricing catalog so realtime proxy sessions can resolve the model, bill audio tokens correctly, and treat it as native-audio-only when building Gemini Live setup messages.

The vertex catalog entry now lists /v1/realtime alongside /vertex_ai/live, and a new gemini/gemini-live-2.5-flash-native-audio entry adds GA Gemini API pricing with gemini_native_audio: true. The same updates are mirrored in the backup JSON. Existing _model_cost_entry lookup (strip provider prefix → bare key) lets vertex_ai/gemini-live-2.5-flash-native-audio pick up that flag so _coerce_response_modalities rewrites client text modalities to AUDIO instead of forwarding invalid TEXT to Vertex.

Tests extend the realtime transformation fixtures to cover the new model IDs and assert both catalog keys exist with gemini_native_audio set.

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

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
@greptile-apps

greptile-apps Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds Gemini Live 2.5 Flash native-audio pricing and capability metadata to the primary and backup model catalogs, adds realtime endpoint support, and extends Gemini realtime regression coverage.

  • Registers bare Vertex AI and prefixed Gemini model entries with native-audio pricing and capability flags.
  • Verifies native-audio detection for 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 Live native-audio provider entry and realtime endpoint metadata consistently with the intended request and spend behavior.
litellm/model_prices_and_context_window_backup.json Mirrors the primary catalog changes for local and remote-fetch fallback runtime operation.
tests/test_litellm/llms/gemini/realtime/test_gemini_realtime_transformation.py Extends native-audio detection and directly checks the primary catalog.

Reviews (2): Last reviewed commit: "merge(staging): merge litellm_internal_s..." | Re-trigger Greptile

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

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

✅ 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 a5bef3f. Configure here.

@codspeed

codspeed Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_gemini_live_native_audio_pricing (a5bef3f) with litellm_internal_staging (ca9007b)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_internal_staging (fe87b18) during the generation of this report, so ca9007b 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 (duplicate of #38573, absorbed there). Standing policy: one open model-pricing registry PR at a time.

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