Skip to content

Commit 060639a

Browse files
committed
chore: add MiniMax H3 model parameters and credentials for enhanced video processing
1 parent b953bc1 commit 060639a

4 files changed

Lines changed: 117 additions & 7 deletions

File tree

apps/models_provider/impl/minimax_model_provider/credential/itv.py

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414

1515
class MiniMaxModelParams(BaseForm):
1616
"""
17-
Parameters class for the Qwen Text-to-Video model.
18-
Defines fields such as Video size, number of Videos, and style.
17+
Parameters class for the MiniMax V1 (legacy) Video model.
1918
"""
2019

2120
aigc_watermark = SwitchField(
@@ -25,6 +24,40 @@ class MiniMaxModelParams(BaseForm):
2524
)
2625

2726

27+
class MiniMaxH3ModelParams(BaseForm):
28+
"""
29+
Parameters class for the MiniMax V2 (MiniMax-H3) Video model.
30+
"""
31+
32+
resolution = forms.SingleSelect(
33+
TooltipLabel(_("Resolution"), _("Output video resolution.")),
34+
required=True,
35+
default_value="480P",
36+
option_list=[{"value": value, "label": value} for value in ["480P", "768P", "2K"]],
37+
text_field="label",
38+
value_field="value",
39+
)
40+
41+
duration = forms.SliderField(
42+
TooltipLabel(_("Duration"), _("Video duration in seconds (4-15).")),
43+
4,
44+
15,
45+
1,
46+
0,
47+
required=True,
48+
default_value=10,
49+
)
50+
51+
ratio = forms.SingleSelect(
52+
TooltipLabel(_("Aspect ratio"), _("Output video aspect ratio.")),
53+
required=False,
54+
default_value="16:9",
55+
option_list=[{"value": value, "label": value} for value in ["16:9", "9:16", "1:1", "4:3", "3:4"]],
56+
text_field="label",
57+
value_field="value",
58+
)
59+
60+
2861
class ImageToVideoModelCredential(BaseForm, BaseModelCredential):
2962
"""
3063
Credential class for the Qwen Text-to-Video model.
@@ -103,3 +136,17 @@ def get_model_params_setting_form(self, model_name: str):
103136
:return: Parameter setting form.
104137
"""
105138
return MiniMaxModelParams()
139+
140+
141+
class MiniMaxH3ImageToVideoModelCredential(ImageToVideoModelCredential):
142+
"""
143+
Credential for the MiniMax H3 / H3-Max (V2) image-to-video model.
144+
Uses the V2 endpoint and requires resolution / duration / ratio.
145+
"""
146+
147+
# BaseForm 只收集本类的字段(vars(self.__class__) 不走 MRO),继承字段需重新声明
148+
api_base = forms.TextInputField("API URL", required=True, default_value="https://api.minimaxi.com/v2")
149+
api_key = PasswordInputField("API Key", required=True)
150+
151+
def get_model_params_setting_form(self, model_name: str):
152+
return MiniMaxH3ModelParams()

apps/models_provider/impl/minimax_model_provider/credential/ttv.py

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414

1515
class MiniMaxModelParams(BaseForm):
1616
"""
17-
Parameters class for the Qwen Text-to-Video model.
18-
Defines fields such as Video size, number of Videos, and style.
17+
Parameters class for the MiniMax V1 (legacy) Video model.
1918
"""
2019

2120
aigc_watermark = SwitchField(
@@ -25,6 +24,40 @@ class MiniMaxModelParams(BaseForm):
2524
)
2625

2726

27+
class MiniMaxH3ModelParams(BaseForm):
28+
"""
29+
Parameters class for the MiniMax V2 (MiniMax-H3) Video model.
30+
"""
31+
32+
resolution = forms.SingleSelect(
33+
TooltipLabel(_("Resolution"), _("Output video resolution.")),
34+
required=True,
35+
default_value="480P",
36+
option_list=[{"value": value, "label": value} for value in ["480P", "768P", "2K"]],
37+
text_field="label",
38+
value_field="value",
39+
)
40+
41+
duration = forms.SliderField(
42+
TooltipLabel(_("Duration"), _("Video duration in seconds (4-15).")),
43+
4,
44+
15,
45+
1,
46+
0,
47+
required=True,
48+
default_value=10,
49+
)
50+
51+
ratio = forms.SingleSelect(
52+
TooltipLabel(_("Aspect ratio"), _("Output video aspect ratio.")),
53+
required=False,
54+
default_value="16:9",
55+
option_list=[{"value": value, "label": value} for value in ["16:9", "9:16", "1:1", "4:3", "3:4"]],
56+
text_field="label",
57+
value_field="value",
58+
)
59+
60+
2861
class TextToVideoModelCredential(BaseForm, BaseModelCredential):
2962
"""
3063
Credential class for the Qwen Text-to-Video model.
@@ -103,3 +136,17 @@ def get_model_params_setting_form(self, model_name: str):
103136
:return: Parameter setting form.
104137
"""
105138
return MiniMaxModelParams()
139+
140+
141+
class MiniMaxH3TextToVideoModelCredential(TextToVideoModelCredential):
142+
"""
143+
Credential for the MiniMax H3 / H3-Max (V2) text-to-video model.
144+
Uses the V2 endpoint and requires resolution / duration / ratio.
145+
"""
146+
147+
# BaseForm 只收集本类的字段(vars(self.__class__) 不走 MRO),继承字段需重新声明
148+
api_base = forms.TextInputField("API URL", required=True, default_value="https://api.minimaxi.com/v2")
149+
api_key = PasswordInputField("API Key", required=True)
150+
151+
def get_model_params_setting_form(self, model_name: str):
152+
return MiniMaxH3ModelParams()

