diff options
author | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-04-17 10:33:23 +0200 |
---|---|---|
committer | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-04-17 10:33:23 +0200 |
commit | a2b5446b2e449f3107d9980d8eaac0a3ae07730f (patch) | |
tree | ce1b1b8dc647d39f88242220db30c3636047d2fa /g4f/Provider/needs_auth/Gemini.py | |
parent | add cohere provider. (diff) | |
download | gpt4free-a2b5446b2e449f3107d9980d8eaac0a3ae07730f.tar gpt4free-a2b5446b2e449f3107d9980d8eaac0a3ae07730f.tar.gz gpt4free-a2b5446b2e449f3107d9980d8eaac0a3ae07730f.tar.bz2 gpt4free-a2b5446b2e449f3107d9980d8eaac0a3ae07730f.tar.lz gpt4free-a2b5446b2e449f3107d9980d8eaac0a3ae07730f.tar.xz gpt4free-a2b5446b2e449f3107d9980d8eaac0a3ae07730f.tar.zst gpt4free-a2b5446b2e449f3107d9980d8eaac0a3ae07730f.zip |
Diffstat (limited to '')
-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( |