diff options
Diffstat (limited to 'g4f/api')
-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 |