XFEstudio/gpt4free
Adding New Models and Enhancing Provider Functionality (#2689)
* Adding New Models and Enhancing Provider Functionality * fix(core): handle model errors and improve configuration - Import ModelNotSupportedError for proper exception handling in model resolution - Update login_url configuration to reference class URL attribute dynamically - Remove redundant typing imports after internal module reorganization * feat(g4f/Provider/PerplexityLabs.py): Add new Perplexity models and update provider listings - Update PerplexityLabs provider with expanded Sonar model family including pro/reasoning variants - Add new text models: sonar-reasoning-pro to supported model catalog - Standardize model naming conventions across provider documentation * feat(g4f/models.py): add Sonar Reasoning Pro model configuration - Add new model to Perplexity AI text models section - Include model in ModelUtils.convert mapping with PerplexityLabs provider - Maintain consistent configuration pattern with existing Sonar variants * feat(docs/providers-and-models.md): update provider models and add new reasoning model - Update PerplexityLabs text models to standardized sonar naming convention - Add new sonar-reasoning-pro model to text models table - Include latest Perplexity AI documentation references for new model * docs(docs/providers-and-models.md): update AI providers documentation - Remove deprecated chatgptt.me from no-auth providers list - Delete redundant Auth column from HuggingSpace providers table - Update PerplexityLabs model website URLs to sonar.perplexity.ai - Adjust provider counts for GPT-4/GPT-4o models in text models section - Fix inconsistent formatting in image models provider listings * chore(g4f/models.py): remove deprecated ChatGptt provider integration - Remove ChatGptt import from provider dependencies - Exclude ChatGptt from default model's best_provider list - Update gpt_4 model configuration to eliminate ChatGptt reference - Modify gpt_4o vision model provider hierarchy - Adjust gpt_4o_mini provider selection parameters BREAKING CHANGE: Existing integrations using ChatGptt provider will no longer function * Disabled provider (g4f/Provider/ChatGptt.py > g4f/Provider/not_working/ChatGptt.py): Problem with Cloudflare * fix(g4f/Provider/CablyAI.py): update API endpoints and model configurations * docs(docs/providers-and-models.md): update model listings and provider capabilities * feat(g4f/models.py): Add Hermes-3 model and enhance provider configs * feat(g4f/Provider/CablyAI.py): Add free tier indicators to model aliases * refactor(g4f/tools/run_tools.py): modularize thinking chunk handling * fix(g4f/Provider/DeepInfraChat.py): resolve duplicate keys and enhance request headers * feat(g4f/Provider/DeepInfraChat.py): Add multimodal image support and improve model handling * chore(g4f/models.py): update default vision model providers * feat(docs/providers-and-models.md): update provider capabilities and model specifications * Update docs/client.md * docs(docs/providers-and-models.md): Update DeepInfraChat models documentation * feat(g4f/Provider/DeepInfraChat.py): add new vision models and expand model aliases * feat(g4f/models.py): update model configurations and add new providers * feat(g4f/models.py): Update model configurations and add new AI models --------- Co-authored-by: kqlio67 <>
88e7ef98
代码差异
@@ -181,8 +181,8 @@ for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content or "", end="")
```
---
### Using a Vision Model
**Analyze an image and generate a description:**
```python
@@ -38,18 +38,16 @@ This document provides an overview of various AI providers and models, including
| Website | API Credentials | Provider | Text Models | Image Models | Vision (Image Upload) | Stream | Status |
|----------|-------------|--------------|---------------|--------|--------|------|------|
|[aichatfree.info](https://aichatfree.info)|No auth required|`g4f.Provider.AIChatFree`|`gemini-1.5-pro` _**(1+)**_|❌|❌|✔||
|[autonomous.ai](https://www.autonomous.ai/anon/)|No auth required|`g4f.Provider.AutonomousAI`|`llama-3.3-70b, qwen-2.5-coder-32b, hermes-3, llama-3.2-90b, llama-3.3-70b, llama-3-2-70b`|✔|❌|✔||
|[blackbox.ai](https://www.blackbox.ai)|No auth required|`g4f.Provider.Blackbox`|`blackboxai, gemini-1.5-flash, gemini-1.5-pro, blackboxai-pro, llama-3.1-8b, llama-3.1-70b, llama-3-1-405b, llama-3.3-70b, mixtral-small-28b, deepseek-chat, dbrx-instruct, qwq-32b, hermes-2-dpo, deepseek-r1` _**(+34)**_|`flux`|`blackboxai, gpt-4o, gemini-1.5-pro, gemini-1.5-flash, llama-3.1-8b, llama-3.1-70b, llama-3.1-405b`|✔||
|[blackbox.ai](https://www.blackbox.ai)|No auth required|`g4f.Provider.Blackbox`|`blackboxai, gpt-4, gpt-4o, o3-mini, claude-3.5-sonnet, gemini-1.5-flash, gemini-1.5-pro, blackboxai-pro, llama-3.1-8b, llama-3.1-70b, llama-3-1-405b, llama-3.3-70b, mixtral-small-28b, deepseek-chat, dbrx-instruct, qwq-32b, hermes-2-dpo, deepseek-r1` _**(+34)**_|`flux`|`blackboxai, gpt-4o, o3-mini, gemini-1.5-pro, gemini-1.5-flash, llama-3.1-8b, llama-3.1-70b, llama-3.1-405b`|✔||
|[api.blackbox.ai](https://api.blackbox.ai)|No auth required|`g4f.Provider.BlackboxAPI`|`deepseek-v3, deepseek-r1, deepseek-chat, mixtral-small-28b, dbrx-instruct, qwq-32b, hermes-2-dpo`|❌|❌|✔||
|[cablyai.com](https://cablyai.com)|Optional API key|`g4f.Provider.CablyAI`|`gpt-4o-mini, llama-3.1-8b, deepseek-v3, deepseek-r1, o3-mini-low` _**(2+)**_|❌|❌|✔||
|[cablyai.com](https://cablyai.com)|Optional API key|`g4f.Provider.CablyAI`|`gpt-4o-mini, llama-3.1-8b, deepseek-v3, deepseek-r1, hermes-3, o3-mini-low, o3-mini, sonar-reasoning` _**(2+)**_|❌|❌|✔||
|[chatglm.cn](https://chatglm.cn)|No auth required|`g4f.Provider.ChatGLM`|`glm-4`|❌|❌|✔||
|[chatgpt.com](https://chatgpt.com)|No auth required|`g4f.Provider.ChatGpt`|✔ _**(+7)**_|❌|❌|✔||
|[chatgpt.es](https://chatgpt.es)|No auth required|`g4f.Provider.ChatGptEs`|`gpt-4, gpt-4o, gpt-4o-mini`|❌|❌|✔||
|[chatgptt.me](https://chatgptt.me)|No auth required|`g4f.Provider.ChatGptt`|`gpt-4, gpt-4o, gpt-4o-mini`|❌|❌|✔||
|[playground.ai.cloudflare.com](https://playground.ai.cloudflare.com)|[Automatic cookies](https://playground.ai.cloudflare.com)|`g4f.Provider.Cloudflare`|`llama-2-7b, llama-3-8b, llama-3.1-8b, llama-3.2-1b, qwen-1.5-7b`|❌|❌|✔||❌|
|[copilot.microsoft.com](https://copilot.microsoft.com)|Optional API key|`g4f.Provider.Copilot`|`gpt-4, gpt-4o`|❌|❌|✔||
|[duckduckgo.com/aichat](https://duckduckgo.com/aichat)|No auth required|`g4f.Provider.DDG`|`gpt-4, gpt-4o-mini, claude-3-haiku, llama-3.1-70b, mixtral-8x7b`|❌|❌|✔||
|[deepinfra.com/chat](https://deepinfra.com/chat)|No auth required|`g4f.Provider.DeepInfraChat`|`llama-3.1-8b, llama-3.2-90b, llama-3.3-70b, deepseek-v3, mixtral-small-28b, deepseek-r1, phi-4, wizardlm-2-8x22b, qwen-2.5-72b`|❌|❌|✔||
|[deepinfra.com/chat](https://deepinfra.com/chat)|No auth required|`g4f.Provider.DeepInfraChat`|`llama-3.1-8b, llama-3.2-90b, llama-3.3-70b, deepseek-v3, mixtral-small-28b, deepseek-r1, phi-4, wizardlm-2-8x22b, qwen-2.5-72b, yi-34b, qwen-2-72b, dolphin-2.6, dolphin-2.9, dbrx-instruct, airoboros-70b, lzlv-70b, wizardlm-2-7b, mixtral-8x22b, minicpm-2.5`|❌|`llama-3.2-90b, minicpm-2.5`|✔||
|[chat10.free2gpt.xyz](https://chat10.free2gpt.xyz)|No auth required|`g4f.Provider.Free2GPT`|`mistral-7b`|❌|❌|✔||
|[freegptsnav.aifree.site](https://freegptsnav.aifree.site)|No auth required|`g4f.Provider.FreeGpt`|`gemini-1.5-pro`|❌|❌|✔||
|[app.giz.ai/assistant](https://app.giz.ai/assistant)|No auth required|`g4f.Provider.GizAI`|`gemini-1.5-flash`|❌|❌|✔||
@@ -63,10 +61,10 @@ This document provides an overview of various AI providers and models, including
|[liaobots.work](https://liaobots.work)|[Automatic cookies](https://liaobots.work)|`g4f.Provider.Liaobots`|`grok-2, gpt-4o-mini, gpt-4o, gpt-4, o1-preview, o1-mini, deepseek-r1, deepseek-v3, claude-3-opus, claude-3.5-sonnet, claude-3-sonnet, gemini-1.5-flash, gemini-1.5-pro, gemini-2.0-flash, gemini-2.0-flash-thinking`|❌|❌|✔||
|[mhystical.cc](https://mhystical.cc)|[Optional API key](https://mhystical.cc/dashboard)|`g4f.Provider.Mhystical`|`gpt-4`|❌|❌|✔||
|[oi-vscode-server.onrender.com](https://oi-vscode-server.onrender.com)|No auth required|`g4f.Provider.OIVSCode`|`gpt-4o-mini`|❌|`gpt-4o-mini`|✔||
|[labs.perplexity.ai](https://labs.perplexity.ai)|No auth required|`g4f.Provider.PerplexityLabs`|`sonar-online, sonar-chat, llama-3.3-70b, llama-3.1-8b, llama-3.1-70b, lfm-40b`|❌|❌|✔||
|[labs.perplexity.ai](https://labs.perplexity.ai)|No auth required|`g4f.Provider.PerplexityLabs`|`sonar, sonar-pro, sonar-reasoning, sonar-reasoning-pro`|❌|❌|✔||
|[pi.ai/talk](https://pi.ai/talk)|[Manual cookies](https://pi.ai/talk)|`g4f.Provider.Pi`|`pi`|❌|❌|✔||
|[pizzagpt.it](https://www.pizzagpt.it)|No auth required|`g4f.Provider.Pizzagpt`|`gpt-4o-mini`|❌|❌|✔||
|[pollinations.ai](https://pollinations.ai)|No auth required|`g4f.Provider.PollinationsAI`|`gpt-4o-mini, gpt-4o, qwen-2.5-72b, qwen-2.5-coder-32b, llama-3.3-70b, mistral-nemo, deepseek-chat, llama-3.1-8b, deepseek-r1` _**(2+)**_|`flux, flux-pro, flux-realism, flux-cablyai, flux-anime, flux-3d, midjourney, dall-e-3, sdxl-turbo`|gpt-4o, gpt-4o-mini|✔||
|[pollinations.ai](https://pollinations.ai)|No auth required|`g4f.Provider.PollinationsAI`|`gpt-4o-mini, gpt-4o, qwen-2.5-72b, qwen-2.5-coder-32b, llama-3.3-70b, mistral-nemo, deepseek-chat, llama-3.1-8b, deepseek-r1, gemini-2.0-flash, gemini-2.0-flash-thinking` _**(3+)**_|`flux, flux-pro, flux-dev, flux-schnell, dall-e-3, sdxl-turbo`|gpt-4o, gpt-4o-mini|✔||
|[app.prodia.com](https://app.prodia.com)|No auth required|`g4f.Provider.Prodia`|❌|✔ _**(46)**_|❌|❌||
|[teach-anything.com](https://www.teach-anything.com)|No auth required|`g4f.Provider.TeachAnything`|`llama-3.1-70b`|❌|❌|✔||
|[you.com](https://you.com)|[Manual cookies](https://you.com)|`g4f.Provider.You`|✔|✔|✔|✔||
@@ -124,12 +122,13 @@ This document provides an overview of various AI providers and models, including
### Text Models
| Model | Base Provider | Providers | Website |
|-------|---------------|-----------|---------|
|gpt-4|OpenAI|10+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4)|
|gpt-4|OpenAI|9+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4)|
|gpt-4o|OpenAI|7+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4o)|
|gpt-4o-mini|OpenAI|9+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4o-mini)|
|gpt-4o-mini|OpenAI|8+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4o-mini)|
|o1|OpenAI|1+ Providers|[openai.com](https://openai.com/index/introducing-openai-o1-preview/)|
|o1-preview|OpenAI|1+ Providers|[openai.com](https://openai.com/index/introducing-openai-o1-preview/)|
|o1-mini|OpenAI|1+ Providers|[openai.com](https://openai.com/index/openai-o1-mini-advancing-cost-efficient-reasoning/)|
|o3-mini|OpenAI|2+ Providers|[openai.com](https://openai.com/index/openai-o3-mini/)|
|o3-mini-low|OpenAI|1+ Providers|[openai.com](https://openai.com/index/openai-o3-mini/)|
|gigachat|GigaChat|1+ Providers|[developers.sber.ru/gigachat](https://developers.sber.ru/gigachat)|
|meta-ai|Meta|1+ Providers|[ai.meta.com](https://ai.meta.com/)|
@@ -145,22 +144,25 @@ This document provides an overview of various AI providers and models, including
|llama-3.2-90b|Meta Llama|1+ Providers|[huggingface.co](https://huggingface.co/meta-llama/Llama-3.2-90B-Vision)|
|llama-3.3-70b|Meta Llama|6+ Providers|[ai.meta.com](https://ai.meta.com/blog/llama-3-3/)|
|mixtral-8x7b|Mistral|2+ Providers|[mistral.ai](https://mistral.ai/news/mixtral-of-experts/)|
|mixtral-8x22b|Mistral|1+ Providers|[huggingface.co](https://huggingface.co/mistralai/Mixtral-8x22B-Instruct-v0.1)|
|mistral-nemo|Mistral|3+ Providers|[huggingface.co](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407)|
|mixtral-small-28b|Mistral|2+ Providers|[mistral.ai](https://mistral.ai/news/mixtral-small-28b/)|
|mixtral-small-28b|Mistral|3+ Providers|[mistral.ai](https://mistral.ai/news/mixtral-small-28b/)|
|hermes-2-dpo|NousResearch|2+ Providers|[huggingface.co](https://huggingface.co/NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO)|
|hermes-3|NousResearch|1+ Providers|[huggingface.co](https://huggingface.co/NousResearch/Hermes-3-Llama-3.2-3B)|
|phi-3.5-mini|Microsoft|1+ Providers|[huggingface.co](https://huggingface.co/microsoft/Phi-3.5-mini-instruct)|
|phi-4|Microsoft|1+ Providers|[techcommunity.microsoft.com](https://techcommunity.microsoft.com/blog/aiplatformblog/introducing-phi-4-microsoft%E2%80%99s-newest-small-language-model-specializing-in-comple/4357090)|
|wizardlm-2-7b|Microsoft|1+ Providers|[wizardlm.github.io](https://wizardlm.github.io/WizardLM2/)|
|wizardlm-2-8x22b|Microsoft|2+ Providers|[wizardlm.github.io](https://wizardlm.github.io/WizardLM2/)|
|gemini|Google DeepMind|1+|[deepmind.google](http://deepmind.google/technologies/gemini/)|
|gemini-exp|Google DeepMind|1+ Providers|[blog.google](https://blog.google/feed/gemini-exp-1206/)|
|gemini-1.5-flash|Google DeepMind|5+ Providers|[deepmind.google](https://deepmind.google/technologies/gemini/flash/)|
|gemini-1.5-pro|Google DeepMind|5+ Providers|[deepmind.google](https://deepmind.google/technologies/gemini/pro/)|
|gemini-2.0-flash|Google DeepMind|2+ Providers|[deepmind.google](https://deepmind.google/technologies/gemini/flash/)|
|gemini-2.0-flash|Google DeepMind|3+ Providers|[deepmind.google](https://deepmind.google/technologies/gemini/flash/)|
|gemini-2.0-flash-thinking|Google DeepMind|1+ Providers|[ai.google.dev](https://ai.google.dev/gemini-api/docs/thinking-mode)|
|claude-3-haiku|Anthropic|2+ Providers|[anthropic.com](https://www.anthropic.com/news/claude-3-haiku)|
|claude-3-sonnet|Anthropic|1+ Providers|[anthropic.com](https://www.anthropic.com/news/claude-3-family)|
|claude-3-opus|Anthropic|2+ Providers|[anthropic.com](https://www.anthropic.com/news/claude-3-family)|
|claude-3.5-sonnet|Anthropic|2+ Providers|[anthropic.com](https://www.anthropic.com/news/claude-3-5-sonnet)|
|claude-3.5-sonnet|Anthropic|3+ Providers|[anthropic.com](https://www.anthropic.com/news/claude-3-5-sonnet)|
|reka-core|Reka AI|1+ Providers|[reka.ai](https://www.reka.ai/ourmodels)|
|blackboxai|Blackbox AI|1+ Providers|[docs.blackbox.chat](https://docs.blackbox.chat/blackbox-ai-1)|
|blackboxai-pro|Blackbox AI|1+ Providers|[docs.blackbox.chat](https://docs.blackbox.chat/blackbox-ai-1)|
@@ -168,26 +170,33 @@ This document provides an overview of various AI providers and models, including
|command-r-plus|CohereForAI|2+ Providers|[docs.cohere.com](https://docs.cohere.com/docs/command-r-plus)|
|command-r7b|CohereForAI|1+ Providers|[huggingface.co](https://huggingface.co/CohereForAI/c4ai-command-r7b-12-2024)|
|qwen-1.5-7b|Qwen|1+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen1.5-7B)|
|qwen-2-72b|Qwen|1+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2-72B)|
|qwen-2-72b|Qwen|2+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2-72B)|
|qwen-2-vl-7b|Qwen|1+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2-VL-7B)|
|qwen-2.5-72b|Qwen|3+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2.5-72B-Instruct)|
|qwen-2.5-coder-32b|Qwen|4+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2.5-Coder-32B)|
|qwen-2.5-coder-32b|Qwen|3+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2.5-Coder-32B)|
|qwen-2.5-1m-demo|Qwen|1+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2.5-1M-Demo)|
|qwq-32b|Qwen|5+ Providers|[huggingface.co](https://huggingface.co/Qwen/QwQ-32B-Preview)|
|qwq-32b|Qwen|4+ Providers|[huggingface.co](https://huggingface.co/Qwen/QwQ-32B-Preview)|
|qvq-72b|Qwen|1+ Providers|[huggingface.co](https://huggingface.co/Qwen/QVQ-72B-Preview)|
|pi|Inflection|1+ Providers|[inflection.ai](https://inflection.ai/blog/inflection-2-5)|
|deepseek-chat|DeepSeek|4+ Providers|[huggingface.co](https://huggingface.co/deepseek-ai/deepseek-llm-67b-chat)|
|deepseek-v3|DeepSeek|4+ Providers|[api-docs.deepseek.com](https://api-docs.deepseek.com/news/news250120)|
|deepseek-r1|DeepSeek|8+ Providers|[api-docs.deepseek.com](https://api-docs.deepseek.com/news/news250120)|
|deepseek-v3|DeepSeek|5+ Providers|[api-docs.deepseek.com](https://api-docs.deepseek.com/news/news250120)|
|deepseek-r1|DeepSeek|10+ Providers|[api-docs.deepseek.com](https://api-docs.deepseek.com/news/news250120)|
|grok-2|x.ai|1+|[x.ai](https://x.ai/blog/grok-2)|
|sonar|Perplexity AI|1+ Providers|[docs.perplexity.ai](https://docs.perplexity.ai/)|
|sonar-pro|Perplexity AI|1+ Providers|[docs.perplexity.ai](https://docs.perplexity.ai/)|
|sonar-reasoning|Perplexity AI|1+ Providers|[docs.perplexity.ai](https://docs.perplexity.ai/)|
|nemotron-70b|Nvidia|3+ Providers|[build.nvidia.com](https://build.nvidia.com/nvidia/llama-3_1-nemotron-70b-instruct)|
|dbrx-instruct|Databricks|2+ Providers|[huggingface.co](https://huggingface.co/databricks/dbrx-instruct)|
|sonar|Perplexity AI|1+ Providers|[sonar.perplexity.ai](https://sonar.perplexity.ai/)|
|sonar-pro|Perplexity AI|1+ Providers|[sonar.perplexity.ai](https://sonar.perplexity.ai/)|
|sonar-reasoning|Perplexity AI|2+ Providers|[sonar.perplexity.ai](https://sonar.perplexity.ai/)|
|sonar-reasoning-pro|Perplexity AI|1+ Providers|[sonar.perplexity.ai](https://sonar.perplexity.ai/)|
|nemotron-70b|Nvidia|2+ Providers|[build.nvidia.com](https://build.nvidia.com/nvidia/llama-3_1-nemotron-70b-instruct)|
|dbrx-instruct|Databricks|3+ Providers|[huggingface.co](https://huggingface.co/databricks/dbrx-instruct)|
|glm-4|THUDM|1+ Providers|[github.com/THUDM](https://github.com/THUDM/GLM-4)|
|mini_max|MiniMax|1+ Providers|[hailuo.ai](https://www.hailuo.ai/)|
|evil|Evil Mode - Experimental|1+ Providers||
|yi-34b|01-ai|1+ Providers|[huggingface.co](https://huggingface.co/01-ai/Yi-34B-Chat)|
|dolphin-2.6|Cognitive Computations|1+ Providers|[huggingface.co](https://huggingface.co/cognitivecomputations/dolphin-2.6-mixtral-8x7b)|
|dolphin-2.9|Cognitive Computations|1+ Providers|[huggingface.co](https://huggingface.co/cognitivecomputations/dolphin-2.9.1-llama-3-70b)|
|airoboros-70b|DeepInfra|1+ Providers|[huggingface.co](https://huggingface.co/cognitivecomputations/dolphin-2.9.1-llama-3-70b)|
|lzlv-70b|Lizpreciatior|1+ Providers|[huggingface.co](https://huggingface.co/cognitivecomputations/dolphin-2.9.1-llama-3-70b)|
|minicpm-2.5|OpenBMB|1+ Providers|[huggingface.co](https://huggingface.co/openbmb/MiniCPM-Llama3-V-2_5)|
|evil|Evil Mode - Experimental|1+ Providers|[]( )|
---
### Image Models
@@ -197,8 +206,8 @@ This document provides an overview of various AI providers and models, including
|sd-3.5|Stability AI|1+ Providers|[huggingface.co](https://huggingface.co/stabilityai/stable-diffusion-3.5-large)|
|flux|Black Forest Labs|3+ Providers|[github.com/black-forest-labs/flux](https://github.com/black-forest-labs/flux)|
|flux-pro|Black Forest Labs|1+ Providers|[huggingface.co](https://huggingface.co/enhanceaiteam/FLUX.1-Pro)|
|flux-dev|Black Forest Labs|3+ Providers|[huggingface.co](https://huggingface.co/black-forest-labs/FLUX.1-dev)|
|flux-schnell|Black Forest Labs|3+ Providers|[huggingface.co](https://huggingface.co/black-forest-labs/FLUX.1-schnell)|
|flux-dev|Black Forest Labs|4+ Providers|[huggingface.co](https://huggingface.co/black-forest-labs/FLUX.1-dev)|
|flux-schnell|Black Forest Labs|4+ Providers|[huggingface.co](https://huggingface.co/black-forest-labs/FLUX.1-schnell)|
|dall-e-3|OpenAI|5+ Providers|[openai.com](https://openai.com/index/dall-e/)|
|midjourney|Midjourney|1+ Providers|[docs.midjourney.com](https://docs.midjourney.com/docs/model-versions)|
@@ -15,7 +15,7 @@ from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
from ..image import to_data_uri
from ..cookies import get_cookies_dir
from .helper import format_prompt, format_image_prompt
from ..providers.response import JsonConversation, ImageResponse, Reasoning
from ..providers.response import JsonConversation, ImageResponse
class Conversation(JsonConversation):
validated_value: str = None
@@ -39,10 +39,9 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
default_vision_model = default_model
default_image_model = 'ImageGeneration'
image_models = [default_image_model]
vision_models = [default_vision_model, 'gpt-4o', 'o3-mini', 'gemini-pro', 'DeepSeek-V3', 'gemini-1.5-flash', 'llama-3.1-8b', 'llama-3.1-70b', 'llama-3.1-405b']
reasoning_models = ['DeepSeek-R1']
vision_models = [default_vision_model, 'gpt-4o', 'o3-mini', 'gemini-pro', 'gemini-1.5-flash', 'llama-3.1-8b', 'llama-3.1-70b', 'llama-3.1-405b']
userSelectedModel = ['gpt-4o', 'o3-mini', 'claude-sonnet-3.5', 'gemini-pro', 'blackboxai-pro']
userSelectedModel = ['gpt-4o', 'o3-mini', 'gemini-pro', 'claude-sonnet-3.5', 'DeepSeek-V3', 'DeepSeek-R1', 'blackboxai-pro', 'Meta-Llama-3.3-70B-Instruct-Turbo', 'Mistral-Small-24B-Instruct-2501', 'DeepSeek-LLM-Chat-(67B)', 'DBRX-Instruct', 'Qwen-QwQ-32B-Preview', 'Nous-Hermes-2-Mixtral-8x7B-DPO']
agentMode = {
'DeepSeek-V3': {'mode': True, 'id': "deepseek-chat", 'name': "DeepSeek-V3"},
@@ -56,6 +55,7 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
}
trendingAgentMode = {
"o3-mini": {'mode': True, 'id': 'o3-mini'},
"gemini-1.5-flash": {'mode': True, 'id': 'Gemini'},
"llama-3.1-8b": {'mode': True, 'id': "llama-3.1-8b"},
'llama-3.1-70b': {'mode': True, 'id': "llama-3.1-70b"},
@@ -94,9 +94,11 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
'builder Agent': {'mode': True, 'id': "builder Agent"},
}
models = list(dict.fromkeys([default_model, *userSelectedModel, *reasoning_models, *image_models, *list(agentMode.keys()), *list(trendingAgentMode.keys())]))
models = list(dict.fromkeys([default_model, *userSelectedModel, *image_models, *list(agentMode.keys()), *list(trendingAgentMode.keys())]))
model_aliases = {
"gpt-4": "gpt-4o",
"claude-3.5-sonnet": "claude-sonnet-3.5",
"gemini-1.5-flash": "gemini-1.5-flash",
"gemini-1.5-pro": "gemini-pro",
"deepseek-v3": "DeepSeek-V3",
@@ -177,7 +179,6 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
messages: Messages,
prompt: str = None,
proxy: str = None,
web_search: bool = False,
images: ImagesType = None,
top_p: float = None,
temperature: float = None,
@@ -283,60 +284,20 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
"vscodeClient": False,
"codeInterpreterMode": False,
"customProfile": {"name": "", "occupation": "", "traits": [], "additionalInfo": "", "enableNewChats": False},
"webSearchMode": web_search
"session": {"user":{"name":"John Doe","email":"john.doe@gmail.com","image":"https://lh3.googleusercontent.com/a/ACg8ocK9X7mNpQ2vR4jH3tY8wL5nB1xM6fDS9JW2kLpTn4Vy3hR2xN4m=s96-c"},"expires":datetime.now(timezone.utc).isoformat(timespec='milliseconds').replace('+00:00', 'Z'), "status": "PREMIUM"},
"webSearchMode": False
}
async with session.post(cls.api_endpoint, json=data, proxy=proxy) as response:
await raise_for_status(response)
response_text = await response.text()
parts = response_text.split('$~~~$')
text_to_yield = parts[2] if len(parts) >= 3 else response_text
if not text_to_yield or text_to_yield.isspace():
return
if model in cls.reasoning_models and "\n\n\n" in text_to_yield:
think_split = text_to_yield.split("\n\n\n", 1)
if len(think_split) > 1:
think_content, answer = think_split[0].strip(), think_split[1].strip()
yield Reasoning(status=think_content)
yield answer
else:
yield text_to_yield
elif "<think>" in text_to_yield:
pre_think, rest = text_to_yield.split('<think>', 1)
think_content, post_think = rest.split('</think>', 1)
pre_think = pre_think.strip()
think_content = think_content.strip()
post_think = post_think.strip()
if pre_think:
yield pre_think
if think_content:
yield Reasoning(status=think_content)
if post_think:
yield post_think
elif "Generated by BLACKBOX.AI" in text_to_yield:
conversation.validated_value = await cls.fetch_validated(force_refresh=True)
if conversation.validated_value:
data["validated"] = conversation.validated_value
async with session.post(cls.api_endpoint, json=data, proxy=proxy) as new_response:
await raise_for_status(new_response)
new_response_text = await new_response.text()
new_parts = new_response_text.split('$~~~$')
new_text = new_parts[2] if len(new_parts) >= 3 else new_response_text
if new_text and not new_text.isspace():
yield new_text
else:
if text_to_yield and not text_to_yield.isspace():
yield text_to_yield
else:
if text_to_yield and not text_to_yield.isspace():
yield text_to_yield
full_response = []
async for chunk in response.content.iter_any():
if chunk:
chunk_text = chunk.decode()
full_response.append(chunk_text)
yield chunk_text
if return_conversation:
conversation.message_history.append({"role": "assistant", "content": text_to_yield})
full_response_text = ''.join(full_response)
conversation.message_history.append({"role": "assistant", "content": full_response_text})
yield conversation
@@ -5,7 +5,6 @@ from aiohttp import ClientSession
from ..typing import AsyncResult, Messages
from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
from ..requests.raise_for_status import raise_for_status
from ..providers.response import Reasoning
from .helper import format_prompt
class BlackboxAPI(AsyncGeneratorProvider, ProviderModelMixin):
@@ -20,15 +19,15 @@ class BlackboxAPI(AsyncGeneratorProvider, ProviderModelMixin):
supports_message_history = True
default_model = 'deepseek-ai/DeepSeek-V3'
reasoning_models = ['deepseek-ai/DeepSeek-R1']
models = [
default_model,
'deepseek-ai/DeepSeek-R1',
'mistralai/Mistral-Small-24B-Instruct-2501',
'deepseek-ai/deepseek-llm-67b-chat',
'databricks/dbrx-instruct',
'Qwen/QwQ-32B-Preview',
'NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO'
] + reasoning_models
]
model_aliases = {
"deepseek-v3": "deepseek-ai/DeepSeek-V3",
@@ -65,39 +64,14 @@ class BlackboxAPI(AsyncGeneratorProvider, ProviderModelMixin):
async with session.post(cls.api_endpoint, json=data, proxy=proxy) as response:
await raise_for_status(response)
is_reasoning = False
current_reasoning = ""
async for chunk in response.content:
if not chunk:
continue
text = chunk.decode(errors='ignore')
if model in cls.reasoning_models:
if "<think>" in text:
text = text.replace("<think>", "")
is_reasoning = True
current_reasoning = text
continue
if "</think>" in text:
text = text.replace("</think>", "")
is_reasoning = False
current_reasoning += text
yield Reasoning(status=current_reasoning.strip())
current_reasoning = ""
continue
if is_reasoning:
current_reasoning += text
continue
try:
if text:
yield text
except Exception as e:
return
if is_reasoning and current_reasoning:
yield Reasoning(status=current_reasoning.strip())
@@ -4,33 +4,45 @@ from ..errors import ModelNotSupportedError
from .template import OpenaiTemplate
class CablyAI(OpenaiTemplate):
label = "CablyAI"
url = "https://cablyai.com"
login_url = url
url = "https://cablyai.com/chat"
login_url = "https://cablyai.com"
api_base = "https://cablyai.com/v1"
api_key = "sk-your-openai-api-key"
working = True
needs_auth = False
supports_stream = True
supports_system_message = True
supports_message_history = True
default_model = 'gpt-4o-mini'
reasoning_models = ['deepseek-r1-uncensored']
fallback_models = [
default_model,
'searchgpt',
'llama-3.1-8b-instruct',
'deepseek-r1-uncensored',
'deepseek-r1',
'deepseek-reasoner',
'deepseek-v3',
'tinyswallow1.5b',
'andy-3.5',
'hermes-3-llama-3.2-3b',
'llama-3.1-8b-instruct',
'o3-mini',
'o3-mini-low',
] + reasoning_models
'sonar-reasoning',
'tinyswallow1.5b',
]
model_aliases = {
"gpt-4o-mini": "searchgpt",
"llama-3.1-8b": "llama-3.1-8b-instruct",
"deepseek-r1": "deepseek-r1-uncensored",
"gpt-4o-mini": "searchgpt (free)",
"deepseek-r1": "deepseek-r1-uncensored (free)",
"deepseek-r1": "deepseek-reasoner (free)",
"hermes-3": "hermes-3-llama-3.2-3b (free)",
"llama-3.1-8b": "llama-3.1-8b-instruct (free)",
"o3-mini-low": "o3-mini-low (free)",
"o3-mini": "o3-mini-low (free)",
"o3-mini": "o3-mini (free)",
}
@classmethod
def get_models(cls, api_key: str = None, api_base: str = None) -> list[str]:
models = super().get_models(api_key, api_base);
@@ -42,6 +54,34 @@ class CablyAI(OpenaiTemplate):
model = super().get_model(model, **kwargs)
return model.split(" (free)")[0]
except ModelNotSupportedError:
if f"{model} (free)" in cls.models:
if f"f{model} (free)" in cls.models:
return model
raise
raise
@classmethod
def create_async_generator(
cls,
model: str,
messages: Messages,
api_key: str = None,
stream: bool = True,
**kwargs
) -> AsyncResult:
api_key = api_key or cls.api_key
headers = {
"Accept": "*/*",
"Accept-Language": "en-US,en;q=0.9",
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
"Origin": cls.url,
"Referer": f"{cls.url}/chat",
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
}
return super().create_async_generator(
model=model,
messages=messages,
api_key=api_key,
stream=stream,
headers=headers,
**kwargs
)
@@ -1,7 +1,8 @@
from __future__ import annotations
from ..typing import AsyncResult, Messages
from ..typing import AsyncResult, Messages, ImagesType
from .template import OpenaiTemplate
from ..image import to_data_uri
class DeepInfraChat(OpenaiTemplate):
url = "https://deepinfra.com/chat"
@@ -9,10 +10,12 @@ class DeepInfraChat(OpenaiTemplate):
working = True
default_model = 'meta-llama/Llama-3.3-70B-Instruct-Turbo'
default_vision_model = 'meta-llama/Llama-3.2-90B-Vision-Instruct'
vision_models = [default_vision_model, 'openbmb/MiniCPM-Llama3-V-2_5']
models = [
'meta-llama/Meta-Llama-3.1-8B-Instruct',
'meta-llama/Llama-3.2-90B-Vision-Instruct',
default_model,
'meta-llama/Llama-3.3-70B-Instruct',
'deepseek-ai/DeepSeek-V3',
'mistralai/Mistral-Small-24B-Instruct-2501',
'deepseek-ai/DeepSeek-R1',
@@ -21,19 +24,38 @@ class DeepInfraChat(OpenaiTemplate):
'microsoft/phi-4',
'microsoft/WizardLM-2-8x22B',
'Qwen/Qwen2.5-72B-Instruct',
]
'01-ai/Yi-34B-Chat',
'Qwen/Qwen2-72B-Instruct',
'cognitivecomputations/dolphin-2.6-mixtral-8x7b',
'cognitivecomputations/dolphin-2.9.1-llama-3-70b',
'databricks/dbrx-instruct',
'deepinfra/airoboros-70b',
'lizpreciatior/lzlv_70b_fp16_hf',
'microsoft/WizardLM-2-7B',
'mistralai/Mixtral-8x22B-Instruct-v0.1',
] + vision_models
model_aliases = {
"llama-3.1-8b": "meta-llama/Meta-Llama-3.1-8B-Instruct",
"llama-3.2-90b": "meta-llama/Llama-3.2-90B-Vision-Instruct",
"llama-3.3-70b": "meta-llama/Llama-3.3-70B-Instruct-Turbo",
"llama-3.3-70b": "meta-llama/Llama-3.3-70B-Instruct",
"deepseek-v3": "deepseek-ai/DeepSeek-V3",
"mixtral-small-28b": "mistralai/Mistral-Small-24B-Instruct-2501",
"deepseek-r1": "deepseek-ai/DeepSeek-R1",
"deepseek-r1": "deepseek-ai/DeepSeek-R1-Distill-Llama-70B",
"deepseek-r1": "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
"deepseek-r1-distill-llama": "deepseek-ai/DeepSeek-R1-Distill-Llama-70B",
"deepseek-r1-distill-qwen": "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
"phi-4": "microsoft/phi-4",
"wizardlm-2-8x22b": "microsoft/WizardLM-2-8x22B",
"qwen-2.5-72b": "Qwen/Qwen2.5-72B-Instruct",
"yi-34b": "01-ai/Yi-34B-Chat",
"qwen-2-72b": "Qwen/Qwen2-72B-Instruct",
"dolphin-2.6": "cognitivecomputations/dolphin-2.6-mixtral-8x7b",
"dolphin-2.9": "cognitivecomputations/dolphin-2.9.1-llama-3-70b",
"dbrx-instruct": "databricks/dbrx-instruct",
"airoboros-70b": "deepinfra/airoboros-70b",
"lzlv-70b": "lizpreciatior/lzlv_70b_fp16_hf",
"wizardlm-2-7b": "microsoft/WizardLM-2-7B",
"mixtral-8x22b": "mistralai/Mixtral-8x22B-Instruct-v0.1",
"minicpm-2.5": "openbmb/MiniCPM-Llama3-V-2_5",
}
@classmethod
@@ -46,6 +68,7 @@ class DeepInfraChat(OpenaiTemplate):
temperature: float = 0.7,
max_tokens: int = None,
headers: dict = {},
images: ImagesType = None,
**kwargs
) -> AsyncResult:
headers = {
@@ -53,7 +76,35 @@ class DeepInfraChat(OpenaiTemplate):
'Origin': 'https://deepinfra.com',
'Referer': 'https://deepinfra.com/',
'X-Deepinfra-Source': 'web-page',
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
**headers
}
async for chunk in super().create_async_generator(model, messages, headers=headers, **kwargs):
if images is not None:
if not model or model not in cls.models:
model = cls.default_vision_model
if messages:
last_message = messages[-1].copy()
last_message["content"] = [
*[{
"type": "image_url",
"image_url": {"url": to_data_uri(image)}
} for image, _ in images],
{
"type": "text",
"text": last_message["content"]
}
]
messages[-1] = last_message
async for chunk in super().create_async_generator(
model,
messages,
headers=headers,
stream=stream,
top_p=top_p,
temperature=temperature,
max_tokens=max_tokens,
**kwargs
):
yield chunk
@@ -5,7 +5,7 @@ from aiohttp import ClientSession
from ..typing import AsyncResult, Messages
from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
from ..requests.raise_for_status import raise_for_status
from ..providers.response import FinishReason, Reasoning
from ..providers.response import FinishReason
from .helper import format_prompt
class Glider(AsyncGeneratorProvider, ProviderModelMixin):
@@ -6,9 +6,16 @@ class OIVSCode(OpenaiTemplate):
label = "OI VSCode Server"
url = "https://oi-vscode-server.onrender.com"
api_base = "https://oi-vscode-server.onrender.com/v1"
working = True
needs_auth = False
supports_stream = True
supports_system_message = True
supports_message_history = True
default_model = "gpt-4o-mini"
default_model = "gpt-4o-mini-2024-07-18"
default_vision_model = default_model
vision_models = [default_model, "gpt-4o-mini"]
vision_models = [default_model, "gpt-4o-mini"]
models = vision_models
model_aliases = {"gpt-4o-mini": "gpt-4o-mini-2024-07-18"}
@@ -17,9 +17,10 @@ class PerplexityLabs(AsyncGeneratorProvider, ProviderModelMixin):
default_model = "sonar-pro"
models = [
default_model,
"sonar",
default_model,
"sonar-reasoning",
"sonar-reasoning-pro",
]
@classmethod
@@ -37,21 +37,11 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
# Models configuration
default_model = "openai"
default_image_model = "flux"
default_vision_model = "gpt-4o"
extra_image_models = [
"flux",
"flux-pro",
"flux-realism",
"flux-anime",
"flux-3d",
"flux-cablyai",
"turbo",
"midjourney",
"dall-e-3",
]
extra_image_models = ["flux-pro", "flux-dev", "flux-schnell", "midjourney", "dall-e-3"]
vision_models = [default_vision_model, "gpt-4o-mini"]
reasoning_models = ['deepseek-reasoner', 'deepseek-r1']
extra_text_models = ["claude", "claude-email", "p1"] + vision_models + reasoning_models
extra_text_models = ["claude", "claude-email", "deepseek-reasoner", "deepseek-r1"] + vision_models
model_aliases = {
### Text Models ###
"gpt-4o-mini": "openai",
@@ -64,7 +54,6 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
"gpt-4o-mini": "rtist",
"gpt-4o": "searchgpt",
"gpt-4o-mini": "p1",
"deepseek-chat": "deepseek",
"deepseek-chat": "claude-hybridspace",
"llama-3.1-8b": "llamalight",
"gpt-4o-vision": "gpt-4o",
@@ -72,33 +61,38 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
"gpt-4o-mini": "claude",
"deepseek-chat": "claude-email",
"deepseek-r1": "deepseek-reasoner",
"gemini-2.0-flash": "gemini",
"gemini-2.0-flash-thinking": "gemini-thinking",
### Image Models ###
"sdxl-turbo": "turbo",
"flux-schnell": "flux",
"flux-dev": "flux",
}
text_models = []
image_models = []
@classmethod
def get_models(cls, **kwargs):
if not cls.text_models:
url = "https://image.pollinations.ai/models"
response = requests.get(url)
raise_for_status(response)
new_image_models = response.json()
cls.extra_image_models = list(dict.fromkeys([*cls.extra_image_models, *new_image_models]))
url = "https://text.pollinations.ai/models"
response = requests.get(url)
raise_for_status(response)
original_text_models = [model.get("name") for model in response.json()]
if not cls.text_models or not cls.image_models:
image_url = "https://image.pollinations.ai/models"
image_response = requests.get(image_url)
raise_for_status(image_response)
new_image_models = image_response.json()
cls.image_models = list(dict.fromkeys([*cls.extra_image_models, *new_image_models]))
cls.extra_image_models = cls.image_models.copy()
text_url = "https://text.pollinations.ai/models"
text_response = requests.get(text_url)
raise_for_status(text_response)
original_text_models = [model.get("name") for model in text_response.json()]
combined_text = cls.extra_text_models + [
model for model in original_text_models
if model not in cls.extra_text_models
]
cls.text_models = list(dict.fromkeys(combined_text))
return cls.text_models
return cls.text_models + cls.image_models
@classmethod
async def create_async_generator(
@@ -194,7 +188,7 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
yield ImagePreview(url, prompt)
async with ClientSession(headers=DEFAULT_HEADERS, connector=get_connector(proxy=proxy)) as session:
async with session.head(url) as response:
if response.status != 500: # Server is busy
if response.status != 500:
await raise_for_status(response)
yield ImageResponse(str(response.url), prompt)
@@ -256,12 +250,7 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
data = json.loads(json_str)
choice = data["choices"][0]
message = choice.get("message") or choice.get("delta", {})
# Handle reasoning content
if model in cls.reasoning_models:
if "reasoning_content" in message:
yield Reasoning(status=message["reasoning_content"].strip())
if "usage" in data:
yield Usage(**data["usage"])
content = message.get("content", "")
@@ -20,7 +20,6 @@ from .CablyAI import CablyAI
from .ChatGLM import ChatGLM
from .ChatGpt import ChatGpt
from .ChatGptEs import ChatGptEs
from .ChatGptt import ChatGptt
from .Cloudflare import Cloudflare
from .Copilot import Copilot
from .DDG import DDG
@@ -2,19 +2,18 @@ from __future__ import annotations
import os
import re
from aiohttp import ClientSession
from ..typing import AsyncResult, Messages
from ..requests.raise_for_status import raise_for_status
from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
from .helper import format_prompt
from ...typing import AsyncResult, Messages
from ...requests.raise_for_status import raise_for_status
from ..base_provider import AsyncGeneratorProvider, ProviderModelMixin
from ..helper import format_prompt
class ChatGptt(AsyncGeneratorProvider, ProviderModelMixin):
url = "https://chatgptt.me"
api_endpoint = "https://chatgptt.me/wp-admin/admin-ajax.php"
working = True
working = False
supports_stream = True
supports_system_message = True
supports_message_history = True
@@ -41,10 +40,22 @@ class ChatGptt(AsyncGeneratorProvider, ProviderModelMixin):
}
async with ClientSession(headers=headers) as session:
# Get initial page content
initial_response = await session.get(cls.url)
nonce_ = re.findall(r'data-nonce="(.+?)"', await initial_response.text())[0]
post_id = re.findall(r'data-post-id="(.+?)"', await initial_response.text())[0]
await raise_for_status(initial_response)
html = await initial_response.text()
# Extract nonce and post ID with error handling
nonce_match = re.search(r'data-nonce=["\']([^"\']+)["\']', html)
post_id_match = re.search(r'data-post-id=["\']([^"\']+)["\']', html)
if not nonce_match or not post_id_match:
raise RuntimeError("Required authentication tokens not found in page HTML")
nonce_ = nonce_match.group(1)
post_id = post_id_match.group(1)
# Prepare payload with session data
payload = {
'_wpnonce': nonce_,
'post_id': post_id,
@@ -57,7 +68,8 @@ class ChatGptt(AsyncGeneratorProvider, ProviderModelMixin):
'wpaicg_chat_history': None
}
# Stream the response
async with session.post(cls.api_endpoint, headers=headers, data=payload, proxy=proxy) as response:
await raise_for_status(response)
result = await response.json()
yield result['data']
yield result['data']