magic-hour 0.84.0 → 0.86.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 (58) hide show
  1. package/README.md +8 -0
  2. package/dist/environment.d.ts +1 -1
  3. package/dist/environment.js +1 -1
  4. package/dist/resources/v1/ai-music-generator/index.d.ts +2 -0
  5. package/dist/resources/v1/ai-music-generator/index.js +5 -0
  6. package/dist/resources/v1/ai-music-generator/request-types.d.ts +32 -0
  7. package/dist/resources/v1/ai-music-generator/request-types.js +78 -0
  8. package/dist/resources/v1/ai-music-generator/resource-client.d.ts +31 -0
  9. package/dist/resources/v1/ai-music-generator/resource-client.js +78 -0
  10. package/dist/resources/v1/ai-video-editor/resource-client.d.ts +1 -1
  11. package/dist/resources/v1/ai-video-editor/resource-client.js +1 -1
  12. package/dist/resources/v1/ai-video-translator/resource-client.d.ts +1 -1
  13. package/dist/resources/v1/ai-video-translator/resource-client.js +1 -1
  14. package/dist/resources/v1/ai-video-upscaler/index.d.ts +2 -0
  15. package/dist/resources/v1/ai-video-upscaler/index.js +5 -0
  16. package/dist/resources/v1/ai-video-upscaler/request-types.d.ts +43 -0
  17. package/dist/resources/v1/ai-video-upscaler/request-types.js +84 -0
  18. package/dist/resources/v1/ai-video-upscaler/resource-client.d.ts +60 -0
  19. package/dist/resources/v1/ai-video-upscaler/resource-client.js +103 -0
  20. package/dist/resources/v1/audio-to-video/resource-client.d.ts +1 -1
  21. package/dist/resources/v1/audio-to-video/resource-client.js +1 -1
  22. package/dist/resources/v1/character-replace/resource-client.d.ts +1 -1
  23. package/dist/resources/v1/character-replace/resource-client.js +1 -1
  24. package/dist/resources/v1/face-swap/resource-client.d.ts +1 -1
  25. package/dist/resources/v1/face-swap/resource-client.js +1 -1
  26. package/dist/resources/v1/image-to-video/resource-client.d.ts +1 -1
  27. package/dist/resources/v1/image-to-video/resource-client.js +1 -1
  28. package/dist/resources/v1/index.d.ts +2 -0
  29. package/dist/resources/v1/index.js +3 -1
  30. package/dist/resources/v1/lip-sync/resource-client.d.ts +1 -1
  31. package/dist/resources/v1/lip-sync/resource-client.js +1 -1
  32. package/dist/resources/v1/resource-client.d.ts +6 -0
  33. package/dist/resources/v1/resource-client.js +12 -0
  34. package/dist/resources/v1/text-to-video/request-types.d.ts +1 -1
  35. package/dist/resources/v1/text-to-video/resource-client.d.ts +1 -1
  36. package/dist/resources/v1/text-to-video/resource-client.js +1 -1
  37. package/dist/resources/v1/video-to-video/resource-client.d.ts +1 -1
  38. package/dist/resources/v1/video-to-video/resource-client.js +1 -1
  39. package/dist/types/index.d.ts +7 -0
  40. package/dist/types/v1-ai-music-generator-create-body-style.d.ts +34 -0
  41. package/dist/types/v1-ai-music-generator-create-body-style.js +77 -0
  42. package/dist/types/v1-ai-music-generator-create-body.d.ts +32 -0
  43. package/dist/types/v1-ai-music-generator-create-body.js +78 -0
  44. package/dist/types/v1-ai-music-generator-create-response.d.ts +29 -0
  45. package/dist/types/v1-ai-music-generator-create-response.js +71 -0
  46. package/dist/types/v1-ai-video-upscaler-create-body-assets.d.ts +27 -0
  47. package/dist/types/v1-ai-video-upscaler-create-body-assets.js +67 -0
  48. package/dist/types/v1-ai-video-upscaler-create-body-resolution-enum.d.ts +4 -0
  49. package/dist/types/v1-ai-video-upscaler-create-body-resolution-enum.js +2 -0
  50. package/dist/types/v1-ai-video-upscaler-create-body.d.ts +43 -0
  51. package/dist/types/v1-ai-video-upscaler-create-body.js +84 -0
  52. package/dist/types/v1-ai-video-upscaler-create-response.d.ts +36 -0
  53. package/dist/types/v1-ai-video-upscaler-create-response.js +75 -0
  54. package/dist/types/v1-ai-voice-generator-create-body-style-voice-name-enum.d.ts +2 -2
  55. package/dist/types/v1-ai-voice-generator-create-body-style.d.ts +3 -3
  56. package/dist/types/v1-ai-voice-generator-create-body-style.js +0 -4
  57. package/dist/types/v1-text-to-video-create-body.d.ts +1 -1
  58. package/package.json +1 -1
