feat(ai): add MiniMax provider for global and China Anthropic Messages endpoints - #222
Open
octo-patch wants to merge 1 commit into
Open
feat(ai): add MiniMax provider for global and China Anthropic Messages endpoints#222octo-patch wants to merge 1 commit into
octo-patch wants to merge 1 commit into
Conversation
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 validated MiniMax provider preset for the global and China Anthropic Messages endpoints and current MiniMax text models.
Changes
MiniMaxProvider(src/services/ai/providers/minimax.ts) that reuses the Anthropic Messages request/response handling and overrides the endpoint resolution and session provider tag.<base>/anthropic/v1/messagesauthenticated with thex-api-keyheader, on both the global host (https://api.minimax.io) and the China host (https://api.minimaxi.com). The provider normalizes a configuredmemoryApiUrlbase URL so it can be supplied with or without a trailing/anthropicor/anthropic/v1suffix, then targets/anthropic/v1/messagesand keeps thex-api-key+anthropic-versionheaders from the shared base.AnthropicMessagesProviderto exposesessionProviderTag()andresolveEndpoint()hooks (plus diagnostic log-label hooks) so an Anthropic-compatible gateway records its own provider tag and request URL while sharing the message/tool-call flow; Anthropic behavior is unchanged."minimax"provider type throughAIProviderFactory.createProvider/getSupportedProviders, theAIProviderTypeunion (session-types.tsandtypes/index.ts), and thememoryProviderconfig types inconfig.ts.minimaxprovider mode and the global/China base URLs in the config template and README.Unlike the closed prior attempt, this adds a source-level provider for both the global and China endpoints, uses the current
/anthropic/v1/messagesendpoint (not a/anthropic/v1alias on a single CN host), keeps the currentx-api-keyauth scheme, and includes tests.Tests
bun test tests/minimax-provider.test.ts tests/anthropic-provider.test.ts tests/ai-provider-config.test.ts tests/openai-chat-completion-provider.test.ts tests/config.test.ts tests/config-resolution.test.ts— all passing.bunx tsc --noEmit— clean.prettier --checkon changed files — clean.New
tests/minimax-provider.test.tscovers endpoint resolution for the global host, the China host, base URLs that already include/anthropicor/anthropic/v1, trailing-slash normalization, the missing-URL guard,x-api-key+anthropic-versionheader emission, request body model/max_tokens, tool-use extraction from an Anthropic-format response, and factory wiring.