magic-hour 0.83.0 → 0.84.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 (76) hide show
  1. package/README.md +27 -0
  2. package/dist/environment.d.ts +1 -1
  3. package/dist/environment.js +1 -1
  4. package/dist/helpers/download-error.d.ts +16 -0
  5. package/dist/helpers/download-error.js +15 -0
  6. package/dist/helpers/download.js +22 -2
  7. package/dist/resources/v1/ai-talking-photo/request-types.d.ts +10 -1
  8. package/dist/resources/v1/ai-talking-photo/request-types.js +4 -0
  9. package/dist/resources/v1/ai-ugc-ad/index.d.ts +2 -0
  10. package/dist/resources/v1/ai-ugc-ad/index.js +5 -0
  11. package/dist/resources/v1/ai-ugc-ad/request-types.d.ts +50 -0
  12. package/dist/resources/v1/ai-ugc-ad/request-types.js +86 -0
  13. package/dist/resources/v1/ai-ugc-ad/resource-client.d.ts +41 -0
  14. package/dist/resources/v1/ai-ugc-ad/resource-client.js +81 -0
  15. package/dist/resources/v1/ai-video-editor/resource-client.d.ts +1 -1
  16. package/dist/resources/v1/ai-video-editor/resource-client.js +1 -1
  17. package/dist/resources/v1/ai-video-translator/resource-client.d.ts +1 -1
  18. package/dist/resources/v1/ai-video-translator/resource-client.js +1 -1
  19. package/dist/resources/v1/audio-projects/resource-client.d.ts +5 -0
  20. package/dist/resources/v1/audio-projects/resource-client.js +14 -2
  21. package/dist/resources/v1/audio-to-video/resource-client.d.ts +1 -1
  22. package/dist/resources/v1/audio-to-video/resource-client.js +1 -1
  23. package/dist/resources/v1/character-replace/resource-client.d.ts +1 -1
  24. package/dist/resources/v1/character-replace/resource-client.js +1 -1
  25. package/dist/resources/v1/face-detection/resource-client.d.ts +5 -0
  26. package/dist/resources/v1/face-detection/resource-client.js +17 -5
  27. package/dist/resources/v1/face-swap/resource-client.d.ts +1 -1
  28. package/dist/resources/v1/face-swap/resource-client.js +1 -1
  29. package/dist/resources/v1/image-projects/resource-client.d.ts +5 -0
  30. package/dist/resources/v1/image-projects/resource-client.js +14 -2
  31. package/dist/resources/v1/image-to-video/request-types.d.ts +6 -2
  32. package/dist/resources/v1/image-to-video/request-types.js +2 -0
  33. package/dist/resources/v1/image-to-video/resource-client.d.ts +1 -1
  34. package/dist/resources/v1/image-to-video/resource-client.js +1 -1
  35. package/dist/resources/v1/index.d.ts +1 -0
  36. package/dist/resources/v1/index.js +2 -1
  37. package/dist/resources/v1/lip-sync/resource-client.d.ts +1 -1
  38. package/dist/resources/v1/lip-sync/resource-client.js +1 -1
  39. package/dist/resources/v1/resource-client.d.ts +3 -0
  40. package/dist/resources/v1/resource-client.js +5 -0
  41. package/dist/resources/v1/text-to-video/request-types.d.ts +22 -3
  42. package/dist/resources/v1/text-to-video/request-types.js +2 -0
  43. package/dist/resources/v1/text-to-video/resource-client.d.ts +1 -1
  44. package/dist/resources/v1/text-to-video/resource-client.js +1 -1
  45. package/dist/resources/v1/video-projects/resource-client.d.ts +5 -0
  46. package/dist/resources/v1/video-projects/resource-client.js +14 -2
  47. package/dist/resources/v1/video-to-video/resource-client.d.ts +1 -1
  48. package/dist/resources/v1/video-to-video/resource-client.js +1 -1
  49. package/dist/types/index.d.ts +6 -0
  50. package/dist/types/v1-ai-talking-photo-create-body-resolution-enum.d.ts +4 -0
  51. package/dist/types/v1-ai-talking-photo-create-body-resolution-enum.js +2 -0
  52. package/dist/types/v1-ai-talking-photo-create-body.d.ts +10 -1
  53. package/dist/types/v1-ai-talking-photo-create-body.js +4 -0
  54. package/dist/types/v1-ai-ugc-ad-create-body-assets.d.ts +29 -0
  55. package/dist/types/v1-ai-ugc-ad-create-body-assets.js +69 -0
  56. package/dist/types/v1-ai-ugc-ad-create-body-model-enum.d.ts +4 -0
  57. package/dist/types/v1-ai-ugc-ad-create-body-model-enum.js +2 -0
  58. package/dist/types/v1-ai-ugc-ad-create-body-resolution-enum.d.ts +4 -0
  59. package/dist/types/v1-ai-ugc-ad-create-body-resolution-enum.js +2 -0
  60. package/dist/types/v1-ai-ugc-ad-create-body.d.ts +50 -0
  61. package/dist/types/v1-ai-ugc-ad-create-body.js +86 -0
  62. package/dist/types/v1-ai-ugc-ad-create-response.d.ts +36 -0
  63. package/dist/types/v1-ai-ugc-ad-create-response.js +75 -0
  64. package/dist/types/v1-image-to-video-create-body-assets.d.ts +2 -1
  65. package/dist/types/v1-image-to-video-create-body-model-enum.d.ts +2 -1
  66. package/dist/types/v1-image-to-video-create-body-resolution-enum.d.ts +1 -0
  67. package/dist/types/v1-image-to-video-create-body.d.ts +6 -2
  68. package/dist/types/v1-image-to-video-create-body.js +2 -0
  69. package/dist/types/v1-text-to-video-create-body-aspect-ratio-enum.d.ts +2 -1
  70. package/dist/types/v1-text-to-video-create-body-model-enum.d.ts +2 -1
  71. package/dist/types/v1-text-to-video-create-body-resolution-enum.d.ts +1 -0
  72. package/dist/types/v1-text-to-video-create-body.d.ts +22 -3
  73. package/dist/types/v1-text-to-video-create-body.js +2 -0
  74. package/dist/types/v1-video-to-video-create-body-style-version-enum.d.ts +1 -1
  75. package/dist/types/v1-video-to-video-create-body-style.d.ts +1 -1
  76. package/package.json +4 -3
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.FaceDetectionClient = void 0;
24
24
  const make_api_request_js_1 = require("make-api-request-js");
