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

XFEstudio/gpt4free

AI Provider and Model Updates: Adding New, Removing Deprecated, and Enhancing Functionality (#2739)

* docs(docs/providers-and-models.md): Update provider listings and model information * feat(g4f/models.py): update model configurations and expand provider support * fix(g4f/gui/client/static/js/chat.v1.js): correct provider checkbox initialization logic * feat(g4f/Provider/Blackbox.py): update model configurations and premium handling * feat(g4f/Provider/ChatGLM.py): add finish reason handling and update default model * chore(g4f/Provider/DDG.py): Reorder model entries for consistency * feat(g4f/Provider/ImageLabs.py): Update default image model to sdxl-turbo * feat(g4f/Provider/Liaobots.py): update supported model configurations and aliases * feat(g4f/Provider/OIVSCode.py): Update API endpoint and expand model support * fix(g4f/Provider/needs_auth/CablyAI.py): Enforce authentication requirement * Removed the provider (g4f/Provider/BlackboxAPI.py) * fix(g4f/providers/base_provider.py): improve cache validation in AsyncAuthedProvider * Update g4f/models.py * fix(g4f/Provider/Liaobots.py): remove deprecated Gemini model aliases * chore(g4f/models.py): Remove Grok-2 and update Gemini provider configurations * chore(docs/providers-and-models.md): Remove deprecated Grok models from provider listings * New provider added (g4f/Provider/AllenAI.py) * feat(g4f/models.py): Add Ai2 models and update provider references * feat(docs/providers-and-models.md): update providers and models documentation * fix(g4f/models.py): update experimental model provider configuration * fix(g4f/Provider/PollinationsImage.py): Initialize image_models list and update label * fix(g4f/Provider/PollinationsAI.py): Resolve model initialization and alias conflicts * refactor(g4f/Provider/PollinationsAI.py): improve model initialization and error handling * refactor(g4f/Provider/PollinationsImage.py): Improve model synchronization and initialization * Update g4f/Provider/AllenAI.py --------- Co-authored-by: kqlio67 <>

07a8dfdf
kqlio67 <166700875+kqlio67@users.noreply.github.com>
提交于

代码差异

15 个文件 +420 -236
Modified docs/providers-and-models.md +27 -20
@@ -37,14 +37,14 @@ This document provides an overview of various AI providers and models, including
37 37 ### Providers No auth required
38 38 | Website | API Credentials | Provider | Text Models | Image Models | Vision (Image Upload) | Stream | Status |
39 39 |----------|-------------|--------------|---------------|--------|--------|------|------|
40 |[blackbox.ai](https://www.blackbox.ai)|No auth required|`g4f.Provider.Blackbox`|`blackboxai, gpt-4, gpt-4o, o3-mini, 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, gemini-2.0-flash` _**(+32)**_|`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, gemini-2.0-flash`|✔|![](https://img.shields.io/badge/Active-brightgreen)|
41 |[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)|
40 |[playground.allenai.org](https://playground.allenai.org)|No auth required|`g4f.Provider.AllenAI`|`tulu-3-405b, olmo-2-13b, tulu-3-1-8b, tulu-3-70b, olmoe-0125`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
41 |[blackbox.ai](https://www.blackbox.ai)|No auth required|`g4f.Provider.Blackbox`|`blackboxai, gemini-1.5-flash, 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-v3, deepseek-r1, gemini-2.0-flash` _**(+35)**_|`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, gemini-2.0-flash`|✔|![](https://img.shields.io/badge/Active-brightgreen)|
42 42 |[chatglm.cn](https://chatglm.cn)|No auth required|`g4f.Provider.ChatGLM`|`glm-4`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
43 43 |[chatgpt.com](https://chatgpt.com)|No auth required|`g4f.Provider.ChatGpt`|✔ _**(+7)**_|❌|❌|✔|![Error](https://img.shields.io/badge/HTTPError-f48d37)|
44 44 |[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)|
45 45 |[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)|❌|
46 46 |[copilot.microsoft.com](https://copilot.microsoft.com)|Optional API key|`g4f.Provider.Copilot`|`gpt-4, gpt-4o`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
47 |[duckduckgo.com/aichat](https://duckduckgo.com/aichat)|No auth required|`g4f.Provider.DDG`|`o3-mini, gpt-4, gpt-4o-mini, claude-3-haiku, llama-3.3-70b, mixtral-8x7b`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
47 |[duckduckgo.com/aichat](https://duckduckgo.com/aichat)|No auth required|`g4f.Provider.DDG`|`gpt-4, gpt-4o-mini, llama-3.3-70b, claude-3-haiku, o3-mini, mixtral-small-24b`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
48 48 |[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)|
49 49 |[chat10.free2gpt.xyz](https://chat10.free2gpt.xyz)|No auth required|`g4f.Provider.Free2GPT`|`mistral-7b`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
50 50 |[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,9 +55,9 @@ This document provides an overview of various AI providers and models, including
55 55 |[editor.imagelabs.net](editor.imagelabs.net)|No auth required|`g4f.Provider.ImageLabs`|❌|`sdxl-turbo`|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
56 56 |[huggingface.co/spaces](https://huggingface.co/spaces)|Optional API key|`g4f.Provider.HuggingSpace`|`qvq-72b, qwen-2-72b, command-r, command-r-plus, command-r7b`|`flux-dev, flux-schnell, sd-3.5`|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
57 57 |[jmuz.me](https://jmuz.me)|Optional API key|`g4f.Provider.Jmuz`|`claude-3-haiku, claude-3-opus, claude-3-haiku, claude-3.5-sonnet, deepseek-r1, deepseek-chat, gemini-exp, gemini-1.5-flash, gemini-1.5-pro, gemini-2.0-flash-thinking, gpt-4, gpt-4o, gpt-4o-mini, llama-3-70b, llama-3-8b, llama-3.1-405b, llama-3.1-70b, llama-3.1-8b, llama-3.2-11b, llama-3.2-90b, llama-3.3-70b, mixtral-8x7b, qwen-2.5-72b, qwen-2.5-coder-32b, qwq-32b, wizardlm-2-8x22b`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
58 |[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)|
58 |[liaobots.work](https://liaobots.work)|[Automatic cookies](https://liaobots.work)|`g4f.Provider.Liaobots`|`gpt-4o-mini, gpt-4o, gpt-4, o1-preview, deepseek-r1, deepseek-v3, claude-3-opus, claude-3.5-sonnet, claude-3-sonnet, gemini-2.0-flash, gemini-2.0-flash-thinking, grok-3, grok-3-r1, o3-mini`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
59 59 |[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)|
60 |[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)|
60 |[oi-vscode-server.onrender.com](https://oi-vscode-server.onrender.com)|No auth required|`g4f.Provider.OIVSCode`|`gpt-4o-mini, deepseek-v3`|❌|`gpt-4o-mini`|✔|![](https://img.shields.io/badge/Active-brightgreen)|
61 61 |[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)|
62 62 |[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)|
63 63 |[pizzagpt.it](https://www.pizzagpt.it)|No auth required|`g4f.Provider.Pizzagpt`|`gpt-4o-mini`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
@@ -92,7 +92,7 @@ This document provides an overview of various AI providers and models, including
92 92 |[copilot.microsoft.com](https://copilot.microsoft.com)|[Manual cookies](https://copilot.microsoft.com)|`g4f.Provider.CopilotAccount`|✔ _**(1+)**_|✔ _**(1+)**_|✔ _**(1+)**_|✔|![](https://img.shields.io/badge/Active-brightgreen)|
93 93 |[deepinfra.com](https://deepinfra.com)|[Get API key](https://deepinfra.com/dash/api_keys)|`g4f.Provider.DeepInfra`|✔ _**(17+)**_|✔ _**(6+)**_|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
94 94 |[platform.deepseek.com](https://platform.deepseek.com)|[Get API key](https://platform.deepseek.com/api_keys)|`g4f.Provider.DeepSeek`|✔ _**(1+)**_|❌|❌|❌|![](https://img.shields.io/badge/Active-brightgreen)|
95 |[gemini.google.com](https://gemini.google.com)|[Manual cookies](https://gemini.google.com)|`g4f.Provider.Gemini`|`gemini, gemini-1.5-flash, gemini-1.5-pro`|`gemini`|`gemini`|❌|![](https://img.shields.io/badge/Active-brightgreen)|
95 |[gemini.google.com](https://gemini.google.com)|[Manual cookies](https://gemini.google.com)|`g4f.Provider.Gemini`|`gemini-2.0`|`gemini-2.0`|`gemini-2.0`|❌|![](https://img.shields.io/badge/Active-brightgreen)|
96 96 |[ai.google.dev](https://ai.google.dev)|[Get API key](https://aistudio.google.com/u/0/apikey)|`g4f.Provider.GeminiPro`|`gemini-1.5-flash, gemini-1.5-pro, gemini-2.0-flash`|❌|`gemini-1.5-pro`|❌|![](https://img.shields.io/badge/Active-brightgreen)|
97 97 |[developers.sber.ru/gigachat](https://developers.sber.ru/gigachat)|[Manual cookies](https://developers.sber.ru/gigachat)|`g4f.Provider.GigaChat`|✔ _**(3+)**_|❌|❌|❌|![](https://img.shields.io/badge/Active-brightgreen)|
98 98 |[github.com/copilot](https://github.com/copilot)|[Manual cookies](https://github.com/copilot)|`g4f.Provider.GithubCopilot`|✔ _**(4+)**_|❌|❌|❌|![](https://img.shields.io/badge/Active-brightgreen)|
@@ -120,13 +120,12 @@ This document provides an overview of various AI providers and models, including
120 120 ### Text Models
121 121 | Model | Base Provider | Providers | Website |
122 122 |-------|---------------|-----------|---------|
123 |gpt-4|OpenAI|9+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4)|
124 |gpt-4o|OpenAI|7+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4o)|
123 |gpt-4|OpenAI|8+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4)|
124 |gpt-4o|OpenAI|6+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4o)|
125 125 |gpt-4o-mini|OpenAI|7+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4o-mini)|
126 126 |o1|OpenAI|1+ Providers|[openai.com](https://openai.com/index/introducing-openai-o1-preview/)|
127 127 |o1-preview|OpenAI|1+ Providers|[openai.com](https://openai.com/index/introducing-openai-o1-preview/)|
128 |o1-mini|OpenAI|1+ Providers|[openai.com](https://openai.com/index/openai-o1-mini-advancing-cost-efficient-reasoning/)|
129 |o3-mini|OpenAI|1+ Providers|[openai.com](https://openai.com/index/openai-o3-mini/)|
128 |o3-mini|OpenAI|2+ Providers|[openai.com](https://openai.com/index/openai-o3-mini/)|
130 129 |gigachat|GigaChat|1+ Providers|[developers.sber.ru/gigachat](https://developers.sber.ru/gigachat)|
131 130 |meta-ai|Meta|1+ Providers|[ai.meta.com](https://ai.meta.com/)|
132 131 |llama-2-7b|Meta Llama|1+ Providers|[huggingface.co](https://huggingface.co/meta-llama/Llama-2-7b)|
@@ -140,19 +139,20 @@ This document provides an overview of various AI providers and models, including
140 139 |llama-3.2-11b|Meta Llama|3+ Providers|[ai.meta.com](https://ai.meta.com/blog/llama-3-2-connect-2024-vision-edge-mobile-devices/)|
141 140 |llama-3.2-90b|Meta Llama|1+ Providers|[huggingface.co](https://huggingface.co/meta-llama/Llama-3.2-90B-Vision)|
142 141 |llama-3.3-70b|Meta Llama|6+ Providers|[ai.meta.com](https://ai.meta.com/blog/llama-3-3/)|
143 |mixtral-8x7b|Mistral|2+ Providers|[mistral.ai](https://mistral.ai/news/mixtral-of-experts/)|
142 |mixtral-8x7b|Mistral|1+ Providers|[mistral.ai](https://mistral.ai/news/mixtral-of-experts/)|
144 143 |mixtral-8x22b|Mistral|1+ Providers|[huggingface.co](https://huggingface.co/mistralai/Mixtral-8x22B-Instruct-v0.1)|
145 144 |mistral-nemo|Mistral|3+ Providers|[huggingface.co](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407)|
145 |mixtral-small-24b|Mistral|1+ Providers|[huggingface.co](https://huggingface.co/mistralai/Mistral-Small-24B-Instruct-2501)|
146 146 |mixtral-small-28b|Mistral|3+ Providers|[mistral.ai](https://mistral.ai/news/mixtral-small-28b/)|
147 |hermes-2-dpo|NousResearch|2+ Providers|[huggingface.co](https://huggingface.co/NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO)|
147 |hermes-2-dpo|NousResearch|1+ Providers|[huggingface.co](https://huggingface.co/NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO)|
148 148 |phi-3.5-mini|Microsoft|1+ Providers|[huggingface.co](https://huggingface.co/microsoft/Phi-3.5-mini-instruct)|
149 149 |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)|
150 150 |wizardlm-2-7b|Microsoft|1+ Providers|[wizardlm.github.io](https://wizardlm.github.io/WizardLM2/)|
151 151 |wizardlm-2-8x22b|Microsoft|2+ Providers|[wizardlm.github.io](https://wizardlm.github.io/WizardLM2/)|
152 |gemini|Google DeepMind|1+|[deepmind.google](http://deepmind.google/technologies/gemini/)|
152 |gemini-2.0|Google DeepMind|1+|[deepmind.google](http://deepmind.google/technologies/gemini/)|
153 153 |gemini-exp|Google DeepMind|1+ Providers|[blog.google](https://blog.google/feed/gemini-exp-1206/)|
154 |gemini-1.5-flash|Google DeepMind|5+ Providers|[deepmind.google](https://deepmind.google/technologies/gemini/flash/)|
155 |gemini-1.5-pro|Google DeepMind|5+ Providers|[deepmind.google](https://deepmind.google/technologies/gemini/pro/)|
154 |gemini-1.5-flash|Google DeepMind|3+ Providers|[deepmind.google](https://deepmind.google/technologies/gemini/flash/)|
155 |gemini-1.5-pro|Google DeepMind|2+ Providers|[deepmind.google](https://deepmind.google/technologies/gemini/pro/)|
156 156 |gemini-2.0-flash|Google DeepMind|4+ Providers|[deepmind.google](https://deepmind.google/technologies/gemini/flash/)|
157 157 |gemini-2.0-flash-thinking|Google DeepMind|1+ Providers|[ai.google.dev](https://ai.google.dev/gemini-api/docs/thinking-mode)|
158 158 |claude-3-haiku|Anthropic|2+ Providers|[anthropic.com](https://www.anthropic.com/news/claude-3-haiku)|
@@ -171,19 +171,21 @@ This document provides an overview of various AI providers and models, including
171 171 |qwen-2.5-72b|Qwen|2+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2.5-72B-Instruct)|
172 172 |qwen-2.5-coder-32b|Qwen|3+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2.5-Coder-32B)|
173 173 |qwen-2.5-1m-demo|Qwen|1+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2.5-1M-Demo)|
174 |qwq-32b|Qwen|4+ Providers|[huggingface.co](https://huggingface.co/Qwen/QwQ-32B-Preview)|
174 |qwq-32b|Qwen|3+ Providers|[huggingface.co](https://huggingface.co/Qwen/QwQ-32B-Preview)|
175 175 |qvq-72b|Qwen|1+ Providers|[huggingface.co](https://huggingface.co/Qwen/QVQ-72B-Preview)|
176 176 |pi|Inflection|1+ Providers|[inflection.ai](https://inflection.ai/blog/inflection-2-5)|
177 |deepseek-chat|DeepSeek|4+ Providers|[huggingface.co](https://huggingface.co/deepseek-ai/deepseek-llm-67b-chat)|
177 |deepseek-chat|DeepSeek|3+ Providers|[huggingface.co](https://huggingface.co/deepseek-ai/deepseek-llm-67b-chat)|
178 178 |deepseek-v3|DeepSeek|4+ Providers|[api-docs.deepseek.com](https://api-docs.deepseek.com/news/news250120)|
179 |deepseek-r1|DeepSeek|9+ Providers|[api-docs.deepseek.com](https://api-docs.deepseek.com/news/news250120)|
180 |grok-2|x.ai|1+|[x.ai](https://x.ai/blog/grok-2)|
179 |deepseek-r1|DeepSeek|8+ Providers|[api-docs.deepseek.com](https://api-docs.deepseek.com/news/news250120)|
180 |grok-3|x.ai|1+|[x.ai](https://x.ai/blog/grok-3)|
181 |grok-3-r1|x.ai|1+|[x.ai](https://x.ai/blog/grok-3)|
181 182 |sonar|Perplexity AI|1+ Providers|[sonar.perplexity.ai](https://sonar.perplexity.ai/)|
182 183 |sonar-pro|Perplexity AI|1+ Providers|[sonar.perplexity.ai](https://sonar.perplexity.ai/)|
183 184 |sonar-reasoning|Perplexity AI|1+ Providers|[sonar.perplexity.ai](https://sonar.perplexity.ai/)|
184 185 |sonar-reasoning-pro|Perplexity AI|1+ Providers|[sonar.perplexity.ai](https://sonar.perplexity.ai/)|
186 |r1-1776|Perplexity AI|1+ Providers|[perplexity.ai](https://www.perplexity.ai/hub/blog/open-sourcing-r1-1776)|
185 187 |nemotron-70b|Nvidia|2+ Providers|[build.nvidia.com](https://build.nvidia.com/nvidia/llama-3_1-nemotron-70b-instruct)|
186 |dbrx-instruct|Databricks|3+ Providers|[huggingface.co](https://huggingface.co/databricks/dbrx-instruct)|
188 |dbrx-instruct|Databricks|2+ Providers|[huggingface.co](https://huggingface.co/databricks/dbrx-instruct)|
187 189 |glm-4|THUDM|1+ Providers|[github.com/THUDM](https://github.com/THUDM/GLM-4)|
188 190 |mini_max|MiniMax|1+ Providers|[hailuo.ai](https://www.hailuo.ai/)|
189 191 |yi-34b|01-ai|1+ Providers|[huggingface.co](https://huggingface.co/01-ai/Yi-34B-Chat)|
@@ -192,6 +194,11 @@ This document provides an overview of various AI providers and models, including
192 194 |airoboros-70b|DeepInfra|1+ Providers|[huggingface.co](https://huggingface.co/cognitivecomputations/dolphin-2.9.1-llama-3-70b)|
193 195 |lzlv-70b|Lizpreciatior|1+ Providers|[huggingface.co](https://huggingface.co/cognitivecomputations/dolphin-2.9.1-llama-3-70b)|
194 196 |minicpm-2.5|OpenBMB|1+ Providers|[huggingface.co](https://huggingface.co/openbmb/MiniCPM-Llama3-V-2_5)|
197 |tulu-3-405b|Ai2|1+ Providers|[allenai.org](https://allenai.org/documentation)|
198 |olmo-2-13b|Ai2|1+ Providers|[allenai.org](https://allenai.org/documentation)|
199 |tulu-3-1-8b|Ai2|1+ Providers|[allenai.org](https://allenai.org/documentation)|
200 |tulu-3-70b|Ai2|1+ Providers|[allenai.org](https://allenai.org/documentation)|
201 |olmoe-0125|Ai2|1+ Providers|[allenai.org](https://allenai.org/documentation)|
195 202 |evil|Evil Mode - Experimental|1+ Providers|[]( )|
196 203
197 204 ---
Added g4f/Provider/AllenAI.py +176 -0
@@ -0,0 +1,176 @@
1 from __future__ import annotations
2 import json
3 from uuid import uuid4
4 from aiohttp import ClientSession
5 from ..typing import AsyncResult, Messages
6 from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
7 from ..requests.raise_for_status import raise_for_status
8 from ..providers.response import FinishReason, JsonConversation
9 from .helper import format_prompt
10
11
12 class Conversation(JsonConversation):
13 parent: str = None
14 x_anonymous_user_id: str = None
15
16 def __init__(self, model: str):
17 super().__init__() # Ensure parent class is initialized
18 self.model = model
19 self.messages = [] # Instance-specific list
20 if not self.x_anonymous_user_id:
21 self.x_anonymous_user_id = str(uuid4())
22
23
24 class AllenAI(AsyncGeneratorProvider, ProviderModelMixin):
25 label = "Ai2 Playground"
26 url = "https://playground.allenai.org"
27 login_url = None
28 api_endpoint = "https://olmo-api.allen.ai/v4/message/stream"
29
30 working = True
31 needs_auth = False
32 use_nodriver = False
33 supports_stream = True
34 supports_system_message = False
35 supports_message_history = True
36
37 default_model = 'tulu3-405b'
38 models = [
39 default_model,
40 'OLMo-2-1124-13B-Instruct',
41 'tulu-3-1-8b',
42 'Llama-3-1-Tulu-3-70B',
43 'olmoe-0125'
44 ]
45
46 model_aliases = {
47 "tulu-3-405b": default_model,
48 "olmo-2-13b": "OLMo-2-1124-13B-Instruct",
49 "tulu-3-1-8b": "tulu-3-1-8b",
50 "tulu-3-70b": "Llama-3-1-Tulu-3-70B",
51 }
52
53 @classmethod
54 async def create_async_generator(
55 cls,
56 model: str,
57 messages: Messages,
58 proxy: str = None,
59 host: str = "inferd",
60 private: bool = True,
61 parent: str = None,
62 top_p: float = None,
63 temperature: float = None,
64 conversation: Conversation = None,
65 return_conversation: bool = False,
66 **kwargs
67 ) -> AsyncResult:
68 # Initialize or update conversation
69 if conversation is None:
70 conversation = Conversation(model)
71
72 # Generate new boundary for each request
73 boundary = f"----WebKitFormBoundary{uuid4().hex}"
74
75 headers = {
76 "accept": "*/*",
77 "accept-language": "en-US,en;q=0.9",
78 "content-type": f"multipart/form-data; boundary={boundary}",
79 "origin": cls.url,
80 "referer": f"{cls.url}/",
81 "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36",
82 "x-anonymous-user-id": conversation.x_anonymous_user_id,
83 }
84
85 # Build multipart form data
86 form_data = [
87 f'--{boundary}\r\n'
88 f'Content-Disposition: form-data; name="model"\r\n\r\n{model}\r\n',
89
90 f'--{boundary}\r\n'
91 f'Content-Disposition: form-data; name="host"\r\n\r\n{host}\r\n',
92
93 f'--{boundary}\r\n'
94 f'Content-Disposition: form-data; name="content"\r\n\r\n{format_prompt(messages)}\r\n',
95
96 f'--{boundary}\r\n'
97 f'Content-Disposition: form-data; name="private"\r\n\r\n{str(private).lower()}\r\n'
98 ]
99
100 # Add parent if exists in conversation
101 if conversation.parent:
102 form_data.append(
103 f'--{boundary}\r\n'
104 f'Content-Disposition: form-data; name="parent"\r\n\r\n{conversation.parent}\r\n'
105 )
106
107 # Add optional parameters
108 if temperature is not None:
109 form_data.append(
110 f'--{boundary}\r\n'
111 f'Content-Disposition: form-data; name="temperature"\r\n\r\n{temperature}\r\n'
112 )
113
114 if top_p is not None:
115 form_data.append(
116 f'--{boundary}\r\n'
117 f'Content-Disposition: form-data; name="top_p"\r\n\r\n{top_p}\r\n'
118 )
119
120 form_data.append(f'--{boundary}--\r\n')
121 data = "".join(form_data).encode()
122
123 async with ClientSession(headers=headers) as session:
124 async with session.post(
125 cls.api_endpoint,
126 data=data,
127 proxy=proxy,
128 ) as response:
129 await raise_for_status(response)
130 current_parent = None
131
132 async for chunk in response.content:
133 if not chunk:
134 continue
135 decoded = chunk.decode(errors="ignore")
136 for line in decoded.splitlines():
137 line = line.strip()
138 if not line:
139 continue
140
141 try:
142 data = json.loads(line)
143 except json.JSONDecodeError:
144 continue
145
146 if isinstance(data, dict):
147 # Update the parental ID
148 if data.get("children"):
149 for child in data["children"]:
150 if child.get("role") == "assistant":
151 current_parent = child.get("id")
152 break
153
154 # We process content only from the assistant
155 if "message" in data and data.get("content"):
156 content = data["content"]
157 # Skip empty content blocks
158 if content.strip():
159 yield content
160
161 # Processing the final response
162 if data.get("final") or data.get("finish_reason") == "stop":
163 if current_parent:
164 conversation.parent = current_parent
165
166 # Add a message to the story
167 conversation.messages.extend([
168 {"role": "user", "content": format_prompt(messages)},
169 {"role": "assistant", "content": "".join(conversation.messages[-1]["content"] + content if conversation.messages else content)}
170 ])
171
172 if return_conversation:
173 yield conversation
174
175 yield FinishReason("stop")
176 return
Modified g4f/Provider/Blackbox.py +19 -27
@@ -7,7 +7,6 @@ import random
7 7 import string
8 8 from pathlib import Path
9 9 from typing import Optional
10 from datetime import datetime, timezone
11 10
12 11 from ..typing import AsyncResult, Messages, ImagesType
13 12 from ..requests.raise_for_status import raise_for_status
@@ -36,14 +35,16 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
36 35 supports_system_message = True
37 36 supports_message_history = True
38 37
39 default_model = "blackboxai"
38 default_model = "BLACKBOXAI"
40 39 default_vision_model = default_model
41 40 default_image_model = 'ImageGeneration'
42 41
43 42 image_models = [default_image_model]
44 43 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', 'Gemini-Flash-2.0']
44
45 premium_models = ['GPT-4o', 'o1', 'o3-mini', 'Gemini-PRO', 'Claude-Sonnet-3.5']
45 46
46 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', 'Gemini-Flash-2.0']
47 userSelectedModel = ['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', 'Gemini-Flash-2.0'] + premium_models
47 48
48 49 agentMode = {
49 50 'DeepSeek-V3': {'mode': True, 'id': "deepseek-chat", 'name': "DeepSeek-V3"},
@@ -58,6 +59,7 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
58 59 }
59 60
60 61 trendingAgentMode = {
62 "o1": {'mode': True, 'id': 'o1'},
61 63 "o3-mini": {'mode': True, 'id': 'o3-mini'},
62 64 "gemini-1.5-flash": {'mode': True, 'id': 'Gemini'},
63 65 "llama-3.1-8b": {'mode': True, 'id': "llama-3.1-8b"},
@@ -75,9 +77,7 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
75 77 'PyTorch Agent': {'mode': True, 'id': "PyTorch Agent"},
76 78 'React Agent': {'mode': True, 'id': "React Agent"},
77 79 'Xcode Agent': {'mode': True, 'id': "Xcode Agent"},
78 'AngularJS Agent': {'mode': True, 'id': "AngularJS Agent"},
79 'blackboxai-pro': {'mode': True, 'id': "BLACKBOXAI-PRO"},
80 'repomap': {'mode': True, 'id': "repomap"},
80 'BLACKBOXAI-PRO': {'mode': True, 'id': "BLACKBOXAI-PRO"},
81 81 'Heroku Agent': {'mode': True, 'id': "Heroku Agent"},
82 82 'Godot Agent': {'mode': True, 'id': "Godot Agent"},
83 83 'Go Agent': {'mode': True, 'id': "Go Agent"},
@@ -97,16 +97,11 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
97 97 'builder Agent': {'mode': True, 'id': "builder Agent"},
98 98 }
99 99
100 premium_models = ['Claude-Sonnet-3.5']
101
102 100 models = list(dict.fromkeys([default_model, *userSelectedModel, *image_models, *list(agentMode.keys()), *list(trendingAgentMode.keys())]))
103 101
104 102 model_aliases = {
105 "gpt-4": "GPT-4o",
106 "gpt-4o": "GPT-4o",
107 "claude-3.5-sonnet": "Claude-Sonnet-3.5", # Premium
103 "blackboxai": "BLACKBOXAI",
108 104 "gemini-1.5-flash": "gemini-1.5-flash",
109 "gemini-1.5-pro": "Gemini-PRO",
110 105 "deepseek-v3": "DeepSeek-V3",
111 106 "deepseek-r1": "DeepSeek-R1",
112 107 "llama-3.3-70b": "Meta-Llama-3.3-70B-Instruct-Turbo",
@@ -116,6 +111,7 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
116 111 "qwq-32b": "Qwen-QwQ-32B-Preview",
117 112 "hermes-2-dpo": "Nous-Hermes-2-Mixtral-8x7B-DPO",
118 113 "gemini-2.0-flash": "Gemini-Flash-2.0",
114 "blackboxai-pro": "BLACKBOXAI-PRO",
119 115 "flux": "ImageGeneration",
120 116 }
121 117
@@ -261,9 +257,6 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
261 257 "content": msg["content"],
262 258 "role": msg["role"]
263 259 }
264 if msg["role"] == "assistant" and i == len(messages)-1:
265 current_time = datetime.now(timezone.utc).isoformat(timespec='milliseconds').replace('+00:00', 'Z')
266 current_msg["createdAt"] = current_time
267 260 current_messages.append(current_msg)
268 261
269 262 if images is not None:
@@ -279,14 +272,6 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
279 272 "title": ""
280 273 }
281 274
282 # Calculate the value for expires + lastChecked
283 expires_iso = datetime.now(timezone.utc).isoformat(timespec='milliseconds').replace('+00:00', 'Z')
284 last_checked_millis = int(datetime.now().timestamp() * 1000)
285
286 # Fake data of a premium user (temporarily working)
287 fake_session = {"user":{"name":"John Doe","email":"john.doe@gmail.com","image":"https://lh3.googleusercontent.com/a/ACg8ocK9X7mNpQ2vR4jH3tY8wL5nB1xM6fDS9JW2kLpTn4Vy3hR2xN4m=s96-c"},"expires":expires_iso}
288 fake_subscriptionCache = {"status":"PREMIUM", "expiryTimestamp":None,"lastChecked":last_checked_millis}
289
290 275 data = {
291 276 "messages": current_messages,
292 277 "agentMode": cls.agentMode.get(model, {}) if model in cls.agentMode else {},
@@ -316,10 +301,17 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
316 301 "domains": None,
317 302 "vscodeClient": False,
318 303 "codeInterpreterMode": False,
319 "customProfile": {"name": "", "occupation": "", "traits": [], "additionalInfo": "", "enableNewChats": False},
320 "session": fake_session,
321 "isPremium": True,
322 "subscriptionCache": fake_subscriptionCache,
304 "customProfile": {
305 "name": "",
306 "occupation": "",
307 "traits": [],
308 "additionalInfo": "",
309 "enableNewChats": False
310 },
311 "session": None,
312 "isPremium": False,
313 "subscriptionCache": None,
314 "beastMode": False,
323 315 "webSearchMode": False
324 316 }
325 317
Deleted g4f/Provider/BlackboxAPI.py +0 -75
@@ -1,75 +0,0 @@
1 from __future__ import annotations
2 from aiohttp import ClientSession
3
4 from ..typing import AsyncResult, Messages
5 from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
6 from ..requests.raise_for_status import raise_for_status
7
8 class BlackboxAPI(AsyncGeneratorProvider, ProviderModelMixin):
9 label = "Blackbox AI API"
10 url = "https://api.blackbox.ai"
11 api_endpoint = "https://api.blackbox.ai/api/chat"
12
13 working = True
14 needs_auth = False
15 supports_stream = False
16 supports_system_message = True
17 supports_message_history = True
18
19 default_model = 'deepseek-ai/DeepSeek-V3'
20 models = [
21 default_model,
22 'deepseek-ai/DeepSeek-R1',
23 'mistralai/Mistral-Small-24B-Instruct-2501',
24 'deepseek-ai/deepseek-llm-67b-chat',
25 'databricks/dbrx-instruct',
26 'Qwen/QwQ-32B-Preview',
27 'NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO'
28 ]
29
30 model_aliases = {
31 "deepseek-v3": "deepseek-ai/DeepSeek-V3",
32 "deepseek-r1": "deepseek-ai/DeepSeek-R1",
33 "deepseek-chat": "deepseek-ai/deepseek-llm-67b-chat",
34 "mixtral-small-28b": "mistralai/Mistral-Small-24B-Instruct-2501",
35 "dbrx-instruct": "databricks/dbrx-instruct",
36 "qwq-32b": "Qwen/QwQ-32B-Preview",
37 "hermes-2-dpo": "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
38 }
39
40 @classmethod
41 async def create_async_generator(
42 cls,
43 model: str,
44 messages: Messages,
45 proxy: str = None,
46 max_tokens: str = None,
47 **kwargs
48 ) -> AsyncResult:
49 model = cls.get_model(model)
50
51 headers = {
52 "Content-Type": "application/json",
53 }
54
55 async with ClientSession(headers=headers) as session:
56 data = {
57 "messages": messages,
58 "model": model,
59 "max_tokens": max_tokens
60 }
61
62 async with session.post(cls.api_endpoint, json=data, proxy=proxy) as response:
63 await raise_for_status(response)
64
65 async for chunk in response.content:
66 if not chunk:
67 continue
68
69 text = chunk.decode(errors='ignore')
70
71 try:
72 if text:
73 yield text
74 except Exception as e:
75 return
Modified g4f/Provider/ChatGLM.py +7 -3
@@ -8,6 +8,7 @@ from aiohttp import ClientSession
8 8 from ..typing import AsyncResult, Messages
9 9 from ..requests.raise_for_status import raise_for_status
10 10 from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
11 from ..providers.response import FinishReason
11 12
12 13 class ChatGLM(AsyncGeneratorProvider, ProviderModelMixin):
13 14 url = "https://chatglm.cn"
@@ -18,9 +19,8 @@ class ChatGLM(AsyncGeneratorProvider, ProviderModelMixin):
18 19 supports_system_message = False
19 20 supports_message_history = False
20 21
21 default_model = "all-tools-230b"
22 default_model = "glm-4"
22 23 models = [default_model]
23 model_aliases = {"glm-4": default_model}
24 24
25 25 @classmethod
26 26 async def create_async_generator(
@@ -85,9 +85,13 @@ class ChatGLM(AsyncGeneratorProvider, ProviderModelMixin):
85 85 if parts:
86 86 content = parts[0].get('content', [])
87 87 if content:
88 text = content[0].get('text', '')[yield_text:]
88 text_content = content[0].get('text', '')
89 text = text_content[yield_text:]
89 90 if text:
90 91 yield text
91 92 yield_text += len(text)
93 # Yield FinishReason when status is 'finish'
94 if json_data.get('status') == 'finish':
95 yield FinishReason("stop")
92 96 except json.JSONDecodeError:
93 97 pass
Modified g4f/Provider/DDG.py +2 -2
@@ -36,12 +36,12 @@ class DDG(AsyncGeneratorProvider, ProviderModelMixin):
36 36 supports_message_history = True
37 37
38 38 default_model = "gpt-4o-mini"
39 models = [default_model, "o3-mini", "claude-3-haiku-20240307", "meta-llama/Llama-3.3-70B-Instruct-Turbo", "mistralai/Mistral-Small-24B-Instruct-2501"]
39 models = [default_model, "meta-llama/Llama-3.3-70B-Instruct-Turbo", "claude-3-haiku-20240307", "o3-mini", "mistralai/Mistral-Small-24B-Instruct-2501"]
40 40
41 41 model_aliases = {
42 42 "gpt-4": "gpt-4o-mini",
43 "claude-3-haiku": "claude-3-haiku-20240307",
44 43 "llama-3.3-70b": "meta-llama/Llama-3.3-70B-Instruct-Turbo",
44 "claude-3-haiku": "claude-3-haiku-20240307",
45 45 "mixtral-small-24b": "mistralai/Mistral-Small-24B-Instruct-2501",
46 46 }
47 47
Modified g4f/Provider/ImageLabs.py +1 -2
@@ -18,11 +18,10 @@ class ImageLabs(AsyncGeneratorProvider, ProviderModelMixin):
18 18 supports_system_message = False
19 19 supports_message_history = False
20 20
21 default_model = 'general'
21 default_model = 'sdxl-turbo'
22 22 default_image_model = default_model
23 23 image_models = [default_image_model]
24 24 models = image_models
25 model_aliases = {"sdxl-turbo": default_model}
26 25
27 26 @classmethod
28 27 async def create_async_generator(
Modified g4f/Provider/Liaobots.py +59 -65
@@ -18,6 +18,51 @@ models = {
18 18 "tokenLimit": 7800,
19 19 "context": "8K",
20 20 },
21 "grok-3": {
22 "id": "grok-3",
23 "name": "Grok-3",
24 "model": "Grok",
25 "provider": "x.ai",
26 "maxLength": 800000,
27 "tokenLimit": 200000,
28 "context": "200K",
29 },
30 "grok-3-r1": {
31 "id": "grok-3-r1",
32 "name": "Grok-3-Thinking",
33 "model": "Grok",
34 "provider": "x.ai",
35 "maxLength": 800000,
36 "tokenLimit": 200000,
37 "context": "200K",
38 },
39 "deepseek-r1": {
40 "id": "deepseek-r1",
41 "name": "DeepSeek-R1",
42 "model": "DeepSeek-R1",
43 "provider": "DeepSeek",
44 "maxLength": 400000,
45 "tokenLimit": 100000,
46 "context": "128K",
47 },
48 "deepseek-r1-distill-llama-70b": {
49 "id": "deepseek-r1-distill-llama-70b",
50 "name": "DeepSeek-R1-70B",
51 "model": "DeepSeek-R1-70B",
52 "provider": "DeepSeek",
53 "maxLength": 400000,
54 "tokenLimit": 100000,
55 "context": "128K",
56 },
57 "deepseek-v3": {
58 "id": "deepseek-v3",
59 "name": "DeepSeek-V3",
60 "model": "DeepSeek-V3",
61 "provider": "DeepSeek",
62 "maxLength": 400000,
63 "tokenLimit": 100000,
64 "context": "128K",
65 },
21 66 "gpt-4o-2024-11-20": {
22 67 "id": "gpt-4o-2024-11-20",
23 68 "name": "GPT-4o",
@@ -36,60 +81,24 @@ models = {
36 81 "tokenLimit": 126000,
37 82 "context": "128K",
38 83 },
39 "o1-preview-2024-09-12": {
40 "id": "o1-preview-2024-09-12",
41 "name": "o1-preview",
42 "model": "o1",
84 "o3-mini": {
85 "id": "o3-mini",
86 "name": "o3-mini",
87 "model": "o3",
43 88 "provider": "OpenAI",
44 89 "maxLength": 400000,
45 90 "tokenLimit": 100000,
46 91 "context": "128K",
47 92 },
48 "o1-mini-2024-09-12": {
49 "id": "o1-mini-2024-09-12",
50 "name": "o1-mini",
93 "o1-preview-2024-09-12": {
94 "id": "o1-preview-2024-09-12",
95 "name": "o1-preview",
51 96 "model": "o1",
52 97 "provider": "OpenAI",
53 98 "maxLength": 400000,
54 99 "tokenLimit": 100000,
55 100 "context": "128K",
56 101 },
57 "DeepSeek-R1-Distill-Llama-70b": {
58 "id": "DeepSeek-R1-Distill-Llama-70b",
59 "name": "DeepSeek-R1-70B",
60 "model": "DeepSeek-R1-70B",
61 "provider": "DeepSeek",
62 "maxLength": 400000,
63 "tokenLimit": 100000,
64 "context": "128K",
65 },
66 "DeepSeek-R1": {
67 "id": "DeepSeek-R1",
68 "name": "DeepSeek-R1",
69 "model": "DeepSeek-R1",
70 "provider": "DeepSeek",
71 "maxLength": 400000,
72 "tokenLimit": 100000,
73 "context": "128K",
74 },
75 "DeepSeek-V3": {
76 "id": "DeepSeek-V3",
77 "name": "DeepSeek-V3",
78 "model": "DeepSeek-V3",
79 "provider": "DeepSeek",
80 "maxLength": 400000,
81 "tokenLimit": 100000,
82 "context": "128K",
83 },
84 "grok-2": {
85 "id": "grok-2",
86 "name": "Grok-2",
87 "model": "Grok",
88 "provider": "x.ai",
89 "maxLength": 400000,
90 "tokenLimit": 100000,
91 "context": "100K",
92 },
93 102 "claude-3-opus-20240229": {
94 103 "id": "claude-3-opus-20240229",
95 104 "name": "Claude-3-Opus",
@@ -144,9 +153,9 @@ models = {
144 153 "tokenLimit": 200000,
145 154 "context": "200K",
146 155 },
147 "gemini-2.0-flash-exp": {
148 "id": "gemini-2.0-flash-exp",
149 "name": "Gemini-2.0-Flash-Exp",
156 "gemini-2.0-flash": {
157 "id": "gemini-2.0-flash",
158 "name": "Gemini-2.0-Flash",
150 159 "model": "Gemini",
151 160 "provider": "Google",
152 161 "maxLength": 4000000,
@@ -162,18 +171,9 @@ models = {
162 171 "tokenLimit": 1000000,
163 172 "context": "1024K",
164 173 },
165 "gemini-1.5-flash-002": {
166 "id": "gemini-1.5-flash-002",
167 "name": "Gemini-1.5-Flash-1M",
168 "model": "Gemini",
169 "provider": "Google",
170 "maxLength": 4000000,
171 "tokenLimit": 1000000,
172 "context": "1024K",
173 },
174 "gemini-1.5-pro-002": {
175 "id": "gemini-1.5-pro-002",
176 "name": "Gemini-1.5-Pro-1M",
174 "gemini-2.0-pro-exp": {
175 "id": "gemini-2.0-pro-exp",
176 "name": "Gemini-2.0-Pro-Exp",
177 177 "model": "Gemini",
178 178 "provider": "Google",
179 179 "maxLength": 4000000,
@@ -197,11 +197,8 @@ class Liaobots(AsyncGeneratorProvider, ProviderModelMixin):
197 197 "gpt-4": default_model,
198 198
199 199 "o1-preview": "o1-preview-2024-09-12",
200 "o1-mini": "o1-mini-2024-09-12",
201 200
202 "deepseek-r1": "DeepSeek-R1-Distill-Llama-70b",
203 "deepseek-r1": "DeepSeek-R1",
204 "deepseek-v3": "DeepSeek-V3",
201 "deepseek-r1": "deepseek-r1-distill-llama-70b",
205 202
206 203 "claude-3-opus": "claude-3-opus-20240229",
207 204 "claude-3.5-sonnet": "claude-3-5-sonnet-20240620",
@@ -210,10 +207,7 @@ class Liaobots(AsyncGeneratorProvider, ProviderModelMixin):
210 207 "claude-3-opus": "claude-3-opus-20240229-t",
211 208 "claude-3.5-sonnet": "claude-3-5-sonnet-20241022-t",
212 209
213 "gemini-2.0-flash": "gemini-2.0-flash-exp",
214 210 "gemini-2.0-flash-thinking": "gemini-2.0-flash-thinking-exp",
215 "gemini-1.5-flash": "gemini-1.5-flash-002",
216 "gemini-1.5-pro": "gemini-1.5-pro-002"
217 211 }
218 212
219 213 _auth_code = ""
Modified g4f/Provider/OIVSCode.py +6 -3
@@ -5,7 +5,7 @@ from .template import OpenaiTemplate
5 5 class OIVSCode(OpenaiTemplate):
6 6 label = "OI VSCode Server"
7 7 url = "https://oi-vscode-server.onrender.com"
8 api_base = "https://oi-vscode-server.onrender.com/v1"
8 api_base = "https://oi-vscode-server-2.onrender.com/v1"
9 9
10 10 working = True
11 11 needs_auth = False
@@ -16,6 +16,9 @@ class OIVSCode(OpenaiTemplate):
16 16 default_model = "gpt-4o-mini-2024-07-18"
17 17 default_vision_model = default_model
18 18 vision_models = [default_model, "gpt-4o-mini"]
19 models = vision_models
19 models = vision_models + ["deepseek-ai/DeepSeek-V3"]
20 20
21 model_aliases = {"gpt-4o-mini": "gpt-4o-mini-2024-07-18"}
21 model_aliases = {
22 "gpt-4o-mini": "gpt-4o-mini-2024-07-18",
23 "deepseek-v3": "deepseek-ai/DeepSeek-V3"
24 }
Modified g4f/Provider/PollinationsAI.py +37 -9
@@ -39,9 +39,12 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
39 39 default_model = "openai"
40 40 default_image_model = "flux"
41 41 default_vision_model = "gpt-4o"
42 image_models = ["flux-pro", "flux-dev", "flux-schnell", "midjourney", "dall-e-3", "turbo"]
42 text_models = [default_model]
43 image_models = [default_image_model]
44 extra_image_models = ["flux-pro", "flux-dev", "flux-schnell", "midjourney", "dall-e-3"]
43 45 vision_models = [default_vision_model, "gpt-4o-mini"]
44 46 extra_text_models = ["claude", "claude-email", "deepseek-reasoner", "deepseek-r1"] + vision_models
47 _models_loaded = False
45 48 model_aliases = {
46 49 ### Text Models ###
47 50 "gpt-4o-mini": "openai",
@@ -66,27 +69,51 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
66 69 ### Image Models ###
67 70 "sdxl-turbo": "turbo",
68 71 }
69 text_models = []
70 72
71 73 @classmethod
72 74 def get_models(cls, **kwargs):
73 if not cls.text_models or not cls.image_models:
75 if not cls._models_loaded:
74 76 try:
77 # Update of image models
75 78 image_response = requests.get("https://image.pollinations.ai/models")
76 79 image_response.raise_for_status()
77 80 new_image_models = image_response.json()
78 cls.image_models = list(dict.fromkeys([*cls.image_models, *new_image_models]))
79 81
82 # Combine models without duplicates
83 all_image_models = (
84 cls.image_models + # Already contains the default
85 cls.extra_image_models +
86 new_image_models
87 )
88 cls.image_models = list(dict.fromkeys(all_image_models))
89
90 # Update of text models
80 91 text_response = requests.get("https://text.pollinations.ai/models")
81 92 text_response.raise_for_status()
82 original_text_models = [model.get("name") for model in text_response.json()]
83
84 combined_text = cls.extra_text_models + [
85 model for model in original_text_models
86 if model not in cls.extra_text_models
93 original_text_models = [
94 model.get("name")
95 for model in text_response.json()
87 96 ]
97
98 # Combining text models
99 combined_text = (
100 cls.text_models + # Already contains the default
101 cls.extra_text_models +
102 [
103 model for model in original_text_models
104 if model not in cls.extra_text_models
105 ]
106 )
88 107 cls.text_models = list(dict.fromkeys(combined_text))
108
109 cls._models_loaded = True
110
89 111 except Exception as e:
112 # Save default models in case of an error
113 if not cls.text_models:
114 cls.text_models = [cls.default_model]
115 if not cls.image_models:
116 cls.image_models = [cls.default_image_model]
90 117 raise RuntimeError(f"Failed to fetch models: {e}") from e
91 118
92 119 return cls.text_models + cls.image_models
@@ -114,6 +141,7 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
114 141 cache: bool = False,
115 142 **kwargs
116 143 ) -> AsyncResult:
144 cls.get_models()
117 145 if images is not None and not model:
118 146 model = cls.default_vision_model
119 147 try:
Modified g4f/Provider/PollinationsImage.py +16 -4
@@ -10,13 +10,23 @@ class PollinationsImage(PollinationsAI):
10 10 default_model = "flux"
11 11 default_vision_model = None
12 12 default_image_model = default_model
13 image_models = [default_image_model] # Default models
14 _models_loaded = False # Add a checkbox for synchronization
13 15
14 16 @classmethod
15 17 def get_models(cls, **kwargs):
16 if not cls.models:
17 super().get_models(**kwargs)
18 cls.models = cls.image_models
19 return cls.models
18 if not cls._models_loaded:
19 # Calling the parent method to load models
20 super().get_models()
21 # Combine models from the parent class and additional ones
22 all_image_models = list(dict.fromkeys(
23 cls.image_models +
24 PollinationsAI.image_models +
25 cls.extra_image_models
26 ))
27 cls.image_models = all_image_models
28 cls._models_loaded = True
29 return cls.image_models
20 30
21 31 @classmethod
22 32 async def create_async_generator(
@@ -35,6 +45,8 @@ class PollinationsImage(PollinationsAI):
35 45 safe: bool = False,
36 46 **kwargs
37 47 ) -> AsyncResult:
48 # Calling model updates before creating a generator
49 cls.get_models()
38 50 async for chunk in cls._generate_image(
39 51 model=model,
40 52 prompt=format_image_prompt(messages, prompt),
Modified g4f/Provider/__init__.py +1 -1
@@ -14,8 +14,8 @@ from .hf_space import *
14 14 from .mini_max import HailuoAI, MiniMax
15 15 from .template import OpenaiTemplate, BackendApi
16 16
17 from .AllenAI import AllenAI
17 18 from .Blackbox import Blackbox
18 from .BlackboxAPI import BlackboxAPI
19 19 from .ChatGLM import ChatGLM
20 20 from .ChatGpt import ChatGpt
21 21 from .ChatGptEs import ChatGptEs
Modified g4f/Provider/needs_auth/CablyAI.py +1 -1
Modified g4f/models.py +67 -23
Modified g4f/providers/base_provider.py +1 -1