返回提交历史
Modified
docs/providers-and-models.md
+5
-6
Modified
g4f/Provider/GizAI.py
+20
-100
Modified
g4f/models.py
+11
-19
XFEstudio/gpt4free
Update (docs/providers-and-models.md g4f/models.py g4f/Provider/GizAI.py)
8c7791aa
代码差异
3 个文件
+36
-125
@@ -30,7 +30,7 @@ This document provides an overview of various AI providers and models, including
30
30
|[openchat.team](https://openchat.team/)|`g4f.Provider.Aura`|✔|❌|❌|?||❌|
31
31
|[bing.com](https://bing.com/chat)|`g4f.Provider.Bing`|`gpt-4`|✔|`gpt-4-vision`|✔||❌+✔|
32
32
|[bing.com/images](https://www.bing.com/images/create)|`g4f.Provider.BingCreateImages`|`❌|✔|❌|❌||✔|
33
|[blackbox.ai](https://www.blackbox.ai)|`g4f.Provider.Blackbox`|`blackboxai, blackboxai-pro, gemini-flash, llama-3.1-8b, llama-3.1-70b, gpt-4o, gemini-pro, claude-3.5-sonnet`|`flux`|✔|✔||❌|
33
|[blackbox.ai](https://www.blackbox.ai)|`g4f.Provider.Blackbox`|`blackboxai, blackboxai-pro, gemini-flash, llama-3.1-8b, llama-3.1-70b, llama-3.1-405b, gpt-4o, gemini-pro, claude-3.5-sonnet`|`flux`|`blackboxai, gemini-flash, llama-3.1-8b, llama-3.1-70b, llama-3.1-405b, gpt-4o, gemini-pro`|✔||❌|
34
34
|[chatgot.one](https://www.chatgot.one/)|`g4f.Provider.ChatGot`|`gemini-pro`|❌|❌|✔||❌|
35
35
|[chatgpt.com](https://chatgpt.com)|`g4f.Provider.ChatGpt`|`?`|`?`|`?`|?| |❌|
36
36
|[chatgpt.es](https://chatgpt.es)|`g4f.Provider.ChatGptEs`|`gpt-4o, gpt-4o-mini`|❌|❌|✔||❌|
@@ -53,7 +53,7 @@ This document provides an overview of various AI providers and models, including
53
53
|[free.netfly.top](https://free.netfly.top)|`g4f.Provider.FreeNetfly`|✔|❌|❌|?||❌|
54
54
|[gemini.google.com](https://gemini.google.com)|`g4f.Provider.Gemini`|✔|❌|❌|✔||✔|
55
55
|[ai.google.dev](https://ai.google.dev)|`g4f.Provider.GeminiPro`|✔|❌|✔|?||✔|
56
|[app.giz.ai](https://app.giz.ai/assistant/)|`g4f.Provider.GizAI`|`gemini-flash, gemini-pro, gpt-4o-mini, gpt-4o, claude-3.5-sonnet, claude-3-haiku, llama-3.1-70b, llama-3.1-8b, mistral-large`|`sdxl, sd-1.5, sd-3.5, dalle-3, flux-schnell, flux1-pro`|❌|✔||❌|
56
|[app.giz.ai](https://app.giz.ai/assistant/)|`g4f.Provider.GizAI`|`gemini-flash`|❌|❌|✔||❌|
57
57
|[developers.sber.ru](https://developers.sber.ru/gigachat)|`g4f.Provider.GigaChat`|✔|❌|❌|✔||✔|
58
58
|[gprochat.com](https://gprochat.com)|`g4f.Provider.GPROChat`|`gemini-pro`|❌|❌|✔||❌|
59
59
|[console.groq.com/playground](https://console.groq.com/playground)|`g4f.Provider.Groq`|✔|❌|❌|?||✔|
@@ -112,8 +112,8 @@ This document provides an overview of various AI providers and models, including
112
112
|gpt-4-turbo|OpenAI|3+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4)|
113
113
|gpt-4o|OpenAI|10+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4o)|
114
114
|gpt-4o-mini|OpenAI|14+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4o-mini)|
115
|o1|OpenAI|1+ Providers|[platform.openai.com](https://openai.com/index/introducing-openai-o1-preview/)|
116
|o1-mini|OpenAI|2+ Providers|[platform.openai.com](https://openai.com/index/openai-o1-mini-advancing-cost-efficient-reasoning/)|
115
|o1|OpenAI|0+ Providers|[platform.openai.com](https://openai.com/index/introducing-openai-o1-preview/)|
116
|o1-mini|OpenAI|0+ Providers|[platform.openai.com](https://openai.com/index/openai-o1-mini-advancing-cost-efficient-reasoning/)|
117
117
|llama-2-7b|Meta Llama|1+ Providers|[huggingface.co](https://huggingface.co/meta-llama/Llama-2-7b)|
118
118
|llama-2-13b|Meta Llama|1+ Providers|[llama.com](https://www.llama.com/llama2/)|
119
119
|llama-3-8b|Meta Llama|4+ Providers|[ai.meta.com](https://ai.meta.com/blog/meta-llama-3/)|
@@ -207,7 +207,6 @@ This document provides an overview of various AI providers and models, including
207
207
|sdxl-turbo|Stability AI|1+ Providers|[huggingface.co](https://huggingface.co/stabilityai/sdxl-turbo)|
208
208
|sd-1.5|Stability AI|1+ Providers|[huggingface.co](https://huggingface.co/runwayml/stable-diffusion-v1-5)|
209
209
|sd-3|Stability AI|1+ Providers|[huggingface.co](https://huggingface.co/docs/diffusers/main/en/api/pipelines/stable_diffusion/stable_diffusion_3)|
210
|sd-3.5|Stability AI|1+ Providers|[stability.ai](https://stability.ai/news/introducing-stable-diffusion-3-5)|
211
210
|playground-v2.5|Playground AI|1+ Providers|[huggingface.co](https://huggingface.co/playgroundai/playground-v2.5-1024px-aesthetic)|
212
211
|flux|Black Forest Labs|2+ Providers|[github.com/black-forest-labs/flux](https://github.com/black-forest-labs/flux)|
213
212
|flux-pro|Black Forest Labs|2+ Providers|[github.com/black-forest-labs/flux](https://github.com/black-forest-labs/flux)|
@@ -235,7 +234,7 @@ This document provides an overview of various AI providers and models, including
235
234
### Providers and vision models
236
235
| Provider | Base Provider | | Vision Models | Status | Auth |
237
236
|-------|---------------|-----------|---------|---------|---------|
238
| `g4f.Provider.Blackbox` | Blackbox AI | | `blackboxai, blackboxai-pro, gemini-flash, llama-3.1-8b, llama-3.1-70b, gpt-4o, gemini-pro, claude-3.5-sonnet` |  | ❌ |
237
| `g4f.Provider.Blackbox` | Blackbox AI | | `blackboxai, gemini-flash, llama-3.1-8b, llama-3.1-70b, llama-3.1-405b, gpt-4o, gemini-pro` |  | ❌ |
239
238
240
239
## Conclusion and Usage Tips
241
240
This document provides a comprehensive overview of various AI providers and models available for text generation, image generation, and vision tasks. **When choosing a provider or model, consider the following factors:**
@@ -1,62 +1,24 @@
1
1
from __future__ import annotations
2
2
3
import json
4
3
from aiohttp import ClientSession
5
4
6
5
from ..typing import AsyncResult, Messages
7
from ..image import ImageResponse
8
6
from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
9
7
from .helper import format_prompt
10
8
9
11
10
class GizAI(AsyncGeneratorProvider, ProviderModelMixin):
12
url = "https://app.giz.ai/assistant/"
11
url = "https://app.giz.ai"
13
12
api_endpoint = "https://app.giz.ai/api/data/users/inferenceServer.infer"
14
13
working = True
15
14
supports_stream = False
16
15
supports_system_message = True
17
16
supports_message_history = True
18
17
19
# Chat models
20
18
default_model = 'chat-gemini-flash'
21
chat_models = [
22
default_model,
23
'chat-gemini-pro',
24
'chat-gpt4m',
25
'chat-gpt4',
26
'claude-sonnet',
27
'claude-haiku',
28
'llama-3-70b',
29
'llama-3-8b',
30
'mistral-large',
31
'chat-o1-mini'
32
]
33
34
# Image models
35
image_models = [
36
'flux1',
37
'sdxl',
38
'sd',
39
'sd35',
40
]
41
42
models = [*chat_models, *image_models]
19
models = [default_model]
43
20
44
model_aliases = {
45
# Chat model aliases
46
"gemini-flash": "chat-gemini-flash",
47
"gemini-pro": "chat-gemini-pro",
48
"gpt-4o-mini": "chat-gpt4m",
49
"gpt-4o": "chat-gpt4",
50
"claude-3.5-sonnet": "claude-sonnet",
51
"claude-3-haiku": "claude-haiku",
52
"llama-3.1-70b": "llama-3-70b",
53
"llama-3.1-8b": "llama-3-8b",
54
"o1-mini": "chat-o1-mini",
55
# Image model aliases
56
"sd-1.5": "sd",
57
"sd-3.5": "sd35",
58
"flux-schnell": "flux1",
59
}
21
model_aliases = {"gemini-flash": "chat-gemini-flash",}
60
22
61
23
@classmethod
62
24
def get_model(cls, model: str) -> str:
@@ -67,10 +29,6 @@ class GizAI(AsyncGeneratorProvider, ProviderModelMixin):
67
29
else:
68
30
return cls.default_model
69
31
70
@classmethod
71
def is_image_model(cls, model: str) -> bool:
72
return model in cls.image_models
73
74
32
@classmethod
75
33
async def create_async_generator(
76
34
cls,
@@ -87,7 +45,8 @@ class GizAI(AsyncGeneratorProvider, ProviderModelMixin):
87
45
'Cache-Control': 'no-cache',
88
46
'Connection': 'keep-alive',
89
47
'Content-Type': 'application/json',
90
'Origin': 'https://app.giz.ai',
48
'DNT': '1',
49
'Origin': cls.url,
91
50
'Pragma': 'no-cache',
92
51
'Sec-Fetch-Dest': 'empty',
93
52
'Sec-Fetch-Mode': 'cors',
@@ -97,55 +56,16 @@ class GizAI(AsyncGeneratorProvider, ProviderModelMixin):
97
56
'sec-ch-ua-mobile': '?0',
98
57
'sec-ch-ua-platform': '"Linux"'
99
58
}
100
101
async with ClientSession() as session:
102
if cls.is_image_model(model):
103
# Image generation
104
prompt = messages[-1]["content"]
105
data = {
106
"model": model,
107
"input": {
108
"width": "1024",
109
"height": "1024",
110
"steps": 4,
111
"output_format": "webp",
112
"batch_size": 1,
113
"mode": "plan",
114
"prompt": prompt
115
}
116
}
117
async with session.post(
118
cls.api_endpoint,
119
headers=headers,
120
data=json.dumps(data),
121
proxy=proxy
122
) as response:
123
response.raise_for_status()
124
response_data = await response.json()
125
if response_data.get('status') == 'completed' and response_data.get('output'):
126
for url in response_data['output']:
127
yield ImageResponse(images=url, alt="Generated Image")
128
else:
129
# Chat completion
130
data = {
131
"model": model,
132
"input": {
133
"messages": [
134
{
135
"type": "human",
136
"content": format_prompt(messages)
137
}
138
],
139
"mode": "plan"
140
},
141
"noStream": True
142
}
143
async with session.post(
144
cls.api_endpoint,
145
headers=headers,
146
data=json.dumps(data),
147
proxy=proxy
148
) as response:
149
response.raise_for_status()
150
result = await response.json()
151
yield result.get('output', '')
59
async with ClientSession(headers=headers) as session:
60
data = {
61
"model": model,
62
"input": {
63
"messages": messages,
64
"mode": "plan"
65
},
66
"noStream": True
67
}
68
async with session.post(cls.api_endpoint, json=data, proxy=proxy) as response:
69
response.raise_for_status()
70
result = await response.json()
71
yield result['output'].strip()
@@ -137,13 +137,13 @@ gpt_35_turbo = Model(
137
137
gpt_4o = Model(
138
138
name = 'gpt-4o',
139
139
base_provider = 'OpenAI',
140
best_provider = IterListProvider([NexraChatGPT, Blackbox, ChatGptEs, DarkAI, Editee, GizAI, Airforce, Liaobots, OpenaiChat])
140
best_provider = IterListProvider([Blackbox, ChatGptEs, DarkAI, Editee, NexraChatGPT, Airforce, Liaobots, OpenaiChat])
141
141
)
142
142
143
143
gpt_4o_mini = Model(
144
144
name = 'gpt-4o-mini',
145
145
base_provider = 'OpenAI',
146
best_provider = IterListProvider([DDG, ChatGptEs, FreeNetfly, Pizzagpt, MagickPen, RubiksAI, Liaobots, Airforce, GizAI, ChatgptFree, Koala, OpenaiChat, ChatGpt])
146
best_provider = IterListProvider([DDG, ChatGptEs, FreeNetfly, Pizzagpt, MagickPen, RubiksAI, Liaobots, Airforce, ChatgptFree, Koala, OpenaiChat, ChatGpt])
147
147
)
148
148
149
149
gpt_4_turbo = Model(
@@ -168,7 +168,7 @@ o1 = Model(
168
168
o1_mini = Model(
169
169
name = 'o1-mini',
170
170
base_provider = 'OpenAI',
171
best_provider = IterListProvider([GizAI])
171
best_provider = None
172
172
)
173
173
174
174
@@ -217,13 +217,13 @@ llama_3_70b = Model(
217
217
llama_3_1_8b = Model(
218
218
name = "llama-3.1-8b",
219
219
base_provider = "Meta Llama",
220
best_provider = IterListProvider([Blackbox, DeepInfraChat, ChatHub, Cloudflare, GizAI, Airforce, PerplexityLabs])
220
best_provider = IterListProvider([Blackbox, DeepInfraChat, ChatHub, Cloudflare, Airforce, PerplexityLabs])
221
221
)
222
222
223
223
llama_3_1_70b = Model(
224
224
name = "llama-3.1-70b",
225
225
base_provider = "Meta Llama",
226
best_provider = IterListProvider([DDG, HuggingChat, Blackbox, FreeGpt, TeachAnything, Free2GPT, DeepInfraChat, DarkAI, AiMathGPT, RubiksAI, GizAI, Airforce, HuggingFace, PerplexityLabs])
226
best_provider = IterListProvider([DDG, HuggingChat, Blackbox, FreeGpt, TeachAnything, Free2GPT, DeepInfraChat, DarkAI, AiMathGPT, RubiksAI, Airforce, HuggingFace, PerplexityLabs])
227
227
)
228
228
229
229
llama_3_1_405b = Model(
@@ -312,7 +312,7 @@ mistral_nemo = Model(
312
312
mistral_large = Model(
313
313
name = "mistral-large",
314
314
base_provider = "Mistral",
315
best_provider = IterListProvider([Editee, GizAI])
315
best_provider = IterListProvider([Editee])
316
316
)
317
317
318
318
@@ -360,7 +360,7 @@ phi_3_5_mini = Model(
360
360
gemini_pro = Model(
361
361
name = 'gemini-pro',
362
362
base_provider = 'Google DeepMind',
363
best_provider = IterListProvider([GeminiPro, Blackbox, AIChatFree, GPROChat, NexraGeminiPro, Editee, GizAI, Airforce, Liaobots])
363
best_provider = IterListProvider([GeminiPro, Blackbox, AIChatFree, GPROChat, NexraGeminiPro, Editee, Airforce, Liaobots])
364
364
)
365
365
366
366
gemini_flash = Model(
@@ -431,14 +431,14 @@ claude_3_sonnet = Model(
431
431
claude_3_haiku = Model(
432
432
name = 'claude-3-haiku',
433
433
base_provider = 'Anthropic',
434
best_provider = IterListProvider([DDG, GizAI, Liaobots])
434
best_provider = IterListProvider([DDG, Liaobots])
435
435
)
436
436
437
437
# claude 3.5
438
438
claude_3_5_sonnet = Model(
439
439
name = 'claude-3.5-sonnet',
440
440
base_provider = 'Anthropic',
441
best_provider = IterListProvider([Blackbox, Editee, GizAI, Liaobots])
441
best_provider = IterListProvider([Blackbox, Editee, Liaobots])
442
442
)
443
443
444
444
@@ -777,7 +777,7 @@ sdxl = Model(
777
777
sd_1_5 = Model(
778
778
name = 'sd-1.5',
779
779
base_provider = 'Stability AI',
780
best_provider = IterListProvider([NexraSD15, GizAI])
780
best_provider = IterListProvider([NexraSD15])
781
781
782
782
)
783
783
@@ -788,13 +788,6 @@ sd_3 = Model(
788
788
789
789
)
790
790
791
sd_3_5 = Model(
792
name = 'sd-3.5',
793
base_provider = 'Stability AI',
794
best_provider = GizAI
795
796
)
797
798
791
### Playground ###
799
792
playground_v2_5 = Model(
800
793
name = 'playground-v2.5',
@@ -864,7 +857,7 @@ flux_4o = Model(
864
857
flux_schnell = Model(
865
858
name = 'flux-schnell',
866
859
base_provider = 'Flux AI',
867
best_provider = IterListProvider([ReplicateHome, GizAI])
860
best_provider = IterListProvider([ReplicateHome])
868
861
869
862
)
870
863
@@ -1156,7 +1149,6 @@ class ModelUtils:
1156
1149
'sdxl-turbo': sdxl_turbo,
1157
1150
'sd-1.5': sd_1_5,
1158
1151
'sd-3': sd_3,
1159
'sd-3.5': sd_3_5,
1160
1152
1161
1153
1162
1154
### Playground ###