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
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,25 @@ You can configure `~/.metagpt/config2.yaml` according to the [example](https://g

```yaml
llm:
api_type: "openai" # or azure / ollama / groq etc. Check LLMType for more options
api_type: "openai" # or azure / ollama / minimax / groq etc. Check LLMType for more options
model: "gpt-4-turbo" # or gpt-3.5-turbo
base_url: "https://api.openai.com/v1" # or forward url / other llm url
api_key: "YOUR_API_KEY"
```

<details>
<summary>Example: Using MiniMax</summary>

```yaml
llm:
api_type: "minimax"
model: "MiniMax-M3" # or MiniMax-M2.7 / MiniMax-M2.7-highspeed
base_url: "https://api.minimax.io/v1"
api_key: "YOUR_MINIMAX_API_KEY"
temperature: 0.5 # MiniMax requires temperature in (0.0, 1.0]
```
</details>

### Usage

After installation, you can use MetaGPT at CLI
Expand Down
5 changes: 5 additions & 0 deletions config/config2.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,8 @@ models:
# # timeout: 600 # Optional. If set to 0, default value is 300.
# # Details: https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service/
# pricing_plan: "" # Optional. Use for Azure LLM when its model name is not the same as OpenAI's
# "MiniMax-M3": # MiniMax (OpenAI-compatible) — default recommended model
# api_type: "minimax"
# base_url: "https://api.minimax.io/v1"
# api_key: "YOUR_MINIMAX_API_KEY"
# temperature: 0.5 # MiniMax requires temperature in (0.0, 1.0]
1 change: 1 addition & 0 deletions metagpt/configs/llm_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class LLMType(Enum):
BEDROCK = "bedrock"
ARK = "ark" # https://www.volcengine.com/docs/82379/1263482#python-sdk
LLAMA_API = "llama_api"
MINIMAX = "minimax"

def __missing__(self, key):
return self.OPENAI
Expand Down
4 changes: 4 additions & 0 deletions metagpt/provider/openai_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
LLMType.SILICONFLOW,
LLMType.OPENROUTER,
LLMType.LLAMA_API,
LLMType.MINIMAX,
]
)
class OpenAILLM(BaseLLM):
Expand Down Expand Up @@ -149,6 +150,9 @@ def _cons_kwargs(self, messages: list[dict], timeout=USE_CONFIG_TIMEOUT, **extra
# compatible to openai o1-series
kwargs["temperature"] = 1
kwargs.pop("max_tokens")
if self.config.api_type == LLMType.MINIMAX and kwargs.get("temperature", 0) <= 0:
# MiniMax requires temperature in (0.0, 1.0]
kwargs["temperature"] = 0.01
if extra_kwargs:
kwargs.update(extra_kwargs)
return kwargs
Expand Down
6 changes: 6 additions & 0 deletions metagpt/utils/token_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@
"llama-4-Maverick-17B-128E-Instruct-FP8": {"prompt": 0.0, "completion": 0.0},
"llama-3.3-8B-Instruct": {"prompt": 0.0, "completion": 0.0},
"llama-3.3-70B-Instruct": {"prompt": 0.0, "completion": 0.0}, # end, for Llama API
"MiniMax-M3": {"prompt": 0.0006, "completion": 0.0024}, # start, for MiniMax
"MiniMax-M2.7": {"prompt": 0.0014, "completion": 0.007},
"MiniMax-M2.7-highspeed": {"prompt": 0.0014, "completion": 0.007}, # end, for MiniMax
}


Expand Down Expand Up @@ -350,6 +353,9 @@
"qwen-7b-chat": 32000,
"qwen-1.8b-longcontext-chat": 32000,
"qwen-1.8b-chat": 8000,
"MiniMax-M3": 512000, # start, for MiniMax
"MiniMax-M2.7": 204000,
"MiniMax-M2.7-highspeed": 204000, # end, for MiniMax
}

# For Amazon Bedrock US region
Expand Down
Loading