From 7dc4d6b0efc190ed5293867f4c5271521f922749 Mon Sep 17 00:00:00 2001 From: austin362667 Date: Sun, 5 Apr 2026 08:20:16 +0800 Subject: [PATCH 1/3] add gemini api client --- agent/api.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/agent/api.py b/agent/api.py index 0ef42d2..0921f8e 100644 --- a/agent/api.py +++ b/agent/api.py @@ -5,6 +5,7 @@ import anthropic import openai +from google import genai logger = logging.getLogger(__name__) @@ -35,6 +36,14 @@ def create_inference_server(api_type: str): if not api_key and not auth_token: _require_env(["ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"], api_type) return anthropic.Anthropic(api_key=api_key, auth_token=auth_token) + elif api_type in ("gemini", "google"): + api_key = os.environ.get("GEMINI_API_KEY") + if not api_key: + _require_env(["GEMINI_API_KEY"], api_type) + return openai.OpenAI( + api_key=_require_env(["GEMINI_API_KEY"], api_type), + base_url=os.environ.get("GEMINI_BASE_URL", "https://generativelanguage.googleapis.com/v1beta/openai/"), + ) else: raise ValueError(f"Unsupported api_type: {api_type}") From 84dc076cbd8127db7b8439a09923f256a4a7502f Mon Sep 17 00:00:00 2001 From: austin362667 Date: Mon, 6 Apr 2026 04:20:07 +0800 Subject: [PATCH 2/3] remove google genai python package --- agent/api.py | 1 - 1 file changed, 1 deletion(-) diff --git a/agent/api.py b/agent/api.py index 0921f8e..af17139 100644 --- a/agent/api.py +++ b/agent/api.py @@ -5,7 +5,6 @@ import anthropic import openai -from google import genai logger = logging.getLogger(__name__) From 43f14476a8d1478b3aef2c7fc6f13debb51834d4 Mon Sep 17 00:00:00 2001 From: austin362667 Date: Mon, 6 Apr 2026 04:23:25 +0800 Subject: [PATCH 3/3] add gemini `api_type` choice --- agent/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/main.py b/agent/main.py index b377732..8bc4db5 100644 --- a/agent/main.py +++ b/agent/main.py @@ -183,7 +183,7 @@ def run_main_loop(args): # Base Model Configs parser.add_argument( - "--api_type", type=str, default="openai", choices=["openai", "claude"] + "--api_type", type=str, default="openai", choices=["openai", "claude", "gemini"] ) parser.add_argument("--model_name", type=str, default="gpt-5-mini") parser.add_argument("--temperature", type=float, default=0.6)