diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-02-29 16:26:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-29 16:26:47 +0100 |
commit | b10516a5121567aaef2f5d5c32e5c005d36ba82b (patch) | |
tree | 552533c44ebdd63263395b492bf78246ae56e1c5 /g4f/api/__init__.py | |
parent | Update OpenaiChat.py (diff) | |
parent | Ignore empty auth header in api (diff) | |
download | gpt4free-b10516a5121567aaef2f5d5c32e5c005d36ba82b.tar gpt4free-b10516a5121567aaef2f5d5c32e5c005d36ba82b.tar.gz gpt4free-b10516a5121567aaef2f5d5c32e5c005d36ba82b.tar.bz2 gpt4free-b10516a5121567aaef2f5d5c32e5c005d36ba82b.tar.lz gpt4free-b10516a5121567aaef2f5d5c32e5c005d36ba82b.tar.xz gpt4free-b10516a5121567aaef2f5d5c32e5c005d36ba82b.tar.zst gpt4free-b10516a5121567aaef2f5d5c32e5c005d36ba82b.zip |
Diffstat (limited to 'g4f/api/__init__.py')
-rw-r--r-- | g4f/api/__init__.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/g4f/api/__init__.py b/g4f/api/__init__.py index f8d0b4af..d8e68bed 100644 --- a/g4f/api/__init__.py +++ b/g4f/api/__init__.py @@ -85,7 +85,9 @@ class Api: if config.api_key is None and request is not None: auth_header = request.headers.get("Authorization") if auth_header is not None: - config.api_key = auth_header.split(None, 1)[-1] + auth_header = auth_header.split(None, 1)[-1] + if auth_header and auth_header != "Bearer": + config.api_key = auth_header response = self.client.chat.completions.create( **config.dict(exclude_none=True), ignored=self.list_ignored_providers |