litellm/tests/test_litellm/llms/gemini
Sameer Kankute 87cf67ec30
feat(gemini): forward web search tools in image generation (#30119)
* feat(gemini): forward web search tools in image generation

Map tools and web_search_options to googleSearch on Gemini image
generateContent requests for Google AI Studio and Vertex AI.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(gemini): dedupe image search tools and return mapped params

Skip web_search_options when tools already include search, dedupe search
tool entries, and assign the return value from map_gemini_image_tools_params.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(gemini): preserve toolConfig side-effects in image tool mapping

* fix(gemini): forward toolConfig in image generation request body

* fix(gemini): track web search grounding cost on image generation

Forwarding Google Search grounding to Gemini and Vertex image
generation previously incurred billable grounding charges that never
reached LiteLLM spend tracking, because the image cost path returns
through the Gemini/Vertex image calculators before built-in tool spend
is added. Carry the grounding request count from the response onto the
image usage object and bill it with the same per-request web search
accounting used for chat completions.

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-06-12 07:24:36 -07:00
..
files test: document gemini file URI handling 2026-04-29 22:38:56 -07:00
image_edit Litellm oss staging 030626 (#29578) 2026-06-03 11:01:51 -07:00
realtime fix(gemini-live): forward audio buffer commit and correct Vertex PCM rate (#29946) 2026-06-11 22:00:15 -07:00
videos Litellm oss staging 040626 (#29671) 2026-06-04 11:07:20 -07:00
__init__.py fix(tests): stabilize 3 failing CI tests 2026-03-13 00:26:31 +00:00
test_cost_calculator.py feat(gemini): forward web search tools in image generation (#30119) 2026-06-12 07:24:36 -07:00
test_gemini_client_setup.py Fix/gemini api key environment variable support (#12507) 2025-07-29 15:56:01 -07:00
test_gemini_common_utils.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_gemini_image_generation_transformation.py feat(gemini): forward web search tools in image generation (#30119) 2026-06-12 07:24:36 -07:00
test_gemini_tts.py Litellm oss staging 080626 (#29932) 2026-06-08 13:49:52 -07:00