@j-o-r/hello-dave 0.0.9 → 0.1.0

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.
Files changed (82) hide show
  1. package/README.md +2 -0
  2. package/README.md.bak.1779452127 +240 -0
  3. package/TODO.md +31 -20
  4. package/agents/code_agent.js +6 -6
  5. package/agents/daisy_agent.js +10 -7
  6. package/agents/minimax.js +173 -0
  7. package/agents/spawn_agent.js +33 -10
  8. package/agents/stability.js +173 -0
  9. package/bin/codeDave +1 -1
  10. package/bin/dave.js +1 -1
  11. package/docs/dependencies.md +7 -0
  12. package/docs/music-toolsets.md +137 -0
  13. package/docs/plans/minimax-music-generation.md +80 -0
  14. package/docs/plans/unified-agent-architecture.md +146 -0
  15. package/docs/plans/websocket-streaming-plan.md.bak +317 -0
  16. package/docs/prompt/spawn_agent.md +46 -44
  17. package/docs/prompt/task_clarification_and_documentation.md +35 -0
  18. package/docs/todo-archive-infra-2026-04-21.md +15 -0
  19. package/docs/todo-archive-v0.1.0.md +32 -0
  20. package/lib/API/minimax/ImageToolset.js +169 -0
  21. package/lib/API/minimax/MusicToolset.js +290 -0
  22. package/lib/API/minimax/VideoToolset.js +296 -0
  23. package/lib/API/minimax/image.generation.md +239 -0
  24. package/lib/API/minimax/image.js +219 -0
  25. package/lib/API/minimax/image.to.image.md +257 -0
  26. package/lib/API/minimax/index.js +16 -0
  27. package/lib/API/minimax/music.cover.preprocess.md +206 -0
  28. package/lib/API/minimax/music.generation.md +346 -0
  29. package/lib/API/minimax/music.js +257 -0
  30. package/lib/API/minimax/music.lyrics.generation.md +205 -0
  31. package/lib/API/minimax/video.download.md +133 -0
  32. package/lib/API/minimax/video.first.last.image.md +186 -0
  33. package/lib/API/minimax/video.from.image.md +206 -0
  34. package/lib/API/minimax/video.from.subject.md +164 -0
  35. package/lib/API/minimax/video.generation.md +192 -0
  36. package/lib/API/minimax/video.js +339 -0
  37. package/lib/API/minimax/video.query.md +128 -0
  38. package/lib/API/stability.ai/ImageToolset.js +357 -0
  39. package/lib/API/stability.ai/MusicToolset.js +302 -0
  40. package/lib/API/stability.ai/audio-3.md +205 -0
  41. package/lib/API/stability.ai/audio.js +679 -0
  42. package/lib/API/stability.ai/image.js +911 -0
  43. package/lib/API/stability.ai/image.md +271 -0
  44. package/lib/API/stability.ai/index.js +11 -0
  45. package/lib/API/stability.ai/openapi.json +17118 -0
  46. package/lib/API/x.ai/ImageToolset.js +165 -0
  47. package/lib/API/x.ai/image.editing.md +86 -0
  48. package/lib/API/x.ai/image.js +393 -0
  49. package/lib/API/x.ai/image.md +213 -0
  50. package/lib/API/x.ai/image.to.generation.md +494 -0
  51. package/lib/API/x.ai/image.to.video.md +23 -0
  52. package/lib/API/x.ai/index.js +9 -0
  53. package/lib/AgentManager.js +1 -1
  54. package/lib/CdnToolset.js +191 -0
  55. package/lib/ToolSet.js +19 -1
  56. package/lib/cdn.js +373 -0
  57. package/lib/fafs.js +5 -3
  58. package/lib/genericToolset.js +75 -210
  59. package/lib/index.js +9 -1
  60. package/package.json +2 -2
  61. package/types/API/minimax/ImageToolset.d.ts +3 -0
  62. package/types/API/minimax/MusicToolset.d.ts +3 -0
  63. package/types/API/minimax/VideoToolset.d.ts +3 -0
  64. package/types/API/minimax/image.d.ts +109 -0
  65. package/types/API/minimax/index.d.ts +15 -0
  66. package/types/API/minimax/music.d.ts +46 -0
  67. package/types/API/minimax/video.d.ts +165 -0
  68. package/types/API/stability.ai/ImageToolset.d.ts +3 -0
  69. package/types/API/stability.ai/MusicToolset.d.ts +3 -0
  70. package/types/API/stability.ai/audio.d.ts +193 -0
  71. package/types/API/stability.ai/image.d.ts +274 -0
  72. package/types/API/stability.ai/index.d.ts +11 -0
  73. package/types/API/x.ai/ImageToolset.d.ts +3 -0
  74. package/types/API/x.ai/image.d.ts +82 -0
  75. package/types/API/x.ai/index.d.ts +9 -0
  76. package/types/AgentManager.d.ts +1 -1
  77. package/types/CdnToolset.d.ts +20 -0
  78. package/types/ToolSet.d.ts +8 -0
  79. package/types/cdn.d.ts +141 -0
  80. package/types/index.d.ts +8 -2
  81. package/utils/syntax_check.sh +59 -15
  82. package/docs/multi-agent-clusters.md.bak +0 -229
@@ -0,0 +1,219 @@
1
+ /**
2
+ * @file lib/API/minimax/image.js
3
+ * @module minimax/image
4
+ * @description Pure HTTP wrapper for the Minimax Image Generation API.
5
+ * Fully aligned with the official documentation:
6
+ * - lib/API/minimax/image.generation.md
7
+ * - lib/API/minimax/image.to.image.md
8
+ *
9
+ * This is a **new library** — only the current response format is supported.
10
+ * No backward compatibility with legacy response structures.
11
+ *
12
+ * This module only handles communication with Minimax endpoints.
13
+ * It does NOT handle file publishing, SSH, or CDN logic.
14
+ *
15
+ * For publishing generated or reference files to a remote CDN,
16
+ * use the reusable `lib/cdn.js` module instead.
17
+ */
18
+
19
+ import { request as doRequest } from '@j-o-r/apiserver';
20
+ import fs from 'fs/promises';
21
+ import path from 'path';
22
+
23
+ const BASE_URL = 'https://api.minimax.io/v1';
24
+
25
+ // All temporary files (audio, images, video) are saved under this directory
26
+ const TMP_DIR = path.join(process.cwd(), '.cache', 'minimax');
27
+
28
+ /**
29
+ * Get authentication headers for Minimax API.
30
+ *
31
+ * @returns {Object} Headers object with Authorization Bearer token.
32
+ * @throws {Error} If MINIMAX_API_KEY environment variable is not set.
33
+ */
34
+ const getHeaders = () => {
35
+ if (!process.env.MINIMAX_API_KEY) {
36
+ throw new Error('Missing MINIMAX_API_KEY! Please export MINIMAX_API_KEY=your_key');
37
+ }
38
+ return {
39
+ 'Content-Type': 'application/json',
40
+ 'Authorization': `Bearer ${process.env.MINIMAX_API_KEY}`
41
+ };
42
+ };
43
+
44
+ /**
45
+ * Saves image data (either URL or base64) to a local temporary file.
46
+ * Handles both `response_format: 'url'` and `response_format: 'base64'`.
47
+ * Supports data URL prefix for base64.
48
+ *
49
+ * @param {string} imageData - Either a URL or a base64-encoded string (with or without data: prefix).
50
+ * @param {string} [filenamePrefix='minimax-image'] - Prefix for the local filename.
51
+ * @param {number} [index=0] - Index for multiple images to avoid filename collisions.
52
+ * @returns {Promise<string>} Absolute path to the saved local file.
53
+ */
54
+ async function saveImageToLocal(imageData, filenamePrefix = 'minimax-image', index = 0) {
55
+ const tmpDir = path.join(process.cwd(), '.cache', 'minimax');
56
+ await fs.mkdir(tmpDir, { recursive: true });
57
+
58
+ const filename = `${filenamePrefix}-${Date.now()}-${index}.png`;
59
+ const localPath = path.join(tmpDir, filename);
60
+
61
+ if (typeof imageData === 'string' && imageData.startsWith('http')) {
62
+ // URL case
63
+ const response = await fetch(imageData);
64
+ if (!response.ok) {
65
+ throw new Error(`Failed to download image: ${response.status} ${response.statusText}`);
66
+ }
67
+ const buffer = Buffer.from(await response.arrayBuffer());
68
+ await fs.writeFile(localPath, buffer);
69
+ } else if (typeof imageData === 'string') {
70
+ // Base64 case (with or without data: prefix)
71
+ let base64Data = imageData;
72
+ if (imageData.startsWith('data:')) {
73
+ base64Data = imageData.split(',')[1];
74
+ }
75
+ const buffer = Buffer.from(base64Data, 'base64');
76
+ await fs.writeFile(localPath, buffer);
77
+ } else {
78
+ throw new Error('Invalid image data provided to saveImageToLocal');
79
+ }
80
+
81
+ return localPath;
82
+ }
83
+
84
+ /**
85
+ * Core image generation request (supports both Text-to-Image and Image-to-Image).
86
+ *
87
+ * Fully implements the official Minimax Image Generation API
88
+ * as documented in `lib/API/minimax/image.generation.md` and `image.to.image.md`.
89
+ *
90
+ * Uses the single endpoint `/v1/image_generation`.
91
+ *
92
+ * Supports all models, parameters, and response formats.
93
+ *
94
+ * @param {string} prompt - Text description of the image, max 1500 characters.
95
+ * @param {Object} [options] - All available options from the official spec.
96
+ *
97
+ * @param {string} [options.model='image-01'] - Model to use.
98
+ * Supported values:
99
+ * - 'image-01' (default, text-to-image and img2img)
100
+ * - 'image-01-live' (for image-to-image)
101
+ *
102
+ * @param {string} [options.aspect_ratio='1:1'] - Image aspect ratio.
103
+ * Options: '1:1', '16:9', '4:3', '3:2', '2:3', '3:4', '9:16', '21:9'
104
+ *
105
+ * @param {number} [options.width] - Image width in px (512-2048, divisible by 8).
106
+ * Only effective for model 'image-01'. aspect_ratio takes priority if both provided.
107
+ *
108
+ * @param {number} [options.height] - Image height in px (same rules as width).
109
+ *
110
+ * @param {string} [options.response_format='url'] - 'url' or 'base64'.
111
+ * Default is `'url'` (user preference).
112
+ * ⚠️ `url` links expire after 24 hours.
113
+ *
114
+ * @param {number} [options.seed] - Random seed for reproducibility.
115
+ *
116
+ * @param {number} [options.n=1] - Number of images to generate (1-9).
117
+ *
118
+ * @param {boolean} [options.prompt_optimizer=false] - Enable automatic prompt optimization.
119
+ *
120
+ * @param {Array<Object>} [options.subject_reference] - For Image-to-Image.
121
+ * Array of subject references. Currently supports:
122
+ * - { type: 'character', image_file: 'https://...' or 'data:image/...;base64,...' }
123
+ *
124
+ * @param {Object} [options.extra] - Any additional parameters not yet documented.
125
+ *
126
+ * @returns {Promise<{
127
+ * image_urls: string[], // Array from data.image_urls (if url format)
128
+ * image_base64: string[], // Array from data.image_base64 (if base64 format)
129
+ * local_paths: string[], // Absolute paths to saved files
130
+ * metadata: Object, // { success_count, failed_count }
131
+ * id: string, // Trace ID
132
+ * duration: number, // API call duration in milliseconds
133
+ * raw: object // Full raw response
134
+ * }>}
135
+ *
136
+ * @example
137
+ * // Text-to-Image (basic)
138
+ * const result = await requestImage("A serene mountain landscape at sunset", {
139
+ * model: "image-01",
140
+ * aspect_ratio: "16:9",
141
+ * n: 2
142
+ * });
143
+ *
144
+ * @example
145
+ * // Image-to-Image
146
+ * const result = await requestImage("A girl looking into the distance", {
147
+ * model: "image-01",
148
+ * subject_reference: [{
149
+ * type: "character",
150
+ * image_file: "https://example.com/portrait.jpg"
151
+ * }],
152
+ * n: 1
153
+ * });
154
+ */
155
+ async function requestImage(prompt, options = {}) {
156
+ const headers = getHeaders();
157
+ const url = `${BASE_URL}/image_generation`;
158
+
159
+ const body = {
160
+ model: options.model || 'image-01',
161
+ prompt: prompt,
162
+ aspect_ratio: options.aspect_ratio || '1:1',
163
+ response_format: options.response_format || 'url', // User preference: URL as default
164
+ n: options.n ?? 1,
165
+ prompt_optimizer: options.prompt_optimizer ?? false,
166
+ ...options.extra
167
+ };
168
+
169
+ if (options.width !== undefined) body.width = options.width;
170
+ if (options.height !== undefined) body.height = options.height;
171
+ if (options.seed !== undefined) body.seed = options.seed;
172
+ if (options.subject_reference) body.subject_reference = options.subject_reference;
173
+
174
+ const start = Date.now();
175
+ const res = await doRequest(url, 'POST', headers, body);
176
+ const duration = Date.now() - start;
177
+
178
+ if (res.status !== 200) {
179
+ throw new Error(`Minimax API error ${res.status}: ${JSON.stringify(res.response)}`);
180
+ }
181
+
182
+ const respData = res.response?.data || {};
183
+ const metadata = res.response?.metadata || {};
184
+ const traceId = res.response?.id;
185
+
186
+ let imageDataArray = [];
187
+
188
+ if (respData.image_urls && Array.isArray(respData.image_urls) && respData.image_urls.length > 0) {
189
+ imageDataArray = respData.image_urls;
190
+ } else if (respData.image_base64 && Array.isArray(respData.image_base64) && respData.image_base64.length > 0) {
191
+ imageDataArray = respData.image_base64;
192
+ }
193
+
194
+ if (imageDataArray.length === 0) {
195
+ throw new Error('No image data found in data.image_urls or data.image_base64 of Minimax response');
196
+ }
197
+
198
+ const localPaths = [];
199
+ for (let i = 0; i < imageDataArray.length; i++) {
200
+ const localPath = await saveImageToLocal(imageDataArray[i], 'minimax-image', i);
201
+ localPaths.push(localPath);
202
+ }
203
+
204
+ return {
205
+ image_urls: respData.image_urls || [],
206
+ image_base64: respData.image_base64 || [],
207
+ local_paths: localPaths,
208
+ metadata,
209
+ id: traceId,
210
+ duration,
211
+ raw: res.response
212
+ };
213
+ }
214
+
215
+ export {
216
+ getHeaders,
217
+ saveImageToLocal,
218
+ requestImage
219
+ };
@@ -0,0 +1,257 @@
1
+ > ## Documentation Index
2
+ > Fetch the complete documentation index at: https://platform.minimax.io/docs/llms.txt
3
+ > Use this file to discover all available pages before exploring further.
4
+
5
+ # Image-to-Image Generation
6
+
7
+ > Use this API to generate images from image input.
8
+
9
+
10
+
11
+ ## OpenAPI
12
+
13
+ ````yaml /api-reference/image/generation/api/image-to-image.json POST /v1/image_generation
14
+ openapi: 3.1.0
15
+ info:
16
+ title: MiniMax Image Generation API
17
+ description: MiniMax image generation API for creating images from text prompts
18
+ license:
19
+ name: MIT
20
+ version: 1.0.0
21
+ servers:
22
+ - url: https://api.minimax.io
23
+ security:
24
+ - bearerAuth: []
25
+ paths:
26
+ /v1/image_generation:
27
+ post:
28
+ tags:
29
+ - Image
30
+ summary: Image Generation
31
+ operationId: imageGeneration
32
+ parameters:
33
+ - name: Content-Type
34
+ in: header
35
+ required: true
36
+ description: >-
37
+ The media type of the request body. Must be set to
38
+ `application/json` to ensure the data is sent in JSON format.
39
+ schema:
40
+ type: string
41
+ enum:
42
+ - application/json
43
+ default: application/json
44
+ requestBody:
45
+ description: ''
46
+ content:
47
+ application/json:
48
+ schema:
49
+ $ref: '#/components/schemas/ImageGenerationReq'
50
+ required: true
51
+ responses:
52
+ '200':
53
+ description: ''
54
+ content:
55
+ application/json:
56
+ schema:
57
+ $ref: '#/components/schemas/ImageGenerationResp'
58
+ components:
59
+ schemas:
60
+ ImageGenerationReq:
61
+ type: object
62
+ required:
63
+ - prompt
64
+ - model
65
+ properties:
66
+ model:
67
+ type: string
68
+ description: 'Model name. Options: `image-01`.'
69
+ enum:
70
+ - image-01
71
+ - image-01-live
72
+ prompt:
73
+ type: string
74
+ description: Text description of the image, max length 1500 characters.
75
+ subject_reference:
76
+ type: array
77
+ items:
78
+ $ref: '#/components/schemas/ImageSubjectReference'
79
+ description: Subject reference for image-to-image generation.
80
+ aspect_ratio:
81
+ type: string
82
+ description: |-
83
+ Image aspect ratio, default `1:1`. Options:
84
+ - `1:1` (1024x1024)
85
+ - `16:9` (1280x720)
86
+ - `4:3` (1152x864)
87
+ - `3:2` (1248x832)
88
+ - `2:3` (832x1248)
89
+ - `3:4` (864x1152)
90
+ - `9:16` (720x1280)
91
+ - `21:9` (1344x576)
92
+ enum:
93
+ - '1:1'
94
+ - '16:9'
95
+ - '4:3'
96
+ - '3:2'
97
+ - '2:3'
98
+ - '3:4'
99
+ - '9:16'
100
+ - '21:9'
101
+ width:
102
+ type: integer
103
+ description: >-
104
+ Image width (px). Only effective for `image-01`. Must be set
105
+ together with `height`. Range [512, 2048], must be divisible by 8.
106
+ If both `width/height` and `aspect_ratio` are provided,
107
+ `aspect_ratio` takes priority.
108
+ height:
109
+ type: integer
110
+ description: >-
111
+ Height of generated image (pixels). Only effective when `model` is
112
+ `image-01`.
113
+
114
+ Same rules as `width`.
115
+ response_format:
116
+ type: string
117
+ enum:
118
+ - url
119
+ - base64
120
+ default: url
121
+ description: |-
122
+ Response format for images. Default: url. Options: url, base64.
123
+ ⚠️ Note: url expires in 24 hours.
124
+ seed:
125
+ type: integer
126
+ format: int64
127
+ description: >-
128
+ Random seed. Using the same seed and parameters allows result
129
+ reproduction.
130
+
131
+ If omitted, each of the n images will use a unique random seed.
132
+ 'n':
133
+ type: integer
134
+ default: 1
135
+ minimum: 1
136
+ maximum: 9
137
+ description: 'Number of images to generate per request. Range [1, 9]. Default: 1.'
138
+ prompt_optimizer:
139
+ type: boolean
140
+ default: false
141
+ description: 'Enable automatic optimization of prompt. Default: `false`.'
142
+ example:
143
+ model: image-01
144
+ prompt: A girl looking into the distance from a library window
145
+ aspect_ratio: '16:9'
146
+ subject_reference:
147
+ - type: character
148
+ image_file: >-
149
+ https://cdn.hailuoai.com/prod/2025-08-12-17/video_cover/1754990600020238321-411603868533342214-cover.jpg
150
+ 'n': 2
151
+ ImageGenerationResp:
152
+ type: object
153
+ properties:
154
+ data:
155
+ $ref: '#/components/schemas/DataObject'
156
+ metadata:
157
+ type: object
158
+ properties:
159
+ success_count:
160
+ type: integer
161
+ description: Number of successfully generated images.
162
+ failed_count:
163
+ type: integer
164
+ description: Number of images blocked due to content safety.
165
+ description: Additional metadata about the generation.
166
+ id:
167
+ type: string
168
+ description: Trace ID for request tracking
169
+ base_resp:
170
+ $ref: '#/components/schemas/BaseResp'
171
+ example:
172
+ id: 03ff3cd0820949eb8a410056b5f21d38
173
+ data:
174
+ image_urls:
175
+ - XXX
176
+ - XXX
177
+ - XXX
178
+ metadata:
179
+ failed_count: '0'
180
+ success_count: '3'
181
+ base_resp:
182
+ status_code: 0
183
+ status_msg: success
184
+ ImageSubjectReference:
185
+ type: object
186
+ required:
187
+ - type
188
+ - image_file
189
+ properties:
190
+ type:
191
+ type: string
192
+ description: Subject type. Currently only supports `character` (portrait).
193
+ image_file:
194
+ type: string
195
+ description: "Reference image file. Supports public URLs or Base64-encoded [Data URL](https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/data) (`data:image/jpeg;base64,...`).\nFor best results, upload a single front-facing portrait photo.\n- Image requirements:\n\t- Formats: JPG, JPEG, PNG\n\t- Size: less than 10MB"
196
+ DataObject:
197
+ type: object
198
+ properties:
199
+ image_urls:
200
+ type: array
201
+ items:
202
+ type: string
203
+ description: >-
204
+ Returned when `response_format` = `url`, contains an array of image
205
+ links.
206
+ image_base64:
207
+ type: array
208
+ items:
209
+ type: string
210
+ description: >-
211
+ Returned when `response_format` = `base64`, contains an array of
212
+ base64-encoded images.
213
+ BaseResp:
214
+ type: object
215
+ properties:
216
+ status_code:
217
+ type: integer
218
+ description: >-
219
+ The status codes and their meanings are as follows:
220
+
221
+ - `0`, Request successful
222
+
223
+ - `1002`, Rate limit triggered, please try again later
224
+
225
+ - `1004`, Account authentication failed, please check if the API Key
226
+ is correct
227
+
228
+ - `1008`, Insufficient account balance
229
+
230
+ - `1026`, Sensitive content detected in prompt
231
+
232
+ - `2013`, Invalid input parameters, please check if the parameters
233
+ are filled in as required
234
+
235
+ - `2049`, Invalid API key
236
+
237
+
238
+ For more information, please refer to the [Error Code
239
+ Reference](/api-reference/errorcode).
240
+ status_msg:
241
+ type: string
242
+ description: Status details.
243
+ securitySchemes:
244
+ bearerAuth:
245
+ type: http
246
+ scheme: bearer
247
+ bearerFormat: JWT
248
+ description: >-
249
+ `HTTP: Bearer Auth`
250
+
251
+ - Security Scheme Type: http
252
+
253
+ - HTTP Authorization Scheme: `Bearer API_key`, can be found in [Account
254
+ Management>API
255
+ Keys](https://platform.minimax.io/user-center/basic-information/interface-key).
256
+
257
+ ````
@@ -0,0 +1,16 @@
1
+ import * as music from './music.js';
2
+ import * as image from './image.js';
3
+ import * as video from './video.js';
4
+
5
+ import musicToolset from './MusicToolset.js'
6
+ import videoToolset from './VideoToolset.js'
7
+ import imageToolset from './ImageToolset.js'
8
+
9
+ export default {
10
+ music,
11
+ musicToolset,
12
+ video,
13
+ videoToolset,
14
+ image,
15
+ imageToolset
16
+ }
@@ -0,0 +1,206 @@
1
+ > ## Documentation Index
2
+ > Fetch the complete documentation index at: https://platform.minimax.io/docs/llms.txt
3
+ > Use this file to discover all available pages before exploring further.
4
+
5
+ # Music Cover Preprocess
6
+
7
+ > Preprocess reference audio to extract features and lyrics for two-step cover generation.
8
+
9
+
10
+
11
+ ## OpenAPI
12
+
13
+ ````yaml POST /v1/music_cover_preprocess
14
+ openapi: 3.1.0
15
+ info:
16
+ title: MiniMax Music Generation API
17
+ description: >-
18
+ MiniMax music generation API with support for creating music from text
19
+ prompts and lyrics
20
+ license:
21
+ name: MIT
22
+ version: 1.0.0
23
+ servers:
24
+ - url: https://api.minimax.io
25
+ security:
26
+ - bearerAuth: []
27
+ paths:
28
+ /v1/music_cover_preprocess:
29
+ post:
30
+ tags:
31
+ - Music
32
+ summary: Music Cover Preprocess
33
+ operationId: coverPreprocess
34
+ parameters:
35
+ - name: Content-Type
36
+ in: header
37
+ required: true
38
+ description: >-
39
+ The media type of the request body. Must be set to
40
+ `application/json` to ensure the data is sent in JSON format.
41
+ schema:
42
+ type: string
43
+ enum:
44
+ - application/json
45
+ default: application/json
46
+ requestBody:
47
+ content:
48
+ application/json:
49
+ schema:
50
+ $ref: '#/components/schemas/CoverPreprocessReq'
51
+ required: true
52
+ responses:
53
+ '200':
54
+ description: ''
55
+ content:
56
+ application/json:
57
+ schema:
58
+ $ref: '#/components/schemas/CoverPreprocessResp'
59
+ components:
60
+ schemas:
61
+ CoverPreprocessReq:
62
+ type: object
63
+ required:
64
+ - model
65
+ properties:
66
+ model:
67
+ type: string
68
+ description: Model name. Must be `music-cover`.
69
+ enum:
70
+ - music-cover
71
+ audio_url:
72
+ type: string
73
+ description: >-
74
+ URL of the reference audio. Exactly one of `audio_url` or
75
+ `audio_base64` must be provided.
76
+
77
+
78
+ Reference audio constraints:
79
+
80
+ - Duration: 6 seconds to 6 minutes
81
+
82
+ - Size: max 50 MB
83
+
84
+ - Format: common audio formats (mp3, wav, flac, etc.)
85
+ audio_base64:
86
+ type: string
87
+ description: >-
88
+ Base64-encoded reference audio. Exactly one of `audio_url` or
89
+ `audio_base64` must be provided.
90
+
91
+
92
+ Reference audio constraints:
93
+
94
+ - Duration: 6 seconds to 6 minutes
95
+
96
+ - Size: max 50 MB
97
+
98
+ - Format: common audio formats (mp3, wav, flac, etc.)
99
+ example:
100
+ model: music-cover
101
+ audio_url: https://example.com/song.mp3
102
+ CoverPreprocessResp:
103
+ type: object
104
+ properties:
105
+ cover_feature_id:
106
+ type: string
107
+ description: >-
108
+ Unique identifier for the preprocessed audio features. Valid for 24
109
+ hours. Pass this to the [Music Generation
110
+ API](/api-reference/music-generation) `cover_feature_id` parameter
111
+ for two-step cover generation.
112
+
113
+
114
+ Same audio content returns the same `cover_feature_id` (MD5-based
115
+ deduplication).
116
+ formatted_lyrics:
117
+ type: string
118
+ description: >-
119
+ Structured lyrics extracted from the reference audio via ASR,
120
+ formatted with section tags such as `[Verse]`, `[Chorus]`,
121
+ `[Bridge]`, etc. You can modify these lyrics before passing them to
122
+ the Music Generation API.
123
+ structure_result:
124
+ type: string
125
+ description: >-
126
+ JSON string containing the song structure analysis result, including
127
+ segment types (`intro`, `verse`, `chorus`, `bridge`, `outro`,
128
+ `inst`, `silence`) and their start/end timestamps in seconds.
129
+ audio_duration:
130
+ type: number
131
+ format: double
132
+ description: Duration of the reference audio in seconds.
133
+ trace_id:
134
+ type: string
135
+ description: Unique trace ID for request tracking.
136
+ base_resp:
137
+ $ref: '#/components/schemas/BaseResp'
138
+ example:
139
+ cover_feature_id: a1b2c3d4e5f67890abcdef1234567890
140
+ formatted_lyrics: |-
141
+ [Verse 1]
142
+ First line of the song
143
+ Second line continues
144
+
145
+ [Chorus]
146
+ This is the chorus
147
+ Singing out loud
148
+ structure_result: >-
149
+ {"num_segments":4,"segments":[{"start":0,"end":15.5,"label":"intro"},{"start":15.5,"end":45.2,"label":"verse"},{"start":45.2,"end":75.0,"label":"chorus"},{"start":75.0,"end":90.0,"label":"outro"}]}
150
+ audio_duration: 90
151
+ trace_id: 061e5f144eb7f10b1fdde81126e24f91
152
+ base_resp:
153
+ status_code: 0
154
+ status_msg: success
155
+ BaseResp:
156
+ type: object
157
+ description: Status code and details
158
+ properties:
159
+ status_code:
160
+ type: integer
161
+ description: >-
162
+ Status codes and their meanings:
163
+
164
+
165
+ `0`: Success
166
+
167
+
168
+ `1002`: Rate limit triggered, retry later
169
+
170
+
171
+ `1004`: Authentication failed, check API key
172
+
173
+
174
+ `1008`: Insufficient balance
175
+
176
+
177
+ `1026`: Content flagged for sensitive material
178
+
179
+
180
+ `2013`: Invalid parameters, check input
181
+
182
+
183
+ `2049`: Invalid API key
184
+
185
+
186
+ For more information, please refer to the [Error Code
187
+ Reference](/api-reference/errorcode).
188
+ status_msg:
189
+ type: string
190
+ description: Detailed error message
191
+ securitySchemes:
192
+ bearerAuth:
193
+ type: http
194
+ scheme: bearer
195
+ bearerFormat: JWT
196
+ description: >-
197
+ `HTTP: Bearer Auth`
198
+
199
+ - Security Scheme Type: http
200
+
201
+ - HTTP Authorization Scheme: `Bearer API_key`, can be found in [Account
202
+ Management>API
203
+ Keys](https://platform.minimax.io/user-center/basic-information/interface-key).
204
+
205
+ ````
206
+