feat: add MiniMax as first-class LLM provider#674
Open
octo-patch wants to merge 1 commit intostakpak:mainfrom
Open
feat: add MiniMax as first-class LLM provider#674octo-patch wants to merge 1 commit intostakpak:mainfrom
octo-patch wants to merge 1 commit intostakpak:mainfrom
Conversation
Add MiniMax (https://api.minimax.io) as a built-in provider alongside OpenAI, Anthropic, and Gemini. MiniMax uses an OpenAI-compatible API, so the implementation reuses existing OpenAI wire types while adding MiniMax-specific temperature clamping (0.0 → 0.01, since MiniMax rejects temperature=0.0) and a static model catalogue. Models: MiniMax-M2.7, MiniMax-M2.7-highspeed (1M context), MiniMax-M2.5, MiniMax-M2.5-highspeed (204K context). Changes: - New provider module: libs/ai/src/providers/minimax/ (types, convert, stream, provider) with 23 unit tests and 3 integration tests - Provider trait impl: generate, stream, list_models, build_headers - SDK wiring: InferenceConfig, ClientBuilder, ProviderRegistry (auto- registers from MINIMAX_API_KEY env var), ProviderKind enum - Shared lib: ProviderConfig::MiniMax variant, stakai_adapter arms - CLI: auth login support, config profile template, endpoint cleaning - README: MiniMax in provider list, auth login example, BYOK config
shehab299
reviewed
Apr 8, 2026
| } | ||
| ProviderConfig::MiniMax { api_endpoint, .. } => { | ||
| if let Some(api_key) = provider_config.api_key() { | ||
| use stakai::providers::minimax::{ |
Collaborator
There was a problem hiding this comment.
Please move this imports to the top of the file like the other providers
shehab299
reviewed
Apr 8, 2026
|
|
||
| ## Usage | ||
| You can [use your own Anthropic or OpenAI API keys](#option-b-running-without-a-stakpak-api-key), [custom OpenAI compatible endpoint](#option-b-running-without-a-stakpak-api-key), or [a Stakpak API key](#option-a-running-with-a-stakpak-api-key). | ||
| You can [use your own Anthropic or OpenAI API keys](#option-b-running-without-a-stakpak-api-key), [custom OpenAI compatible endpoint](#option-b-running-without-a-stakpak-api-key), [MiniMax API keys](#option-b-running-without-a-stakpak-api-key), or [a Stakpak API key](#option-a-running-with-a-stakpak-api-key). |
Collaborator
There was a problem hiding this comment.
Add it to the [use your own Anthropic or OpenAI API keys] instead of making a seperate entry
shehab299
reviewed
Apr 8, 2026
| } | ||
|
|
||
| async fn list_models(&self) -> Result<Vec<Model>> { | ||
| Ok(Self::static_models()) |
Collaborator
There was a problem hiding this comment.
Instead of using static models hard coded in code use models.dev to load models dynamically
crate::registry::models_dev::load_models_for_provider("minimax")
shehab299
reviewed
Apr 8, 2026
| } | ||
|
|
||
| /// Convert MiniMax (OpenAI-compatible) response to SDK response | ||
| fn from_minimax_response(resp: ChatCompletionResponse) -> Result<GenerateResponse> { |
Collaborator
There was a problem hiding this comment.
This should be in convert module
shehab299
reviewed
Apr 8, 2026
| } | ||
|
|
||
| /// Convert OpenAI-compatible ChatUsage to SDK Usage | ||
| fn usage_from_chat_usage(usage: &ChatUsage) -> Usage { |
Collaborator
There was a problem hiding this comment.
This also should be in convert module
Collaborator
|
To fix the CI/CD pipeline error just use cargo fmt and cargo clippy before committing |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Add MiniMax as a built-in LLM provider alongside OpenAI, Anthropic, and Gemini. MiniMax offers high-performance models (M2.7 with 1M context, M2.5 with 204K context) through an OpenAI-compatible API at
https://api.minimax.io/v1.What's included
New provider module (
libs/ai/src/providers/minimax/):types.rs–MiniMaxConfigwith API key + base URL,MINIMAX_API_KEYenv auto-detectconvert.rs– SDK→OpenAI request conversion with temperature clamping (MiniMax rejectstemperature=0.0, clamped to0.01)stream.rs– SSE streaming viareqwest_eventsource, tool-call state trackingprovider.rs– FullProvidertrait implementation:generate,stream,list_models,build_headersMiniMax-M2.7,MiniMax-M2.7-highspeed,MiniMax-M2.5,MiniMax-M2.5-highspeedSDK wiring:
InferenceConfig–.minimax()and.minimax_config()builder methodsClientBuilder– MiniMax registration inwith_inference_config()ProviderRegistry– Auto-registration fromMINIMAX_API_KEYenv varProviderKind–MiniMaxvariant with"minimax"string conversionShared library:
ProviderConfig::MiniMaxvariant withapi_key,api_endpoint,authfieldsstakai_adapter.rs–build_inference_config()andbuild_provider_registry_direct()armsCLI integration:
stakpak auth login --provider minimax --api-key $MINIMAX_API_KEYgenerate_minimax_profile())BuiltinProvider::MiniMaxenum variantDocumentation: README updated with MiniMax in provider list, auth login example, BYOK config
Tests
MINIMAX_API_KEY): generate, streaming, system message – all passingDesign decisions
ChatCompletionRequest,ChatMessage, etc.) to minimize code duplication0.0 → 0.01(MiniMax requires(0.0, 1.0]range)/v1/modelsendpoint)Test plan
MINIMAX_API_KEYcargo checkpasses