mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-06-16 21:06:15 +03:00
feat(llm): add MiniMax as a built-in provider
Two regional endpoints (global api.minimax.io, China api.minimaxi.com) with separate API keys. Models M2.7 / M2.5 plus -highspeed variants, 204K context. Follows the existing provider-preset pattern. #789 #609 #577 #546 #395 #378
This commit is contained in:
@@ -6,4 +6,6 @@ XAI_API_KEY=
|
||||
DEEPSEEK_API_KEY=
|
||||
DASHSCOPE_API_KEY=
|
||||
ZHIPU_API_KEY=
|
||||
MINIMAX_API_KEY=
|
||||
MINIMAX_CN_API_KEY=
|
||||
OPENROUTER_API_KEY=
|
||||
|
||||
@@ -144,6 +144,8 @@ export XAI_API_KEY=... # xAI (Grok)
|
||||
export DEEPSEEK_API_KEY=... # DeepSeek
|
||||
export DASHSCOPE_API_KEY=... # Qwen (Alibaba DashScope)
|
||||
export ZHIPU_API_KEY=... # GLM (Zhipu)
|
||||
export MINIMAX_API_KEY=... # MiniMax (global, api.minimax.io)
|
||||
export MINIMAX_CN_API_KEY=... # MiniMax (China, api.minimaxi.com)
|
||||
export OPENROUTER_API_KEY=... # OpenRouter
|
||||
export ALPHA_VANTAGE_API_KEY=... # Alpha Vantage
|
||||
```
|
||||
@@ -184,7 +186,7 @@ An interface will appear showing results as they load, letting you track the age
|
||||
|
||||
### Implementation Details
|
||||
|
||||
We built TradingAgents with LangGraph to ensure flexibility and modularity. The framework supports multiple LLM providers: OpenAI, Google, Anthropic, xAI, DeepSeek, Qwen (Alibaba DashScope), GLM (Zhipu), OpenRouter, Ollama for local models, and Azure OpenAI for enterprise.
|
||||
We built TradingAgents with LangGraph to ensure flexibility and modularity. The framework supports multiple LLM providers: OpenAI, Google, Anthropic, xAI, DeepSeek, Qwen (Alibaba DashScope), GLM (Zhipu), MiniMax (global + China), OpenRouter, Ollama for local models, and Azure OpenAI for enterprise.
|
||||
|
||||
### Python Usage
|
||||
|
||||
@@ -208,7 +210,7 @@ from tradingagents.graph.trading_graph import TradingAgentsGraph
|
||||
from tradingagents.default_config import DEFAULT_CONFIG
|
||||
|
||||
config = DEFAULT_CONFIG.copy()
|
||||
config["llm_provider"] = "openai" # openai, google, anthropic, xai, deepseek, qwen, glm, openrouter, ollama, azure
|
||||
config["llm_provider"] = "openai" # openai, google, anthropic, xai, deepseek, qwen, glm, minimax, minimax-cn, openrouter, ollama, azure
|
||||
config["deep_think_llm"] = "gpt-5.4" # Model for complex reasoning
|
||||
config["quick_think_llm"] = "gpt-5.4-mini" # Model for quick tasks
|
||||
config["max_debate_rounds"] = 2
|
||||
|
||||
@@ -239,6 +239,8 @@ def select_llm_provider() -> tuple[str, str | None]:
|
||||
("DeepSeek", "deepseek", "https://api.deepseek.com"),
|
||||
("Qwen", "qwen", "https://dashscope.aliyuncs.com/compatible-mode/v1"),
|
||||
("GLM", "glm", "https://open.bigmodel.cn/api/paas/v4/"),
|
||||
("MiniMax", "minimax", "https://api.minimax.io/v1"),
|
||||
("MiniMax CN", "minimax-cn", "https://api.minimaxi.com/v1"),
|
||||
("OpenRouter", "openrouter", "https://openrouter.ai/api/v1"),
|
||||
("Azure OpenAI", "azure", None),
|
||||
("Ollama", "ollama", "http://localhost:11434/v1"),
|
||||
|
||||
@@ -4,7 +4,9 @@ from .base_client import BaseLLMClient
|
||||
|
||||
# Providers that use the OpenAI-compatible chat completions API
|
||||
_OPENAI_COMPATIBLE = (
|
||||
"openai", "xai", "deepseek", "qwen", "glm", "ollama", "openrouter",
|
||||
"openai", "xai", "deepseek", "qwen", "glm",
|
||||
"minimax", "minimax-cn",
|
||||
"ollama", "openrouter",
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,22 @@ ModelOption = Tuple[str, str]
|
||||
ProviderModeOptions = Dict[str, Dict[str, List[ModelOption]]]
|
||||
|
||||
|
||||
# Shared model list for MiniMax's global and CN endpoints (same model IDs).
|
||||
_MINIMAX_MODELS: Dict[str, List[ModelOption]] = {
|
||||
"quick": [
|
||||
("MiniMax M2.7 Highspeed — Fast, 204K ctx", "MiniMax-M2.7-highspeed"),
|
||||
("MiniMax M2.5 Highspeed — Previous-gen fast", "MiniMax-M2.5-highspeed"),
|
||||
("Custom model ID", "custom"),
|
||||
],
|
||||
"deep": [
|
||||
("MiniMax M2.7 — Flagship, 204K ctx", "MiniMax-M2.7"),
|
||||
("MiniMax M2.5 — Previous-gen flagship", "MiniMax-M2.5"),
|
||||
("MiniMax M2.7 Highspeed — Faster M2.7, 204K ctx", "MiniMax-M2.7-highspeed"),
|
||||
("Custom model ID", "custom"),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
MODEL_OPTIONS: ProviderModeOptions = {
|
||||
"openai": {
|
||||
"quick": [
|
||||
@@ -101,6 +117,10 @@ MODEL_OPTIONS: ProviderModeOptions = {
|
||||
("Custom model ID", "custom"),
|
||||
],
|
||||
},
|
||||
# MiniMax: same model IDs across global (.io) and China (.com) regions,
|
||||
# so the two provider keys share one model list.
|
||||
"minimax": _MINIMAX_MODELS,
|
||||
"minimax-cn": _MINIMAX_MODELS,
|
||||
# OpenRouter: fetched dynamically. Azure: any deployed model name.
|
||||
"ollama": {
|
||||
"quick": [
|
||||
|
||||
@@ -119,6 +119,10 @@ _PROVIDER_CONFIG = {
|
||||
"deepseek": ("https://api.deepseek.com", "DEEPSEEK_API_KEY"),
|
||||
"qwen": ("https://dashscope-intl.aliyuncs.com/compatible-mode/v1", "DASHSCOPE_API_KEY"),
|
||||
"glm": ("https://api.z.ai/api/paas/v4/", "ZHIPU_API_KEY"),
|
||||
# MiniMax exposes two regional endpoints with separate keys; mainland
|
||||
# Chinese users hit .com while global users hit .io.
|
||||
"minimax": ("https://api.minimax.io/v1", "MINIMAX_API_KEY"),
|
||||
"minimax-cn": ("https://api.minimaxi.com/v1", "MINIMAX_CN_API_KEY"),
|
||||
"openrouter": ("https://openrouter.ai/api/v1", "OPENROUTER_API_KEY"),
|
||||
"ollama": ("http://localhost:11434/v1", None),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user