mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-24 13:07:53 +08:00
- Rename DeepInfraChat to DeepInfra across all files - Move DeepInfra from needs_auth to main Provider directory - Rename LMArenaBeta to LMArena throughout codebase - Move search-related providers to new search subdirectory (GoogleSearch, SearXNG, YouTube) - Move deprecated providers to not_working directory (Free2GPT, LegacyLMArena, PenguinAI, ImageLabs, har) - Add new Mintlify provider with custom AI assistant implementation - Update Anthropic provider with Claude 4 models and Opus 4.1 parameter handling - Update Grok provider with Grok 4 models and improved streaming support - Update GithubCopilot with expanded model list including o3-mini, o4-mini, gpt-5 previews - Update LambdaChat default model from deepseek-r1 to deepseek-llama3.3-70b - Update TeachAnything default model from gemini-1.5-pro to gemma - Remove DeepInfra from needs_auth directory - Update all model_map references from DeepInfraChat to DeepInfra - Update all model_map references from LMArenaBeta to LMArena - Add beta_headers support to Anthropic for special features - Improve Mintlify provider with system prompt handling and streaming - Update model configurations in models.py to reflect provider changes
51 lines
2.0 KiB
Python
51 lines
2.0 KiB
Python
from __future__ import annotations
|
|
import requests
|
|
|
|
from ..template import OpenaiTemplate
|
|
from ...requests import raise_for_status
|
|
from ... import debug
|
|
|
|
class PenguinAI(OpenaiTemplate):
|
|
label = "PenguinAI"
|
|
url = "https://penguinai.tech"
|
|
api_base = "https://api.penguinai.tech/v1"
|
|
working = False
|
|
active_by_default = False
|
|
|
|
default_model = "gpt-3.5-turbo"
|
|
default_vision_model = "gpt-4o"
|
|
|
|
# in reality, it uses pollinations
|
|
image_models = ["flux"]
|
|
|
|
@classmethod
|
|
def get_models(cls, api_key: str = None, api_base: str = None) -> list[str]:
|
|
if not cls.models:
|
|
try:
|
|
headers = {}
|
|
if api_base is None:
|
|
api_base = cls.api_base
|
|
if api_key is None and cls.api_key is not None:
|
|
api_key = cls.api_key
|
|
if api_key is not None:
|
|
headers["authorization"] = f"Bearer {api_key}"
|
|
response = requests.get(f"{api_base}/models", headers=headers, verify=cls.ssl)
|
|
raise_for_status(response)
|
|
data = response.json()
|
|
data = data.get("data") if isinstance(data, dict) else data
|
|
cls.image_models = [model.get("id") for model in data if "image" in model.get("type")]
|
|
cls.models = [model.get("id") for model in data]
|
|
if cls.sort_models:
|
|
cls.models.sort()
|
|
|
|
cls.vision_models = []
|
|
vision_model_prefixes = ["vision", "multimodal", "o1", "o3", "o4", "gpt-4", "claude-3", "claude-opus", "claude-sonnet"]
|
|
for model in cls.models:
|
|
for tag in vision_model_prefixes:
|
|
if tag in model and not "search" in model:
|
|
cls.vision_models.append(model)
|
|
except Exception as e:
|
|
debug.error(e)
|
|
return cls.fallback_models
|
|
return cls.models
|