尝试传入自定义base_url(实验性)

pull/1246/head
foxplaying 2025-09-21 20:39:12 +08:00 committed by GitHub
parent 0e0179fcd2
commit b7a6042dd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 0 deletions

View File

@ -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,12 @@ class GeminiClient(BaseClient):
api_key=api_provider.api_key,
) # 这里和openai不一样gemini会自己决定自己是否需要retry
if hasattr(api_provider, "base_url") and api_provider.base_url:
genai_base_url.set_default_base_urls(
gemini_url=api_provider.base_url,
vertex_url=None # 不修改 Vertex URL
) # 尝试传入自定义base_url(实验性必须为gemini格式)
@staticmethod
def clamp_thinking_budget(tb: int, model_id: str) -> int:
"""