magic-hour 0.60.0 → 0.61.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 (30) 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-generator/request-types.d.ts +1 -1
  5. package/dist/resources/v1/body-swap/index.d.ts +2 -0
  6. package/dist/resources/v1/body-swap/index.js +5 -0
  7. package/dist/resources/v1/body-swap/request-types.d.ts +33 -0
  8. package/dist/resources/v1/body-swap/request-types.js +76 -0
  9. package/dist/resources/v1/body-swap/resource-client.d.ts +64 -0
  10. package/dist/resources/v1/body-swap/resource-client.js +105 -0
  11. package/dist/resources/v1/image-to-video/request-types.d.ts +1 -1
  12. package/dist/resources/v1/index.d.ts +1 -0
  13. package/dist/resources/v1/index.js +2 -1
  14. package/dist/resources/v1/resource-client.d.ts +3 -0
  15. package/dist/resources/v1/resource-client.js +5 -0
  16. package/dist/resources/v1/text-to-video/request-types.d.ts +1 -1
  17. package/dist/types/index.d.ts +4 -0
  18. package/dist/types/v1-ai-image-generator-create-body-model-enum.d.ts +1 -1
  19. package/dist/types/v1-ai-image-generator-create-body.d.ts +1 -1
  20. package/dist/types/v1-body-swap-create-body-assets.d.ts +37 -0
  21. package/dist/types/v1-body-swap-create-body-assets.js +71 -0
  22. package/dist/types/v1-body-swap-create-body-resolution-enum.d.ts +4 -0
  23. package/dist/types/v1-body-swap-create-body-resolution-enum.js +2 -0
  24. package/dist/types/v1-body-swap-create-body.d.ts +33 -0
  25. package/dist/types/v1-body-swap-create-body.js +76 -0
  26. package/dist/types/v1-body-swap-create-response.d.ts +34 -0
  27. package/dist/types/v1-body-swap-create-response.js +75 -0
  28. package/dist/types/v1-image-to-video-create-body.d.ts +1 -1
  29. package/dist/types/v1-text-to-video-create-body.d.ts +1 -1
  30. package/package.json +1 -1
package/README.md CHANGED
@@ -277,6 +277,11 @@ Valid values are: `none`, `error`, `warn`, `info`, `debug` (case insensitive). I
277
277
  - [create](src/resources/v1/auto-subtitle-generator/README.md#create) - Auto Subtitle Generator
278
278
  - [generate](src/resources/v1/auto-subtitle-generator/README.md#generate) - Auto Subtitle Generator Generate Workflow
279
279
 
280
+ ### [v1.bodySwap](src/resources/v1/body-swap/README.md)
281
+
282
+ - [create](src/resources/v1/body-swap/README.md#create) - Body Swap
283
+ - [generate](src/resources/v1/body-swap/README.md#generate) - Body Swap Generate Workflow
284
+
280
285
  ### [v1.faceDetection](src/resources/v1/face-detection/README.md)
281
286
 
282
287
  - [create](src/resources/v1/face-detection/README.md#create) - Face Detection
@@ -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.61.1"
3
+ MockServer = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.62.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.61.1";
7
+ Environment["MockServer"] = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.62.0";
8
8
  })(Environment || (exports.Environment = Environment = {}));
@@ -36,7 +36,7 @@ export type CreateRequest = {
36
36
  * - `nano-banana-2` - from 100 credits/image
37
37
  * - Supported resolutions: 640px, 1k, 2k, 4k
38
38
  * - Available for tiers: free, creator, pro, business
39
- * - Image count allowed: 1, 2, 3, 4
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
@@ -0,0 +1,2 @@
1
+ export { CreateRequest } from "./request-types";
2
+ export { BodySwapClient } from "./resource-client";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BodySwapClient = void 0;
4
+ var resource_client_1 = require("./resource-client");
5
+ Object.defineProperty(exports, "BodySwapClient", { enumerable: true, get: function () { return resource_client_1.BodySwapClient; } });
@@ -0,0 +1,33 @@
1
+ import * as z from "zod";
2
+ import { External$V1BodySwapCreateBodyAssets, V1BodySwapCreateBodyAssets } from "../../../types/v1-body-swap-create-body-assets";
3
+ /**
4
+ * CreateRequest
5
+ */
6
+ export type CreateRequest = {
7
+ /**
8
+ * Person image and scene image for body swap
9
+ */
10
+ assets: V1BodySwapCreateBodyAssets;
11
+ /**
12
+ * Give your image a custom name for easy identification.
13
+ */
14
+ name?: string | undefined;
15
+ /**
16
+ * Output resolution. Determines credits charged for the run.
17
+ */
18
+ resolution: "1k" | "2k" | "4k" | "640px";
19
+ };
20
+ /**
21
+ * @internal
22
+ * CreateRequest without any key transformation, this is what
23
+ * we expect to come in as network data
24
+ */
25
+ export type External$CreateRequest = {
26
+ assets: External$V1BodySwapCreateBodyAssets;
27
+ name?: string | undefined;
28
+ resolution: "1k" | "2k" | "4k" | "640px";
29
+ };
30
+ export declare const Schemas$CreateRequest: {
31
+ in: z.ZodType<CreateRequest, z.ZodTypeDef, unknown>;
32
+ out: z.ZodType<External$CreateRequest, z.ZodTypeDef, CreateRequest>;
33
+ };
@@ -0,0 +1,76 @@
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_body_swap_create_body_assets_1 = require("../../../types/v1-body-swap-create-body-assets");
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_body_swap_create_body_assets_1.Schemas$V1BodySwapCreateBodyAssets.in,
46
+ name: z.string().optional(),
47
+ resolution: z.enum(["1k", "2k", "4k", "640px"]),
48
+ })
49
+ .transform((obj) => {
50
+ return (0, make_api_request_js_1.zodTransform)(obj, {
51
+ assets: "assets",
52
+ name: "name",
53
+ resolution: "resolution",
54
+ });
55
+ });
56
+ /**
57
+ * @internal
58
+ * Takes typescript data, validates it, and maps keys to match the expected external object External$CreateRequest
59
+ */
60
+ const SchemaOut$CreateRequest = z
61
+ .object({
62
+ assets: v1_body_swap_create_body_assets_1.Schemas$V1BodySwapCreateBodyAssets.out,
63
+ name: z.string().optional(),
64
+ resolution: z.enum(["1k", "2k", "4k", "640px"]),
65
+ })
66
+ .transform((obj) => {
67
+ return (0, make_api_request_js_1.zodTransform)(obj, {
68
+ assets: "assets",
69
+ name: "name",
70
+ resolution: "resolution",
71
+ });
72
+ });
73
+ exports.Schemas$CreateRequest = {
74
+ in: SchemaIn$CreateRequest,
75
+ out: SchemaOut$CreateRequest,
76
+ };
@@ -0,0 +1,64 @@
1
+ import { ApiPromise, CoreClient, CoreResourceClient, RequestOptions, ResourceClientOptions } from "make-api-request-js";
2
+ import { GenerateOptions, GenerateRequestType } from "../../../helpers/generate-type";
3
+ import * as requests from "../../../resources/v1/body-swap/request-types";
4
+ import * as types from "../../../types";
5
+ type GenerateRequest = GenerateRequestType<requests.CreateRequest, {
6
+ /**
7
+ * Image of the person to place into the scene. This value is either
8
+ * - a direct URL to the image 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
+ personFilePath: string;
14
+ /**
15
+ * Target scene image (background). 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
+ sceneFilePath: string;
22
+ }>;
23
+ export declare class BodySwapClient extends CoreResourceClient {
24
+ constructor(coreClient: CoreClient, opts: ResourceClientOptions);
25
+ /**
26
+ * Body Swap
27
+ *
28
+ * Swap a person into a scene image using Nano Banana 2. Credits depend on `resolution` (from 100 credits at 640px upward).
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.bodySwap.generate(
38
+ * {
39
+ * assets: {
40
+ * personFilePath: "/path/to/person.png",
41
+ * sceneFilePath: "/path/to/scene.png",
42
+ * },
43
+ * name: "My Body Swap image",
44
+ * resolution: "1k",
45
+ * },
46
+ * {
47
+ * waitForCompletion: true,
48
+ * downloadOutputs: true,
49
+ * downloadDirectory: ".",
50
+ * },
51
+ * );
52
+ * ```
53
+ */
54
+ generate(request: GenerateRequest, opts?: GenerateOptions): Promise<import("../image-projects/resource-client").V1ImageProjectsGetResponseWithDownloads>;
55
+ /**
56
+ * Body Swap
57
+ *
58
+ * Swap a person into a scene image using Nano Banana 2. Credits depend on `resolution` (from 100 credits at 640px upward).
59
+ *
60
+ * POST /v1/body-swap
61
+ */
62
+ create(request: requests.CreateRequest, opts?: RequestOptions): ApiPromise<types.V1BodySwapCreateResponse>;
63
+ }
64
+ export {};
@@ -0,0 +1,105 @@
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.BodySwapClient = 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 image_projects_1 = require("../../../resources/v1/image-projects");
28
+ const v1_body_swap_create_body_1 = require("../../../types/v1-body-swap-create-body");
29
+ const v1_body_swap_create_response_1 = require("../../../types/v1-body-swap-create-response");
30
+ class BodySwapClient extends make_api_request_js_1.CoreResourceClient {
31
+ constructor(coreClient, opts) {
32
+ super(coreClient, opts);
33
+ }
34
+ /**
35
+ * Body Swap
36
+ *
37
+ * Swap a person into a scene image using Nano Banana 2. Credits depend on `resolution` (from 100 credits at 640px upward).
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.bodySwap.generate(
47
+ * {
48
+ * assets: {
49
+ * personFilePath: "/path/to/person.png",
50
+ * sceneFilePath: "/path/to/scene.png",
51
+ * },
52
+ * name: "My Body Swap image",
53
+ * resolution: "1k",
54
+ * },
55
+ * {
56
+ * waitForCompletion: true,
57
+ * downloadOutputs: true,
58
+ * downloadDirectory: ".",
59
+ * },
60
+ * );
61
+ * ```
62
+ */
63
+ generate(request_1) {
64
+ return __awaiter(this, arguments, void 0, function* (request, opts = {}) {
65
+ const { waitForCompletion = true, downloadOutputs = true, downloadDirectory = undefined } = opts, createOpts = __rest(opts, ["waitForCompletion", "downloadOutputs", "downloadDirectory"]);
66
+ const fileClient = new files_1.FilesClient(this._client, this._opts);
67
+ const _a = request.assets, { personFilePath, sceneFilePath } = _a, restAssets = __rest(_a, ["personFilePath", "sceneFilePath"]);
68
+ (0, logger_1.getLogger)().debug(`Uploading file ${personFilePath} to Magic Hour's storage`);
69
+ (0, logger_1.getLogger)().debug(`Uploading file ${sceneFilePath} to Magic Hour's storage`);
70
+ const [uploadedPersonFilePath, uploadedSceneFilePath] = yield Promise.all([
71
+ fileClient.uploadFile(personFilePath),
72
+ fileClient.uploadFile(sceneFilePath),
73
+ ]);
74
+ (0, logger_1.getLogger)().info(`Uploaded file ${personFilePath} to Magic Hour's storage as ${uploadedPersonFilePath}`);
75
+ (0, logger_1.getLogger)().info(`Uploaded file ${sceneFilePath} to Magic Hour's storage as ${uploadedSceneFilePath}`);
76
+ const createResponse = yield this.create(Object.assign(Object.assign({}, request), { assets: Object.assign(Object.assign({}, restAssets), { personFilePath: uploadedPersonFilePath, sceneFilePath: uploadedSceneFilePath }) }), createOpts);
77
+ (0, logger_1.getLogger)().info(`Created BodySwapClient project ${createResponse.id}`);
78
+ const projectsClient = new image_projects_1.ImageProjectsClient(this._client, this._opts);
79
+ (0, logger_1.getLogger)().debug(`Checking result for BodySwapClient project ${createResponse.id}`);
80
+ const result = yield projectsClient.checkResult({ id: createResponse.id }, Object.assign({ waitForCompletion,
81
+ downloadOutputs,
82
+ downloadDirectory }, createOpts));
83
+ return result;
84
+ });
85
+ }
86
+ /**
87
+ * Body Swap
88
+ *
89
+ * Swap a person into a scene image using Nano Banana 2. Credits depend on `resolution` (from 100 credits at 640px upward).
90
+ *
91
+ * POST /v1/body-swap
92
+ */
93
+ create(request, opts) {
94
+ return this._client.makeRequest({
95
+ method: "post",
96
+ path: "/v1/body-swap",
97
+ auth: ["bearerAuth"],
98
+ contentType: "application/json",
99
+ body: v1_body_swap_create_body_1.Schemas$V1BodySwapCreateBody.out.parse(request),
100
+ responseSchema: v1_body_swap_create_response_1.Schemas$V1BodySwapCreateResponse.in,
101
+ opts,
102
+ });
103
+ }
104
+ }
105
+ exports.BodySwapClient = BodySwapClient;
@@ -16,7 +16,7 @@ export type CreateRequest = {
16
16
  * * **`ltx-2`**: Automatically included with no extra credits
17
17
  * * **`wan-2.2`**: Not supported
18
18
  * * **`seedance`**: Not supported
19
- * * **`seedance-2.0`**: Not supported
19
+ * * **`seedance-2.0`**: Automatically included with no extra credits
20
20
  * * **`kling-2.5`**: Automatically included with no extra credits
21
21
  * * **`kling-3.0`**: Toggle-able (can enable/disable)
22
22
  * * **`sora-2`**: Automatically included with no extra credits
@@ -13,6 +13,7 @@ export * as aiVoiceGenerator from "./ai-voice-generator";
13
13
  export * as animation from "./animation";
14
14
  export * as audioProjects from "./audio-projects";
15
15
  export * as autoSubtitleGenerator from "./auto-subtitle-generator";
16
+ export * as bodySwap from "./body-swap";
16
17
  export * as faceDetection from "./face-detection";
17
18
  export * as faceSwap from "./face-swap";
18
19
  export * as faceSwapPhoto from "./face-swap-photo";
@@ -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.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.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"));
@@ -49,6 +49,7 @@ exports.aiVoiceGenerator = __importStar(require("./ai-voice-generator"));
49
49
  exports.animation = __importStar(require("./animation"));
50
50
  exports.audioProjects = __importStar(require("./audio-projects"));
51
51
  exports.autoSubtitleGenerator = __importStar(require("./auto-subtitle-generator"));
52
+ exports.bodySwap = __importStar(require("./body-swap"));
52
53
  exports.faceDetection = __importStar(require("./face-detection"));
53
54
  exports.faceSwap = __importStar(require("./face-swap"));
54
55
  exports.faceSwapPhoto = __importStar(require("./face-swap-photo"));
@@ -14,6 +14,7 @@ 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
16
  import { AutoSubtitleGeneratorClient } from "../../resources/v1/auto-subtitle-generator";
17
+ import { BodySwapClient } from "../../resources/v1/body-swap";
17
18
  import { FaceDetectionClient } from "../../resources/v1/face-detection";
18
19
  import { FaceSwapClient } from "../../resources/v1/face-swap";
19
20
  import { FaceSwapPhotoClient } from "../../resources/v1/face-swap-photo";
@@ -28,6 +29,7 @@ import { TextToVideoClient } from "../../resources/v1/text-to-video";
28
29
  import { VideoProjectsClient } from "../../resources/v1/video-projects";
29
30
  import { VideoToVideoClient } from "../../resources/v1/video-to-video";
30
31
  export declare class V1Client extends CoreResourceClient {
32
+ private _bodySwapLazy?;
31
33
  private _headSwapLazy?;
32
34
  private _aiVoiceClonerLazy?;
33
35
  private _audioProjectsLazy?;
@@ -85,4 +87,5 @@ export declare class V1Client extends CoreResourceClient {
85
87
  get audioProjects(): AudioProjectsClient;
86
88
  get aiVoiceCloner(): AiVoiceClonerClient;
87
89
  get headSwap(): HeadSwapClient;
90
+ get bodySwap(): BodySwapClient;
88
91
  }
@@ -21,6 +21,7 @@ class V1Client extends make_api_request_js_1.CoreResourceClient {
21
21
  this.animation;
22
22
  this.audioProjects;
23
23
  this.autoSubtitleGenerator;
24
+ this.bodySwap;
24
25
  this.faceDetection;
25
26
  this.faceSwap;
26
27
  this.faceSwapPhoto;
@@ -171,5 +172,9 @@ class V1Client extends make_api_request_js_1.CoreResourceClient {
171
172
  var _a;
172
173
  return ((_a = this._headSwapLazy) !== null && _a !== void 0 ? _a : (this._headSwapLazy = new (require("./head-swap").HeadSwapClient)(this._client, this._opts)));
173
174
  }
175
+ get bodySwap() {
176
+ var _a;
177
+ return ((_a = this._bodySwapLazy) !== null && _a !== void 0 ? _a : (this._bodySwapLazy = new (require("./body-swap").BodySwapClient)(this._client, this._opts)));
178
+ }
174
179
  }
175
180
  exports.V1Client = V1Client;
@@ -28,7 +28,7 @@ export type CreateRequest = {
28
28
  * * **`ltx-2`**: Automatically included with no extra credits
29
29
  * * **`wan-2.2`**: Not supported
30
30
  * * **`seedance`**: Not supported
31
- * * **`seedance-2.0`**: Not supported
31
+ * * **`seedance-2.0`**: Automatically included with no extra credits
32
32
  * * **`kling-2.5`**: Automatically included with no extra credits
33
33
  * * **`kling-3.0`**: Toggle-able (can enable/disable)
34
34
  * * **`sora-2`**: Automatically included with no extra credits
@@ -74,6 +74,10 @@ export { V1AutoSubtitleGeneratorCreateBodyStyle } from "./v1-auto-subtitle-gener
74
74
  export { V1AutoSubtitleGeneratorCreateBodyStyleCustomConfig } from "./v1-auto-subtitle-generator-create-body-style-custom-config";
75
75
  export { V1AutoSubtitleGeneratorCreateBodyStyleTemplateEnum } from "./v1-auto-subtitle-generator-create-body-style-template-enum";
76
76
  export { V1AutoSubtitleGeneratorCreateResponse } from "./v1-auto-subtitle-generator-create-response";
77
+ export { V1BodySwapCreateBody } from "./v1-body-swap-create-body";
78
+ export { V1BodySwapCreateBodyAssets } from "./v1-body-swap-create-body-assets";
79
+ export { V1BodySwapCreateBodyResolutionEnum } from "./v1-body-swap-create-body-resolution-enum";
80
+ export { V1BodySwapCreateResponse } from "./v1-body-swap-create-response";
77
81
  export { V1FaceDetectionCreateBody } from "./v1-face-detection-create-body";
78
82
  export { V1FaceDetectionCreateBodyAssets } from "./v1-face-detection-create-body-assets";
79
83
  export { V1FaceDetectionCreateResponse } from "./v1-face-detection-create-response";
@@ -22,7 +22,7 @@
22
22
  * - `nano-banana-2` - from 100 credits/image
23
23
  * - Supported resolutions: 640px, 1k, 2k, 4k
24
24
  * - Available for tiers: free, creator, pro, business
25
- * - Image count allowed: 1, 2, 3, 4
25
+ * - Image count allowed: 1, 4, 9, 16
26
26
  * - `nano-banana-pro` - from 150 credits/image
27
27
  * - Supported resolutions: 1k, 2k, 4k
28
28
  * - Available for tiers: creator, pro, business
@@ -36,7 +36,7 @@ export type V1AiImageGeneratorCreateBody = {
36
36
  * - `nano-banana-2` - from 100 credits/image
37
37
  * - Supported resolutions: 640px, 1k, 2k, 4k
38
38
  * - Available for tiers: free, creator, pro, business
39
- * - Image count allowed: 1, 2, 3, 4
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
@@ -0,0 +1,37 @@
1
+ import * as z from "zod";
2
+ /**
3
+ * Person image and scene image for body swap
4
+ */
5
+ export type V1BodySwapCreateBodyAssets = {
6
+ /**
7
+ * Image of the person to place into the scene. This value is either
8
+ * - a direct URL to the video file
9
+ * - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls).
10
+ *
11
+ * See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details.
12
+ *
13
+ */
14
+ personFilePath: string;
15
+ /**
16
+ * Target scene image (background). This value is either
17
+ * - a direct URL to the video file
18
+ * - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls).
19
+ *
20
+ * See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details.
21
+ *
22
+ */
23
+ sceneFilePath: string;
24
+ };
25
+ /**
26
+ * @internal
27
+ * V1BodySwapCreateBodyAssets without any key transformation, this is what
28
+ * we expect to come in as network data
29
+ */
30
+ export type External$V1BodySwapCreateBodyAssets = {
31
+ person_file_path: string;
32
+ scene_file_path: string;
33
+ };
34
+ export declare const Schemas$V1BodySwapCreateBodyAssets: {
35
+ in: z.ZodType<V1BodySwapCreateBodyAssets, z.ZodTypeDef, unknown>;
36
+ out: z.ZodType<External$V1BodySwapCreateBodyAssets, z.ZodTypeDef, V1BodySwapCreateBodyAssets>;
37
+ };
@@ -0,0 +1,71 @@
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$V1BodySwapCreateBodyAssets = void 0;
37
+ const make_api_request_js_1 = require("make-api-request-js");
38
+ const z = __importStar(require("zod"));
39
+ /**
40
+ * Takes network data, validates it, and transforms keys to match typescript object V1BodySwapCreateBodyAssets
41
+ */
42
+ const SchemaIn$V1BodySwapCreateBodyAssets = z
43
+ .object({
44
+ person_file_path: z.string(),
45
+ scene_file_path: z.string(),
46
+ })
47
+ .transform((obj) => {
48
+ return (0, make_api_request_js_1.zodTransform)(obj, {
49
+ person_file_path: "personFilePath",
50
+ scene_file_path: "sceneFilePath",
51
+ });
52
+ });
53
+ /**
54
+ * @internal
55
+ * Takes typescript data, validates it, and maps keys to match the expected external object External$V1BodySwapCreateBodyAssets
56
+ */
57
+ const SchemaOut$V1BodySwapCreateBodyAssets = z
58
+ .object({
59
+ personFilePath: z.string(),
60
+ sceneFilePath: z.string(),
61
+ })
62
+ .transform((obj) => {
63
+ return (0, make_api_request_js_1.zodTransform)(obj, {
64
+ personFilePath: "person_file_path",
65
+ sceneFilePath: "scene_file_path",
66
+ });
67
+ });
68
+ exports.Schemas$V1BodySwapCreateBodyAssets = {
69
+ in: SchemaIn$V1BodySwapCreateBodyAssets,
70
+ out: SchemaOut$V1BodySwapCreateBodyAssets,
71
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Output resolution. Determines credits charged for the run.
3
+ */
4
+ export type V1BodySwapCreateBodyResolutionEnum = "1k" | "2k" | "4k" | "640px";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,33 @@
1
+ import * as z from "zod";
2
+ import { External$V1BodySwapCreateBodyAssets, V1BodySwapCreateBodyAssets } from "./v1-body-swap-create-body-assets";
3
+ /**
4
+ * V1BodySwapCreateBody
5
+ */
6
+ export type V1BodySwapCreateBody = {
7
+ /**
8
+ * Person image and scene image for body swap
9
+ */
10
+ assets: V1BodySwapCreateBodyAssets;
11
+ /**
12
+ * Give your image a custom name for easy identification.
13
+ */
14
+ name?: string | undefined;
15
+ /**
16
+ * Output resolution. Determines credits charged for the run.
17
+ */
18
+ resolution: "1k" | "2k" | "4k" | "640px";
19
+ };
20
+ /**
21
+ * @internal
22
+ * V1BodySwapCreateBody without any key transformation, this is what
23
+ * we expect to come in as network data
24
+ */
25
+ export type External$V1BodySwapCreateBody = {
26
+ assets: External$V1BodySwapCreateBodyAssets;
27
+ name?: string | undefined;
28
+ resolution: "1k" | "2k" | "4k" | "640px";
29
+ };
30
+ export declare const Schemas$V1BodySwapCreateBody: {
31
+ in: z.ZodType<V1BodySwapCreateBody, z.ZodTypeDef, unknown>;
32
+ out: z.ZodType<External$V1BodySwapCreateBody, z.ZodTypeDef, V1BodySwapCreateBody>;
33
+ };
@@ -0,0 +1,76 @@
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$V1BodySwapCreateBody = void 0;
37
+ const make_api_request_js_1 = require("make-api-request-js");
38
+ const z = __importStar(require("zod"));
39
+ const v1_body_swap_create_body_assets_1 = require("./v1-body-swap-create-body-assets");
40
+ /**
41
+ * Takes network data, validates it, and transforms keys to match typescript object V1BodySwapCreateBody
42
+ */
43
+ const SchemaIn$V1BodySwapCreateBody = z
44
+ .object({
45
+ assets: v1_body_swap_create_body_assets_1.Schemas$V1BodySwapCreateBodyAssets.in,
46
+ name: z.string().optional(),
47
+ resolution: z.enum(["1k", "2k", "4k", "640px"]),
48
+ })
49
+ .transform((obj) => {
50
+ return (0, make_api_request_js_1.zodTransform)(obj, {
51
+ assets: "assets",
52
+ name: "name",
53
+ resolution: "resolution",
54
+ });
55
+ });
56
+ /**
57
+ * @internal
58
+ * Takes typescript data, validates it, and maps keys to match the expected external object External$V1BodySwapCreateBody
59
+ */
60
+ const SchemaOut$V1BodySwapCreateBody = z
61
+ .object({
62
+ assets: v1_body_swap_create_body_assets_1.Schemas$V1BodySwapCreateBodyAssets.out,
63
+ name: z.string().optional(),
64
+ resolution: z.enum(["1k", "2k", "4k", "640px"]),
65
+ })
66
+ .transform((obj) => {
67
+ return (0, make_api_request_js_1.zodTransform)(obj, {
68
+ assets: "assets",
69
+ name: "name",
70
+ resolution: "resolution",
71
+ });
72
+ });
73
+ exports.Schemas$V1BodySwapCreateBody = {
74
+ in: SchemaIn$V1BodySwapCreateBody,
75
+ out: SchemaOut$V1BodySwapCreateBody,
76
+ };
@@ -0,0 +1,34 @@
1
+ import * as z from "zod";
2
+ /**
3
+ * Success
4
+ */
5
+ export type V1BodySwapCreateResponse = {
6
+ /**
7
+ * The amount of credits deducted from your account to generate the image. We charge credits right when the request is made.
8
+ *
9
+ * If an error occurred while generating the image(s), credits will be refunded and this field will be updated to include the refund.
10
+ */
11
+ creditsCharged: number;
12
+ /**
13
+ * Deprecated: Previously represented the number of frames (original name of our credit system) used for image generation. Use 'credits_charged' instead.
14
+ */
15
+ frameCost: number;
16
+ /**
17
+ * Unique ID of the image. Use it with the [Get image Project API](https://docs.magichour.ai/api-reference/image-projects/get-image-details) to fetch status and downloads.
18
+ */
19
+ id: string;
20
+ };
21
+ /**
22
+ * @internal
23
+ * V1BodySwapCreateResponse without any key transformation, this is what
24
+ * we expect to come in as network data
25
+ */
26
+ export type External$V1BodySwapCreateResponse = {
27
+ credits_charged: number;
28
+ frame_cost: number;
29
+ id: string;
30
+ };
31
+ export declare const Schemas$V1BodySwapCreateResponse: {
32
+ in: z.ZodType<V1BodySwapCreateResponse, z.ZodTypeDef, unknown>;
33
+ out: z.ZodType<External$V1BodySwapCreateResponse, z.ZodTypeDef, V1BodySwapCreateResponse>;
34
+ };
@@ -0,0 +1,75 @@
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$V1BodySwapCreateResponse = void 0;
37
+ const make_api_request_js_1 = require("make-api-request-js");
38
+ const z = __importStar(require("zod"));
39
+ /**
40
+ * Takes network data, validates it, and transforms keys to match typescript object V1BodySwapCreateResponse
41
+ */
42
+ const SchemaIn$V1BodySwapCreateResponse = z
43
+ .object({
44
+ credits_charged: z.number().int(),
45
+ frame_cost: z.number().int(),
46
+ id: z.string(),
47
+ })
48
+ .transform((obj) => {
49
+ return (0, make_api_request_js_1.zodTransform)(obj, {
50
+ credits_charged: "creditsCharged",
51
+ frame_cost: "frameCost",
52
+ id: "id",
53
+ });
54
+ });
55
+ /**
56
+ * @internal
57
+ * Takes typescript data, validates it, and maps keys to match the expected external object External$V1BodySwapCreateResponse
58
+ */
59
+ const SchemaOut$V1BodySwapCreateResponse = z
60
+ .object({
61
+ creditsCharged: z.number().int(),
62
+ frameCost: z.number().int(),
63
+ id: z.string(),
64
+ })
65
+ .transform((obj) => {
66
+ return (0, make_api_request_js_1.zodTransform)(obj, {
67
+ creditsCharged: "credits_charged",
68
+ frameCost: "frame_cost",
69
+ id: "id",
70
+ });
71
+ });
72
+ exports.Schemas$V1BodySwapCreateResponse = {
73
+ in: SchemaIn$V1BodySwapCreateResponse,
74
+ out: SchemaOut$V1BodySwapCreateResponse,
75
+ };
@@ -16,7 +16,7 @@ export type V1ImageToVideoCreateBody = {
16
16
  * * **`ltx-2`**: Automatically included with no extra credits
17
17
  * * **`wan-2.2`**: Not supported
18
18
  * * **`seedance`**: Not supported
19
- * * **`seedance-2.0`**: Not supported
19
+ * * **`seedance-2.0`**: Automatically included with no extra credits
20
20
  * * **`kling-2.5`**: Automatically included with no extra credits
21
21
  * * **`kling-3.0`**: Toggle-able (can enable/disable)
22
22
  * * **`sora-2`**: Automatically included with no extra credits
@@ -28,7 +28,7 @@ export type V1TextToVideoCreateBody = {
28
28
  * * **`ltx-2`**: Automatically included with no extra credits
29
29
  * * **`wan-2.2`**: Not supported
30
30
  * * **`seedance`**: Not supported
31
- * * **`seedance-2.0`**: Not supported
31
+ * * **`seedance-2.0`**: Automatically included with no extra credits
32
32
  * * **`kling-2.5`**: Automatically included with no extra credits
33
33
  * * **`kling-3.0`**: Toggle-able (can enable/disable)
34
34
  * * **`sora-2`**: Automatically included with no extra credits
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "magic-hour",
3
- "version": "0.60.0",
3
+ "version": "0.61.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {