@ai-sdk/minimax 0.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # @ai-sdk/minimax
2
+
3
+ ## 2.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 6be018f: Add video model support to the MiniMax provider (`minimax.video`) for the MiniMax-H3 model, including text-to-video, first/last-frame, and reference-to-video generation.
8
+
9
+ ## 2.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - 56c055b: Add MiniMax provider with language model support for the MiniMax-M model series.
package/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2023 Vercel, Inc.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # AI SDK - MiniMax Provider
2
+
3
+ The **[MiniMax provider](https://ai-sdk.dev/providers/ai-sdk-providers/minimax)** for the [AI SDK](https://ai-sdk.dev/docs) contains language model support for the [MiniMax](https://www.minimax.io/) platform, including the MiniMax-M model series.
4
+
5
+ > **Deploying to Vercel?** With Vercel's AI Gateway you can access MiniMax (and hundreds of models from other providers) — no additional packages, API keys, or extra cost. [Get started with AI Gateway](https://vercel.com/ai-gateway).
6
+
7
+ ## Setup
8
+
9
+ The MiniMax provider is available in the `@ai-sdk/minimax` module. You can install it with
10
+
11
+ ```bash
12
+ npm i @ai-sdk/minimax
13
+ ```
14
+
15
+ ## Skill for Coding Agents
16
+
17
+ If you use coding agents such as Claude Code or Cursor, we highly recommend adding the AI SDK skill to your repository:
18
+
19
+ ```shell
20
+ npx skills add vercel/ai
21
+ ```
22
+
23
+ ## Provider Instance
24
+
25
+ You can import the default provider instance `minimax` from `@ai-sdk/minimax`:
26
+
27
+ ```ts
28
+ import { minimax } from '@ai-sdk/minimax';
29
+ ```
30
+
31
+ ## Language Model Example
32
+
33
+ ```ts
34
+ import { minimax } from '@ai-sdk/minimax';
35
+ import { generateText } from 'ai';
36
+
37
+ const { text } = await generateText({
38
+ model: minimax('minimax-m3'),
39
+ prompt: 'Write a JavaScript function that sorts a list:',
40
+ });
41
+ ```
42
+
43
+ ## Thinking Mode Example
44
+
45
+ ```ts
46
+ import { minimax } from '@ai-sdk/minimax';
47
+ import { generateText } from 'ai';
48
+
49
+ const { text } = await generateText({
50
+ model: minimax('minimax-m3'),
51
+ prompt: 'Solve this problem step by step: What is 15% of 240?',
52
+ providerOptions: {
53
+ minimax: {
54
+ thinking: { type: 'adaptive' },
55
+ },
56
+ },
57
+ });
58
+ ```
59
+
60
+ ## Video Generation Example
61
+
62
+ ```ts
63
+ import { minimax } from '@ai-sdk/minimax';
64
+ import { experimental_generateVideo as generateVideo } from 'ai';
65
+
66
+ const { video } = await generateVideo({
67
+ model: minimax.video('MiniMax-H3'),
68
+ prompt: 'A white kitten chases a butterfly across a sunlit garden.',
69
+ aspectRatio: '16:9',
70
+ duration: 5,
71
+ });
72
+ ```
73
+
74
+ ## Documentation
75
+
76
+ Please check out the **[MiniMax provider](https://ai-sdk.dev/providers/ai-sdk-providers/minimax)** for more information.
@@ -0,0 +1,98 @@
1
+ import { ProviderV3, LanguageModelV3, Experimental_VideoModelV3 } from '@ai-sdk/provider';
2
+ import { FetchFunction } from '@ai-sdk/provider-utils';
3
+ import { z } from 'zod/v4';
4
+
5
+ type MiniMaxChatModelId = 'minimax-m3' | 'minimax-m2.7' | 'minimax-m2.7-highspeed' | 'minimax-m2.5' | 'minimax-m2.5-highspeed' | 'minimax-m2.1' | 'minimax-m2.1-highspeed' | 'minimax-m2' | (string & {});
6
+ declare const minimaxLanguageModelOptions: z.ZodObject<{
7
+ thinking: z.ZodOptional<z.ZodObject<{
8
+ type: z.ZodEnum<{
9
+ adaptive: "adaptive";
10
+ disabled: "disabled";
11
+ }>;
12
+ }, z.core.$strip>>;
13
+ }, z.core.$strip>;
14
+ type MiniMaxLanguageModelOptions = z.infer<typeof minimaxLanguageModelOptions>;
15
+
16
+ type MiniMaxVideoModelId = 'MiniMax-H3' | (string & {});
17
+
18
+ interface MiniMaxProviderSettings {
19
+ /**
20
+ * MiniMax API key. Default value is taken from the `MINIMAX_API_KEY`
21
+ * environment variable.
22
+ */
23
+ apiKey?: string;
24
+ /**
25
+ * Base URL for the API calls. Defaults to MiniMax's Anthropic-compatible
26
+ * endpoint (`https://api.minimax.io/anthropic/v1`).
27
+ */
28
+ baseURL?: string;
29
+ /**
30
+ * Use a different URL prefix for video generation API calls.
31
+ * The default prefix is `https://api.minimax.io`.
32
+ */
33
+ videoBaseURL?: string;
34
+ /**
35
+ * Custom headers to include in the requests.
36
+ */
37
+ headers?: Record<string, string>;
38
+ /**
39
+ * Custom fetch implementation. You can use it as a middleware to intercept requests,
40
+ * or to provide a custom fetch implementation for e.g. testing.
41
+ */
42
+ fetch?: FetchFunction;
43
+ }
44
+ interface MiniMaxProvider extends ProviderV3 {
45
+ /**
46
+ * Creates a MiniMax model for text generation.
47
+ */
48
+ (modelId: MiniMaxChatModelId): LanguageModelV3;
49
+ /**
50
+ * Creates a MiniMax language model for text generation.
51
+ */
52
+ languageModel(modelId: MiniMaxChatModelId): LanguageModelV3;
53
+ /**
54
+ * Creates a MiniMax chat model for text generation.
55
+ */
56
+ chat(modelId: MiniMaxChatModelId): LanguageModelV3;
57
+ /**
58
+ * Creates a MiniMax video model for video generation.
59
+ */
60
+ video(modelId: MiniMaxVideoModelId): Experimental_VideoModelV3;
61
+ /**
62
+ * Creates a MiniMax video model for video generation.
63
+ */
64
+ videoModel(modelId: MiniMaxVideoModelId): Experimental_VideoModelV3;
65
+ /**
66
+ * @deprecated Use `embeddingModel` instead.
67
+ */
68
+ textEmbeddingModel(modelId: string): never;
69
+ }
70
+ declare function createMiniMax(options?: MiniMaxProviderSettings): MiniMaxProvider;
71
+ declare const minimax: MiniMaxProvider;
72
+
73
+ /**
74
+ * Provider options for MiniMax video generation.
75
+ */
76
+ declare const minimaxVideoProviderOptions: z.ZodObject<{
77
+ resolution: z.ZodOptional<z.ZodEnum<{
78
+ "2K": "2K";
79
+ }>>;
80
+ ratio: z.ZodOptional<z.ZodEnum<{
81
+ adaptive: "adaptive";
82
+ "21:9": "21:9";
83
+ "16:9": "16:9";
84
+ "4:3": "4:3";
85
+ "1:1": "1:1";
86
+ "3:4": "3:4";
87
+ "9:16": "9:16";
88
+ }>>;
89
+ referenceAudioUrls: z.ZodOptional<z.ZodArray<z.ZodString>>;
90
+ aigcWatermark: z.ZodOptional<z.ZodBoolean>;
91
+ pollIntervalMs: z.ZodOptional<z.ZodNumber>;
92
+ pollTimeoutMs: z.ZodOptional<z.ZodNumber>;
93
+ }, z.core.$strip>;
94
+ type MiniMaxVideoModelOptions = z.infer<typeof minimaxVideoProviderOptions>;
95
+
96
+ declare const VERSION: string;
97
+
98
+ export { type MiniMaxChatModelId, type MiniMaxLanguageModelOptions, type MiniMaxProvider, type MiniMaxLanguageModelOptions as MiniMaxProviderOptions, type MiniMaxProviderSettings, type MiniMaxVideoModelId, type MiniMaxVideoModelOptions, VERSION, createMiniMax, minimax };