Repository navigation
Conversation
Greptile SummaryThis PR prevents multimodal embedding inputs from being charged using both token and physical-unit rates.
Confidence Score: 5/5The PR appears safe to merge; the current commit keeps the generated schema synchronized and the single-charge modality behavior is covered across relevant fallback and zero-rate cases. No actionable new failures remain in the changes since the previous review, and no mounted repository-rule violations were identified.
|
| Filename | Overview |
|---|---|
| litellm/litellm_core_utils/llm_cost_calc/utils.py | Introduces mutually exclusive token-or-physical-unit modality charging while preserving explicit zero rates and generic token fallback. |
| litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_transformation.py | Preserves image and video token metadata and removes the artificial text-token floor. |
| model_prices_and_context_window.json | Adds published modality token rates across the intended Gemini Embedding 2 aliases. |
| model_prices_and_context_window.schema.json | Adds the generated nonnegative-number schema property for video token pricing, consistent with the pricing source. |
| tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py | Adds a pricing matrix covering token preference, unit fallback, explicit zero rates, generic fallback, and cached audio. |
| tests/test_litellm/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.py | Expands modality usage and exact-cost regressions across six Gemini and Vertex model/provider combinations. |
Reviews (2): Last reviewed commit: "fix(cost): avoid double billing Gemini e..." | Re-trigger Greptile
8fb0328 to
c698972
Compare
|
@greptileai Please review the current commit c698972, including the generated pricing schema and the single-charge modality regressions |
|
bugbot run Please review c698972 for pricing correctness, fallback behavior, cached audio accounting, and the generated schema update |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
✅ 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 c698972. Configure here.
TLDR
Problem this solves:
How it solves it:
User Flow
Before: 64 audio tokens representing two seconds cost $0.000736
{"cost":0.000736}After: the same usage costs $0.000416 at Google's token rate
{"cost":0.000416}Relevant issues
Affected release
Linear ticket
Changes
Pre-Submission checklist
Screenshots / Proof of Fix
Real local proxy and Postgres, using
/spend/calculatewith example usage and each commit's bundled pricesSave as
audio-request.json:{"completion_response":{"model":"vertex_ai/gemini-embedding-2","usage":{"prompt_tokens":64,"completion_tokens":0,"total_tokens":64,"prompt_tokens_details":{"text_tokens":0,"audio_tokens":64,"audio_length_seconds":2}}}}Before (d1fc231)
Send the request
HTTP 200:
{"cost":0.000736}After (c698972)
Send the same request
HTTP 200:
{"cost":0.000416}Type
Bug Fix
Caveats
Low
Final Attestation