XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

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
kqlio67 <166700875+kqlio67@users.noreply.github.com>
提交于

代码差异

15 个文件 +381 -229
Modified docs/client.md +1 -1
@@ -181,8 +181,8 @@ for chunk in stream:
181 181 if chunk.choices[0].delta.content:
182 182 print(chunk.choices[0].delta.content or "", end="")
183 183 ```
184 184
185 ---
185 186 ### Using a Vision Model
186 187 **Analyze an image and generate a description:**
187 188 ```python
Modified docs/providers-and-models.md +34 -25
@@ -38,18 +38,16 @@ This document provides an overview of various AI providers and models, including
38 38 | Website | API Credentials | Provider | Text Models | Image Models | Vision (Image Upload) | Stream | Status |
39 39 |----------|-------------|--------------|---------------|--------|--------|------|------|
40 40 |[aichatfree.info](https://aichatfree.info)|No auth required|`g4f.Provider.AIChatFree`|`gemini-1.5-pro` _**(1+)**_|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
41 |[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`|✔|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
42 |[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`|✔|![](https://img.shields.io/badge/Active-brightgreen)|
41 |[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`|✔|![](https://img.shields.io/badge/Active-brightgreen)|
43 42 |[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`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
44 |[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+)**_|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
43 |[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+)**_|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
45 44 |[chatglm.cn](https://chatglm.cn)|No auth required|`g4f.Provider.ChatGLM`|`glm-4`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
46 45 |[chatgpt.com](https://chatgpt.com)|No auth required|`g4f.Provider.ChatGpt`|✔ _**(+7)**_|❌|❌|✔|![Error](https://img.shields.io/badge/HTTPError-f48d37)|
47 46 |[chatgpt.es](https://chatgpt.es)|No auth required|`g4f.Provider.ChatGptEs`|`gpt-4, gpt-4o, gpt-4o-mini`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
48 |[chatgptt.me](https://chatgptt.me)|No auth required|`g4f.Provider.ChatGptt`|`gpt-4, gpt-4o, gpt-4o-mini`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
49 47 |[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`|❌|❌|✔|![Error](https://img.shields.io/badge/Active-brightgreen)|❌|
50 48 |[copilot.microsoft.com](https://copilot.microsoft.com)|Optional API key|`g4f.Provider.Copilot`|`gpt-4, gpt-4o`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
51 49 |[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`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
52 |[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`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
50 |[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`|✔|![](https://img.shields.io/badge/Active-brightgreen)|
53 51 |[chat10.free2gpt.xyz](https://chat10.free2gpt.xyz)|No auth required|`g4f.Provider.Free2GPT`|`mistral-7b`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
54 52 |[freegptsnav.aifree.site](https://freegptsnav.aifree.site)|No auth required|`g4f.Provider.FreeGpt`|`gemini-1.5-pro`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
55 53 |[app.giz.ai/assistant](https://app.giz.ai/assistant)|No auth required|`g4f.Provider.GizAI`|`gemini-1.5-flash`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
@@ -63,10 +61,10 @@ This document provides an overview of various AI providers and models, including
63 61 |[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`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
64 62 |[mhystical.cc](https://mhystical.cc)|[Optional API key](https://mhystical.cc/dashboard)|`g4f.Provider.Mhystical`|`gpt-4`|❌|❌|✔|![Error](https://img.shields.io/badge/Active-brightgreen)|
65 63 |[oi-vscode-server.onrender.com](https://oi-vscode-server.onrender.com)|No auth required|`g4f.Provider.OIVSCode`|`gpt-4o-mini`|❌|`gpt-4o-mini`|✔|![](https://img.shields.io/badge/Active-brightgreen)|
66 |[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`|❌|❌|✔|![Error](https://img.shields.io/badge/Active-brightgreen)|
64 |[labs.perplexity.ai](https://labs.perplexity.ai)|No auth required|`g4f.Provider.PerplexityLabs`|`sonar, sonar-pro, sonar-reasoning, sonar-reasoning-pro`|❌|❌|✔|![Error](https://img.shields.io/badge/Active-brightgreen)|
67 65 |[pi.ai/talk](https://pi.ai/talk)|[Manual cookies](https://pi.ai/talk)|`g4f.Provider.Pi`|`pi`|❌|❌|✔|![Error](https://img.shields.io/badge/Active-brightgreen)|
68 66 |[pizzagpt.it](https://www.pizzagpt.it)|No auth required|`g4f.Provider.Pizzagpt`|`gpt-4o-mini`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
69 |[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|✔|![](https://img.shields.io/badge/Active-brightgreen)|
67 |[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|✔|![](https://img.shields.io/badge/Active-brightgreen)|
70 68 |[app.prodia.com](https://app.prodia.com)|No auth required|`g4f.Provider.Prodia`|❌|✔ _**(46)**_|❌|❌|![](https://img.shields.io/badge/Active-brightgreen)|
71 69 |[teach-anything.com](https://www.teach-anything.com)|No auth required|`g4f.Provider.TeachAnything`|`llama-3.1-70b`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
72 70 |[you.com](https://you.com)|[Manual cookies](https://you.com)|`g4f.Provider.You`|✔|✔|✔|✔|![](https://img.shields.io/badge/Active-brightgreen)|
@@ -124,12 +122,13 @@ This document provides an overview of various AI providers and models, including
124 122 ### Text Models
125 123 | Model | Base Provider | Providers | Website |
126 124 |-------|---------------|-----------|---------|
127 |gpt-4|OpenAI|10+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4)|
125 |gpt-4|OpenAI|9+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4)|
128 126 |gpt-4o|OpenAI|7+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4o)|
129 |gpt-4o-mini|OpenAI|9+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4o-mini)|
127 |gpt-4o-mini|OpenAI|8+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4o-mini)|
130 128 |o1|OpenAI|1+ Providers|[openai.com](https://openai.com/index/introducing-openai-o1-preview/)|
131 129 |o1-preview|OpenAI|1+ Providers|[openai.com](https://openai.com/index/introducing-openai-o1-preview/)|
132 130 |o1-mini|OpenAI|1+ Providers|[openai.com](https://openai.com/index/openai-o1-mini-advancing-cost-efficient-reasoning/)|
131 |o3-mini|OpenAI|2+ Providers|[openai.com](https://openai.com/index/openai-o3-mini/)|
133 132 |o3-mini-low|OpenAI|1+ Providers|[openai.com](https://openai.com/index/openai-o3-mini/)|
134 133 |gigachat|GigaChat|1+ Providers|[developers.sber.ru/gigachat](https://developers.sber.ru/gigachat)|
135 134 |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
145 144 |llama-3.2-90b|Meta Llama|1+ Providers|[huggingface.co](https://huggingface.co/meta-llama/Llama-3.2-90B-Vision)|
146 145 |llama-3.3-70b|Meta Llama|6+ Providers|[ai.meta.com](https://ai.meta.com/blog/llama-3-3/)|
147 146 |mixtral-8x7b|Mistral|2+ Providers|[mistral.ai](https://mistral.ai/news/mixtral-of-experts/)|
147 |mixtral-8x22b|Mistral|1+ Providers|[huggingface.co](https://huggingface.co/mistralai/Mixtral-8x22B-Instruct-v0.1)|
148 148 |mistral-nemo|Mistral|3+ Providers|[huggingface.co](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407)|
149 |mixtral-small-28b|Mistral|2+ Providers|[mistral.ai](https://mistral.ai/news/mixtral-small-28b/)|
149 |mixtral-small-28b|Mistral|3+ Providers|[mistral.ai](https://mistral.ai/news/mixtral-small-28b/)|
150 150 |hermes-2-dpo|NousResearch|2+ Providers|[huggingface.co](https://huggingface.co/NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO)|
151 |hermes-3|NousResearch|1+ Providers|[huggingface.co](https://huggingface.co/NousResearch/Hermes-3-Llama-3.2-3B)|
151 152 |phi-3.5-mini|Microsoft|1+ Providers|[huggingface.co](https://huggingface.co/microsoft/Phi-3.5-mini-instruct)|
152 153 |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)|
154 |wizardlm-2-7b|Microsoft|1+ Providers|[wizardlm.github.io](https://wizardlm.github.io/WizardLM2/)|
153 155 |wizardlm-2-8x22b|Microsoft|2+ Providers|[wizardlm.github.io](https://wizardlm.github.io/WizardLM2/)|
154 156 |gemini|Google DeepMind|1+|[deepmind.google](http://deepmind.google/technologies/gemini/)|
155 157 |gemini-exp|Google DeepMind|1+ Providers|[blog.google](https://blog.google/feed/gemini-exp-1206/)|
156 158 |gemini-1.5-flash|Google DeepMind|5+ Providers|[deepmind.google](https://deepmind.google/technologies/gemini/flash/)|
157 159 |gemini-1.5-pro|Google DeepMind|5+ Providers|[deepmind.google](https://deepmind.google/technologies/gemini/pro/)|
158 |gemini-2.0-flash|Google DeepMind|2+ Providers|[deepmind.google](https://deepmind.google/technologies/gemini/flash/)|
160 |gemini-2.0-flash|Google DeepMind|3+ Providers|[deepmind.google](https://deepmind.google/technologies/gemini/flash/)|
159 161 |gemini-2.0-flash-thinking|Google DeepMind|1+ Providers|[ai.google.dev](https://ai.google.dev/gemini-api/docs/thinking-mode)|
160 162 |claude-3-haiku|Anthropic|2+ Providers|[anthropic.com](https://www.anthropic.com/news/claude-3-haiku)|
161 163 |claude-3-sonnet|Anthropic|1+ Providers|[anthropic.com](https://www.anthropic.com/news/claude-3-family)|
162 164 |claude-3-opus|Anthropic|2+ Providers|[anthropic.com](https://www.anthropic.com/news/claude-3-family)|
163 |claude-3.5-sonnet|Anthropic|2+ Providers|[anthropic.com](https://www.anthropic.com/news/claude-3-5-sonnet)|
165 |claude-3.5-sonnet|Anthropic|3+ Providers|[anthropic.com](https://www.anthropic.com/news/claude-3-5-sonnet)|
164 166 |reka-core|Reka AI|1+ Providers|[reka.ai](https://www.reka.ai/ourmodels)|
165 167 |blackboxai|Blackbox AI|1+ Providers|[docs.blackbox.chat](https://docs.blackbox.chat/blackbox-ai-1)|
166 168 |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
168 170 |command-r-plus|CohereForAI|2+ Providers|[docs.cohere.com](https://docs.cohere.com/docs/command-r-plus)|
169 171 |command-r7b|CohereForAI|1+ Providers|[huggingface.co](https://huggingface.co/CohereForAI/c4ai-command-r7b-12-2024)|
170 172 |qwen-1.5-7b|Qwen|1+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen1.5-7B)|
171 |qwen-2-72b|Qwen|1+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2-72B)|
173 |qwen-2-72b|Qwen|2+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2-72B)|
172 174 |qwen-2-vl-7b|Qwen|1+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2-VL-7B)|
173 175 |qwen-2.5-72b|Qwen|3+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2.5-72B-Instruct)|
174 |qwen-2.5-coder-32b|Qwen|4+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2.5-Coder-32B)|
176 |qwen-2.5-coder-32b|Qwen|3+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2.5-Coder-32B)|
175 177 |qwen-2.5-1m-demo|Qwen|1+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2.5-1M-Demo)|
176 |qwq-32b|Qwen|5+ Providers|[huggingface.co](https://huggingface.co/Qwen/QwQ-32B-Preview)|
178 |qwq-32b|Qwen|4+ Providers|[huggingface.co](https://huggingface.co/Qwen/QwQ-32B-Preview)|
177 179 |qvq-72b|Qwen|1+ Providers|[huggingface.co](https://huggingface.co/Qwen/QVQ-72B-Preview)|
178 180 |pi|Inflection|1+ Providers|[inflection.ai](https://inflection.ai/blog/inflection-2-5)|
179 181 |deepseek-chat|DeepSeek|4+ Providers|[huggingface.co](https://huggingface.co/deepseek-ai/deepseek-llm-67b-chat)|
180 |deepseek-v3|DeepSeek|4+ Providers|[api-docs.deepseek.com](https://api-docs.deepseek.com/news/news250120)|
181 |deepseek-r1|DeepSeek|8+ Providers|[api-docs.deepseek.com](https://api-docs.deepseek.com/news/news250120)|
182 |deepseek-v3|DeepSeek|5+ Providers|[api-docs.deepseek.com](https://api-docs.deepseek.com/news/news250120)|
183 |deepseek-r1|DeepSeek|10+ Providers|[api-docs.deepseek.com](https://api-docs.deepseek.com/news/news250120)|
182 184 |grok-2|x.ai|1+|[x.ai](https://x.ai/blog/grok-2)|
183 |sonar|Perplexity AI|1+ Providers|[docs.perplexity.ai](https://docs.perplexity.ai/)|
184 |sonar-pro|Perplexity AI|1+ Providers|[docs.perplexity.ai](https://docs.perplexity.ai/)|
185 |sonar-reasoning|Perplexity AI|1+ Providers|[docs.perplexity.ai](https://docs.perplexity.ai/)|
186 |nemotron-70b|Nvidia|3+ Providers|[build.nvidia.com](https://build.nvidia.com/nvidia/llama-3_1-nemotron-70b-instruct)|
187 |dbrx-instruct|Databricks|2+ Providers|[huggingface.co](https://huggingface.co/databricks/dbrx-instruct)|
185 |sonar|Perplexity AI|1+ Providers|[sonar.perplexity.ai](https://sonar.perplexity.ai/)|
186 |sonar-pro|Perplexity AI|1+ Providers|[sonar.perplexity.ai](https://sonar.perplexity.ai/)|
187 |sonar-reasoning|Perplexity AI|2+ Providers|[sonar.perplexity.ai](https://sonar.perplexity.ai/)|
188 |sonar-reasoning-pro|Perplexity AI|1+ Providers|[sonar.perplexity.ai](https://sonar.perplexity.ai/)|
189 |nemotron-70b|Nvidia|2+ Providers|[build.nvidia.com](https://build.nvidia.com/nvidia/llama-3_1-nemotron-70b-instruct)|
190 |dbrx-instruct|Databricks|3+ Providers|[huggingface.co](https://huggingface.co/databricks/dbrx-instruct)|
188 191 |glm-4|THUDM|1+ Providers|[github.com/THUDM](https://github.com/THUDM/GLM-4)|
189 192 |mini_max|MiniMax|1+ Providers|[hailuo.ai](https://www.hailuo.ai/)|
190 |evil|Evil Mode - Experimental|1+ Providers||
193 |yi-34b|01-ai|1+ Providers|[huggingface.co](https://huggingface.co/01-ai/Yi-34B-Chat)|
194 |dolphin-2.6|Cognitive Computations|1+ Providers|[huggingface.co](https://huggingface.co/cognitivecomputations/dolphin-2.6-mixtral-8x7b)|
195 |dolphin-2.9|Cognitive Computations|1+ Providers|[huggingface.co](https://huggingface.co/cognitivecomputations/dolphin-2.9.1-llama-3-70b)|
196 |airoboros-70b|DeepInfra|1+ Providers|[huggingface.co](https://huggingface.co/cognitivecomputations/dolphin-2.9.1-llama-3-70b)|
197 |lzlv-70b|Lizpreciatior|1+ Providers|[huggingface.co](https://huggingface.co/cognitivecomputations/dolphin-2.9.1-llama-3-70b)|
198 |minicpm-2.5|OpenBMB|1+ Providers|[huggingface.co](https://huggingface.co/openbmb/MiniCPM-Llama3-V-2_5)|
199 |evil|Evil Mode - Experimental|1+ Providers|[]( )|
191 200
192 201 ---
193 202 ### Image Models
@@ -197,8 +206,8 @@ This document provides an overview of various AI providers and models, including
197 206 |sd-3.5|Stability AI|1+ Providers|[huggingface.co](https://huggingface.co/stabilityai/stable-diffusion-3.5-large)|
198 207 |flux|Black Forest Labs|3+ Providers|[github.com/black-forest-labs/flux](https://github.com/black-forest-labs/flux)|
199 208 |flux-pro|Black Forest Labs|1+ Providers|[huggingface.co](https://huggingface.co/enhanceaiteam/FLUX.1-Pro)|
200 |flux-dev|Black Forest Labs|3+ Providers|[huggingface.co](https://huggingface.co/black-forest-labs/FLUX.1-dev)|
201 |flux-schnell|Black Forest Labs|3+ Providers|[huggingface.co](https://huggingface.co/black-forest-labs/FLUX.1-schnell)|
209 |flux-dev|Black Forest Labs|4+ Providers|[huggingface.co](https://huggingface.co/black-forest-labs/FLUX.1-dev)|
210 |flux-schnell|Black Forest Labs|4+ Providers|[huggingface.co](https://huggingface.co/black-forest-labs/FLUX.1-schnell)|
202 211 |dall-e-3|OpenAI|5+ Providers|[openai.com](https://openai.com/index/dall-e/)|
203 212 |midjourney|Midjourney|1+ Providers|[docs.midjourney.com](https://docs.midjourney.com/docs/model-versions)|
204 213
Modified g4f/Provider/Blackbox.py +17 -56
@@ -15,7 +15,7 @@ from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
15 15 from ..image import to_data_uri
16 16 from ..cookies import get_cookies_dir
17 17 from .helper import format_prompt, format_image_prompt
18 from ..providers.response import JsonConversation, ImageResponse, Reasoning
18 from ..providers.response import JsonConversation, ImageResponse
19 19
20 20 class Conversation(JsonConversation):
21 21 validated_value: str = None
@@ -39,10 +39,9 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
39 39 default_vision_model = default_model
40 40 default_image_model = 'ImageGeneration'
41 41 image_models = [default_image_model]
42 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']
43 reasoning_models = ['DeepSeek-R1']
42 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']
44 43
45 userSelectedModel = ['gpt-4o', 'o3-mini', 'claude-sonnet-3.5', 'gemini-pro', 'blackboxai-pro']
44 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']
46 45
47 46 agentMode = {
48 47 'DeepSeek-V3': {'mode': True, 'id': "deepseek-chat", 'name': "DeepSeek-V3"},
@@ -56,6 +55,7 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
56 55 }
57 56
58 57 trendingAgentMode = {
58 "o3-mini": {'mode': True, 'id': 'o3-mini'},
59 59 "gemini-1.5-flash": {'mode': True, 'id': 'Gemini'},
60 60 "llama-3.1-8b": {'mode': True, 'id': "llama-3.1-8b"},
61 61 'llama-3.1-70b': {'mode': True, 'id': "llama-3.1-70b"},
@@ -94,9 +94,11 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
94 94 'builder Agent': {'mode': True, 'id': "builder Agent"},
95 95 }
96 96
97 models = list(dict.fromkeys([default_model, *userSelectedModel, *reasoning_models, *image_models, *list(agentMode.keys()), *list(trendingAgentMode.keys())]))
97 models = list(dict.fromkeys([default_model, *userSelectedModel, *image_models, *list(agentMode.keys()), *list(trendingAgentMode.keys())]))
98 98
99 99 model_aliases = {
100 "gpt-4": "gpt-4o",
101 "claude-3.5-sonnet": "claude-sonnet-3.5",
100 102 "gemini-1.5-flash": "gemini-1.5-flash",
101 103 "gemini-1.5-pro": "gemini-pro",
102 104 "deepseek-v3": "DeepSeek-V3",
@@ -177,7 +179,6 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
177 179 messages: Messages,
178 180 prompt: str = None,
179 181 proxy: str = None,
180 web_search: bool = False,
181 182 images: ImagesType = None,
182 183 top_p: float = None,
183 184 temperature: float = None,
@@ -283,60 +284,20 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
283 284 "vscodeClient": False,
284 285 "codeInterpreterMode": False,
285 286 "customProfile": {"name": "", "occupation": "", "traits": [], "additionalInfo": "", "enableNewChats": False},
286 "webSearchMode": web_search
287 "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"},
288 "webSearchMode": False
287 289 }
288 290
289 291 async with session.post(cls.api_endpoint, json=data, proxy=proxy) as response:
290 292 await raise_for_status(response)
291 response_text = await response.text()
292 parts = response_text.split('$~~~$')
293 text_to_yield = parts[2] if len(parts) >= 3 else response_text
294
295 if not text_to_yield or text_to_yield.isspace():
296 return
297
298 if model in cls.reasoning_models and "\n\n\n" in text_to_yield:
299 think_split = text_to_yield.split("\n\n\n", 1)
300 if len(think_split) > 1:
301 think_content, answer = think_split[0].strip(), think_split[1].strip()
302 yield Reasoning(status=think_content)
303 yield answer
304 else:
305 yield text_to_yield
306 elif "<think>" in text_to_yield:
307 pre_think, rest = text_to_yield.split('<think>', 1)
308 think_content, post_think = rest.split('</think>', 1)
309
310 pre_think = pre_think.strip()
311 think_content = think_content.strip()
312 post_think = post_think.strip()
313
314 if pre_think:
315 yield pre_think
316 if think_content:
317 yield Reasoning(status=think_content)
318 if post_think:
319 yield post_think
320
321 elif "Generated by BLACKBOX.AI" in text_to_yield:
322 conversation.validated_value = await cls.fetch_validated(force_refresh=True)
323 if conversation.validated_value:
324 data["validated"] = conversation.validated_value
325 async with session.post(cls.api_endpoint, json=data, proxy=proxy) as new_response:
326 await raise_for_status(new_response)
327 new_response_text = await new_response.text()
328 new_parts = new_response_text.split('$~~~$')
329 new_text = new_parts[2] if len(new_parts) >= 3 else new_response_text
330
331 if new_text and not new_text.isspace():
332 yield new_text
333 else:
334 if text_to_yield and not text_to_yield.isspace():
335 yield text_to_yield
336 else:
337 if text_to_yield and not text_to_yield.isspace():
338 yield text_to_yield
293 full_response = []
294 async for chunk in response.content.iter_any():
295 if chunk:
296 chunk_text = chunk.decode()
297 full_response.append(chunk_text)
298 yield chunk_text
339 299
340 300 if return_conversation:
341 conversation.message_history.append({"role": "assistant", "content": text_to_yield})
301 full_response_text = ''.join(full_response)
302 conversation.message_history.append({"role": "assistant", "content": full_response_text})
342 303 yield conversation
Modified g4f/Provider/BlackboxAPI.py +2 -28
@@ -5,7 +5,6 @@ from aiohttp import ClientSession
5 5 from ..typing import AsyncResult, Messages
6 6 from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
7 7 from ..requests.raise_for_status import raise_for_status
8 from ..providers.response import Reasoning
9 8 from .helper import format_prompt
10 9
11 10 class BlackboxAPI(AsyncGeneratorProvider, ProviderModelMixin):
@@ -20,15 +19,15 @@ class BlackboxAPI(AsyncGeneratorProvider, ProviderModelMixin):
20 19 supports_message_history = True
21 20
22 21 default_model = 'deepseek-ai/DeepSeek-V3'
23 reasoning_models = ['deepseek-ai/DeepSeek-R1']
24 22 models = [
25 23 default_model,
24 'deepseek-ai/DeepSeek-R1',
26 25 'mistralai/Mistral-Small-24B-Instruct-2501',
27 26 'deepseek-ai/deepseek-llm-67b-chat',
28 27 'databricks/dbrx-instruct',
29 28 'Qwen/QwQ-32B-Preview',
30 29 'NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO'
31 ] + reasoning_models
30 ]
32 31
33 32 model_aliases = {
34 33 "deepseek-v3": "deepseek-ai/DeepSeek-V3",
@@ -65,39 +64,14 @@ class BlackboxAPI(AsyncGeneratorProvider, ProviderModelMixin):
65 64 async with session.post(cls.api_endpoint, json=data, proxy=proxy) as response:
66 65 await raise_for_status(response)
67 66
68 is_reasoning = False
69 current_reasoning = ""
70
71 67 async for chunk in response.content:
72 68 if not chunk:
73 69 continue
74 70
75 71 text = chunk.decode(errors='ignore')
76 72
77 if model in cls.reasoning_models:
78 if "<think>" in text:
79 text = text.replace("<think>", "")
80 is_reasoning = True
81 current_reasoning = text
82 continue
83
84 if "</think>" in text:
85 text = text.replace("</think>", "")
86 is_reasoning = False
87 current_reasoning += text
88 yield Reasoning(status=current_reasoning.strip())
89 current_reasoning = ""
90 continue
91
92 if is_reasoning:
93 current_reasoning += text
94 continue
95
96 73 try:
97 74 if text:
98 75 yield text
99 76 except Exception as e:
100 77 return
101
102 if is_reasoning and current_reasoning:
103 yield Reasoning(status=current_reasoning.strip())
Modified g4f/Provider/CablyAI.py +55 -15
@@ -4,33 +4,45 @@ from ..errors import ModelNotSupportedError
4 4 from .template import OpenaiTemplate
5 5
6 6 class CablyAI(OpenaiTemplate):
7 label = "CablyAI"
8 url = "https://cablyai.com"
9 login_url = url
7 url = "https://cablyai.com/chat"
8 login_url = "https://cablyai.com"
10 9 api_base = "https://cablyai.com/v1"
11 10 api_key = "sk-your-openai-api-key"
12
11
13 12 working = True
14 13 needs_auth = False
14 supports_stream = True
15 supports_system_message = True
16 supports_message_history = True
15 17
16 18 default_model = 'gpt-4o-mini'
17 reasoning_models = ['deepseek-r1-uncensored']
18 19 fallback_models = [
19 20 default_model,
20 21 'searchgpt',
21 'llama-3.1-8b-instruct',
22 'deepseek-r1-uncensored',
23 'deepseek-r1',
24 'deepseek-reasoner',
22 25 'deepseek-v3',
23 'tinyswallow1.5b',
24 26 'andy-3.5',
27 'hermes-3-llama-3.2-3b',
28 'llama-3.1-8b-instruct',
29 'o3-mini',
25 30 'o3-mini-low',
26 ] + reasoning_models
27
31 'sonar-reasoning',
32 'tinyswallow1.5b',
33 ]
34
28 35 model_aliases = {
29 "gpt-4o-mini": "searchgpt",
30 "llama-3.1-8b": "llama-3.1-8b-instruct",
31 "deepseek-r1": "deepseek-r1-uncensored",
36 "gpt-4o-mini": "searchgpt (free)",
37 "deepseek-r1": "deepseek-r1-uncensored (free)",
38 "deepseek-r1": "deepseek-reasoner (free)",
39 "hermes-3": "hermes-3-llama-3.2-3b (free)",
40 "llama-3.1-8b": "llama-3.1-8b-instruct (free)",
41 "o3-mini-low": "o3-mini-low (free)",
42 "o3-mini": "o3-mini-low (free)",
43 "o3-mini": "o3-mini (free)",
32 44 }
33
45
34 46 @classmethod
35 47 def get_models(cls, api_key: str = None, api_base: str = None) -> list[str]:
36 48 models = super().get_models(api_key, api_base);
@@ -42,6 +54,34 @@ class CablyAI(OpenaiTemplate):
42 54 model = super().get_model(model, **kwargs)
43 55 return model.split(" (free)")[0]
44 56 except ModelNotSupportedError:
45 if f"{model} (free)" in cls.models:
57 if f"f{model} (free)" in cls.models:
46 58 return model
47 raise
59 raise
60
61 @classmethod
62 def create_async_generator(
63 cls,
64 model: str,
65 messages: Messages,
66 api_key: str = None,
67 stream: bool = True,
68 **kwargs
69 ) -> AsyncResult:
70 api_key = api_key or cls.api_key
71 headers = {
72 "Accept": "*/*",
73 "Accept-Language": "en-US,en;q=0.9",
74 "Authorization": f"Bearer {api_key}",
75 "Content-Type": "application/json",
76 "Origin": cls.url,
77 "Referer": f"{cls.url}/chat",
78 "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
79 }
80 return super().create_async_generator(
81 model=model,
82 messages=messages,
83 api_key=api_key,
84 stream=stream,
85 headers=headers,
86 **kwargs
87 )
Modified g4f/Provider/DeepInfraChat.py +58 -7
@@ -1,7 +1,8 @@
1 1 from __future__ import annotations
2 2
3 from ..typing import AsyncResult, Messages
3 from ..typing import AsyncResult, Messages, ImagesType
4 4 from .template import OpenaiTemplate
5 from ..image import to_data_uri
5 6
6 7 class DeepInfraChat(OpenaiTemplate):
7 8 url = "https://deepinfra.com/chat"
@@ -9,10 +10,12 @@ class DeepInfraChat(OpenaiTemplate):
9 10 working = True
10 11
11 12 default_model = 'meta-llama/Llama-3.3-70B-Instruct-Turbo'
13 default_vision_model = 'meta-llama/Llama-3.2-90B-Vision-Instruct'
14 vision_models = [default_vision_model, 'openbmb/MiniCPM-Llama3-V-2_5']
12 15 models = [
13 16 'meta-llama/Meta-Llama-3.1-8B-Instruct',
14 'meta-llama/Llama-3.2-90B-Vision-Instruct',
15 17 default_model,
18 'meta-llama/Llama-3.3-70B-Instruct',
16 19 'deepseek-ai/DeepSeek-V3',
17 20 'mistralai/Mistral-Small-24B-Instruct-2501',
18 21 'deepseek-ai/DeepSeek-R1',
@@ -21,19 +24,38 @@ class DeepInfraChat(OpenaiTemplate):
21 24 'microsoft/phi-4',
22 25 'microsoft/WizardLM-2-8x22B',
23 26 'Qwen/Qwen2.5-72B-Instruct',
24 ]
27 '01-ai/Yi-34B-Chat',
28 'Qwen/Qwen2-72B-Instruct',
29 'cognitivecomputations/dolphin-2.6-mixtral-8x7b',
30 'cognitivecomputations/dolphin-2.9.1-llama-3-70b',
31 'databricks/dbrx-instruct',
32 'deepinfra/airoboros-70b',
33 'lizpreciatior/lzlv_70b_fp16_hf',
34 'microsoft/WizardLM-2-7B',
35 'mistralai/Mixtral-8x22B-Instruct-v0.1',
36 ] + vision_models
25 37 model_aliases = {
26 38 "llama-3.1-8b": "meta-llama/Meta-Llama-3.1-8B-Instruct",
27 39 "llama-3.2-90b": "meta-llama/Llama-3.2-90B-Vision-Instruct",
28 40 "llama-3.3-70b": "meta-llama/Llama-3.3-70B-Instruct-Turbo",
41 "llama-3.3-70b": "meta-llama/Llama-3.3-70B-Instruct",
29 42 "deepseek-v3": "deepseek-ai/DeepSeek-V3",
30 43 "mixtral-small-28b": "mistralai/Mistral-Small-24B-Instruct-2501",
31 44 "deepseek-r1": "deepseek-ai/DeepSeek-R1",
32 "deepseek-r1": "deepseek-ai/DeepSeek-R1-Distill-Llama-70B",
33 "deepseek-r1": "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
45 "deepseek-r1-distill-llama": "deepseek-ai/DeepSeek-R1-Distill-Llama-70B",
46 "deepseek-r1-distill-qwen": "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
34 47 "phi-4": "microsoft/phi-4",
35 48 "wizardlm-2-8x22b": "microsoft/WizardLM-2-8x22B",
36 "qwen-2.5-72b": "Qwen/Qwen2.5-72B-Instruct",
49 "yi-34b": "01-ai/Yi-34B-Chat",
50 "qwen-2-72b": "Qwen/Qwen2-72B-Instruct",
51 "dolphin-2.6": "cognitivecomputations/dolphin-2.6-mixtral-8x7b",
52 "dolphin-2.9": "cognitivecomputations/dolphin-2.9.1-llama-3-70b",
53 "dbrx-instruct": "databricks/dbrx-instruct",
54 "airoboros-70b": "deepinfra/airoboros-70b",
55 "lzlv-70b": "lizpreciatior/lzlv_70b_fp16_hf",
56 "wizardlm-2-7b": "microsoft/WizardLM-2-7B",
57 "mixtral-8x22b": "mistralai/Mixtral-8x22B-Instruct-v0.1",
58 "minicpm-2.5": "openbmb/MiniCPM-Llama3-V-2_5",
37 59 }
38 60
39 61 @classmethod
@@ -46,6 +68,7 @@ class DeepInfraChat(OpenaiTemplate):
46 68 temperature: float = 0.7,
47 69 max_tokens: int = None,
48 70 headers: dict = {},
71 images: ImagesType = None,
49 72 **kwargs
50 73 ) -> AsyncResult:
51 74 headers = {
@@ -53,7 +76,35 @@ class DeepInfraChat(OpenaiTemplate):
53 76 'Origin': 'https://deepinfra.com',
54 77 'Referer': 'https://deepinfra.com/',
55 78 'X-Deepinfra-Source': 'web-page',
79 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
56 80 **headers
57 81 }
58 async for chunk in super().create_async_generator(model, messages, headers=headers, **kwargs):
82
83 if images is not None:
84 if not model or model not in cls.models:
85 model = cls.default_vision_model
86 if messages:
87 last_message = messages[-1].copy()
88 last_message["content"] = [
89 *[{
90 "type": "image_url",
91 "image_url": {"url": to_data_uri(image)}
92 } for image, _ in images],
93 {
94 "type": "text",
95 "text": last_message["content"]
96 }
97 ]
98 messages[-1] = last_message
99
100 async for chunk in super().create_async_generator(
101 model,
102 messages,
103 headers=headers,
104 stream=stream,
105 top_p=top_p,
106 temperature=temperature,
107 max_tokens=max_tokens,
108 **kwargs
109 ):
59 110 yield chunk
Modified g4f/Provider/Glider.py +1 -1
@@ -5,7 +5,7 @@ from aiohttp import ClientSession
5 5 from ..typing import AsyncResult, Messages
6 6 from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
7 7 from ..requests.raise_for_status import raise_for_status
8 from ..providers.response import FinishReason, Reasoning
8 from ..providers.response import FinishReason
9 9 from .helper import format_prompt
10 10
11 11 class Glider(AsyncGeneratorProvider, ProviderModelMixin):
Modified g4f/Provider/OIVSCode.py +9 -2
@@ -6,9 +6,16 @@ class OIVSCode(OpenaiTemplate):
6 6 label = "OI VSCode Server"
7 7 url = "https://oi-vscode-server.onrender.com"
8 8 api_base = "https://oi-vscode-server.onrender.com/v1"
9
9 10 working = True
10 11 needs_auth = False
12 supports_stream = True
13 supports_system_message = True
14 supports_message_history = True
11 15
12 default_model = "gpt-4o-mini"
16 default_model = "gpt-4o-mini-2024-07-18"
13 17 default_vision_model = default_model
14 vision_models = [default_model, "gpt-4o-mini"]
18 vision_models = [default_model, "gpt-4o-mini"]
19 models = vision_models
20
21 model_aliases = {"gpt-4o-mini": "gpt-4o-mini-2024-07-18"}
Modified g4f/Provider/PerplexityLabs.py +2 -1
@@ -17,9 +17,10 @@ class PerplexityLabs(AsyncGeneratorProvider, ProviderModelMixin):
17 17
18 18 default_model = "sonar-pro"
19 19 models = [
20 default_model,
21 20 "sonar",
21 default_model,
22 22 "sonar-reasoning",
23 "sonar-reasoning-pro",
23 24 ]
24 25
25 26 @classmethod
Modified g4f/Provider/PollinationsAI.py +24 -35
@@ -37,21 +37,11 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
37 37
38 38 # Models configuration
39 39 default_model = "openai"
40 default_image_model = "flux"
40 41 default_vision_model = "gpt-4o"
41 extra_image_models = [
42 "flux",
43 "flux-pro",
44 "flux-realism",
45 "flux-anime",
46 "flux-3d",
47 "flux-cablyai",
48 "turbo",
49 "midjourney",
50 "dall-e-3",
51 ]
42 extra_image_models = ["flux-pro", "flux-dev", "flux-schnell", "midjourney", "dall-e-3"]
52 43 vision_models = [default_vision_model, "gpt-4o-mini"]
53 reasoning_models = ['deepseek-reasoner', 'deepseek-r1']
54 extra_text_models = ["claude", "claude-email", "p1"] + vision_models + reasoning_models
44 extra_text_models = ["claude", "claude-email", "deepseek-reasoner", "deepseek-r1"] + vision_models
55 45 model_aliases = {
56 46 ### Text Models ###
57 47 "gpt-4o-mini": "openai",
@@ -64,7 +54,6 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
64 54 "gpt-4o-mini": "rtist",
65 55 "gpt-4o": "searchgpt",
66 56 "gpt-4o-mini": "p1",
67 "deepseek-chat": "deepseek",
68 57 "deepseek-chat": "claude-hybridspace",
69 58 "llama-3.1-8b": "llamalight",
70 59 "gpt-4o-vision": "gpt-4o",
@@ -72,33 +61,38 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
72 61 "gpt-4o-mini": "claude",
73 62 "deepseek-chat": "claude-email",
74 63 "deepseek-r1": "deepseek-reasoner",
64 "gemini-2.0-flash": "gemini",
65 "gemini-2.0-flash-thinking": "gemini-thinking",
75 66
76 67 ### Image Models ###
77 68 "sdxl-turbo": "turbo",
78 "flux-schnell": "flux",
79 "flux-dev": "flux",
80 69 }
81 70 text_models = []
71 image_models = []
82 72
83 73 @classmethod
84 74 def get_models(cls, **kwargs):
85 if not cls.text_models:
86 url = "https://image.pollinations.ai/models"
87 response = requests.get(url)
88 raise_for_status(response)
89 new_image_models = response.json()
90 cls.extra_image_models = list(dict.fromkeys([*cls.extra_image_models, *new_image_models]))
91
92 url = "https://text.pollinations.ai/models"
93 response = requests.get(url)
94 raise_for_status(response)
95 original_text_models = [model.get("name") for model in response.json()]
75 if not cls.text_models or not cls.image_models:
76 image_url = "https://image.pollinations.ai/models"
77 image_response = requests.get(image_url)
78 raise_for_status(image_response)
79 new_image_models = image_response.json()
80
81 cls.image_models = list(dict.fromkeys([*cls.extra_image_models, *new_image_models]))
82 cls.extra_image_models = cls.image_models.copy()
83
84 text_url = "https://text.pollinations.ai/models"
85 text_response = requests.get(text_url)
86 raise_for_status(text_response)
87 original_text_models = [model.get("name") for model in text_response.json()]
88
96 89 combined_text = cls.extra_text_models + [
97 90 model for model in original_text_models
98 91 if model not in cls.extra_text_models
99 92 ]
100 93 cls.text_models = list(dict.fromkeys(combined_text))
101 return cls.text_models
94
95 return cls.text_models + cls.image_models
102 96
103 97 @classmethod
104 98 async def create_async_generator(
@@ -194,7 +188,7 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
194 188 yield ImagePreview(url, prompt)
195 189 async with ClientSession(headers=DEFAULT_HEADERS, connector=get_connector(proxy=proxy)) as session:
196 190 async with session.head(url) as response:
197 if response.status != 500: # Server is busy
191 if response.status != 500:
198 192 await raise_for_status(response)
199 193 yield ImageResponse(str(response.url), prompt)
200 194
@@ -256,12 +250,7 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
256 250 data = json.loads(json_str)
257 251 choice = data["choices"][0]
258 252 message = choice.get("message") or choice.get("delta", {})
259
260 # Handle reasoning content
261 if model in cls.reasoning_models:
262 if "reasoning_content" in message:
263 yield Reasoning(status=message["reasoning_content"].strip())
264
253
265 254 if "usage" in data:
266 255 yield Usage(**data["usage"])
267 256 content = message.get("content", "")
Modified g4f/Provider/__init__.py +0 -1
@@ -20,7 +20,6 @@ from .CablyAI import CablyAI
20 20 from .ChatGLM import ChatGLM
21 21 from .ChatGpt import ChatGpt
22 22 from .ChatGptEs import ChatGptEs
23 from .ChatGptt import ChatGptt
24 23 from .Cloudflare import Cloudflare
25 24 from .Copilot import Copilot
26 25 from .DDG import DDG
Renamed g4f/Provider/not_working/ChatGptt.py +21 -9
@@ -2,19 +2,18 @@ from __future__ import annotations
2 2
3 3 import os
4 4 import re
5
6 5 from aiohttp import ClientSession
7 6
8 from ..typing import AsyncResult, Messages
9 from ..requests.raise_for_status import raise_for_status
10 from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
11 from .helper import format_prompt
7 from ...typing import AsyncResult, Messages
8 from ...requests.raise_for_status import raise_for_status
9 from ..base_provider import AsyncGeneratorProvider, ProviderModelMixin
10 from ..helper import format_prompt
12 11
13 12 class ChatGptt(AsyncGeneratorProvider, ProviderModelMixin):
14 13 url = "https://chatgptt.me"
15 14 api_endpoint = "https://chatgptt.me/wp-admin/admin-ajax.php"
16 15
17 working = True
16 working = False
18 17 supports_stream = True
19 18 supports_system_message = True
20 19 supports_message_history = True
@@ -41,10 +40,22 @@ class ChatGptt(AsyncGeneratorProvider, ProviderModelMixin):
41 40 }
42 41
43 42 async with ClientSession(headers=headers) as session:
43 # Get initial page content
44 44 initial_response = await session.get(cls.url)
45 nonce_ = re.findall(r'data-nonce="(.+?)"', await initial_response.text())[0]
46 post_id = re.findall(r'data-post-id="(.+?)"', await initial_response.text())[0]
45 await raise_for_status(initial_response)
46 html = await initial_response.text()
47
48 # Extract nonce and post ID with error handling
49 nonce_match = re.search(r'data-nonce=["\']([^"\']+)["\']', html)
50 post_id_match = re.search(r'data-post-id=["\']([^"\']+)["\']', html)
51
52 if not nonce_match or not post_id_match:
53 raise RuntimeError("Required authentication tokens not found in page HTML")
54
55 nonce_ = nonce_match.group(1)
56 post_id = post_id_match.group(1)
47 57
58 # Prepare payload with session data
48 59 payload = {
49 60 '_wpnonce': nonce_,
50 61 'post_id': post_id,
@@ -57,7 +68,8 @@ class ChatGptt(AsyncGeneratorProvider, ProviderModelMixin):
57 68 'wpaicg_chat_history': None
58 69 }
59 70
71 # Stream the response
60 72 async with session.post(cls.api_endpoint, headers=headers, data=payload, proxy=proxy) as response:
61 73 await raise_for_status(response)
62 74 result = await response.json()
63 yield result['data']
75 yield result['data']
Modified g4f/Provider/not_working/__init__.py +1 -0
Modified g4f/models.py +105 -18
Modified g4f/tools/run_tools.py +51 -30