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

XFEstudio/gpt4free

Add support for multiple AI models and enhance agent functionality in Blackbox provider (#2484)

* refactor(g4f/Provider/Airforce.py): improve model handling and filtering - Add hidden_models set to exclude specific models - Add evil alias for uncensored model handling - Extend filtering for model-specific response tokens - Add response buffering for streamed content - Update model fetching with error handling * refactor(g4f/Provider/Blackbox.py): improve caching and model handling - Add caching system for validated values with file-based storage - Rename 'flux' model to 'ImageGeneration' and update references - Add temperature, top_p and max_tokens parameters to generator - Simplify HTTP headers and remove redundant options - Add model alias mapping for ImageGeneration - Add file system utilities for cache management * feat(g4f/Provider/RobocodersAPI.py): add caching and error handling - Add file-based caching system for access tokens and sessions - Add robust error handling with specific error messages - Add automatic dialog continuation on resource limits - Add HTML parsing with BeautifulSoup for token extraction - Add debug logging for error tracking - Add timeout configuration for API requests * refactor(g4f/Provider/DarkAI.py): update DarkAI default model and aliases - Change default model from llama-3-405b to llama-3-70b - Remove llama-3-405b from supported models list - Remove llama-3.1-405b from model aliases * feat(g4f/Provider/Blackbox2.py): add image generation support - Add image model 'flux' with dedicated API endpoint - Refactor generator to support both text and image outputs - Extract headers into reusable static method - Add type hints for AsyncGenerator return type - Split generation logic into _generate_text and _generate_image methods - Add ImageResponse handling for image generation results BREAKING CHANGE: create_async_generator now returns AsyncGenerator instead of AsyncResult * refactor(g4f/Provider/ChatGptEs.py): update ChatGptEs model configuration - Update models list to include gpt-3.5-turbo - Remove chatgpt-4o-latest from supported models - Remove model_aliases mapping for gpt-4o * feat(g4f/Provider/DeepInfraChat.py): add Accept-Language header support - Add Accept-Language header for internationalization - Maintain existing header configuration - Improve request compatibility with language preferences * refactor(g4f/Provider/needs_auth/Gemini.py): add ProviderModelMixin inheritance - Add ProviderModelMixin to class inheritance - Import ProviderModelMixin from base_provider - Move BaseConversation import to base_provider imports * refactor(g4f/Provider/Liaobots.py): update model details and aliases - Add version suffix to o1 model IDs - Update model aliases for o1-preview and o1-mini - Standardize version format across model definitions * refactor(g4f/Provider/PollinationsAI.py): enhance model support and generation - Split generation logic into dedicated image/text methods - Add additional text models including sur and claude - Add width/height parameters for image generation - Add model existence validation - Add hasattr checks for model lists initialization * chore(gitignore): add provider cache directory - Add g4f/Provider/.cache to gitignore patterns * refactor(g4f/Provider/ReplicateHome.py): update model configuration - Update default model to gemma-2b-it - Add default_image_model configuration - Remove llava-13b from supported models - Simplify request headers * feat(g4f/models.py): expand provider and model support - Add new providers DarkAI and PollinationsAI - Add new models for Mistral, Flux and image generation - Update provider lists for existing models - Add P1 and Evil models with experimental providers BREAKING CHANGE: Remove llava-13b model support * refactor(Airforce): Update type hint for split_message return - Change return type of from to for consistency with import. - Maintain overall functionality and structure of the class. - Ensure compatibility with type hinting standards in Python. * refactor(g4f/Provider/Airforce.py): Update type hint for split_message return - Change return type of 'split_message' from 'list[str]' to 'List[str]' for consistency with import. - Maintain overall functionality and structure of the 'Airforce' class. - Ensure compatibility with type hinting standards in Python. * feat(g4f/Provider/RobocodersAPI.py): Add support for optional BeautifulSoup dependency - Introduce a check for the BeautifulSoup library and handle its absence gracefully. - Raise a if BeautifulSoup is not installed, prompting the user to install it. - Remove direct import of BeautifulSoup to avoid import errors when the library is missing. * fix: Updating provider documentation and small fixes in providers * Disabled the provider (RobocodersAPI) * Fix: Conflicting file g4f/models.py * Update g4f/models.py g4f/Provider/Airforce.py * Update docs/providers-and-models.md g4f/models.py g4f/Provider/Airforce.py g4f/Provider/PollinationsAI.py * Update docs/providers-and-models.md * Update .gitignore * Update g4f/models.py * Update g4f/Provider/PollinationsAI.py * feat(g4f/Provider/Blackbox.py): add support for additional AI models and agents - Introduce new agent modes for Meta-Llama, Mistral, DeepSeek, DBRX, Qwen, and Nous-Hermes - Update model aliases to include newly supported models * Update (g4f/Provider/Blackbox.py) * Update (g4f/Provider/Blackbox.py) * feat(g4f/Provider/Blackbox2.py): add license key caching and validation - Add cache file management for license key persistence - Implement async license key extraction from JavaScript files - Add license key validation to text generation requests - Update type hints for async generators - Add error handling for cache file operations Breaking changes: - Text generation now requires license key validation --------- Co-authored-by: kqlio67 <>

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

代码差异

6 个文件 +166 -44
Modified docs/providers-and-models.md +6 -3
@@ -22,7 +22,7 @@ This document provides an overview of various AI providers and models, including
22 22 |----------|-------------|--------------|---------------|--------|--------|------|------|
23 23 |[api.airforce](https://api.airforce)|`g4f.Provider.Airforce`|`phi-2, gpt-4, gpt-4o-mini, gpt-4o, gpt-4-turbo, o1-mini, openchat-3.5, deepseek-coder, hermes-2-dpo, hermes-2-pro, openhermes-2.5, lfm-40b, german-7b, llama-2-7b, llama-3.1-70b, neural-7b, zephyr-7b, evil,`|`sdxl, flux-pro, flux, flux-realism, flux-anime, flux-3d, flux-disney, flux-pixel, flux-4o, any-dark, midjourney, dall-e-3`|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌+✔|
24 24 |[amigochat.io](https://amigochat.io/chat/)|`g4f.Provider.AmigoChat`|✔|✔|❌|✔|![Error](https://img.shields.io/badge/RateLimit-f48d37)|❌|
25 |[blackbox.ai](https://www.blackbox.ai)|`g4f.Provider.Blackbox`|`blackboxai, gpt-4, gpt-4o, gemini-pro, claude-3.5-sonnet, blackboxai-pro, llama-3.1-8b, llama-3.1-70b, llama-3.1-405b`|`flux`|`blackboxai, gpt-4o, gemini-pro, gemini-flash, llama-3.1-8b, llama-3.1-70b, llama-3.1-405b`|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌|
25 |[blackbox.ai](https://www.blackbox.ai)|`g4f.Provider.Blackbox`|`blackboxai, gpt-4, gpt-4o, gemini-pro, claude-3.5-sonnet, blackboxai-pro, llama-3.1-8b, llama-3.1-70b, llama-3.1-405b, llama-3.3-70b, mixtral-7b, deepseek-chat, dbrx-instruct, qwq-32b, hermes-2-dpo`|`flux`|`blackboxai, gpt-4o, gemini-pro, gemini-flash, llama-3.1-8b, llama-3.1-70b, llama-3.1-405b`|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌|
26 26 |[blackbox.ai](https://www.blackbox.ai)|`g4f.Provider.Blackbox2`|`llama-3.1-70b`|`flux`|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌|
27 27 |[chatgpt.com](https://chatgpt.com)|`g4f.Provider.ChatGpt`|✔|❌|❌|✔|![Error](https://img.shields.io/badge/HTTPError-f48d37)|❌|
28 28 |[chatgpt.es](https://chatgpt.es)|`g4f.Provider.ChatGptEs`|`gpt-4, gpt-4o, gpt-4o-mini`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|❌|
@@ -97,7 +97,8 @@ This document provides an overview of various AI providers and models, including
97 97 |llama-3.1-70b|Meta Llama|12+ Providers|[ai.meta.com](https://ai.meta.com/blog/meta-llama-3-1/)|
98 98 |llama-3.1-405b|Meta Llama|1+ Providers|[ai.meta.com](https://ai.meta.com/blog/meta-llama-3-1/)|
99 99 |llama-3.2-11b|Meta Llama|2+ Providers|[ai.meta.com](https://ai.meta.com/blog/llama-3-2-connect-2024-vision-edge-mobile-devices/)|
100 |llama-3.3-70b|Meta Llama|3+ Providers|[llama.com/]()|
100 |llama-3.3-70b|Meta Llama|4+ Providers|[llama.com/]()|
101 |mixtral-7b|Mistral AI|1+ Providers|[mistral.ai](https://mistral.ai/news/mixtral-of-experts/)|
101 102 |mixtral-8x7b|Mistral AI|1+ Providers|[mistral.ai](https://mistral.ai/news/mixtral-of-experts/)|
102 103 |mistral-nemo|Mistral AI|3+ Providers|[huggingface.co](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407)|
103 104 |mistral-large|Mistral AI|1+ Providers|[mistral.ai](https://mistral.ai/news/mistral-large-2407/)|
@@ -122,8 +123,9 @@ This document provides an overview of various AI providers and models, including
122 123 |qwen-2-72b|Qwen|1+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2-72B)|
123 124 |qwen-2.5-72b|Qwen|2+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2.5-72B-Instruct)|
124 125 |qwen-2.5-coder-32b|Qwen|4+ Providers|[huggingface.co](https://huggingface.co/Qwen/Qwen2.5-Coder-32B)|
125 |qwq-32b|Qwen|3+ Providers|[qwen2.org](https://qwen2.org/qwq-32b-preview/)|
126 |qwq-32b|Qwen|4+ Providers|[qwen2.org](https://qwen2.org/qwq-32b-preview/)|
126 127 |pi|Inflection|1+ Providers|[inflection.ai](https://inflection.ai/blog/inflection-2-5)|
128 |deepseek-chat|DeepSeek|1+ Providers|[huggingface.co](https://huggingface.co/deepseek-ai/deepseek-llm-67b-chat)|
127 129 |deepseek-coder|DeepSeek|1+ Providers|[huggingface.co](https://huggingface.co/deepseek-ai/DeepSeek-Coder-V2-Instruct)|
128 130 |wizardlm-2-8x22b|WizardLM|1+ Providers|[huggingface.co](https://huggingface.co/alpindale/WizardLM-2-8x22B)|
129 131 |openchat-3.5|OpenChat|1+ Providers|[huggingface.co](https://huggingface.co/openchat/openchat_3.5)|
@@ -137,6 +139,7 @@ This document provides an overview of various AI providers and models, including
137 139 |zephyr-7b|HuggingFaceH4|1+ Providers|[huggingface.co](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta)|
138 140 |neural-7b|Inferless|1+ Providers|[huggingface.co](https://huggingface.co/Intel/neural-chat-7b-v3-1)|
139 141 |p1|PollinationsAI|1+ Providers|[]( )|
142 |dbrx-instruct|Databricks|1+ Providers|[huggingface.co](https://huggingface.co/databricks/dbrx-instruct)|
140 143 |evil|Evil Mode - Experimental|2+ Providers|[]( )|
141 144 |midijourney||1+ Providers|[]( )|
142 145 |turbo||1+ Providers|[]( )|
Modified docs/providers.md +3 -3
@@ -17,8 +17,8 @@
17 17 | -------- | ---- |
18 18 | **Website** | [blackbox.ai](https://www.blackbox.ai) |
19 19 | **Status** | ![Active](https://img.shields.io/badge/Active-brightgreen) |
20 | **Models** | gpt-4, gpt-4o, llama-3.1-8b, llama-3.1-70b, llama-3.1-405b, gemini-pro, gemini-flash, claude-3.5-sonnet, blackboxai, blackboxai-pro (41)|
21 | **Image Models (Image Generation)** | flux |
20 | **Models** | gpt-4, gpt-4o, llama-3.1-8b, llama-3.1-70b, llama-3.1-405b, gemini-pro, gemini-flash, claude-3.5-sonnet, blackboxai, blackboxai-pro, llama-3.3-70b, mixtral-7b, deepseek-chat, dbrx-instruct, llama-3.1-405b, qwq-32b, hermes-2-dpo (46)|
21 | **Image Models (Image Generation)** | flux (2)|
22 22 | **Vision (Image Upload)** | ✔️ |
23 23 | **Authentication** | ❌ |
24 24 | **Streaming** | ✔️ |
@@ -572,4 +572,4 @@
572 572 | Pollinations AI | `g4f.Provider.PollinationsAI` | flux, flux-realism, flux-cablyai, flux-anime, flux-3d, any-dark, flux-pro, turbo, midjourney, dall-e-3| ❌ | [pollinations.ai](https://pollinations.ai) |
573 573 | Prodia | `g4f.Provider.Prodia` | | ❌ | [app.prodia.com](https://app.prodia.com) |
574 574 | ReplicateHome | `g4f.Provider.ReplicateHome` | sd-3, sdxl, playground-v2.5| ❌ | [replicate.com](https://replicate.com) |
575 | You.com | `g4f.Provider.You` | | ❌ | [you.com](https://you.com) |
575 | You.com | `g4f.Provider.You` | | ❌ | [you.com](https://you.com) |
Modified g4f/Provider/Blackbox.py +36 -21
@@ -35,7 +35,14 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
35 35 userSelectedModel = ['gpt-4o', 'gemini-pro', 'claude-sonnet-3.5', 'blackboxai-pro']
36 36
37 37 agentMode = {
38 'ImageGeneration': {'mode': True, 'id': "ImageGenerationLV45LJp", 'name': "Image Generation"}
38 'ImageGeneration': {'mode': True, 'id': "ImageGenerationLV45LJp", 'name': "Image Generation"},
39 'meta-llama/Llama-3.3-70B-Instruct-Turbo': {'mode': True, 'id': "meta-llama/Llama-3.3-70B-Instruct-Turbo", 'name': "Meta-Llama-3.3-70B-Instruct-Turbo"},
40 'mistralai/Mistral-7B-Instruct-v0.2': {'mode': True, 'id': "mistralai/Mistral-7B-Instruct-v0.2", 'name': "Mistral-(7B)-Instruct-v0.2"},
41 'deepseek-ai/deepseek-llm-67b-chat': {'mode': True, 'id': "deepseek-ai/deepseek-llm-67b-chat", 'name': "DeepSeek-LLM-Chat-(67B)"},
42 'databricks/dbrx-instruct': {'mode': True, 'id': "databricks/dbrx-instruct", 'name': "DBRX-Instruct"},
43 'meta-llama/Meta-Llama-3.1-405B-Instruct-Lite-Pro': {'mode': True, 'id': "meta-llama/Meta-Llama-3.1-405B-Instruct-Lite-Pro", 'name': "Meta-Llama-3.1-405B-Instruct-Turbo"}, #
44 'Qwen/QwQ-32B-Preview': {'mode': True, 'id': "Qwen/QwQ-32B-Preview", 'name': "Qwen-QwQ-32B-Preview"},
45 'NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO': {'mode': True, 'id': "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO", 'name': "Nous-Hermes-2-Mixtral-8x7B-DPO"}
39 46 }
40 47
41 48 trendingAgentMode = {
@@ -102,6 +109,13 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
102 109 "gpt-4": "gpt-4o",
103 110 "gemini-flash": "gemini-1.5-flash",
104 111 "claude-3.5-sonnet": "claude-sonnet-3.5",
112 "llama-3.3-70b": "meta-llama/Llama-3.3-70B-Instruct-Turbo",
113 "mixtral-7b": "mistralai/Mistral-7B-Instruct-v0.2",
114 "deepseek-chat": "deepseek-ai/deepseek-llm-67b-chat",
115 "dbrx-instruct": "databricks/dbrx-instruct",
116 "llama-3.1-405b": "meta-llama/Meta-Llama-3.1-405B-Instruct-Lite-Pro",
117 "qwq-32b": "Qwen/QwQ-32B-Preview",
118 "hermes-2-dpo": "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
105 119
106 120 ### image ###
107 121 "flux": "ImageGeneration",
@@ -198,9 +212,9 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
198 212 proxy: str = None,
199 213 web_search: bool = False,
200 214 images: ImagesType = None,
201 top_p: float = 0.9,
202 temperature: float = 0.5,
203 max_tokens: int = 1024,
215 top_p: float = None,
216 temperature: float = None,
217 max_tokens: int = None,
204 218 **kwargs
205 219 ) -> AsyncResult:
206 220 message_id = cls.generate_id()
@@ -233,30 +247,31 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
233 247 }
234 248
235 249 data = {
236 "messages": messages,
237 "id": message_id,
238 "previewToken": None,
239 "userId": None,
240 "codeModelMode": True,
241 250 "agentMode": cls.agentMode.get(model, {}) if model in cls.agentMode else {},
242 "trendingAgentMode": cls.trendingAgentMode.get(model, {}) if model in cls.trendingAgentMode else {},
243 "isMicMode": False,
244 "userSystemPrompt": None,
245 "maxTokens": max_tokens,
246 "playgroundTopP": top_p,
247 "playgroundTemperature": temperature,
248 "isChromeExt": False,
249 "githubToken": None,
250 251 "clickedAnswer2": False,
251 252 "clickedAnswer3": False,
252 253 "clickedForceWebSearch": False,
253 "visitFromDelta": False,
254 "codeModelMode": True,
255 "deepSearchMode": False,
256 "githubToken": None,
257 "id": message_id,
258 "imageGenerationMode": False,
259 "isChromeExt": False,
260 "isMicMode": False,
261 "maxTokens": max_tokens,
262 "messages": messages,
254 263 "mobileClient": False,
264 "playgroundTemperature": temperature,
265 "playgroundTopP": top_p,
266 "previewToken": None,
267 "trendingAgentMode": cls.trendingAgentMode.get(model, {}) if model in cls.trendingAgentMode else {},
268 "userId": None,
255 269 "userSelectedModel": model if model in cls.userSelectedModel else None,
256 "webSearchMode": web_search,
270 "userSystemPrompt": None,
257 271 "validated": validated_value,
258 "imageGenerationMode": False,
259 "webSearchModePrompt": web_search
272 "visitFromDelta": False,
273 "webSearchModePrompt": False,
274 "webSearchMode": web_search
260 275 }
261 276
262 277 async with ClientSession(headers=headers) as session:
Modified g4f/Provider/Blackbox2.py +81 -13
@@ -2,12 +2,16 @@ from __future__ import annotations
2 2
3 3 import random
4 4 import asyncio
5 import re
6 import json
7 from pathlib import Path
5 8 from aiohttp import ClientSession
6 9 from typing import AsyncGenerator
7 10
8 11 from ..typing import AsyncResult, Messages
9 12 from ..image import ImageResponse
10 13 from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
14 from ..cookies import get_cookies_dir
11 15
12 16 from .. import debug
13 17
@@ -28,23 +32,84 @@ class Blackbox2(AsyncGeneratorProvider, ProviderModelMixin):
28 32 image_models = ['flux']
29 33 models = [*chat_models, *image_models]
30 34
35 @classmethod
36 def _get_cache_file(cls) -> Path:
37 """Returns the path to the cache file."""
38 dir = Path(get_cookies_dir())
39 dir.mkdir(exist_ok=True)
40 return dir / 'blackbox2.json'
41
42 @classmethod
43 def _load_cached_license(cls) -> str | None:
44 """Loads the license key from the cache."""
45 cache_file = cls._get_cache_file()
46 if cache_file.exists():
47 try:
48 with open(cache_file, 'r') as f:
49 data = json.load(f)
50 return data.get('license_key')
51 except Exception as e:
52 debug.log(f"Error reading cache file: {e}")
53 return None
54
55 @classmethod
56 def _save_cached_license(cls, license_key: str):
57 """Saves the license key to the cache."""
58 cache_file = cls._get_cache_file()
59 try:
60 with open(cache_file, 'w') as f:
61 json.dump({'license_key': license_key}, f)
62 except Exception as e:
63 debug.log(f"Error writing to cache file: {e}")
64
65 @classmethod
66 async def _get_license_key(cls, session: ClientSession) -> str:
67 """Gets the license key from the cache or from JavaScript files."""
68 cached_license = cls._load_cached_license()
69 if cached_license:
70 return cached_license
71
72 try:
73 async with session.get(cls.url) as response:
74 html = await response.text()
75 js_files = re.findall(r'static/chunks/\d{4}-[a-fA-F0-9]+\.js', html)
76
77 license_pattern = re.compile(r'j="(\d{6}-\d{6}-\d{6}-\d{6}-\d{6})"')
78
79 for js_file in js_files:
80 js_url = f"{cls.url}/_next/{js_file}"
81 async with session.get(js_url) as js_response:
82 js_content = await js_response.text()
83 if license_match := license_pattern.search(js_content):
84 license_key = license_match.group(1)
85 cls._save_cached_license(license_key)
86 return license_key
87
88 raise ValueError("License key not found")
89 except Exception as e:
90 debug.log(f"Error getting license key: {str(e)}")
91 raise
92
31 93 @classmethod
32 94 async def create_async_generator(
33 95 cls,
34 96 model: str,
35 97 messages: Messages,
98 prompt: str = None,
36 99 proxy: str = None,
37 100 max_retries: int = 3,
38 101 delay: int = 1,
102 max_tokens: int = None,
39 103 **kwargs
40 ) -> AsyncResult:
104 ) -> AsyncGenerator[str, None]:
41 105 if not model:
42 106 model = cls.default_model
107
43 108 if model in cls.chat_models:
44 async for result in cls._generate_text(model, messages, proxy, max_retries, delay):
109 async for result in cls._generate_text(model, messages, proxy, max_retries, delay, max_tokens):
45 110 yield result
46 111 elif model in cls.image_models:
47 prompt = messages[-1]["content"] if prompt is None else prompt
112 prompt = messages[-1]["content"]
48 113 async for result in cls._generate_image(model, prompt, proxy):
49 114 yield result
50 115 else:
@@ -57,17 +122,21 @@ class Blackbox2(AsyncGeneratorProvider, ProviderModelMixin):
57 122 messages: Messages,
58 123 proxy: str = None,
59 124 max_retries: int = 3,
60 delay: int = 1
61 ) -> AsyncGenerator:
125 delay: int = 1,
126 max_tokens: int = None,
127 ) -> AsyncGenerator[str, None]:
62 128 headers = cls._get_headers()
63 api_endpoint = cls.api_endpoints[model]
64
65 data = {
66 "messages": messages,
67 "max_tokens": None
68 }
69 129
70 130 async with ClientSession(headers=headers) as session:
131 license_key = await cls._get_license_key(session)
132 api_endpoint = cls.api_endpoints[model]
133
134 data = {
135 "messages": messages,
136 "max_tokens": max_tokens,
137 "validated": license_key
138 }
139
71 140 for attempt in range(max_retries):
72 141 try:
73 142 async with session.post(api_endpoint, json=data, proxy=proxy) as response:
@@ -92,7 +161,7 @@ class Blackbox2(AsyncGeneratorProvider, ProviderModelMixin):
92 161 model: str,
93 162 prompt: str,
94 163 proxy: str = None
95 ) -> AsyncGenerator:
164 ) -> AsyncGenerator[ImageResponse, None]:
96 165 headers = cls._get_headers()
97 166 api_endpoint = cls.api_endpoints[model]
98 167
@@ -116,7 +185,6 @@ class Blackbox2(AsyncGeneratorProvider, ProviderModelMixin):
116 185 'accept-language': 'en-US,en;q=0.9',
117 186 'content-type': 'text/plain;charset=UTF-8',
118 187 'origin': 'https://www.blackbox.ai',
119 'priority': 'u=1, i',
120 188 'referer': 'https://www.blackbox.ai',
121 189 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36'
122 190 }
Modified g4f/gui/client/index.html +1 -0
@@ -285,6 +285,7 @@
285 285 <option value="Copilot">Microsoft Copilot</option>
286 286 <option value="Gemini">Google Gemini</option>
287 287 <option value="DDG">DuckDuckGo AI Chat</option>
288 <option value="Blackbox">Blackbox AI</option>
288 289 <option disabled="disabled">----</option>
289 290 </select>
290 291 </div>
Modified g4f/models.py +39 -4
@@ -76,8 +76,9 @@ default = Model(
76 76 DeepInfraChat,
77 77 Airforce,
78 78 Cloudflare,
79 Mhystical,
80 79 PollinationsAI,
80 ChatGptEs,
81 ChatGpt,
81 82 ])
82 83 )
83 84
@@ -195,10 +196,16 @@ llama_3_2_11b = Model(
195 196 llama_3_3_70b = Model(
196 197 name = "llama-3.3-70b",
197 198 base_provider = "Meta Llama",
198 best_provider = IterListProvider([HuggingChat, HuggingFace, PerplexityLabs])
199 best_provider = IterListProvider([Blackbox, HuggingChat, HuggingFace, PerplexityLabs])
199 200 )
200 201
201 202 ### Mistral ###
203 mixtral_7b = Model(
204 name = "mixtral-7b",
205 base_provider = "Mistral",
206 best_provider = Blackbox
207 )
208
202 209 mixtral_8x7b = Model(
203 210 name = "mixtral-8x7b",
204 211 base_provider = "Mistral",
@@ -221,7 +228,7 @@ mistral_large = Model(
221 228 hermes_2_dpo = Model(
222 229 name = "hermes-2-dpo",
223 230 base_provider = "NousResearch",
224 best_provider = Airforce
231 best_provider = IterListProvider([Blackbox, Airforce])
225 232 )
226 233
227 234 hermes_2_pro = Model(
@@ -368,7 +375,7 @@ qwen_2_5_coder_32b = Model(
368 375 qwq_32b = Model(
369 376 name = 'qwq-32b',
370 377 base_provider = 'Qwen',
371 best_provider = IterListProvider([DeepInfraChat, HuggingChat, HuggingFace])
378 best_provider = IterListProvider([DeepInfraChat, Blackbox, HuggingChat, HuggingFace])
372 379 )
373 380
374 381 ### Inflection ###
@@ -379,6 +386,12 @@ pi = Model(
379 386 )
380 387
381 388 ### DeepSeek ###
389 deepseek_chat = Model(
390 name = 'deepseek-chat',
391 base_provider = 'DeepSeek',
392 best_provider = Blackbox
393 )
394
382 395 deepseek_coder = Model(
383 396 name = 'deepseek-coder',
384 397 base_provider = 'DeepSeek',
@@ -463,6 +476,20 @@ neural_7b = Model(
463 476 best_provider = Airforce
464 477 )
465 478
479 ### Databricks ###
480 dbrx_instruct = Model(
481 name = 'dbrx-instruct',
482 base_provider = 'Databricks',
483 best_provider = Blackbox
484 )
485
486 ### PollinationsAI ###
487 p1 = Model(
488 name = 'p1',
489 base_provider = 'PollinationsAI',
490 best_provider = PollinationsAI
491 )
492
466 493 ### Uncensored AI ###
467 494 evil = Model(
468 495 name = 'evil',
@@ -654,6 +681,7 @@ class ModelUtils:
654 681 llama_3_3_70b.name: llama_3_3_70b,
655 682
656 683 ### Mistral ###
684 mixtral_7b.name: mixtral_7b,
657 685 mixtral_8x7b.name: mixtral_8x7b,
658 686 mistral_nemo.name: mistral_nemo,
659 687 mistral_large.name: mistral_large,
@@ -728,6 +756,7 @@ class ModelUtils:
728 756 sonar_chat.name: sonar_chat,
729 757
730 758 ### DeepSeek ###
759 deepseek_chat.name: deepseek_chat,
731 760 deepseek_coder.name: deepseek_coder,
732 761
733 762 ### TheBloke ###
@@ -748,6 +777,12 @@ class ModelUtils:
748 777 ### Inferless ###
749 778 neural_7b.name: neural_7b,
750 779
780 ### Databricks ###
781 dbrx_instruct.name: dbrx_instruct,
782
783 ### PollinationsAI ###
784 p1.name: p1,
785
751 786 ### Uncensored AI ###
752 787 evil.name: evil,
753 788