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

XFEstudio/gpt4free

Update provider list

b775c0e2
hlohaus <hlohaus@users.noreply.github.com>
提交于

代码差异

7 个文件 +9 -490
Modified g4f/Provider/__init__.py +4 -18
@@ -82,12 +82,8 @@ def _resolve_provider(name: str) -> ProviderType:
82 82 from g4f.Provider.needs_auth.mini_max.HailuoAI import HailuoAI; return HailuoAI
83 83 elif name == "HuggingChat":
84 84 from g4f.Provider.needs_auth.hf.HuggingChat import HuggingChat; return HuggingChat
85 elif name == "HuggingFace":
85 elif name == "HuggingFace" or name == "HuggingFaceAPI":
86 86 from g4f.Provider.needs_auth.hf import HuggingFace; return HuggingFace
87 elif name == "HuggingFaceAPI":
88 from g4f.Provider.needs_auth.hf.HuggingFaceAPI import HuggingFaceAPI; return HuggingFaceAPI
89 elif name == "HuggingFaceInference":
90 from g4f.Provider.needs_auth.hf.HuggingFaceInference import HuggingFaceInference; return HuggingFaceInference
91 87 elif name == "HuggingFaceMedia":
92 88 from g4f.Provider.needs_auth.hf.HuggingFaceMedia import HuggingFaceMedia; return HuggingFaceMedia
93 89 elif name == "HuggingSpace":
@@ -184,7 +180,7 @@ _provider_names = [
184 180 "AIBadgr",
185 181 "Anthropic",
186 182 "Antigravity",
187 "ApiAirforce",
183 "Airforce",
188 184 "BingCreateImages",
189 185 "BlackForestLabs_Flux1Dev",
190 186 "BlackForestLabs_Flux1KontextDev",
@@ -203,9 +199,7 @@ _provider_names = [
203 199 "Custom",
204 200 "DeepInfra",
205 201 "DeepSeek",
206 "EasyChat",
207 202 "EdgeTTS",
208 "Felo",
209 203 "FenayAI",
210 204 "GLM",
211 205 "Gemini",
@@ -216,15 +210,11 @@ _provider_names = [
216 210 "GithubCopilotAPI",
217 211 "GlhfChat",
218 212 "GoogleSearch",
219
220 "GradientNetwork",
221 213 "Grok",
222 214 "Groq",
223 215 "HailuoAI",
224 216 "HuggingChat",
225 217 "HuggingFace",
226 "HuggingFaceAPI",
227 "HuggingFaceInference",
228 218 "HuggingFaceMedia",
229 219 "HuggingSpace",
230 220 "LMArena",
@@ -233,11 +223,9 @@ _provider_names = [
233 223 "MetaAI",
234 224 "MetaAIAccount",
235 225 "MicrosoftDesigner",
236 "Miklium",
237 226 "MiniMax",
238 227 "Nvidia",
239 228 "Ollama",
240 "OllamaSwarm",
241 229 "OpenAIFM",
242 230 "OpenRouter",
243 231 "OpenRouterFree",
@@ -246,22 +234,20 @@ _provider_names = [
246 234 "OpenaiChat",
247 235 "OpenaiTemplate",
248 236 "OperaAria",
249 "Perchance",
250 237 "Perplexity",
251 238 "PerplexityApi",
252 239 "PhindAi",
253 240 "Pi",
254 "PollinationsAI",
241 "Pollinations",
255 242 "PollinationsAudio",
256 243 "PollinationsImage",
257 "PuterJS",
244 "Puter",
258 245 "Qwen",
259 246 "QwenCode",
260 247 "Reka",
261 248 "Replicate",
262 249 "SearXNG",
263 250 "StabilityAI_SD35Large",
264 "Surfsense",
265 251 "TeachAnything",
266 252 "ThebApi",
267 253 "Together",
Deleted g4f/Provider/needs_auth/hf/HuggingFaceAPI.py +0 -100
@@ -1,100 +0,0 @@
1 from __future__ import annotations
2
3 import requests
4
5 from ....providers.types import Messages
6 from ....typing import MediaListType
7 from ....requests import StreamSession, raise_for_status
8 from ....errors import ModelNotFoundError, PaymentRequiredError
9 from ....providers.response import ProviderInfo
10 from ...template.OpenaiTemplate import OpenaiTemplate
11 from .models import model_aliases, vision_models, default_model, default_vision_model, text_models
12
13 class HuggingFaceAPI(OpenaiTemplate):
14 label = "HuggingFace (Text Generation)"
15 parent = "HuggingFace"
16 url = "https://huggingface.com"
17 base_url = "https://router.huggingface.co/v1"
18 working = True
19 needs_auth = True
20
21 default_model = default_model
22 default_vision_model = default_vision_model
23 vision_models = vision_models
24 model_aliases = model_aliases
25 fallback_models = text_models + vision_models
26
27 provider_mapping: dict[str, dict] = {}
28
29
30 @classmethod
31 async def get_mapping(cls, model: str, api_key: str = None):
32 if model in cls.provider_mapping:
33 return cls.provider_mapping[model]
34 async with StreamSession(
35 timeout=30,
36 headers=cls.get_headers(False, api_key),
37 ) as session:
38 async with session.get(f"https://huggingface.co/api/models/{model}?expand[]=inferenceProviderMapping") as response:
39 await raise_for_status(response)
40 model_data = await response.json()
41 cls.provider_mapping[model] = model_data.get("inferenceProviderMapping")
42 return cls.provider_mapping[model]
43
44 @classmethod
45 async def create_async_generator(
46 cls,
47 model: str,
48 messages: Messages,
49 base_url: str = None,
50 api_key: str = None,
51 max_tokens: int = 2048,
52 media: MediaListType = None,
53 **kwargs
54 ):
55 if not model and media is not None:
56 model = cls.default_vision_model
57 model = cls.get_model(model)
58 provider_mapping = await cls.get_mapping(model, api_key)
59 if not provider_mapping:
60 raise ModelNotFoundError(f"Model is not supported: {model} in: {cls.__name__}")
61 error = None
62 for provider_key in provider_mapping:
63 if provider_key == "zai-org":
64 api_path = "zai-org/api/paas/v4"
65 elif provider_key == "novita":
66 api_path = "novita/v3/openai"
67 elif provider_key == "groq":
68 api_path = "groq/openai/v1"
69 elif provider_key == "hf-inference":
70 api_path = f"{provider_key}/models/{model}/v1"
71 else:
72 api_path = f"{provider_key}/v1"
73 base_url = f"https://router.huggingface.co/{api_path}"
74 task = provider_mapping[provider_key]["task"]
75 if task != "conversational":
76 raise ModelNotFoundError(f"Model is not supported: {model} in: {cls.__name__} task: {task}")
77 model = provider_mapping[provider_key]["providerId"]
78 # start = calculate_lenght(messages)
79 # if start > max_inputs_lenght:
80 # if len(messages) > 6:
81 # messages = messages[:3] + messages[-3:]
82 # if calculate_lenght(messages) > max_inputs_lenght:
83 # last_user_message = [{"role": "user", "content": get_last_user_message(messages)}]
84 # if len(messages) > 2:
85 # messages = [m for m in messages if m["role"] == "system"] + last_user_message
86 # if len(messages) > 1 and calculate_lenght(messages) > max_inputs_lenght:
87 # messages = last_user_message
88 # debug.log(f"Messages trimmed from: {start} to: {calculate_lenght(messages)}")
89 try:
90 async for chunk in super().create_async_generator(model, messages, base_url=base_url, api_key=api_key, max_tokens=max_tokens, media=media, **kwargs):
91 if isinstance(chunk, ProviderInfo):
92 yield ProviderInfo(**{**chunk.get_dict(), "label": f"HuggingFace ({provider_key})"})
93 else:
94 yield chunk
95 return
96 except PaymentRequiredError as e:
97 error = e
98 continue
99 if error is not None:
100 raise error
Deleted g4f/Provider/needs_auth/hf/HuggingFaceInference.py +0 -255
@@ -1,255 +0,0 @@
1 from __future__ import annotations
2
3 import json
4 import base64
5 import random
6 import requests
7
8 from ....typing import AsyncResult, Messages
9 from ...base_provider import AsyncGeneratorProvider, ProviderModelMixin, format_prompt
10 from ....errors import ModelNotFoundError, ResponseError
11 from ....requests import StreamSession, raise_for_status
12 from ....providers.response import FinishReason, ImageResponse
13 from ....image.copy_images import save_response_media
14 from ....image import use_aspect_ratio
15 from ...helper import format_media_prompt, get_last_user_message
16 from .models import default_model, default_image_model, model_aliases, text_models, image_models, vision_models
17 from .... import debug
18
19 provider_together_urls = {
20 "black-forest-labs/FLUX.1-dev": "https://router.huggingface.co/together/v1/images/generations",
21 "black-forest-labs/FLUX.1-schnell": "https://router.huggingface.co/together/v1/images/generations",
22 }
23
24 class HuggingFaceInference(AsyncGeneratorProvider, ProviderModelMixin):
25 url = "https://huggingface.co"
26 parent = "HuggingFace"
27 working = False
28
29 default_model = default_model
30 default_image_model = default_image_model
31 model_aliases = model_aliases
32 image_models = image_models
33
34 model_data: dict[str, dict] = {}
35
36 @classmethod
37 def get_models(cls, **kwargs) -> list[str]:
38 if not cls.models:
39 models = text_models.copy()
40 url = "https://huggingface.co/api/models?inference=warm&pipeline_tag=text-generation"
41 response = requests.get(url, timeout=kwargs.get("timeout", 15))
42 if response.ok:
43 extra_models = [model["id"] for model in response.json() if model.get("trendingScore", 0) >= 10]
44 models = extra_models + vision_models + [model for model in models if model not in extra_models]
45 url = "https://huggingface.co/api/models?pipeline_tag=text-to-image"
46 response = requests.get(url, timeout=kwargs.get("timeout", 15))
47 cls.image_models = image_models.copy()
48 if response.ok:
49 extra_models = [model["id"] for model in response.json() if model.get("trendingScore", 0) >= 20]
50 cls.image_models.extend([model for model in extra_models if model not in cls.image_models])
51 models.extend([model for model in cls.image_models if model not in models])
52 cls.models = models
53 return cls.models
54
55 @classmethod
56 async def get_model_data(cls, session: StreamSession, model: str) -> str:
57 if model in cls.model_data:
58 return cls.model_data[model]
59 async with session.get(f"https://huggingface.co/api/models/{model}") as response:
60 if response.status == 404:
61 raise ModelNotFoundError(f"Model not found: {model} in: {cls.__name__}")
62 await raise_for_status(response)
63 cls.model_data[model] = await response.json()
64 return cls.model_data[model]
65
66 @classmethod
67 async def create_async_generator(
68 cls,
69 model: str,
70 messages: Messages,
71 stream: bool = True,
72 proxy: str = None,
73 timeout: int = 600,
74 base_url: str = "https://api-inference.huggingface.co",
75 api_key: str = None,
76 max_tokens: int = 1024,
77 temperature: float = None,
78 prompt: str = None,
79 action: str = None,
80 extra_body: dict = None,
81 seed: int = None,
82 aspect_ratio: str = None,
83 width: int = None,
84 height: int = None,
85 **kwargs
86 ) -> AsyncResult:
87 try:
88 model = cls.get_model(model)
89 except ModelNotFoundError:
90 pass
91 headers = {
92 'Accept-Encoding': 'gzip, deflate',
93 'Content-Type': 'application/json',
94 }
95 if api_key is not None:
96 headers["Authorization"] = f"Bearer {api_key}"
97 if extra_body is None:
98 extra_body = {}
99 image_extra_body = use_aspect_ratio({
100 "width": width,
101 "height": height,
102 **extra_body
103 }, aspect_ratio)
104 async with StreamSession(
105 headers=headers,
106 proxy=proxy,
107 timeout=timeout
108 ) as session:
109 try:
110 if model in provider_together_urls:
111 data = {
112 "response_format": "url",
113 "prompt": format_media_prompt(messages, prompt),
114 "model": model,
115 **image_extra_body
116 }
117 async with session.post(provider_together_urls[model], json=data) as response:
118 if response.status == 404:
119 raise ModelNotFoundError(f"Model not found: {model}")
120 await raise_for_status(response)
121 result = await response.json()
122 yield ImageResponse([item["url"] for item in result["data"]], data["prompt"])
123 return
124 except ModelNotFoundError:
125 pass
126 payload = None
127 params = {
128 "return_full_text": False,
129 "max_new_tokens": max_tokens,
130 "temperature": temperature,
131 **extra_body
132 }
133 do_continue = action == "continue"
134 if payload is None:
135 model_data = await cls.get_model_data(session, model)
136 pipeline_tag = model_data.get("pipeline_tag")
137 if pipeline_tag == "text-to-image":
138 stream = False
139 inputs = format_media_prompt(messages, prompt)
140 payload = {"inputs": inputs, "parameters": {"seed": random.randint(0, 2**32) if seed is None else seed, **image_extra_body}}
141 elif pipeline_tag in ("text-generation", "image-text-to-text"):
142 model_type = None
143 if "config" in model_data and "model_type" in model_data["config"]:
144 model_type = model_data["config"]["model_type"]
145 debug.log(f"Model type: {model_type}")
146 inputs = get_inputs(messages, model_data, model_type, do_continue)
147 debug.log(f"Inputs len: {len(inputs)}")
148 if len(inputs) > 4096:
149 if len(messages) > 6:
150 messages = messages[:3] + messages[-3:]
151 else:
152 messages = [m for m in messages if m["role"] == "system"] + [{"role": "user", "content": get_last_user_message(messages)}]
153 inputs = get_inputs(messages, model_data, model_type, do_continue)
154 debug.log(f"New len: {len(inputs)}")
155 if model_type == "gpt2" and max_tokens >= 1024:
156 params["max_new_tokens"] = 512
157 if seed is not None:
158 params["seed"] = seed
159 payload = {"inputs": inputs, "parameters": params, "stream": stream}
160 else:
161 raise ModelNotFoundError(f"Model is not supported: {model} in: {cls.__name__} pipeline_tag: {pipeline_tag}")
162
163 async with session.post(f"{base_url.rstrip('/')}/models/{model}", json=payload) as response:
164 if response.status == 404:
165 raise ModelNotFoundError(f"Model not found: {model}")
166 await raise_for_status(response)
167 if stream:
168 first = True
169 is_special = False
170 async for line in response.iter_lines():
171 if line.startswith(b"data:"):
172 data = json.loads(line[5:])
173 if "error" in data:
174 raise ResponseError(data["error"])
175 if not data["token"]["special"]:
176 chunk = data["token"]["text"]
177 if first and not do_continue:
178 first = False
179 chunk = chunk.lstrip()
180 if chunk:
181 yield chunk
182 else:
183 is_special = True
184 debug.log(f"Special token: {is_special}")
185 yield FinishReason("stop" if is_special else "length")
186 else:
187 async for chunk in save_response_media(response, inputs, [aspect_ratio, model]):
188 yield chunk
189 return
190 yield (await response.json())[0]["generated_text"].strip()
191
192 def format_prompt_mistral(messages: Messages, do_continue: bool = False) -> str:
193 system_messages = [message["content"] for message in messages if message["role"] == "system"]
194 question = " ".join([messages[-1]["content"], *system_messages])
195 history = "\n".join([
196 f"<s>[INST]{messages[idx-1]['content']} [/INST] {message['content']}</s>"
197 for idx, message in enumerate(messages)
198 if message["role"] == "assistant"
199 ])
200 if do_continue:
201 return history[:-len('</s>')]
202 return f"{history}\n<s>[INST] {question} [/INST]"
203
204 def format_prompt_qwen(messages: Messages, do_continue: bool = False) -> str:
205 prompt = "".join([
206 f"<|im_start|>{message['role']}\n{message['content']}\n<|im_end|>\n" for message in messages
207 ]) + ("" if do_continue else "<|im_start|>assistant\n")
208 if do_continue:
209 return prompt[:-len("\n<|im_end|>\n")]
210 return prompt
211
212 def format_prompt_qwen2(messages: Messages, do_continue: bool = False) -> str:
213 prompt = "".join([
214 f"\u003C|{message['role'].capitalize()}|\u003E{message['content']}\u003C|end▁of▁sentence|\u003E" for message in messages
215 ]) + ("" if do_continue else "\u003C|Assistant|\u003E")
216 if do_continue:
217 return prompt[:-len("\u003C|Assistant|\u003E")]
218 return prompt
219
220 def format_prompt_llama(messages: Messages, do_continue: bool = False) -> str:
221 prompt = "<|begin_of_text|>" + "".join([
222 f"<|start_header_id|>{message['role']}<|end_header_id|>\n\n{message['content']}\n<|eot_id|>\n" for message in messages
223 ]) + ("" if do_continue else "<|start_header_id|>assistant<|end_header_id|>\n\n")
224 if do_continue:
225 return prompt[:-len("\n<|eot_id|>\n")]
226 return prompt
227
228 def format_prompt_custom(messages: Messages, end_token: str = "</s>", do_continue: bool = False) -> str:
229 prompt = "".join([
230 f"<|{message['role']}|>\n{message['content']}{end_token}\n" for message in messages
231 ]) + ("" if do_continue else "<|assistant|>\n")
232 if do_continue:
233 return prompt[:-len(end_token + "\n")]
234 return prompt
235
236 def get_inputs(messages: Messages, model_data: dict, model_type: str, do_continue: bool = False) -> str:
237 if model_type in ("gpt2", "gpt_neo", "gemma", "gemma2"):
238 inputs = format_prompt(messages, do_continue=do_continue)
239 elif model_type == "mistral" and model_data.get("author") == "mistralai":
240 inputs = format_prompt_mistral(messages, do_continue)
241 elif "config" in model_data and "tokenizer_config" in model_data["config"] and "eos_token" in model_data["config"]["tokenizer_config"]:
242 eos_token = model_data["config"]["tokenizer_config"]["eos_token"]
243 if eos_token in ("<|endoftext|>", "<eos>", "</s>"):
244 inputs = format_prompt_custom(messages, eos_token, do_continue)
245 elif eos_token == "<|im_end|>":
246 inputs = format_prompt_qwen(messages, do_continue)
247 elif "content" in eos_token and eos_token["content"] == "\u003C|end▁of▁sentence|\u003E":
248 inputs = format_prompt_qwen2(messages, do_continue)
249 elif eos_token == "<|eot_id|>":
250 inputs = format_prompt_llama(messages, do_continue)
251 else:
252 inputs = format_prompt(messages, do_continue=do_continue)
253 else:
254 inputs = format_prompt(messages, do_continue=do_continue)
255 return inputs
Modified g4f/Provider/needs_auth/hf/HuggingFaceMedia.py +1 -1
@@ -17,7 +17,7 @@ from .... import debug
17 17 from .models import image_model_aliases
18 18
19 19 class HuggingFaceMedia(AsyncGeneratorProvider, ProviderModelMixin):
20 label = "HuggingFace"
20 label = "HuggingFace Media"
21 21 parent = "HuggingFace"
22 22 url = "https://huggingface.co"
23 23 working = True
Modified g4f/Provider/needs_auth/hf/__init__.py +4 -69
@@ -1,78 +1,13 @@
1 1 from __future__ import annotations
2 2
3 import random
4
5 from ....typing import AsyncResult, Messages
6 from ....providers.response import ImageResponse
7 from ....errors import ModelNotFoundError, MissingAuthError
8 from ...base_provider import AsyncGeneratorProvider, ProviderModelMixin
9 from .HuggingChat import HuggingChat
10 from .HuggingFaceAPI import HuggingFaceAPI
11 from .HuggingFaceInference import HuggingFaceInference
3 from ...template.OpenaiTemplate import OpenaiTemplate
12 4 from .HuggingFaceMedia import HuggingFaceMedia
13 from .models import model_aliases, image_model_aliases, vision_models, default_model
14 from .... import debug
5 from .HuggingChat import HuggingChat
15 6
16 class HuggingFace(AsyncGeneratorProvider, ProviderModelMixin):
7 class HuggingFace(OpenaiTemplate):
17 8 url = "https://huggingface.co"
9 base_url = "https://router.huggingface.co/v1"
18 10 login_url = "https://huggingface.co/settings/tokens"
19 11 working = True
20 12 active_by_default = True
21 13 quota_url = "https://huggingface.co/api/whoami-v2"
22
23 @classmethod
24 def get_models(cls, **kwargs) -> list[str]:
25 if not cls.models:
26 cls.models = HuggingFaceInference.get_models()
27 cls.image_models = HuggingFaceInference.image_models
28 return cls.models
29
30 model_aliases = {**model_aliases, **image_model_aliases}
31 vision_models = vision_models
32 default_model = default_model
33
34 @classmethod
35 async def create_async_generator(
36 cls,
37 model: str,
38 messages: Messages,
39 **kwargs
40 ) -> AsyncResult:
41 if model in cls.model_aliases:
42 model = cls.model_aliases[model]
43 # if "tools" not in kwargs and "media" not in kwargs and random.random() >= 0.5:
44 # try:
45 # is_started = False
46 # async for chunk in HuggingFaceInference.create_async_generator(model, messages, **kwargs):
47 # if isinstance(chunk, (str, ImageResponse)):
48 # is_started = True
49 # yield chunk
50 # if is_started:
51 # return
52 # except Exception as e:
53 # if is_started:
54 # raise e
55 # debug.error(f"{cls.__name__} {type(e).__name__}; {e}")
56 if not cls.image_models:
57 cls.get_models()
58 try:
59 async for chunk in HuggingFaceMedia.create_async_generator(model, messages, **kwargs):
60 yield chunk
61 return
62 except ModelNotFoundError:
63 pass
64 # if model in cls.image_models:
65 # if "api_key" not in kwargs:
66 # async for chunk in HuggingChat.create_async_generator(model, messages, **kwargs):
67 # yield chunk
68 # else:
69 # async for chunk in HuggingFaceInference.create_async_generator(model, messages, **kwargs):
70 # yield chunk
71 # return
72 try:
73 async for chunk in HuggingFaceAPI.create_async_generator(model, messages, **kwargs):
74 yield chunk
75 except (ModelNotFoundError, MissingAuthError):
76 raise
77 # async for chunk in HuggingFaceInference.create_async_generator(model, messages, **kwargs):
78 # yield chunk
Modified g4f/Provider/needs_auth/hf/models.py +0 -42
@@ -1,44 +1,10 @@
1 1 from ....config import DEFAULT_MODEL
2 2
3 default_model = DEFAULT_MODEL
4 3 default_image_model = "black-forest-labs/FLUX.1-dev"
5 4 image_models = [
6 5 default_image_model,
7 6 "black-forest-labs/FLUX.1-schnell",
8 7 ]
9 text_models = [
10 default_model,
11 'meta-llama/Llama-3.3-70B-Instruct',
12 'CohereForAI/c4ai-command-r-plus-08-2024',
13 'deepseek-ai/DeepSeek-R1-Distill-Qwen-32B',
14 'Qwen/QwQ-32B',
15 'nvidia/Llama-3.1-Nemotron-70B-Instruct-HF',
16 'Qwen/Qwen2.5-Coder-32B-Instruct',
17 'meta-llama/Llama-3.2-11B-Vision-Instruct',
18 'mistralai/Mistral-Nemo-Instruct-2407',
19 'microsoft/Phi-3.5-mini-instruct',
20 ]
21 fallback_models = text_models + image_models
22 model_aliases = {
23 ### Chat ###
24 "qwen-2.5-72b": "Qwen/Qwen2.5-Coder-32B-Instruct",
25 "llama-3": "meta-llama/Llama-3.3-70B-Instruct",
26 "llama-3.3-70b": "meta-llama/Llama-3.3-70B-Instruct",
27 "command-r-plus": "CohereForAI/c4ai-command-r-plus-08-2024",
28 "deepseek-r1": "deepseek-ai/DeepSeek-R1",
29 "qwq-32b": "Qwen/QwQ-32B",
30 "nemotron-70b": "nvidia/Llama-3.1-Nemotron-70B-Instruct-HF",
31 "qwen-2.5-coder-32b": "Qwen/Qwen2.5-Coder-32B-Instruct",
32 "llama-3.2-11b": "meta-llama/Llama-3.2-11B-Vision-Instruct",
33 "mistral-nemo": "mistralai/Mistral-Nemo-Instruct-2407",
34 "phi-3.5-mini": "microsoft/Phi-3.5-mini-instruct",
35 "moonshotai/Kimi-K2-Instruct": "moonshotai/Kimi-K2-Instruct-0905",
36 ### Used in other providers ###
37 "qwen-2-vl-7b": "Qwen/Qwen2-VL-7B-Instruct",
38 "gemma-2-27b": "google/gemma-2-27b-it",
39 "qwen-2-72b": "Qwen/Qwen2-72B-Instruct",
40 "qvq-72b": "Qwen/QVQ-72B-Preview",
41 }
42 8 image_model_aliases = {
43 9 "flux": "black-forest-labs/FLUX.1-dev",
44 10 "flux-dev": "black-forest-labs/FLUX.1-dev",
@@ -48,11 +14,3 @@ image_model_aliases = {
48 14 "sdxl-turbo": "stabilityai/sdxl-turbo",
49 15 "sd-3.5-large": "stabilityai/stable-diffusion-3.5-large",
50 16 }
51 extra_models = [
52 "meta-llama/Llama-3.2-11B-Vision-Instruct",
53 "nvidia/Llama-3.1-Nemotron-70B-Instruct-HF",
54 "NousResearch/Hermes-3-Llama-3.1-8B",
55 ]
56 default_vision_model = "meta-llama/Llama-3.2-11B-Vision-Instruct"
57 default_llama_model = "meta-llama/Llama-3.3-70B-Instruct"
58 vision_models = [default_vision_model, "Qwen/Qwen2-VL-7B-Instruct"]
Modified g4f/providers/any_provider.py +0 -5
@@ -561,8 +561,3 @@ def clean_name(name: str) -> str:
561 561 name = name.replace("claude-haiku-4.5", "claude-haiku-4-5")
562 562 name = name.replace("claude-sonnet-4.5", "claude-sonnet-4-5")
563 563 return name
564
565
566 setattr(Provider, "AnyProvider", AnyProvider)
567 Provider.__map__["AnyProvider"] = AnyProvider
568 Provider.__providers__.append(AnyProvider)