Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,18 @@
"await model_client.close()"
]
},
{
"cell_type": "markdown",
"source": "## MiniMax (experimental)\n\n[MiniMax](https://www.minimax.io/) offers an [OpenAI-compatible API](https://platform.minimaxi.com/document/Fast%20access?key=66701332a427f0c8a5701643).\nSo you can use the {py:class}`~autogen_ext.models.openai.OpenAIChatCompletionClient` with the MiniMax API.\n\nAvailable models:\n* `MiniMax-M2.7` — Latest flagship model, 204K context window, supports vision, function calling, and structured output.\n* `MiniMax-M2.7-highspeed` — Same capabilities as M2.7 with optimized inference speed.\n* `MiniMax-M2.5` — Previous generation, 204K context window.\n* `MiniMax-M2.5-highspeed` — Same capabilities as M2.5 with optimized inference speed.\n\n```{note}\nMiniMax requires `temperature` to be in (0.0, 1.0] — a value of 0 is not accepted.\n```",
"metadata": {}
},
{
"cell_type": "code",
"source": "from autogen_core.models import UserMessage\nfrom autogen_ext.models.openai import OpenAIChatCompletionClient\n\nmodel_client = OpenAIChatCompletionClient(\n model=\"MiniMax-M2.7\",\n # api_key=\"MINIMAX_API_KEY\",\n)\n\nresponse = await model_client.create([UserMessage(content=\"What is the capital of France?\", source=\"user\")])\nprint(response)\nawait model_client.close()",
"metadata": {},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -599,4 +611,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class ModelFamily:
LLAMA_3_3_70B = "llama-3.3-70b"
LLAMA_4_SCOUT = "llama-4-scout"
LLAMA_4_MAVERICK = "llama-4-maverick"
MINIMAX_M2_5 = "minimax-m2.5"
MINIMAX_M2_7 = "minimax-m2.7"
CODESRAL = "codestral"
OPEN_CODESRAL_MAMBA = "open-codestral-mamba"
MISTRAL = "mistral"
Expand Down Expand Up @@ -84,6 +86,9 @@ class ModelFamily:
"llama-3.3-70b",
"llama-4-scout",
"llama-4-maverick",
# minimax_models
"minimax-m2.5",
"minimax-m2.7",
# mistral_models
"codestral",
"open-codestral-mamba",
Expand Down Expand Up @@ -143,6 +148,10 @@ def is_llama(family: str) -> bool:
ModelFamily.LLAMA_4_MAVERICK,
)

@staticmethod
def is_minimax(family: str) -> bool:
return family in (ModelFamily.MINIMAX_M2_5, ModelFamily.MINIMAX_M2_7)

@staticmethod
def is_mistral(family: str) -> bool:
return family in (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
"claude-3-7-sonnet": "claude-3-7-sonnet-20250219",
"claude-4-sonnet": "claude-sonnet-4-20250514",
"claude-4-opus": "claude-opus-4-20250514",
# MiniMax models
"minimax-m2.5": "MiniMax-M2.5",
"minimax-m2.5-highspeed": "MiniMax-M2.5-highspeed",
"minimax-m2.7": "MiniMax-M2.7",
"minimax-m2.7-highspeed": "MiniMax-M2.7-highspeed",
# Llama models
"llama-3.3-8b": "Llama-3.3-8B-Instruct",
"llama-3.3-70b": "Llama-3.3-70B-Instruct",
Expand Down Expand Up @@ -409,6 +414,38 @@
"structured_output": False,
"multiple_system_messages": True,
},
"MiniMax-M2.5": {
"vision": True,
"function_calling": True,
"json_output": True,
"family": ModelFamily.MINIMAX_M2_5,
"structured_output": True,
"multiple_system_messages": True,
},
"MiniMax-M2.5-highspeed": {
"vision": True,
"function_calling": True,
"json_output": True,
"family": ModelFamily.MINIMAX_M2_5,
"structured_output": True,
"multiple_system_messages": True,
},
"MiniMax-M2.7": {
"vision": True,
"function_calling": True,
"json_output": True,
"family": ModelFamily.MINIMAX_M2_7,
"structured_output": True,
"multiple_system_messages": True,
},
"MiniMax-M2.7-highspeed": {
"vision": True,
"function_calling": True,
"json_output": True,
"family": ModelFamily.MINIMAX_M2_7,
"structured_output": True,
"multiple_system_messages": True,
},
"Llama-3.3-8B-Instruct": {
"vision": False,
"function_calling": True,
Expand Down Expand Up @@ -487,6 +524,10 @@
"claude-3-7-sonnet-20250219": 200000,
"claude-sonnet-4-20250514": 200000,
"claude-opus-4-20250514": 200000,
"MiniMax-M2.5": 204800,
"MiniMax-M2.5-highspeed": 204800,
"MiniMax-M2.7": 204800,
"MiniMax-M2.7-highspeed": 204800,
"Llama-3.3-8B-Instruct": 128000,
"Llama-3.3-70B-Instruct": 128000,
"Llama-4-Scout-17B-16E-Instruct-FP8": 128000,
Expand All @@ -496,6 +537,7 @@
GEMINI_OPENAI_BASE_URL = "https://generativelanguage.googleapis.com/v1beta/openai/"
ANTHROPIC_OPENAI_BASE_URL = "https://api.anthropic.com/v1/"
LLAMA_API_BASE_URL = "https://api.llama.com/compat/v1/"
MINIMAX_API_BASE_URL = "https://api.minimax.io/v1"


def resolve_model(model: str) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,11 @@ def __init__(self, **kwargs: Unpack[OpenAIClientConfiguration]):
copied_args["base_url"] = _model_info.LLAMA_API_BASE_URL
if "api_key" not in copied_args and "LLAMA_API_KEY" in os.environ:
copied_args["api_key"] = os.environ["LLAMA_API_KEY"]
if copied_args["model"].startswith("MiniMax-"):
if "base_url" not in copied_args:
copied_args["base_url"] = _model_info.MINIMAX_API_BASE_URL
if "api_key" not in copied_args and "MINIMAX_API_KEY" in os.environ:
copied_args["api_key"] = os.environ["MINIMAX_API_KEY"]

client = _openai_client_from_config(copied_args)
create_args = _create_args_from_config(copied_args)
Expand Down