magic-hour 0.61.0 → 0.63.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 (60) 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 +10 -5
  5. package/dist/resources/v1/ai-image-editor/request-types.js +2 -0
  6. package/dist/resources/v1/ai-image-generator/request-types.d.ts +10 -5
  7. package/dist/resources/v1/ai-image-generator/request-types.js +2 -0
  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 +136 -0
  14. package/dist/resources/v1/files/upload-urls/resource-client.d.ts +1 -1
  15. package/dist/resources/v1/files/upload-urls/resource-client.js +1 -1
  16. package/dist/resources/v1/image-to-video/request-types.d.ts +27 -36
  17. package/dist/resources/v1/image-to-video/request-types.js +4 -2
  18. package/dist/resources/v1/index.d.ts +1 -0
  19. package/dist/resources/v1/index.js +2 -1
  20. package/dist/resources/v1/resource-client.d.ts +3 -0
  21. package/dist/resources/v1/resource-client.js +6 -0
  22. package/dist/resources/v1/text-to-video/request-types.d.ts +32 -43
  23. package/dist/resources/v1/text-to-video/request-types.js +4 -2
  24. package/dist/types/index.d.ts +5 -0
  25. package/dist/types/v1-ai-image-editor-create-body-model-enum.d.ts +8 -4
  26. package/dist/types/v1-ai-image-editor-create-body-resolution-enum.d.ts +1 -0
  27. package/dist/types/v1-ai-image-editor-create-body.d.ts +10 -5
  28. package/dist/types/v1-ai-image-editor-create-body.js +2 -0
  29. package/dist/types/v1-ai-image-generator-create-body-model-enum.d.ts +8 -4
  30. package/dist/types/v1-ai-image-generator-create-body-resolution-enum.d.ts +1 -0
  31. package/dist/types/v1-ai-image-generator-create-body.d.ts +10 -5
  32. package/dist/types/v1-ai-image-generator-create-body.js +2 -0
  33. package/dist/types/v1-ai-voice-generator-create-body-style-voice-name-enum.d.ts +2 -2
  34. package/dist/types/v1-ai-voice-generator-create-body-style.d.ts +3 -3
  35. package/dist/types/v1-ai-voice-generator-create-body-style.js +590 -0
  36. package/dist/types/v1-audio-projects-get-response.d.ts +1 -1
  37. package/dist/types/v1-audio-to-video-create-body-assets.d.ts +37 -0
  38. package/dist/types/v1-audio-to-video-create-body-assets.js +71 -0
  39. package/dist/types/v1-audio-to-video-create-body-resolution-enum.d.ts +4 -0
  40. package/dist/types/v1-audio-to-video-create-body-resolution-enum.js +2 -0
  41. package/dist/types/v1-audio-to-video-create-body-style.d.ts +22 -0
  42. package/dist/types/v1-audio-to-video-create-body-style.js +67 -0
  43. package/dist/types/v1-audio-to-video-create-body.d.ts +49 -0
  44. package/dist/types/v1-audio-to-video-create-body.js +89 -0
  45. package/dist/types/v1-audio-to-video-create-response.d.ts +36 -0
  46. package/dist/types/v1-audio-to-video-create-response.js +75 -0
  47. package/dist/types/v1-files-upload-urls-create-body-items-item.d.ts +1 -1
  48. package/dist/types/v1-image-projects-get-response.d.ts +1 -1
  49. package/dist/types/v1-image-to-video-create-body-assets.d.ts +5 -7
  50. package/dist/types/v1-image-to-video-create-body-model-enum.d.ts +7 -10
  51. package/dist/types/v1-image-to-video-create-body-resolution-enum.d.ts +6 -8
  52. package/dist/types/v1-image-to-video-create-body.d.ts +27 -36
  53. package/dist/types/v1-image-to-video-create-body.js +4 -2
  54. package/dist/types/v1-text-to-video-create-body-aspect-ratio-enum.d.ts +5 -7
  55. package/dist/types/v1-text-to-video-create-body-model-enum.d.ts +7 -10
  56. package/dist/types/v1-text-to-video-create-body-resolution-enum.d.ts +6 -8
  57. package/dist/types/v1-text-to-video-create-body.d.ts +32 -43
  58. package/dist/types/v1-text-to-video-create-body.js +4 -2
  59. package/dist/types/v1-video-projects-get-response.d.ts +1 -1
  60. 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
