feat(minimax): dynamic model listing and validation to respect API entitlement
This commit is contained in:
@@ -441,6 +441,10 @@ def set_provider(provider: str, model: str) -> None:
|
|||||||
else:
|
else:
|
||||||
_model = model
|
_model = model
|
||||||
elif provider == "minimax":
|
elif provider == "minimax":
|
||||||
|
try:
|
||||||
|
creds = _load_credentials()
|
||||||
|
valid_models = _list_minimax_models(creds.get("minimax", {}).get("api_key", ""))
|
||||||
|
except Exception:
|
||||||
valid_models = _list_minimax_models("")
|
valid_models = _list_minimax_models("")
|
||||||
if model not in valid_models:
|
if model not in valid_models:
|
||||||
_model = "MiniMax-M2.5"
|
_model = "MiniMax-M2.5"
|
||||||
@@ -583,6 +587,15 @@ def _list_deepseek_models(api_key: str) -> list[str]:
|
|||||||
return ["deepseek-chat", "deepseek-reasoner"]
|
return ["deepseek-chat", "deepseek-reasoner"]
|
||||||
|
|
||||||
def _list_minimax_models(api_key: str) -> list[str]:
|
def _list_minimax_models(api_key: str) -> list[str]:
|
||||||
|
try:
|
||||||
|
from openai import OpenAI
|
||||||
|
client = OpenAI(api_key=api_key, base_url="https://api.minimax.io/v1")
|
||||||
|
models_list = client.models.list()
|
||||||
|
found = [m.id for m in models_list]
|
||||||
|
if found:
|
||||||
|
return sorted(found)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
return ["MiniMax-M2.7", "MiniMax-M2.5", "MiniMax-M2.5-highspeed", "MiniMax-M2.1", "MiniMax-M2.1-highspeed", "MiniMax-M2"]
|
return ["MiniMax-M2.7", "MiniMax-M2.5", "MiniMax-M2.5-highspeed", "MiniMax-M2.1", "MiniMax-M2.1-highspeed", "MiniMax-M2"]
|
||||||
|
|
||||||
TOOL_NAME: str = "run_powershell"
|
TOOL_NAME: str = "run_powershell"
|
||||||
|
|||||||
Reference in New Issue
Block a user