summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/needs_auth
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-04-17 10:43:11 +0200
committerGitHub <noreply@github.com>2024-04-17 10:43:11 +0200
commit6afc6722a05f6d4498e6dcf19a7689ad58ffd444 (patch)
tree7b8ab362992408b78838df82a5172be15272a485 /g4f/Provider/needs_auth
parentMerge pull request #1833 from hlohaus/curl (diff)
parentFix style.css (diff)
downloadgpt4free-6afc6722a05f6d4498e6dcf19a7689ad58ffd444.tar
gpt4free-6afc6722a05f6d4498e6dcf19a7689ad58ffd444.tar.gz
gpt4free-6afc6722a05f6d4498e6dcf19a7689ad58ffd444.tar.bz2
gpt4free-6afc6722a05f6d4498e6dcf19a7689ad58ffd444.tar.lz
gpt4free-6afc6722a05f6d4498e6dcf19a7689ad58ffd444.tar.xz
gpt4free-6afc6722a05f6d4498e6dcf19a7689ad58ffd444.tar.zst
gpt4free-6afc6722a05f6d4498e6dcf19a7689ad58ffd444.zip
Diffstat (limited to 'g4f/Provider/needs_auth')
-rw-r--r--g4f/Provider/needs_auth/Gemini.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/g4f/Provider/needs_auth/Gemini.py b/g4f/Provider/needs_auth/Gemini.py
index fc9d9575..ebf5f413 100644
--- a/g4f/Provider/needs_auth/Gemini.py
+++ b/g4f/Provider/needs_auth/Gemini.py
@@ -60,6 +60,7 @@ class Gemini(AsyncGeneratorProvider):
model: str,
messages: Messages,
proxy: str = None,
+ api_key: str = None,
cookies: Cookies = None,
connector: BaseConnector = None,
image: ImageType = None,
@@ -67,6 +68,10 @@ class Gemini(AsyncGeneratorProvider):
**kwargs
) -> AsyncResult:
prompt = format_prompt(messages)
+ if api_key is not None:
+ if cookies is None:
+ cookies = {}
+ cookies["__Secure-1PSID"] = api_key
cookies = cookies if cookies else get_cookies(".google.com", False, True)
base_connector = get_connector(connector, proxy)
async with ClientSession(