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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,14 @@ This example demonstrates how to:

CrewAI supports using various LLMs through a variety of connection options. By default your agents will use the OpenAI API when querying the model. However, there are several other ways to allow your agents to connect to models. For example, you can configure your agents to use a local model via the Ollama tool.

CrewAI includes native support for [MiniMax](https://www.minimax.io) models. Set the `MINIMAX_API_KEY` environment variable and use `MiniMax-M2.7` (latest flagship) or any other available model as the model name:

```python
from crewai import LLM

llm = LLM(model="MiniMax-M2.7")
```

Please refer to the [Connect CrewAI to LLMs](https://docs.crewai.com/how-to/LLM-Connections/) page for details on configuring your agents' connections to models.

## How CrewAI Compares
Expand Down
13 changes: 13 additions & 0 deletions lib/crewai/src/crewai/cli/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@
"key_name": "SAMBANOVA_API_KEY",
}
],
"minimax": [
{
"prompt": "Enter your MiniMax API key (press Enter to skip)",
"key_name": "MINIMAX_API_KEY",
}
],
}


Expand All @@ -128,6 +134,7 @@
"azure",
"cerebras",
"sambanova",
"minimax",
]

MODELS: dict[str, list[str]] = {
Expand Down Expand Up @@ -324,6 +331,12 @@
"sambanova/Meta-Llama-3.2-3B-Instruct",
"sambanova/Meta-Llama-3.2-1B-Instruct",
],
"minimax": [
"minimax/MiniMax-M2.7",
"minimax/MiniMax-M2.7-highspeed",
"minimax/MiniMax-M2.5",
"minimax/MiniMax-M2.5-highspeed",
],
}

DEFAULT_LLM_MODEL = "gpt-4.1-mini"
Expand Down
22 changes: 22 additions & 0 deletions lib/crewai/src/crewai/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
AZURE_MODELS,
BEDROCK_MODELS,
GEMINI_MODELS,
MINIMAX_MODELS,
OPENAI_MODELS,
)
from crewai.utilities import InternalInstructor
Expand Down Expand Up @@ -297,6 +298,11 @@ def writable(self) -> bool:
"ai21.j2-ultra-v1": 8191,
"ai21.jamba-instruct-v1:0": 256000,
"mistral.mistral-7b-instruct-v0:2": 32000,
# minimax
"MiniMax-M2.7": 204800,
"MiniMax-M2.7-highspeed": 204800,
"MiniMax-M2.5": 204800,
"MiniMax-M2.5-highspeed": 204800,
"mistral.mixtral-8x7b-instruct-v0:1": 32000,
# mistral
"mistral-tiny": 32768,
Expand Down Expand Up @@ -325,6 +331,7 @@ def writable(self) -> bool:
"gemini",
"bedrock",
"aws",
"minimax",
]


Expand Down Expand Up @@ -384,6 +391,7 @@ def __new__(cls, model: str, is_litellm: bool = False, **kwargs: Any) -> LLM:
"gemini": "gemini",
"bedrock": "bedrock",
"aws": "bedrock",
"minimax": "minimax",
}

canonical_provider = provider_mapping.get(prefix.lower())
Expand Down Expand Up @@ -483,6 +491,9 @@ def _matches_provider_pattern(cls, model: str, provider: str) -> bool:
for prefix in ["gpt-", "gpt-35-", "o1", "o3", "o4", "azure-"]
)

if provider == "minimax":
return model_lower.startswith("minimax-")

return False

@classmethod
Expand Down Expand Up @@ -518,6 +529,9 @@ def _validate_model_in_constants(cls, model: str, provider: str) -> bool:
# azure does not provide a list of available models, determine a better way to handle this
return True

if provider == "minimax" and model in MINIMAX_MODELS:
return True

# Fallback to pattern matching for models not in constants
return cls._matches_provider_pattern(model, provider)

Expand Down Expand Up @@ -550,6 +564,9 @@ def _infer_provider_from_model(cls, model: str) -> str:
if model in AZURE_MODELS:
return "azure"

if model in MINIMAX_MODELS:
return "minimax"

return "openai"

@classmethod
Expand Down Expand Up @@ -582,6 +599,11 @@ def _get_native_provider(cls, provider: str) -> type | None:

return BedrockCompletion

if provider == "minimax":
from crewai.llms.providers.minimax.completion import MiniMaxCompletion

return MiniMaxCompletion

return None

def __init__(
Expand Down
14 changes: 14 additions & 0 deletions lib/crewai/src/crewai/llms/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,20 @@
"claude-3-haiku-20240307",
]

MiniMaxModels: TypeAlias = Literal[
"MiniMax-M2.7",
"MiniMax-M2.7-highspeed",
"MiniMax-M2.5",
"MiniMax-M2.5-highspeed",
]
MINIMAX_MODELS: list[MiniMaxModels] = [
"MiniMax-M2.7",
"MiniMax-M2.7-highspeed",
"MiniMax-M2.5",
"MiniMax-M2.5-highspeed",
]


GeminiModels: TypeAlias = Literal[
"gemini-3-pro-preview",
"gemini-2.5-pro",
Expand Down
Empty file.
Loading