Skip to content

Add direct MiniMax chat provider - #687

Open
octo-patch wants to merge 1 commit into
ksimback:mainfrom
octo-patch:octo/20260730-provider-add-recvqerXOBCxwz
Open

octo-patch wants to merge 1 commit into
ksimback:mainfrom
octo-patch:octo/20260730-provider-add-recvqerXOBCxwz

Conversation

@octo-patch

Copy link
Copy Markdown

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

  • Add lib/chat-provider.js: a single transport-selection module that resolves the active chat provider (openrouter, default, or minimax) 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 via MINIMAX_REGION, and serves the current MiniMax text models (MiniMax-M3, MiniMax-M2.7) via the MINIMAX_MODELS list. 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.
  • Wire api/chat.js to 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 via CHAT_PROVIDER=minimax.
  • Add tests/chat-provider.test.js covering region resolution, model-list override, and the request shape for both transports.
  • Document the new CHAT_PROVIDER, MINIMAX_API_KEY, MINIMAX_REGION, and MINIMAX_MODELS environment variables in the README env table.

Checks

  • node --check api/chat.js
  • node --check lib/chat-provider.js
  • node --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.

@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant