MiniMax
Learn how to use MiniMax provider with the AI SDK.
vercel-minimax-ai-provider is a community provider that provides access to the latest MiniMax-M2 model from MiniMax.
API keys can be obtained from the MiniMax Platform.
Setup
The MiniMax provider is available via the vercel-minimax-ai-provider module. You can install it with:
$ pnpm add vercel-minimax-ai-provider
$ npm install vercel-minimax-ai-provider
$ yarn add vercel-minimax-ai-provider
$ bun add vercel-minimax-ai-provider
Provider Instance
The MiniMax provider supports two API compatibility modes:
Anthropic-Compatible API (Default)
You can import the default provider instance minimax from vercel-minimax-ai-provider:
Or explicitly use the Anthropic-compatible instance:
Or OpenAI-compatible API format:
Custom Configuration
For custom configuration, you can use the createMinimax (Anthropic-compatible) or createMinimaxOpenAI (OpenAI-compatible) functions:
Anthropic-Compatible Configuration (Default)
Configuration Options
You can use the following optional settings to customize the MiniMax provider instance:
-
baseURL string
Use a different URL prefix for API calls.
- Anthropic-compatible default:
https://api.minimax.io/anthropic/v1 - OpenAI-compatible default:
https://api.minimax.io/v1
- Anthropic-compatible default:
-
apiKey string
API key that is being sent using the
Authorizationheader. It defaults to theMINIMAX_API_KEYenvironment variable. -
headers Record<string,string>
Custom headers to include in the requests.
-
fetch (input: RequestInfo, init?: RequestInit) => Promise<Response>
Custom fetch implementation.
API Compatibility
MiniMax provides two API formats. Both are included in this package.
The main difference is the API request/response format:
- Anthropic format (default): Uses Anthropic Messages API format with
anthropic-versionheader - OpenAI format: Uses standard OpenAI chat completion format
Both formats access the same MiniMax models with the same capabilities.
Model Capabilities
| Model | Text Generation | Object Generation | Image Input | Tool Usage | Tool Streaming |
|---|---|---|---|---|---|
MiniMax-M2 | |||||
MiniMax-M2-Stable |
Please see the MiniMax docs for a full list of available models and their capabilities. The provider accepts any model ID as a string for forward compatibility.