package/README.md CHANGED
@@ -268,6 +268,10 @@ Valid values are: `none`, `error`, `warn`, `info`, `debug` (case insensitive). I
268
268
  - [create](src/resources/v1/ai-meme-generator/README.md#create) - AI Meme Generator
269
269
  - [generate](src/resources/v1/ai-meme-generator/README.md#generate) - AI Meme Generator Generate Workflow
270
270
 
271
+ ### [v1.aiMusicGenerator](src/resources/v1/ai-music-generator/README.md)
272
+
273
+ - [create](src/resources/v1/ai-music-generator/README.md#create) - AI Music Generator
274
+
271
275
  ### [v1.aiQrCodeGenerator](src/resources/v1/ai-qr-code-generator/README.md)
272
276
 
273
277
  - [create](src/resources/v1/ai-qr-code-generator/README.md#create) - AI QR Code Generator
@@ -292,6 +296,10 @@ Valid values are: `none`, `error`, `warn`, `info`, `debug` (case insensitive). I
292
296
  - [create](src/resources/v1/ai-video-translator/README.md#create) - AI Video Translator
293
297
  - [generate](src/resources/v1/ai-video-translator/README.md#generate) - Generate video translation
294
298
 
299
+ ### [v1.aiVideoUpscaler](src/resources/v1/ai-video-upscaler/README.md)
300
+
301
+ - [create](src/resources/v1/ai-video-upscaler/README.md#create) - AI Video Upscaler
302
+
295
303
  ### [v1.aiVoiceCloner](src/resources/v1/ai-voice-cloner/README.md)
296
304
 
297
305
  - [create](src/resources/v1/ai-voice-cloner/README.md#create) - AI Voice Cloner
@@ -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.88.0"
3
+ MockServer = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.90.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.88.0";
7
+ Environment["MockServer"] = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.90.0";
8
8
  })(Environment || (exports.Environment = Environment = {}));
@@ -0,0 +1,2 @@
1
+ export { CreateRequest } from "./request-types";
2
+ export { AiMusicGeneratorClient } from "./resource-client";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AiMusicGeneratorClient = void 0;
4
+ var resource_client_1 = require("./resource-client");
5
+ Object.defineProperty(exports, "AiMusicGeneratorClient", { enumerable: true, get: function () { return resource_client_1.AiMusicGeneratorClient; } });
@@ -0,0 +1,32 @@
1
+ import * as z from "zod";
2
+ import { External$V1AiMusicGeneratorCreateBodyStyle, V1AiMusicGeneratorCreateBodyStyle } from "../../../types/v1-ai-music-generator-create-body-style.js";
3
+ /**
4
+ * CreateRequest
5
+ */
6
+ export type CreateRequest = {
7
+ /**
8
+ * Requested track duration in seconds, from 15 to 300. Determines credits charged.
9
+ */
10
+ duration: number;
11
+ /**
12
+ * Give your audio a custom name for easy identification.
13
+ */
14
+ name?: string | undefined;
15
+ style: V1AiMusicGeneratorCreateBodyStyle;
16
+ [additionalProperty: string]: number | (string | undefined) | V1AiMusicGeneratorCreateBodyStyle | any | null | undefined;
17
+ };
18
+ /**
19
+ * @internal
20
+ * CreateRequest without any key transformation, this is what
21
+ * we expect to come in as network data
22
+ */
23
+ export type External$CreateRequest = {
24
+ duration: number;
25
+ name?: string | undefined;
26
+ style: External$V1AiMusicGeneratorCreateBodyStyle;
27
+ [additionalProperty: string]: number | (string | undefined) | External$V1AiMusicGeneratorCreateBodyStyle | External$CreateRequest | null | undefined;
28
+ };
29
+ export declare const Schemas$CreateRequest: {
30
+ in: z.ZodType<CreateRequest, z.ZodTypeDef, unknown>;
31
+ out: z.ZodType<External$CreateRequest, z.ZodTypeDef, CreateRequest>;
32
+ };
@@ -0,0 +1,78 @@
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_ai_music_generator_create_body_style_1 = require("../../../types/v1-ai-music-generator-create-body-style.js");
40
+ /**
41
+ * Takes network data, validates it, and transforms keys to match typescript object CreateRequest
42
+ */
43
+ const SchemaIn$CreateRequest = z
44
+ .object({
45
+ duration: z.number().int(),
46
+ name: z.string().optional(),
47
+ style: v1_ai_music_generator_create_body_style_1.Schemas$V1AiMusicGeneratorCreateBodyStyle.in,
48
+ })
49
+ .catchall(make_api_request_js_1.zodRequiredAny)
50
+ .transform((obj) => {
51
+ return (0, make_api_request_js_1.zodTransform)(obj, {
52
+ duration: "duration",
53
+ name: "name",
54
+ style: "style",
55
+ });
56
+ });
57
+ /**
58
+ * @internal
59
+ * Takes typescript data, validates it, and maps keys to match the expected external object External$CreateRequest
60
+ */
61
+ const SchemaOut$CreateRequest = z
62
+ .object({
63
+ duration: z.number().int(),
64
+ name: z.string().optional(),
65
+ style: v1_ai_music_generator_create_body_style_1.Schemas$V1AiMusicGeneratorCreateBodyStyle.out,
66
+ })
67
+ .catchall(make_api_request_js_1.zodRequiredAny)
68
+ .transform((obj) => {
69
+ return (0, make_api_request_js_1.zodTransform)(obj, {
70
+ duration: "duration",
71
+ name: "name",
72
+ style: "style",
73
+ });
74
+ });
75
+ exports.Schemas$CreateRequest = {
76
+ in: SchemaIn$CreateRequest,
77
+ out: SchemaOut$CreateRequest,
78
+ };
@@ -0,0 +1,31 @@
1
+ import { ApiPromise, CoreClient, CoreResourceClient, RequestOptions, ResourceClientOptions } from "make-api-request-js";
2
+ import { GenerateOptions } from "../../../helpers/generate-type.js";
3
+ import * as requests from "./request-types.js";
4
+ import * as types from "../../../types/index.js";
5
+ export declare class AiMusicGeneratorClient extends CoreResourceClient {
6
+ constructor(coreClient: CoreClient, opts: ResourceClientOptions);
7
+ /**
8
+ * Generate music with automatic polling and downloads.
9
+ *
10
+ * Accepts the same request fields as create(). By default, waits for completion
11
+ * and downloads outputs. Use opts to disable waiting or downloading, or set
12
+ * the download directory.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const result = await client.v1.aiMusicGenerator.generate({
17
+ * duration: 120,
18
+ * style: { prompt: "Dreamy synthwave with warm bass" },
19
+ * });
20
+ * ```
21
+ */
22
+ generate(request: requests.CreateRequest, opts?: GenerateOptions): Promise<import("../audio-projects/resource-client").V1AudioProjectsGetResponseWithDownloads>;
23
+ /**
24
+ * AI Music Generator
25
+ *
26
+ * Generate music from a description, with optional custom lyrics or instrumental-only output. Costs 1 credits per requested second. Returns a project ID; poll GET /v1/audio-projects/{id} for status and downloads.
27
+ *
28
+ * POST /v1/ai-music-generator
29
+ */
30
+ create(request: requests.CreateRequest, opts?: RequestOptions): ApiPromise<types.V1AiMusicGeneratorCreateResponse>;
31
+ }
@@ -0,0 +1,78 @@
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.AiMusicGeneratorClient = void 0;
24
+ const make_api_request_js_1 = require("make-api-request-js");
25
+ const logger_1 = require("../../../logger.js");
26
+ const audio_projects_1 = require("../audio-projects/index.js");
27
+ const v1_ai_music_generator_create_body_1 = require("../../../types/v1-ai-music-generator-create-body.js");
28
+ const v1_ai_music_generator_create_response_1 = require("../../../types/v1-ai-music-generator-create-response.js");
29
+ class AiMusicGeneratorClient extends make_api_request_js_1.CoreResourceClient {
30
+ constructor(coreClient, opts) {
31
+ super(coreClient, opts);
32
+ }
33
+ /**
34
+ * Generate music with automatic polling and downloads.
35
+ *
36
+ * Accepts the same request fields as create(). By default, waits for completion
37
+ * and downloads outputs. Use opts to disable waiting or downloading, or set
38
+ * the download directory.
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * const result = await client.v1.aiMusicGenerator.generate({
43
+ * duration: 120,
44
+ * style: { prompt: "Dreamy synthwave with warm bass" },
45
+ * });
46
+ * ```
47
+ */
48
+ generate(request_1) {
49
+ return __awaiter(this, arguments, void 0, function* (request, opts = {}) {
50
+ const { waitForCompletion = true, downloadOutputs = true, downloadDirectory = undefined } = opts, createOpts = __rest(opts, ["waitForCompletion", "downloadOutputs", "downloadDirectory"]);
51
+ const createResponse = yield this.create(request, createOpts);
52
+ (0, logger_1.getLogger)().info(`Created ai-music-generator project ${createResponse.id}`);
53
+ const projectsClient = new audio_projects_1.AudioProjectsClient(this._client, this._opts);
54
+ return projectsClient.checkResult({ id: createResponse.id }, Object.assign({ waitForCompletion,
55
+ downloadOutputs,
56
+ downloadDirectory }, createOpts));
57
+ });
58
+ }
59
+ /**
60
+ * AI Music Generator
61
+ *
62
+ * Generate music from a description, with optional custom lyrics or instrumental-only output. Costs 1 credits per requested second. Returns a project ID; poll GET /v1/audio-projects/{id} for status and downloads.
63
+ *
64
+ * POST /v1/ai-music-generator
65
+ */
66
+ create(request, opts) {
67
+ return this._client.makeRequest({
68
+ method: "post",
69
+ path: "/v1/ai-music-generator",
70
+ auth: ["bearerAuth"],
71
+ contentType: "application/json",
72
+ body: v1_ai_music_generator_create_body_1.Schemas$V1AiMusicGeneratorCreateBody.out.parse(request),
73
+ responseSchema: v1_ai_music_generator_create_response_1.Schemas$V1AiMusicGeneratorCreateResponse.in,
74
+ opts,
75
+ });
76
+ }
77
+ }
78
+ exports.AiMusicGeneratorClient = AiMusicGeneratorClient;
@@ -65,7 +65,7 @@ export declare class AiVideoEditorClient extends CoreResourceClient {
65
65
  * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
66
66
  *
67
67
  * **Cost**
68
- * Credits are only charged for the frames that actually render. You'll see an estimate when the job is queued, and the final total after it's done.
68
+ * Credits are charged when the job is queued (`credits_charged` in the response). Tools billed per frame charge an estimate and settle to the frames that actually render once the job finishes; tools billed per second charge the final amount upfront. Failed jobs are refunded.
69
69
  *
70
70
  * For detailed examples, see the [product page](https://magichour.ai/products/ai-video-editor).
71
71
  *
@@ -99,7 +99,7 @@ class AiVideoEditorClient extends make_api_request_js_1.CoreResourceClient {
99
99
  * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
100
100
  *
101
101
  * **Cost**
102
- * 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.
102
+ * Credits are charged when the job is queued (`credits_charged` in the response). Tools billed per frame charge an estimate and settle to the frames that actually render once the job finishes; tools billed per second charge the final amount upfront. Failed jobs are refunded.
103
103
  *
104
104
  * For detailed examples, see the [product page](https://magichour.ai/products/ai-video-editor).
105
105
  *
@@ -32,7 +32,7 @@ export declare class AiVideoTranslatorClient extends CoreResourceClient {
32
32
  * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
33
33
  *
34
34
  * **Cost**
35
- * 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.
35
+ * Credits are charged when the job is queued (`credits_charged` in the response). Tools billed per frame charge an estimate and settle to the frames that actually render once the job finishes; tools billed per second charge the final amount upfront. Failed jobs are refunded.
36
36
  *
37
37
  * For detailed examples, see the [product page](https://magichour.ai/products/ai-video-translator).
38
38
  *
@@ -63,7 +63,7 @@ class AiVideoTranslatorClient extends make_api_request_js_1.CoreResourceClient {
63
63
  * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
64
64
  *
65
65
  * **Cost**
66
- * 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.
66
+ * Credits are charged when the job is queued (`credits_charged` in the response). Tools billed per frame charge an estimate and settle to the frames that actually render once the job finishes; tools billed per second charge the final amount upfront. Failed jobs are refunded.
67
67
  *
68
68
  * For detailed examples, see the [product page](https://magichour.ai/products/ai-video-translator).
69
69
  *
@@ -0,0 +1,2 @@
1
+ export { CreateRequest } from "./request-types";
2
+ export { AiVideoUpscalerClient } from "./resource-client";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AiVideoUpscalerClient = void 0;
4
+ var resource_client_1 = require("./resource-client");
5
+ Object.defineProperty(exports, "AiVideoUpscalerClient", { enumerable: true, get: function () { return resource_client_1.AiVideoUpscalerClient; } });
@@ -0,0 +1,43 @@
1
+ import * as z from "zod";
2
+ import { External$V1AiVideoUpscalerCreateBodyAssets, V1AiVideoUpscalerCreateBodyAssets } from "../../../types/v1-ai-video-upscaler-create-body-assets.js";
3
+ /**
4
+ * CreateRequest
5
+ */
6
+ export type CreateRequest = {
7
+ /**
8
+ * Source video for the upscale job.
9
+ */
10
+ assets: V1AiVideoUpscalerCreateBodyAssets;
11
+ /**
12
+ * End time of your clip (seconds). Must be greater than start_seconds.
13
+ */
14
+ endSeconds: number;
15
+ /**
16
+ * Give your video a custom name for easy identification.
17
+ */
18
+ name?: string | undefined;
19
+ /**
20
+ * Output resolution. `720p` and `1080p` set the output's short side, `2k` and `4k` its long side; the aspect ratio is kept. Requires a paid plan.
21
+ */
22
+ resolution: "1080p" | "2k" | "4k" | "720p";
23
+ /**
24
+ * Start time of your clip (seconds). Must be ≥ 0.
25
+ */
26
+ startSeconds?: number | undefined;
27
+ };
28
+ /**
29
+ * @internal
30
+ * CreateRequest without any key transformation, this is what
31
+ * we expect to come in as network data
32
+ */
33
+ export type External$CreateRequest = {
34
+ assets: External$V1AiVideoUpscalerCreateBodyAssets;
35
+ end_seconds: number;
36
+ name?: string | undefined;
37
+ resolution: "1080p" | "2k" | "4k" | "720p";
38
+ start_seconds?: number | undefined;
39
+ };
40
+ export declare const Schemas$CreateRequest: {
41
+ in: z.ZodType<CreateRequest, z.ZodTypeDef, unknown>;
42
+ out: z.ZodType<External$CreateRequest, z.ZodTypeDef, CreateRequest>;
43
+ };
@@ -0,0 +1,84 @@
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_ai_video_upscaler_create_body_assets_1 = require("../../../types/v1-ai-video-upscaler-create-body-assets.js");
40
+ /**
41
+ * Takes network data, validates it, and transforms keys to match typescript object CreateRequest
42
+ */
43
+ const SchemaIn$CreateRequest = z
44
+ .object({
45
+ assets: v1_ai_video_upscaler_create_body_assets_1.Schemas$V1AiVideoUpscalerCreateBodyAssets.in,
46
+ end_seconds: z.number(),
47
+ name: z.string().optional(),
48
+ resolution: z.enum(["1080p", "2k", "4k", "720p"]),
49
+ start_seconds: z.number().optional(),
50
+ })
51
+ .transform((obj) => {
52
+ return (0, make_api_request_js_1.zodTransform)(obj, {
53
+ assets: "assets",
54
+ end_seconds: "endSeconds",
55
+ name: "name",
56
+ resolution: "resolution",
57
+ start_seconds: "startSeconds",
58
+ });
59
+ });
60
+ /**
61
+ * @internal
62
+ * Takes typescript data, validates it, and maps keys to match the expected external object External$CreateRequest
63
+ */
64
+ const SchemaOut$CreateRequest = z
65
+ .object({
66
+ assets: v1_ai_video_upscaler_create_body_assets_1.Schemas$V1AiVideoUpscalerCreateBodyAssets.out,
67
+ endSeconds: z.number(),
68
+ name: z.string().optional(),
69
+ resolution: z.enum(["1080p", "2k", "4k", "720p"]),
70
+ startSeconds: z.number().optional(),
71
+ })
72
+ .transform((obj) => {
73
+ return (0, make_api_request_js_1.zodTransform)(obj, {
74
+ assets: "assets",
75
+ endSeconds: "end_seconds",
76
+ name: "name",
77
+ resolution: "resolution",
78
+ startSeconds: "start_seconds",
79
+ });
80
+ });
81
+ exports.Schemas$CreateRequest = {
82
+ in: SchemaIn$CreateRequest,
83
+ out: SchemaOut$CreateRequest,
84
+ };
@@ -0,0 +1,60 @@
1
+ import { ApiPromise, CoreClient, CoreResourceClient, RequestOptions, ResourceClientOptions } from "make-api-request-js";
2
+ import { GenerateOptions, GenerateRequestType } from "../../../helpers/generate-type.js";
3
+ import * as requests from "./request-types.js";
4
+ import * as types from "../../../types/index.js";
5
+ type GenerateRequest = GenerateRequestType<requests.CreateRequest, {
6
+ /**
7
+ * Video to upscale. Accepts a local path, URL, or existing api-assets path.
8
+ */
9
+ videoFilePath: string;
10
+ }>;
11
+ export declare class AiVideoUpscalerClient extends CoreResourceClient {
12
+ constructor(coreClient: CoreClient, opts: ResourceClientOptions);
13
+ /**
14
+ * Generate upscaled video with automatic upload, polling and downloads.
15
+ *
16
+ * Accepts the same request fields as create(). By default, waits for completion
17
+ * and downloads outputs. Use opts to disable waiting or downloading, or set
18
+ * the download directory.
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * const result = await client.v1.aiVideoUpscaler.generate({
23
+ * assets: { videoFilePath: "path/to/video.mp4" },
24
+ * endSeconds: 5,
25
+ * resolution: "1080p",
26
+ * });
27
+ * ```
28
+ */
29
+ generate(request: GenerateRequest, opts?: GenerateOptions): Promise<import("../video-projects/resource-client").V1VideoProjectsGetResponseWithDownloads>;
30
+ /**
31
+ * AI Video Upscaler
32
+ *
33
+ * **What this API does**
34
+ *
35
+ * Create the same Video Upscaler 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.
36
+ *
37
+ * **Good for**
38
+ * - Automation and batch processing
39
+ * - Adding video upscaler into apps, pipelines, or tools
40
+ *
41
+ * **How it works (3 steps)**
42
+ * 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`.
43
+ * 2) Send a request to create a video upscaler job with the basic fields.
44
+ * 3) Check the job status until it's `complete`, then download the result from `downloads`.
45
+ *
46
+ * **Key options**
47
+ * - Inputs: usually a file, sometimes a YouTube link, depending on project type
48
+ * - Resolution: output size and plan requirements vary by workflow and model. Some workflows derive output size from the input video.
49
+ * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
50
+ *
51
+ * **Cost**
52
+ * Credits are charged when the job is queued (`credits_charged` in the response). Tools billed per frame charge an estimate and settle to the frames that actually render once the job finishes; tools billed per second charge the final amount upfront. Failed jobs are refunded.
53
+ *
54
+ * For detailed examples, see the [product page](https://magichour.ai/products/video-upscaler).
55
+ *
56
+ * POST /v1/ai-video-upscaler
57
+ */
58
+ create(request: requests.CreateRequest, opts?: RequestOptions): ApiPromise<types.V1AiVideoUpscalerCreateResponse>;
59
+ }
60
+ export {};
@@ -0,0 +1,103 @@
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.AiVideoUpscalerClient = void 0;
24
+ const make_api_request_js_1 = require("make-api-request-js");
25
+ const logger_1 = require("../../../logger.js");
26
+ const files_1 = require("../files/index.js");
27
+ const video_projects_1 = require("../video-projects/index.js");
28
+ const v1_ai_video_upscaler_create_body_1 = require("../../../types/v1-ai-video-upscaler-create-body.js");
29
+ const v1_ai_video_upscaler_create_response_1 = require("../../../types/v1-ai-video-upscaler-create-response.js");
30
+ class AiVideoUpscalerClient extends make_api_request_js_1.CoreResourceClient {
31
+ constructor(coreClient, opts) {
32
+ super(coreClient, opts);
33
+ }
34
+ /**
35
+ * Generate upscaled video with automatic upload, polling and downloads.
36
+ *
37
+ * Accepts the same request fields as create(). By default, waits for completion
38
+ * and downloads outputs. Use opts to disable waiting or downloading, or set
39
+ * the download directory.
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * const result = await client.v1.aiVideoUpscaler.generate({
44
+ * assets: { videoFilePath: "path/to/video.mp4" },
45
+ * endSeconds: 5,
46
+ * resolution: "1080p",
47
+ * });
48
+ * ```
49
+ */
50
+ generate(request_1) {
51
+ return __awaiter(this, arguments, void 0, function* (request, opts = {}) {
52
+ const { waitForCompletion = true, downloadOutputs = true, downloadDirectory = undefined } = opts, createOpts = __rest(opts, ["waitForCompletion", "downloadOutputs", "downloadDirectory"]);
53
+ const fileClient = new files_1.FilesClient(this._client, this._opts);
54
+ const uploadedVideoFilePath = yield fileClient.uploadFile(request.assets.videoFilePath);
55
+ const createResponse = yield this.create(Object.assign(Object.assign({}, request), { assets: Object.assign(Object.assign({}, request.assets), { videoFilePath: uploadedVideoFilePath }) }), createOpts);
56
+ (0, logger_1.getLogger)().info(`Created ai-video-upscaler project ${createResponse.id}`);
57
+ const projectsClient = new video_projects_1.VideoProjectsClient(this._client, this._opts);
58
+ return projectsClient.checkResult({ id: createResponse.id }, Object.assign({ waitForCompletion,
59
+ downloadOutputs,
60
+ downloadDirectory }, createOpts));
61
+ });
62
+ }
63
+ /**
64
+ * AI Video Upscaler
65
+ *
66
+ * **What this API does**
67
+ *
68
+ * Create the same Video Upscaler 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.
69
+ *
70
+ * **Good for**
71
+ * - Automation and batch processing
72
+ * - Adding video upscaler into apps, pipelines, or tools
73
+ *
74
+ * **How it works (3 steps)**
75
+ * 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`.
76
+ * 2) Send a request to create a video upscaler job with the basic fields.
77
+ * 3) Check the job status until it's `complete`, then download the result from `downloads`.
78
+ *
79
+ * **Key options**
80
+ * - Inputs: usually a file, sometimes a YouTube link, depending on project type
81
+ * - Resolution: output size and plan requirements vary by workflow and model. Some workflows derive output size from the input video.
82
+ * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
83
+ *
84
+ * **Cost**
85
+ * Credits are charged when the job is queued (`credits_charged` in the response). Tools billed per frame charge an estimate and settle to the frames that actually render once the job finishes; tools billed per second charge the final amount upfront. Failed jobs are refunded.
86
+ *
87
+ * For detailed examples, see the [product page](https://magichour.ai/products/video-upscaler).
88
+ *
89
+ * POST /v1/ai-video-upscaler
90
+ */
91
+ create(request, opts) {
92
+ return this._client.makeRequest({
93
+ method: "post",
94
+ path: "/v1/ai-video-upscaler",
95
+ auth: ["bearerAuth"],
96
+ contentType: "application/json",
97
+ body: v1_ai_video_upscaler_create_body_1.Schemas$V1AiVideoUpscalerCreateBody.out.parse(request),
98
+ responseSchema: v1_ai_video_upscaler_create_response_1.Schemas$V1AiVideoUpscalerCreateResponse.in,
99
+ opts,
100
+ });
101
+ }
102
+ }
103
+ exports.AiVideoUpscalerClient = AiVideoUpscalerClient;
@@ -76,7 +76,7 @@ export declare class AudioToVideoClient extends CoreResourceClient {
76
76
  * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
77
77
  *
78
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.
79
+ * Credits are charged when the job is queued (`credits_charged` in the response). Tools billed per frame charge an estimate and settle to the frames that actually render once the job finishes; tools billed per second charge the final amount upfront. Failed jobs are refunded.
80
80
  *
81
81
  * For detailed examples, see the [product page](https://magichour.ai/products/audio-to-video).
82
82
  *
@@ -113,7 +113,7 @@ class AudioToVideoClient extends make_api_request_js_1.CoreResourceClient {
113
113
  * - Extra fields: e.g. `face_swap_mode`, `start_seconds`/`end_seconds`, or a text prompt
114
114
  *
115
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.
116
+ * Credits are charged when the job is queued (`credits_charged` in the response). Tools billed per frame charge an estimate and settle to the frames that actually render once the job finishes; tools billed per second charge the final amount upfront. Failed jobs are refunded.
117
117
  *
118
118
  * For detailed examples, see the [product page](https://magichour.ai/products/audio-to-video).
119
119
  *