25
25
  const download_1 = require("../../../helpers/download.js");
26
+ const download_error_1 = require("../../../helpers/download-error.js");
26
27
  const sleep_1 = require("../../../helpers/sleep.js");
27
28
  const logger_1 = require("../../../logger.js");
28
29
  const files_1 = require("../files/index.js");
@@ -76,12 +77,23 @@ class FaceDetectionClient extends make_api_request_js_1.CoreResourceClient {
76
77
  return Object.assign({}, apiResponse);
77
78
  }
78
79
  (0, logger_1.getLogger)().debug(`Downloading outputs for face detection ${apiResponse.id} to ${downloadDirectory !== null && downloadDirectory !== void 0 ? downloadDirectory : "current directory"}`);
79
- const downloadedPaths = yield (0, download_1.downloadFiles)(apiResponse.faces.map((f) => ({
80
- url: f.url,
81
- expiresAt: "ignore",
82
- })), downloadDirectory);
80
+ let downloadedPaths;
81
+ let downloadErrors = [];
82
+ try {
83
+ downloadedPaths = yield (0, download_1.downloadFiles)(apiResponse.faces.map((f) => ({
84
+ url: f.url,
85
+ expiresAt: "ignore",
86
+ })), downloadDirectory);
87
+ }
88
+ catch (error) {
89
+ if (!(error instanceof download_error_1.DownloadError)) {
90
+ throw error;
91
+ }
92
+ downloadedPaths = error.downloadedPaths;
93
+ downloadErrors = error.downloadErrors;
94
+ }
83
95
  (0, logger_1.getLogger)().info(`Downloaded outputs for face detection ${apiResponse.id} to ${downloadedPaths}`);
84
- return Object.assign(Object.assign({}, apiResponse), { downloadedPaths });
96
+ return Object.assign(Object.assign(Object.assign({}, apiResponse), { downloadedPaths }), (downloadErrors.length > 0 ? { downloadErrors } : {}));
85
97
  });
86
98
  }
87
99
  /**
@@ -97,7 +97,7 @@ export declare class FaceSwapClient extends CoreResourceClient {
97
97
  *
98
98
  * **Key options**
99
99
  * - Inputs: usually a file, sometimes a YouTube link, depending on project type
100
- * - Resolution: free users are limited to 576px; higher plans unlock HD and larger sizes
100
+ * - Resolution: output size and plan requirements vary by workflow and model. Some workflows derive output size from the input video.
101
101
  * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
102
102
  *
103
103
  * **Cost**
@@ -151,7 +151,7 @@ class FaceSwapClient extends make_api_request_js_1.CoreResourceClient {
151
151
  *
152
152
  * **Key options**
153
153
  * - Inputs: usually a file, sometimes a YouTube link, depending on project type
154
- * - Resolution: free users are limited to 576px; higher plans unlock HD and larger sizes
154
+ * - Resolution: output size and plan requirements vary by workflow and model. Some workflows derive output size from the input video.
155
155
  * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
156
156
  *
157
157
  * **Cost**
@@ -1,5 +1,6 @@
1
1
  import { ApiPromise, CoreClient, CoreResourceClient, RequestOptions, ResourceClientOptions } from "make-api-request-js";
2
2
  import { types } from "../../../index.js";
3
+ import { DownloadError } from "../../../helpers/download-error.js";
3
4
  import { GenerateOptions } from "../../../helpers/generate-type.js";
4
5
  import * as requests from "./request-types.js";
5
6
  /**
@@ -11,6 +12,10 @@ export interface V1ImageProjectsGetResponseWithDownloads extends types.V1ImagePr
11
12
  * This field is only populated if `download_outputs` is True and the image project is complete.
12
13
  */
13
14
  downloadedPaths?: string[];
15
+ /**
16
+ * Local download failures. The completed project and remote download URLs remain available.
17
+ */
18
+ downloadErrors?: DownloadError["downloadErrors"];
14
19
  }
15
20
  export declare class ImageProjectsClient extends CoreResourceClient {
16
21
  constructor(coreClient: CoreClient, opts: ResourceClientOptions);
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.ImageProjectsClient = void 0;
24
24
  const make_api_request_js_1 = require("make-api-request-js");
25
25
  const download_1 = require("../../../helpers/download.js");
26
+ const download_error_1 = require("../../../helpers/download-error.js");
26
27
  const sleep_1 = require("../../../helpers/sleep.js");
27
28
  const logger_1 = require("../../../logger.js");
28
29
  const v1_image_projects_get_response_1 = require("../../../types/v1-image-projects-get-response.js");
@@ -70,9 +71,20 @@ class ImageProjectsClient extends make_api_request_js_1.CoreResourceClient {
70
71
  return Object.assign({}, apiResponse);
71
72
  }
72
73
  (0, logger_1.getLogger)().debug(`Downloading outputs for image project ${request.id} to ${downloadDirectory !== null && downloadDirectory !== void 0 ? downloadDirectory : "current directory"}`);
73
- const downloadedPaths = yield (0, download_1.downloadFiles)(apiResponse.downloads, downloadDirectory);
74
+ let downloadedPaths;
75
+ let downloadErrors = [];
76
+ try {
77
+ downloadedPaths = yield (0, download_1.downloadFiles)(apiResponse.downloads, downloadDirectory);
78
+ }
79
+ catch (error) {
80
+ if (!(error instanceof download_error_1.DownloadError)) {
81
+ throw error;
82
+ }
83
+ downloadedPaths = error.downloadedPaths;
84
+ downloadErrors = error.downloadErrors;
85
+ }
74
86
  (0, logger_1.getLogger)().info(`Downloaded outputs for image project ${request.id} to ${downloadedPaths}`);
75
- return Object.assign(Object.assign({}, apiResponse), { downloadedPaths });
87
+ return Object.assign(Object.assign(Object.assign({}, apiResponse), { downloadedPaths }), (downloadErrors.length > 0 ? { downloadErrors } : {}));
76
88
  });
77
89
  }
78
90
  /**
@@ -20,6 +20,7 @@ export type CreateRequest = {
20
20
  * * **`minimax-h3`**: Toggle-able: no additional credits for audio
21
21
  * * **`seedance-1.5`**: Toggle-able: audio adds extra credits when enabled
22
22
  * * **`seedance-2.0`**: Toggle-able: no additional credits for audio
23
+ * * **`seedance-2.0-fast`**: Toggle-able: no additional credits for audio
23
24
  * * **`seedance-2.0-mini`**: Toggle-able: no additional credits for audio
24
25
  * * **`seedance-2.5`**: Toggle-able: no additional credits for audio
25
26
  * * **`veo3.1`**: Toggle-able: audio adds extra credits when enabled
@@ -39,6 +40,7 @@ export type CreateRequest = {
39
40
  * * **`minimax-h3`**: any integer from 1 to 30
40
41
  * * **`seedance-1.5`**: any integer from 4 to 12
41
42
  * * **`seedance-2.0`**: any integer from 4 to 15
43
+ * * **`seedance-2.0-fast`**: any integer from 4 to 15
42
44
  * * **`seedance-2.0-mini`**: any integer from 4 to 15
43
45
  * * **`seedance-2.5`**: any integer from 4 to 30
44
46
  * * **`veo3.1`**: 4, 6, 8, 16, 24, 32, 40, 48, 56
@@ -65,6 +67,7 @@ export type CreateRequest = {
65
67
  * * `minimax-h3`: Great for reference-driven clips with native audio and longer durations.
66
68
  * * `seedance-1.5`: Best for smooth, consistent motion with an end frame.
67
69
  * * `seedance-2.0`: Best for reference-led clips with precise subject control.
70
+ * * `seedance-2.0-fast`: Fast reference-led clips with consistent motion and audio.
68
71
  * * `seedance-2.0-mini`: Faster reference-led clips with consistent motion and audio.
69
72
  * * `seedance-2.5`: Best for premium realism, detail, and natural motion.
70
73
  * * `veo3.1`: Best for romantic interactions and expressive action, with realistic detail.
@@ -74,7 +77,7 @@ export type CreateRequest = {
74
77
  *
75
78
  * If you specify the deprecated model value that includes the `-audio` suffix, this will be the same as included `audio` as `true`.
76
79
  */
77
- model?: ("default" | "gemini-omni-1.1" | "kling-1.6" | "kling-2.5" | "kling-2.5-audio" | "kling-2.6" | "kling-3.0" | "ltx-2" | "ltx-2.3" | "ltx-2.5" | "minimax-h3" | "seedance" | "seedance-1.5" | "seedance-2.0" | "seedance-2.0-mini" | "seedance-2.5" | "sora-2" | "veo3.1" | "veo3.1-audio" | "veo3.1-lite" | "wan-2.2" | "wan-3.0") | undefined;
80
+ model?: ("default" | "gemini-omni-1.1" | "kling-1.6" | "kling-2.5" | "kling-2.5-audio" | "kling-2.6" | "kling-3.0" | "ltx-2" | "ltx-2.3" | "ltx-2.5" | "minimax-h3" | "seedance" | "seedance-1.5" | "seedance-2.0" | "seedance-2.0-fast" | "seedance-2.0-mini" | "seedance-2.5" | "sora-2" | "veo3.1" | "veo3.1-audio" | "veo3.1-lite" | "wan-2.2" | "wan-3.0") | undefined;
78
81
  /**
79
82
  * Give your video a custom name for easy identification.
80
83
  */
