magic-hour 0.43.1 → 0.45.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 (167) hide show
  1. package/README.md +82 -77
  2. package/dist/core/api-error.d.ts +6 -0
  3. package/dist/core/api-error.js +11 -0
  4. package/dist/core/api-promise.d.ts +28 -0
  5. package/dist/core/api-promise.js +252 -0
  6. package/dist/core/auth.d.ts +76 -0
  7. package/dist/core/auth.js +232 -0
  8. package/dist/core/binary-response.d.ts +6 -0
  9. package/dist/core/binary-response.js +10 -0
  10. package/dist/core/content-type.d.ts +4 -0
  11. package/dist/core/content-type.js +12 -0
  12. package/dist/core/core-client.d.ts +58 -0
  13. package/dist/core/core-client.js +168 -0
  14. package/dist/core/form-data.d.ts +26 -0
  15. package/dist/core/form-data.js +83 -0
  16. package/dist/core/index.d.ts +9 -0
  17. package/dist/core/index.js +28 -0
  18. package/dist/core/logger.d.ts +48 -0
  19. package/dist/core/logger.js +82 -0
  20. package/dist/core/query.d.ts +8 -0
  21. package/dist/core/query.js +77 -0
  22. package/dist/core/runtime.d.ts +4 -0
  23. package/dist/core/runtime.js +20 -0
  24. package/dist/core/zod.d.ts +13 -0
  25. package/dist/core/zod.js +60 -0
  26. package/dist/environment.d.ts +1 -1
  27. package/dist/environment.js +1 -1
  28. package/dist/examples/logging-example.d.ts +10 -0
  29. package/dist/examples/logging-example.js +137 -0
  30. package/dist/logging-client.d.ts +39 -0
  31. package/dist/logging-client.js +116 -0
  32. package/dist/resources/v1/ai-clothes-changer/request-types.d.ts +1 -1
  33. package/dist/resources/v1/ai-face-editor/request-types.d.ts +1 -1
  34. package/dist/resources/v1/ai-gif-generator/request-types.d.ts +1 -1
  35. package/dist/resources/v1/ai-headshot-generator/request-types.d.ts +1 -1
  36. package/dist/resources/v1/ai-image-editor/request-types.d.ts +1 -1
  37. package/dist/resources/v1/ai-image-editor/resource-client.d.ts +1 -1
  38. package/dist/resources/v1/ai-image-editor/resource-client.js +1 -1
  39. package/dist/resources/v1/ai-image-generator/request-types.d.ts +1 -1
  40. package/dist/resources/v1/ai-image-upscaler/request-types.d.ts +1 -1
  41. package/dist/resources/v1/ai-photo-editor/request-types.d.ts +1 -1
  42. package/dist/resources/v1/ai-qr-code-generator/request-types.d.ts +1 -1
  43. package/dist/resources/v1/ai-talking-photo/request-types.d.ts +1 -1
  44. package/dist/resources/v1/ai-voice-cloner/index.d.ts +2 -0
  45. package/dist/resources/v1/ai-voice-cloner/index.js +5 -0
  46. package/dist/resources/v1/ai-voice-cloner/request-types.d.ts +31 -0
  47. package/dist/resources/v1/ai-voice-cloner/request-types.js +77 -0
  48. package/dist/resources/v1/ai-voice-cloner/resource-client.d.ts +55 -0
  49. package/dist/resources/v1/ai-voice-cloner/resource-client.js +99 -0
  50. package/dist/resources/v1/ai-voice-generator/request-types.d.ts +1 -1
  51. package/dist/resources/v1/animation/request-types.d.ts +1 -1
  52. package/dist/resources/v1/audio-projects/resource-client.d.ts +9 -10
  53. package/dist/resources/v1/audio-projects/resource-client.js +8 -9
  54. package/dist/resources/v1/auto-subtitle-generator/request-types.d.ts +3 -3
  55. package/dist/resources/v1/face-swap/request-types.d.ts +3 -3
  56. package/dist/resources/v1/face-swap/resource-client.d.ts +20 -2
  57. package/dist/resources/v1/face-swap/resource-client.js +20 -2
  58. package/dist/resources/v1/face-swap-photo/request-types.d.ts +1 -1
  59. package/dist/resources/v1/files/resource-client.d.ts +13 -3
  60. package/dist/resources/v1/files/resource-client.js +54 -3
  61. package/dist/resources/v1/files/resource-client.test.js +45 -0
  62. package/dist/resources/v1/image-background-remover/request-types.d.ts +1 -1
  63. package/dist/resources/v1/image-projects/resource-client.d.ts +9 -10
  64. package/dist/resources/v1/image-projects/resource-client.js +8 -9
  65. package/dist/resources/v1/image-to-video/request-types.d.ts +1 -1
  66. package/dist/resources/v1/image-to-video/resource-client.d.ts +20 -2
  67. package/dist/resources/v1/image-to-video/resource-client.js +20 -2
  68. package/dist/resources/v1/index.d.ts +1 -0
  69. package/dist/resources/v1/index.js +2 -1
  70. package/dist/resources/v1/lip-sync/request-types.d.ts +3 -3
  71. package/dist/resources/v1/lip-sync/resource-client.d.ts +20 -2
  72. package/dist/resources/v1/lip-sync/resource-client.js +20 -2
  73. package/dist/resources/v1/photo-colorizer/request-types.d.ts +1 -1
  74. package/dist/resources/v1/photo-colorizer/resource-client.d.ts +1 -1
  75. package/dist/resources/v1/photo-colorizer/resource-client.js +1 -1
  76. package/dist/resources/v1/resource-client.d.ts +3 -0
  77. package/dist/resources/v1/resource-client.js +6 -0
  78. package/dist/resources/v1/text-to-video/request-types.d.ts +1 -1
  79. package/dist/resources/v1/text-to-video/resource-client.d.ts +20 -2
  80. package/dist/resources/v1/text-to-video/resource-client.js +20 -2
  81. package/dist/resources/v1/video-projects/resource-client.d.ts +9 -10
  82. package/dist/resources/v1/video-projects/resource-client.js +8 -9
  83. package/dist/resources/v1/video-to-video/request-types.d.ts +3 -3
  84. package/dist/resources/v1/video-to-video/resource-client.d.ts +20 -2
  85. package/dist/resources/v1/video-to-video/resource-client.js +20 -2
  86. package/dist/types/index.d.ts +4 -0
  87. package/dist/types/v1-ai-clothes-changer-create-body-assets-garment-type-enum.d.ts +6 -2
  88. package/dist/types/v1-ai-clothes-changer-create-body-assets.d.ts +9 -5
  89. package/dist/types/v1-ai-clothes-changer-create-body-assets.js +6 -2
  90. package/dist/types/v1-ai-clothes-changer-create-body.d.ts +1 -1
  91. package/dist/types/v1-ai-clothes-changer-create-response.d.ts +1 -1
  92. package/dist/types/v1-ai-face-editor-create-body-assets.d.ts +1 -1
  93. package/dist/types/v1-ai-face-editor-create-body.d.ts +1 -1
  94. package/dist/types/v1-ai-face-editor-create-response.d.ts +1 -1
  95. package/dist/types/v1-ai-gif-generator-create-body.d.ts +1 -1
  96. package/dist/types/v1-ai-gif-generator-create-response.d.ts +1 -1
  97. package/dist/types/v1-ai-headshot-generator-create-body-assets.d.ts +1 -1
  98. package/dist/types/v1-ai-headshot-generator-create-body.d.ts +1 -1
  99. package/dist/types/v1-ai-headshot-generator-create-response.d.ts +1 -1
  100. package/dist/types/v1-ai-image-editor-create-body-assets.d.ts +2 -2
  101. package/dist/types/v1-ai-image-editor-create-body.d.ts +1 -1
  102. package/dist/types/v1-ai-image-editor-create-response.d.ts +1 -1
  103. package/dist/types/v1-ai-image-generator-create-body.d.ts +1 -1
  104. package/dist/types/v1-ai-image-generator-create-response.d.ts +1 -1
  105. package/dist/types/v1-ai-image-upscaler-create-body-assets.d.ts +1 -1
  106. package/dist/types/v1-ai-image-upscaler-create-body.d.ts +1 -1
  107. package/dist/types/v1-ai-image-upscaler-create-response.d.ts +1 -1
  108. package/dist/types/v1-ai-meme-generator-create-response.d.ts +1 -1
  109. package/dist/types/v1-ai-photo-editor-create-body-assets.d.ts +1 -1
  110. package/dist/types/v1-ai-photo-editor-create-body.d.ts +1 -1
  111. package/dist/types/v1-ai-photo-editor-create-response.d.ts +1 -1
  112. package/dist/types/v1-ai-qr-code-generator-create-body.d.ts +1 -1
  113. package/dist/types/v1-ai-qr-code-generator-create-response.d.ts +1 -1
  114. package/dist/types/v1-ai-talking-photo-create-body-assets.d.ts +2 -2
  115. package/dist/types/v1-ai-talking-photo-create-body.d.ts +1 -1
  116. package/dist/types/v1-ai-talking-photo-create-response.d.ts +1 -1
  117. package/dist/types/v1-ai-voice-cloner-create-body-assets.d.ts +27 -0
  118. package/dist/types/v1-ai-voice-cloner-create-body-assets.js +67 -0
  119. package/dist/types/v1-ai-voice-cloner-create-body-style.d.ts +22 -0
  120. package/dist/types/v1-ai-voice-cloner-create-body-style.js +67 -0
  121. package/dist/types/v1-ai-voice-cloner-create-body.d.ts +31 -0
  122. package/dist/types/v1-ai-voice-cloner-create-body.js +77 -0
  123. package/dist/types/v1-ai-voice-cloner-create-response.d.ts +29 -0
  124. package/dist/types/v1-ai-voice-cloner-create-response.js +71 -0
  125. package/dist/types/v1-ai-voice-generator-create-body.d.ts +1 -1
  126. package/dist/types/v1-ai-voice-generator-create-response.d.ts +1 -1
  127. package/dist/types/v1-animation-create-body-assets.d.ts +2 -2
  128. package/dist/types/v1-animation-create-body.d.ts +1 -1
  129. package/dist/types/v1-animation-create-response.d.ts +1 -1
  130. package/dist/types/v1-audio-projects-get-response.d.ts +2 -2
  131. package/dist/types/v1-auto-subtitle-generator-create-body-assets.d.ts +1 -1
  132. package/dist/types/v1-auto-subtitle-generator-create-body.d.ts +3 -3
  133. package/dist/types/v1-auto-subtitle-generator-create-response.d.ts +1 -1
  134. package/dist/types/v1-face-detection-create-body-assets.d.ts +1 -1
  135. package/dist/types/v1-face-swap-create-body-assets-face-mappings-item.d.ts +1 -1
  136. package/dist/types/v1-face-swap-create-body-assets-face-swap-mode-enum.d.ts +3 -3
  137. package/dist/types/v1-face-swap-create-body-assets-video-source-enum.d.ts +1 -1
  138. package/dist/types/v1-face-swap-create-body-assets.d.ts +10 -7
  139. package/dist/types/v1-face-swap-create-body.d.ts +3 -3
  140. package/dist/types/v1-face-swap-create-response.d.ts +1 -1
  141. package/dist/types/v1-face-swap-photo-create-body-assets-face-mappings-item.d.ts +1 -1
  142. package/dist/types/v1-face-swap-photo-create-body-assets-face-swap-mode-enum.d.ts +3 -3
  143. package/dist/types/v1-face-swap-photo-create-body-assets.d.ts +5 -5
  144. package/dist/types/v1-face-swap-photo-create-body.d.ts +1 -1
  145. package/dist/types/v1-face-swap-photo-create-response.d.ts +1 -1
  146. package/dist/types/v1-image-background-remover-create-body-assets.d.ts +2 -2
  147. package/dist/types/v1-image-background-remover-create-body.d.ts +1 -1
  148. package/dist/types/v1-image-background-remover-create-response.d.ts +1 -1
  149. package/dist/types/v1-image-projects-get-response.d.ts +2 -2
  150. package/dist/types/v1-image-to-video-create-body-assets.d.ts +1 -1
  151. package/dist/types/v1-image-to-video-create-body.d.ts +1 -1
  152. package/dist/types/v1-image-to-video-create-response.d.ts +1 -1
  153. package/dist/types/v1-lip-sync-create-body-assets-video-source-enum.d.ts +1 -1
  154. package/dist/types/v1-lip-sync-create-body-assets.d.ts +7 -4
  155. package/dist/types/v1-lip-sync-create-body.d.ts +3 -3
  156. package/dist/types/v1-lip-sync-create-response.d.ts +1 -1
  157. package/dist/types/v1-photo-colorizer-create-body-assets.d.ts +1 -1
  158. package/dist/types/v1-photo-colorizer-create-body.d.ts +1 -1
  159. package/dist/types/v1-photo-colorizer-create-response.d.ts +1 -1
  160. package/dist/types/v1-text-to-video-create-body.d.ts +1 -1
  161. package/dist/types/v1-text-to-video-create-response.d.ts +1 -1
  162. package/dist/types/v1-video-projects-get-response.d.ts +4 -4
  163. package/dist/types/v1-video-to-video-create-body-assets-video-source-enum.d.ts +1 -1
  164. package/dist/types/v1-video-to-video-create-body-assets.d.ts +6 -3
  165. package/dist/types/v1-video-to-video-create-body.d.ts +3 -3
  166. package/dist/types/v1-video-to-video-create-response.d.ts +1 -1
  167. package/package.json +2 -2
