Skip to content

Commit bb02eeb

Browse files
committed
Add model alias for Kimi-K2-Instruct and update best_provider references
1 parent 4e5c26f commit bb02eeb

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

g4f/Provider/DeepInfra.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ class DeepInfra(OpenaiTemplate):
7777
"qwen-3-32b": "Qwen/Qwen3-32B",
7878
"qwen-3-235b": "Qwen/Qwen3-235B-A22B",
7979
"qwq-32b": "Qwen/QwQ-32B",
80+
81+
"moonshotai/Kimi-K2-Instruct": "moonshotai/Kimi-K2-Instruct-0905",
8082
}
8183

8284
@classmethod

g4f/Provider/PollinationsAI.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
8888
vision_models = [default_vision_model]
8989
_models_loaded = False
9090
model_aliases = {
91+
"openai-fast": "gpt-4.1-nano",
9192
"llama-4-scout": "llamascout",
9293
"deepseek-r1": "deepseek-reasoning",
9394
"sdxl-turbo": "turbo",
@@ -105,6 +106,8 @@ def get_alias(model: dict) -> str:
105106
alias = model.get("name")
106107
if (model.get("aliases")):
107108
alias = model.get("aliases")[0]
109+
elif alias in cls.model_aliases:
110+
alias = cls.model_aliases[alias]
108111
return alias.replace("-instruct", "").replace("qwen-", "qwen").replace("qwen", "qwen-")
109112
if not cls._models_loaded:
110113
try:

g4f/Provider/needs_auth/hf/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"llama-3.2-11b": "meta-llama/Llama-3.2-11B-Vision-Instruct",
3333
"mistral-nemo": "mistralai/Mistral-Nemo-Instruct-2407",
3434
"phi-3.5-mini": "microsoft/Phi-3.5-mini-instruct",
35+
"moonshotai/Kimi-K2-Instruct": "moonshotai/Kimi-K2-Instruct-0905",
3536
### Used in other providers ###
3637
"qwen-2-vl-7b": "Qwen/Qwen2-VL-7B-Instruct",
3738
"gemma-2-27b": "google/gemma-2-27b-it",

g4f/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ class VisionModel(Model):
271271
gpt_4_1 = Model(
272272
name = 'gpt-4.1',
273273
base_provider = 'OpenAI',
274-
best_provider = IterListProvider([PollinationsAI, OpenaiChat])
274+
best_provider = IterListProvider([OpenaiChat])
275275
)
276276

277277
gpt_4_1_mini = Model(
@@ -283,7 +283,7 @@ class VisionModel(Model):
283283
gpt_4_1_nano = Model(
284284
name = 'gpt-4.1-nano',
285285
base_provider = 'OpenAI',
286-
best_provider = IterListProvider([Blackbox])
286+
best_provider = IterListProvider([Blackbox, PollinationsAI])
287287
)
288288

289289
gpt_4_5 = Model(

0 commit comments

Comments
 (0)