feat(minimax): dynamic model listing and validation to respect API entitlement
This commit is contained in:
+14
-1
@@ -441,7 +441,11 @@ def set_provider(provider: str, model: str) -> None:
|
||||
else:
|
||||
_model = model
|
||||
elif provider == "minimax":
|
||||
valid_models = _list_minimax_models("")
|
||||
try:
|
||||
creds = _load_credentials()
|
||||
valid_models = _list_minimax_models(creds.get("minimax", {}).get("api_key", ""))
|
||||
except Exception:
|
||||
valid_models = _list_minimax_models("")
|
||||
if model not in valid_models:
|
||||
_model = "MiniMax-M2.5"
|
||||
else:
|
||||
@@ -583,6 +587,15 @@ def _list_deepseek_models(api_key: str) -> list[str]:
|
||||
return ["deepseek-chat", "deepseek-reasoner"]
|
||||
|
||||
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"]
|
||||
|
||||
TOOL_NAME: str = "run_powershell"
|
||||
|
||||
Reference in New Issue
Block a user