Skip to content
Merged
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 astrbot/core/config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ class ChatProviderTemplate(TypedDict):
"provider_type": "chat_completion",
"enable": True,
"key": [],
"api_base": "https://api.kimi.com/coding/",
"api_base": "https://api.kimi.com/coding",
"timeout": 120,
"proxy": "",
"custom_headers": {"User-Agent": "claude-code/0.1.0"},
Expand Down Expand Up @@ -1236,6 +1236,19 @@ class ChatProviderTemplate(TypedDict):
"proxy": "",
"custom_headers": {},
},
"MiniMax Token Plan": {
"id": "minimax-token-plan",
"provider": "minimax-token-plan",
"type": "minimax_token_plan",
"provider_type": "chat_completion",
"enable": True,
"key": [],
"api_base": "https://api.minimaxi.com/anthropic",
"timeout": 120,
"proxy": "",
"custom_headers": {"User-Agent": "claude-code/0.1.0"},
"anth_thinking_config": {"type": "", "budget": 0, "effort": ""},
},
"xAI": {
"id": "xai",
"provider": "xai",
Expand Down
4 changes: 4 additions & 0 deletions astrbot/core/provider/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@ def dynamic_import_provider(self, type: str) -> None:
)
case "longcat_chat_completion":
from .sources.longcat_source import ProviderLongCat as ProviderLongCat
case "minimax_token_plan":
from .sources.minimax_token_plan_source import (
ProviderMiniMaxTokenPlan as ProviderMiniMaxTokenPlan,
)
case "zhipu_chat_completion":
from .sources.zhipu_source import ProviderZhipu as ProviderZhipu
case "groq_chat_completion":
Expand Down
55 changes: 55 additions & 0 deletions astrbot/core/provider/sources/minimax_token_plan_source.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from astrbot.core.provider.sources.anthropic_source import ProviderAnthropic

from ..register import register_provider_adapter

MINIMAX_TOKEN_PLAN_MODELS = [
"MiniMax-M2.7",
"MiniMax-M2.5",
"MiniMax-M2.1",
"MiniMax-M2",
]


@register_provider_adapter(
"minimax_token_plan",
"MiniMax Token Plan Provider Adapter",
)
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
class ProviderMiniMaxTokenPlan(ProviderAnthropic):
"""MiniMax Token Plan provider.

The Token Plan API does not support the /models endpoint, so get_models()
returns a hard-coded model list. This is a Token Plan API limitation.
See https://github.com/AstrBotDevs/AstrBot/issues/7585 for details.
"""

def __init__(
self,
provider_config,
provider_settings,
) -> None:
# Keep api_base fixed; Token Plan users do not need to configure it.
provider_config["api_base"] = "https://api.minimaxi.com/anthropic"
# MiniMax Token Plan requires the Authorization: Bearer <token> header.
key = provider_config.get("key", "")
actual_key = key[0] if isinstance(key, list) else key
provider_config.setdefault("custom_headers", {})["Authorization"] = (
f"Bearer {actual_key}"
)

super().__init__(
provider_config,
provider_settings,
)

configured_model = provider_config.get("model", "MiniMax-M2.7")
if configured_model not in MINIMAX_TOKEN_PLAN_MODELS:
raise ValueError(
f"Unsupported model: {configured_model!r}. "
f"Supported models: {', '.join(MINIMAX_TOKEN_PLAN_MODELS)}"
)

self.set_model(configured_model)

async def get_models(self) -> list[str]:
"""Return the hard-coded known model list because Token Plan cannot fetch it dynamically."""
return MINIMAX_TOKEN_PLAN_MODELS.copy()
3 changes: 2 additions & 1 deletion dashboard/src/utils/providerUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function getProviderIcon(type) {
'moonshot': 'https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@latest/icons/kimi.svg',
'kimi': 'https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@latest/icons/kimi.svg',
'kimi-code': 'https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@latest/icons/kimi.svg',
'kimi-code': 'https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@latest/icons/longcat-color.svg',
'longcat': 'https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@latest/icons/longcat-color.svg',
'ppio': 'https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@latest/icons/ppio.svg',
'dify': 'https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@latest/icons/dify-color.svg',
"coze": "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@1.66.0/icons/coze.svg",
Expand All @@ -33,6 +33,7 @@ export function getProviderIcon(type) {
'lm_studio': 'https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@latest/icons/lmstudio.svg',
'fishaudio': 'https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@latest/icons/fishaudio.svg',
'minimax': 'https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@latest/icons/minimax.svg',
'minimax-token-plan': 'https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@latest/icons/minimax.svg',
'mimo': 'https://platform.xiaomimimo.com/favicon.874c9507.png',
'302ai': 'https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@1.53.0/icons/ai302-color.svg',
'microsoft': 'https://cdn.jsdelivr.net/npm/@lobehub/icons-static-svg@latest/icons/microsoft.svg',
Expand Down
Loading