返回提交历史
Modified
g4f/Provider/PollinationsAI.py
+2
-2
XFEstudio/gpt4free
Update PollinationsAI to support additional API key prefix for image and text endpoints
b42ac28a
代码差异
1 个文件
+2
-2
@@ -338,7 +338,7 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
338
338
if model == "gptimage" and aspect_ratio is not None:
339
339
encoded_prompt = f"{encoded_prompt} aspect-ratio: {aspect_ratio}"
340
340
encoded_prompt = quote_plus(encoded_prompt)[:4096 - len(cls.image_api_endpoint) - len(query) - 8].rstrip("%")
341
if api_key and not api_key.startswith("g4f_"):
341
if api_key and not api_key.startswith("g4f_") and not api_key.startswith("gfs_"):
342
342
url = cls.gen_image_api_endpoint
343
343
else:
344
344
url = cls.image_api_endpoint
@@ -459,7 +459,7 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
459
459
if api_key:
460
460
headers = {"authorization": f"Bearer {api_key}"}
461
461
yield JsonRequest.from_dict(data)
462
if api_key and not api_key.startswith("g4f_"):
462
if api_key and not api_key.startswith("g4f_") and not api_key.startswith("gfs_"):
463
463
url = cls.gen_text_api_endpoint
464
464
else:
465
465
url = cls.text_api_endpoint