Skip to content

feat(ai): add MiniMax provider for global and China Anthropic Messages endpoints - #222

Open
octo-patch wants to merge 1 commit into
tickernelz:mainfrom
octo-patch:octo/20260730--recvqepZ4MOsVs
Open

feat(ai): add MiniMax provider for global and China Anthropic Messages endpoints#222
octo-patch wants to merge 1 commit into
tickernelz:mainfrom
octo-patch:octo/20260730--recvqepZ4MOsVs

Conversation

@octo-patch

Copy link
Copy Markdown

Reason: Add a validated MiniMax provider preset for the global and China Anthropic Messages endpoints and current MiniMax text models.

Changes

  • Add MiniMaxProvider (src/services/ai/providers/minimax.ts) that reuses the Anthropic Messages request/response handling and overrides the endpoint resolution and session provider tag.
  • MiniMax exposes an Anthropic Messages-compatible endpoint at <base>/anthropic/v1/messages authenticated with the x-api-key header, on both the global host (https://api.minimax.io) and the China host (https://api.minimaxi.com). The provider normalizes a configured memoryApiUrl base URL so it can be supplied with or without a trailing /anthropic or /anthropic/v1 suffix, then targets /anthropic/v1/messages and keeps the x-api-key + anthropic-version headers from the shared base.
  • Refactor AnthropicMessagesProvider to expose sessionProviderTag() and resolveEndpoint() 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.
  • Wire the "minimax" provider type through AIProviderFactory.createProvider / getSupportedProviders, the AIProviderType union (session-types.ts and types/index.ts), and the memoryProvider config types in config.ts.
  • Document the minimax provider 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/messages endpoint (not a /anthropic/v1 alias on a single CN host), keeps the current x-api-key auth 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 --check on changed files — clean.

New tests/minimax-provider.test.ts covers endpoint resolution for the global host, the China host, base URLs that already include /anthropic or /anthropic/v1, trailing-slash normalization, the missing-URL guard, x-api-key + anthropic-version header emission, request body model/max_tokens, tool-use extraction from an Anthropic-format response, and factory wiring.

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