diff --git a/cli/utils.py b/cli/utils.py index 62b50c9c..290a4b67 100644 --- a/cli/utils.py +++ b/cli/utils.py @@ -192,7 +192,7 @@ def select_llm_provider() -> tuple[str, str]: # Define OpenAI api options with their corresponding endpoints BASE_URLS = [ ("OpenAI", "https://api.openai.com/v1"), - ("Google", "https://generativelanguage.googleapis.com/v1"), + ("Google", None), # google-genai SDK manages its own endpoint internally ("Anthropic", "https://api.anthropic.com/"), ("xAI", "https://api.x.ai/v1"), ("Openrouter", "https://openrouter.ai/api/v1"), diff --git a/tradingagents/llm_clients/google_client.py b/tradingagents/llm_clients/google_client.py index 48055560..baa31add 100644 --- a/tradingagents/llm_clients/google_client.py +++ b/tradingagents/llm_clients/google_client.py @@ -28,10 +28,8 @@ class GoogleClient(BaseLLMClient): self.warn_if_unknown_model() llm_kwargs = {"model": self.model} - # base_url is intentionally NOT passed to ChatGoogleGenerativeAI. - # The google-genai SDK manages its own endpoint and API versioning internally. - # Passing a base_url (e.g. https://generativelanguage.googleapis.com/v1) - # causes 404s because the SDK appends its own paths onto the override URL. + if self.base_url: + llm_kwargs["base_url"] = self.base_url for key in ("timeout", "max_retries", "callbacks", "http_client", "http_async_client"): if key in self.kwargs: