magic-hour 0.62.0 → 0.64.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 (50) hide show
  1. package/README.md +5 -0
  2. package/dist/environment.d.ts +1 -1
  3. package/dist/environment.js +1 -1
  4. package/dist/resources/v1/ai-image-editor/request-types.d.ts +3 -3
  5. package/dist/resources/v1/ai-image-generator/request-types.d.ts +3 -3
  6. package/dist/resources/v1/ai-image-upscaler/request-types.d.ts +3 -0
  7. package/dist/resources/v1/ai-talking-photo/request-types.d.ts +2 -2
  8. package/dist/resources/v1/audio-to-video/index.d.ts +2 -0
  9. package/dist/resources/v1/audio-to-video/index.js +5 -0
  10. package/dist/resources/v1/audio-to-video/request-types.d.ts +49 -0
  11. package/dist/resources/v1/audio-to-video/request-types.js +89 -0
  12. package/dist/resources/v1/audio-to-video/resource-client.d.ts +87 -0
  13. package/dist/resources/v1/audio-to-video/resource-client.js +134 -0
  14. package/dist/resources/v1/image-to-video/request-types.d.ts +2 -2
  15. package/dist/resources/v1/index.d.ts +1 -0
  16. package/dist/resources/v1/index.js +2 -1
  17. package/dist/resources/v1/resource-client.d.ts +3 -0
  18. package/dist/resources/v1/resource-client.js +6 -0
  19. package/dist/resources/v1/text-to-video/request-types.d.ts +2 -2
  20. package/dist/types/index.d.ts +6 -0
  21. package/dist/types/v1-ai-image-editor-create-body-model-enum.d.ts +3 -3
  22. package/dist/types/v1-ai-image-editor-create-body.d.ts +3 -3
  23. package/dist/types/v1-ai-image-generator-create-body-model-enum.d.ts +3 -3
  24. package/dist/types/v1-ai-image-generator-create-body.d.ts +3 -3
  25. package/dist/types/v1-ai-image-upscaler-create-body-style-mode-enum.d.ts +4 -0
  26. package/dist/types/v1-ai-image-upscaler-create-body-style-mode-enum.js +2 -0
  27. package/dist/types/v1-ai-image-upscaler-create-body-style.d.ts +8 -3
  28. package/dist/types/v1-ai-image-upscaler-create-body-style.js +6 -2
  29. package/dist/types/v1-ai-image-upscaler-create-body.d.ts +3 -0
  30. package/dist/types/v1-ai-talking-photo-create-body.d.ts +2 -2
  31. package/dist/types/v1-ai-voice-generator-create-body-style-voice-name-enum.d.ts +2 -2
  32. package/dist/types/v1-ai-voice-generator-create-body-style.d.ts +3 -3
  33. package/dist/types/v1-ai-voice-generator-create-body-style.js +590 -0
  34. package/dist/types/v1-audio-projects-get-response.d.ts +1 -1
  35. package/dist/types/v1-audio-to-video-create-body-assets.d.ts +37 -0
  36. package/dist/types/v1-audio-to-video-create-body-assets.js +71 -0
  37. package/dist/types/v1-audio-to-video-create-body-resolution-enum.d.ts +4 -0
  38. package/dist/types/v1-audio-to-video-create-body-resolution-enum.js +2 -0
  39. package/dist/types/v1-audio-to-video-create-body-style.d.ts +22 -0
  40. package/dist/types/v1-audio-to-video-create-body-style.js +67 -0
  41. package/dist/types/v1-audio-to-video-create-body.d.ts +49 -0
  42. package/dist/types/v1-audio-to-video-create-body.js +89 -0
  43. package/dist/types/v1-audio-to-video-create-response.d.ts +36 -0
  44. package/dist/types/v1-audio-to-video-create-response.js +75 -0
  45. package/dist/types/v1-image-projects-get-response.d.ts +1 -1
  46. package/dist/types/v1-image-to-video-create-body-model-enum.d.ts +1 -1
  47. package/dist/types/v1-image-to-video-create-body.d.ts +2 -2
  48. package/dist/types/v1-text-to-video-create-body-model-enum.d.ts +1 -1
  49. package/dist/types/v1-text-to-video-create-body.d.ts +2 -2
  50. package/package.json +1 -1
