From 2d515e72ffa43ef6799118a839b320c262b65592 Mon Sep 17 00:00:00 2001 From: Ifta Khairul Alam Adil Date: Wed, 27 Aug 2025 11:53:47 +0200 Subject: [PATCH] refactor: simplify URL construction for Gemini image generation - Remove unnecessary model name prefix stripping - Directly use the model name in the API URL construction This change streamlines the URL generation process for the Google AI API, ensuring compatibility with model names without the 'gemini/' prefix. Signed-off-by: Ifta Khairul Alam Adil --- litellm/llms/gemini/image_generation/transformation.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/litellm/llms/gemini/image_generation/transformation.py b/litellm/llms/gemini/image_generation/transformation.py index 30799991d3..a78a5b9dda 100644 --- a/litellm/llms/gemini/image_generation/transformation.py +++ b/litellm/llms/gemini/image_generation/transformation.py @@ -88,18 +88,15 @@ class GoogleImageGenConfig(BaseImageGenerationConfig): Google AI API format: https://generativelanguage.googleapis.com/v1beta/models/{model}:predict """ - from litellm.llms.gemini.common_utils import GeminiModelInfo - + complete_url: str = ( api_base or get_secret_str("GEMINI_API_BASE") or self.DEFAULT_BASE_URL ) - # Strip the "gemini/" prefix from the model name for the API call - base_model = GeminiModelInfo.get_base_model(model) or model complete_url = complete_url.rstrip("/") - complete_url = f"{complete_url}/models/{base_model}:predict" + complete_url = f"{complete_url}/models/{model}:predict" return complete_url def validate_environment(