diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-04-17 10:43:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-17 10:43:11 +0200 |
commit | 6afc6722a05f6d4498e6dcf19a7689ad58ffd444 (patch) | |
tree | 7b8ab362992408b78838df82a5172be15272a485 /g4f/Provider/needs_auth/Gemini.py | |
parent | Merge pull request #1833 from hlohaus/curl (diff) | |
parent | Fix style.css (diff) | |
download | gpt4free-0.2.9.10.tar gpt4free-0.2.9.10.tar.gz gpt4free-0.2.9.10.tar.bz2 gpt4free-0.2.9.10.tar.lz gpt4free-0.2.9.10.tar.xz gpt4free-0.2.9.10.tar.zst gpt4free-0.2.9.10.zip |
Diffstat (limited to 'g4f/Provider/needs_auth/Gemini.py')
-rw-r--r-- | g4f/Provider/needs_auth/Gemini.py | 5 |
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( |