package/README.md CHANGED
@@ -272,6 +272,11 @@ Valid values are: `none`, `error`, `warn`, `info`, `debug` (case insensitive). I
272
272
  - [delete](src/resources/v1/audio-projects/README.md#delete) - Delete audio
273
273
  - [get](src/resources/v1/audio-projects/README.md#get) - Get audio details
274
274
 
275
+ ### [v1.audioToVideo](src/resources/v1/audio-to-video/README.md)
276
+
277
+ - [create](src/resources/v1/audio-to-video/README.md#create) - Audio-to-Video
278
+ - [generate](src/resources/v1/audio-to-video/README.md#generate) - Audio To Video Generate Workflow
279
+
275
280
  ### [v1.autoSubtitleGenerator](src/resources/v1/auto-subtitle-generator/README.md)
276
281
 
277
282
  - [create](src/resources/v1/auto-subtitle-generator/README.md#create) - Auto Subtitle Generator
@@ -1,4 +1,4 @@
1
1
  export declare enum Environment {
2
2
  Environment = "https://api.magichour.ai",
3
- MockServer = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.63.0"
3
+ MockServer = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.65.0"
4
4
  }
@@ -4,5 +4,5 @@ exports.Environment = void 0;
4
4
  var Environment;
5
5
  (function (Environment) {
6
6
  Environment["Environment"] = "https://api.magichour.ai";
7
- Environment["MockServer"] = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.63.0";
7
+ Environment["MockServer"] = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.65.0";
8
8
  })(Environment || (exports.Environment = Environment = {}));
@@ -28,15 +28,15 @@ export type CreateRequest = {
28
28
  * - Max additional input images: 2
29
29
  * - `nano-banana` - from 50 credits/image
30
30
  * - Supported resolutions: 640px, 1k
31
- * - Available for tiers: free, creator, pro, business
31
+ * - Available for tiers: creator, pro, business
32
32
  * - Max additional input images: 9
33
33
  * - `nano-banana-2` - from 100 credits/image
34
34
  * - Supported resolutions: 640px, 1k, 2k, 4k
35
- * - Available for tiers: free, creator, pro, business
35
+ * - Available for tiers: creator, pro, business
36
36
  * - Max additional input images: 9
37
37
  * - `seedream-v4` - from 40 credits/image
38
38
  * - Supported resolutions: 640px, 1k, 2k, 4k
39
- * - Available for tiers: free, creator, pro, business
39
+ * - Available for tiers: creator, pro, business
40
40
  * - Max additional input images: 9
41
41
  * - `nano-banana-pro` - from 150 credits/image
42
42
  * - Supported resolutions: 1k, 2k, 4k
@@ -27,15 +27,15 @@ export type CreateRequest = {
27
27
  * - Image count allowed: 1, 2, 3, 4
28
28
  * - `seedream-v4` - from 40 credits/image
29
29
  * - Supported resolutions: 640px, 1k, 2k, 4k
30
- * - Available for tiers: free, creator, pro, business
30
+ * - Available for tiers: creator, pro, business
31
31
  * - Image count allowed: 1, 2, 3, 4
32
32
  * - `nano-banana` - from 50 credits/image
33
33
  * - Supported resolutions: 640px, 1k
34
- * - Available for tiers: free, creator, pro, business
34
+ * - Available for tiers: creator, pro, business
35
35
  * - Image count allowed: 1, 2, 3, 4
36
36
  * - `nano-banana-2` - from 100 credits/image
37
37
  * - Supported resolutions: 640px, 1k, 2k, 4k
38
- * - Available for tiers: free, creator, pro, business
38
+ * - Available for tiers: creator, pro, business
39
39
  * - Image count allowed: 1, 4, 9, 16
40
40
  * - `nano-banana-pro` - from 150 credits/image
41
41
  * - Supported resolutions: 1k, 2k, 4k
@@ -19,6 +19,9 @@ export type CreateRequest = {
19
19
  * Note: 4x upscale is only available on Creator, Pro, or Business tier.
20
20
  */
21
21
  scaleFactor: number;
22
+ /**
23
+ * Style settings for the upscale. Use `mode` to select between `"pro"` (faster, no enhancement required) and `"creative"` (defaults to `"Balanced"` enhancement). Defaults to `"creative"`.
24
+ */
22
25
  style: V1AiImageUpscalerCreateBodyStyle;
23
26
  };
24
27
  /**
@@ -10,7 +10,7 @@ export type CreateRequest = {
10
10
  */
11
11
  assets: V1AiTalkingPhotoCreateBodyAssets;
12
12
  /**
13
- * The end time of the input audio in seconds. The maximum duration allowed is 60 seconds.
13
+ * The end time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 180s, prompted 45s.
14
14
  */
15
15
  endSeconds: number;
16
16
  /**
@@ -22,7 +22,7 @@ export type CreateRequest = {
22
22
  */
23
23
  name?: string | undefined;
24
24
  /**
25
- * The start time of the input audio in seconds. The maximum duration allowed is 60 seconds.
25
+ * The start time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 180s, prompted 45s.
26
26
  */
27
27
  startSeconds: number;
28
28
  /**
@@ -0,0 +1,2 @@
1
+ export { CreateRequest } from "./request-types";
2
+ export { AudioToVideoClient } from "./resource-client";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AudioToVideoClient = void 0;
4
+ var resource_client_1 = require("./resource-client");
5
+ Object.defineProperty(exports, "AudioToVideoClient", { enumerable: true, get: function () { return resource_client_1.AudioToVideoClient; } });
@@ -0,0 +1,49 @@
1
+ import * as z from "zod";
2
+ import { External$V1AudioToVideoCreateBodyAssets, V1AudioToVideoCreateBodyAssets } from "../../../types/v1-audio-to-video-create-body-assets";
3
+ import { External$V1AudioToVideoCreateBodyStyle, V1AudioToVideoCreateBodyStyle } from "../../../types/v1-audio-to-video-create-body-style";
4
+ /**
5
+ * CreateRequest
6
+ */
7
+ export type CreateRequest = {
8
+ /**
9
+ * Provide the audio file and an optional reference image.
10
+ */
11
+ assets: V1AudioToVideoCreateBodyAssets;
12
+ /**
13
+ * End time of your clip (seconds). Must be greater than start_seconds.
14
+ */
15
+ endSeconds: number;
16
+ /**
17
+ * Give your video a custom name for easy identification.
18
+ */
19
+ name?: string | undefined;
20
+ /**
21
+ * Output video resolution. Defaults to `720p` on paid tiers and `480p` on free tiers.
22
+ */
23
+ resolution?: ("1080p" | "480p" | "720p") | undefined;
24
+ /**
25
+ * Start time of your clip (seconds). Must be ≥ 0.
26
+ */
27
+ startSeconds?: number | undefined;
28
+ /**
29
+ * Attributes used to dictate the style of the output
30
+ */
31
+ style?: V1AudioToVideoCreateBodyStyle | undefined;
32
+ };
33
+ /**
34
+ * @internal
35
+ * CreateRequest without any key transformation, this is what
36
+ * we expect to come in as network data
37
+ */
38
+ export type External$CreateRequest = {
39
+ assets: External$V1AudioToVideoCreateBodyAssets;
40
+ end_seconds: number;
41
+ name?: string | undefined;
42
+ resolution?: ("1080p" | "480p" | "720p") | undefined;
43
+ start_seconds?: number | undefined;
44
+ style?: External$V1AudioToVideoCreateBodyStyle | undefined;
45
+ };
46
+ export declare const Schemas$CreateRequest: {
47
+ in: z.ZodType<CreateRequest, z.ZodTypeDef, unknown>;
48
+ out: z.ZodType<External$CreateRequest, z.ZodTypeDef, CreateRequest>;
49
+ };
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Schemas$CreateRequest = void 0;
37
+ const make_api_request_js_1 = require("make-api-request-js");
38
+ const z = __importStar(require("zod"));
39
+ const v1_audio_to_video_create_body_assets_1 = require("../../../types/v1-audio-to-video-create-body-assets");
40
+ const v1_audio_to_video_create_body_style_1 = require("../../../types/v1-audio-to-video-create-body-style");
41
+ /**
42
+ * Takes network data, validates it, and transforms keys to match typescript object CreateRequest
43
+ */
44
+ const SchemaIn$CreateRequest = z
45
+ .object({
46
+ assets: v1_audio_to_video_create_body_assets_1.Schemas$V1AudioToVideoCreateBodyAssets.in,
47
+ end_seconds: z.number(),
48
+ name: z.string().optional(),
49
+ resolution: z.enum(["1080p", "480p", "720p"]).optional(),
50
+ start_seconds: z.number().optional(),
51
+ style: v1_audio_to_video_create_body_style_1.Schemas$V1AudioToVideoCreateBodyStyle.in.optional(),
52
+ })
53
+ .transform((obj) => {
54
+ return (0, make_api_request_js_1.zodTransform)(obj, {
55
+ assets: "assets",
56
+ end_seconds: "endSeconds",
57
+ name: "name",
58
+ resolution: "resolution",
59
+ start_seconds: "startSeconds",
60
+ style: "style",
61
+ });
62
+ });
63
+ /**
64
+ * @internal
65
+ * Takes typescript data, validates it, and maps keys to match the expected external object External$CreateRequest
66
+ */
67
+ const SchemaOut$CreateRequest = z
68
+ .object({
69
+ assets: v1_audio_to_video_create_body_assets_1.Schemas$V1AudioToVideoCreateBodyAssets.out,
70
+ endSeconds: z.number(),
71
+ name: z.string().optional(),
72
+ resolution: z.enum(["1080p", "480p", "720p"]).optional(),
73
+ startSeconds: z.number().optional(),
74
+ style: v1_audio_to_video_create_body_style_1.Schemas$V1AudioToVideoCreateBodyStyle.out.optional(),
75
+ })
76
+ .transform((obj) => {
77
+ return (0, make_api_request_js_1.zodTransform)(obj, {
78
+ assets: "assets",
79
+ endSeconds: "end_seconds",
80
+ name: "name",
81
+ resolution: "resolution",
82
+ startSeconds: "start_seconds",
83
+ style: "style",
84
+ });
85
+ });
86
+ exports.Schemas$CreateRequest = {
87
+ in: SchemaIn$CreateRequest,
88
+ out: SchemaOut$CreateRequest,
89
+ };
@@ -0,0 +1,87 @@
1
+ import { ApiPromise, CoreClient, CoreResourceClient, RequestOptions, ResourceClientOptions } from "make-api-request-js";
2
+ import { types } from "../../../index.js";
3
+ import { GenerateOptions, GenerateRequestType } from "../../../helpers/generate-type";
4
+ import * as requests from "../../../resources/v1/audio-to-video/request-types";
5
+ type GenerateRequest = GenerateRequestType<requests.CreateRequest, {
6
+ /**
7
+ * The path of the audio file. This value is either
8
+ * - a direct URL to the audio file
9
+ * - a path to a local file
10
+ *
11
+ * Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
12
+ */
13
+ audioFilePath: string;
14
+ /**
15
+ * Reference image for the initial frame of the video. This value is either
16
+ * - a direct URL to the image file
17
+ * - a path to a local file
18
+ *
19
+ * Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
20
+ */
21
+ imageFilePath?: string | undefined;
22
+ }>;
23
+ export declare class AudioToVideoClient extends CoreResourceClient {
24
+ constructor(coreClient: CoreClient, opts: ResourceClientOptions);
25
+ /**
26
+ * Audio-to-Video
27
+ *
28
+ * Create a Audio To Video video
29
+ *
30
+ * This method provides a convenient way to create a request and automatically wait for completion and download outputs.
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * import { Client } from "../../../index.js";
35
+ *
36
+ * const client = new Client({ token: process.env["API_TOKEN"]!! });
37
+ * const res = await client.v1.audioToVideo.generate(
38
+ * {
39
+ * assets: {
40
+ * audioFilePath: "/path/to/1234.mp3",
41
+ * imageFilePath: "/path/to/1234.png",
42
+ * },
43
+ * endSeconds: 15.0,
44
+ * name: "Audio To Video video",
45
+ * resolution: "720p",
46
+ * startSeconds: 0.0,
47
+ * },
48
+ * {
49
+ * waitForCompletion: true,
50
+ * downloadOutputs: true,
51
+ * downloadDirectory: ".",
52
+ * },
53
+ * );
54
+ * ```
55
+ */
56
+ generate(request: GenerateRequest, opts?: GenerateOptions): Promise<import("../video-projects/resource-client").V1VideoProjectsGetResponseWithDownloads>;
57
+ /**
58
+ * Audio-to-Video
59
+ *
60
+ * **What this API does**
61
+ *
62
+ * Create the same Audio 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.
63
+ *
64
+ * **Good for**
65
+ * - Automation and batch processing
66
+ * - Adding audio to video into apps, pipelines, or tools
67
+ *
68
+ * **How it works (3 steps)**
69
+ * 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`.
70
+ * 2) Send a request to create a audio to video job with the basic fields.
71
+ * 3) Check the job status until it's `complete`, then download the result from `downloads`.
72
+ *
73
+ * **Key options**
74
+ * - Inputs: usually a file, sometimes a YouTube link, depending on project type
75
+ * - Resolution: free users are limited to 576px; higher plans unlock HD and larger sizes
76
+ * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
77
+ *
78
+ * **Cost**
79
+ * 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.
80
+ *
81
+ * For detailed examples, see the [product page](https://magichour.ai/products/audio-to-video).
82
+ *
83
+ * POST /v1/audio-to-video
84
+ */
85
+ create(request: requests.CreateRequest, opts?: RequestOptions): ApiPromise<types.V1AudioToVideoCreateResponse>;
86
+ }
87
+ export {};
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.AudioToVideoClient = void 0;
24
+ const make_api_request_js_1 = require("make-api-request-js");
25
+ const logger_1 = require("../../../logger");
26
+ const files_1 = require("../../../resources/v1/files");
27
+ const video_projects_1 = require("../../../resources/v1/video-projects");
28
+ const v1_audio_to_video_create_body_1 = require("../../../types/v1-audio-to-video-create-body");
29
+ const v1_audio_to_video_create_response_1 = require("../../../types/v1-audio-to-video-create-response");
30
+ class AudioToVideoClient extends make_api_request_js_1.CoreResourceClient {
31
+ constructor(coreClient, opts) {
32
+ super(coreClient, opts);
33
+ }
34
+ /**
35
+ * Audio-to-Video
36
+ *
37
+ * Create a Audio To Video video
38
+ *
39
+ * This method provides a convenient way to create a request and automatically wait for completion and download outputs.
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * import { Client } from "../../../index.js";
44
+ *
45
+ * const client = new Client({ token: process.env["API_TOKEN"]!! });
46
+ * const res = await client.v1.audioToVideo.generate(
47
+ * {
48
+ * assets: {
49
+ * audioFilePath: "/path/to/1234.mp3",
50
+ * imageFilePath: "/path/to/1234.png",
51
+ * },
52
+ * endSeconds: 15.0,
53
+ * name: "Audio To Video video",
54
+ * resolution: "720p",
55
+ * startSeconds: 0.0,
56
+ * },
57
+ * {
58
+ * waitForCompletion: true,
59
+ * downloadOutputs: true,
60
+ * downloadDirectory: ".",
61
+ * },
62
+ * );
63
+ * ```
64
+ */
65
+ generate(request_1) {
66
+ return __awaiter(this, arguments, void 0, function* (request, opts = {}) {
67
+ const { waitForCompletion = true, downloadOutputs = true, downloadDirectory = undefined } = opts, createOpts = __rest(opts, ["waitForCompletion", "downloadOutputs", "downloadDirectory"]);
68
+ const fileClient = new files_1.FilesClient(this._client, this._opts);
69
+ const _a = request.assets, { audioFilePath, imageFilePath } = _a, restAssets = __rest(_a, ["audioFilePath", "imageFilePath"]);
70
+ (0, logger_1.getLogger)().debug(`Uploading file ${audioFilePath} to Magic Hour's storage`);
71
+ if (imageFilePath) {
72
+ (0, logger_1.getLogger)().debug(`Uploading file ${imageFilePath} to Magic Hour's storage`);
73
+ }
74
+ const [uploadedAudioFilePath, uploadedImageFilePath] = yield Promise.all([
75
+ fileClient.uploadFile(audioFilePath),
76
+ imageFilePath
77
+ ? fileClient.uploadFile(imageFilePath)
78
+ : Promise.resolve(imageFilePath),
79
+ ]);
80
+ (0, logger_1.getLogger)().info(`Uploaded file ${audioFilePath} to Magic Hour's storage as ${uploadedAudioFilePath}`);
81
+ if (imageFilePath) {
82
+ (0, logger_1.getLogger)().info(`Uploaded file ${imageFilePath} to Magic Hour's storage as ${uploadedImageFilePath}`);
83
+ }
84
+ const createResponse = yield this.create(Object.assign(Object.assign({}, request), { assets: Object.assign(Object.assign({}, restAssets), { audioFilePath: uploadedAudioFilePath, imageFilePath: imageFilePath ? uploadedImageFilePath : imageFilePath }) }), createOpts);
85
+ (0, logger_1.getLogger)().info(`Created AudioToVideoClient project ${createResponse.id}`);
86
+ const projectsClient = new video_projects_1.VideoProjectsClient(this._client, this._opts);
87
+ (0, logger_1.getLogger)().debug(`Checking result for AudioToVideoClient project ${createResponse.id}`);
88
+ const result = yield projectsClient.checkResult({ id: createResponse.id }, Object.assign({ waitForCompletion,
89
+ downloadOutputs,
90
+ downloadDirectory }, createOpts));
91
+ return result;
92
+ });
93
+ }
94
+ /**
95
+ * Audio-to-Video
96
+ *
97
+ * **What this API does**
98
+ *
99
+ * Create the same Audio 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.
100
+ *
101
+ * **Good for**
102
+ * - Automation and batch processing
103
+ * - Adding audio to video into apps, pipelines, or tools
104
+ *
105
+ * **How it works (3 steps)**
106
+ * 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`.
107
+ * 2) Send a request to create a audio to video job with the basic fields.
108
+ * 3) Check the job status until it's `complete`, then download the result from `downloads`.
109
+ *
110
+ * **Key options**
111
+ * - Inputs: usually a file, sometimes a YouTube link, depending on project type
112
+ * - Resolution: free users are limited to 576px; higher plans unlock HD and larger sizes
113
+ * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
114
+ *
115
+ * **Cost**
116
+ * 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.
117
+ *
118
+ * For detailed examples, see the [product page](https://magichour.ai/products/audio-to-video).
119
+ *
120
+ * POST /v1/audio-to-video
121
+ */
122
+ create(request, opts) {
123
+ return this._client.makeRequest({
124
+ method: "post",
125
+ path: "/v1/audio-to-video",
126
+ auth: ["bearerAuth"],
127
+ contentType: "application/json",
128
+ body: v1_audio_to_video_create_body_1.Schemas$V1AudioToVideoCreateBody.out.parse(request),
129
+ responseSchema: v1_audio_to_video_create_response_1.Schemas$V1AudioToVideoCreateResponse.in,
130
+ opts,
131
+ });
132
+ }
133
+ }
134
+ exports.AudioToVideoClient = AudioToVideoClient;
@@ -34,7 +34,7 @@ export type CreateRequest = {
34
34
  * * **`kling-3.0`**: 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
35
35
  * * **`veo3.1-lite`**: 8, 16, 24, 32, 40, 48, 56
36
36
  * * **`veo3.1`**: 4, 6, 8, 16, 24, 32, 40, 48, 56
37
- * * **`seedance`**: 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
37
+ * * **`seedance`**: 4, 5, 6, 7, 8, 9, 10, 11, 12
38
38
  * * **`seedance-2.0`**: 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
39
39
  * * **`sora-2`**: 4, 8, 12, 24, 36, 48, 60
40
40
  *
@@ -50,7 +50,7 @@ export type CreateRequest = {
50
50
  * The AI model to use for video generation.
51
51
  *
52
52
  * * `default`: uses our currently recommended model for general use. For paid tiers, defaults to `kling-3.0`. For free tiers, it defaults to `ltx-2.3`.
53
- * * `ltx-2.3`: Fast iteration with audio, lip-sync, and end frame
53
+ * * `ltx-2.3`: Fast iteration with lip-sync & end frame
54
54
  * * `wan-2.2`: Fast, strong visuals with effects
55
55
  * * `kling-2.5`: Motion, action, and camera control
56
56
  * * `kling-3.0`: Cinematic, multi-scene storytelling
@@ -12,6 +12,7 @@ export * as aiVoiceCloner from "./ai-voice-cloner";
12
12
  export * as aiVoiceGenerator from "./ai-voice-generator";
13
13
  export * as animation from "./animation";
14
14
  export * as audioProjects from "./audio-projects";
15
+ export * as audioToVideo from "./audio-to-video";
15
16
  export * as autoSubtitleGenerator from "./auto-subtitle-generator";
16
17
  export * as bodySwap from "./body-swap";
17
18
  export * as faceDetection from "./face-detection";
@@ -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.headSwap = exports.files = exports.faceSwapPhoto = exports.faceSwap = exports.faceDetection = exports.bodySwap = exports.autoSubtitleGenerator = exports.audioProjects = exports.animation = exports.aiVoiceGenerator = exports.aiVoiceCloner = exports.aiTalkingPhoto = exports.aiQrCodeGenerator = 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.headSwap = exports.files = exports.faceSwapPhoto = exports.faceSwap = exports.faceDetection = exports.bodySwap = exports.autoSubtitleGenerator = exports.audioToVideo = exports.audioProjects = exports.animation = exports.aiVoiceGenerator = exports.aiVoiceCloner = exports.aiTalkingPhoto = exports.aiQrCodeGenerator = 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"));
@@ -48,6 +48,7 @@ exports.aiVoiceCloner = __importStar(require("./ai-voice-cloner"));
48
48
  exports.aiVoiceGenerator = __importStar(require("./ai-voice-generator"));
49
49
  exports.animation = __importStar(require("./animation"));
50
50
  exports.audioProjects = __importStar(require("./audio-projects"));
51
+ exports.audioToVideo = __importStar(require("./audio-to-video"));
51
52
  exports.autoSubtitleGenerator = __importStar(require("./auto-subtitle-generator"));
52
53
  exports.bodySwap = __importStar(require("./body-swap"));
53
54
  exports.faceDetection = __importStar(require("./face-detection"));
@@ -13,6 +13,7 @@ import { AiVoiceClonerClient } from "../../resources/v1/ai-voice-cloner";
13
13
  import { AiVoiceGeneratorClient } from "../../resources/v1/ai-voice-generator";
14
14
  import { AnimationClient } from "../../resources/v1/animation";
15
15
  import { AudioProjectsClient } from "../../resources/v1/audio-projects";
16
+ import { AudioToVideoClient } from "../../resources/v1/audio-to-video";
16
17
  import { AutoSubtitleGeneratorClient } from "../../resources/v1/auto-subtitle-generator";
17
18
  import { BodySwapClient } from "../../resources/v1/body-swap";
18
19
  import { FaceDetectionClient } from "../../resources/v1/face-detection";
@@ -29,6 +30,7 @@ import { TextToVideoClient } from "../../resources/v1/text-to-video";
29
30
  import { VideoProjectsClient } from "../../resources/v1/video-projects";
30
31
  import { VideoToVideoClient } from "../../resources/v1/video-to-video";
31
32
  export declare class V1Client extends CoreResourceClient {
33
+ private _audioToVideoLazy?;
32
34
  private _bodySwapLazy?;
33
35
  private _headSwapLazy?;
34
36
  private _aiVoiceClonerLazy?;
@@ -88,4 +90,5 @@ export declare class V1Client extends CoreResourceClient {
88
90
  get aiVoiceCloner(): AiVoiceClonerClient;
89
91
  get headSwap(): HeadSwapClient;
90
92
  get bodySwap(): BodySwapClient;
93
+ get audioToVideo(): AudioToVideoClient;
91
94
  }
@@ -20,6 +20,7 @@ class V1Client extends make_api_request_js_1.CoreResourceClient {
20
20
  this.aiVoiceGenerator;
21
21
  this.animation;
22
22
  this.audioProjects;
23
+ this.audioToVideo;
23
24
  this.autoSubtitleGenerator;
24
25
  this.bodySwap;
25
26
  this.faceDetection;
@@ -176,5 +177,10 @@ class V1Client extends make_api_request_js_1.CoreResourceClient {
176
177
  var _a;
177
178
  return ((_a = this._bodySwapLazy) !== null && _a !== void 0 ? _a : (this._bodySwapLazy = new (require("./body-swap").BodySwapClient)(this._client, this._opts)));
178
179
  }
180
+ get audioToVideo() {
181
+ var _a;
182
+ return ((_a = this._audioToVideoLazy) !== null && _a !== void 0 ? _a : (this._audioToVideoLazy =
183
+ new (require("./audio-to-video").AudioToVideoClient)(this._client, this._opts)));
184
+ }
179
185
  }
180
186
  exports.V1Client = V1Client;
@@ -44,7 +44,7 @@ export type CreateRequest = {
44
44
  * * **`kling-3.0`**: 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
45
45
  * * **`veo3.1-lite`**: 8, 16, 24, 32, 40, 48, 56
46
46
  * * **`veo3.1`**: 4, 6, 8, 16, 24, 32, 40, 48, 56
47
- * * **`seedance`**: 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
47
+ * * **`seedance`**: 4, 5, 6, 7, 8, 9, 10, 11, 12
48
48
  * * **`seedance-2.0`**: 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
49
49
  * * **`sora-2`**: 4, 8, 12, 24, 36, 48, 60
50
50
  *
@@ -54,7 +54,7 @@ export type CreateRequest = {
54
54
  * The AI model to use for video generation.
55
55
  *
56
56
  * * `default`: uses our currently recommended model for general use. For paid tiers, defaults to `kling-3.0`. For free tiers, it defaults to `ltx-2.3`.
57
- * * `ltx-2.3`: Fast iteration with audio, lip-sync, and end frame
57
+ * * `ltx-2.3`: Fast iteration with lip-sync & end frame
58
58
  * * `wan-2.2`: Fast, strong visuals with effects
59
59
  * * `kling-2.5`: Motion, action, and camera control
60
60
  * * `kling-3.0`: Cinematic, multi-scene storytelling
@@ -35,6 +35,7 @@ export { V1AiImageUpscalerCreateBody } from "./v1-ai-image-upscaler-create-body"
35
35
  export { V1AiImageUpscalerCreateBodyAssets } from "./v1-ai-image-upscaler-create-body-assets";
36
36
  export { V1AiImageUpscalerCreateBodyStyle } from "./v1-ai-image-upscaler-create-body-style";
37
37
  export { V1AiImageUpscalerCreateBodyStyleEnhancementEnum } from "./v1-ai-image-upscaler-create-body-style-enhancement-enum";
38
+ export { V1AiImageUpscalerCreateBodyStyleModeEnum } from "./v1-ai-image-upscaler-create-body-style-mode-enum";
38
39
  export { V1AiImageUpscalerCreateResponse } from "./v1-ai-image-upscaler-create-response";
39
40
  export { V1AiMemeGeneratorCreateBody } from "./v1-ai-meme-generator-create-body";
40
41
  export { V1AiMemeGeneratorCreateBodyStyle } from "./v1-ai-meme-generator-create-body-style";
@@ -68,6 +69,11 @@ export { V1AudioProjectsGetResponse } from "./v1-audio-projects-get-response";
68
69
  export { V1AudioProjectsGetResponseDownloadsItem } from "./v1-audio-projects-get-response-downloads-item";
69
70
  export { V1AudioProjectsGetResponseError } from "./v1-audio-projects-get-response-error";
70
71
  export { V1AudioProjectsGetResponseStatusEnum } from "./v1-audio-projects-get-response-status-enum";
72
+ export { V1AudioToVideoCreateBody } from "./v1-audio-to-video-create-body";
73
+ export { V1AudioToVideoCreateBodyAssets } from "./v1-audio-to-video-create-body-assets";
74
+ export { V1AudioToVideoCreateBodyResolutionEnum } from "./v1-audio-to-video-create-body-resolution-enum";
75
+ export { V1AudioToVideoCreateBodyStyle } from "./v1-audio-to-video-create-body-style";
76
+ export { V1AudioToVideoCreateResponse } from "./v1-audio-to-video-create-response";
71
77
  export { V1AutoSubtitleGeneratorCreateBody } from "./v1-auto-subtitle-generator-create-body";
72
78
  export { V1AutoSubtitleGeneratorCreateBodyAssets } from "./v1-auto-subtitle-generator-create-body-assets";
73
79
  export { V1AutoSubtitleGeneratorCreateBodyStyle } from "./v1-auto-subtitle-generator-create-body-style";
@@ -9,15 +9,15 @@
9
9
  * - Max additional input images: 2
10
10
  * - `nano-banana` - from 50 credits/image
11
11
  * - Supported resolutions: 640px, 1k
12
- * - Available for tiers: free, creator, pro, business
12
+ * - Available for tiers: creator, pro, business
13
13
  * - Max additional input images: 9
14
14
  * - `nano-banana-2` - from 100 credits/image
15
15
  * - Supported resolutions: 640px, 1k, 2k, 4k
16
- * - Available for tiers: free, creator, pro, business
16
+ * - Available for tiers: creator, pro, business
17
17
  * - Max additional input images: 9
18
18
  * - `seedream-v4` - from 40 credits/image
19
19
  * - Supported resolutions: 640px, 1k, 2k, 4k
20
- * - Available for tiers: free, creator, pro, business
20
+ * - Available for tiers: creator, pro, business
21
21
  * - Max additional input images: 9
22
22
  * - `nano-banana-pro` - from 150 credits/image
23
23
  * - Supported resolutions: 1k, 2k, 4k
@@ -28,15 +28,15 @@ export type V1AiImageEditorCreateBody = {
28
28
  * - Max additional input images: 2
29
29
  * - `nano-banana` - from 50 credits/image
30
30
  * - Supported resolutions: 640px, 1k
31
- * - Available for tiers: free, creator, pro, business
31
+ * - Available for tiers: creator, pro, business
32
32
  * - Max additional input images: 9
33
33
  * - `nano-banana-2` - from 100 credits/image
34
34
  * - Supported resolutions: 640px, 1k, 2k, 4k
35
- * - Available for tiers: free, creator, pro, business
35
+ * - Available for tiers: creator, pro, business
36
36
  * - Max additional input images: 9
37
37
  * - `seedream-v4` - from 40 credits/image
38
38
  * - Supported resolutions: 640px, 1k, 2k, 4k
39
- * - Available for tiers: free, creator, pro, business
39
+ * - Available for tiers: creator, pro, business
40
40
  * - Max additional input images: 9
41
41
  * - `nano-banana-pro` - from 150 credits/image
42
42
  * - Supported resolutions: 1k, 2k, 4k