@@ -54,6 +54,25 @@ const fs = __importStar(require("fs"));
54
54
  const make_api_request_js_1 = require("make-api-request-js");
55
55
  const path = __importStar(require("path"));
56
56
  const stream_1 = require("stream");
57
+ const logger_1 = require("../../../logger");
58
+ /**
59
+ * Check if the given string is a valid HTTP/HTTPS URL.
60
+ */
61
+ function isUrl(str) {
62
+ try {
63
+ const url = new URL(str);
64
+ return url.protocol === "http:" || url.protocol === "https:";
65
+ }
66
+ catch (_a) {
67
+ return false;
68
+ }
69
+ }
70
+ /**
71
+ * Check if the given string is an already-uploaded path (api-assets/).
72
+ */
73
+ function isAlreadyUploaded(str) {
74
+ return str.startsWith("api-assets/");
75
+ }
57
76
  /**
58
77
  * Determine file type and extension from file path or name.
59
78
  */
@@ -144,14 +163,20 @@ class FilesClient extends make_api_request_js_1.CoreResourceClient {
144
163
  * a file path that can be used as input for other Magic Hour API endpoints.
145
164
  * The file type is automatically detected from the file extension.
146
165
  *
166
+ * If a URL (http:// or https://) or an already-uploaded path (api-assets/...)
167
+ * is provided, it will be returned as-is without uploading.
168
+ *
147
169
  * @param file - The file to upload. Can be:
148
- * - **string**: Path to a local file (e.g., "/path/to/image.jpg")
170
+ * - **string**: Path to a local file (e.g., "/path/to/image.jpg"),
171
+ * a URL (e.g., "https://example.com/image.jpg"), or
172
+ * an already-uploaded path (e.g., "api-assets/id/1234.png")
149
173
  * - **Buffer**: File content as buffer (requires extension detection via other means)
150
174
  * - **Readable**: Node.js readable stream (must have a 'path' property)
151
175
  * - **File**: File object (browser environment)
152
176
  *
153
- * @returns The uploaded file's path in Magic Hour's storage system.
154
- * This path can be used as input for other API endpoints.
177
+ * @returns The file path that can be used as input for other API endpoints.
178
+ * For local files, this will be the uploaded path in Magic Hour's storage.
179
+ * For URLs and already-uploaded paths, this will be the input string as-is.
155
180
  *
156
181
  * @throws {Error} If the specified local file doesn't exist.
157
182
  * @throws {Error} If the file type is not supported.
@@ -167,6 +192,10 @@ class FilesClient extends make_api_request_js_1.CoreResourceClient {
167
192
  * const filePath = await client.v1.files.uploadFile("/path/to/your/image.jpg");
168
193
  * console.log(`Uploaded file: ${filePath}`);
169
194
  *
195
+ * // URLs are returned as-is (no upload needed)
196
+ * const urlPath = await client.v1.files.uploadFile("https://example.com/image.jpg");
197
+ * console.log(urlPath); // "https://example.com/image.jpg"
198
+ *
170
199
  * // Use the uploaded file in other API calls
171
200
  * const result = await client.v1.aiImageUpscaler.create({
172
201
  * assets: { imageFilePath: filePath },
@@ -177,7 +206,23 @@ class FilesClient extends make_api_request_js_1.CoreResourceClient {
177
206
  uploadFile(file) {
178
207
  return __awaiter(this, void 0, void 0, function* () {
179
208
  var _a, e_1, _b, _c;
209
+ const logger = (0, logger_1.getLogger)();
210
+ // If the input is a URL or already-uploaded path, return it as-is
211
+ if (typeof file === "string") {
212
+ if (isUrl(file)) {
213
+ logger.debug(`Skipping upload for ${file} since it is a valid URL`);
214
+ return file;
215
+ }
216
+ else if (isAlreadyUploaded(file)) {
217
+ logger.debug(`Skipping upload for ${file} since it is a valid already-uploaded path`);
218
+ return file;
219
+ }
220
+ else {
221
+ logger.debug(`Processing file input for upload ${file} as a local file`);
222
+ }
223
+ }
180
224
  const { filePath, fileData, fileType, extension } = processFileInput(file);
225
+ logger.debug(`File processed: type=${fileType}, extension=${extension}, source=${filePath ? "path" : "data"}`);
181
226
  // Create upload URL
182
227
  const response = yield this.uploadUrls.create({
183
228
  items: [
@@ -194,14 +239,17 @@ class FilesClient extends make_api_request_js_1.CoreResourceClient {
194
239
  if (!uploadInfo) {
195
240
  throw new Error("Upload info is missing from server response");
196
241
  }
242
+ logger.debug(`Received upload URL, target path: ${uploadInfo.filePath}`);
197
243
  // Prepare file content
198
244
  let content;
199
245
  if (filePath) {
200
246
  content = fs.readFileSync(filePath);
247
+ logger.debug(`Read ${content.length} bytes from local file: ${filePath}`);
201
248
  }
202
249
  else if (fileData) {
203
250
  if (Buffer.isBuffer(fileData)) {
204
251
  content = fileData;
252
+ logger.debug(`Using buffer data: ${content.length} bytes`);
205
253
  }
206
254
  else if (fileData instanceof stream_1.Readable) {
207
255
  // For streams, read all data into buffer
@@ -222,11 +270,13 @@ class FilesClient extends make_api_request_js_1.CoreResourceClient {
222
270
  finally { if (e_1) throw e_1.error; }
223
271
  }
224
272
  content = Buffer.concat(chunks);
273
+ logger.debug(`Read ${content.length} bytes from stream`);
225
274
  }
226
275
  else if (typeof File !== "undefined" && fileData instanceof File) {
227
276
  // File object - convert to buffer
228
277
  const arrayBuffer = yield fileData.arrayBuffer();
229
278
  content = Buffer.from(arrayBuffer);
279
+ logger.debug(`Read ${content.length} bytes from File object: ${fileData.name}`);
230
280
  }
231
281
  else {
232
282
  throw new Error("Unsupported file data type");
@@ -246,6 +296,7 @@ class FilesClient extends make_api_request_js_1.CoreResourceClient {
246
296
  if (!uploadResponse.ok) {
247
297
  throw new Error(`Upload failed with status ${uploadResponse.status}: ${uploadResponse.statusText}`);
248
298
  }
299
+ logger.debug(`Upload complete: ${uploadInfo.filePath}`);
249
300
  return uploadInfo.filePath;
250
301
  });
251
302
  }
@@ -100,6 +100,51 @@ describe("FilesClient.uploadFile", () => {
100
100
  mockFs.existsSync.mockReturnValue(true);
101
101
  mockFs.readFileSync.mockReturnValue(Buffer.from("mock file content"));
102
102
  });
103
+ describe("URL and already-uploaded path handling", () => {
104
+ test("should return HTTP URL as-is without uploading", () => __awaiter(void 0, void 0, void 0, function* () {
105
+ const url = "http://example.com/image.jpg";
106
+ const createSpy = jest.spyOn(client.v1.files.uploadUrls, "create");
107
+ const result = yield client.v1.files.uploadFile(url);
108
+ expect(result).toBe(url);
109
+ expect(createSpy).not.toHaveBeenCalled();
110
+ expect(mockFs.existsSync).not.toHaveBeenCalled();
111
+ createSpy.mockRestore();
112
+ }));
113
+ test("should return HTTPS URL as-is without uploading", () => __awaiter(void 0, void 0, void 0, function* () {
114
+ const url = "https://example.com/path/to/video.mp4";
115
+ const createSpy = jest.spyOn(client.v1.files.uploadUrls, "create");
116
+ const result = yield client.v1.files.uploadFile(url);
117
+ expect(result).toBe(url);
118
+ expect(createSpy).not.toHaveBeenCalled();
119
+ expect(mockFs.existsSync).not.toHaveBeenCalled();
120
+ createSpy.mockRestore();
121
+ }));
122
+ test("should return already-uploaded api-assets path as-is without uploading", () => __awaiter(void 0, void 0, void 0, function* () {
123
+ const apiAssetsPath = "api-assets/12345/image.jpg";
124
+ const createSpy = jest.spyOn(client.v1.files.uploadUrls, "create");
125
+ const result = yield client.v1.files.uploadFile(apiAssetsPath);
126
+ expect(result).toBe(apiAssetsPath);
127
+ expect(createSpy).not.toHaveBeenCalled();
128
+ expect(mockFs.existsSync).not.toHaveBeenCalled();
129
+ createSpy.mockRestore();
130
+ }));
131
+ test("should handle URLs with query parameters", () => __awaiter(void 0, void 0, void 0, function* () {
132
+ const url = "https://example.com/image.jpg?token=abc123&expires=12345";
133
+ const createSpy = jest.spyOn(client.v1.files.uploadUrls, "create");
134
+ const result = yield client.v1.files.uploadFile(url);
135
+ expect(result).toBe(url);
136
+ expect(createSpy).not.toHaveBeenCalled();
137
+ createSpy.mockRestore();
138
+ }));
139
+ test("should upload local file paths that look similar to URLs but are not", () => __awaiter(void 0, void 0, void 0, function* () {
140
+ const filePath = "/http/example.com/image.jpg";
141
+ const createSpy = jest.spyOn(client.v1.files.uploadUrls, "create");
142
+ const result = yield client.v1.files.uploadFile(filePath);
143
+ expect(result).toBe("api-assets/12345/image.jpg");
144
+ expect(createSpy).toHaveBeenCalled();
145
+ createSpy.mockRestore();
146
+ }));
147
+ });
103
148
  describe("File type detection", () => {
104
149
  // MSW handles the uploadUrls.create call automatically
105
150
  test("should detect video file types correctly", () => __awaiter(void 0, void 0, void 0, function* () {
@@ -9,7 +9,7 @@ export type CreateRequest = {
9
9
  */
10
10
  assets: V1ImageBackgroundRemoverCreateBodyAssets;
11
11
  /**
12
- * The name of image. This value is mainly used for your own identification of the image.
12
+ * Give your image a custom name for easy identification.
13
13
  */
14
14
  name?: string | undefined;
15
15
  };
@@ -36,16 +36,15 @@ export declare class ImageProjectsClient extends CoreResourceClient {
36
36
  /**
37
37
  * Get image details
38
38
  *
39
- * Get the details of a image project. The `downloads` field will be empty unless the image was successfully rendered.
40
- *
41
- * The image can be one of the following status
42
- * - `draft` - not currently used
43
- * - `queued` - the job is queued and waiting for a GPU
44
- * - `rendering` - the generation is in progress
45
- * - `complete` - the image is successful created
46
- * - `error` - an error occurred during rendering
47
- * - `canceled` - image render is canceled by the user
48
- *
39
+ * Check the progress of a image project. The `downloads` field is populated after a successful render.
40
+ *
41
+ * **Statuses**
42
+ * - `queued` — waiting to start
43
+ * - `rendering` — in progress
44
+ * - `complete` — ready; see `downloads`
45
+ * - `error` — a failure occurred (see `error`)
46
+ * - `canceled` — user canceled
47
+ * - `draft` — not used
49
48
  *
50
49
  * GET /v1/image-projects/{id}
51
50
  */
@@ -93,16 +93,15 @@ class ImageProjectsClient extends make_api_request_js_1.CoreResourceClient {
93
93
  /**
94
94
  * Get image details
95
95
  *
96
- * Get the details of a image project. The `downloads` field will be empty unless the image was successfully rendered.
97
- *
98
- * The image can be one of the following status
99
- * - `draft` - not currently used
100
- * - `queued` - the job is queued and waiting for a GPU
101
- * - `rendering` - the generation is in progress
102
- * - `complete` - the image is successful created
103
- * - `error` - an error occurred during rendering
104
- * - `canceled` - image render is canceled by the user
96
+ * Check the progress of a image project. The `downloads` field is populated after a successful render.
105
97
  *
98
+ * **Statuses**
99
+ * - `queued` — waiting to start
100
+ * - `rendering` — in progress
101
+ * - `complete` — ready; see `downloads`
102
+ * - `error` — a failure occurred (see `error`)
103
+ * - `canceled` — user canceled
104
+ * - `draft` — not used
106
105
  *
107
106
  * GET /v1/image-projects/{id}
108
107
  */
@@ -24,7 +24,7 @@ export type CreateRequest = {
24
24
  */
25
25
  height?: number | null | undefined;
26
26
  /**
27
- * The name of video. This value is mainly used for your own identification of the video.
27
+ * Give your video a custom name for easy identification.
28
28
  */
29
29
  name?: string | undefined;
30
30
  /**
@@ -45,10 +45,28 @@ export declare class ImageToVideoClient extends CoreResourceClient {
45
45
  /**
46
46
  * Image-to-Video
47
47
  *
48
- * Create a Image To Video video. The estimated frame cost is calculated using 30 FPS. This amount is deducted from your account balance when a video is queued. Once the video is complete, the cost will be updated based on the actual number of frames rendered.
48
+ * **What this API does**
49
49
  *
50
- * Get more information about this mode at our [product page](https://magichour.ai/products/image-to-video).
50
+ * Create the same Image To Video you can make in the browser, but programmatically, so you can automate it, run it at scale, or connect it to your own app or workflow.
51
51
  *
52
+ * **Good for**
53
+ * - Automation and batch processing
54
+ * - Adding image to video into apps, pipelines, or tools
55
+ *
56
+ * **How it works (3 steps)**
57
+ * 1) Upload your inputs (video, image, or audio) with [Generate Upload URLs](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls) and copy the `file_path`.
58
+ * 2) Send a request to create a image to video job with the basic fields.
59
+ * 3) Check the job status until it's `complete`, then download the result from `downloads`.
60
+ *
61
+ * **Key options**
62
+ * - Inputs: usually a file, sometimes a YouTube link, depending on project type
63
+ * - Resolution: free users are limited to 576px; higher plans unlock HD and larger sizes
64
+ * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
65
+ *
66
+ * **Cost**
67
+ * Credits are only charged for the frames that actually render. You'll see an estimate when the job is queued, and the final total after it's done.
68
+ *
69
+ * For detailed examples, see the [product page](https://magichour.ai/products/image-to-video).
52
70
  *
53
71
  * POST /v1/image-to-video
54
72
  */
@@ -81,10 +81,28 @@ class ImageToVideoClient extends make_api_request_js_1.CoreResourceClient {
81
81
  /**
82
82
  * Image-to-Video
83
83
  *
84
- * Create a Image To Video video. The estimated frame cost is calculated using 30 FPS. This amount is deducted from your account balance when a video is queued. Once the video is complete, the cost will be updated based on the actual number of frames rendered.
84
+ * **What this API does**
85
85
  *
86
- * Get more information about this mode at our [product page](https://magichour.ai/products/image-to-video).
86
+ * Create the same Image To Video you can make in the browser, but programmatically, so you can automate it, run it at scale, or connect it to your own app or workflow.
87
87
  *
88
+ * **Good for**
89
+ * - Automation and batch processing
90
+ * - Adding image to video into apps, pipelines, or tools
91
+ *
92
+ * **How it works (3 steps)**
93
+ * 1) Upload your inputs (video, image, or audio) with [Generate Upload URLs](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls) and copy the `file_path`.
94
+ * 2) Send a request to create a image to video job with the basic fields.
95
+ * 3) Check the job status until it's `complete`, then download the result from `downloads`.
96
+ *
97
+ * **Key options**
98
+ * - Inputs: usually a file, sometimes a YouTube link, depending on project type
99
+ * - Resolution: free users are limited to 576px; higher plans unlock HD and larger sizes
100
+ * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
101
+ *
102
+ * **Cost**
103
+ * Credits are only charged for the frames that actually render. You'll see an estimate when the job is queued, and the final total after it's done.
104
+ *
105
+ * For detailed examples, see the [product page](https://magichour.ai/products/image-to-video).
88
106
  *
89
107
  * POST /v1/image-to-video
90
108
  */
@@ -9,6 +9,7 @@ export * as aiMemeGenerator from "./ai-meme-generator";
9
9
  export * as aiPhotoEditor from "./ai-photo-editor";
10
10
  export * as aiQrCodeGenerator from "./ai-qr-code-generator";
11
11
  export * as aiTalkingPhoto from "./ai-talking-photo";
12
+ export * as aiVoiceCloner from "./ai-voice-cloner";
12
13
  export * as aiVoiceGenerator from "./ai-voice-generator";
13
14
  export * as animation from "./animation";
14
15
  export * as audioProjects from "./audio-projects";
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.videoToVideo = exports.videoProjects = exports.textToVideo = exports.V1Client = exports.photoColorizer = exports.lipSync = exports.imageToVideo = exports.imageProjects = exports.imageBackgroundRemover = exports.files = exports.faceSwapPhoto = exports.faceSwap = exports.faceDetection = exports.autoSubtitleGenerator = exports.audioProjects = exports.animation = exports.aiVoiceGenerator = exports.aiTalkingPhoto = exports.aiQrCodeGenerator = exports.aiPhotoEditor = exports.aiMemeGenerator = exports.aiImageUpscaler = exports.aiImageGenerator = exports.aiImageEditor = exports.aiHeadshotGenerator = exports.aiGifGenerator = exports.aiFaceEditor = exports.aiClothesChanger = void 0;
36
+ exports.videoToVideo = exports.videoProjects = exports.textToVideo = exports.V1Client = exports.photoColorizer = exports.lipSync = exports.imageToVideo = exports.imageProjects = exports.imageBackgroundRemover = exports.files = exports.faceSwapPhoto = exports.faceSwap = exports.faceDetection = exports.autoSubtitleGenerator = exports.audioProjects = exports.animation = exports.aiVoiceGenerator = exports.aiVoiceCloner = exports.aiTalkingPhoto = exports.aiQrCodeGenerator = exports.aiPhotoEditor = exports.aiMemeGenerator = exports.aiImageUpscaler = exports.aiImageGenerator = exports.aiImageEditor = exports.aiHeadshotGenerator = exports.aiGifGenerator = exports.aiFaceEditor = exports.aiClothesChanger = void 0;
37
37
  exports.aiClothesChanger = __importStar(require("./ai-clothes-changer"));
38
38
  exports.aiFaceEditor = __importStar(require("./ai-face-editor"));
39
39
  exports.aiGifGenerator = __importStar(require("./ai-gif-generator"));
@@ -45,6 +45,7 @@ exports.aiMemeGenerator = __importStar(require("./ai-meme-generator"));
45
45
  exports.aiPhotoEditor = __importStar(require("./ai-photo-editor"));
46
46
  exports.aiQrCodeGenerator = __importStar(require("./ai-qr-code-generator"));
47
47
  exports.aiTalkingPhoto = __importStar(require("./ai-talking-photo"));
48
+ exports.aiVoiceCloner = __importStar(require("./ai-voice-cloner"));
48
49
  exports.aiVoiceGenerator = __importStar(require("./ai-voice-generator"));
49
50
  exports.animation = __importStar(require("./animation"));
50
51
  exports.audioProjects = __importStar(require("./audio-projects"));
@@ -10,7 +10,7 @@ export type CreateRequest = {
10
10
  */
11
11
  assets: V1LipSyncCreateBodyAssets;
12
12
  /**
13
- * The end time of the input video in seconds. This value is used to trim the input video. The value must be greater than 0.1, and more than the start_seconds.
13
+ * End time of your clip (seconds). Must be greater than start_seconds.
14
14
  */
15
15
  endSeconds: number;
16
16
  /**
@@ -28,11 +28,11 @@ export type CreateRequest = {
28
28
  */
29
29
  maxFpsLimit?: number | undefined;
30
30
  /**
31
- * The name of video. This value is mainly used for your own identification of the video.
31
+ * Give your video a custom name for easy identification.
32
32
  */
33
33
  name?: string | undefined;
34
34
  /**
35
- * The start time of the input video in seconds. This value is used to trim the input video. The value must be greater than 0.
35
+ * Start time of your clip (seconds). Must be ≥ 0.
36
36
  */
37
37
  startSeconds: number;
38
38
  /**
@@ -58,10 +58,28 @@ export declare class LipSyncClient extends CoreResourceClient {
58
58
  /**
59
59
  * Lip Sync
60
60
  *
61
- * Create a Lip Sync video. The estimated frame cost is calculated using 30 FPS. This amount is deducted from your account balance when a video is queued. Once the video is complete, the cost will be updated based on the actual number of frames rendered.
61
+ * **What this API does**
62
62
  *
63
- * Get more information about this mode at our [product page](https://magichour.ai/products/lip-sync).
63
+ * Create the same Lip Sync you can make in the browser, but programmatically, so you can automate it, run it at scale, or connect it to your own app or workflow.
64
64
  *
65
+ * **Good for**
66
+ * - Automation and batch processing
67
+ * - Adding lip sync into apps, pipelines, or tools
68
+ *
69
+ * **How it works (3 steps)**
70
+ * 1) Upload your inputs (video, image, or audio) with [Generate Upload URLs](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls) and copy the `file_path`.
71
+ * 2) Send a request to create a lip sync job with the basic fields.
72
+ * 3) Check the job status until it's `complete`, then download the result from `downloads`.
73
+ *
74
+ * **Key options**
75
+ * - Inputs: usually a file, sometimes a YouTube link, depending on project type
76
+ * - Resolution: free users are limited to 576px; higher plans unlock HD and larger sizes
77
+ * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
78
+ *
79
+ * **Cost**
80
+ * Credits are only charged for the frames that actually render. You'll see an estimate when the job is queued, and the final total after it's done.
81
+ *
82
+ * For detailed examples, see the [product page](https://magichour.ai/products/lip-sync).
65
83
  *
66
84
  * POST /v1/lip-sync
67
85
  */
@@ -95,10 +95,28 @@ class LipSyncClient extends make_api_request_js_1.CoreResourceClient {
95
95
  /**
96
96
  * Lip Sync
97
97
  *
98
- * Create a Lip Sync video. The estimated frame cost is calculated using 30 FPS. This amount is deducted from your account balance when a video is queued. Once the video is complete, the cost will be updated based on the actual number of frames rendered.
98
+ * **What this API does**
99
99
  *
100
- * Get more information about this mode at our [product page](https://magichour.ai/products/lip-sync).
100
+ * Create the same Lip Sync you can make in the browser, but programmatically, so you can automate it, run it at scale, or connect it to your own app or workflow.
101
101
  *
102
+ * **Good for**
103
+ * - Automation and batch processing
104
+ * - Adding lip sync into apps, pipelines, or tools
105
+ *
106
+ * **How it works (3 steps)**
107
+ * 1) Upload your inputs (video, image, or audio) with [Generate Upload URLs](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls) and copy the `file_path`.
108
+ * 2) Send a request to create a lip sync job with the basic fields.
109
+ * 3) Check the job status until it's `complete`, then download the result from `downloads`.
110
+ *
111
+ * **Key options**
112
+ * - Inputs: usually a file, sometimes a YouTube link, depending on project type
113
+ * - Resolution: free users are limited to 576px; higher plans unlock HD and larger sizes
114
+ * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
115
+ *
116
+ * **Cost**
117
+ * Credits are only charged for the frames that actually render. You'll see an estimate when the job is queued, and the final total after it's done.
118
+ *
119
+ * For detailed examples, see the [product page](https://magichour.ai/products/lip-sync).
102
120
  *
103
121
  * POST /v1/lip-sync
104
122
  */
@@ -9,7 +9,7 @@ export type CreateRequest = {
9
9
  */
10
10
  assets: V1PhotoColorizerCreateBodyAssets;
11
11
  /**
12
- * The name of image. This value is mainly used for your own identification of the image.
12
+ * Give your image a custom name for easy identification.
13
13
  */
14
14
  name?: string | undefined;
15
15
  };
@@ -43,7 +43,7 @@ export declare class PhotoColorizerClient extends CoreResourceClient {
43
43
  /**
44
44
  * Photo Colorizer
45
45
  *
46
- * Colorize image. Each image costs 5 credits.
46
+ * Colorize image. Each image costs 10 credits.
47
47
  *
48
48
  * POST /v1/photo-colorizer
49
49
  */
@@ -79,7 +79,7 @@ class PhotoColorizerClient extends make_api_request_js_1.CoreResourceClient {
79
79
  /**
80
80
  * Photo Colorizer
81
81
  *
82
- * Colorize image. Each image costs 5 credits.
82
+ * Colorize image. Each image costs 10 credits.
83
83
  *
84
84
  * POST /v1/photo-colorizer
85
85
  */
@@ -10,6 +10,7 @@ import { AiMemeGeneratorClient } from "../../resources/v1/ai-meme-generator";
10
10
  import { AiPhotoEditorClient } from "../../resources/v1/ai-photo-editor";
11
11
  import { AiQrCodeGeneratorClient } from "../../resources/v1/ai-qr-code-generator";
12
12
  import { AiTalkingPhotoClient } from "../../resources/v1/ai-talking-photo";
13
+ import { AiVoiceClonerClient } from "../../resources/v1/ai-voice-cloner";
13
14
  import { AiVoiceGeneratorClient } from "../../resources/v1/ai-voice-generator";
14
15
  import { AnimationClient } from "../../resources/v1/animation";
15
16
  import { AudioProjectsClient } from "../../resources/v1/audio-projects";
@@ -27,6 +28,7 @@ import { TextToVideoClient } from "../../resources/v1/text-to-video";
27
28
  import { VideoProjectsClient } from "../../resources/v1/video-projects";
28
29
  import { VideoToVideoClient } from "../../resources/v1/video-to-video";
29
30
  export declare class V1Client extends CoreResourceClient {
31
+ private _aiVoiceClonerLazy?;
30
32
  private _audioProjectsLazy?;
31
33
  private _aiVoiceGeneratorLazy?;
32
34
  private _imageProjectsLazy?;
@@ -82,4 +84,5 @@ export declare class V1Client extends CoreResourceClient {
82
84
  get videoToVideo(): VideoToVideoClient;
83
85
  get aiVoiceGenerator(): AiVoiceGeneratorClient;
84
86
  get audioProjects(): AudioProjectsClient;
87
+ get aiVoiceCloner(): AiVoiceClonerClient;
85
88
  }
@@ -17,6 +17,7 @@ class V1Client extends make_api_request_js_1.CoreResourceClient {
17
17
  this.aiPhotoEditor;
18
18
  this.aiQrCodeGenerator;
19
19
  this.aiTalkingPhoto;
20
+ this.aiVoiceCloner;
20
21
  this.aiVoiceGenerator;
21
22
  this.animation;
22
23
  this.audioProjects;
@@ -166,5 +167,10 @@ class V1Client extends make_api_request_js_1.CoreResourceClient {
166
167
  return ((_a = this._audioProjectsLazy) !== null && _a !== void 0 ? _a : (this._audioProjectsLazy =
167
168
  new (require("./audio-projects").AudioProjectsClient)(this._client, this._opts)));
168
169
  }
170
+ get aiVoiceCloner() {
171
+ var _a;
172
+ return ((_a = this._aiVoiceClonerLazy) !== null && _a !== void 0 ? _a : (this._aiVoiceClonerLazy =
173
+ new (require("./ai-voice-cloner").AiVoiceClonerClient)(this._client, this._opts)));
174
+ }
169
175
  }
170
176
  exports.V1Client = V1Client;
@@ -13,7 +13,7 @@ export type CreateRequest = {
13
13
  */
14
14
  endSeconds: number;
15
15
  /**
16
- * The name of video. This value is mainly used for your own identification of the video.
16
+ * Give your video a custom name for easy identification.
17
17
  */
18
18
  name?: string | undefined;
19
19
  /**
@@ -37,10 +37,28 @@ export declare class TextToVideoClient extends CoreResourceClient {
37
37
  /**
38
38
  * Text-to-Video
39
39
  *
40
- * Create a Text To Video video. The estimated frame cost is calculated using 30 FPS. This amount is deducted from your account balance when a video is queued. Once the video is complete, the cost will be updated based on the actual number of frames rendered.
40
+ * **What this API does**
41
41
  *
42
- * Get more information about this mode at our [product page](https://magichour.ai/products/text-to-video).
42
+ * Create the same Text To Video you can make in the browser, but programmatically, so you can automate it, run it at scale, or connect it to your own app or workflow.
43
43
  *
44
+ * **Good for**
45
+ * - Automation and batch processing
46
+ * - Adding text to video into apps, pipelines, or tools
47
+ *
48
+ * **How it works (3 steps)**
49
+ * 1) Upload your inputs (video, image, or audio) with [Generate Upload URLs](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls) and copy the `file_path`.
50
+ * 2) Send a request to create a text to video job with the basic fields.
51
+ * 3) Check the job status until it's `complete`, then download the result from `downloads`.
52
+ *
53
+ * **Key options**
54
+ * - Inputs: usually a file, sometimes a YouTube link, depending on project type
55
+ * - Resolution: free users are limited to 576px; higher plans unlock HD and larger sizes
56
+ * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
57
+ *
58
+ * **Cost**
59
+ * Credits are only charged for the frames that actually render. You'll see an estimate when the job is queued, and the final total after it's done.
60
+ *
61
+ * For detailed examples, see the [product page](https://magichour.ai/products/text-to-video).
44
62
  *
45
63
  * POST /v1/text-to-video
46
64
  */
@@ -74,10 +74,28 @@ class TextToVideoClient extends make_api_request_js_1.CoreResourceClient {
74
74
  /**
75
75
  * Text-to-Video
76
76
  *
77
- * Create a Text To Video video. The estimated frame cost is calculated using 30 FPS. This amount is deducted from your account balance when a video is queued. Once the video is complete, the cost will be updated based on the actual number of frames rendered.
77
+ * **What this API does**
78
78
  *
79
- * Get more information about this mode at our [product page](https://magichour.ai/products/text-to-video).
79
+ * Create the same Text To Video you can make in the browser, but programmatically, so you can automate it, run it at scale, or connect it to your own app or workflow.
80
80
  *
81
+ * **Good for**
82
+ * - Automation and batch processing
83
+ * - Adding text to video into apps, pipelines, or tools
84
+ *
85
+ * **How it works (3 steps)**
86
+ * 1) Upload your inputs (video, image, or audio) with [Generate Upload URLs](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls) and copy the `file_path`.
87
+ * 2) Send a request to create a text to video job with the basic fields.
88
+ * 3) Check the job status until it's `complete`, then download the result from `downloads`.
89
+ *
90
+ * **Key options**
91
+ * - Inputs: usually a file, sometimes a YouTube link, depending on project type
92
+ * - Resolution: free users are limited to 576px; higher plans unlock HD and larger sizes
93
+ * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
94
+ *
95
+ * **Cost**
96
+ * Credits are only charged for the frames that actually render. You'll see an estimate when the job is queued, and the final total after it's done.
97
+ *
98
+ * For detailed examples, see the [product page](https://magichour.ai/products/text-to-video).
81
99
  *
82
100
  * POST /v1/text-to-video
83
101
  */
@@ -36,16 +36,15 @@ export declare class VideoProjectsClient extends CoreResourceClient {
36
36
  /**
37
37
  * Get video details
38
38
  *
39
- * Get the details of a video project. The `downloads` field will be empty unless the video was successfully rendered.
40
- *
41
- * The video can be one of the following status
42
- * - `draft` - not currently used
43
- * - `queued` - the job is queued and waiting for a GPU
44
- * - `rendering` - the generation is in progress
45
- * - `complete` - the video is successful created
46
- * - `error` - an error occurred during rendering
47
- * - `canceled` - video render is canceled by the user
48
- *
39
+ * Check the progress of a video project. The `downloads` field is populated after a successful render.
40
+ *
41
+ * **Statuses**
42
+ * - `queued` — waiting to start
43
+ * - `rendering` — in progress
44
+ * - `complete` — ready; see `downloads`
45
+ * - `error` — a failure occurred (see `error`)
46
+ * - `canceled` — user canceled
47
+ * - `draft` — not used
49
48
  *
50
49
  * GET /v1/video-projects/{id}
51
50
  */
@@ -93,16 +93,15 @@ class VideoProjectsClient extends make_api_request_js_1.CoreResourceClient {
93
93
  /**
94
94
  * Get video details
95
95
  *
96
- * Get the details of a video project. The `downloads` field will be empty unless the video was successfully rendered.
97
- *
98
- * The video can be one of the following status
99
- * - `draft` - not currently used
100
- * - `queued` - the job is queued and waiting for a GPU
101
- * - `rendering` - the generation is in progress
102
- * - `complete` - the video is successful created
103
- * - `error` - an error occurred during rendering
104
- * - `canceled` - video render is canceled by the user
96
+ * Check the progress of a video project. The `downloads` field is populated after a successful render.
105
97
  *
98
+ * **Statuses**
99
+ * - `queued` — waiting to start
100
+ * - `rendering` — in progress
101
+ * - `complete` — ready; see `downloads`
102
+ * - `error` — a failure occurred (see `error`)
103
+ * - `canceled` — user canceled
104
+ * - `draft` — not used
106
105
  *
107
106
  * GET /v1/video-projects/{id}
108
107
  */