mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
For non-Anthropic models served over /v1/messages, the outer wrapper recomputes cost over the adapter-translated Anthropic response dict. That dict dropped every web search usage signal, so the recompute overwrote the correct cost breakdown with a token-only one: x-litellm-response-cost-tool-usage read 0.0 and x-litellm-response-cost-original excluded the search cost, while the total kept it. The adapter now maps web search request counts (from Usage.server_tool_use or Gemini's prompt_tokens_details) into usage.server_tool_use.web_search_requests, matching the Anthropic API shape, and the Gemini web search cost calculator falls back to server_tool_use when prompt_tokens_details carries no count. The shared get_web_search_requests helper is now public since five modules consume it. Resolves LIT-6288 |
||
|---|---|---|
| .. | ||
| files | ||
| image_edit | ||
| realtime | ||
| videos | ||
| __init__.py | ||
| test_cost_calculator.py | ||
| test_gemini_client_setup.py | ||
| test_gemini_common_utils.py | ||
| test_gemini_image_generation_transformation.py | ||
| test_gemini_tts.py | ||