summaryrefslogtreecommitdiffstats
path: root/g4f/api/__init__.py
diff options
context:
space:
mode:
authorabc <98614666+xtekky@users.noreply.github.com>2024-03-05 23:06:31 +0100
committerabc <98614666+xtekky@users.noreply.github.com>2024-03-05 23:06:31 +0100
commit9d17588fcbcec64acbd48500b2612dca9d34b891 (patch)
tree757071cbfa79bd7b9a338f08c6ffcad394d83abe /g4f/api/__init__.py
parent~ (diff)
parent~ (diff)
downloadgpt4free-9d17588fcbcec64acbd48500b2612dca9d34b891.tar
gpt4free-9d17588fcbcec64acbd48500b2612dca9d34b891.tar.gz
gpt4free-9d17588fcbcec64acbd48500b2612dca9d34b891.tar.bz2
gpt4free-9d17588fcbcec64acbd48500b2612dca9d34b891.tar.lz
gpt4free-9d17588fcbcec64acbd48500b2612dca9d34b891.tar.xz
gpt4free-9d17588fcbcec64acbd48500b2612dca9d34b891.tar.zst
gpt4free-9d17588fcbcec64acbd48500b2612dca9d34b891.zip
Diffstat (limited to 'g4f/api/__init__.py')
-rw-r--r--g4f/api/__init__.py4
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