Add direct MiniMax chat provider - #687
Open
octo-patch wants to merge 1 commit into
Open
octo-patch wants to merge 1 commit into
octo-patch wants to merge 1 commit into
Conversation
|
@octo-patch is attempting to deploy a commit to the Kevin's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Reason: Add a direct MiniMax chat provider so the Ask the Atlas RAG path can stream from MiniMax's Anthropic Messages-compatible endpoint instead of being OpenRouter-only.
Changes
lib/chat-provider.js: a single transport-selection module that resolves the active chat provider (openrouter, default, orminimax) and builds the streaming chat request for each. For MiniMax it targets the Anthropic Messages-compatible endpoint, supports the global (api.minimax.io) and China (api.minimaxi.com) regional hosts viaMINIMAX_REGION, and serves the current MiniMax text models (MiniMax-M3,MiniMax-M2.7) via theMINIMAX_MODELSlist. The module also exposes transport-agnostic SSE accessors (chatStreamDelta,chatStreamModel,chatStreamUsage) covering both OpenRouter (choices[].delta.content/model/usage) and MiniMax Anthropic (delta.text/message.model/usage) chunk shapes.api/chat.jsto use the new module: provider config is resolved once at module load, the API-key gate and the streaming fetch are dispatched per provider, and the SSE loop reads deltas/model/usage through the shared accessors. The OpenRouter waterfall is unchanged in behavior; the MiniMax path is opt-in viaCHAT_PROVIDER=minimax.tests/chat-provider.test.jscovering region resolution, model-list override, and the request shape for both transports.CHAT_PROVIDER,MINIMAX_API_KEY,MINIMAX_REGION, andMINIMAX_MODELSenvironment variables in the README env table.Checks
node --check api/chat.jsnode --check lib/chat-provider.jsnode --test tests/chat-provider.test.js(10/10 passing)node --test tests/openrouter.test.js(existing OpenRouter tests still green)MiniMax is reached through its OpenAI-compatible and Anthropic-compatible endpoints; the chatbot uses the Anthropic-compatible transport so the existing streaming parser keeps working without per-provider branching.