mmx-cli 1.0.11 → 1.0.13
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/README.md +1 -1
- package/dist/index.d.ts +419 -0
- package/dist/mmx.mjs +191 -180
- package/dist/sdk.mjs +1505 -0
- package/package.json +16 -4
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
14
|
<p align="center">
|
|
15
|
-
<a href="README_CN.md">中文文档</a> · <a href="https://platform.minimax.io">Global Platform</a> · <a href="https://platform.minimaxi.com">CN Platform</a>
|
|
15
|
+
<a href="README_CN.md">中文文档</a> · <a href="https://platform.minimax.io">Global Platform</a> · <a href="https://platform.minimaxi.com">CN Platform</a> · <a href="https://platform.minimax.io/docs/token-plan/minimax-cli">Example</a>
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
18
|
## Features
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
declare const REGIONS: {
|
|
4
|
+
readonly global: "https://api.minimax.io";
|
|
5
|
+
readonly cn: "https://api.minimaxi.com";
|
|
6
|
+
};
|
|
7
|
+
export type Region = keyof typeof REGIONS;
|
|
8
|
+
export interface Config {
|
|
9
|
+
apiKey?: string;
|
|
10
|
+
fileApiKey?: string;
|
|
11
|
+
fileRegion?: Region;
|
|
12
|
+
configPath?: string;
|
|
13
|
+
region: Region;
|
|
14
|
+
baseUrl: string;
|
|
15
|
+
output: "text" | "json";
|
|
16
|
+
timeout: number;
|
|
17
|
+
defaultTextModel?: string;
|
|
18
|
+
defaultSpeechModel?: string;
|
|
19
|
+
defaultVideoModel?: string;
|
|
20
|
+
defaultMusicModel?: string;
|
|
21
|
+
verbose: boolean;
|
|
22
|
+
quiet: boolean;
|
|
23
|
+
noColor: boolean;
|
|
24
|
+
yes: boolean;
|
|
25
|
+
dryRun: boolean;
|
|
26
|
+
nonInteractive: boolean;
|
|
27
|
+
async: boolean;
|
|
28
|
+
needsRegionDetection?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface RequestOpts {
|
|
31
|
+
url: string;
|
|
32
|
+
method?: string;
|
|
33
|
+
body?: unknown;
|
|
34
|
+
headers?: Record<string, string>;
|
|
35
|
+
timeout?: number;
|
|
36
|
+
stream?: boolean;
|
|
37
|
+
noAuth?: boolean;
|
|
38
|
+
authStyle?: "bearer" | "x-api-key";
|
|
39
|
+
}
|
|
40
|
+
export interface MiniMaxSDKOptions {
|
|
41
|
+
apiKey?: string;
|
|
42
|
+
baseUrl?: string;
|
|
43
|
+
region?: Region;
|
|
44
|
+
}
|
|
45
|
+
export type ModelPartial<T> = "model" extends keyof T ? Omit<T, "model"> & {
|
|
46
|
+
model?: T["model"];
|
|
47
|
+
} : T;
|
|
48
|
+
declare class Client {
|
|
49
|
+
protected config: Config;
|
|
50
|
+
constructor(options: MiniMaxSDKOptions);
|
|
51
|
+
protected request(opts: RequestOpts): Promise<Response>;
|
|
52
|
+
protected requestJson<T>(opts: RequestOpts): Promise<T>;
|
|
53
|
+
protected streamSSE<T>(res: Response): AsyncGenerator<T>;
|
|
54
|
+
}
|
|
55
|
+
export type ContentBlock = {
|
|
56
|
+
type: "text";
|
|
57
|
+
text: string;
|
|
58
|
+
} | {
|
|
59
|
+
type: "thinking";
|
|
60
|
+
thinking: string;
|
|
61
|
+
} | {
|
|
62
|
+
type: "tool_use";
|
|
63
|
+
id: string;
|
|
64
|
+
name: string;
|
|
65
|
+
input: Record<string, unknown>;
|
|
66
|
+
} | {
|
|
67
|
+
type: "tool_result";
|
|
68
|
+
tool_use_id: string;
|
|
69
|
+
content: string;
|
|
70
|
+
};
|
|
71
|
+
export interface ChatMessage {
|
|
72
|
+
role: "user" | "assistant";
|
|
73
|
+
content: string | ContentBlock[];
|
|
74
|
+
}
|
|
75
|
+
export interface ChatTool {
|
|
76
|
+
name: string;
|
|
77
|
+
description?: string;
|
|
78
|
+
input_schema: Record<string, unknown>;
|
|
79
|
+
}
|
|
80
|
+
export interface ChatRequest {
|
|
81
|
+
model: string;
|
|
82
|
+
messages: ChatMessage[];
|
|
83
|
+
max_tokens: number;
|
|
84
|
+
system?: string;
|
|
85
|
+
temperature?: number;
|
|
86
|
+
top_p?: number;
|
|
87
|
+
stream?: boolean;
|
|
88
|
+
tools?: ChatTool[];
|
|
89
|
+
tool_choice?: {
|
|
90
|
+
type: "auto" | "any" | "tool";
|
|
91
|
+
name?: string;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export interface ChatResponse {
|
|
95
|
+
id: string;
|
|
96
|
+
type: "message";
|
|
97
|
+
role: "assistant";
|
|
98
|
+
content: ContentBlock[];
|
|
99
|
+
model: string;
|
|
100
|
+
stop_reason: string;
|
|
101
|
+
usage: {
|
|
102
|
+
input_tokens: number;
|
|
103
|
+
output_tokens: number;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export interface StreamMessageStart {
|
|
107
|
+
type: "message_start";
|
|
108
|
+
message: ChatResponse;
|
|
109
|
+
}
|
|
110
|
+
export interface StreamContentBlockStart {
|
|
111
|
+
type: "content_block_start";
|
|
112
|
+
index: number;
|
|
113
|
+
content_block: ContentBlock;
|
|
114
|
+
}
|
|
115
|
+
export interface StreamContentBlockDelta {
|
|
116
|
+
type: "content_block_delta";
|
|
117
|
+
index: number;
|
|
118
|
+
delta: {
|
|
119
|
+
type: "text_delta";
|
|
120
|
+
text: string;
|
|
121
|
+
} | {
|
|
122
|
+
type: "thinking_delta";
|
|
123
|
+
thinking: string;
|
|
124
|
+
} | {
|
|
125
|
+
type: "input_json_delta";
|
|
126
|
+
partial_json: string;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export interface StreamContentBlockStop {
|
|
130
|
+
type: "content_block_stop";
|
|
131
|
+
index: number;
|
|
132
|
+
}
|
|
133
|
+
export interface StreamMessageDelta {
|
|
134
|
+
type: "message_delta";
|
|
135
|
+
delta: {
|
|
136
|
+
stop_reason: string;
|
|
137
|
+
};
|
|
138
|
+
usage: {
|
|
139
|
+
output_tokens: number;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
export interface StreamMessageStop {
|
|
143
|
+
type: "message_stop";
|
|
144
|
+
}
|
|
145
|
+
export type StreamEvent = StreamMessageStart | StreamContentBlockStart | StreamContentBlockDelta | StreamContentBlockStop | StreamMessageDelta | StreamMessageStop;
|
|
146
|
+
export interface SpeechRequest {
|
|
147
|
+
model: string;
|
|
148
|
+
text: string;
|
|
149
|
+
voice_setting?: {
|
|
150
|
+
voice_id?: string;
|
|
151
|
+
speed?: number;
|
|
152
|
+
vol?: number;
|
|
153
|
+
pitch?: number;
|
|
154
|
+
};
|
|
155
|
+
audio_setting?: {
|
|
156
|
+
format?: string;
|
|
157
|
+
sample_rate?: number;
|
|
158
|
+
bitrate?: number;
|
|
159
|
+
channel?: number;
|
|
160
|
+
};
|
|
161
|
+
language_boost?: string;
|
|
162
|
+
pronunciation_dict?: Array<{
|
|
163
|
+
tone: string;
|
|
164
|
+
text: string;
|
|
165
|
+
}>;
|
|
166
|
+
output_format?: "url" | "hex";
|
|
167
|
+
stream?: boolean;
|
|
168
|
+
subtitle_enable?: boolean;
|
|
169
|
+
}
|
|
170
|
+
export interface SpeechResponse {
|
|
171
|
+
base_resp: BaseResp;
|
|
172
|
+
data: {
|
|
173
|
+
audio?: string;
|
|
174
|
+
audio_url?: string;
|
|
175
|
+
subtitle_file?: string;
|
|
176
|
+
status: number;
|
|
177
|
+
};
|
|
178
|
+
extra_info?: {
|
|
179
|
+
audio_length?: number;
|
|
180
|
+
audio_sample_rate?: number;
|
|
181
|
+
audio_size?: number;
|
|
182
|
+
bitrate?: number;
|
|
183
|
+
word_count?: number;
|
|
184
|
+
invisible_character_ratio?: number;
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
export interface SystemVoiceInfo {
|
|
188
|
+
voice_id: string;
|
|
189
|
+
voice_name: string;
|
|
190
|
+
description: string[];
|
|
191
|
+
}
|
|
192
|
+
export interface ImageRequest {
|
|
193
|
+
model: string;
|
|
194
|
+
prompt: string;
|
|
195
|
+
aspect_ratio?: string;
|
|
196
|
+
n?: number;
|
|
197
|
+
seed?: number;
|
|
198
|
+
width?: number;
|
|
199
|
+
height?: number;
|
|
200
|
+
prompt_optimizer?: boolean;
|
|
201
|
+
aigc_watermark?: boolean;
|
|
202
|
+
response_format?: "url" | "base64";
|
|
203
|
+
subject_reference?: Array<{
|
|
204
|
+
type: string;
|
|
205
|
+
image_url?: string;
|
|
206
|
+
image_file?: string;
|
|
207
|
+
}>;
|
|
208
|
+
}
|
|
209
|
+
export interface ImageResponse {
|
|
210
|
+
base_resp: BaseResp;
|
|
211
|
+
data: {
|
|
212
|
+
image_urls?: string[];
|
|
213
|
+
image_base64?: string[];
|
|
214
|
+
task_id: string;
|
|
215
|
+
success_count: number;
|
|
216
|
+
failed_count: number;
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
export interface VideoRequest {
|
|
220
|
+
model: string;
|
|
221
|
+
prompt: string;
|
|
222
|
+
first_frame_image?: string;
|
|
223
|
+
last_frame_image?: string;
|
|
224
|
+
callback_url?: string;
|
|
225
|
+
subject_reference?: Array<{
|
|
226
|
+
type: string;
|
|
227
|
+
image: string[];
|
|
228
|
+
}>;
|
|
229
|
+
}
|
|
230
|
+
export interface VideoResponse {
|
|
231
|
+
base_resp: BaseResp;
|
|
232
|
+
task_id: string;
|
|
233
|
+
status: string;
|
|
234
|
+
}
|
|
235
|
+
export interface VideoTaskResponse {
|
|
236
|
+
base_resp: BaseResp;
|
|
237
|
+
task_id: string;
|
|
238
|
+
status: "Queueing" | "Processing" | "Success" | "Failed" | "Unknown";
|
|
239
|
+
file_id?: string;
|
|
240
|
+
video_width?: number;
|
|
241
|
+
video_height?: number;
|
|
242
|
+
}
|
|
243
|
+
export interface MusicRequest {
|
|
244
|
+
model: string;
|
|
245
|
+
prompt?: string;
|
|
246
|
+
lyrics?: string;
|
|
247
|
+
is_instrumental?: boolean;
|
|
248
|
+
lyrics_optimizer?: boolean;
|
|
249
|
+
audio_url?: string;
|
|
250
|
+
audio_base64?: string;
|
|
251
|
+
seed?: number;
|
|
252
|
+
audio_setting?: {
|
|
253
|
+
format?: string;
|
|
254
|
+
sample_rate?: number;
|
|
255
|
+
bitrate?: number;
|
|
256
|
+
channel?: number;
|
|
257
|
+
};
|
|
258
|
+
output_format?: "url" | "hex";
|
|
259
|
+
stream?: boolean;
|
|
260
|
+
aigc_watermark?: boolean;
|
|
261
|
+
}
|
|
262
|
+
export interface MusicResponse {
|
|
263
|
+
base_resp: BaseResp;
|
|
264
|
+
data: {
|
|
265
|
+
audio?: string;
|
|
266
|
+
audio_url?: string;
|
|
267
|
+
status: number;
|
|
268
|
+
};
|
|
269
|
+
extra_info?: {
|
|
270
|
+
audio_length?: number;
|
|
271
|
+
audio_sample_rate?: number;
|
|
272
|
+
audio_size?: number;
|
|
273
|
+
bitrate?: number;
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
export interface QuotaResponse {
|
|
277
|
+
model_remains: QuotaModelRemain[];
|
|
278
|
+
}
|
|
279
|
+
export interface QuotaModelRemain {
|
|
280
|
+
model_name: string;
|
|
281
|
+
start_time: number;
|
|
282
|
+
end_time: number;
|
|
283
|
+
remains_time: number;
|
|
284
|
+
current_interval_total_count: number;
|
|
285
|
+
current_interval_usage_count: number;
|
|
286
|
+
current_weekly_total_count: number;
|
|
287
|
+
current_weekly_usage_count: number;
|
|
288
|
+
weekly_start_time: number;
|
|
289
|
+
weekly_end_time: number;
|
|
290
|
+
weekly_remains_time: number;
|
|
291
|
+
}
|
|
292
|
+
export interface BaseResp {
|
|
293
|
+
status_code: number;
|
|
294
|
+
status_msg: string;
|
|
295
|
+
}
|
|
296
|
+
declare class TextSDK extends Client {
|
|
297
|
+
private chatStream;
|
|
298
|
+
chat(request: Partial<ChatRequest> & {
|
|
299
|
+
stream: true;
|
|
300
|
+
}): Promise<AsyncGenerator<StreamEvent>>;
|
|
301
|
+
chat(request: Partial<ChatRequest>): Promise<ChatResponse>;
|
|
302
|
+
private validateParams;
|
|
303
|
+
}
|
|
304
|
+
declare class SpeechSDK extends Client {
|
|
305
|
+
synthesize(request: ModelPartial<SpeechRequest> & {
|
|
306
|
+
stream: true;
|
|
307
|
+
}): Promise<AsyncGenerator<SpeechResponse>>;
|
|
308
|
+
synthesize(request: ModelPartial<SpeechRequest>): Promise<SpeechResponse>;
|
|
309
|
+
private synthesizeStream;
|
|
310
|
+
voices(language?: string): Promise<SystemVoiceInfo[]>;
|
|
311
|
+
private validateParams;
|
|
312
|
+
}
|
|
313
|
+
declare class ImageSDK extends Client {
|
|
314
|
+
generate(request: ModelPartial<ImageRequest>): Promise<ImageResponse>;
|
|
315
|
+
private validateParams;
|
|
316
|
+
}
|
|
317
|
+
export interface VideoAsyncGenerateRequest extends ModelPartial<VideoRequest> {
|
|
318
|
+
async?: boolean;
|
|
319
|
+
pollInterval?: number;
|
|
320
|
+
timeout?: number;
|
|
321
|
+
}
|
|
322
|
+
export interface VideoDownloadRequest {
|
|
323
|
+
fileId: string;
|
|
324
|
+
outPath: string;
|
|
325
|
+
}
|
|
326
|
+
declare class VideoSDK extends Client {
|
|
327
|
+
generate(request: VideoAsyncGenerateRequest & {
|
|
328
|
+
async: true;
|
|
329
|
+
}): Promise<{
|
|
330
|
+
taskId: string;
|
|
331
|
+
}>;
|
|
332
|
+
generate(request: ModelPartial<VideoAsyncGenerateRequest>): Promise<VideoResponse>;
|
|
333
|
+
getTask({ taskId }: {
|
|
334
|
+
taskId: string;
|
|
335
|
+
}): Promise<VideoTaskResponse>;
|
|
336
|
+
download(request: VideoDownloadRequest): Promise<{
|
|
337
|
+
size: number;
|
|
338
|
+
save: string;
|
|
339
|
+
downloadUrl: string;
|
|
340
|
+
}>;
|
|
341
|
+
private validateParams;
|
|
342
|
+
}
|
|
343
|
+
export interface MusicGenerateRequest extends MusicRequest {
|
|
344
|
+
/** Vocal style, e.g. "warm male baritone", "bright female soprano", "duet with harmonies" */
|
|
345
|
+
vocals?: string;
|
|
346
|
+
/** Music genre, e.g. folk, pop, jazz */
|
|
347
|
+
genre?: string;
|
|
348
|
+
/** Mood or emotion, e.g. warm, melancholic, uplifting */
|
|
349
|
+
mood?: string;
|
|
350
|
+
/** Instruments to feature, e.g. "acoustic guitar, piano" */
|
|
351
|
+
instruments?: string;
|
|
352
|
+
/** Tempo description, e.g. fast, slow, moderate */
|
|
353
|
+
tempo?: string;
|
|
354
|
+
/** Exact tempo in beats per minute */
|
|
355
|
+
bpm?: number;
|
|
356
|
+
/** Musical key, e.g. C major, A minor, G sharp */
|
|
357
|
+
key?: string;
|
|
358
|
+
/** Elements to avoid in the generated music */
|
|
359
|
+
avoid?: string;
|
|
360
|
+
/** Use case context, e.g. "background music for video", "theme song" */
|
|
361
|
+
use_case?: string;
|
|
362
|
+
/** Song structure, e.g. "verse-chorus-verse-bridge-chorus" */
|
|
363
|
+
structure?: string;
|
|
364
|
+
/** Reference tracks or artists, e.g. "similar to Ed Sheeran, Taylor Swift" */
|
|
365
|
+
references?: string;
|
|
366
|
+
/** Additional fine-grained requirements not covered above */
|
|
367
|
+
extra?: string;
|
|
368
|
+
/** Generate instrumental music (no vocals) */
|
|
369
|
+
instrumental?: boolean;
|
|
370
|
+
/** Use case */
|
|
371
|
+
useCase?: string;
|
|
372
|
+
}
|
|
373
|
+
declare class MusicSDK extends Client {
|
|
374
|
+
private generateStream;
|
|
375
|
+
generate(request: ModelPartial<MusicGenerateRequest> & {
|
|
376
|
+
stream: true;
|
|
377
|
+
}): Promise<AsyncGenerator<Uint8Array<ArrayBuffer>>>;
|
|
378
|
+
generate(request: ModelPartial<MusicGenerateRequest>): Promise<MusicResponse>;
|
|
379
|
+
private buildPrompt;
|
|
380
|
+
private validateParams;
|
|
381
|
+
}
|
|
382
|
+
export interface SearchResult {
|
|
383
|
+
title: string;
|
|
384
|
+
link: string;
|
|
385
|
+
snippet: string;
|
|
386
|
+
date: string;
|
|
387
|
+
}
|
|
388
|
+
export interface SearchResponse {
|
|
389
|
+
organic: SearchResult[];
|
|
390
|
+
}
|
|
391
|
+
declare class SearchSDK extends Client {
|
|
392
|
+
query(query: string): Promise<SearchResponse>;
|
|
393
|
+
}
|
|
394
|
+
export interface VlmResponse {
|
|
395
|
+
content: string;
|
|
396
|
+
}
|
|
397
|
+
export interface ImageDescribeRequest {
|
|
398
|
+
prompt?: string;
|
|
399
|
+
image: string;
|
|
400
|
+
}
|
|
401
|
+
declare class VisionSDK extends Client {
|
|
402
|
+
describe(request: ImageDescribeRequest): Promise<VlmResponse>;
|
|
403
|
+
}
|
|
404
|
+
declare class QuotaSDK extends Client {
|
|
405
|
+
info(): Promise<QuotaResponse>;
|
|
406
|
+
}
|
|
407
|
+
export declare class MiniMaxSDK extends Client {
|
|
408
|
+
readonly text: TextSDK;
|
|
409
|
+
readonly speech: SpeechSDK;
|
|
410
|
+
readonly image: ImageSDK;
|
|
411
|
+
readonly video: VideoSDK;
|
|
412
|
+
readonly music: MusicSDK;
|
|
413
|
+
readonly search: SearchSDK;
|
|
414
|
+
readonly vision: VisionSDK;
|
|
415
|
+
readonly quota: QuotaSDK;
|
|
416
|
+
constructor(options: MiniMaxSDKOptions);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export {};
|