mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-12-25 04:01:52 +03:00
Improve provider list
This commit is contained in:
parent
98d3304108
commit
69ca98ac85
51
README.md
51
README.md
@ -185,30 +185,33 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
| Website| Provider| gpt-3.5 | gpt-4 | Streaming | Status | Auth |
|
| Website| Provider| gpt-3.5 | gpt-4 | Streaming | Status | Auth |
|
||||||
| ------ | ------- | ------- | ----- | --------- | ------ | ---- |
|
| ------ | ------- | ------- | ----- | --------- | ------ | ---- |
|
||||||
| [www.aitianhu.com](https://www.aitianhu.com/api/chat-process) | g4f.Provider.AItianhu | ✔️ | ❌ | ❌ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
|
| [chat.acytoo.com](https://chat.acytoo.com/) | g4f.provider.Acytoo | ✔️ | ❌ | ❌ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
|
||||||
| [chat.acytoo.com](https://chat.acytoo.com/api/completions) | g4f.Provider.Acytoo | ✔️ | ❌ | ❌ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
| [chat-gpt.org](https://chat-gpt.org/chat) | g4f.provider.Aichat | ✔️ | ❌ | ❌ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
|
||||||
| [aiservice.vercel.app](https://aiservice.vercel.app/api/chat/answer) | g4f.Provider.AiService | ✔️ | ❌ | ❌ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
|
| [ai.ls](https://ai.ls) | g4f.provider.Ails | ✔️ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
||||||
| [chat-gpt.org](https://chat-gpt.org/chat) | g4f.Provider.Aichat | ✔️ | ❌ | ❌ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
| [bard.google.com](https://bard.google.com) | g4f.provider.Bard | ❌ | ❌ | ❌ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ✔️ |
|
||||||
| [ai.ls](https://ai.ls) | g4f.Provider.Ails | ✔️ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
| [chatgpt.ai](https://chatgpt.ai/gpt-4/) | g4f.provider.ChatgptAi | ❌ | ✔️ | ❌ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
||||||
| [bard.google.com](https://bard.google.com) | g4f.Provider.Bard | ❌ | ❌ | ❌ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ✔️ |
|
| [opchatgpts.net](https://opchatgpts.net) | g4f.provider.ChatgptLogin | ✔️ | ❌ | ❌ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
||||||
| [bing.com](https://bing.com/chat) | g4f.Provider.Bing | ❌ | ✔️ | ❌ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
|
| [deepai.org](https://deepai.org) | g4f.provider.DeepAi | ✔️ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
||||||
| [chatgpt.ai](https://chatgpt.ai/gpt-4/) | g4f.Provider.ChatgptAi | ❌ | ✔️ | ❌ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
| [free.easychat.work](https://free.easychat.work) | g4f.provider.EasyChat | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
|
||||||
| [chatgptlogin.ac](https://chatgptlogin.ac) | g4f.Provider.ChatgptLogin | ✔️ | ❌ | ❌ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
|
| [next.eqing.tech](https://next.eqing.tech/) | g4f.provider.Equing | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
|
||||||
| [deepai.org](https://deepai.org) | g4f.Provider.DeepAi | ✔️ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
| [chat.getgpt.world](https://chat.getgpt.world/) | g4f.provider.GetGpt | ✔️ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
||||||
| [chat.dfehub.com](https://chat.dfehub.com/api/chat) | g4f.Provider.DfeHub | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
|
| [gpt-gm.h2o.ai](https://gpt-gm.h2o.ai) | g4f.provider.H2o | ❌ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
||||||
| [free.easychat.work](https://free.easychat.work) | g4f.Provider.EasyChat | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
|
| [opchatgpts.net](https://opchatgpts.net) | g4f.provider.Opchatgpts | ✔️ | ❌ | ❌ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
||||||
| [forefront.com](https://forefront.com) | g4f.Provider.Forefront | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
|
| [raycast.com](https://raycast.com) | g4f.provider.Raycast | ✔️ | ✔️ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ✔️ |
|
||||||
| [chat.getgpt.world](https://chat.getgpt.world/) | g4f.Provider.GetGpt | ✔️ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
| [theb.ai](https://theb.ai) | g4f.provider.Theb | ✔️ | ❌ | ✔️ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ✔️ |
|
||||||
| [gpt-gm.h2o.ai](https://gpt-gm.h2o.ai) | g4f.Provider.H2o | ❌ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
| [play.vercel.ai](https://play.vercel.ai) | g4f.provider.Vercel | ✔️ | ❌ | ❌ | ![Unknown](https://img.shields.io/badge/Unknown-grey) | ❌ |
|
||||||
| [liaobots.com](https://liaobots.com) | g4f.Provider.Liaobots | ✔️ | ✔️ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ✔️ |
|
| [wewordle.org](https://wewordle.org/) | g4f.provider.Wewordle | ✔️ | ❌ | ❌ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
||||||
| [supertest.lockchat.app](http://supertest.lockchat.app) | g4f.Provider.Lockchat | ✔️ | ✔️ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
|
| [you.com](https://you.com) | g4f.provider.You | ✔️ | ❌ | ❌ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
||||||
| [opchatgpts.net](https://opchatgpts.net) | g4f.Provider.Opchatgpts | ✔️ | ❌ | ❌ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
| [chat9.yqcloud.top](https://chat9.yqcloud.top/) | g4f.provider.Yqcloud | ✔️ | ❌ | ❌ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
||||||
| [backend.raycast.com](https://backend.raycast.com/api/v1/ai/chat_completions) | g4f.Provider.Raycast | ✔️ | ✔️ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ✔️ |
|
| [www.aitianhu.com](https://www.aitianhu.com/) | g4f.provider.AItianhu | ✔️ | ❌ | ❌ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
|
||||||
| [theb.ai](https://theb.ai) | g4f.Provider.Theb | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
|
| [aiservice.vercel.app](https://aiservice.vercel.app/) | g4f.provider.AiService | ✔️ | ❌ | ❌ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
|
||||||
| [play.vercel.ai](https://play.vercel.ai) | g4f.Provider.Vercel | ✔️ | ❌ | ❌ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
| [bing.com](https://bing.com/chat) | g4f.provider.Bing | ❌ | ✔️ | ❌ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
|
||||||
| [wewordle.org](https://wewordle.org/gptapi/v1/android/turbo) | g4f.Provider.Wewordle | ✔️ | ❌ | ❌ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
| [chat.dfehub.com](https://chat.dfehub.com/) | g4f.provider.DfeHub | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
|
||||||
| [you.com](https://you.com) | g4f.Provider.You | ✔️ | ❌ | ❌ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
| [chat9.fastgpt.me](https://chat9.fastgpt.me/) | g4f.provider.FastGpt | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
|
||||||
| [chat9.yqcloud.top](https://chat9.yqcloud.top/) | g4f.Provider.Yqcloud | ✔️ | ❌ | ❌ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
|
| [forefront.com](https://forefront.com) | g4f.provider.Forefront | ✔️ | ❌ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
|
||||||
|
| [liaobots.com](https://liaobots.com) | g4f.provider.Liaobots | ✔️ | ✔️ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ✔️ |
|
||||||
|
| [supertest.lockchat.app](http://supertest.lockchat.app) | g4f.provider.Lockchat | ✔️ | ✔️ | ✔️ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
|
||||||
|
| [p5.v50.ltd](https://p5.v50.ltd) | g4f.provider.V50 | ✔️ | ❌ | ❌ | ![Inactive](https://img.shields.io/badge/Inactive-red) | ❌ |
|
||||||
|
|
||||||
### Other Models
|
### Other Models
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ from .base_provider import BaseProvider
|
|||||||
|
|
||||||
|
|
||||||
class AItianhu(BaseProvider):
|
class AItianhu(BaseProvider):
|
||||||
url = "https://www.aitianhu.com/api/chat-process"
|
url = "https://www.aitianhu.com/"
|
||||||
working = False
|
working = False
|
||||||
supports_gpt_35_turbo = True
|
supports_gpt_35_turbo = True
|
||||||
|
|
||||||
|
@ -7,12 +7,13 @@ from .base_provider import BaseProvider
|
|||||||
|
|
||||||
|
|
||||||
class Acytoo(BaseProvider):
|
class Acytoo(BaseProvider):
|
||||||
url = "https://chat.acytoo.com/api/completions"
|
url = "https://chat.acytoo.com/"
|
||||||
working = True
|
working = True
|
||||||
supports_gpt_35_turbo = True
|
supports_gpt_35_turbo = True
|
||||||
|
|
||||||
@staticmethod
|
@classmethod
|
||||||
def create_completion(
|
def create_completion(
|
||||||
|
cls,
|
||||||
model: str,
|
model: str,
|
||||||
messages: list[dict[str, str]],
|
messages: list[dict[str, str]],
|
||||||
stream: bool,
|
stream: bool,
|
||||||
@ -21,8 +22,7 @@ class Acytoo(BaseProvider):
|
|||||||
headers = _create_header()
|
headers = _create_header()
|
||||||
payload = _create_payload(messages, kwargs.get('temperature', 0.5))
|
payload = _create_payload(messages, kwargs.get('temperature', 0.5))
|
||||||
|
|
||||||
url = "https://chat.acytoo.com/api/completions"
|
response = requests.post("{cls.url}api/completions", headers=headers, json=payload)
|
||||||
response = requests.post(url=url, headers=headers, json=payload)
|
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
response.encoding = "utf-8"
|
response.encoding = "utf-8"
|
||||||
yield response.text
|
yield response.text
|
||||||
|
@ -5,7 +5,7 @@ from .base_provider import BaseProvider
|
|||||||
|
|
||||||
|
|
||||||
class AiService(BaseProvider):
|
class AiService(BaseProvider):
|
||||||
url = "https://aiservice.vercel.app/api/chat/answer"
|
url = "https://aiservice.vercel.app/"
|
||||||
working = False
|
working = False
|
||||||
supports_gpt_35_turbo = True
|
supports_gpt_35_turbo = True
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ from .base_provider import BaseProvider
|
|||||||
|
|
||||||
|
|
||||||
class DfeHub(BaseProvider):
|
class DfeHub(BaseProvider):
|
||||||
url = "https://chat.dfehub.com/api/chat"
|
url = "https://chat.dfehub.com/"
|
||||||
supports_stream = True
|
supports_stream = True
|
||||||
supports_gpt_35_turbo = True
|
supports_gpt_35_turbo = True
|
||||||
|
|
||||||
|
@ -10,12 +10,13 @@ from .base_provider import BaseProvider
|
|||||||
|
|
||||||
|
|
||||||
class Wewordle(BaseProvider):
|
class Wewordle(BaseProvider):
|
||||||
url = "https://wewordle.org/gptapi/v1/android/turbo"
|
url = "https://wewordle.org/"
|
||||||
working = True
|
working = True
|
||||||
supports_gpt_35_turbo = True
|
supports_gpt_35_turbo = True
|
||||||
|
|
||||||
@staticmethod
|
@classmethod
|
||||||
def create_completion(
|
def create_completion(
|
||||||
|
cls,
|
||||||
model: str,
|
model: str,
|
||||||
messages: list[dict[str, str]],
|
messages: list[dict[str, str]],
|
||||||
stream: bool,
|
stream: bool,
|
||||||
@ -62,8 +63,7 @@ class Wewordle(BaseProvider):
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
url = "https://wewordle.org/gptapi/v1/android/turbo"
|
response = requests.post(f"{cls.url}gptapi/v1/android/turbo", headers=headers, data=json.dumps(data))
|
||||||
response = requests.post(url, headers=headers, data=json.dumps(data))
|
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
_json = response.json()
|
_json = response.json()
|
||||||
if "message" in _json:
|
if "message" in _json:
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from colorama import Fore
|
||||||
|
|
||||||
sys.path.append(str(Path(__file__).parent.parent))
|
sys.path.append(str(Path(__file__).parent.parent))
|
||||||
|
|
||||||
@ -20,9 +21,14 @@ def main():
|
|||||||
if _provider.working and not result:
|
if _provider.working and not result:
|
||||||
failed_providers.append([_provider, result])
|
failed_providers.append([_provider, result])
|
||||||
|
|
||||||
print("Failed providers:")
|
print()
|
||||||
|
|
||||||
|
if failed_providers:
|
||||||
|
print(f"{Fore.RED}Failed providers:\n")
|
||||||
for _provider, result in failed_providers:
|
for _provider, result in failed_providers:
|
||||||
print(f"{_provider.__name__}: {result}")
|
print(f"{Fore.RED}{_provider.__name__}")
|
||||||
|
else:
|
||||||
|
print(f"{Fore.GREEN}All providers are working")
|
||||||
|
|
||||||
|
|
||||||
def get_providers() -> list[type[BaseProvider]]:
|
def get_providers() -> list[type[BaseProvider]]:
|
||||||
@ -36,18 +42,21 @@ def get_providers() -> list[type[BaseProvider]]:
|
|||||||
for provider_name in provider_names
|
for provider_name in provider_names
|
||||||
if not provider_name.startswith("__") and provider_name not in ignore_names
|
if not provider_name.startswith("__") and provider_name not in ignore_names
|
||||||
]
|
]
|
||||||
return [getattr(Provider, provider_name) for provider_name in provider_names]
|
return [getattr(Provider, provider_name) for provider_name in sorted(provider_names)]
|
||||||
|
|
||||||
|
|
||||||
def create_response(_provider: type[BaseProvider]) -> str:
|
def create_response(_provider: type[BaseProvider]) -> str:
|
||||||
model = (
|
if _provider.supports_gpt_35_turbo:
|
||||||
models.gpt_35_turbo.name
|
model = models.gpt_35_turbo.name
|
||||||
if _provider.supports_gpt_35_turbo
|
elif _provider.supports_gpt_4:
|
||||||
else _provider.model
|
model = models.gpt_4
|
||||||
)
|
elif hasattr(_provider, "model"):
|
||||||
|
model = _provider.model
|
||||||
|
else:
|
||||||
|
model = None
|
||||||
response = _provider.create_completion(
|
response = _provider.create_completion(
|
||||||
model=model,
|
model=model,
|
||||||
messages=[{"role": "user", "content": "Hello world!"}],
|
messages=[{"role": "user", "content": "Hello"}],
|
||||||
stream=False,
|
stream=False,
|
||||||
)
|
)
|
||||||
return "".join(response)
|
return "".join(response)
|
||||||
@ -57,9 +66,13 @@ def judge(_provider: type[BaseProvider]) -> bool:
|
|||||||
if _provider.needs_auth:
|
if _provider.needs_auth:
|
||||||
return _provider.working
|
return _provider.working
|
||||||
|
|
||||||
|
return test(_provider)
|
||||||
|
|
||||||
|
def test(_provider: type[BaseProvider]) -> bool:
|
||||||
try:
|
try:
|
||||||
response = create_response(_provider)
|
response = create_response(_provider)
|
||||||
assert type(response) is str
|
assert type(response) is str
|
||||||
|
assert len(response) > 0
|
||||||
return response
|
return response
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if logging:
|
if logging:
|
||||||
|
@ -7,7 +7,7 @@ sys.path.append(str(Path(__file__).parent.parent))
|
|||||||
|
|
||||||
from g4f import models, Provider
|
from g4f import models, Provider
|
||||||
from g4f.Provider.base_provider import BaseProvider
|
from g4f.Provider.base_provider import BaseProvider
|
||||||
|
from testing.test_providers import test
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
print_providers()
|
print_providers()
|
||||||
@ -21,7 +21,10 @@ def print_providers():
|
|||||||
"| ------ | ------- | ------- | ----- | --------- | ------ | ---- |",
|
"| ------ | ------- | ------- | ----- | --------- | ------ | ---- |",
|
||||||
]
|
]
|
||||||
providers = get_providers()
|
providers = get_providers()
|
||||||
|
for is_working in (True, False):
|
||||||
for _provider in providers:
|
for _provider in providers:
|
||||||
|
if is_working != _provider.working:
|
||||||
|
continue
|
||||||
netloc = urlparse(_provider.url).netloc
|
netloc = urlparse(_provider.url).netloc
|
||||||
website = f"[{netloc}]({_provider.url})"
|
website = f"[{netloc}]({_provider.url})"
|
||||||
|
|
||||||
@ -30,11 +33,13 @@ def print_providers():
|
|||||||
has_gpt_35 = "✔️" if _provider.supports_gpt_35_turbo else "❌"
|
has_gpt_35 = "✔️" if _provider.supports_gpt_35_turbo else "❌"
|
||||||
has_gpt_4 = "✔️" if _provider.supports_gpt_4 else "❌"
|
has_gpt_4 = "✔️" if _provider.supports_gpt_4 else "❌"
|
||||||
stream = "✔️" if _provider.supports_stream else "❌"
|
stream = "✔️" if _provider.supports_stream else "❌"
|
||||||
status = (
|
if _provider.working:
|
||||||
"![Active](https://img.shields.io/badge/Active-brightgreen)"
|
if test(_provider):
|
||||||
if _provider.working
|
status = '![Active](https://img.shields.io/badge/Active-brightgreen)'
|
||||||
else "![Inactive](https://img.shields.io/badge/Inactive-red)"
|
else:
|
||||||
)
|
status = '![Unknown](https://img.shields.io/badge/Unknown-grey)'
|
||||||
|
else:
|
||||||
|
status = '![Inactive](https://img.shields.io/badge/Inactive-red)'
|
||||||
auth = "✔️" if _provider.needs_auth else "❌"
|
auth = "✔️" if _provider.needs_auth else "❌"
|
||||||
|
|
||||||
lines.append(
|
lines.append(
|
||||||
@ -79,6 +84,8 @@ def print_models():
|
|||||||
|
|
||||||
_models = get_models()
|
_models = get_models()
|
||||||
for model in _models:
|
for model in _models:
|
||||||
|
if model.best_provider.__name__ not in provider_urls:
|
||||||
|
continue
|
||||||
split_name = re.split(r":|/", model.name)
|
split_name = re.split(r":|/", model.name)
|
||||||
name = split_name[-1]
|
name = split_name[-1]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user