@@ -89,6 +92,7 @@ export type CreateRequest = {
89
92
  * * **`minimax-h3`**: Supports 480p, 720p, 1080p.
90
93
  * * **`seedance-1.5`**: Supports 480p, 720p, 1080p.
91
94
  * * **`seedance-2.0`**: Supports 480p, 720p, 1080p, 4k.
95
+ * * **`seedance-2.0-fast`**: Supports 480p, 720p.
92
96
  * * **`seedance-2.0-mini`**: Supports 480p, 720p.
93
97
  * * **`seedance-2.5`**: Supports 480p, 720p, 1080p.
94
98
  * * **`veo3.1`**: Supports 720p, 1080p.
@@ -119,7 +123,7 @@ export type External$CreateRequest = {
119
123
  audio?: boolean | undefined;
120
124
  end_seconds: number;
121
125
  height?: number | null | undefined;
122
- model?: ("default" | "gemini-omni-1.1" | "kling-1.6" | "kling-2.5" | "kling-2.5-audio" | "kling-2.6" | "kling-3.0" | "ltx-2" | "ltx-2.3" | "ltx-2.5" | "minimax-h3" | "seedance" | "seedance-1.5" | "seedance-2.0" | "seedance-2.0-mini" | "seedance-2.5" | "sora-2" | "veo3.1" | "veo3.1-audio" | "veo3.1-lite" | "wan-2.2" | "wan-3.0") | undefined;
126
+ model?: ("default" | "gemini-omni-1.1" | "kling-1.6" | "kling-2.5" | "kling-2.5-audio" | "kling-2.6" | "kling-3.0" | "ltx-2" | "ltx-2.3" | "ltx-2.5" | "minimax-h3" | "seedance" | "seedance-1.5" | "seedance-2.0" | "seedance-2.0-fast" | "seedance-2.0-mini" | "seedance-2.5" | "sora-2" | "veo3.1" | "veo3.1-audio" | "veo3.1-lite" | "wan-2.2" | "wan-3.0") | undefined;
123
127
  name?: string | undefined;
124
128
  resolution?: ("1080p" | "360p" | "480p" | "4k" | "720p") | undefined;
125
129
  style?: External$V1ImageToVideoCreateBodyStyle | undefined;
@@ -63,6 +63,7 @@ const SchemaIn$CreateRequest = z
63
63
  "seedance",
64
64
  "seedance-1.5",
65
65
  "seedance-2.0",
66
+ "seedance-2.0-fast",
66
67
  "seedance-2.0-mini",
67
68
  "seedance-2.5",
68
69
  "sora-2",
@@ -117,6 +118,7 @@ const SchemaOut$CreateRequest = z
117
118
  "seedance",
118
119
  "seedance-1.5",
119
120
  "seedance-2.0",
121
+ "seedance-2.0-fast",
120
122
  "seedance-2.0-mini",
121
123
  "seedance-2.5",
122
124
  "sora-2",
@@ -60,7 +60,7 @@ export declare class ImageToVideoClient extends CoreResourceClient {
60
60
  *
61
61
  * **Key options**
62
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
63
+ * - Resolution: output size and plan requirements vary by workflow and model. Some workflows derive output size from the input video.
64
64
  * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
65
65
  *
66
66
  * **Cost**
@@ -96,7 +96,7 @@ class ImageToVideoClient extends make_api_request_js_1.CoreResourceClient {
96
96
  *
97
97
  * **Key options**
98
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
99
+ * - Resolution: output size and plan requirements vary by workflow and model. Some workflows derive output size from the input video.
100
100
  * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
101
101
  *
102
102
  * **Cost**
@@ -9,6 +9,7 @@ export * as aiImageUpscaler from "./ai-image-upscaler";
9
9
  export * as aiMemeGenerator from "./ai-meme-generator";
10
10
  export * as aiQrCodeGenerator from "./ai-qr-code-generator";
11
11
  export * as aiTalkingPhoto from "./ai-talking-photo";
12
+ export * as aiUgcAd from "./ai-ugc-ad";
12
13
  export * as aiVideoEditor from "./ai-video-editor";
13
14
  export * as aiVideoTranslator from "./ai-video-translator";
14
15
  export * as aiVoiceCloner from "./ai-voice-cloner";
@@ -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.savedItems = exports.V1Client = exports.photoColorizer = exports.lipSync = exports.imageToVideo = exports.imageProjects = exports.imageBackgroundRemover = exports.headSwap = exports.files = exports.faceSwapPhoto = exports.faceSwap = exports.faceDetection = exports.characterReplace = exports.bodySwap = exports.autoSubtitleGenerator = exports.audioToVideo = exports.audioProjects = exports.animation = exports.aiVoiceGenerator = exports.aiVoiceCloner = exports.aiVideoTranslator = exports.aiVideoEditor = exports.aiTalkingPhoto = exports.aiQrCodeGenerator = exports.aiMemeGenerator = exports.aiImageUpscaler = exports.aiImageGenerator = exports.aiImageEditor = exports.aiHeadshotGenerator = exports.aiGifGenerator = exports.aiFaceEditor = exports.aiClothesChanger = exports.account = void 0;
36
+ exports.videoToVideo = exports.videoProjects = exports.textToVideo = exports.savedItems = exports.V1Client = exports.photoColorizer = exports.lipSync = exports.imageToVideo = exports.imageProjects = exports.imageBackgroundRemover = exports.headSwap = exports.files = exports.faceSwapPhoto = exports.faceSwap = exports.faceDetection = exports.characterReplace = exports.bodySwap = exports.autoSubtitleGenerator = exports.audioToVideo = exports.audioProjects = exports.animation = exports.aiVoiceGenerator = exports.aiVoiceCloner = exports.aiVideoTranslator = exports.aiVideoEditor = exports.aiUgcAd = exports.aiTalkingPhoto = exports.aiQrCodeGenerator = exports.aiMemeGenerator = exports.aiImageUpscaler = exports.aiImageGenerator = exports.aiImageEditor = exports.aiHeadshotGenerator = exports.aiGifGenerator = exports.aiFaceEditor = exports.aiClothesChanger = exports.account = void 0;
37
37
  exports.account = __importStar(require("./account"));
38
38
  exports.aiClothesChanger = __importStar(require("./ai-clothes-changer"));
39
39
  exports.aiFaceEditor = __importStar(require("./ai-face-editor"));
@@ -45,6 +45,7 @@ exports.aiImageUpscaler = __importStar(require("./ai-image-upscaler"));
45
45
  exports.aiMemeGenerator = __importStar(require("./ai-meme-generator"));
46
46
  exports.aiQrCodeGenerator = __importStar(require("./ai-qr-code-generator"));
47
47
  exports.aiTalkingPhoto = __importStar(require("./ai-talking-photo"));
48
+ exports.aiUgcAd = __importStar(require("./ai-ugc-ad"));
48
49
  exports.aiVideoEditor = __importStar(require("./ai-video-editor"));
49
50
  exports.aiVideoTranslator = __importStar(require("./ai-video-translator"));
50
51
  exports.aiVoiceCloner = __importStar(require("./ai-voice-cloner"));
@@ -73,7 +73,7 @@ export declare class LipSyncClient extends CoreResourceClient {
73
73
  *
74
74
  * **Key options**
75
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
76
+ * - Resolution: output size and plan requirements vary by workflow and model. Some workflows derive output size from the input video.
77
77
  * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
78
78
  *
79
79
  * **Cost**
@@ -110,7 +110,7 @@ class LipSyncClient extends make_api_request_js_1.CoreResourceClient {
110
110
  *
111
111
  * **Key options**
112
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
113
+ * - Resolution: output size and plan requirements vary by workflow and model. Some workflows derive output size from the input video.
114
114
  * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
115
115
  *
116
116
  * **Cost**
@@ -10,6 +10,7 @@ import { AiImageUpscalerClient } from "./ai-image-upscaler/index.js";
10
10
  import { AiMemeGeneratorClient } from "./ai-meme-generator/index.js";
11
11
  import { AiQrCodeGeneratorClient } from "./ai-qr-code-generator/index.js";
12
12
  import { AiTalkingPhotoClient } from "./ai-talking-photo/index.js";
13
+ import { AiUgcAdClient } from "./ai-ugc-ad/index.js";
13
14
  import { AiVideoEditorClient } from "./ai-video-editor/index.js";
14
15
  import { AiVideoTranslatorClient } from "./ai-video-translator/index.js";
15
16
  import { AiVoiceClonerClient } from "./ai-voice-cloner/index.js";
@@ -35,6 +36,7 @@ import { TextToVideoClient } from "./text-to-video/index.js";
35
36
  import { VideoProjectsClient } from "./video-projects/index.js";
36
37
  import { VideoToVideoClient } from "./video-to-video/index.js";
37
38
  export declare class V1Client extends CoreResourceClient {
39
+ private _aiUgcAdLazy?;
38
40
  private _aiVideoTranslatorLazy?;
39
41
  private _savedItemsLazy?;
40
42
  private _accountLazy?;
@@ -106,4 +108,5 @@ export declare class V1Client extends CoreResourceClient {
106
108
  get account(): AccountClient;
107
109
  get savedItems(): SavedItemsClient;
108
110
  get aiVideoTranslator(): AiVideoTranslatorClient;
111
+ get aiUgcAd(): AiUgcAdClient;
109
112
  }
@@ -17,6 +17,7 @@ class V1Client extends make_api_request_js_1.CoreResourceClient {
17
17
  this.aiMemeGenerator;
18
18
  this.aiQrCodeGenerator;
19
19
  this.aiTalkingPhoto;
20
+ this.aiUgcAd;
20
21
  this.aiVideoEditor;
21
22
  this.aiVideoTranslator;
22
23
  this.aiVoiceCloner;
@@ -210,5 +211,9 @@ class V1Client extends make_api_request_js_1.CoreResourceClient {
210
211
  return ((_a = this._aiVideoTranslatorLazy) !== null && _a !== void 0 ? _a : (this._aiVideoTranslatorLazy =
211
212
  new (require("./ai-video-translator").AiVideoTranslatorClient)(this._client, this._opts)));
212
213
  }
214
+ get aiUgcAd() {
215
+ var _a;
216
+ return ((_a = this._aiUgcAdLazy) !== null && _a !== void 0 ? _a : (this._aiUgcAdLazy = new (require("./ai-ugc-ad").AiUgcAdClient)(this._client, this._opts)));
217
+ }
213
218
  }
214
219
  exports.V1Client = V1Client;
@@ -6,7 +6,7 @@ import { External$V1TextToVideoCreateBodyStyle, V1TextToVideoCreateBodyStyle } f
6
6
  */
7
7
  export type CreateRequest = {
8
8
  /**
9
- * Determines the aspect ratio of the output video.
9
+ * Provide `aspect_ratio` to set the video’s aspect ratio. Determines the aspect ratio of the output video.
10
10
  *
11
11
  * * **`gemini-omni-1.1`**: Supports 16:9, 9:16.
12
12
  * * **`kling-2.6`**: Supports 9:16, 16:9, 1:1.
@@ -15,6 +15,7 @@ export type CreateRequest = {
15
15
  * * **`minimax-h3`**: Supports 16:9, 9:16, 1:1.
16
16
  * * **`seedance-1.5`**: Supports 9:16, 16:9, 1:1.
17
17
  * * **`seedance-2.0`**: Supports 9:16, 16:9, 1:1.
18
+ * * **`seedance-2.0-fast`**: Supports 9:16, 16:9, 1:1.
18
19
  * * **`seedance-2.0-mini`**: Supports 9:16, 16:9, 1:1.
19
20
  * * **`seedance-2.5`**: Supports 9:16, 16:9, 1:1.
20
21
  * * **`veo3.1`**: Supports 9:16, 16:9.
@@ -35,6 +36,7 @@ export type CreateRequest = {
35
36
  * * **`minimax-h3`**: Toggle-able: no additional credits for audio
36
37
  * * **`seedance-1.5`**: Toggle-able: audio adds extra credits when enabled
37
38
  * * **`seedance-2.0`**: Toggle-able: no additional credits for audio
39
+ * * **`seedance-2.0-fast`**: Toggle-able: no additional credits for audio
38
40
  * * **`seedance-2.0-mini`**: Toggle-able: no additional credits for audio
39
41
  * * **`seedance-2.5`**: Toggle-able: no additional credits for audio
40
42
  * * **`veo3.1`**: Toggle-able: audio adds extra credits when enabled
@@ -54,6 +56,7 @@ export type CreateRequest = {
54
56
  * * **`minimax-h3`**: any integer from 1 to 30
55
57
  * * **`seedance-1.5`**: any integer from 4 to 12
56
58
  * * **`seedance-2.0`**: any integer from 4 to 15
59
+ * * **`seedance-2.0-fast`**: any integer from 4 to 15
57
60
  * * **`seedance-2.0-mini`**: any integer from 4 to 15
58
61
  * * **`seedance-2.5`**: any integer from 4 to 30
59
62
  * * **`veo3.1`**: 4, 6, 8, 16, 24, 32, 40, 48, 56
@@ -74,6 +77,7 @@ export type CreateRequest = {
74
77
  * * `minimax-h3`: Great for reference-driven clips with native audio and longer durations.
75
78
  * * `seedance-1.5`: Best for smooth, consistent motion with an end frame.
76
79
  * * `seedance-2.0`: Best for reference-led clips with precise subject control.
80
+ * * `seedance-2.0-fast`: Fast reference-led clips with consistent motion and audio.
77
81
  * * `seedance-2.0-mini`: Faster reference-led clips with consistent motion and audio.
78
82
  * * `seedance-2.5`: Best for premium realism, detail, and natural motion.
79
83
  * * `veo3.1`: Best for romantic interactions and expressive action, with realistic detail.
@@ -83,7 +87,7 @@ export type CreateRequest = {
83
87
  *
84
88
  * If you specify the deprecated model value that includes the `-audio` suffix, this will be the same as included `audio` as `true`.
85
89
  */
86
- model?: ("default" | "gemini-omni-1.1" | "kling-1.6" | "kling-2.5" | "kling-2.5-audio" | "kling-2.6" | "kling-3.0" | "ltx-2" | "ltx-2.3" | "ltx-2.5" | "minimax-h3" | "seedance" | "seedance-1.5" | "seedance-2.0" | "seedance-2.0-mini" | "seedance-2.5" | "sora-2" | "veo3.1" | "veo3.1-audio" | "veo3.1-lite" | "wan-2.2" | "wan-3.0") | undefined;
90
+ model?: ("default" | "gemini-omni-1.1" | "kling-1.6" | "kling-2.5" | "kling-2.5-audio" | "kling-2.6" | "kling-3.0" | "ltx-2" | "ltx-2.3" | "ltx-2.5" | "minimax-h3" | "seedance" | "seedance-1.5" | "seedance-2.0" | "seedance-2.0-fast" | "seedance-2.0-mini" | "seedance-2.5" | "sora-2" | "veo3.1" | "veo3.1-audio" | "veo3.1-lite" | "wan-2.2" | "wan-3.0") | undefined;
87
91
  /**
88
92
  * Give your video a custom name for easy identification.
89
93
  */
@@ -92,6 +96,20 @@ export type CreateRequest = {
92
96
  * Deprecated. Use `aspect_ratio` instead.
93
97
  */
94
98
  orientation?: ("landscape" | "portrait" | "square") | undefined;
99
+ /**
100
+ * Reference media for video generation. Name references without @ and refer to them as @name in style.prompt. Maximum 10 references total.
101
+ *
102
+ * Supported models and reference media:
103
+ * * **`gemini-omni-1.1`**: Supports images, videos. Up to 13 references.
104
+ * * **`kling-3.0`**: Supports images, videos.
105
+ * * **`minimax-h3`**: Supports images, videos, audio.
106
+ * * **`seedance-2.0`**: Supports images, videos, audio.
107
+ * * **`seedance-2.0-fast`**: Supports images, videos, audio.
108
+ * * **`seedance-2.0-mini`**: Supports images, videos, audio.
109
+ * * **`seedance-2.5`**: Supports images, videos, audio.
110
+ * * **`veo3.1`**: Supports images. Up to 3 references. Requires `end_seconds` of 8.
111
+ * * **`wan-3.0`**: Supports images, videos, audio.
112
+ */
95
113
  references?: V1TextToVideoCreateBodyReferencesItem[] | undefined;
96
114
  /**
97
115
  * Controls the output video resolution. Defaults to `720p` on paid tiers and `480p` on free tiers.
@@ -103,6 +121,7 @@ export type CreateRequest = {
103
121
  * * **`minimax-h3`**: Supports 480p, 720p, 1080p.
104
122
  * * **`seedance-1.5`**: Supports 480p, 720p, 1080p.
105
123
  * * **`seedance-2.0`**: Supports 480p, 720p, 1080p, 4k.
124
+ * * **`seedance-2.0-fast`**: Supports 480p, 720p.
106
125
  * * **`seedance-2.0-mini`**: Supports 480p, 720p.
107
126
  * * **`seedance-2.5`**: Supports 480p, 720p, 1080p.
108
127
  * * **`veo3.1`**: Supports 720p, 1080p.
@@ -123,7 +142,7 @@ export type External$CreateRequest = {
123
142
  aspect_ratio?: ("16:9" | "1:1" | "9:16") | undefined;
124
143
  audio?: boolean | undefined;
125
144
  end_seconds: number;
126
- model?: ("default" | "gemini-omni-1.1" | "kling-1.6" | "kling-2.5" | "kling-2.5-audio" | "kling-2.6" | "kling-3.0" | "ltx-2" | "ltx-2.3" | "ltx-2.5" | "minimax-h3" | "seedance" | "seedance-1.5" | "seedance-2.0" | "seedance-2.0-mini" | "seedance-2.5" | "sora-2" | "veo3.1" | "veo3.1-audio" | "veo3.1-lite" | "wan-2.2" | "wan-3.0") | undefined;
145
+ model?: ("default" | "gemini-omni-1.1" | "kling-1.6" | "kling-2.5" | "kling-2.5-audio" | "kling-2.6" | "kling-3.0" | "ltx-2" | "ltx-2.3" | "ltx-2.5" | "minimax-h3" | "seedance" | "seedance-1.5" | "seedance-2.0" | "seedance-2.0-fast" | "seedance-2.0-mini" | "seedance-2.5" | "sora-2" | "veo3.1" | "veo3.1-audio" | "veo3.1-lite" | "wan-2.2" | "wan-3.0") | undefined;
127
146
  name?: string | undefined;
128
147
  orientation?: ("landscape" | "portrait" | "square") | undefined;
129
148
  references?: External$V1TextToVideoCreateBodyReferencesItem[] | undefined;
@@ -62,6 +62,7 @@ const SchemaIn$CreateRequest = z
62
62
  "seedance",
63
63
  "seedance-1.5",
64
64
  "seedance-2.0",
65
+ "seedance-2.0-fast",
65
66
  "seedance-2.0-mini",
66
67
  "seedance-2.5",
67
68
  "sora-2",
@@ -118,6 +119,7 @@ const SchemaOut$CreateRequest = z
118
119
  "seedance",
119
120
  "seedance-1.5",
120
121
  "seedance-2.0",
122
+ "seedance-2.0-fast",
121
123
  "seedance-2.0-mini",
122
124
  "seedance-2.5",
123
125
  "sora-2",
@@ -52,7 +52,7 @@ export declare class TextToVideoClient extends CoreResourceClient {
52
52
  *
53
53
  * **Key options**
54
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
55
+ * - Resolution: output size and plan requirements vary by workflow and model. Some workflows derive output size from the input video.
56
56
  * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
57
57
  *
58
58
  * **Cost**
@@ -89,7 +89,7 @@ class TextToVideoClient extends make_api_request_js_1.CoreResourceClient {
89
89
  *
90
90
  * **Key options**
91
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
92
+ * - Resolution: output size and plan requirements vary by workflow and model. Some workflows derive output size from the input video.
93
93
  * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
94
94
  *
95
95
  * **Cost**
@@ -1,5 +1,6 @@
1
1
  import { ApiPromise, CoreClient, CoreResourceClient, RequestOptions, ResourceClientOptions } from "make-api-request-js";
2
2
  import { types } from "../../../index.js";
3
+ import { DownloadError } from "../../../helpers/download-error.js";
3
4
  import { GenerateOptions } from "../../../helpers/generate-type.js";
4
5
  import * as requests from "./request-types.js";
5
6
  /**
@@ -11,6 +12,10 @@ export interface V1VideoProjectsGetResponseWithDownloads extends types.V1VideoPr
11
12
  * This field is only populated if `download_outputs` is True and the video project is complete.
12
13
  */
13
14
  downloadedPaths?: string[];
15
+ /**
16
+ * Local download failures. The completed project and remote download URLs remain available.
17
+ */
18
+ downloadErrors?: DownloadError["downloadErrors"];
14
19
  }
15
20
  export declare class VideoProjectsClient extends CoreResourceClient {
16
21
  constructor(coreClient: CoreClient, opts: ResourceClientOptions);
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.VideoProjectsClient = void 0;
24
24
  const make_api_request_js_1 = require("make-api-request-js");
25
25
  const download_1 = require("../../../helpers/download.js");
26
+ const download_error_1 = require("../../../helpers/download-error.js");
26
27
  const sleep_1 = require("../../../helpers/sleep.js");
27
28
  const logger_1 = require("../../../logger.js");
28
29
  const v1_video_projects_get_response_1 = require("../../../types/v1-video-projects-get-response.js");
@@ -70,9 +71,20 @@ class VideoProjectsClient extends make_api_request_js_1.CoreResourceClient {
70
71
  return Object.assign({}, apiResponse);
71
72
  }
72
73
  (0, logger_1.getLogger)().debug(`Downloading outputs for video project ${request.id} to ${downloadDirectory !== null && downloadDirectory !== void 0 ? downloadDirectory : "current directory"}`);
73
- const downloadedPaths = yield (0, download_1.downloadFiles)(apiResponse.downloads, downloadDirectory);
74
+ let downloadedPaths;
75
+ let downloadErrors = [];
76
+ try {
77
+ downloadedPaths = yield (0, download_1.downloadFiles)(apiResponse.downloads, downloadDirectory);
78
+ }
79
+ catch (error) {
80
+ if (!(error instanceof download_error_1.DownloadError)) {
81
+ throw error;
82
+ }
83
+ downloadedPaths = error.downloadedPaths;
84
+ downloadErrors = error.downloadErrors;
85
+ }
74
86
  (0, logger_1.getLogger)().info(`Downloaded outputs for video project ${request.id} to ${downloadedPaths}`);
75
- return Object.assign(Object.assign({}, apiResponse), { downloadedPaths });
87
+ return Object.assign(Object.assign(Object.assign({}, apiResponse), { downloadedPaths }), (downloadErrors.length > 0 ? { downloadErrors } : {}));
76
88
  });
77
89
  }
78
90
  /**
@@ -68,7 +68,7 @@ export declare class VideoToVideoClient extends CoreResourceClient {
68
68
  *
69
69
  * **Key options**
70
70
  * - Inputs: usually a file, sometimes a YouTube link, depending on project type
71
- * - Resolution: free users are limited to 576px; higher plans unlock HD and larger sizes
71
+ * - Resolution: output size and plan requirements vary by workflow and model. Some workflows derive output size from the input video.
72
72
  * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
73
73
  *
74
74
  * **Cost**
@@ -110,7 +110,7 @@ class VideoToVideoClient extends make_api_request_js_1.CoreResourceClient {
110
110
  *
111
111
  * **Key options**
112
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
113
+ * - Resolution: output size and plan requirements vary by workflow and model. Some workflows derive output size from the input video.
114
114
  * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
115
115
  *
116
116
  * **Cost**
@@ -53,9 +53,15 @@ export { V1AiQrCodeGeneratorCreateBodyStyle } from "./v1-ai-qr-code-generator-cr
53
53
  export { V1AiQrCodeGeneratorCreateResponse } from "./v1-ai-qr-code-generator-create-response";
54
54
  export { V1AiTalkingPhotoCreateBody } from "./v1-ai-talking-photo-create-body";
55
55
  export { V1AiTalkingPhotoCreateBodyAssets } from "./v1-ai-talking-photo-create-body-assets";
56
+ export { V1AiTalkingPhotoCreateBodyResolutionEnum } from "./v1-ai-talking-photo-create-body-resolution-enum";
56
57
  export { V1AiTalkingPhotoCreateBodyStyle } from "./v1-ai-talking-photo-create-body-style";
57
58
  export { V1AiTalkingPhotoCreateBodyStyleGenerationModeEnum } from "./v1-ai-talking-photo-create-body-style-generation-mode-enum";
58
59
  export { V1AiTalkingPhotoCreateResponse } from "./v1-ai-talking-photo-create-response";
60
+ export { V1AiUgcAdCreateBody } from "./v1-ai-ugc-ad-create-body";
61
+ export { V1AiUgcAdCreateBodyAssets } from "./v1-ai-ugc-ad-create-body-assets";
62
+ export { V1AiUgcAdCreateBodyModelEnum } from "./v1-ai-ugc-ad-create-body-model-enum";
63
+ export { V1AiUgcAdCreateBodyResolutionEnum } from "./v1-ai-ugc-ad-create-body-resolution-enum";
64
+ export { V1AiUgcAdCreateResponse } from "./v1-ai-ugc-ad-create-response";
59
65
  export { V1AiVideoEditorCreateBody } from "./v1-ai-video-editor-create-body";
60
66
  export { V1AiVideoEditorCreateBodyAssets } from "./v1-ai-video-editor-create-body-assets";
61
67
  export { V1AiVideoEditorCreateBodyModelEnum } from "./v1-ai-video-editor-create-body-model-enum";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Output preset. Overrides `max_resolution`. Defaults to 480p in prompted mode; realistic mode uses the mapped plan maximum.
3
+ */
4
+ export type V1AiTalkingPhotoCreateBodyResolutionEnum = "480p" | "720p";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -14,13 +14,21 @@ export type V1AiTalkingPhotoCreateBody = {
14
14
  */
15
15
  endSeconds: number;
16
16
  /**
17
- * Constrains the larger dimension (height or width) of the output video. Allows you to set a lower resolution than your plan's maximum if desired. The value is capped by your plan's max resolution.
17
+ * Deprecated: use `resolution`. Still accepted as a larger-dimension cap, limited by your plan. Ignored when `resolution` is provided.
18
+ *
19
+ * After plan capping:
20
+ * * Below 1280 maps to `480p` (intermediate values round down).
21
+ * * 1280 or above maps to `720p`.
18
22
  */
19
23
  maxResolution?: number | undefined;
20
24
  /**
21
25
  * Give your video a custom name for easy identification.
22
26
  */
23
27
  name?: string | undefined;
28
+ /**
29
+ * Output preset. Overrides `max_resolution`. Defaults to 480p in prompted mode; realistic mode uses the mapped plan maximum.
30
+ */
31
+ resolution?: ("480p" | "720p") | undefined;
24
32
  /**
25
33
  * The start time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 300s, prompted 45s.
26
34
  */
@@ -40,6 +48,7 @@ export type External$V1AiTalkingPhotoCreateBody = {
40
48
  end_seconds: number;
41
49
  max_resolution?: number | undefined;
42
50
  name?: string | undefined;
51
+ resolution?: ("480p" | "720p") | undefined;
43
52
  start_seconds: number;
44
53
  style?: External$V1AiTalkingPhotoCreateBodyStyle | undefined;
45
54
  };
@@ -47,6 +47,7 @@ const SchemaIn$V1AiTalkingPhotoCreateBody = z
47
47
  end_seconds: z.number(),
48
48
  max_resolution: z.number().int().optional(),
49
49
  name: z.string().optional(),
50
+ resolution: z.enum(["480p", "720p"]).optional(),
50
51
  start_seconds: z.number(),
51
52
  style: v1_ai_talking_photo_create_body_style_1.Schemas$V1AiTalkingPhotoCreateBodyStyle.in.optional(),
52
53
  })
@@ -56,6 +57,7 @@ const SchemaIn$V1AiTalkingPhotoCreateBody = z
56
57
  end_seconds: "endSeconds",
57
58
  max_resolution: "maxResolution",
58
59
  name: "name",
60
+ resolution: "resolution",
59
61
  start_seconds: "startSeconds",
60
62
  style: "style",
61
63
  });
@@ -70,6 +72,7 @@ const SchemaOut$V1AiTalkingPhotoCreateBody = z
70
72
  endSeconds: z.number(),
71
73
  maxResolution: z.number().int().optional(),
72
74
  name: z.string().optional(),
75
+ resolution: z.enum(["480p", "720p"]).optional(),
73
76
  startSeconds: z.number(),
74
77
  style: v1_ai_talking_photo_create_body_style_1.Schemas$V1AiTalkingPhotoCreateBodyStyle.out.optional(),
75
78
  })
@@ -79,6 +82,7 @@ const SchemaOut$V1AiTalkingPhotoCreateBody = z
79
82
  endSeconds: "end_seconds",
80
83
  maxResolution: "max_resolution",
81
84
  name: "name",
85
+ resolution: "resolution",
82
86
  startSeconds: "start_seconds",
83
87
  style: "style",
84
88
  });
