From 74183ff07941be4b2cf27af3402b6c9fd62f32fa Mon Sep 17 00:00:00 2001 From: foxplaying <166147707+foxplaying@users.noreply.github.com> Date: Sun, 21 Sep 2025 20:56:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BC=A0=E5=85=A5=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89base=5Furl(=E5=AE=9E=E9=AA=8C=E6=80=A7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/llm_models/model_client/gemini_client.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/llm_models/model_client/gemini_client.py b/src/llm_models/model_client/gemini_client.py index e58466d1..237d0724 100644 --- a/src/llm_models/model_client/gemini_client.py +++ b/src/llm_models/model_client/gemini_client.py @@ -4,6 +4,7 @@ import base64 from typing import Callable, AsyncIterator, Optional, Coroutine, Any, List from google import genai +from google.genai import _base_url as genai_base_url from google.genai.types import ( Content, Part, @@ -349,6 +350,11 @@ class GeminiClient(BaseClient): api_key=api_provider.api_key, ) # 这里和openai不一样,gemini会自己决定自己是否需要retry + # 尝试传入自定义base_url(实验性,必须为Gemini格式) + if hasattr(api_provider, "base_url") and api_provider.base_url: + self.base_url = api_provider.base_url + self.client._api_client._base_url = self.base_url + @staticmethod def clamp_thinking_budget(tb: int, model_id: str) -> int: """