apps/models_provider/impl/minimax_model_provider/minimax_model_provider.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,17 @@
99
ModelTypeConst,
1010
ModelInfoManage,
1111
)
12-
from models_provider.impl.minimax_model_provider.credential.itv import ImageToVideoModelCredential
12+
from models_provider.impl.minimax_model_provider.credential.itv import (
13+
ImageToVideoModelCredential,
14+
MiniMaxH3ImageToVideoModelCredential,
15+
)
1316
from models_provider.impl.minimax_model_provider.credential.llm import MiniMaxLLMModelCredential
1417
from models_provider.impl.minimax_model_provider.credential.tti import MiniMaxTextToImageModelCredential
1518
from models_provider.impl.minimax_model_provider.credential.tts import MiniMaxTTSModelCredential
16-
from models_provider.impl.minimax_model_provider.credential.ttv import TextToVideoModelCredential
19+
from models_provider.impl.minimax_model_provider.credential.ttv import (
20+
MiniMaxH3TextToVideoModelCredential,
21+
TextToVideoModelCredential,
22+
)
1723
from models_provider.impl.minimax_model_provider.model.llm import MiniMaxChatModel
1824
from models_provider.impl.minimax_model_provider.model.tti import MiniMaxTextToImageModel
1925
from models_provider.impl.minimax_model_provider.model.tts import MiniMaxTextToSpeech
@@ -27,6 +33,8 @@
2733
minimax_tti_model_credential = MiniMaxTextToImageModelCredential()
2834
minimax_ttv_model_credential = TextToVideoModelCredential()
2935
minimax_itv_model_credential = ImageToVideoModelCredential()
36+
minimax_h3_ttv_model_credential = MiniMaxH3TextToVideoModelCredential()
37+
minimax_h3_itv_model_credential = MiniMaxH3ImageToVideoModelCredential()
3038

3139
minimax_m2_7 = ModelInfo(
3240
"MiniMax-M2.7",
@@ -87,10 +95,14 @@
8795
ModelInfo("image-01", _(""), ModelTypeConst.TTI, minimax_tti_model_credential, MiniMaxTextToImageModel),
8896
]
8997
minimax_ttv_list = [
98+
ModelInfo("MiniMax-H3", _(""), ModelTypeConst.TTV, minimax_h3_ttv_model_credential, GenerationVideoModel),
99+
ModelInfo("MiniMax-H3-Max", _(""), ModelTypeConst.TTV, minimax_h3_ttv_model_credential, GenerationVideoModel),
90100
ModelInfo("MiniMax-Hailuo-2.3", _(""), ModelTypeConst.TTV, minimax_ttv_model_credential, GenerationVideoModel),
91101
]
92102

93103
model_info_itv_list = [
104+
ModelInfo("MiniMax-H3", _(""), ModelTypeConst.ITV, minimax_h3_itv_model_credential, GenerationVideoModel),
105+
ModelInfo("MiniMax-H3-Max", _(""), ModelTypeConst.ITV, minimax_h3_itv_model_credential, GenerationVideoModel),
94106
ModelInfo("MiniMax-Hailuo-2.3", _(""), ModelTypeConst.ITV, minimax_itv_model_credential, GenerationVideoModel),
95107
]
96108
model_info_manage = (

apps/models_provider/impl/minimax_model_provider/model/ttv.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ def _build_session(self) -> requests.Session:
7171
# ---------- API 版本探测 / URL 构建 ----------
7272

7373
def _detect_api_version(self) -> str:
74-
"""根据 api_base 路径判断当前使用 V1 还是 V2 (MiniMax-H3)。"""
74+
"""探测当前使用 V1 还是 V2 (MiniMax-H3)。"""
75+
# 模型名包含 H3 -> V2
76+
if self.model_name and "H3" in self.model_name.upper():
77+
return "v2"
78+
# api_base 路径包含 /v2 -> V2
7579
base_path = self.api_base.split("://", 1)[-1] if "://" in self.api_base else self.api_base
7680
if "/v2" in base_path:
7781
return "v2"

0 commit comments

Comments
 (0)