@@ -0,0 +1,29 @@
1
+ import * as z from "zod";
2
+ /**
3
+ * V1AiUgcAdCreateBodyAssets
4
+ */
5
+ export type V1AiUgcAdCreateBodyAssets = {
6
+ /**
7
+ * Prepared image to animate. This value is either
8
+ * - a direct URL to the video file
9
+ * - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls).
10
+ *
11
+ * See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details.
12
+ *
13
+ */
14
+ imageFilePath: string;
15
+ [additionalProperty: string]: string | any | null | undefined;
16
+ };
17
+ /**
18
+ * @internal
19
+ * V1AiUgcAdCreateBodyAssets without any key transformation, this is what
20
+ * we expect to come in as network data
21
+ */
22
+ export type External$V1AiUgcAdCreateBodyAssets = {
23
+ image_file_path: string;
24
+ [additionalProperty: string]: string | External$V1AiUgcAdCreateBodyAssets | null | undefined;
25
+ };
26
+ export declare const Schemas$V1AiUgcAdCreateBodyAssets: {
27
+ in: z.ZodType<V1AiUgcAdCreateBodyAssets, z.ZodTypeDef, unknown>;
28
+ out: z.ZodType<External$V1AiUgcAdCreateBodyAssets, z.ZodTypeDef, V1AiUgcAdCreateBodyAssets>;
29
+ };