-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat: add MiniMax Token Plan provider with hardcoded model list #7609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Soulter
merged 6 commits into
AstrBotDevs:master
from
Blueteemo:feat/add-minimax-token-plan-provider
Apr 17, 2026
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
af63e8c
feat: add MiniMax Token Plan provider with hardcoded model list (fix …
Blueteemo fce304a
fix: remove api_base from config template and add model validation
Blueteemo 906061c
fix: use custom_headers for Bearer token auth instead of auth_header
Blueteemo 24a49f8
fix: update MiniMax Token Plan provider adapter and documentation to …
Soulter 80ce260
feat: add MiniMax Token Plan configuration and icon support
Soulter ce6cb6d
feat: remove default configuration template from MiniMax Token Plan p…
Soulter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
astrbot/core/provider/sources/minimax_token_plan_source.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| 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 提供商适配器", | ||
| default_config_tmpl={ | ||
| "key": "", | ||
| "api_base": "https://api.minimaxi.com/anthropic", | ||
| }, | ||
| provider_display_name="MiniMax Token Plan", | ||
| ) | ||
| class ProviderMiniMaxTokenPlan(ProviderAnthropic): | ||
| """MiniMax Token Plan provider. | ||
|
|
||
| Token Plan API 不支持 /models 接口,因此 get_models() 返回硬编码的模型列表。 | ||
| 这是 Token Plan API 本身的限制,详见 https://github.com/AstrBotDevs/AstrBot/issues/7585 | ||
| """ | ||
|
|
||
| def __init__( | ||
| self, | ||
| provider_config, | ||
| provider_settings, | ||
| ) -> None: | ||
| # 使用固定的 api_base,不允许用户自定义 | ||
| provider_config["api_base"] = "https://api.minimaxi.com/anthropic" | ||
| # 强制使用 auth header(Token Plan 要求) | ||
| provider_config["auth_header"] = True | ||
|
|
||
|
Soulter marked this conversation as resolved.
Outdated
|
||
| super().__init__( | ||
| provider_config, | ||
| provider_settings, | ||
| ) | ||
|
|
||
| self.set_model(provider_config.get("model", "MiniMax-M2.7")) | ||
|
sourcery-ai[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| async def get_models(self) -> list[str]: | ||
| """Token Plan 不支持动态获取模型列表,返回硬编码的已知模型列表。""" | ||
| return MINIMAX_TOKEN_PLAN_MODELS.copy() | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.