mmx-cli 1.0.13 → 1.0.14

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 CHANGED
@@ -45,7 +45,10 @@ npm install -g mmx-cli
45
45
  ## Quick Start
46
46
 
47
47
  ```bash
48
- # Authenticate
48
+ # Authenticate (interactive — choose MiniMax OAuth or paste an API key)
49
+ mmx auth login
50
+
51
+ # Or non-interactive
49
52
  mmx auth login --api-key sk-xxxxx
50
53
 
51
54
  # Start creating
@@ -130,16 +133,21 @@ mmx search query --q "latest news" --output json
130
133
  ### `mmx auth`
131
134
 
132
135
  ```bash
133
- mmx auth login --api-key sk-xxxxx
134
- mmx auth login # OAuth browser flow
136
+ mmx auth login # interactive: pick OAuth (Global / China) or paste an API key
137
+ mmx auth login --api-key sk-xxxxx # save an API key directly
138
+ mmx auth login --recommend # skip the menu, pick OAuth region interactively
139
+ mmx auth login --recommend --region=global # OAuth → api.minimax.io
140
+ mmx auth login --recommend --region=cn # OAuth → api.minimaxi.com
135
141
  mmx auth status
136
142
  mmx auth refresh
137
143
  mmx auth logout
138
144
  ```
139
145
 
140
146
  `mmx auth status` is the canonical way to verify active authentication.
141
- `~/.mmx/credentials.json` exists only for OAuth login. API-key login persists to
142
- `~/.mmx/config.json` (and `--api-key` can also be passed per command).
147
+ Both OAuth and API-key credentials live in `~/.mmx/config.json` (the two are
148
+ mutually exclusive — logging in with one method clears the other). API keys
149
+ can also be passed per command via `--api-key`. With an API key, the region
150
+ is auto-detected by probing both Global and CN.
143
151
 
144
152
  ### `mmx config` · `mmx quota`
145
153
 
package/dist/index.d.ts CHANGED
@@ -289,6 +289,41 @@ export interface QuotaModelRemain {
289
289
  weekly_end_time: number;
290
290
  weekly_remains_time: number;
291
291
  }
292
+ export interface FileUploadResponse {
293
+ base_resp: BaseResp;
294
+ file: {
295
+ file_id: string;
296
+ bytes: number;
297
+ created_at: number;
298
+ filename: string;
299
+ purpose: string;
300
+ };
301
+ }
302
+ export interface FileListResponse {
303
+ base_resp: BaseResp;
304
+ files: Array<{
305
+ file_id: string;
306
+ bytes: number;
307
+ created_at: number;
308
+ filename: string;
309
+ purpose: string;
310
+ }>;
311
+ }
312
+ export interface FileDeleteResponse {
313
+ base_resp: BaseResp;
314
+ file_id: number;
315
+ }
316
+ export interface FileRetrieveResponse {
317
+ base_resp: BaseResp;
318
+ file: {
319
+ file_id: string;
320
+ bytes: number;
321
+ created_at: number;
322
+ filename: string;
323
+ purpose: string;
324
+ download_url?: string;
325
+ };
326
+ }
292
327
  export interface BaseResp {
293
328
  status_code: number;
294
329
  status_msg: string;
@@ -308,10 +343,41 @@ declare class SpeechSDK extends Client {
308
343
  synthesize(request: ModelPartial<SpeechRequest>): Promise<SpeechResponse>;
309
344
  private synthesizeStream;
310
345
  voices(language?: string): Promise<SystemVoiceInfo[]>;
346
+ /**
347
+ * Save synthesized speech audio to a file. Decodes the hex-encoded audio
348
+ * from the API response and writes it to disk. Creates intermediate
349
+ * directories as needed.
350
+ *
351
+ * @param response — The response from `synthesize()`.
352
+ * @param outPath — Target file path. Defaults to `speech_<timestamp>.mp3`.
353
+ * @param ext — File extension (default: `"mp3"`).
354
+ * @returns The absolute path of the saved file.
355
+ */
356
+ save(response: SpeechResponse, outPath?: string, ext?: string): string;
311
357
  private validateParams;
312
358
  }
359
+ export interface ImageSaveOptions {
360
+ /** Save to exact file path (single image only). */
361
+ out?: string;
362
+ /** Save images to directory (default: "."). */
363
+ outDir?: string;
364
+ /** Filename prefix (default: "image"). */
365
+ prefix?: string;
366
+ /** Response format used by generate() — "url" or "base64" (default: "url"). */
367
+ responseFormat?: "url" | "base64";
368
+ /** Suppress progress output. */
369
+ quiet?: boolean;
370
+ }
313
371
  declare class ImageSDK extends Client {
314
372
  generate(request: ModelPartial<ImageRequest>): Promise<ImageResponse>;
373
+ /**
374
+ * Download and save images from a `generate()` response to disk.
375
+ *
376
+ * Handles both `"url"` (CDN download) and `"base64"` response formats
377
+ * and creates intermediate directories as needed. Returns the absolute
378
+ * paths of all saved files.
379
+ */
380
+ save(response: ImageResponse, options?: ImageSaveOptions): Promise<string[]>;
315
381
  private validateParams;
316
382
  }
317
383
  export interface VideoAsyncGenerateRequest extends ModelPartial<VideoRequest> {
@@ -376,6 +442,17 @@ declare class MusicSDK extends Client {
376
442
  stream: true;
377
443
  }): Promise<AsyncGenerator<Uint8Array<ArrayBuffer>>>;
378
444
  generate(request: ModelPartial<MusicGenerateRequest>): Promise<MusicResponse>;
445
+ /**
446
+ * Save generated music audio to a file. Decodes the hex-encoded audio
447
+ * from the API response and writes it to disk. Creates intermediate
448
+ * directories as needed.
449
+ *
450
+ * @param response — The response from `generate()`.
451
+ * @param outPath — Target file path. Defaults to `music_<timestamp>.mp3`.
452
+ * @param ext — File extension (default: `"mp3"`).
453
+ * @returns The absolute path of the saved file.
454
+ */
455
+ save(response: MusicResponse, outPath?: string, ext?: string): string;
379
456
  private buildPrompt;
380
457
  private validateParams;
381
458
  }
@@ -404,6 +481,29 @@ declare class VisionSDK extends Client {
404
481
  declare class QuotaSDK extends Client {
405
482
  info(): Promise<QuotaResponse>;
406
483
  }
484
+ declare class FileSDK extends Client {
485
+ /**
486
+ * Upload a file to MiniMax storage.
487
+ *
488
+ * @param filePath - Absolute or relative path to the file on disk.
489
+ * @param purpose - File purpose, defaults to `"retrieval"`.
490
+ */
491
+ upload(filePath: string, purpose?: string): Promise<FileUploadResponse>;
492
+ /** List all files in MiniMax storage. */
493
+ list(): Promise<FileListResponse>;
494
+ /**
495
+ * Delete a file from MiniMax storage by its file ID.
496
+ *
497
+ * @param fileId - The ID of the file to delete (string or number).
498
+ */
499
+ delete(fileId: string | number): Promise<FileDeleteResponse>;
500
+ /**
501
+ * Retrieve metadata (and optional download URL) for a file.
502
+ *
503
+ * @param fileId - The ID of the file to retrieve.
504
+ */
505
+ retrieve(fileId: string): Promise<FileRetrieveResponse>;
506
+ }
407
507
  export declare class MiniMaxSDK extends Client {
408
508
  readonly text: TextSDK;
409
509
  readonly speech: SpeechSDK;
@@ -413,6 +513,7 @@ export declare class MiniMaxSDK extends Client {
413
513
  readonly search: SearchSDK;
414
514
  readonly vision: VisionSDK;
415
515
  readonly quota: QuotaSDK;
516
+ readonly file: FileSDK;
416
517
  constructor(options: MiniMaxSDKOptions);
417
518
  }
418
519