+ - [generate](src/resources/v1/audio-to-video/README.md#generate) - Audio To Video Generate Workflow
278
+ - [create](src/resources/v1/audio-to-video/README.md#create) - Audio-to-Video
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.62.0"
3
+ MockServer = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.64.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.62.0";
7
+ Environment["MockServer"] = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.64.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
@@ -46,9 +46,13 @@ export type CreateRequest = {
46
46
  * - Supported resolutions: 640px, 1k, 2k, 4k
47
47
  * - Available for tiers: creator, pro, business
48
48
  * - Max additional input images: 9
49
+ * - `gpt-image-2` - from 50 credits/image
50
+ * - Supported resolutions: 640px, 1k, 2k, 4k
51
+ * - Available for tiers: creator, pro, business
52
+ * - Max additional input images: 9
49
53
  *
50
54
  */
51
- model?: ("default" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "qwen-edit" | "seedream-v4" | "seedream-v4.5") | undefined;
55
+ model?: ("default" | "gpt-image-2" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "qwen-edit" | "seedream-v4" | "seedream-v4.5") | undefined;
52
56
  /**
53
57
  * Give your image a custom name for easy identification.
54
58
  */
@@ -70,6 +74,7 @@ export type CreateRequest = {
70
74
  * - `seedream-v4` - 640px, 1k, 2k, 4k
71
75
  * - `nano-banana-pro` - 1k, 2k, 4k
72
76
  * - `seedream-v4.5` - 640px, 1k, 2k, 4k
77
+ * - `gpt-image-2` - 640px, 1k, 2k, 4k
73
78
  *
74
79
  * Note: Resolution availability depends on the model and your subscription tier.
75
80
  */
@@ -85,7 +90,7 @@ export type External$CreateRequest = {
85
90
  aspect_ratio?: ("16:9" | "1:1" | "2:3" | "3:2" | "4:3" | "4:5" | "9:16" | "auto") | undefined;
86
91
  assets: External$V1AiImageEditorCreateBodyAssets;
87
92
  image_count?: number | undefined;
88
- model?: ("default" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "qwen-edit" | "seedream-v4" | "seedream-v4.5") | undefined;
93
+ model?: ("default" | "gpt-image-2" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "qwen-edit" | "seedream-v4" | "seedream-v4.5") | undefined;
89
94
  name?: string | undefined;
90
95
  resolution?: ("1k" | "2k" | "4k" | "640px" | "auto") | undefined;
91
96
  style: External$V1AiImageEditorCreateBodyStyle;
@@ -51,6 +51,7 @@ const SchemaIn$CreateRequest = z
51
51
  model: z
52
52
  .enum([
53
53
  "default",
54
+ "gpt-image-2",
54
55
  "nano-banana",
55
56
  "nano-banana-2",
56
57
  "nano-banana-pro",
@@ -88,6 +89,7 @@ const SchemaOut$CreateRequest = z
88
89
  model: z
89
90
  .enum([
90
91
  "default",
92
+ "gpt-image-2",
91
93
  "nano-banana",
92
94
  "nano-banana-2",
93
95
  "nano-banana-pro",
@@ -27,26 +27,30 @@ 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
42
42
  * - Available for tiers: creator, pro, business
43
43
  * - Image count allowed: 1, 4, 9, 16
44
+ * - `gpt-image-2` - from 50 credits/image
45
+ * - Supported resolutions: 640px, 1k, 2k, 4k
46
+ * - Available for tiers: creator, pro, business
47
+ * - Image count allowed: 1, 2, 3, 4
44
48
  *
45
49
  * **Deprecated Enum Values:**
46
50
  * - `seedream` - Use `seedream-v4` instead.
47
51
  *
48
52
  */
49
- model?: ("default" | "flux-schnell" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "seedream" | "seedream-v4" | "z-image-turbo") | undefined;
53
+ model?: ("default" | "flux-schnell" | "gpt-image-2" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "seedream" | "seedream-v4" | "z-image-turbo") | undefined;
50
54
  /**
51
55
  * Give your image a custom name for easy identification.
52
56
  */
@@ -74,6 +78,7 @@ export type CreateRequest = {
74
78
  * - `nano-banana` - 640px, 1k
75
79
  * - `nano-banana-2` - 640px, 1k, 2k, 4k
76
80
  * - `nano-banana-pro` - 1k, 2k, 4k
81
+ * - `gpt-image-2` - 640px, 1k, 2k, 4k
77
82
  *
78
83
  * Note: Resolution availability depends on the model and your subscription tier.
79
84
  */
@@ -91,7 +96,7 @@ export type CreateRequest = {
91
96
  export type External$CreateRequest = {
92
97
  aspect_ratio?: ("16:9" | "1:1" | "9:16") | undefined;
93
98
  image_count: number;
94
- model?: ("default" | "flux-schnell" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "seedream" | "seedream-v4" | "z-image-turbo") | undefined;
99
+ model?: ("default" | "flux-schnell" | "gpt-image-2" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "seedream" | "seedream-v4" | "z-image-turbo") | undefined;
95
100
  name?: string | undefined;
96
101
  orientation?: ("landscape" | "portrait" | "square") | undefined;
97
102
  resolution?: ("1k" | "2k" | "4k" | "640px" | "auto") | undefined;
@@ -48,6 +48,7 @@ const SchemaIn$CreateRequest = z
48
48
  .enum([
49
49
  "default",
50
50
  "flux-schnell",
51
+ "gpt-image-2",
51
52
  "nano-banana",
52
53
  "nano-banana-2",
53
54
  "nano-banana-pro",
@@ -84,6 +85,7 @@ const SchemaOut$CreateRequest = z
84
85
  .enum([
85
86
  "default",
86
87
  "flux-schnell",
88
+ "gpt-image-2",
87
89
  "nano-banana",
88
90
  "nano-banana-2",
89
91
  "nano-banana-pro",
@@ -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,136 @@
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
85
+ ? uploadedImageFilePath
86
+ : imageFilePath }) }), createOpts);
87
+ (0, logger_1.getLogger)().info(`Created AudioToVideoClient project ${createResponse.id}`);
88
+ const projectsClient = new video_projects_1.VideoProjectsClient(this._client, this._opts);
89
+ (0, logger_1.getLogger)().debug(`Checking result for AudioToVideoClient project ${createResponse.id}`);
90
+ const result = yield projectsClient.checkResult({ id: createResponse.id }, Object.assign({ waitForCompletion,
91
+ downloadOutputs,
92
+ downloadDirectory }, createOpts));
93
+ return result;
94
+ });
95
+ }
96
+ /**
97
+ * Audio-to-Video
98
+ *
99
+ * **What this API does**
100
+ *
101
+ * 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.
102
+ *
103
+ * **Good for**
104
+ * - Automation and batch processing
105
+ * - Adding audio to video into apps, pipelines, or tools
106
+ *
107
+ * **How it works (3 steps)**
108
+ * 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`.
109
+ * 2) Send a request to create a audio to video job with the basic fields.
110
+ * 3) Check the job status until it's `complete`, then download the result from `downloads`.
111
+ *
112
+ * **Key options**
113
+ * - Inputs: usually a file, sometimes a YouTube link, depending on project type
114
+ * - Resolution: free users are limited to 576px; higher plans unlock HD and larger sizes
115
+ * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
116
+ *
117
+ * **Cost**
118
+ * 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.
119
+ *
120
+ * For detailed examples, see the [product page](https://magichour.ai/products/audio-to-video).
121
+ *
122
+ * POST /v1/audio-to-video
123
+ */
124
+ create(request, opts) {
125
+ return this._client.makeRequest({
126
+ method: "post",
127
+ path: "/v1/audio-to-video",
128
+ auth: ["bearerAuth"],
129
+ contentType: "application/json",
130
+ body: v1_audio_to_video_create_body_1.Schemas$V1AudioToVideoCreateBody.out.parse(request),
131
+ responseSchema: v1_audio_to_video_create_response_1.Schemas$V1AudioToVideoCreateResponse.in,
132
+ opts,
133
+ });
134
+ }
135
+ }
136
+ exports.AudioToVideoClient = AudioToVideoClient;
@@ -13,7 +13,7 @@ export declare class UploadUrlsClient extends CoreResourceClient {
13
13
  * **Valid file extensions per asset type**:
14
14
  * - video: mp4, m4v, mov, webm
15
15
  * - audio: mp3, wav, aac, flac, webm, m4a
16
- * - image: png, jpg, jpeg, heic, webp, avif, jp2, tiff, bmp
16
+ * - image: png, jpg, jpeg, heic, heif, webp, avif, jp2, tiff, bmp
17
17
  * - gif: gif, webp, webm
18
18
  *
19
19
  * > Note: `gif` is only supported for face swap API `video_file_path` field.
@@ -18,7 +18,7 @@ class UploadUrlsClient extends make_api_request_js_1.CoreResourceClient {
18
18
  * **Valid file extensions per asset type**:
19
19
  * - video: mp4, m4v, mov, webm
20
20
  * - audio: mp3, wav, aac, flac, webm, m4a
21
- * - image: png, jpg, jpeg, heic, webp, avif, jp2, tiff, bmp
21
+ * - image: png, jpg, jpeg, heic, heif, webp, avif, jp2, tiff, bmp
22
22
  * - gif: gif, webp, webm
23
23
  *
24
24
  * > Note: `gif` is only supported for face swap API `video_file_path` field.